From fb95084b78a39ccdcb440d7f9f205778e2bd70af Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Nov 2023 12:11:07 -0500 Subject: [PATCH] update method --- .../specimin/UnsolvedSymbolVisitor.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/checkerframework/specimin/UnsolvedSymbolVisitor.java b/src/main/java/org/checkerframework/specimin/UnsolvedSymbolVisitor.java index 77d99675..72e18ab9 100644 --- a/src/main/java/org/checkerframework/specimin/UnsolvedSymbolVisitor.java +++ b/src/main/java/org/checkerframework/specimin/UnsolvedSymbolVisitor.java @@ -526,9 +526,7 @@ public Visitable visit(MethodDeclaration node, Void arg) { try { nodeType.resolve(); } catch (UnsolvedSymbolException | UnsupportedOperationException e) { - // if the class could not be found among import statements, we assume that the class must be - // in the same package as the current class. - this.updateMissingClass(createUnsolvedClass(nodeTypeSimpleForm)); + updateUnsolvedClassWithClassName(nodeTypeSimpleForm); } } @@ -673,7 +671,7 @@ public Visitable visit(Parameter parameter, Void p) { } else { // since it is unsolved, it could not be a primitive type @ClassGetSimpleName String className = parameter.getType().asClassOrInterfaceType().getName().asString(); - updateMissingClass(createUnsolvedClass(className)); + updateUnsolvedClassWithClassName(className); } } gotException = true; @@ -879,16 +877,15 @@ public void updateClassesFromJarSourcesForMethodCall(MethodCallExpr expr) { /** * Given the simple name of an unsolved class, this method will create an UnsolvedClass instance - * to represent that class. + * to represent that class and update the list of missing class with that UnsolvedClass instance. * * @param nameOfClass the name of an unsolved class - * @return an UnsolvedClass instance */ - public UnsolvedClass createUnsolvedClass(@ClassGetSimpleName String nameOfClass) { + public void updateUnsolvedClassWithClassName(@ClassGetSimpleName String nameOfClass) { // if the name of the class is not present among import statements, we assume that this unsolved // class is in the same directory as the current class String packageName = classAndPackageMap.getOrDefault(nameOfClass, currentPackage); - return new UnsolvedClass(nameOfClass, packageName); + updateMissingClass(new UnsolvedClass(nameOfClass, packageName)); } /**