Community
Participate
Working Groups
Eclipse is able to use a 1.5 JVM a compile 1.4 compatible code. Ideally, when you link source, it should be able to warn if it finds a @version tag. Example : while specifying 1.4 compatibility, we recently used the Thread.getId(), which has an @version 1.5 tag. I did not notice it and we delivered our jar which was still supposed to support 1.4 JVM => crash with nosuchMethodError on some machines :-/. Obviously, I'm perfectly aware that we should be using a real 1.4 JVM if we must be compatible with, but the thing is that we will soon update our requirements to 1.5, so we don't want to change our conf in the meantime. So, to sum up, I think Eclipse could try and use the info "@version" when present. It would not harm :), and it would give an additional opportunity to use the 1.4 "compiler compliance" setting securely... Thanks a lot.
Two limitations: 1) @since doesn't not appear in .class files 2) the javadoc might not be present. What we might want to define would be a "map" file that would contain all available types, fields and methods for a specific version and check the generated .class files with this file.
> 1) @since doesn't not appear in .class files > 2) the javadoc might not be present. Yes, I agree. I wanted to say it, but I forgot. I wanted to precise that this feature could be only available when linking with sources or with javadoc, obviously because javadoc is stored in the bytecode. Maybe there could be an option like : "warn if using upper version methods or classes if possible¹" ¹maybe a tooltip specifying what possible means (i.e. javadoc or source is linked with the jar)
Is there any reason why the @since information couldn't be encoded as a new classfile attribute for Eclipse-compiled stuff? The VM spec allows for arbitrary new information to be dumped in the file as attributes on a class or member basis, and it would seem a useful feature to have.
(In reply to comment #3) > Is there any reason why the @since information couldn't be encoded as a new > classfile attribute for Eclipse-compiled stuff? The VM spec allows for > arbitrary new information to be dumped in the file as attributes on a class or > member basis, and it would seem a useful feature to have. Sure this would be doable, but since we don't recompile the libraries with this new attribute, it makes it useless for the java APIs. And this would be the most important case to cover.