Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Should old stuff be removed from a future Java version?

Posts: 3323
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:You are probably too young to understand public class LSD extends Money.

Unfortunately (or should that be fortunately) not.

Matthew Brown wrote:In other words, would it be a problem to return legacy types as long as they were never referred to as that type?

An interesting point.
Any restrictions on what could be returned would have to be compiler and not runtime restrictions so you would have to allow legacy classes to be returned if referred to by an implemented interface.
Another issue is if a class is marked as Legacy what happens to any class that extends it.
Posts: 2759
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I think the Java 7 code should be able to return objects of legacy classes via an supported interface. The idea is to break the dependency between Java 7 code and deprecated API. As long as the exposed type is supported in Java 7, there's shouldn't be a problem. It shouldn't matter that the object that extends/implements a deprecated type

Of course there will be backdoors. The Java 7 code will be able to use reflection to call Java 6 methods. But, if someone is dumb or desperate enough to write new code that uses a backdoor takes the risk that they will require rework when they upgrade their 3rd party libraries.
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic