You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Graeme Rocher (JIRA)" <ji...@apache.org> on 2015/06/01 09:29:19 UTC
[jira] [Commented] (GROOVY-7402) Compiler NPE Related To AST
Transformations And Traits
[ https://issues.apache.org/jira/browse/GROOVY-7402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14567015#comment-14567015 ]
Graeme Rocher commented on GROOVY-7402:
---------------------------------------
For some reason via Gradle it is not possible to get the root cause stack trace, I attached a debugger to the Gradle process and was able to get a reference to the original exception and trace which is:
{code}
Caused by: java.lang.NullPointerException
at org.codehaus.groovy.transform.trait.TraitASTTransformation$PostTypeCheckingExpressionReplacer.transform(TraitASTTransformation.java:554)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitField(ClassCodeExpressionTransformer.java:65)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1075)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
at org.codehaus.groovy.transform.trait.TraitASTTransformation$1.call(TraitASTTransformation.java:264)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1052)
... 84 more
{code}
> Compiler NPE Related To AST Transformations And Traits
> ------------------------------------------------------
>
> Key: GROOVY-7402
> URL: https://issues.apache.org/jira/browse/GROOVY-7402
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.4.3
> Reporter: Jeff Scott Brown
> Attachments: traitannotation.zip
>
>
> Related to https://github.com/grails/grails-core/issues/663.
> The attached traitannotation.zip includes the following:
> {code:title=src/main/groovy/demo/SomeTrait.groovy|borderStyle=solid}
> package demo
> import groovy.transform.*
> @Immutable
> trait SomeTrait {
> String name
> }
> {code}
> {code:title=src/main/groovy/demo/SomeClass.groovy|borderStyle=solid}
> package demo
> class SomeClass implements SomeTrait {}
> {code}
> Compilation raises an NPE:
> {noformat}
> $ ./gradlew clean cG
> :clean
> :compileJava UP-TO-DATE
> :compileGroovy FAILED
> FAILURE: Build failed with an exception.
> * What went wrong:
> Execution failed for task ':compileGroovy'.
> > BUG! exception in phase 'instruction selection' in source unit '/Users/jeff/traitannotation/src/main/groovy/demo/SomeTrait.groovy' unexpected NullpointerException
> * Try:
> Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
> BUILD FAILED
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)