Bug 93913 - wrong resolved type caused by a static import
Summary: wrong resolved type caused by a static import
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-06 10:28 EDT by David Audel CLA
Modified: 2005-05-11 10:01 EDT (History)
0 users

See Also:


Attachments

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