You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.ClassCastException: spoon.support.reflect.declaration.CtAnonymousExecutableImpl cannot be cast to spoon.reflect.declaration.CtConstructor
#739
Caused by: java.lang.ClassCastException: spoon.support.reflect.declaration.CtAnonymousExecutableImpl cannot be cast to spoon.reflect.declaration.CtConstructor
at spoon.reflect.factory.ExecutableFactory.createReference(ExecutableFactory.java:109)
at spoon.support.reflect.declaration.CtExecutableImpl.getReference(CtExecutableImpl.java:145)
when parsing the following code:
class Foo {
static {
System.out.println("fooo");
}
}
A test case to reproduce the exception:
public void testSpoon() {
final spoon.Launcher launcher = new spoon.Launcher();
launcher.addInputResource("src/test/resources/java/Foo.java");
launcher.getEnvironment().setNoClasspath(true);
launcher.getEnvironment().setComplianceLevel(8);
launcher.buildModel();
launcher.getModel().getElements(new TypeFilter<CtExecutable<?>>(CtExecutable.class) {
@Override
public boolean matches(final CtExecutable<?> exec) {
try {
System.out.println(exec.getReference());
}catch(ClassCastException ex) {
fail();
}
return super.matches(exec);
}
});
}
The text was updated successfully, but these errors were encountered:
Me, again.
Using 5.2.0, I got a:
when parsing the following code:
A test case to reproduce the exception:
The text was updated successfully, but these errors were encountered: