-
-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: StackOverflowError occurred in CtExecutableReference.getExecutableDeclaration #5584
Labels
Comments
When class C is not in the current project, stack overflow will occur in the following test example @Test()
void foo(){
Launcher launcher = new Launcher();
launcher.getEnvironment().setComplianceLevel(11);
launcher.getEnvironment().setAutoImports(true);
launcher.addInputResource(new VirtualFile("" +
"import com.C;\n" +
"import java.util.List;\n" +
"import java.util.function.BiFunction;\n" +
"\n" +
"public class A {\n" +
" public void test( List<? extends C> list, BiFunction<C, B, Boolean> func) {\n" +
" list.stream().forEach(c -> {\n" +
" func.apply(c, null);\n" +
" });\n" +
" }\n" +
"}\n" +
"class B{ }" +
""));
CtModel ctModel = launcher.buildModel();
List<CtExecutableReference> elements = ctModel.getElements(new TypeFilter<>(CtExecutableReference.class));
for (CtExecutableReference element : elements) {
try{
element.getExecutableDeclaration();
}catch(StackOverflowError e){
e.printStackTrace();
}
}
} |
When class C is in the current project, the following test cases are normal @Test()
void foo(){
Launcher launcher = new Launcher();
launcher.getEnvironment().setComplianceLevel(11);
launcher.getEnvironment().setAutoImports(true);
launcher.addInputResource(new VirtualFile("" +
"import java.util.List;\n" +
"import java.util.function.BiFunction;\n" +
"\n" +
"public class A {\n" +
" public void test( List<? extends C> list, BiFunction<C, B, Boolean> func) {\n" +
" list.stream().forEach(c -> {\n" +
" func.apply(c, null);\n" +
" });\n" +
" }\n" +
"}\n" +
"class B{ }class C{}" +
""));
CtModel ctModel = launcher.buildModel();
List<CtExecutableReference> elements = ctModel.getElements(new TypeFilter<>(CtExecutableReference.class));
for (CtExecutableReference element : elements) {
try{
element.getExecutableDeclaration();
}catch(StackOverflowError e){
e.printStackTrace();
}
}
} |
Can anyone answer me if it's actually a bug |
thanks, i suggest you can return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
StackOverflowError occurred in CtExecutableReference.getExecutableDeclaration
Source code you are trying to analyze/transform
Source code for your Spoon processing
Actual output
Expected output
Spoon Version
10.4.3-beta-10
JVM Version
11
What operating system are you using?
windows 11
The text was updated successfully, but these errors were encountered: