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
Reproduction steps: From twofilesimple test input, remove the Baz.java file and modify the Foo.java file as below:
package com.example;
class Foo {
void bar(Baz b) {
Baz obj = new Baz("hello");
}
}
Execute the command: ./gradlew run --args='--outputDirectory "tempDir" --root "src/test/resources/twofilesimple/input/" --targetFile "com/example/Foo.java" --targetMethod "com.example.Foo#bar(Baz)"'
Exception stack trace:
> Task :run FAILED
Exception in thread "main" java.lang.RuntimeException: Unexpected class: Baz
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:567)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:68)
at com.github.javaparser.ast.body.Parameter.accept(Parameter.java:113)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:1129)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:51)
at com.github.javaparser.ast.NodeList.accept(NodeList.java:277)
at com.github.javaparser.ast.visitor.ModifierVisitor.modifyList(ModifierVisitor.java:1168)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:673)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:498)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:68)
at com.github.javaparser.ast.body.MethodDeclaration.accept(MethodDeclaration.java:98)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:1129)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:51)
at com.github.javaparser.ast.NodeList.accept(NodeList.java:277)
at com.github.javaparser.ast.visitor.ModifierVisitor.modifyList(ModifierVisitor.java:1168)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:243)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:277)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:68)
at com.github.javaparser.ast.body.ClassOrInterfaceDeclaration.accept(ClassOrInterfaceDeclaration.java:92)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:1129)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:51)
at com.github.javaparser.ast.NodeList.accept(NodeList.java:277)
at com.github.javaparser.ast.visitor.ModifierVisitor.modifyList(ModifierVisitor.java:1168)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:306)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:51)
at com.github.javaparser.ast.CompilationUnit.accept(CompilationUnit.java:127)
at org.checkerframework.specimin.SpeciminRunner.performMinimization(SpeciminRunner.java:121)
at org.checkerframework.specimin.SpeciminRunner.main(SpeciminRunner.java:61)
FAILURE: Build failed with an exception.
The text was updated successfully, but these errors were encountered:
The issue originates from the visit method for MethodDeclaration.
Currently, this method raises an exception when encountering an unresolved type that lacks an import statement. However, if the unresolved type is expected to be in the same directory as the input class file, importing it is unnecessary.
@tahiat If you want to solve this bug, let me know. Otherwise I will be happy to do it.
Reproduction steps: From twofilesimple test input, remove the Baz.java file and modify the Foo.java file as below:
Execute the command:
./gradlew run --args='--outputDirectory "tempDir" --root "src/test/resources/twofilesimple/input/" --targetFile "com/example/Foo.java" --targetMethod "com.example.Foo#bar(Baz)"'
Exception stack trace:
The text was updated successfully, but these errors were encountered: