[jira] [Assigned] (GROOVY-7856) Adding CompileStatic via compiler config script to class with eachWithIndex results in exception in instruction selection phase

2016-07-17 Thread Paul King (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-7856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King reassigned GROOVY-7856:
-

Assignee: Paul King

> Adding CompileStatic via compiler config script to class with eachWithIndex 
> results in exception in instruction selection phase
> ---
>
> Key: GROOVY-7856
> URL: https://issues.apache.org/jira/browse/GROOVY-7856
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.4.7
> Environment: Groovy Version: 2.4.7 JVM: 1.8.0_92 Vendor: Oracle 
> Corporation OS: Linux
>Reporter: Rick Venutolo
>Assignee: Paul King
>Priority: Minor
>
> I have run into an issue when adding the CompileStatic AST transformation to 
> a class via the Groovy compiler configscript argument.
> {code:title=Demo.groovy|borderStyle=solid}
> class Demo {
> void test() {
> ['a', 'b'].eachWithIndex {String s, int i -> println "$i: $s"}
> }
> }
> {code}
> {code:title=config.groovy|borderStyle=solid}
> import groovy.transform.CompileStatic
> import org.codehaus.groovy.ast.ClassNode
> withConfig(configuration) {
> source(classValidator: {ClassNode classNode -> 
> classNode.nameWithoutPackage == 'Demo'}) {
> ast(CompileStatic)
> }
> }
> {code}
> {code:title=Compile using --configscript|borderStyle=solid}
> $ groovyc --configscript config.groovy Demo.groovy
> {code}
> {code:title=Output (abbreviated)|borderStyle=solid}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'Demo.groovy' unexpected NullpointerException
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'Demo.groovy' 
> unexpected NullpointerException
> at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1058)
> at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
> at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
> ...
> Caused by: java.lang.NullPointerException
> at 
> org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:180)
> at 
> org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:170)
> at 
> org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:126)
>   ...
> {code}
> *Notes*
> * Groovy & JVM versions: {{Groovy Version: 2.4.7 JVM: 1.8.0_92 Vendor: Oracle 
> Corporation OS: Linux}}
> ** Have tried Groovy versions going back to 2.4.3 and Oracle JVM 1.7.0_79
> * Changing any of the following will result in no compilation error:
> ** Remove the {{source(classValidator: ...)}} code around {{ast}}, leaving 
> {{ast(CompileStatic)}}, in the compiler config script
> ** Replace the {{eachWithIndex}} call in Demo with {{each}}
> ** Annotate {{Demo}} with {{@CompileStatic}} and compile without 
> {{--configscript}}
> I have detailed and demoed the bug 
> [here|https://github.com/rvenutolo/compilestatic-compiler-config] with some 
> code you can clone and run.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7856) Adding CompileStatic via compiler config script to class with eachWithIndex results in exception in instruction selection phase

2016-07-17 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15381618#comment-15381618
 ] 

Paul King commented on GROOVY-7856:
---

I have a temporary fix in the master branch. Basically the static compiler is 
trying to find the class {{Integer}} (no package). This is taken directly from 
the {{@ClosureParams}} options attribute hint. I haven't had enough time yet to 
work out why using {{--configscript}} doesn't do the same package name 
resolving as seems to occur normally (without {{--configscript}}). So for now I 
have {{java.lang.Integer}} in the hint. We should really understand why this is 
occurring and also I haven't created a test case yet, so I'll leave the issue 
open for now. But any feedback in the meantime on whether this fixes things for 
you would be appreciated.

> Adding CompileStatic via compiler config script to class with eachWithIndex 
> results in exception in instruction selection phase
> ---
>
> Key: GROOVY-7856
> URL: https://issues.apache.org/jira/browse/GROOVY-7856
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.4.7
> Environment: Groovy Version: 2.4.7 JVM: 1.8.0_92 Vendor: Oracle 
> Corporation OS: Linux
>Reporter: Rick Venutolo
>Priority: Minor
>
> I have run into an issue when adding the CompileStatic AST transformation to 
> a class via the Groovy compiler configscript argument.
> {code:title=Demo.groovy|borderStyle=solid}
> class Demo {
> void test() {
> ['a', 'b'].eachWithIndex {String s, int i -> println "$i: $s"}
> }
> }
> {code}
> {code:title=config.groovy|borderStyle=solid}
> import groovy.transform.CompileStatic
> import org.codehaus.groovy.ast.ClassNode
> withConfig(configuration) {
> source(classValidator: {ClassNode classNode -> 
> classNode.nameWithoutPackage == 'Demo'}) {
> ast(CompileStatic)
> }
> }
> {code}
> {code:title=Compile using --configscript|borderStyle=solid}
> $ groovyc --configscript config.groovy Demo.groovy
> {code}
> {code:title=Output (abbreviated)|borderStyle=solid}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'Demo.groovy' unexpected NullpointerException
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'Demo.groovy' 
> unexpected NullpointerException
> at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1058)
> at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
> at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
> ...
> Caused by: java.lang.NullPointerException
> at 
> org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:180)
> at 
> org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:170)
> at 
> org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:126)
>   ...
> {code}
> *Notes*
> * Groovy & JVM versions: {{Groovy Version: 2.4.7 JVM: 1.8.0_92 Vendor: Oracle 
> Corporation OS: Linux}}
> ** Have tried Groovy versions going back to 2.4.3 and Oracle JVM 1.7.0_79
> * Changing any of the following will result in no compilation error:
> ** Remove the {{source(classValidator: ...)}} code around {{ast}}, leaving 
> {{ast(CompileStatic)}}, in the compiler config script
> ** Replace the {{eachWithIndex}} call in Demo with {{each}}
> ** Annotate {{Demo}} with {{@CompileStatic}} and compile without 
> {{--configscript}}
> I have detailed and demoed the bug 
> [here|https://github.com/rvenutolo/compilestatic-compiler-config] with some 
> code you can clone and run.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] groovy pull request #351: GROOVY-7862: Statically compiled calls to protecte...

2016-07-17 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/351


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (GROOVY-7862) Statically compiled calls to protected methods of an outerclass' superclass result in IllegalAccessErrors

2016-07-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15381387#comment-15381387
 ] 

ASF GitHub Bot commented on GROOVY-7862:


Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/351


> Statically compiled calls to protected methods of an outerclass' superclass 
> result in IllegalAccessErrors
> -
>
> Key: GROOVY-7862
> URL: https://issues.apache.org/jira/browse/GROOVY-7862
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.4.7
>Reporter: Shil Sinha
>
> Example:
> {code}
> package one;
> public class Base {
> protected int foo() {
> 123
> }
> }
> {code}
> {code}
> package two;
> class SubBase extends Base {
> class Inner {
> int test() {
> foo()
> }
> }
> 
> int innerTest() {
> new Inner().test()
> }
> }
> assert new SubBase().innerTest() == 123
> {code}
> The code above will fail with the following error:
> {code}
> java.lang.IllegalAccessError: tried to access method one.Base.foo()I from 
> class two.SubBase$Inner
> {code}
> This is due to bridge methods for protected methods not being correctly 
> generated (and subsequently used when writing protected method invocations.)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Assigned] (GROOVY-7872) Nested calls between @Lazy static properties throws MissingPropertyException

2016-07-17 Thread Paul King (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-7872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King reassigned GROOVY-7872:
-

Assignee: Paul King

> Nested calls between @Lazy static properties throws MissingPropertyException
> 
>
> Key: GROOVY-7872
> URL: https://issues.apache.org/jira/browse/GROOVY-7872
> Project: Groovy
>  Issue Type: Bug
>Reporter: Endika GutiƩrrez
>Assignee: Paul King
>Priority: Minor
> Fix For: 2.5.0-beta-1
>
>
> This piece of code throws {{MissingPropertyException}}
> {noformat}
> class LazyTesting {
>   @Lazy static final Set STRING_SET = ['a', 'b', 'c'] as Set
>   @Lazy static final Set BIGGER_STRING_SET = (['d', 'e', 'f'] + 
> STRING_SET) as Set
> }
> println LazyTesting.BIGGER_STRING_SET
> {noformat}
> {noformat}
> java.lang.ExceptionInInitializerError
>   at LazyTesting.getBIGGER_STRING_SET(test.groovy)
>   at test.run(test.groovy:6)
> Caused by: groovy.lang.MissingPropertyException: No such property: STRING_SET 
> for class: LazyTesting$SetHolder_BIGGER_STRING_SET
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Resolved] (GROOVY-7872) Nested calls between @Lazy static properties throws MissingPropertyException

2016-07-17 Thread Paul King (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-7872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King resolved GROOVY-7872.
---
   Resolution: Fixed
Fix Version/s: 2.5.0-beta-1

merged, thanks!

> Nested calls between @Lazy static properties throws MissingPropertyException
> 
>
> Key: GROOVY-7872
> URL: https://issues.apache.org/jira/browse/GROOVY-7872
> Project: Groovy
>  Issue Type: Bug
>Reporter: Endika GutiƩrrez
>Assignee: Paul King
>Priority: Minor
> Fix For: 2.5.0-beta-1
>
>
> This piece of code throws {{MissingPropertyException}}
> {noformat}
> class LazyTesting {
>   @Lazy static final Set STRING_SET = ['a', 'b', 'c'] as Set
>   @Lazy static final Set BIGGER_STRING_SET = (['d', 'e', 'f'] + 
> STRING_SET) as Set
> }
> println LazyTesting.BIGGER_STRING_SET
> {noformat}
> {noformat}
> java.lang.ExceptionInInitializerError
>   at LazyTesting.getBIGGER_STRING_SET(test.groovy)
>   at test.run(test.groovy:6)
> Caused by: groovy.lang.MissingPropertyException: No such property: STRING_SET 
> for class: LazyTesting$SetHolder_BIGGER_STRING_SET
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] groovy pull request #354: GROOVY-7872 Fix nested calls between @Lazy static ...

2016-07-17 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/354


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (GROOVY-5501) When inspecting the AST, it would be nice to have the node metadata properties listed too

2016-07-17 Thread Paul King (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-5501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15381141#comment-15381141
 ] 

Paul King commented on GROOVY-5501:
---

I applied an improvement based on the earlier PR's but tweaked to fix some of 
the identified issues previously. There are no doubt other improvements that 
could piggy-back on this one.

> When inspecting the AST, it would be nice to have the node metadata 
> properties listed too
> -
>
> Key: GROOVY-5501
> URL: https://issues.apache.org/jira/browse/GROOVY-5501
> Project: Groovy
>  Issue Type: Sub-task
>  Components: Groovy Console
>Reporter: Ariel Morelli Andres
>Assignee: Paul King
> Fix For: 2.5.0-beta-1
>
> Attachments: typeCheckingProperties.patch
>
>
> I use the Groovy Console to inspect the AST during the different compilation 
> phases.
> Particularly I'm interested in the static type checking metadata properties.
> I've included a patch. Let me know what you think about it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Assigned] (GROOVY-5501) When inspecting the AST, it would be nice to have the node metadata properties listed too

2016-07-17 Thread Paul King (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-5501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King reassigned GROOVY-5501:
-

Assignee: Paul King

> When inspecting the AST, it would be nice to have the node metadata 
> properties listed too
> -
>
> Key: GROOVY-5501
> URL: https://issues.apache.org/jira/browse/GROOVY-5501
> Project: Groovy
>  Issue Type: Sub-task
>  Components: Groovy Console
>Reporter: Ariel Morelli Andres
>Assignee: Paul King
> Fix For: 2.5.0-beta-1
>
> Attachments: typeCheckingProperties.patch
>
>
> I use the Groovy Console to inspect the AST during the different compilation 
> phases.
> Particularly I'm interested in the static type checking metadata properties.
> I've included a patch. Let me know what you think about it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Resolved] (GROOVY-5501) When inspecting the AST, it would be nice to have the node metadata properties listed too

2016-07-17 Thread Paul King (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-5501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King resolved GROOVY-5501.
---
   Resolution: Fixed
Fix Version/s: 2.5.0-beta-1

> When inspecting the AST, it would be nice to have the node metadata 
> properties listed too
> -
>
> Key: GROOVY-5501
> URL: https://issues.apache.org/jira/browse/GROOVY-5501
> Project: Groovy
>  Issue Type: Sub-task
>  Components: Groovy Console
>Reporter: Ariel Morelli Andres
>Assignee: Paul King
> Fix For: 2.5.0-beta-1
>
> Attachments: typeCheckingProperties.patch
>
>
> I use the Groovy Console to inspect the AST during the different compilation 
> phases.
> Particularly I'm interested in the static type checking metadata properties.
> I've included a patch. Let me know what you think about it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)