Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Should old stuff be removed from a future Java version?

 
Bartender
Posts: 3323
86
  • Likes 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.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • 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.
 
this is supposed to be a surprise, but it smells like a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!