sdaschner / jaxrs-analyzer-maven-plugin

Maven plugin for the JAX-RS Analyzer
Apache License 2.0
91 stars 39 forks source link

Stack-underflow error v0.9 - v0.17 #63

Open nperillodev opened 5 years ago

nperillodev commented 5 years ago

Hi there, first of all, congratulations for your plugin, this is one of the best and useful for API documentation. I got a problem switching from version 0.9 to higher ones: I want to use a newer version (v0.11+) because I really need the JavaDoc Analysis feature. The problem with the newer versions is the stack-underflow error, as reported in the log.

I already tried to read the other issues, but I can't find a solution. In my opinion the problem could be related to the ASM, since the versions <= 0.9 work perfectly.

My environment is: -Maven: 3.6.0 -Java version: 1.8.0_201

This is the plugin configured in the pom.xml:

<plugin>
    <groupId>com.sebastian-daschner</groupId>
    <artifactId>jaxrs-analyzer-maven-plugin</artifactId>
    <version>0.17</version>
    <executions>
        <execution>
            <goals>
                 <goal>analyze-jaxrs</goal>
            </goals>
            <configuration>
                  <backend>swagger</backend>
            </configuration>
       </execution>
   </executions>
</plugin>

Log:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  22.677 s
[INFO] Finished at: 2019-03-21T10:42:52+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.17:analyze-jaxrs (default) on project ecomm: Execu tion default of goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.17:analyze-jaxrs failed: Runtime stack under-flow occurred.  -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.17 :analyze-jaxrs (default) on project ecomm: Execution default of goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.17:analyze-j axrs failed: Runtime stack under-flow occurred.
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
 at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
 at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
 at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
 at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
 at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke (Method.java:498)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
 at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal com.sebastian-daschner:jaxrs-analyzer-maven-plu gin:0.17:analyze-jaxrs failed: Runtime stack under-flow occurred.
 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
 at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
 at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
 at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
 at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
 at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke (Method.java:498)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
 at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.IllegalStateException: Runtime stack under-flow occurred.
 at com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.reduction.StackSizeSimulator.buildStackSizes (StackSizeSimulator.java:5 3)
 at com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.reduction.RelevantInstructionReducer.reduceInstructions (RelevantInstru ctionReducer.java:55)
 at com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.MethodContentAnalyzer.interpretRelevantInstructions (MethodContentAnaly zer.java:59)
 at com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.MethodContentAnalyzer.addProjectMethods (MethodContentAnalyzer.java:110 )
 at com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.MethodContentAnalyzer.findProjectMethods (MethodContentAnalyzer.java:88 )
 at com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.ResourceMethodContentAnalyzer.analyze (ResourceMethodContentAnalyzer.ja va:57)
 at com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.BytecodeAnalyzer.analyzeBytecode (BytecodeAnalyzer.java:26)
 at java.lang.Iterable.forEach (Iterable.java:75)
 at java.util.Collections$UnmodifiableCollection.forEach (Collections.java:1080)
 at com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.BytecodeAnalyzer.analyzeBytecode (BytecodeAnalyzer.java:18)
 at com.sebastian_daschner.jaxrs_analyzer.analysis.ProjectAnalyzer.analyze (ProjectAnalyzer.java:104)
 at com.sebastian_daschner.jaxrs_analyzer.JAXRSAnalyzer.analyze (JAXRSAnalyzer.java:47)
 at com.sebastian_daschner.jaxrs_analyzer.maven.JAXRSAnalyzerMojo.execute (JAXRSAnalyzerMojo.java:226)
 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
 at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
 at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
 at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
 at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
 at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke (Method.java:498)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
 at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[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
sdaschner commented 5 years ago

Hi there,

do you have some piece of code that you can share or a simple reproducer project?

nperillodev commented 5 years ago

Hello Sebastian, sure. All my APIs are pretty basic, like this one:

/**
* This is a general comment.
*
* @param myp I'm declaring the parameter myp!
*
*/
    @Path("/displayInvoices")
    @Consumes("application/json")
    @Produces("application/json")
    @ValidateRequest
    public MyResp displayInvoices(@Context HttpServletRequest requestContext, @APIValidator ReportFattureRequest invoiceReq) {        

        MyResp lookAtThis = new MyResp(invoiceReq.getParameter("name"));
        if(!lookAtThis.validParameters()){
            log.error("Not valid data");
        else
            return lookAtThis;

        ........

    }

Is it possible that the error is due to the ASM?

Thank you, Nicolas