Bug 28224

Summary: Invalid "Unused Imports" warning when importing inner classes
Product: [Eclipse Project] JDT Reporter: Matthew Conway <matt>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M5   
Hardware: PC   
OS: Windows NT   
Whiteboard:

Description Matthew Conway CLA 2002-12-12 18:15:49 EST
The unused imports warning (Preferences->Java->Compiler->Problem Markers->Unused
Imports) is erroneously shown when one imports _and_ uses a inner class.  e.g.

package com.foo;
public interface Bar
{
    public static class Inner {}
}

package com.baz;
import com.foo.Bar;
import com.foo.Bar.Inner;
public class Baz
{
    Bar b;
    Inner i;
    public Baz()
    {
        i = Inner();
    }
}
Comment 1 Philipe Mulet CLA 2002-12-14 07:30:09 EST
Cannot reproduce with your example (after replacing 'Inner()' with 'new Inner
()').

Which import get flagged as unused ? Which build are you running ?
Does these exact steps reproduce it for you ?
Comment 2 Matthew Conway CLA 2002-12-16 11:00:29 EST
Sorry, my example was typed on the fly and I didn't test it.

Check out the following as a project, and you'll see the warnings where there
shouldn't be any.

:pserver:anonymous@cvs.clearcase-java.sf.net:/cvsroot/clearcase-java
Comment 3 Philipe Mulet CLA 2003-01-08 10:43:06 EST
Got it, cannot see any warning... should I look at something specific ?
Comment 4 Matthew Conway CLA 2003-01-13 10:05:25 EST
Strange, I haven't tried any newer builds, but the problem is exhibiting itself
in my 2.1M4 build.

At the risk of stating the obvious, did you build the project and do you have
any Task filters set, or warning levels turned off in preferences?
You should end up with 3 warnings, 1 each in the ClearcaeCLI/JNI/Dummy classes
Comment 5 Philipe Mulet CLA 2003-01-20 04:21:26 EST
I did all that, and saw nothing reported. Did you try to close/reopen the 
project ? Wondering if this would be an editor artifact, which isn't visible 
when you recreate the project from scratch again.
Comment 6 Philipe Mulet CLA 2003-01-28 09:58:49 EST
Reproduced. Actually, this isn't a bug, you can remove the import safely, since 
you can see the Status member type through its enclosing type which is imported.

Closing