[jira] [Commented] (GROOVY-8758) @WithReadLock in inner class of @CompileStatic class causes java.lang.VerifyError

2018-08-20 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on GROOVY-8758:


GitHub user paulk-asert opened a pull request:

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

GROOVY-8758: @WithReadLock in inner class of @CompileStatic class cau…

…ses java.lang.VerifyError

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/paulk-asert/groovy groovy8758

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/groovy/pull/787.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 #787


commit 3e2888e0f6f76054d5a3f4a6b2a5075a28495a4d
Author: Paul King 
Date:   2018-08-21T05:22:21Z

GROOVY-8758: @WithReadLock in inner class of @CompileStatic class causes 
java.lang.VerifyError




> @WithReadLock in inner class of @CompileStatic class causes 
> java.lang.VerifyError
> -
>
> Key: GROOVY-8758
> URL: https://issues.apache.org/jira/browse/GROOVY-8758
> Project: Groovy
>  Issue Type: Bug
>  Components: bytecode, Static compilation
>Affects Versions: 2.5.2
> Environment: Ubuntu 18.04 x86_64, OpenJDK 10
>Reporter: Curtis Mackie
>Assignee: Paul King
>Priority: Major
>
> Minimal reproduction:
> {code:java}
> import groovy.transform.CompileStatic
> import groovy.transform.WithReadLock
> @CompileStatic
> class A {
>     private class B {
>     @WithReadLock
>     int getFoo() {
>     0
>     }
>     }
>     private B b
>     A() {
>     b = new B()
>     }
> }
> def a = new A()
> {code}
> Output from groovy:
> {noformat}
> Caught: java.lang.VerifyError: Bad type on operand stack
> Exception Details:
>   Location:
>     A$B.getFoo()I @4: invokevirtual
>   Reason:
>     Type 'A' (current frame, stack[0]) is not assignable to 
> 'java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock'
>   Current Frame:
>     bci: @4
>     flags: { }
>     locals: { 'A$B' }
>     stack: { 'A' }
>   Bytecode:
>     0x000: 2ab4 0015 b600 2d01 5703 3c00 2ab4 0015
>     0x010: b600 3001 5700 1bac  bf00  
>     0x020:    00bf 4d2a b400 15b6 0030
>     0x030: 0157 2cbf  bf  
>   Exception Handler Table:
>     bci [9, 12] => handler: 40
>     bci [22, 24] => handler: 40
>   Stackmap Table:
>     full_frame(@24,{},{Object[#51]})
>     same_locals_1_stack_item_frame(@27,Object[#51])
>     full_frame(@40,{Object[#2]},{Object[#51]})
>     full_frame(@52,{},{Object[#51]})
> java.lang.VerifyError: Bad type on operand stack
> Exception Details:
>   Location:
>     A$B.getFoo()I @4: invokevirtual
>   Reason:
>     Type 'A' (current frame, stack[0]) is not assignable to 
> 'java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock'
>   Current Frame:
>     bci: @4
>     flags: { }
>     locals: { 'A$B' }
>     stack: { 'A' }
>   Bytecode:
>     0x000: 2ab4 0015 b600 2d01 5703 3c00 2ab4 0015
>     0x010: b600 3001 5700 1bac  bf00  
>     0x020:    00bf 4d2a b400 15b6 0030
>     0x030: 0157 2cbf  bf  
>   Exception Handler Table:
>     bci [9, 12] => handler: 40
>     bci [22, 24] => handler: 40
>   Stackmap Table:
>     full_frame(@24,{},{Object[#51]})
>     same_locals_1_stack_item_frame(@27,Object[#51])
>     full_frame(@40,{Object[#2]},{Object[#51]})
>     full_frame(@52,{},{Object[#51]})
>     at A.(test.groovy:16)
>     at test.run(test.groovy:20){noformat}
> From a glance at the bytecode, it looks like Groovy is creating the 
> $reentrantlock field in A$B as it should, but in the actual method it tries 
> to use this$0 (i.e. the reference to the enclosing outer A object) as a 
> ReentrantReadWriteLock instead.
> This error also occurs with @WithWriteLock, but doesn't occur with 
> @Synchronized.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] groovy pull request #787: GROOVY-8758: @WithReadLock in inner class of @Comp...

2018-08-20 Thread paulk-asert
GitHub user paulk-asert opened a pull request:

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

GROOVY-8758: @WithReadLock in inner class of @CompileStatic class cau…

…ses java.lang.VerifyError

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/paulk-asert/groovy groovy8758

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/groovy/pull/787.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 #787


commit 3e2888e0f6f76054d5a3f4a6b2a5075a28495a4d
Author: Paul King 
Date:   2018-08-21T05:22:21Z

GROOVY-8758: @WithReadLock in inner class of @CompileStatic class causes 
java.lang.VerifyError




---


[jira] [Commented] (GROOVY-8703) NamedVariant on constructor

2018-08-20 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8703:
---

I might send an email to the dev list about this.

> NamedVariant on constructor
> ---
>
> Key: GROOVY-8703
> URL: https://issues.apache.org/jira/browse/GROOVY-8703
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.1
>Reporter: Eric Milles
>Priority: Major
>
> Tried this example and got cast exception converting Map to Integer.  Should 
> the print statement at the end use the generated map constructor as expected? 
>  (Note: I am compiling with indy variant; tried to use web console to try 
> vanilla MOP...)
> {code:groovy}
> import groovy.transform.*
> import groovy.transform.options.*
> @ToString(includeNames=true)
> class Color {
>   final Integer r, g, b
>   @NamedVariant @VisibilityOptions(Visibility.PUBLIC)
>   private Color(Integer r, Integer g, Integer b) {
> this.r = r
> this.g = g
> this.b = b
>   }
>   public static final Color BLACK = new Color(0, 0, 0)
> }
> print(new Color(g:12, b:42, r:12)) // gives 
> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast 
> object '{}' with class 'java.util.LinkedHashMap' to class 'java.lang.Integer'
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Resolved] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Paul King (JIRA)


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

Paul King resolved GROOVY-8753.
---
Resolution: Fixed

It's quite possible we still need to tweak our build to more accurately reflect 
task inputs. I frequently clear/turn off the build cache but I am often 
changing the Groovy compiler itself which can change what bytecode is generated 
even when source files don't change and that second order task dependency is a 
harder thing to reflect in the task configuration. In any case, I'll re-close 
this for now. Feel free to open a different issue if you want to track down why 
the cache seems a bit too sticky for your build scenario. PRs also welcome! :-)

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> 

[jira] [Commented] (GROOVY-8740) groovy.util.CliBuilder doesn't handle parse errors correctly

2018-08-20 Thread Remko Popma (JIRA)


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

Remko Popma commented on GROOVY-8740:
-

FYI I fixed the picocli CliBuilder so it behaves the same as the commons-cli 
CliBuilder.

> groovy.util.CliBuilder doesn't handle parse errors correctly
> 
>
> Key: GROOVY-8740
> URL: https://issues.apache.org/jira/browse/GROOVY-8740
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-jdk
>Affects Versions: 2.5.1
>Reporter: Роман Донченко
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.2
>
>
> In Groovy 2.5, {{groovy.util.CliBuilder}} is a wrapper that delegates to 
> {{groovy.cli.commons.CliBuilder}}. However, this wrapper doesn't correctly 
> handle the case when the arguments fail to be parsed.
> Here's how it works with the real {{CliBuilder}}:
> {code:java}
> groovy:000> options = new groovy.cli.commons.CliBuilder(stopAtNonOption: 
> false).parse(['-x'])
> error: Unrecognized option: -x
> usage: groovy
> ===> null{code}
> And here's what happens with the wrapper:
> {code:java}
> groovy:000> options = new groovy.util.CliBuilder(stopAtNonOption: 
> false).parse(['-x'])
> error: Unrecognized option: -x
> usage: groovy
> ===> groovy.util.OptionAccessor@6fc3e1a4
> groovy:000> options.arguments()
> ERROR java.lang.NullPointerException:
> Cannot invoke method arguments() on null object{code}
> I get an object that pretends to be {{null}}, but isn't. So I can't determine 
> whether the parsing was successful or not.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Resolved] (GROOVY-8759) groovy.cli.picocli.CliBuilder should behave like cli.commons.CliBuilder on invalid options

2018-08-20 Thread Remko Popma (JIRA)


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

Remko Popma resolved GROOVY-8759.
-
Resolution: Fixed

Fixed by setting the picocli both ParserSpec's {{stopAtPositional}} and 
{{unmatchedOptionsArePositionalParams}} properties to the value of 
{{stopAtNonOption}}:

{code}
void setStopAtNonOption(boolean stopAtNonOption) {
this.stopAtNonOption = stopAtNonOption
parser.stopAtPositional(stopAtNonOption)
parser.unmatchedOptionsArePositionalParams(stopAtNonOption)
}
{code}

> groovy.cli.picocli.CliBuilder should behave like cli.commons.CliBuilder on 
> invalid options
> --
>
> Key: GROOVY-8759
> URL: https://issues.apache.org/jira/browse/GROOVY-8759
> Project: Groovy
>  Issue Type: Dependency upgrade
>  Components: command line processing
>Affects Versions: 2.5.2
>Reporter: Remko Popma
>Assignee: Remko Popma
>Priority: Major
> Fix For: 2.5.3
>
>
> When {{stopAtNonOption: false}} flag is set, the two versions of CliBuilder 
> behave differently. (See GROOVY-8740)
> The commons cli version of CliBuilder returns {{null}}:
> {code}
> def optCommons = new groovy.cli.commons.CliBuilder(stopAtNonOption: 
> false).parse(['-x'])
> if (optCommons) println "Okay" else println "Error"
> {code}
> The picocli version of CliBuilder returns a non-null options object with the 
> {{"-x"}} value as a positional parameter:
> {code}
> def optCli = new groovy.cli.picocli.CliBuilder(stopAtNonOption: 
> false).parse(['-x'])
> if (optCli) println "Okay" else println "Error"
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (GROOVY-8759) groovy.cli.picocli.CliBuilder should behave like cli.commons.CliBuilder on invalid options

2018-08-20 Thread Remko Popma (JIRA)
Remko Popma created GROOVY-8759:
---

 Summary: groovy.cli.picocli.CliBuilder should behave like 
cli.commons.CliBuilder on invalid options
 Key: GROOVY-8759
 URL: https://issues.apache.org/jira/browse/GROOVY-8759
 Project: Groovy
  Issue Type: Dependency upgrade
  Components: command line processing
Affects Versions: 2.5.2
Reporter: Remko Popma
Assignee: Remko Popma
 Fix For: 2.5.3


When {{stopAtNonOption: false}} flag is set, the two versions of CliBuilder 
behave differently. (See GROOVY-8740)

The commons cli version of CliBuilder returns {{null}}:
{code}
def optCommons = new groovy.cli.commons.CliBuilder(stopAtNonOption: 
false).parse(['-x'])
if (optCommons) println "Okay" else println "Error"
{code}

The picocli version of CliBuilder returns a non-null options object with the 
{{"-x"}} value as a positional parameter:
{code}
def optCli = new groovy.cli.picocli.CliBuilder(stopAtNonOption: 
false).parse(['-x'])
if (optCli) println "Okay" else println "Error"
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (GROOVY-8757) Incorrect bytecode produced after compiling class implementing trait with generic method

2018-08-20 Thread Paul King (JIRA)


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

Paul King edited comment on GROOVY-8757 at 8/21/18 12:02 AM:
-

Trait helper class itself looks okay:
{code}
$ javap T$Trait$Helper.class
Compiled from "T.groovy"
public abstract class T$Trait$Helper implements groovy.lang.GroovyObject {
  ...
  public static  T foo(T, java.lang.Class);
  ...
}
{code}
As does the interface:
{code}
$ javap T.class
Compiled from "T.groovy"
public interface T {
  public abstract  T foo(java.lang.Class);
}
{code}



was (Author: paulk):
Trait helper class itself looks okay:
{code}
$ javap T$Trait$Helper.class
Compiled from "T.groovy"
public abstract class T$Trait$Helper implements groovy.lang.GroovyObject {
  ...
  public static  T foo(T, java.lang.Class);
  ...
}
{code}


> Incorrect bytecode produced after compiling class implementing trait with 
> generic method
> 
>
> Key: GROOVY-8757
> URL: https://issues.apache.org/jira/browse/GROOVY-8757
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.4.15, 3.0.0-alpha-3, 2.5.2
>Reporter: Daniil Ovchinnikov
>Priority: Critical
>
> {code:java|title=T.groovy}
> trait T {
> def  T foo(Class c) {
> println c
> return null 
> }
> }
> {code}
> {code:java|title=C.groovy}
> class C implements T {}
> {code}
> {code:java|title=usage.groovy}
> new C().foo(Integer)
> {code}
> {noformat}
> $ groovyc C.groovy T.groovy
> $ groovy usage.groovy
> class java.lang.Integer
> $ groovyc C.groovy # recompile C using already compiled T
> $ groovy usage.groovy
> Caught: java.lang.VerifyError: Bad return type
> Exception Details:
>   Location:
> C.foo(Ljava/lang/Class;)Ljava/lang/Number; @5: areturn
>   Reason:
> Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 
> 'java/lang/Number' (from method signature)
>   Current Frame:
> bci: @5
> flags: { }
> locals: { 'C', 'java/lang/Class' }
> stack: { 'java/lang/Object' }
>   Bytecode:
> 0x000: 2a2b b600 88b0
> java.lang.VerifyError: Bad return type
> Exception Details:
>   Location:
> C.foo(Ljava/lang/Class;)Ljava/lang/Number; @5: areturn
>   Reason:
> Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 
> 'java/lang/Number' (from method signature)
>   Current Frame:
> bci: @5
> flags: { }
> locals: { 'C', 'java/lang/Class' }
> stack: { 'java/lang/Object' }
>   Bytecode:
> 0x000: 2a2b b600 88b0
>   at usage.run(usage.groovy:1)
> {noformat}
> {noformat:title=original javap output}
> public class C implements T,groovy.lang.GroovyObject {
>   public static transient boolean __$stMC;
>   public C();
>   public  T foo(java.lang.Class);
>   public  T Ttrait$super$foo(java.lang.Class);
>   static {};
>   protected groovy.lang.MetaClass $getStaticMetaClass();
>   public groovy.lang.MetaClass getMetaClass();
>   public void setMetaClass(groovy.lang.MetaClass);
>   public java.lang.Object invokeMethod(java.lang.String, java.lang.Object);
>   public java.lang.Object getProperty(java.lang.String);
>   public void setProperty(java.lang.String, java.lang.Object);
> }
> {noformat}
> {noformat:title=recompiled javap output}
> public class C implements T,groovy.lang.GroovyObject {
>   public static transient boolean __$stMC;
>   public C();
>   public  T foo(java.lang.Class);
>   public  T Ttrait$super$foo(java.lang.Class);
>   static {};
>   protected groovy.lang.MetaClass $getStaticMetaClass();
>   public groovy.lang.MetaClass getMetaClass();
>   public void setMetaClass(groovy.lang.MetaClass);
>   public java.lang.Object invokeMethod(java.lang.String, java.lang.Object);
>   public java.lang.Object getProperty(java.lang.String);
>   public void setProperty(java.lang.String, java.lang.Object);
>   public java.lang.Number foo(java.lang.Class);
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GROOVY-8757) Incorrect bytecode produced after compiling class implementing trait with generic method

2018-08-20 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8757:
---

Trait helper class itself looks okay:
{code}
$ javap T$Trait$Helper.class
Compiled from "T.groovy"
public abstract class T$Trait$Helper implements groovy.lang.GroovyObject {
  ...
  public static  T foo(T, java.lang.Class);
  ...
}
{code}


> Incorrect bytecode produced after compiling class implementing trait with 
> generic method
> 
>
> Key: GROOVY-8757
> URL: https://issues.apache.org/jira/browse/GROOVY-8757
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.4.15, 3.0.0-alpha-3, 2.5.2
>Reporter: Daniil Ovchinnikov
>Priority: Critical
>
> {code:java|title=T.groovy}
> trait T {
> def  T foo(Class c) {
> println c
> return null 
> }
> }
> {code}
> {code:java|title=C.groovy}
> class C implements T {}
> {code}
> {code:java|title=usage.groovy}
> new C().foo(Integer)
> {code}
> {noformat}
> $ groovyc C.groovy T.groovy
> $ groovy usage.groovy
> class java.lang.Integer
> $ groovyc C.groovy # recompile C using already compiled T
> $ groovy usage.groovy
> Caught: java.lang.VerifyError: Bad return type
> Exception Details:
>   Location:
> C.foo(Ljava/lang/Class;)Ljava/lang/Number; @5: areturn
>   Reason:
> Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 
> 'java/lang/Number' (from method signature)
>   Current Frame:
> bci: @5
> flags: { }
> locals: { 'C', 'java/lang/Class' }
> stack: { 'java/lang/Object' }
>   Bytecode:
> 0x000: 2a2b b600 88b0
> java.lang.VerifyError: Bad return type
> Exception Details:
>   Location:
> C.foo(Ljava/lang/Class;)Ljava/lang/Number; @5: areturn
>   Reason:
> Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 
> 'java/lang/Number' (from method signature)
>   Current Frame:
> bci: @5
> flags: { }
> locals: { 'C', 'java/lang/Class' }
> stack: { 'java/lang/Object' }
>   Bytecode:
> 0x000: 2a2b b600 88b0
>   at usage.run(usage.groovy:1)
> {noformat}
> {noformat:title=original javap output}
> public class C implements T,groovy.lang.GroovyObject {
>   public static transient boolean __$stMC;
>   public C();
>   public  T foo(java.lang.Class);
>   public  T Ttrait$super$foo(java.lang.Class);
>   static {};
>   protected groovy.lang.MetaClass $getStaticMetaClass();
>   public groovy.lang.MetaClass getMetaClass();
>   public void setMetaClass(groovy.lang.MetaClass);
>   public java.lang.Object invokeMethod(java.lang.String, java.lang.Object);
>   public java.lang.Object getProperty(java.lang.String);
>   public void setProperty(java.lang.String, java.lang.Object);
> }
> {noformat}
> {noformat:title=recompiled javap output}
> public class C implements T,groovy.lang.GroovyObject {
>   public static transient boolean __$stMC;
>   public C();
>   public  T foo(java.lang.Class);
>   public  T Ttrait$super$foo(java.lang.Class);
>   static {};
>   protected groovy.lang.MetaClass $getStaticMetaClass();
>   public groovy.lang.MetaClass getMetaClass();
>   public void setMetaClass(groovy.lang.MetaClass);
>   public java.lang.Object invokeMethod(java.lang.String, java.lang.Object);
>   public java.lang.Object getProperty(java.lang.String);
>   public void setProperty(java.lang.String, java.lang.Object);
>   public java.lang.Number foo(java.lang.Class);
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (GROOVY-8757) Incorrect bytecode produced after compiling class implementing trait with generic method

2018-08-20 Thread Paul King (JIRA)


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

Paul King updated GROOVY-8757:
--
Affects Version/s: 2.5.2

> Incorrect bytecode produced after compiling class implementing trait with 
> generic method
> 
>
> Key: GROOVY-8757
> URL: https://issues.apache.org/jira/browse/GROOVY-8757
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.4.15, 3.0.0-alpha-3, 2.5.2
>Reporter: Daniil Ovchinnikov
>Priority: Critical
>
> {code:java|title=T.groovy}
> trait T {
> def  T foo(Class c) {
> println c
> return null 
> }
> }
> {code}
> {code:java|title=C.groovy}
> class C implements T {}
> {code}
> {code:java|title=usage.groovy}
> new C().foo(Integer)
> {code}
> {noformat}
> $ groovyc C.groovy T.groovy
> $ groovy usage.groovy
> class java.lang.Integer
> $ groovyc C.groovy # recompile C using already compiled T
> $ groovy usage.groovy
> Caught: java.lang.VerifyError: Bad return type
> Exception Details:
>   Location:
> C.foo(Ljava/lang/Class;)Ljava/lang/Number; @5: areturn
>   Reason:
> Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 
> 'java/lang/Number' (from method signature)
>   Current Frame:
> bci: @5
> flags: { }
> locals: { 'C', 'java/lang/Class' }
> stack: { 'java/lang/Object' }
>   Bytecode:
> 0x000: 2a2b b600 88b0
> java.lang.VerifyError: Bad return type
> Exception Details:
>   Location:
> C.foo(Ljava/lang/Class;)Ljava/lang/Number; @5: areturn
>   Reason:
> Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 
> 'java/lang/Number' (from method signature)
>   Current Frame:
> bci: @5
> flags: { }
> locals: { 'C', 'java/lang/Class' }
> stack: { 'java/lang/Object' }
>   Bytecode:
> 0x000: 2a2b b600 88b0
>   at usage.run(usage.groovy:1)
> {noformat}
> {noformat:title=original javap output}
> public class C implements T,groovy.lang.GroovyObject {
>   public static transient boolean __$stMC;
>   public C();
>   public  T foo(java.lang.Class);
>   public  T Ttrait$super$foo(java.lang.Class);
>   static {};
>   protected groovy.lang.MetaClass $getStaticMetaClass();
>   public groovy.lang.MetaClass getMetaClass();
>   public void setMetaClass(groovy.lang.MetaClass);
>   public java.lang.Object invokeMethod(java.lang.String, java.lang.Object);
>   public java.lang.Object getProperty(java.lang.String);
>   public void setProperty(java.lang.String, java.lang.Object);
> }
> {noformat}
> {noformat:title=recompiled javap output}
> public class C implements T,groovy.lang.GroovyObject {
>   public static transient boolean __$stMC;
>   public C();
>   public  T foo(java.lang.Class);
>   public  T Ttrait$super$foo(java.lang.Class);
>   static {};
>   protected groovy.lang.MetaClass $getStaticMetaClass();
>   public groovy.lang.MetaClass getMetaClass();
>   public void setMetaClass(groovy.lang.MetaClass);
>   public java.lang.Object invokeMethod(java.lang.String, java.lang.Object);
>   public java.lang.Object getProperty(java.lang.String);
>   public void setProperty(java.lang.String, java.lang.Object);
>   public java.lang.Number foo(java.lang.Class);
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Patric Bechtel (JIRA)


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

Patric Bechtel commented on GROOVY-8753:


Strike :)

That did the trick. Checking the docs, this cache even survives a clean... wtf? 
Isn't there a trick to make clean drop the build cache, too?

Thanks a lot, though. Am I the only one ever stumbled over that?

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:397)
>     at 
> 

[jira] [Comment Edited] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Paul King (JIRA)


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

Paul King edited comment on GROOVY-8753 at 8/20/18 11:49 PM:
-

That stacktrace definitely doesn't match the current branch:
https://github.com/apache/groovy/blob/GROOVY_2_5_X/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L502
 
All I can think of is adding {{--no-build-cache}} when building Groovy.


was (Author: paulk):
All I can think of is adding {{--no-build-cache}} when building Groovy.

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
>     

[jira] [Commented] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8753:
---

All I can think of is adding {{--no-build-cache}} when building Groovy.

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:397)
>     at 
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> 

[jira] [Updated] (GROOVY-8758) @WithReadLock in inner class of @CompileStatic class causes java.lang.VerifyError

2018-08-20 Thread Curtis Mackie (JIRA)


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

Curtis Mackie updated GROOVY-8758:
--
Description: 
Minimal reproduction:
{code:java}
import groovy.transform.CompileStatic
import groovy.transform.WithReadLock

@CompileStatic
class A {
    private class B {
    @WithReadLock
    int getFoo() {
    0
    }
    }

    private B b

    A() {
    b = new B()
    }
}

def a = new A()
{code}
Output from groovy:
{noformat}
Caught: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    A$B.getFoo()I @4: invokevirtual
  Reason:
    Type 'A' (current frame, stack[0]) is not assignable to 
'java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock'
  Current Frame:
    bci: @4
    flags: { }
    locals: { 'A$B' }
    stack: { 'A' }
  Bytecode:
    0x000: 2ab4 0015 b600 2d01 5703 3c00 2ab4 0015
    0x010: b600 3001 5700 1bac  bf00  
    0x020:    00bf 4d2a b400 15b6 0030
    0x030: 0157 2cbf  bf  
  Exception Handler Table:
    bci [9, 12] => handler: 40
    bci [22, 24] => handler: 40
  Stackmap Table:
    full_frame(@24,{},{Object[#51]})
    same_locals_1_stack_item_frame(@27,Object[#51])
    full_frame(@40,{Object[#2]},{Object[#51]})
    full_frame(@52,{},{Object[#51]})

java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    A$B.getFoo()I @4: invokevirtual
  Reason:
    Type 'A' (current frame, stack[0]) is not assignable to 
'java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock'
  Current Frame:
    bci: @4
    flags: { }
    locals: { 'A$B' }
    stack: { 'A' }
  Bytecode:
    0x000: 2ab4 0015 b600 2d01 5703 3c00 2ab4 0015
    0x010: b600 3001 5700 1bac  bf00  
    0x020:    00bf 4d2a b400 15b6 0030
    0x030: 0157 2cbf  bf  
  Exception Handler Table:
    bci [9, 12] => handler: 40
    bci [22, 24] => handler: 40
  Stackmap Table:
    full_frame(@24,{},{Object[#51]})
    same_locals_1_stack_item_frame(@27,Object[#51])
    full_frame(@40,{Object[#2]},{Object[#51]})
    full_frame(@52,{},{Object[#51]})

    at A.(test.groovy:16)
    at test.run(test.groovy:20){noformat}
>From a glance at the bytecode, it looks like Groovy is creating the 
>$reentrantlock field in A$B as it should, but in the actual method it tries to 
>use this$0 (i.e. the reference to the enclosing outer A object) as a 
>ReentrantReadWriteLock instead.

This error also occurs with @WithWriteLock, but doesn't occur with 
@Synchronized.

  was:
Minimal reproduction:

 
{code:java}
import groovy.transform.CompileStatic
import groovy.transform.WithReadLock

@CompileStatic
class A {
    private class B {
    @WithReadLock
    int getFoo() {
    0
    }
    }

    private B b

    A() {
    b = new B()
    }
}

def a = new A()
{code}
Output from groovy:

 

 
{noformat}
Caught: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    A$B.getFoo()I @4: invokevirtual
  Reason:
    Type 'A' (current frame, stack[0]) is not assignable to 
'java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock'
  Current Frame:
    bci: @4
    flags: { }
    locals: { 'A$B' }
    stack: { 'A' }
  Bytecode:
    0x000: 2ab4 0015 b600 2d01 5703 3c00 2ab4 0015
    0x010: b600 3001 5700 1bac  bf00  
    0x020:    00bf 4d2a b400 15b6 0030
    0x030: 0157 2cbf  bf  
  Exception Handler Table:
    bci [9, 12] => handler: 40
    bci [22, 24] => handler: 40
  Stackmap Table:
    full_frame(@24,{},{Object[#51]})
    same_locals_1_stack_item_frame(@27,Object[#51])
    full_frame(@40,{Object[#2]},{Object[#51]})
    full_frame(@52,{},{Object[#51]})

java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    A$B.getFoo()I @4: invokevirtual
  Reason:
    Type 'A' (current frame, stack[0]) is not assignable to 
'java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock'
  Current Frame:
    bci: @4
    flags: { }
    locals: { 'A$B' }
    stack: { 'A' }
  Bytecode:
    0x000: 2ab4 0015 b600 2d01 5703 3c00 2ab4 0015
    0x010: b600 3001 5700 1bac  bf00  
    0x020:    00bf 4d2a b400 15b6 0030
    0x030: 0157 2cbf  bf  
  Exception Handler Table:
    bci [9, 12] => handler: 40
    bci [22, 24] => handler: 40
  Stackmap Table:
    full_frame(@24,{},{Object[#51]})
    same_locals_1_stack_item_frame(@27,Object[#51])
    full_frame(@40,{Object[#2]},{Object[#51]})
    full_frame(@52,{},{Object[#51]})

    at A.(test.groovy:16)
    at test.run(test.groovy:20){noformat}
 

>From a glance at the bytecode, it looks like Groovy is creating the 
>$reentrantlock field in A$B as it should, but in the actual method it tries to 
>use this$0 (i.e. the reference to the 

[jira] [Created] (GROOVY-8758) @WithReadLock in inner class of @CompileStatic class causes java.lang.VerifyError

2018-08-20 Thread Curtis Mackie (JIRA)
Curtis Mackie created GROOVY-8758:
-

 Summary: @WithReadLock in inner class of @CompileStatic class 
causes java.lang.VerifyError
 Key: GROOVY-8758
 URL: https://issues.apache.org/jira/browse/GROOVY-8758
 Project: Groovy
  Issue Type: Bug
  Components: bytecode, Static compilation
Affects Versions: 2.5.2
 Environment: Ubuntu 18.04 x86_64, OpenJDK 10
Reporter: Curtis Mackie


Minimal reproduction:

 
{code:java}
import groovy.transform.CompileStatic
import groovy.transform.WithReadLock

@CompileStatic
class A {
    private class B {
    @WithReadLock
    int getFoo() {
    0
    }
    }

    private B b

    A() {
    b = new B()
    }
}

def a = new A()
{code}
Output from groovy:

 

 
{noformat}
Caught: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    A$B.getFoo()I @4: invokevirtual
  Reason:
    Type 'A' (current frame, stack[0]) is not assignable to 
'java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock'
  Current Frame:
    bci: @4
    flags: { }
    locals: { 'A$B' }
    stack: { 'A' }
  Bytecode:
    0x000: 2ab4 0015 b600 2d01 5703 3c00 2ab4 0015
    0x010: b600 3001 5700 1bac  bf00  
    0x020:    00bf 4d2a b400 15b6 0030
    0x030: 0157 2cbf  bf  
  Exception Handler Table:
    bci [9, 12] => handler: 40
    bci [22, 24] => handler: 40
  Stackmap Table:
    full_frame(@24,{},{Object[#51]})
    same_locals_1_stack_item_frame(@27,Object[#51])
    full_frame(@40,{Object[#2]},{Object[#51]})
    full_frame(@52,{},{Object[#51]})

java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    A$B.getFoo()I @4: invokevirtual
  Reason:
    Type 'A' (current frame, stack[0]) is not assignable to 
'java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock'
  Current Frame:
    bci: @4
    flags: { }
    locals: { 'A$B' }
    stack: { 'A' }
  Bytecode:
    0x000: 2ab4 0015 b600 2d01 5703 3c00 2ab4 0015
    0x010: b600 3001 5700 1bac  bf00  
    0x020:    00bf 4d2a b400 15b6 0030
    0x030: 0157 2cbf  bf  
  Exception Handler Table:
    bci [9, 12] => handler: 40
    bci [22, 24] => handler: 40
  Stackmap Table:
    full_frame(@24,{},{Object[#51]})
    same_locals_1_stack_item_frame(@27,Object[#51])
    full_frame(@40,{Object[#2]},{Object[#51]})
    full_frame(@52,{},{Object[#51]})

    at A.(test.groovy:16)
    at test.run(test.groovy:20){noformat}
 

>From a glance at the bytecode, it looks like Groovy is creating the 
>$reentrantlock field in A$B as it should, but in the actual method it tries to 
>use this$0 (i.e. the reference to the enclosing outer A object) as a 
>ReentrantReadWriteLock instead.

This error also occurs with @WithWriteLock, but doesn't occur with 
@Synchronized.

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Patric Bechtel (JIRA)


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

Patric Bechtel edited comment on GROOVY-8753 at 8/20/18 11:01 PM:
--

Just tried:
{noformat}
LANG=C git status{noformat}
{noformat}
On branch GROOVY_2_5_X
Your branch is up to date with 'origin/GROOVY_2_5_X'.

Untracked files:
  (use "git add ..." to include in what will be committed)

    A.groovy

nothing added to commit but untracked files present (use "git add" to track)
{noformat}
{noformat}
git pull; ./gradlew clean; ./gradlew installGroovy; 
{noformat}
{noformat}
java -cp target/install/lib/groovy-2.5.3-SNAPSHOT.jar 
org.codehaus.groovy.tools.FileSystemCompiler A.groovy{noformat}
results in
{noformat}
>>> a serious error occurred: BUG! exception in phase 'instruction selection' 
>>> in source unit 'A.groovy' Tried to overwrite existing meta data 
>>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
>>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
>>> property: ConstantExpression[fooNames]].
>>> stacktrace:
BUG! exception in phase 'instruction selection' in source unit 'A.groovy' Tried 
to overwrite existing meta data 
org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] property: 
ConstantExpression[fooNames]].
    at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
    at 
org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
    at 
org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
{noformat}
Oracle Java 8u181, Ubuntu 18.04.

*sigh*... wtf?

 


was (Author: patric42):
Just tried:
{noformat}
LANG=C git status{noformat}
{noformat}
On branch GROOVY_2_5_X
Your branch is up to date with 'origin/GROOVY_2_5_X'.

Untracked files:
  (use "git add ..." to include in what will be committed)

    A.groovy

nothing added to commit but untracked files present (use "git add" to track)
{noformat}
{noformat}
git pull; ./gradlew clean; gradlew installGroovy; 
{noformat}
{noformat}
java -cp target/install/lib/groovy-2.5.3-SNAPSHOT.jar 
org.codehaus.groovy.tools.FileSystemCompiler A.groovy{noformat}
results in
{noformat}
>>> a serious error occurred: BUG! exception in phase 'instruction selection' 
>>> in source unit 'A.groovy' Tried to overwrite existing meta data 
>>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
>>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
>>> property: ConstantExpression[fooNames]].
>>> stacktrace:
BUG! exception in phase 'instruction selection' in source unit 'A.groovy' Tried 
to overwrite existing meta data 
org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] property: 
ConstantExpression[fooNames]].
    at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
    at 
org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
    at 

[jira] [Comment Edited] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Patric Bechtel (JIRA)


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

Patric Bechtel edited comment on GROOVY-8753 at 8/20/18 11:00 PM:
--

Just tried:
{noformat}
LANG=C git status{noformat}
{noformat}
On branch GROOVY_2_5_X
Your branch is up to date with 'origin/GROOVY_2_5_X'.

Untracked files:
  (use "git add ..." to include in what will be committed)

    A.groovy

nothing added to commit but untracked files present (use "git add" to track)
{noformat}
{noformat}
git pull; ./gradlew clean; gradlew installGroovy; 
{noformat}
{noformat}
java -cp target/install/lib/groovy-2.5.3-SNAPSHOT.jar 
org.codehaus.groovy.tools.FileSystemCompiler A.groovy{noformat}
results in
{noformat}
>>> a serious error occurred: BUG! exception in phase 'instruction selection' 
>>> in source unit 'A.groovy' Tried to overwrite existing meta data 
>>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
>>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
>>> property: ConstantExpression[fooNames]].
>>> stacktrace:
BUG! exception in phase 'instruction selection' in source unit 'A.groovy' Tried 
to overwrite existing meta data 
org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] property: 
ConstantExpression[fooNames]].
    at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
    at 
org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
    at 
org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
{noformat}
Oracle Java 8u181, Ubuntu 18.04.

*sigh*... wtf?

 


was (Author: patric42):
Just tried:
{noformat}
git pull; ./gradlew clean; gradlew installGroovy;
java -cp target/install/lib/groovy-2.5.3-SNAPSHOT.jar 
org.codehaus.groovy.tools.FileSystemCompiler A.groov{noformat}
results in
{noformat}
>>> a serious error occurred: BUG! exception in phase 'instruction selection' 
>>> in source unit 'A.groovy' Tried to overwrite existing meta data 
>>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
>>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
>>> property: ConstantExpression[fooNames]].
>>> stacktrace:
BUG! exception in phase 'instruction selection' in source unit 'A.groovy' Tried 
to overwrite existing meta data 
org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] property: 
ConstantExpression[fooNames]].
    at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
    at 
org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
    at 
org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
{noformat}
Oracle Java 8u181, Ubuntu 18.04.

*sigh*... wtf?

 

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> 

[jira] [Commented] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Patric Bechtel (JIRA)


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

Patric Bechtel commented on GROOVY-8753:


Just tried:
{noformat}
git pull; ./gradlew clean; gradlew installGroovy;
java -cp target/install/lib/groovy-2.5.3-SNAPSHOT.jar 
org.codehaus.groovy.tools.FileSystemCompiler A.groov{noformat}
results in
{noformat}
>>> a serious error occurred: BUG! exception in phase 'instruction selection' 
>>> in source unit 'A.groovy' Tried to overwrite existing meta data 
>>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
>>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
>>> property: ConstantExpression[fooNames]].
>>> stacktrace:
BUG! exception in phase 'instruction selection' in source unit 'A.groovy' Tried 
to overwrite existing meta data 
org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] property: 
ConstantExpression[fooNames]].
    at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
    at 
org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
    at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
    at 
org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
{noformat}
Oracle Java 8u181, Ubuntu 18.04.

*sigh*... wtf?

 

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>    

[jira] [Created] (GROOVY-8757) Incorrect bytecode produced after compiling class implementing trait with generic method

2018-08-20 Thread Daniil Ovchinnikov (JIRA)
Daniil Ovchinnikov created GROOVY-8757:
--

 Summary: Incorrect bytecode produced after compiling class 
implementing trait with generic method
 Key: GROOVY-8757
 URL: https://issues.apache.org/jira/browse/GROOVY-8757
 Project: Groovy
  Issue Type: Bug
  Components: Compiler
Affects Versions: 3.0.0-alpha-3, 2.4.15
Reporter: Daniil Ovchinnikov


{code:java|title=T.groovy}
trait T {
def  T foo(Class c) {
println c
return null 
}
}
{code}
{code:java|title=C.groovy}
class C implements T {}
{code}
{code:java|title=usage.groovy}
new C().foo(Integer)
{code}
{noformat}
$ groovyc C.groovy T.groovy
$ groovy usage.groovy
class java.lang.Integer
$ groovyc C.groovy # recompile C using already compiled T
$ groovy usage.groovy
Caught: java.lang.VerifyError: Bad return type
Exception Details:
  Location:
C.foo(Ljava/lang/Class;)Ljava/lang/Number; @5: areturn
  Reason:
Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 
'java/lang/Number' (from method signature)
  Current Frame:
bci: @5
flags: { }
locals: { 'C', 'java/lang/Class' }
stack: { 'java/lang/Object' }
  Bytecode:
0x000: 2a2b b600 88b0

java.lang.VerifyError: Bad return type
Exception Details:
  Location:
C.foo(Ljava/lang/Class;)Ljava/lang/Number; @5: areturn
  Reason:
Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 
'java/lang/Number' (from method signature)
  Current Frame:
bci: @5
flags: { }
locals: { 'C', 'java/lang/Class' }
stack: { 'java/lang/Object' }
  Bytecode:
0x000: 2a2b b600 88b0

at usage.run(usage.groovy:1)
{noformat}

{noformat:title=original javap output}
public class C implements T,groovy.lang.GroovyObject {
  public static transient boolean __$stMC;
  public C();
  public  T foo(java.lang.Class);
  public  T Ttrait$super$foo(java.lang.Class);
  static {};
  protected groovy.lang.MetaClass $getStaticMetaClass();
  public groovy.lang.MetaClass getMetaClass();
  public void setMetaClass(groovy.lang.MetaClass);
  public java.lang.Object invokeMethod(java.lang.String, java.lang.Object);
  public java.lang.Object getProperty(java.lang.String);
  public void setProperty(java.lang.String, java.lang.Object);
}
{noformat}

{noformat:title=recompiled javap output}
public class C implements T,groovy.lang.GroovyObject {
  public static transient boolean __$stMC;
  public C();
  public  T foo(java.lang.Class);
  public  T Ttrait$super$foo(java.lang.Class);
  static {};
  protected groovy.lang.MetaClass $getStaticMetaClass();
  public groovy.lang.MetaClass getMetaClass();
  public void setMetaClass(groovy.lang.MetaClass);
  public java.lang.Object invokeMethod(java.lang.String, java.lang.Object);
  public java.lang.Object getProperty(java.lang.String);
  public void setProperty(java.lang.String, java.lang.Object);
  public java.lang.Number foo(java.lang.Class);
}
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GROOVY-8703) NamedVariant on constructor

2018-08-20 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8703:
---

Yes, the latter. Leaving off, by request was made equivalent to:

{code}

private Color(@NamedDelegate Integer r, Integer g, Integer b)

{code}

but in hindsight I wonder if that is the most intuitive approach.

> NamedVariant on constructor
> ---
>
> Key: GROOVY-8703
> URL: https://issues.apache.org/jira/browse/GROOVY-8703
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.1
>Reporter: Eric Milles
>Priority: Major
>
> Tried this example and got cast exception converting Map to Integer.  Should 
> the print statement at the end use the generated map constructor as expected? 
>  (Note: I am compiling with indy variant; tried to use web console to try 
> vanilla MOP...)
> {code:groovy}
> import groovy.transform.*
> import groovy.transform.options.*
> @ToString(includeNames=true)
> class Color {
>   final Integer r, g, b
>   @NamedVariant @VisibilityOptions(Visibility.PUBLIC)
>   private Color(Integer r, Integer g, Integer b) {
> this.r = r
> this.g = g
> this.b = b
>   }
>   public static final Color BLACK = new Color(0, 0, 0)
> }
> print(new Color(g:12, b:42, r:12)) // gives 
> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast 
> object '{}' with class 'java.util.LinkedHashMap' to class 'java.lang.Integer'
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GROOVY-8703) NamedVariant on constructor

2018-08-20 Thread Eric Milles (JIRA)


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

Eric Milles commented on GROOVY-8703:
-

The named variant constructor is being created as I would expect.{{Color BLACK 
= new Color(0, 0, 0)}} uses the original tuple constructor and {{new 
Color(g:12, b:42, r:12)}} should use the named variant, but is trying to use 
the tuple constructor from what I can tell.

Or are you saying I should be specifying like this: {{@NamedVariant 
@VisibilityOptions(Visibility.PUBLIC) private Color(@NamedParam Integer r, 
@NamedParam Integer g, @NamedParam Integer b)}}?

> NamedVariant on constructor
> ---
>
> Key: GROOVY-8703
> URL: https://issues.apache.org/jira/browse/GROOVY-8703
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.1
>Reporter: Eric Milles
>Priority: Major
>
> Tried this example and got cast exception converting Map to Integer.  Should 
> the print statement at the end use the generated map constructor as expected? 
>  (Note: I am compiling with indy variant; tried to use web console to try 
> vanilla MOP...)
> {code:groovy}
> import groovy.transform.*
> import groovy.transform.options.*
> @ToString(includeNames=true)
> class Color {
>   final Integer r, g, b
>   @NamedVariant @VisibilityOptions(Visibility.PUBLIC)
>   private Color(Integer r, Integer g, Integer b) {
> this.r = r
> this.g = g
> this.b = b
>   }
>   public static final Color BLACK = new Color(0, 0, 0)
> }
> print(new Color(g:12, b:42, r:12)) // gives 
> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast 
> object '{}' with class 'java.util.LinkedHashMap' to class 'java.lang.Integer'
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8753:
---

>From the GROOVY_2_5_X branch when I first use the {{installGroovy}} task I can 
>then run:
{noformat}
java -cp target/install/lib/groovy-2.5.3-SNAPSHOT.jar 
org.codehaus.groovy.tools.FileSystemCompiler A.groovy
{noformat}


> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:397)
>     at 
> 

[jira] [Commented] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Patric Bechtel (JIRA)


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

Patric Bechtel commented on GROOVY-8753:


Ack - the test in the pull request works.

The test on from the shell, via
{noformat}
java -cp groovy/target/libs/groovy-2.5.3-SNAPSHOT.jar 
org.codehaus.groovy.tools.FileSystemCompiler A.groovy{noformat}
doesn't.

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:397)
>     at 
> 

[jira] [Comment Edited] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Paul King (JIRA)


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

Paul King edited comment on GROOVY-8753 at 8/20/18 9:01 AM:


Can you try the test in the pull request. That is passing in the build.


was (Author: paulk):
Can you try the test in the pull request.

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:397)
>     at 
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
>     

[jira] [Commented] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8753:
---

Can you try the test in the pull request.

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:397)
>     at 
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> 

[jira] [Comment Edited] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Patric Bechtel (JIRA)


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

Patric Bechtel edited comment on GROOVY-8753 at 8/20/18 8:04 AM:
-

I should add something. While trying to reproduce the bug, the (ugly) line
{code:java}
names.each { fooNames << it }
{code}
is important. Replacing that line by the (much nicer)
{code:java}
fooNames.addAll( names )
{code}
it works.

That might give a clue where this comes from...


was (Author: patric42):
I should add something. While trying to reproduce the bug, the (ugly) line
{code:java}
names.each { fooNames << it }
{code}
is important. Replacing that line by the (much nicer) line
{code:java}
fooNames.addAll( names )
{code}
it works.

That might give a clue where this comes from...

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> 

[jira] [Commented] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Patric Bechtel (JIRA)


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

Patric Bechtel commented on GROOVY-8753:


I should add something. While trying to reproduce the bug, the (ugly) line
{code:java}
names.each { fooNames << it }
{code}
is important. Replacing that line by the (much nicer) line
{code:java}
fooNames.addAll( names )
{code}
it works.

That might give a clue where this comes from...

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
>     at 
> 

[jira] [Reopened] (GROOVY-8753) Compiler error in STC: exception in phase 'instruction selection'

2018-08-20 Thread Patric Bechtel (JIRA)


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

Patric Bechtel reopened GROOVY-8753:


I just verified with a build from bf37aa58f97b51081fba355c5ef4356d569af68a;

Still doesn't work, the error message is identical.

 

 

> Compiler error in STC: exception in phase 'instruction selection'
> -
>
> Key: GROOVY-8753
> URL: https://issues.apache.org/jira/browse/GROOVY-8753
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation
>Affects Versions: 2.5.2
> Environment: Java 8u181, Ubuntu 18.04
>Reporter: Patric Bechtel
>Assignee: Paul King
>Priority: Critical
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> Following source compiles under 2.5.1 and 3.0alpha3, but not 2.5.2:
> {code:java}
> @groovy.transform.CompileStatic
> class A {
>    private List fooNames = []
>    public A(Collection names) {
>   names.each { fooNames << it }
>    }
>    public List getFooNames() { fooNames }
> }
> {code}
> error message is:
> {noformat}
> >>> a serious error occurred: BUG! exception in phase 'instruction selection' 
> >>> in source unit 'A.groovy' Tried to overwrite existing meta data 
> >>> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> >>> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> >>> property: ConstantExpression[fooNames]].
> >>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit 'A.groovy' 
> Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[fooNames]].
>     at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
>     at 
> org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
>     at 
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
>     at 
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
>     at 
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
>     at 
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>     at 
> org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
>     at 
> org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
>     at 
> org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
>     at 
> org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:397)
>     at 
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
>     at 
> 

[jira] [Commented] (GROOVY-8755) Forbidden using command chain expression in array initializer to avoid ambiguities

2018-08-20 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8755:
---

We should capture this in the doco somewhere too.

> Forbidden using command chain expression in array initializer to avoid 
> ambiguities
> --
>
> Key: GROOVY-8755
> URL: https://issues.apache.org/jira/browse/GROOVY-8755
> Project: Groovy
>  Issue Type: Improvement
>  Components: parser-antlr4
>Affects Versions: 2.6.0-alpha-4, 3.0.0-alpha-3
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.6.0-alpha-5
>
>
> http://groovy.329449.n5.nabble.com/parrot-Command-expressions-in-array-initializer-tt5752273.html



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Resolved] (GROOVY-8479) sum from DefaultGroovyMethods does not have type information

2018-08-20 Thread Paul King (JIRA)


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

Paul King resolved GROOVY-8479.
---
Resolution: Won't Fix
  Assignee: Paul King

Nothing more to do, so closing this.

> sum from DefaultGroovyMethods does not have type information
> 
>
> Key: GROOVY-8479
> URL: https://issues.apache.org/jira/browse/GROOVY-8479
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-jdk
>Affects Versions: 2.4.13
>Reporter: Michal Kordas
>Assignee: Paul King
>Priority: Major
>
> Overloads of {{org.codehaus.groovy.runtime.DefaultGroovyMethods#sum}} are 
> missing type information. I don't see {{@ClosureParams}} or generics on any 
> of them. 
> It should have been done in 
> https://issues.apache.org/jira/browse/GROOVY-7283, but for some reason 
> {{sum}} was not modified back then.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)