GMaven
  1. GMaven
  2. GMAVEN-84

GMaven generates incorrect stubs where groovyc generates correct stubs

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.4
    • Component/s: stub generation
    • Labels:
      None
    • Number of attachments :
      1

      Description

      This started out as a Groovy issue, so have a look at GROOVY-4434, in particular this comment: http://jira.codehaus.org/browse/GROOVY-4434?focusedCommentId=239237&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_239237

      Stack traces obtained from debugging stub generation with groovyc and GMaven follow below. I've also attached a Maven project that makes it easy to reproduce the issue. Maven version used is 2.2.1. Groovy version used is https://svn.codehaus.org/groovy/branches/GROOVY_1_7_Xtrunk, rev. 20934 (1.7.6-SNAPSHOT).

      Stub generation with groovyc:
      -----------------------------
      
      Compile with:
      
      cd src/main/groovy
      groovyc -j ../java/foo/*.java bar/*.groovy
      
      AST representation of annotation attribute value:
      
      org.codehaus.groovy.ast.expr.PropertyExpression@4cdf4bfc[object: org.codehaus.groovy.ast.expr.ClassExpression@57f5b4d1[type: foo.MyEnum] property: ConstantExpression[ONE]]
      
      Stack trace at point of generation of annotation attribute value:
      
      	  at org.codehaus.groovy.tools.javac.JavaStubGenerator.getAnnotationValue(JavaStubGenerator.java:641)
      	  at org.codehaus.groovy.tools.javac.JavaStubGenerator.printAnnotations(JavaStubGenerator.java:634)
      	  at org.codehaus.groovy.tools.javac.JavaStubGenerator.genClassInner(JavaStubGenerator.java:169)
      	  at org.codehaus.groovy.tools.javac.JavaStubGenerator.generateClass(JavaStubGenerator.java:105)
      	  at org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit$2.call(JavaAwareCompilationUnit.java:75)
      	  at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:932)
      	  at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:509)
      	  at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487)
      	  at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464)
      	  at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:448)
      	  at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:57)
      	  at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:170)
      	  at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:138)
      	  at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:152)
      	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
      	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	  at java.lang.reflect.Method.invoke(Method.java:597)
      	  at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:108)
      	  at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)       
      	  
       
      Stub generation with GMaven:   
      --------------------------------  
      
      Compile with:
      
      mvn clean install
      
      AST representation of annotation attribute value:
      
      org.codehaus.groovy.ast.expr.PropertyExpression@65f4ba51[object: org.codehaus.groovy.ast.expr.VariableExpression@25f45022[variable: MyEnum] property: ConstantExpression[ONE]]
      	  
      Stack trace at point of generation of annotation attribute value:
      
            	  at org.codehaus.groovy.tools.javac.JavaStubGenerator.getAnnotationValue(JavaStubGenerator.java:641)
            	  at org.codehaus.groovy.tools.javac.JavaStubGenerator.printAnnotations(JavaStubGenerator.java:634)
            	  at org.codehaus.groovy.tools.javac.JavaStubGenerator.genClassInner(JavaStubGenerator.java:169)
            	  at org.codehaus.groovy.tools.javac.JavaStubGenerator.generateClass(JavaStubGenerator.java:105)
            	  at org.codehaus.gmaven.runtime.v1_7.JavaStubCompilationUnit$2.call(JavaStubCompilationUnit.java:78)
            	  at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:932)
            	  at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:509)
            	  at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:487)
            	  at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:464)
            	  at org.codehaus.gmaven.runtime.v1_7.JavaStubCompilationUnit.compile(JavaStubCompilationUnit.java:112)
            	  at org.codehaus.gmaven.runtime.v1_7.StubCompilerFeature$StubCompilerImpl.compile(StubCompilerFeature.java:107)
            	  at org.codehaus.gmaven.plugin.stubgen.AbstractGenerateStubsMojo.compile(AbstractGenerateStubsMojo.java:160)
            	  at org.codehaus.gmaven.plugin.stubgen.AbstractGenerateStubsMojo.process(AbstractGenerateStubsMojo.java:131)
            	  at org.codehaus.gmaven.plugin.ComponentMojoSupport.doExecute(ComponentMojoSupport.java:60)
            	  at org.codehaus.gmaven.plugin.MojoSupport.execute(MojoSupport.java:69)
            	  at org.codehaus.gmaven.plugin.stubgen.AbstractGenerateStubsMojo.execute(AbstractGenerateStubsMojo.java:60)
            	  at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
            	  at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
            	  at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
            	  at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
            	  at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
            	  at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
            	  at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
            	  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
            	  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
            	  at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
            	  at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
            	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
            	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            	  at java.lang.reflect.Method.invoke(Method.java:597)
            	  at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
            	  at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
            	  at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
            	  at org.codehaus.classworlds.Launcher.main(Launcher.java:375)                                                                                                                                                   
      

        Issue Links

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Keegan Witt
              Reporter:
              Peter Niederwieser
            • Votes:
              6 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: