[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=15890120#comment-15890120 ] ASF GitHub Bot commented on GROOVY-7402: Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/499 > 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 >Assignee: Paul King > 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.15#6346)
[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=15873018#comment-15873018 ] Paul King commented on GROOVY-7402: --- I checked Groovy 2.3.0, the first release to contain traits, and combining @Immutable and traits (using the above example) resulted in the following error: {code} java.lang.ClassFormatError: Illegal class modifiers in class SomeTrait: 0x1419 {code} The problem is the {{SomeTrait$Trait$Helper}} inner class within {{SomeTrait}} is both abstract and final. The proposed PR removes the NPE and changes the above error to: {code} Error during @Immutable processing: annotation found on inappropriate class SomeTrait$Trait$Helper {code} I guess this could be improved a bit further but I think is an incremental improvement over what we have had in the past. > 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.15#6346)
[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=15873017#comment-15873017 ] ASF GitHub Bot commented on GROOVY-7402: GitHub user paulk-asert opened a pull request: https://github.com/apache/groovy/pull/499 GROOVY-7402: Compiler NPE Related To AST Transformations And Traits You can merge this pull request into a Git repository by running: $ git pull https://github.com/paulk-asert/groovy groovy7402 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/499.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #499 commit 9851c82a2b3cb2ae4d914daa523b9adc11faff0c Author: paulkDate: 2017-02-18T06:17:49Z GROOVY-7402: Compiler NPE Related To AST Transformations And Traits > 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.15#6346)
[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=15840877#comment-15840877 ] Paul King commented on GROOVY-7402: --- [~digitarts] I created this issue to track producing a better error message for protected fields: GROOVY-8066. Previously, they weren't really supported but the modifier was being ignored and treated as private. Whereas protected methods gave the correct error message. > 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)
[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=15829762#comment-15829762 ] Huabin Zhang commented on GROOVY-7402: -- Thanks, Paul, your solution works well: change protected to public. > 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)
[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=15829693#comment-15829693 ] Paul King commented on GROOVY-7402: --- [~digitarts], I haven't yet investigated your sample project but please raise a new issue. If you look at the Trait documentation, it says, "Traits only support public and private methods. Neither protected nor package private scopes are supported." I guess we should clarify what that means for the protected property that you have used. I suspect that 2.4.7 and 2.4.8 might have slightly different assumptions in that case. It might end up being a duplicate of GROOVY-8048 but I think it is worth investigating separately. > 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)
[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=15827527#comment-15827527 ] Huabin Zhang commented on GROOVY-7402: -- Hi, guys, after upgrading from 2.4.7 to 2.4.8, I got an NPE during gradle compilation. The most important is I did not use AST on the trait, so I think it should be a new bug but similar to this one. Please see my [sample project|https://github.com/zhanghuabin/groovy248-npe] to reproduce the problem. > 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)