groovy
  1. groovy
  2. GROOVY-5386

@Delegate - sometimes compilation fails for generic types

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta-2, 1.8.6
    • Fix Version/s: 2.0.5
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      JVM: 1.6.0_29 Vendor: Apple Inc. OS: Mac OS X
    • Number of attachments :
      1

      Description

      we have some classes using @Delegate on generic classes:

      @Commons
      class FilterList

      { @Delegate List<Map<Dimension, List<String>>> filterList = [] ... }

      Sometime compilation fails with compiler errors like

      BUG! exception in phase 'class generation' in source unit '/Users/andre/Development/Projects/Adternity/grf/grails-app/jobs/com/grf/reports/ScheduledReportExecutionJob.groovy' Type is null. Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context. (Use --stacktrace to see the full trace)

      I assume this has to do with DelegateASTTransformation#nonGeneric handling of generic types, which is setting the generic type to null, but it's hard to reproduce the error in a determined way.

        Activity

        Hide
        Andre Steingress added a comment -

        I've just seen that DelegateASTTransformation uses a new ClassNode instance, so the compiler error above shouldn't come from that place, am I right?

        Show
        Andre Steingress added a comment - I've just seen that DelegateASTTransformation uses a new ClassNode instance, so the compiler error above shouldn't come from that place, am I right?
        Hide
        CÚdric Champeau added a comment -

        What is the @Commons annotation? Is it an AST xform too?

        Show
        CÚdric Champeau added a comment - What is the @Commons annotation? Is it an AST xform too?
        Show
        Andre Steingress added a comment - Yep, http://groovy.codehaus.org/api/groovy/util/logging/Commons.html
        Hide
        Andre Steingress added a comment - - edited

        I did a simple lookup to find all the usages of setGenericTypes in groovy-core. The only two ast xforms directly calling this method are:

        DelegateASTTransformation
        ListenerListASTTransformation

        Hm, I think the error above did not occur before introducing @Delegate - but of course I could be wrong and it is caused by some Grails xform.

        Show
        Andre Steingress added a comment - - edited I did a simple lookup to find all the usages of setGenericTypes in groovy-core. The only two ast xforms directly calling this method are: DelegateASTTransformation ListenerListASTTransformation Hm, I think the error above did not occur before introducing @Delegate - but of course I could be wrong and it is caused by some Grails xform.
        Hide
        CÚdric Champeau added a comment -

        Does it happen in a plain Groovy project too? Grails also performs transparent AST transformations which could be in action here.

        Show
        CÚdric Champeau added a comment - Does it happen in a plain Groovy project too? Grails also performs transparent AST transformations which could be in action here.
        Hide
        Andre Steingress added a comment -

        I'll try to reproduce it in a standalone Groovy project as we're running into this issue now regularly, which is pain because the programmer (including me ) needs to clean and recompile the Grails project.

        
        | Packaging Grails application
        | Packaging Grails application.
        | Packaging Grails application..
        | Packaging Grails application...
        | Packaging Grails application....
        | Packaging Grails application.....
        | Compiling 11 source files
        | Compiling 11 source files.
        | Error Fatal error during compilation org.apache.tools.ant.BuildException: BUG! exception in phase 'class generation' in source unit '/super/secret/XXX.groovy' Type is null. Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context. (Use --stacktrace to see the full trace)
        
        Show
        Andre Steingress added a comment - I'll try to reproduce it in a standalone Groovy project as we're running into this issue now regularly, which is pain because the programmer (including me ) needs to clean and recompile the Grails project. | Packaging Grails application | Packaging Grails application. | Packaging Grails application.. | Packaging Grails application... | Packaging Grails application.... | Packaging Grails application..... | Compiling 11 source files | Compiling 11 source files. | Error Fatal error during compilation org.apache.tools.ant.BuildException: BUG! exception in phase 'class generation' in source unit '/ super /secret/XXX.groovy' Type is null . Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context. (Use --stacktrace to see the full trace)
        Hide
        Andre Steingress added a comment - - edited

        It seems to me that this issue occurs when recompiling classes with a reference to already compiled @Delegate classes. But as I've said before, I'll try to reproduce it...

        Show
        Andre Steingress added a comment - - edited It seems to me that this issue occurs when recompiling classes with a reference to already compiled @Delegate classes. But as I've said before, I'll try to reproduce it...
        Hide
        Andre Steingress added a comment - - edited

        Here is the full stracktrace, just for the record:

        	at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:96)
        	at org.codehaus.groovy.vmplugin.v5.Java5.configureTypeArguments(Java5.java:157)
        	at org.codehaus.groovy.vmplugin.v5.Java5.configureParameterizedType(Java5.java:137)
        	at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:88)
        	at org.codehaus.groovy.vmplugin.v5.Java5.makeClassNode(Java5.java:384)
        	at org.codehaus.groovy.vmplugin.v5.Java5.makeInterfaceTypes(Java5.java:365)
        	at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:348)
        	at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:262)
        	at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:974)
        	at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:969)
        	at org.codehaus.groovy.ast.ClassNode.getSuperClass(ClassNode.java:963)
        	at org.codehaus.groovy.ast.ClassNode.getPlainNodeReference(ClassNode.java:1369)
        	at org.codehaus.groovy.classgen.asm.ClosureWriter.createClosureClass(ClosureWriter.java:262)
        	at org.codehaus.groovy.classgen.asm.ClosureWriter.getOrAddClosureClass(ClosureWriter.java:144)
        	at org.codehaus.groovy.classgen.asm.ClosureWriter.writeClosure(ClosureWriter.java:71)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitClosureExpression(AsmClassGenerator.java:540)
        	at org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:43)
        	at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:301)
        	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:187)
        	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:89)
        	at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:73)
        	at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:292)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:657)
        	at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:75)
        	at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:599)
        	at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeExpressionStatement(OptimizingStatementWriter.java:354)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:503)
        	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
        	at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:80)
        	at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:449)
        	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
        	at org.codehaus.groovy.classgen.asm.StatementWriter.writeTryCatchFinally(StatementWriter.java:315)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitTryCatchFinally(AsmClassGenerator.java:473)
        	at org.codehaus.groovy.ast.stmt.TryCatchStatement.visit(TryCatchStatement.java:42)
        	at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:80)
        	at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:449)
        	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:313)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:270)
        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:390)
        	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056)
        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
        	at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:174)
        	at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:767)
        	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:967)
        	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:546)
        	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:524)
        	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:501)
        	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)
        	at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:60)
        	at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:216)
        	at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:909)
        
        Show
        Andre Steingress added a comment - - edited Here is the full stracktrace, just for the record: at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:96) at org.codehaus.groovy.vmplugin.v5.Java5.configureTypeArguments(Java5.java:157) at org.codehaus.groovy.vmplugin.v5.Java5.configureParameterizedType(Java5.java:137) at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:88) at org.codehaus.groovy.vmplugin.v5.Java5.makeClassNode(Java5.java:384) at org.codehaus.groovy.vmplugin.v5.Java5.makeInterfaceTypes(Java5.java:365) at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:348) at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:262) at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:974) at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:969) at org.codehaus.groovy.ast.ClassNode.getSuperClass(ClassNode.java:963) at org.codehaus.groovy.ast.ClassNode.getPlainNodeReference(ClassNode.java:1369) at org.codehaus.groovy.classgen.asm.ClosureWriter.createClosureClass(ClosureWriter.java:262) at org.codehaus.groovy.classgen.asm.ClosureWriter.getOrAddClosureClass(ClosureWriter.java:144) at org.codehaus.groovy.classgen.asm.ClosureWriter.writeClosure(ClosureWriter.java:71) at org.codehaus.groovy.classgen.AsmClassGenerator.visitClosureExpression(AsmClassGenerator.java:540) at org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:43) at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:301) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:187) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:89) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:73) at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:292) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:657) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:75) at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:599) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeExpressionStatement(OptimizingStatementWriter.java:354) at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:503) at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40) at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:80) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155) at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:449) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69) at org.codehaus.groovy.classgen.asm.StatementWriter.writeTryCatchFinally(StatementWriter.java:315) at org.codehaus.groovy.classgen.AsmClassGenerator.visitTryCatchFinally(AsmClassGenerator.java:473) at org.codehaus.groovy.ast.stmt.TryCatchStatement.visit(TryCatchStatement.java:42) at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:80) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155) at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:449) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112) at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:313) at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:270) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:390) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50) at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:174) at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:767) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:967) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:546) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:524) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:501) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480) at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:60) at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:216) at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:909)
        Hide
        Pascal Schumacher added a comment -

        Does this error still occur with recent versions of groovy? Or can we close this?

        Show
        Pascal Schumacher added a comment - Does this error still occur with recent versions of groovy? Or can we close this?
        Hide
        David Smith added a comment -

        Issue is still occurring in Groovy 2.3.0

        Exception in thread "main" BUG! exception in phase 'class generation' in source unit 'SimpleTemplateScript1.groovy' Type is null. Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context.
        at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:122)
        at org.codehaus.groovy.vmplugin.v5.Java5.configureTypeArguments(Java5.java:183)
        at org.codehaus.groovy.vmplugin.v5.Java5.configureParameterizedType(Java5.java:163)
        at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:114)
        at org.codehaus.groovy.vmplugin.v5.Java5.makeClassNode(Java5.java:411)
        at org.codehaus.groovy.vmplugin.v5.Java5.makeInterfaceTypes(Java5.java:392)
        at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:375)
        at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:258)
        at org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:353)
        at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:945)
        at org.codehaus.groovy.ast.ClassNode.implementsInterface(ClassNode.java:925)
        at org.codehaus.groovy.ast.ClassNode.isDerivedFromGroovyObject(ClassNode.java:915)
        at org.codehaus.groovy.classgen.AsmClassGenerator.isGroovyObject(AsmClassGenerator.java:1111)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitPropertyExpression(AsmClassGenerator.java:1066)
        at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:55)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitGStringExpression(AsmClassGenerator.java:1884)
        at org.codehaus.groovy.ast.expr.GStringExpression.visit(GStringExpression.java:50)
        at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:301)
        at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:245)
        at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:329)
        at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:76)
        at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:60)
        at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:382)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:650)
        at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:64)
        at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:604)
        at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeExpressionStatement(OptimizingStatementWriter.java:354)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:511)
        at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
        at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:81)
        at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:457)
        at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:321)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:278)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:398)
        at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1055)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:180)
        at org.codehaus.groovy.control.CompilationUnit$15.call(CompilationUnit.java:794)
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1036)
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:572)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:550)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:527)
        at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258)
        at groovy.lang.GroovyShell.parseClass(GroovyShell.java:613)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:625)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:652)
        at groovy.text.SimpleTemplateEngine.createTemplate(SimpleTemplateEngine.java:123)
        at groovy.text.TemplateEngine.createTemplate(TemplateEngine.java:38)
        at groovy.text.TemplateEngine$createTemplate.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at net.clockworkcode.ps.ReportGenerator.generate(ReportGenerator.groovy:20)
        at net.clockworkcode.ps.ReportGenerator$generate.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
        at net.clockworkcode.ps.RunSubAnalyser.process(RunSubAnalyser.groovy:135)
        at net.clockworkcode.ps.RunSubAnalyser$process.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
        at net.clockworkcode.ps.RunSubAnalyser.main(RunSubAnalyser.groovy:120)

        Show
        David Smith added a comment - Issue is still occurring in Groovy 2.3.0 Exception in thread "main" BUG! exception in phase 'class generation' in source unit 'SimpleTemplateScript1.groovy' Type is null. Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context. at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:122) at org.codehaus.groovy.vmplugin.v5.Java5.configureTypeArguments(Java5.java:183) at org.codehaus.groovy.vmplugin.v5.Java5.configureParameterizedType(Java5.java:163) at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:114) at org.codehaus.groovy.vmplugin.v5.Java5.makeClassNode(Java5.java:411) at org.codehaus.groovy.vmplugin.v5.Java5.makeInterfaceTypes(Java5.java:392) at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:375) at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:258) at org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:353) at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:945) at org.codehaus.groovy.ast.ClassNode.implementsInterface(ClassNode.java:925) at org.codehaus.groovy.ast.ClassNode.isDerivedFromGroovyObject(ClassNode.java:915) at org.codehaus.groovy.classgen.AsmClassGenerator.isGroovyObject(AsmClassGenerator.java:1111) at org.codehaus.groovy.classgen.AsmClassGenerator.visitPropertyExpression(AsmClassGenerator.java:1066) at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:55) at org.codehaus.groovy.classgen.AsmClassGenerator.visitGStringExpression(AsmClassGenerator.java:1884) at org.codehaus.groovy.ast.expr.GStringExpression.visit(GStringExpression.java:50) at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:301) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:245) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:329) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:76) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:60) at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:382) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:650) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:64) at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:604) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeExpressionStatement(OptimizingStatementWriter.java:354) at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:511) at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40) at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:81) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155) at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:457) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112) at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:321) at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:278) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:398) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1055) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50) at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:180) at org.codehaus.groovy.control.CompilationUnit$15.call(CompilationUnit.java:794) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1036) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:572) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:550) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:527) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:613) at groovy.lang.GroovyShell.parse(GroovyShell.java:625) at groovy.lang.GroovyShell.parse(GroovyShell.java:652) at groovy.text.SimpleTemplateEngine.createTemplate(SimpleTemplateEngine.java:123) at groovy.text.TemplateEngine.createTemplate(TemplateEngine.java:38) at groovy.text.TemplateEngine$createTemplate.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at net.clockworkcode.ps.ReportGenerator.generate(ReportGenerator.groovy:20) at net.clockworkcode.ps.ReportGenerator$generate.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at net.clockworkcode.ps.RunSubAnalyser.process(RunSubAnalyser.groovy:135) at net.clockworkcode.ps.RunSubAnalyser$process.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at net.clockworkcode.ps.RunSubAnalyser.main(RunSubAnalyser.groovy:120)
        Hide
        blackdrag blackdrag added a comment -

        I fixed a generics issue for @Delegate in 2.3.1. Could you test that one?

        Show
        blackdrag blackdrag added a comment - I fixed a generics issue for @Delegate in 2.3.1. Could you test that one?
        Hide
        Paul King added a comment -

        Any chance you could try 2.3.1? There was one additional generics fix for @Delegate in that release.

        Show
        Paul King added a comment - Any chance you could try 2.3.1? There was one additional generics fix for @Delegate in that release.
        Hide
        Paul King added a comment -

        Oops, yes what blackdrag said.

        Show
        Paul King added a comment - Oops, yes what blackdrag said.
        Hide
        David Smith added a comment -

        I still get the same error with groovy 2.3.1

        The error does arise using SimpleTemplateEngine to create some html...

        Show
        David Smith added a comment - I still get the same error with groovy 2.3.1 The error does arise using SimpleTemplateEngine to create some html...
        Hide
        David Smith added a comment -

        One thing though, I get the error when I am doing a maven package running tests in Intellij, but don't get the error when running the test directly via Intellij.

        Show
        David Smith added a comment - One thing though, I get the error when I am doing a maven package running tests in Intellij, but don't get the error when running the test directly via Intellij.
        Hide
        David Smith added a comment - - edited

        Hi Paul,

        I've attached a sample project that generates the delegate bug

        Show
        David Smith added a comment - - edited Hi Paul, I've attached a sample project that generates the delegate bug
        Hide
        Paul King added a comment -

        Changing to @Delegate(interfaces=false) seems to avoid the problem (hinting where the issue lies) and indeed it looks like the very last added interface (which is List in your case) isn't corrected for generics. However, I fixed that and the problem remains. We'll need to explore further.

        Show
        Paul King added a comment - Changing to @Delegate(interfaces=false) seems to avoid the problem (hinting where the issue lies) and indeed it looks like the very last added interface (which is List in your case) isn't corrected for generics. However, I fixed that and the problem remains. We'll need to explore further.
        Hide
        Paul King added a comment -

        I made the obvious change alluded to in my last comment. If you get a chance to try a snapshot version, it would be interesting to see if you get anything different. In my system it still failed but perhaps I didn't manipulate the maven environment appropriately. I was using a SNAPSHOT version and perhaps some caching of the artifacts came into play.

        Show
        Paul King added a comment - I made the obvious change alluded to in my last comment. If you get a chance to try a snapshot version, it would be interesting to see if you get anything different. In my system it still failed but perhaps I didn't manipulate the maven environment appropriately. I was using a SNAPSHOT version and perhaps some caching of the artifacts came into play.
        Hide
        David Smith added a comment - - edited

        Tried 2.3.2-SNAPSHOT (and 2.4.0-SNAPSHOT) and got the same error.
        Adding @Delegate(interfaces=false) made the error go away. (But also stops left shift operator for adding to list from compiling)
        (Well went away for the sample class I attached to this card, but not in my real program using SimpleTemplateEngine)

        Show
        David Smith added a comment - - edited Tried 2.3.2-SNAPSHOT (and 2.4.0-SNAPSHOT) and got the same error. Adding @Delegate(interfaces=false) made the error go away. (But also stops left shift operator for adding to list from compiling) (Well went away for the sample class I attached to this card, but not in my real program using SimpleTemplateEngine)
        Hide
        CÚdric Champeau added a comment -

        The 2.4 build which includes the latest changes from Paul finished 16 minutes ago and there's still no 2.3.X snapshot including the fix available, so worth double checking by invalidating the cache...

        (for reference http://ci.groovy-lang.org/viewType.html?buildTypeId=Groovy_BintrayIntegration_UploadSnapshots&guest=1)

        Show
        CÚdric Champeau added a comment - The 2.4 build which includes the latest changes from Paul finished 16 minutes ago and there's still no 2.3.X snapshot including the fix available, so worth double checking by invalidating the cache... (for reference http://ci.groovy-lang.org/viewType.html?buildTypeId=Groovy_BintrayIntegration_UploadSnapshots&guest=1 )
        Hide
        David Smith added a comment -

        Was looking at the snapshots for groovy-all via - https://oss.jfrog.org/oss-snapshot-local/org/codehaus/groovy/groovy-all/

        and pulling them in using maven repo <url>http://oss.jfrog.org/artifactory/oss-snapshot-local</url>

        Show
        David Smith added a comment - Was looking at the snapshots for groovy-all via - https://oss.jfrog.org/oss-snapshot-local/org/codehaus/groovy/groovy-all/ and pulling them in using maven repo <url> http://oss.jfrog.org/artifactory/oss-snapshot-local </url>
        Hide
        David Smith added a comment -

        Deleted the snapshot so that It would download again and cleared out the target folder

        ...
        Downloading: http://oss.jfrog.org/artifactory/oss-snapshot-local/org/codehaus/groovy/groovy-all/2.4.0-SNAPSHOT/groovy-all-2.4.0-20140521.103323-16.jar
        ...
        xception in thread "main" BUG! exception in phase 'class generation' in source unit '/Users/david/work_temp/runsub/zips/code/delegate-bug/src/test/groovy/net/clockworkcode/ps/DelegateTest.groovy' Type is null. Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context.
        at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:96)
        at org.codehaus.groovy.vmplugin.v5.Java5.configureTypeArguments(Java5.java:157)
        at org.codehaus.groovy.vmplugin.v5.Java5.configureParameterizedType(Java5.java:137)
        at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:88)
        at org.codehaus.groovy.vmplugin.v5.Java5.makeClassNode(Java5.java:384)
        at org.codehaus.groovy.vmplugin.v5.Java5.makeInterfaceTypes(Java5.java:365)
        at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:348)
        at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:262)
        at org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:356)
        at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:946)
        at org.codehaus.groovy.ast.ClassNode.implementsInterface(ClassNode.java:926)
        at org.codehaus.groovy.ast.ClassNode.isDerivedFromGroovyObject(ClassNode.java:916)
        at org.codehaus.groovy.classgen.AsmClassGenerator.isGroovyObject(AsmClassGenerator.java:1090)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitPropertyExpression(AsmClassGenerator.java:1047)
        at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:55)
        at org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:232)
        at org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:221)
        at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:270)
        at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:187)
        at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:89)
        at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:73)
        at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:292)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:655)
        at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:75)
        at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:599)
        at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeExpressionStatement(OptimizingStatementWriter.java:354)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:501)
        at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
        at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:80)
        at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:447)
        at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:311)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:268)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:388)
        at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
        at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:172)
        at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:767)
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:967)
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:546)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:524)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:501)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)
        at org.codehaus.gmaven.runtime.v1_8.ClassCompilerFeature$ClassCompilerImpl.compile(ClassCompilerFeature.java:148)
        at org.codehaus.gmaven.plugin.compile.AbstractCompileMojo.compile(AbstractCompileMojo.java:211)
        at org.codehaus.gmaven.plugin.compile.AbstractCompileMojo.process(AbstractCompileMojo.java:175)
        at org.codehaus.gmaven.plugin.ComponentMojoSupport.doExecute(ComponentMojoSupport.java:60)
        at org.codehaus.gmaven.plugin.compile.TestCompileMojo.doExecute(TestCompileMojo.java:90)
        at org.codehaus.gmaven.plugin.MojoSupport.execute(MojoSupport.java:71)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        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)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

        Wonder why the above fails when testing via maven but running test via Intellij's runner passes?

        Show
        David Smith added a comment - Deleted the snapshot so that It would download again and cleared out the target folder ... Downloading: http://oss.jfrog.org/artifactory/oss-snapshot-local/org/codehaus/groovy/groovy-all/2.4.0-SNAPSHOT/groovy-all-2.4.0-20140521.103323-16.jar ... xception in thread "main" BUG! exception in phase 'class generation' in source unit '/Users/david/work_temp/runsub/zips/code/delegate-bug/src/test/groovy/net/clockworkcode/ps/DelegateTest.groovy' Type is null. Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context. at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:96) at org.codehaus.groovy.vmplugin.v5.Java5.configureTypeArguments(Java5.java:157) at org.codehaus.groovy.vmplugin.v5.Java5.configureParameterizedType(Java5.java:137) at org.codehaus.groovy.vmplugin.v5.Java5.configureType(Java5.java:88) at org.codehaus.groovy.vmplugin.v5.Java5.makeClassNode(Java5.java:384) at org.codehaus.groovy.vmplugin.v5.Java5.makeInterfaceTypes(Java5.java:365) at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:348) at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:262) at org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:356) at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:946) at org.codehaus.groovy.ast.ClassNode.implementsInterface(ClassNode.java:926) at org.codehaus.groovy.ast.ClassNode.isDerivedFromGroovyObject(ClassNode.java:916) at org.codehaus.groovy.classgen.AsmClassGenerator.isGroovyObject(AsmClassGenerator.java:1090) at org.codehaus.groovy.classgen.AsmClassGenerator.visitPropertyExpression(AsmClassGenerator.java:1047) at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:55) at org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:232) at org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:221) at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:270) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:187) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:89) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:73) at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:292) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:655) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:75) at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:599) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeExpressionStatement(OptimizingStatementWriter.java:354) at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:501) at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40) at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:80) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155) at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:447) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112) at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:311) at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:268) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:388) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50) at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:172) at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:767) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:967) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:546) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:524) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:501) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480) at org.codehaus.gmaven.runtime.v1_8.ClassCompilerFeature$ClassCompilerImpl.compile(ClassCompilerFeature.java:148) at org.codehaus.gmaven.plugin.compile.AbstractCompileMojo.compile(AbstractCompileMojo.java:211) at org.codehaus.gmaven.plugin.compile.AbstractCompileMojo.process(AbstractCompileMojo.java:175) at org.codehaus.gmaven.plugin.ComponentMojoSupport.doExecute(ComponentMojoSupport.java:60) at org.codehaus.gmaven.plugin.compile.TestCompileMojo.doExecute(TestCompileMojo.java:90) at org.codehaus.gmaven.plugin.MojoSupport.execute(MojoSupport.java:71) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) 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) at org.codehaus.classworlds.Launcher.main(Launcher.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Wonder why the above fails when testing via maven but running test via Intellij's runner passes?
        Hide
        blackdrag blackdrag added a comment -

        David, I looked a bit more closely at this last stacktrace and AsmClassGenrator line 1090 is not the method isGroovyObject in 2.4. The line org.codehaus.gmaven.runtime.v1_8.ClassCompilerFeature$ClassCompilerImpl.compile let's me believe you are actually using Groovy 1.8 here

        Show
        blackdrag blackdrag added a comment - David, I looked a bit more closely at this last stacktrace and AsmClassGenrator line 1090 is not the method isGroovyObject in 2.4. The line org.codehaus.gmaven.runtime.v1_8.ClassCompilerFeature$ClassCompilerImpl.compile let's me believe you are actually using Groovy 1.8 here
        Hide
        David Smith added a comment - - edited

        That would explain why it works in intellij which is using the maven dependency from the main section of the pom
        but fails to work when using maven to do the compile it is using the gmaven plugin which has a provider set to 1.8, I can change this to 2.0 but still get the bug.

        Is there a gmaven plugin that supports later versions of groovy than 2.0 or an alternative to graven plugin?

        Show
        David Smith added a comment - - edited That would explain why it works in intellij which is using the maven dependency from the main section of the pom but fails to work when using maven to do the compile it is using the gmaven plugin which has a provider set to 1.8, I can change this to 2.0 but still get the bug. Is there a gmaven plugin that supports later versions of groovy than 2.0 or an alternative to graven plugin?
        Hide
        David Smith added a comment -

        I was able to get the code compiled with groovyc rather than gmaven-plugin and the code compiles and runs successfully using 2.4.0-SNAPSHOT

        For info, you can replace your gmaven-plugin with:

                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <configuration>
                                    <tasks>
                                        <taskdef name="Groovydoc" classname="org.codehaus.groovy.ant.Groovydoc">
                                            <classpath>
                                                <path refid="maven.compile.classpath"/>
                                            </classpath>
                                        </taskdef>
        
                                        <Groovydoc destdir="target/apidocs" sourcepath="src/main/groovy" packagenames="**.*"
                                                   use="true"
                                                   windowtitle="Groovydoc" private="false"/>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>compile</id>
                                <phase>compile</phase>
                                <configuration>
                                    <tasks>
                                        <mkdir dir="${basedir}/src/main/groovy"/>
                                        <taskdef name="groovyc"
                                                 classname="org.codehaus.groovy.ant.Groovyc">
                                            <classpath refid="maven.compile.classpath"/>
                                        </taskdef>
                                        <mkdir dir="${project.build.outputDirectory}"/>
                                        <groovyc destdir="${project.build.outputDirectory}"
                                                 srcdir="${basedir}/src/main/groovy/" listfiles="true">
                                            <classpath refid="maven.compile.classpath"/>
                                        </groovyc>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>test-compile</id>
                                <phase>test-compile</phase>
                                <configuration>
                                    <tasks>
                                        <mkdir dir="${basedir}/src/test/groovy"/>
                                        <taskdef name="groovyc"
                                                 classname="org.codehaus.groovy.ant.Groovyc">
                                            <classpath refid="maven.test.classpath"/>
                                        </taskdef>
                                        <mkdir dir="${project.build.testOutputDirectory}"/>
                                        <groovyc destdir="${project.build.testOutputDirectory}"
                                                 srcdir="${basedir}/src/test/groovy/" listfiles="true">
                                            <classpath refid="maven.test.classpath"/>
                                        </groovyc>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
        
                        </executions>
                    </plugin>
        
        Show
        David Smith added a comment - I was able to get the code compiled with groovyc rather than gmaven-plugin and the code compiles and runs successfully using 2.4.0-SNAPSHOT For info, you can replace your gmaven-plugin with: <plugin> <artifactId> maven-antrun-plugin </artifactId> <executions> <execution> <phase> package </phase> <configuration> <tasks> <taskdef name= "Groovydoc" classname= "org.codehaus.groovy.ant.Groovydoc" > <classpath> <path refid= "maven.compile.classpath" /> </classpath> </taskdef> <Groovydoc destdir= "target/apidocs" sourcepath= "src/main/groovy" packagenames= "**.*" use= "true" windowtitle= "Groovydoc" private= "false" /> </tasks> </configuration> <goals> <goal> run </goal> </goals> </execution> <execution> <id> compile </id> <phase> compile </phase> <configuration> <tasks> <mkdir dir= "${basedir}/src/main/groovy" /> <taskdef name= "groovyc" classname= "org.codehaus.groovy.ant.Groovyc" > <classpath refid= "maven.compile.classpath" /> </taskdef> <mkdir dir= "${project.build.outputDirectory}" /> <groovyc destdir= "${project.build.outputDirectory}" srcdir= "${basedir}/src/main/groovy/" listfiles= "true" > <classpath refid= "maven.compile.classpath" /> </groovyc> </tasks> </configuration> <goals> <goal> run </goal> </goals> </execution> <execution> <id> test-compile </id> <phase> test-compile </phase> <configuration> <tasks> <mkdir dir= "${basedir}/src/test/groovy" /> <taskdef name= "groovyc" classname= "org.codehaus.groovy.ant.Groovyc" > <classpath refid= "maven.test.classpath" /> </taskdef> <mkdir dir= "${project.build.testOutputDirectory}" /> <groovyc destdir= "${project.build.testOutputDirectory}" srcdir= "${basedir}/src/test/groovy/" listfiles= "true" > <classpath refid= "maven.test.classpath" /> </groovyc> </tasks> </configuration> <goals> <goal> run </goal> </goals> </execution> </executions> </plugin>
        Hide
        David Smith added a comment - - edited

        For me at least, I find that the following bug

        BUG! exception in phase 'class generation' in source unit 'SimpleTemplateScript1.groovy' Type is null. Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context.

        was fixed in 2.0.5
        The issue I was having seems to be with gmaven only supporting compilation up to version 2.0.0

        Show
        David Smith added a comment - - edited For me at least, I find that the following bug BUG! exception in phase 'class generation' in source unit 'SimpleTemplateScript1.groovy' Type is null. Most probably you let a transform reuse existing ClassNodes with generics information, that is now used in a wrong context. was fixed in 2.0.5 The issue I was having seems to be with gmaven only supporting compilation up to version 2.0.0
        Hide
        Pascal Schumacher added a comment -

        @David:

        You can use gmavenplus or the groovy-eclipse-batch compiler instead of gmaven.

        Show
        Pascal Schumacher added a comment - @David: You can use gmavenplus or the groovy-eclipse-batch compiler instead of gmaven.

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            Andre Steingress
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: