This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Should old stuff be removed from a future Java version?

 
Tony Docherty
Bartender
Pie
Posts: 2878
59
  • 1
  • Mark post as helpful
  • send pies
  • 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.
 
Jayesh A Lalwani
Rancher
Pie
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic