Community
Participate
Working Groups
Created attachment 122783 [details] Sample class which reproduces the problem Build ID: M20080911-1700 Steps To Reproduce: 1. Create a static class property 2. In the same class, create a static import for that property 3. Annotate the class, and give the unqualified property name as a value for that property At that moment the static import is marked as unused, even though it is used by the annotation. According to the JLS, the annotation value must be a constant expression ( which the plain field name is not, unless statically imported ). More information:
Srikanth - pls have a look at it
Unable to reproduce this: Tested with the following versions: 3.4.1 Build id: M20080911-1700 3.5 M2 Build id: I20080918-0100 3.5 M3 Build id: I20081030-1917 3.5 M4 Build id: I20081211-1908 HEAD I uniformly see only the single diagnostic : Unnecessary @SuppressWarnings("unchecked") SomeTest.java _pasted_code_/src/com line 5 Java Problem Perhaps, some special settings for warnings be in place for this to show up ?
(In reply to comment #2) > Perhaps, some special settings for warnings be in place for this to show up ? In the preferences, please set Java -> Compiler -> Errors/Warnings -> Unnecessary code -> Unused imports to 'Warning'
(In reply to comment #3) > (In reply to comment #2) > > Perhaps, some special settings for warnings be in place for this to show up ? > In the preferences, please set Java -> Compiler -> Errors/Warnings -> > Unnecessary code -> Unused imports to 'Warning' I had assumed that this setting was indeed set to 'Warning' since I had noticed that if I change the test case to // comment out the line containing the SuppressWarnings annotation, I do get a warning about unused static imports. Anyways, I have double checked now that this setting *is* set to Warning. Do you have happen to have any other versions of eclipse lying around that you can quickly check against ? Any of the 3.5 milestone builds of recent vintage ?
Does not show up in I20081211-1908
(In reply to comment #5) > Does not show up in I20081211-1908 Thanks. That is 3.5 M4 build (latest). For closing this as not reproducible, personally I would feel more comfortable if I have a version where it fails and the HEAD version where it passes and then to track the difference down to an intermediate change (either intended or otherwise). I'll ask my team mates and see if any one is able to reproduce it. At a minimum, I can add your test case to the test harness.
Created attachment 123481 [details] Junit Test Test to make sure that alleged warning is not issued. This test passes on HEAD as of now without any attendant code change.
Created attachment 123483 [details] Test patch for 3.4 maintenance branch This test passes on 3.4 top of branch without any attendant code changes. In the event, the defect stays unreproducible, we may as well add the test to 3.4
Re: comment 6 >At a minimum, I can add your test case to the test harness. Very good. Adding a regression test to a closed bug is important, even if we cannot reproduce it (so that we wouldn't start seeing it occur in the future)
Re: patch in comment 7 We normally number our tests in sequence (it should be numbered test267). Also we try to sort all methods alphabetically.
Released test for 3.5M5. Closing as invalid.
Verified for 3.5M5 using I20090126-1300