Skip to content

GeneratedJavaParser.generateParseException #102

Closed

Description

@atkawa7
[ERROR] Failed to execute goal org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.5.0:htmlReport (default-cli) on project ngschema: Execution default-cli of goal org.hjug.refactorfirst.plugin:refactor-first-maven-plugin:0.5.0:htmlReport failed: com.github.javaparser.ParseProblemException: (line 23,col 32) Parse error. Found ".", expected one of  "!=" "%" "%=" "&" "&&" "&=" "(" "*" "*=" "+" "+=" "," "-" "-=" "->" "/" "/=" "::" ";" "<" "<<=" "<=" "=" "==" ">" ">=" ">>=" ">>>=" "?" "^" "^=" "instanceof" "|" "|=" "||"
[ERROR] Problem stacktrace :
[ERROR]   com.github.javaparser.GeneratedJavaParser.generateParseException(GeneratedJavaParser.java:14457)
[ERROR]   com.github.javaparser.GeneratedJavaParser.jj_consume_token(GeneratedJavaParser.java:14302)
[ERROR]   com.github.javaparser.GeneratedJavaParser.FieldDeclaration(GeneratedJavaParser.java:1855)
[ERROR]   com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceBodyDeclaration(GeneratedJavaParser.java:1764)
[ERROR]   com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceBody(GeneratedJavaParser.java:1286)
[ERROR]   com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceDeclaration(GeneratedJavaParser.java:538)
[ERROR]   com.github.javaparser.GeneratedJavaParser.CompilationUnit(GeneratedJavaParser.java:156)
[ERROR]   com.github.javaparser.JavaParser.parse(JavaParser.java:125)
[ERROR]   com.github.javaparser.JavaParser.parse(JavaParser.java:199)
[ERROR]   com.github.javaparser.JavaParserAdapter.parse(JavaParserAdapter.java:92)
[ERROR]   com.github.javaparser.StaticJavaParser.parse(StaticJavaParser.java:142)
[ERROR]   org.hjug.parser.JavaProjectParser.getInstanceVarTypes(JavaProjectParser.java:75)
[ERROR]   org.hjug.parser.JavaProjectParser.lambda$getClassReferences$2(JavaProjectParser.java:40)
[ERROR]   java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
[ERROR]   java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
[ERROR]   java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
[ERROR]   java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
[ERROR]   java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
[ERROR]   java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[ERROR]   java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[ERROR]   java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
[ERROR]   java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
[ERROR]   java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[ERROR]   java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
[ERROR]   org.hjug.parser.JavaProjectParser.getClassReferences(JavaProjectParser.java:39)
[ERROR]   org.hjug.cbc.CostBenefitCalculator.runCycleAnalysis(CostBenefitCalculator.java:77)
[ERROR]   org.hjug.refactorfirst.report.HtmlReport.runCycleAnalysis(HtmlReport.java:178)
[ERROR]   org.hjug.refactorfirst.report.SimpleHtmlReport.execute(SimpleHtmlReport.java:162)
[ERROR]   org.hjug.mavenreport.RefactorFirstHtmlReport.execute(RefactorFirstHtmlReport.java:43)
[ERROR]   org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
[ERROR]   org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328)
[ERROR]   org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
[ERROR]   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
[ERROR]   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
[ERROR]   org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
[ERROR]   org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
[ERROR]   org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
[ERROR]   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
[ERROR]   org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
[ERROR]   org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
[ERROR]   org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
[ERROR]   org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
[ERROR]   org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
[ERROR]   org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
[ERROR]   org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
[ERROR]   org.apache.maven.cli.MavenCli.execute(MavenCli.java:906)
[ERROR]   org.apache.maven.cli.MavenCli.doMain(MavenCli.java:283)
[ERROR]   org.apache.maven.cli.MavenCli.main(MavenCli.java:206)
[ERROR]   java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]   java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR]   java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]   java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR]   org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:283)
[ERROR]   org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:226)
[ERROR]   org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:407)
[ERROR]   org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:348)
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Activity

  1. jimbethancourt commented on Sep 26, 2024

    @jimbethancourt
    Collaborator

    Hi @atkawa7 - thank you for the stacktrace! It looks like this may be an issue with the JavaParser library.

    Could you provide sample code that reproduces the issue? I'd be happy to try and resolve the issue if it can be reproduced.

    Since this does appear to be an issue with the JavaParser library, it may require a fix there, which is something that is (likely) out of my control, though I can pass along the stacktrace and the code that reproduces the issue.

    I have recently considered using a different parser, which could also resolve the issue.

    Thanks!

  2. agentgt commented on Sep 27, 2024

    @agentgt

    @jimbethancourt I'm having all sorts of parser errors as well and because the filename is not outputted it is quite painful to go off and reproduce code.

    https://www.reddit.com/r/java/comments/1fpb8ex/refactorfirst_050_is_released/lp7964b/

    It appears the parser does not like inline local classes but also as issues with sealed classes.

  3. added a commit that references this issue on Oct 2, 2024
  4. jimbethancourt commented on Oct 2, 2024

    @jimbethancourt
    Collaborator

    Logging classes as they are being parsed. Please try 0.6.0

  5. atkawa7 commented on Oct 2, 2024

    @atkawa7
    Author

    @jimbethancourt I have looked. It seems this library is passing any file with .java extension it finds. We have our sample codes in ours docs folder being parsed which are not part of the source. Is there a way to exclude the folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions