Bug 166057 - Eclipse should be able to use the @version javadoc tag to warn when using class of methods present only in upper versions
Summary: Eclipse should be able to use the @version javadoc tag to warn when using cla...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-28 09:19 EST by Baptiste Mathus CLA
Modified: 2006-12-14 22:40 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Baptiste Mathus CLA 2006-11-28 09:19:02 EST
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.
Comment 1 Olivier Thomann CLA 2006-11-28 09:34:10 EST
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.
Comment 2 Baptiste Mathus CLA 2006-11-28 09:41:50 EST
> 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)
Comment 3 Alex Blewitt CLA 2006-12-05 08:56:54 EST
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.
Comment 4 Olivier Thomann CLA 2006-12-14 22:40:02 EST
(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.