[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jdt-core-dev] Possible bug in Binding2JavaModel.findCompilationUnit()
|
Enter a bug report against JDT/UI with steps to reproduce. It is too late
to fix this in 2.1. It will be investigated for 2.2 if this is a bug.
"Dr. Robert M.
Fuhrer" To: jdt-core-dev@xxxxxxxxxxx
<rfuhrer@xxxxxxxxxx cc:
.com> Subject: [jdt-core-dev] Possible bug in Binding2JavaModel.findCompilationUnit()
Sent by:
jdt-core-dev-admin@
eclipse.org
03/27/03 01:49 PM
Please respond to
jdt-core-dev
I may have found a bug in
Binding2JavaModel.findCompilationUnit(ITypeBinding, IJavaProject)
For the code sequence
ICompilationUnit cu = <refers to "Test.java">;
MethodDeclaration decl = <refers to X.foo()>;
ASTNode parent = decl.getParent();
TypeDeclaration type = (TypeDeclaration) parent;
ICompilationUnit declUnit =
Binding2JavaModel.findCompilationUnit(type.resolveBinding(),
fCu.getJavaProject());
when run in the context of the following *single* compilation unit,
findCompilationUnit() returns null. Note the non-public top-level class,
which the Eclipse Java compiler handles properly, but which I suspect
is the cause of the problem. I verified in the debugger the claims given
in <>'s regarding the nature of the entities to which cu and decl refer.
public class Test {
public static void main(String[] args) {
String s = (String) new X().foo();
}
}
class X {
public Object foo() { return new String(); }
}
I don't think findCompilationUnit() should be returning null in this case.
Am I wrong in thinking that? If I am wrong, how can I find the compilation
unit containing such a class?
===================================================
Dr. Robert M. Fuhrer, rfuhrer@xxxxxxxxxxxxxx
IBM T.J. Watson Research Center