Skip to content
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

UnresolvedSymbolException during method minimization - NodeList<ImportDeclaration> #40

Closed
jonathan-m-phillips opened this issue Nov 12, 2023 · 4 comments
Assignees

Comments

@jonathan-m-phillips
Copy link
Collaborator

jonathan-m-phillips commented Nov 12, 2023

I'm encountering an UnsolvedSymbolException when running Specimin on a method with the signature org.checkerframework.specimin.UnsolvedSymbolVisitor#setImportStatement(NodeList). Below are the arguments passed to Specimin and the stack trace of the exception:

Arguments

--args=--outputDirectory "/temp/output/dir" --root "my/root/dir/specimin/src/main/java" --targetFile "org/checkerframework/specimin/UnsolvedSymbolVisitor.java" --targetMethod "org.checkerframework.specimin.UnsolvedSymbolVisitor#setImportStatement(NodeList<ImportDeclaration>)"

Exception

13:56:41.706 [main] INFO  edu.njit.jerse.ashe.services.SpeciminTool - Exception in thread "main" UnsolvedSymbolException{context='null', name='PackageDeclaration', cause='null'}
at com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade.convertToUsage(JavaParserFacade.java:682)
at com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade.convert(JavaParserFacade.java:740)
at com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade.convert(JavaParserFacade.java:736)
at com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserParameterDeclaration.getType(JavaParserParameterDeclaration.java:69)
at com.github.javaparser.symbolsolver.model.resolution.Value.from(Value.java:45)
at com.github.javaparser.symbolsolver.core.resolution.Context.solveSymbolAsValueInParentContext(Context.java:148)
at com.github.javaparser.symbolsolver.javaparsermodel.contexts.MethodCallExprContext.solveSymbolAsValue(MethodCallExprContext.java:161)
at com.github.javaparser.symbolsolver.resolution.SymbolSolver.solveSymbolAsValue(SymbolSolver.java:78)
at com.github.javaparser.symbolsolver.resolution.SymbolSolver.solveSymbolAsValue(SymbolSolver.java:83)
at com.github.javaparser.symbolsolver.javaparsermodel.TypeExtractor.visit(TypeExtractor.java:533)
at com.github.javaparser.symbolsolver.javaparsermodel.TypeExtractor.visit(TypeExtractor.java:99)
at com.github.javaparser.ast.expr.NameExpr.accept(NameExpr.java:79)
at com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade.getTypeConcrete(JavaParserFacade.java:554)
at com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade.getType(JavaParserFacade.java:401)
at com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade.getType(JavaParserFacade.java:383)
at com.github.javaparser.symbolsolver.JavaSymbolSolver.calculateType(JavaSymbolSolver.java:291)
at com.github.javaparser.ast.expr.Expression.calculateResolvedType(Expression.java:566)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.getArgumentsFromMethodCall(UnsolvedSymbolVisitor.java:931)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.updateUnsolvedClassWithMethod(UnsolvedSymbolVisitor.java:674)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.updateSyntheticClassForSuperCall(UnsolvedSymbolVisitor.java:832)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:526)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:68)
at com.github.javaparser.ast.expr.MethodCallExpr.accept(MethodCallExpr.java:116)
at com.github.javaparser.ast.visitor.ModifierVisitor.lambda$visit$79(ModifierVisitor.java:852)
at java.base/java.util.Optional.map(Optional.java:260)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:852)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:51)
at com.github.javaparser.ast.stmt.ReturnStmt.accept(ReturnStmt.java:78)
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:169)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:406)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:68)
at com.github.javaparser.ast.stmt.BlockStmt.accept(BlockStmt.java:70)
at com.github.javaparser.ast.visitor.ModifierVisitor.lambda$visit$60(ModifierVisitor.java:670)
at java.base/java.util.Optional.map(Optional.java:260)
at com.github.javaparser.ast.visitor.ModifierVisitor.visit(ModifierVisitor.java:670)
at org.checkerframework.specimin.UnsolvedSymbolVisitor.visit(UnsolvedSymbolVisitor.java:506)
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:287)
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)

Is this an issue with Specimin or JavaParser?

This is an important issue, as we are trying to iterate through Java projects - Each Java project's public method in each public class will be minimized. We are unable to minimize org.checkerframework.specimin.UnsolvedSymbolVisitor#setImportStatement(NodeList) within Specimin.

@jonathan-m-phillips jonathan-m-phillips changed the title Exception passing NodeList<ImportDeclaration> as an argument in targetMethod UnresolvedSymbolException during method minimization - NodeList<ImportDeclaration> Nov 12, 2023
@LoiNguyenCS
Copy link
Collaborator

Hello @jonathan-m-phillips,

Could you please share the code for the mentioned program? Without the context, it's challenging to identify the bug. Thank you very much.

@LoiNguyenCS
Copy link
Collaborator

Sorry, I've figure out the codes of the program.

@kelloggm kelloggm self-assigned this Nov 13, 2023
@jonathan-m-phillips
Copy link
Collaborator Author

Sorry, I've figure out the codes of the program.

No problem - I should have been more specific about the application. I am running Specimin on itself and compiling with the checker framework.

@kelloggm
Copy link
Collaborator

fixed by #46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants