Bug 202169

Summary: [compiler] Static import of supertype reported as unused
Product: [Eclipse Project] JDT Reporter: Felis Cattus <feles>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: jerome_lanneluc
Version: 3.3   
Target Milestone: 3.4 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Felis Cattus CLA 2007-09-04 11:38:50 EDT
Build ID: I20070809-1105

Steps To Reproduce:
1. Two interfaces - TestInterfaceSub extends TestInterfaceSuper
2. static import of both interfaces into a class that uses constants from both interfaces
3. If the super interface is imported after the sub interface (for example - ordered alphabetically this way by Organize Imports), it is reported as unused.

import static test.TestInterfaceSub.*;
import static test.TestInterfaceSuper.*;

If it is imported (and ordered) after the sub interface - it is not reported as unused.

import static test.TestInterfaceSuper.*;
import static test.TestInterfaceSub.*;


More information:
Comment 1 Kent Johnson CLA 2007-09-10 14:13:56 EDT
This is not a bug.


The constants from TestInterfaceSuper are inherited by TestInterfaceSub, so when the import statements are :

import static test.TestInterfaceSub.*;
import static test.TestInterfaceSuper.*;

The second statement is unused & unnecessary since all constants defined by TestInterfaceSuper are found using 'import static test.TestInterfaceSub.*'.
Comment 2 Jerome Lanneluc CLA 2007-09-18 04:51:17 EDT
Verified for 3.4M2
Comment 3 Felis Cattus CLA 2007-09-28 03:12:30 EDT
OK, it is unused, but how can you fix the warning. Even if you delete it, Organize Imports brings it back. And because I have Organize Imports added as a Save Action, I always have a warning. 

Probably the bug here is that Organize Imports adds it at all.
Comment 4 Jerome Lanneluc CLA 2007-09-28 04:37:26 EDT
(In reply to comment #3)
> Probably the bug here is that Organize Imports adds it at all.
> 
Please open a separate bug report against JDT/UI