Bug 165081 - [1.5][compiler] Fup of bug 165069, unused imports are not reported
Summary: [1.5][compiler] Fup of bug 165069, unused imports are not reported
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-18 14:39 EST by Olivier Thomann CLA
Modified: 2006-12-11 15:50 EST (History)
1 user (show)

See Also:


Attachments
Proposed patch (1.70 KB, patch)
2006-11-20 08:02 EST, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2006-11-18 14:39:02 EST
Using HEAD, compile this code with -warn:hiding,unused. You'll get two field hiding warnings. Removing the imports fixes it and doesn't report any error. So the two imports are unused and should be reported as is.

package sample;

import static sample.Test.TestEnum.V1;
import static sample.Test.TestEnum.V2;

public class Test<T> {
        public static enum TestEnum {
                V1,
                V2
        }

        public void test(final TestEnum value) {
                switch (value) {
                        case V1:
                        case V2:
                }
        }
}
Comment 1 Philipe Mulet CLA 2006-11-20 07:40:18 EST
Hiding check shouldn't mark import as used, since these are not truly referenced (only a side effect of the hiding check).
Comment 2 Philipe Mulet CLA 2006-11-20 08:02:00 EST
Tuned StaticImportTest#test047-048 + added test049.
Comment 3 Philipe Mulet CLA 2006-11-20 08:02:55 EST
Created attachment 54168 [details]
Proposed patch
Comment 4 Philipe Mulet CLA 2006-11-20 08:05:03 EST
Released for 3.3M4

Fixed
Comment 5 Olivier Thomann CLA 2006-12-11 15:50:18 EST
Verified for 3.3M4 with I20061211-1119