Bug 202169 - [compiler] Static import of supertype reported as unused
Summary: [compiler] Static import of supertype reported as unused
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-04 11:38 EDT by Felis Cattus CLA
Modified: 2007-09-28 04:37 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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