Bug 93913

Summary: wrong resolved type caused by a static import
Product: [Eclipse Project] JDT Reporter: David Audel <david_audel>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description David Audel CLA 2005-05-06 10:28:51 EDT
build N20050506-0010

1) create p/A.java
package p;
public class A {
  public static class B {
    public void fooA() {}
    }
  }
}
2) create q/C.java
package q;
public class C {
  public static class B {
    public void fooC() {}
    }
  }
  public static int B() {return 0;}
}
3) create a/B.java
package a;
public class B {
  public void fooB() {}
  }
}
4) create a/Test.java
package a;
import static q.C.B;
public class Test {
  void foo() {
    int i = B();
    B b = null;
    b.fooA();
    b.fooB();
    b.fooC();
  }
}
5) compile
2 errors appear:
-The method fooA() is undefined for the type B
-The method fooC() is undefined for the type B

6) compile with javac
a\Test.java:9: cannot find symbol
symbol  : method fooA()
location: class q.C.B
                b.fooA();
                 ^
a\Test.java:10: cannot find symbol
symbol  : method fooB()
location: class q.C.B
                b.fooB();
                 ^
2 errors




Remove "public static int B() {return 0;}" fromC.java and new errors are correct.
Comment 1 Kent Johnson CLA 2005-05-06 16:20:59 EDT
Added StaticImport test029

David: I've added a subclass of ImportBinding called ImportConflictBinding.

It holds onto both the methodBinding & the 'hidden' type binding.

You may need to check for it in Code Assist.
Comment 2 Olivier Thomann CLA 2005-05-11 10:01:16 EDT
Verified in I20050510-0010