paypal / butterfly

Application transformation tool
https://paypal.github.io/butterfly/
MIT License
48 stars 50 forks source link

In some edge cases, log of exception stack trace is emitted by JavaParser which is used by Butterfly JavaMatch #357

Open jessicadeery opened 4 years ago

jessicadeery commented 4 years ago

Butterfly version 3.0.0 uses javaparser com.github.javaparser:javaparser-core:3.15.14. JavaParser is currently used by the Butterfly JavaMatch condition.

In some edge cases, this JavaParser emits a log of an exception stack trace when parsing javadocs. The log looks like this: com.github.javadocparser.ParseException: Encountered " <ENTER_JAVADOC_COMMENT> "/** "" at line 2, column 5. Was expecting: "*/" ... at com.github.javadocparser.GeneratedJavaDocParser.generateParseException(GeneratedJavaDocParser.java:505) at com.github.javadocparser.GeneratedJavaDocParser.jj_consume_token(GeneratedJavaDocParser.java:376) at com.github.javadocparser.GeneratedJavaDocParser.JavaDocLine(GeneratedJavaDocParser.java:34) at com.github.javadocparser.GeneratedJavaDocParser.Start(GeneratedJavaDocParser.java:14) at com.github.javadocparser.GeneratedJavaDocParser.parse(GeneratedJavaDocParser.java:8) at com.github.javaparser.GeneratedJavaParserTokenManager.CommonTokenAction(GeneratedJavaParserTokenManager.java:113) at com.github.javaparser.GeneratedJavaParserTokenManager.getNextToken(GeneratedJavaParserTokenManager.java:2968) at com.github.javaparser.GeneratedJavaParser.jj_ntk_f(GeneratedJavaParser.java:10577) at com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceBody(GeneratedJavaParser.java:765) at com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceDeclaration(GeneratedJavaParser.java:410) at com.github.javaparser.GeneratedJavaParser.CompilationUnit(GeneratedJavaParser.java:156) at com.github.javaparser.JavaParser.parse(JavaParser.java:123) at com.github.javaparser.JavaParser.parse(JavaParser.java:198) at

It does not actually throw an exception in this case. Nor does it cause the parsing of the file to fail. It mainly just creates noise in the Butterfly CLI.

This is appears to be a known issue in Java Parser, and may be fixed in a later version. To resolve this issue, it should be confirmed in which version of the JavaParser this is fixed. Then butterfly should move to this later version.

In order to pick up other JavaParser fixes, it may be worth updating the JavaParser dependency version on a more periodic cadence.

fabiocarvalho777 commented 4 years ago

Thank you very much for opening this issue!!