*
The moose likes Features new in Java 7 and the fly likes Should old stuff be removed from a future Java version? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Features new in Java 7
Bookmark "Should old stuff be removed from a future Java version?" Watch "Should old stuff be removed from a future Java version?" New topic
Author

Should old stuff be removed from a future Java version?

Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2165
    
  47
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.
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2271
    
  28

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.
 
 
subject: Should old stuff be removed from a future Java version?
 
Similar Threads
Purpose of Marker Interface
marker interfaces
Book Needed: Java: The Bad Parts. Anyone want to take a shot at it? James Waldo? Bear? Cameron?
Difference between lang.Enum and util.Enumeration
Clarification on Definition of API