Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade javaparser and enhance the fail message for parse exceptions (#…
…241) This PR upgrades the javaparser library to version `3.26.2` and enhances the fail message for parse exceptions, providing more context and clarity. Before this change, a parse exception would display a message like the following, which lacks sufficient context: ``` Exception in thread "main" com.github.javaparser.ParseProblemException: (line 699,col 20) Parse error. Found ":", expected "(" Problem stacktrace : com.github.javaparser.GeneratedJavaParser.generateParseException(GeneratedJavaParser.java:14419) com.github.javaparser.GeneratedJavaParser.jj_consume_token(GeneratedJavaParser.java:14264) com.github.javaparser.GeneratedJavaParser.PatternList(GeneratedJavaParser.java:4128) com.github.javaparser.GeneratedJavaParser.RecordPatternExpression(GeneratedJavaParser.java:4114) com.github.javaparser.GeneratedJavaParser.PatternExpression(GeneratedJavaParser.java:4069) com.github.javaparser.GeneratedJavaParser.SwitchEntry(GeneratedJavaParser.java:6491) com.github.javaparser.GeneratedJavaParser.SwitchStatement(GeneratedJavaParser.java:6381) com.github.javaparser.GeneratedJavaParser.Statement(GeneratedJavaParser.java:5828) com.github.javaparser.GeneratedJavaParser.BlockStatement(GeneratedJavaParser.java:6079) com.github.javaparser.GeneratedJavaParser.Statements(GeneratedJavaParser.java:2811) com.github.javaparser.GeneratedJavaParser.Block(GeneratedJavaParser.java:5955) com.github.javaparser.GeneratedJavaParser.MethodDeclaration(GeneratedJavaParser.java:2201) com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceBodyDeclaration(GeneratedJavaParser.java:1796) com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceBody(GeneratedJavaParser.java:1286) com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceDeclaration(GeneratedJavaParser.java:538) com.github.javaparser.GeneratedJavaParser.CompilationUnit(GeneratedJavaParser.java:156) com.github.javaparser.JavaParser.parse(JavaParser.java:125) com.github.javaparser.JavaParser.parse(JavaParser.java:231) com.github.javaparser.JavaParserAdapter.parse(JavaParserAdapter.java:99) com.github.javaparser.StaticJavaParser.parse(StaticJavaParser.java:173) edu.ucr.cs.riple.injector.Injector.parse(Injector.java:173) edu.ucr.cs.riple.core.registries.field.FieldRegistry$1.build(FieldRegistry.java:115) edu.ucr.cs.riple.core.registries.field.FieldRegistry$1.build(FieldRegistry.java:97) edu.ucr.cs.riple.core.registries.Registry.populateContent(Registry.java:122) edu.ucr.cs.riple.core.registries.Registry.lambda$new$0(Registry.java:91) java.base/java.lang.Iterable.forEach(Iterable.java:75) edu.ucr.cs.riple.core.registries.Registry.<init>(Registry.java:88) edu.ucr.cs.riple.core.registries.field.FieldRegistry.<init>(FieldRegistry.java:82) edu.ucr.cs.riple.core.module.ModuleInfo.<init>(ModuleInfo.java:94) edu.ucr.cs.riple.core.module.ModuleInfo.<init>(ModuleInfo.java:75) edu.ucr.cs.riple.core.Context.<init>(Context.java:78) edu.ucr.cs.riple.core.Annotator.<init>(Annotator.java:63) edu.ucr.cs.riple.core.Main.main(Main.java:45) (line 709,col 14) Parse error. Found "case", expected "}" ``` With this update, the error message now includes the file path, making it easier to locate the issue: ``` javaparser was not able to parse file at: /path_to_Foojava Parse problem: (line 699,col 20) Parse error. Found ":", expected "(" ``` This change involves both the library upgrade and an improvement to the error message but both are included in this single PR rather than separated due to the small scope of changes.
- Loading branch information