fusesource / hawtjni

A JNI code generator based on the JNI generator used by the eclipse SWT project
http://fusesource.github.io/hawtjni/
Apache License 2.0
165 stars 61 forks source link

hawtjni-maven-plugin throws exception when processing classes compiled with -parameters #60

Closed allen-ball closed 4 years ago

allen-ball commented 5 years ago

Classes compiled with -parameters of

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                ...
                <parameters>true</parameters>
                ...
              </configuration>
            </plugin>

cause hawtjni-maven-plugin:generate to throw an Exception

[INFO] --- hawtjni-maven-plugin:1.17:generate (default) @ ball-util ---
[INFO] Analyzing classes...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.855 s
[INFO] Finished at: 2019-09-23T16:24:21-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.fusesource.hawtjni:hawtjni-maven-plugin:1.17:generate (default) on project ball-util: Native source code generation failed: java.lang.RuntimeException: java.lang.RuntimeException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.fusesource.hawtjni:hawtjni-maven-plugin:1.17:generate (default) on project ball-util: Native source code generation failed: java.lang.RuntimeException: java.lang.RuntimeException
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    ...
Caused by: org.apache.maven.plugin.MojoExecutionException: Native source code generation failed: java.lang.RuntimeException: java.lang.RuntimeException
    at org.fusesource.hawtjni.maven.GenerateMojo.generateNativeSourceFiles (GenerateMojo.java:234)
    ...
Caused by: java.lang.RuntimeException: java.lang.RuntimeException
    at org.fusesource.hawtjni.generator.HawtJNI.findClasses (HawtJNI.java:299)
    at org.fusesource.hawtjni.generator.HawtJNI.generate (HawtJNI.java:211)
    at org.fusesource.hawtjni.maven.GenerateMojo.generateNativeSourceFiles (GenerateMojo.java:232)
    at org.fusesource.hawtjni.maven.GenerateMojo.execute (GenerateMojo.java:199)
    ...
Caused by: java.lang.RuntimeException
    at org.objectweb.asm.MethodVisitor.visitParameter (Unknown Source)
    at org.objectweb.asm.ClassReader.b (Unknown Source)
    at org.objectweb.asm.ClassReader.accept (Unknown Source)
    at org.objectweb.asm.ClassReader.accept (Unknown Source)
    at org.apache.xbean.finder.AbstractFinder.readClassDef (AbstractFinder.java:581)
    at org.apache.xbean.finder.AbstractFinder.readClassDef (AbstractFinder.java:576)
    at org.apache.xbean.finder.AbstractFinder.readClassDef (AbstractFinder.java:562)
    at org.apache.xbean.finder.ClassFinder.<init> (ClassFinder.java:122)
    at org.fusesource.hawtjni.generator.HawtJNI.findClasses (HawtJNI.java:296)
    at org.fusesource.hawtjni.generator.HawtJNI.generate (HawtJNI.java:211)
    at org.fusesource.hawtjni.maven.GenerateMojo.generateNativeSourceFiles (GenerateMojo.java:232)
    at org.fusesource.hawtjni.maven.GenerateMojo.execute (GenerateMojo.java:199)
    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:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] 
[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/MojoExecutionException

Compilation exited abnormally with code 1 at Mon Sep 23 16:24:21

<parameters>false</parameters> compiles without issue.

gnodet commented 4 years ago

The used ASM version has just been upgraded to the 8.0.1 which should bring support for all java languages features. Would you mind building master and trying again with your use case ?

allen-ball commented 4 years ago

My use case now compiles with maven-compiler-plugin true. Thank you!