Skip to main content

Equip JDK classes with JDK version information annotations

1 reply [Last post]
hlavac
Offline
Joined: 2003-09-16

I'd like if all JDK classes would contain annotations serving the same purpose as the @since javadoc tag in documentation.

Having each published Java API feature annotated with version of Java it was introduced in addition to deprecation status would improve crosscompilation for older JDK verisons.

As it is now, when you want to develop for older JDK using newest JDK, you have to somehow rip the runtime JARs from the old JDK and force the compiler to use them instead of the new ones.

What i suggest would allow simply compiling with -target switch on newest JDK and get compilation errors when trying to use features (classes, methods, fields...) not present in the target JDK version, as the compiler would be able to use the annotations in his classes to check for the existence of the feature in the targetted JDK version
in the same way as it is currently checking for deprecation, and issue a firendly error message about it.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jwenting
Offline
Joined: 2003-12-02

or just keep several compilers installed like the rest of us do and have done for every language we've ever used.