Bug 165081

Summary: [1.5][compiler] Fup of bug 165069, unused imports are not reported
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse
Version: 3.3   
Target Milestone: 3.3 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

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