For the following code,
import java.util.ArrayList;
public class MultiClassWithOverloadedMethods {
public static void main(String[] args) {
A x = new A();
int i = 10;
while(i>0) {
x = x.foo(new B());
i--;
}
AnotherClass an = new AnotherClass();
an.foo();
}
}
class AnotherClass {
public AnotherClass() {
}
public void anotherFoo() {
A b = new B();
A d = b.foo(new D());
}
public int foo() {
int haha = 1;
A x = new D();
x.foo(new C());
return haha;
}
}
class A {
A foo(A x) {
return x;
}
}
class B extends A {
A foo(A x) {
return new D();
}
}
class D extends A {
A foo(A x) {
A b = new B();
b.foo(x);
return new A();
}
A foo(A x, ArrayList<A> y) {
return x;
}
}
class C extends A {
A foo(A x) {
D y = new D();
y.foo(x);
return this;
}
}
For the _expression_
b.foo(new D())
we get the following binding in some cases
(id=NoId)
class A
extends java.lang.Object
/* methods */
[unresolved] non-sealed void <init>()
and we get this in some other cases.
[MISSING:A]
Here is the code I am using.
IBinding nodeBinding = node.resolveBinding();
where node is a SimpleName. Then checking that the IBinding is of IVariableBinding and then doing ths
ITypeBinding typeBinding = ((IVariableBinding)nodeBinding).getType();
How can the result be made consistent? Note, I have to run my code on the Eclipse IDE (With build ID: 20250905-1456) using the debug mode to get the variation. While using eclipse in a normal run, I am always getting the second missing binding.
Thoughts?
Thanks.
Dr. Munawar HafizFounder and CEO,OpenRefactory, Inc.,