[jira] [Created] (GROOVY-8501) Switch internal details of @ImmutableBase existing constructor validation

2018-03-07 Thread Paul King (JIRA)
Paul King created GROOVY-8501:
-

 Summary: Switch internal details of @ImmutableBase existing 
constructor validation
 Key: GROOVY-8501
 URL: https://issues.apache.org/jira/browse/GROOVY-8501
 Project: Groovy
  Issue Type: Task
Reporter: Paul King


Currently @ImmutableBase validates that no existing constructors are present. 
It requires @ImmutableBase to appear before @TupleConstructor and 
@MapConstructor. It allows @Builder with the InitializerStrategy to have been 
processed earlier and uses some node metadata tracking to allow this to happen. 
If we change to instead checking for the @Generated annotation instead of node 
metadata, these ordering restrictions can be relaxed.



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


[jira] [Updated] (GROOVY-8500) Support logging the stacktrace of bytecode generation

2018-03-07 Thread Daniel Sun (JIRA)

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

Daniel Sun updated GROOVY-8500:
---
Description: 
Add `groovy.log.classgen.stacktrace.max.depth` option to control max depth of 
stacktrace(default value is 0).

 

 For example, if {{-Dgroovy.log.classgen=true 
-Dgroovy.log.classgen.stacktrace.max.depth=3}} is passed into JVM, the bytecode 
will be attached with some stacktrace tracking where the following bytecode 
generated.

 

*bytecode snippet:*
{code:java}
// 
org.codehaus.groovy.classgen.AsmClassGenerator#onLineNumber:2215
// 
org.codehaus.groovy.classgen.asm.StatementWriter#writeReturn:593
// 
org.codehaus.groovy.classgen.AsmClassGenerator#visitReturnStatement:677
LINENUMBER 13 L1
{code}

  was:
Add `groovy.log.classgen.stacktrace.max.depth` option to control max depth of 
stacktrace(default value is 0).

 

 For example, if `-Dgroovy.log.classgen=true 
-Dgroovy.log.classgen.stacktrace.max.depth=3` is passed into JVM, the bytecode 
will be attached with some stacktrace tracking where the following bytecode 
generated.

 

*bytecode snippet:*
{code:java}
// 
org.codehaus.groovy.classgen.AsmClassGenerator#onLineNumber:2215
// 
org.codehaus.groovy.classgen.asm.StatementWriter#writeReturn:593
// 
org.codehaus.groovy.classgen.AsmClassGenerator#visitReturnStatement:677
LINENUMBER 13 L1
{code}


> Support logging the stacktrace of bytecode generation
> -
>
> Key: GROOVY-8500
> URL: https://issues.apache.org/jira/browse/GROOVY-8500
> Project: Groovy
>  Issue Type: New Feature
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.0-alpha-2, 2.5.0-rc-1, 2.6.0-alpha-4
>
>
> Add `groovy.log.classgen.stacktrace.max.depth` option to control max depth of 
> stacktrace(default value is 0).
>  
>  For example, if {{-Dgroovy.log.classgen=true 
> -Dgroovy.log.classgen.stacktrace.max.depth=3}} is passed into JVM, the 
> bytecode will be attached with some stacktrace tracking where the following 
> bytecode generated.
>  
> *bytecode snippet:*
> {code:java}
> // 
> org.codehaus.groovy.classgen.AsmClassGenerator#onLineNumber:2215
> // 
> org.codehaus.groovy.classgen.asm.StatementWriter#writeReturn:593
> // 
> org.codehaus.groovy.classgen.AsmClassGenerator#visitReturnStatement:677
> LINENUMBER 13 L1
> {code}



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


[jira] [Updated] (GROOVY-8500) Support logging the stacktrace of bytecode generation

2018-03-07 Thread Daniel Sun (JIRA)

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

Daniel Sun updated GROOVY-8500:
---
Description: 
Add `groovy.log.classgen.stacktrace.max.depth` option to control max depth of 
stacktrace(default value is 0).

 

 For example, if {{-Dgroovy.log.classgen=true 
-Dgroovy.log.classgen.stacktrace.max.depth=3}} is passed into JVM, the bytecode 
will be attached with some stacktrace tracking where the bytecode generated.

 

*bytecode snippet:*
{code:java}
// 
org.codehaus.groovy.classgen.AsmClassGenerator#onLineNumber:2215
// 
org.codehaus.groovy.classgen.asm.StatementWriter#writeReturn:593
// 
org.codehaus.groovy.classgen.AsmClassGenerator#visitReturnStatement:677
LINENUMBER 13 L1
{code}

  was:
Add `groovy.log.classgen.stacktrace.max.depth` option to control max depth of 
stacktrace(default value is 0).

 

 For example, if {{-Dgroovy.log.classgen=true 
-Dgroovy.log.classgen.stacktrace.max.depth=3}} is passed into JVM, the bytecode 
will be attached with some stacktrace tracking where the following bytecode 
generated.

 

*bytecode snippet:*
{code:java}
// 
org.codehaus.groovy.classgen.AsmClassGenerator#onLineNumber:2215
// 
org.codehaus.groovy.classgen.asm.StatementWriter#writeReturn:593
// 
org.codehaus.groovy.classgen.AsmClassGenerator#visitReturnStatement:677
LINENUMBER 13 L1
{code}


> Support logging the stacktrace of bytecode generation
> -
>
> Key: GROOVY-8500
> URL: https://issues.apache.org/jira/browse/GROOVY-8500
> Project: Groovy
>  Issue Type: New Feature
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.0-alpha-2, 2.5.0-rc-1, 2.6.0-alpha-4
>
>
> Add `groovy.log.classgen.stacktrace.max.depth` option to control max depth of 
> stacktrace(default value is 0).
>  
>  For example, if {{-Dgroovy.log.classgen=true 
> -Dgroovy.log.classgen.stacktrace.max.depth=3}} is passed into JVM, the 
> bytecode will be attached with some stacktrace tracking where the bytecode 
> generated.
>  
> *bytecode snippet:*
> {code:java}
> // 
> org.codehaus.groovy.classgen.AsmClassGenerator#onLineNumber:2215
> // 
> org.codehaus.groovy.classgen.asm.StatementWriter#writeReturn:593
> // 
> org.codehaus.groovy.classgen.AsmClassGenerator#visitReturnStatement:677
> LINENUMBER 13 L1
> {code}



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


[jira] [Closed] (GROOVY-8500) Support logging the stacktrace of bytecode generation

2018-03-07 Thread Daniel Sun (JIRA)

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

Daniel Sun closed GROOVY-8500.
--
Resolution: Fixed

Fixed by: 
https://github.com/apache/groovy/commit/49c0d8c5b602018cb29f038c91a4ac227f81a581

> Support logging the stacktrace of bytecode generation
> -
>
> Key: GROOVY-8500
> URL: https://issues.apache.org/jira/browse/GROOVY-8500
> Project: Groovy
>  Issue Type: New Feature
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.0-alpha-2, 2.5.0-rc-1, 2.6.0-alpha-4
>
>
> Add `groovy.log.classgen.stacktrace.max.depth` option to control max depth of 
> stacktrace(default value is 0).
>  
>  For example, if `-Dgroovy.log.classgen=true 
> -Dgroovy.log.classgen.stacktrace.max.depth=3` is passed into JVM, the 
> bytecode will be attached with some stacktrace tracking where the following 
> bytecode generated.
>  
> *bytecode snippet:*
> {code:java}
> // 
> org.codehaus.groovy.classgen.AsmClassGenerator#onLineNumber:2215
> // 
> org.codehaus.groovy.classgen.asm.StatementWriter#writeReturn:593
> // 
> org.codehaus.groovy.classgen.AsmClassGenerator#visitReturnStatement:677
> LINENUMBER 13 L1
> {code}



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


[jira] [Updated] (GROOVY-8500) Support logging the stacktrace of bytecode generation

2018-03-07 Thread Daniel Sun (JIRA)

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

Daniel Sun updated GROOVY-8500:
---
Description: 
Add `groovy.log.classgen.stacktrace.max.depth` option to control max depth of 
stacktrace(default value is 0).

 

 For example, if `-Dgroovy.log.classgen=true 
-Dgroovy.log.classgen.stacktrace.max.depth=3` is passed into JVM, the bytecode 
will be attached with some stacktrace tracking where the following bytecode 
generated.

 

*bytecode snippet:*
{code:java}
// 
org.codehaus.groovy.classgen.AsmClassGenerator#onLineNumber:2215
// 
org.codehaus.groovy.classgen.asm.StatementWriter#writeReturn:593
// 
org.codehaus.groovy.classgen.AsmClassGenerator#visitReturnStatement:677
LINENUMBER 13 L1
{code}

> Support logging the stacktrace of bytecode generation
> -
>
> Key: GROOVY-8500
> URL: https://issues.apache.org/jira/browse/GROOVY-8500
> Project: Groovy
>  Issue Type: New Feature
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.0-alpha-2, 2.5.0-rc-1, 2.6.0-alpha-4
>
>
> Add `groovy.log.classgen.stacktrace.max.depth` option to control max depth of 
> stacktrace(default value is 0).
>  
>  For example, if `-Dgroovy.log.classgen=true 
> -Dgroovy.log.classgen.stacktrace.max.depth=3` is passed into JVM, the 
> bytecode will be attached with some stacktrace tracking where the following 
> bytecode generated.
>  
> *bytecode snippet:*
> {code:java}
> // 
> org.codehaus.groovy.classgen.AsmClassGenerator#onLineNumber:2215
> // 
> org.codehaus.groovy.classgen.asm.StatementWriter#writeReturn:593
> // 
> org.codehaus.groovy.classgen.AsmClassGenerator#visitReturnStatement:677
> LINENUMBER 13 L1
> {code}



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


[jira] [Created] (GROOVY-8500) Support logging the stacktrace of bytecode generation

2018-03-07 Thread Daniel Sun (JIRA)
Daniel Sun created GROOVY-8500:
--

 Summary: Support logging the stacktrace of bytecode generation
 Key: GROOVY-8500
 URL: https://issues.apache.org/jira/browse/GROOVY-8500
 Project: Groovy
  Issue Type: New Feature
Reporter: Daniel Sun
Assignee: Daniel Sun
 Fix For: 3.0.0-alpha-2, 2.5.0-rc-1, 2.6.0-alpha-4






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


[jira] [Comment Edited] (GROOVY-8499) Glitch with native lambda support when supplied with incorrect arity lambda

2018-03-07 Thread Paul King (JIRA)

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

Paul King edited comment on GROOVY-8499 at 3/8/18 2:05 AM:
---

Yes, of course. But we need a better error message in that case. I changed the 
description to better reflect the error.


was (Author: paulk):
Yes, of course. But we need a better error message in that case.

> Glitch with native lambda support when supplied with incorrect arity lambda
> ---
>
> Key: GROOVY-8499
> URL: https://issues.apache.org/jira/browse/GROOVY-8499
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.x
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
>
> The following code works:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().stream().collect((x, y) -> 
> "$x$y").forEach{ println it }
> }
> method()
> {code}
> but if I make an error like this:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
> "$x$y").forEach{ println it }
> }
> method()
> {code}
> I get the following error:
> {noformat}
> Exception thrown
> java.lang.BootstrapMethodError: call site initialization exception
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
>   at ConsoleScript33.method(ConsoleScript33:5)
>   at ConsoleScript33.run(ConsoleScript33:9)
>   at 
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:378)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:357)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:173)
>   at groovy.lang.GroovyShell$run$0.call(Unknown Source)
>   at 
> groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
>   at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
>   at groovy.lang.Closure.call(Closure.java:419)
>   at groovy.lang.Closure.call(Closure.java:413)
>   at groovy.lang.Closure.run(Closure.java:500)
>   at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
> parameters for instance method invokeVirtual 
> ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 
> 2 captured parameters, 1 functional interface method parameters, 3 
> implementation parameters
>   at 
> java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
>   at 
> java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
>   ... 23 more
> {noformat}
> We should produce a sensible error message in this case.



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


[jira] [Updated] (GROOVY-8499) Glitch with native lambda support when supplied with incorrect arity lambda

2018-03-07 Thread Paul King (JIRA)

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

Paul King updated GROOVY-8499:
--
Description: 
The following code works:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().stream().collect((x, y) -> 
"$x$y").forEach{ println it }
}

method()
{code}
but if I make an error like this:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
"$x$y").forEach{ println it }
}

method()
{code}
I get the following error:
{noformat}
Exception thrown
java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
at 
java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at 
java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at ConsoleScript33.method(ConsoleScript33:5)
at ConsoleScript33.run(ConsoleScript33:9)
at 
groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
at groovy.lang.GroovyShell.run(GroovyShell.java:378)
at groovy.lang.GroovyShell.run(GroovyShell.java:357)
at groovy.lang.GroovyShell.run(GroovyShell.java:173)
at groovy.lang.GroovyShell$run$0.call(Unknown Source)
at 
groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at 
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
at groovy.lang.Closure.call(Closure.java:419)
at groovy.lang.Closure.call(Closure.java:413)
at groovy.lang.Closure.run(Closure.java:500)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
parameters for instance method invokeVirtual 
ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 2 
captured parameters, 1 functional interface method parameters, 3 implementation 
parameters
at 
java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
at 
java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
... 23 more
{noformat}
We should produce a sensible error message in this case.

  was:
The following code works:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ println 
it }
}

method()
{code}
but the lambda equivalent doesn't:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
"$x$y").forEach{ println it }
}

method()
{code}
giving the following error:
{noformat}
Exception thrown
java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
at 
java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at 
java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at ConsoleScript33.method(ConsoleScript33:5)
at ConsoleScript33.run(ConsoleScript33:9)
at 
groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
at groovy.lang.GroovyShell.run(GroovyShell.java:378)
at groovy.lang.GroovyShell.run(GroovyShell.java:357)
at groovy.lang.GroovyShell.run(GroovyShell.java:173)
at groovy.lang.GroovyShell$run$0.call(Unknown Source)
at 
groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
at 

[jira] [Updated] (GROOVY-8499) Glitch with native lambda support when supplied with incorrect arity lambda

2018-03-07 Thread Paul King (JIRA)

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

Paul King updated GROOVY-8499:
--
Summary: Glitch with native lambda support when supplied with incorrect 
arity lambda  (was: Glitch with native lambda support possibly relating to 
multiple params)

> Glitch with native lambda support when supplied with incorrect arity lambda
> ---
>
> Key: GROOVY-8499
> URL: https://issues.apache.org/jira/browse/GROOVY-8499
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.x
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
>
> The following code works:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ 
> println it }
> }
> method()
> {code}
> but the lambda equivalent doesn't:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
> "$x$y").forEach{ println it }
> }
> method()
> {code}
> giving the following error:
> {noformat}
> Exception thrown
> java.lang.BootstrapMethodError: call site initialization exception
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
>   at ConsoleScript33.method(ConsoleScript33:5)
>   at ConsoleScript33.run(ConsoleScript33:9)
>   at 
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:378)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:357)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:173)
>   at groovy.lang.GroovyShell$run$0.call(Unknown Source)
>   at 
> groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
>   at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
>   at groovy.lang.Closure.call(Closure.java:419)
>   at groovy.lang.Closure.call(Closure.java:413)
>   at groovy.lang.Closure.run(Closure.java:500)
>   at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
> parameters for instance method invokeVirtual 
> ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 
> 2 captured parameters, 1 functional interface method parameters, 3 
> implementation parameters
>   at 
> java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
>   at 
> java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
>   ... 23 more
> {noformat}



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


[jira] [Assigned] (GROOVY-8499) Glitch with native lambda support possibly relating to multiple params

2018-03-07 Thread Paul King (JIRA)

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

Paul King reassigned GROOVY-8499:
-

Assignee: Paul King

> Glitch with native lambda support possibly relating to multiple params
> --
>
> Key: GROOVY-8499
> URL: https://issues.apache.org/jira/browse/GROOVY-8499
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.x
>Reporter: Paul King
>Assignee: Paul King
>Priority: Major
>
> The following code works:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ 
> println it }
> }
> method()
> {code}
> but the lambda equivalent doesn't:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
> "$x$y").forEach{ println it }
> }
> method()
> {code}
> giving the following error:
> {noformat}
> Exception thrown
> java.lang.BootstrapMethodError: call site initialization exception
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
>   at ConsoleScript33.method(ConsoleScript33:5)
>   at ConsoleScript33.run(ConsoleScript33:9)
>   at 
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:378)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:357)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:173)
>   at groovy.lang.GroovyShell$run$0.call(Unknown Source)
>   at 
> groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
>   at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
>   at groovy.lang.Closure.call(Closure.java:419)
>   at groovy.lang.Closure.call(Closure.java:413)
>   at groovy.lang.Closure.run(Closure.java:500)
>   at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
> parameters for instance method invokeVirtual 
> ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 
> 2 captured parameters, 1 functional interface method parameters, 3 
> implementation parameters
>   at 
> java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
>   at 
> java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
>   ... 23 more
> {noformat}



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


[jira] [Commented] (GROOVY-8499) Glitch with native lambda support possibly relating to multiple params

2018-03-07 Thread Paul King (JIRA)

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

Paul King commented on GROOVY-8499:
---

Yes, of course. But we need a better error message in that case.

> Glitch with native lambda support possibly relating to multiple params
> --
>
> Key: GROOVY-8499
> URL: https://issues.apache.org/jira/browse/GROOVY-8499
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.x
>Reporter: Paul King
>Priority: Major
>
> The following code works:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ 
> println it }
> }
> method()
> {code}
> but the lambda equivalent doesn't:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
> "$x$y").forEach{ println it }
> }
> method()
> {code}
> giving the following error:
> {noformat}
> Exception thrown
> java.lang.BootstrapMethodError: call site initialization exception
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
>   at ConsoleScript33.method(ConsoleScript33:5)
>   at ConsoleScript33.run(ConsoleScript33:9)
>   at 
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:378)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:357)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:173)
>   at groovy.lang.GroovyShell$run$0.call(Unknown Source)
>   at 
> groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
>   at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
>   at groovy.lang.Closure.call(Closure.java:419)
>   at groovy.lang.Closure.call(Closure.java:413)
>   at groovy.lang.Closure.run(Closure.java:500)
>   at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
> parameters for instance method invokeVirtual 
> ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 
> 2 captured parameters, 1 functional interface method parameters, 3 
> implementation parameters
>   at 
> java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
>   at 
> java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
>   ... 23 more
> {noformat}



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


[jira] [Commented] (GROOVY-8499) Glitch with native lambda support possibly relating to multiple params

2018-03-07 Thread Daniel Sun (JIRA)

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

Daniel Sun commented on GROOVY-8499:


As 
[https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#map-java.util.function.Function-]
 shows

 

Stream.map only accept Function, whose argument size is 1. So the following 
invocation of map is invalid...
{code:java}
map((x, y) -> "$x$y")
{code}

> Glitch with native lambda support possibly relating to multiple params
> --
>
> Key: GROOVY-8499
> URL: https://issues.apache.org/jira/browse/GROOVY-8499
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.x
>Reporter: Paul King
>Priority: Major
>
> The following code works:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ 
> println it }
> }
> method()
> {code}
> but the lambda equivalent doesn't:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
> "$x$y").forEach{ println it }
> }
> method()
> {code}
> giving the following error:
> {noformat}
> Exception thrown
> java.lang.BootstrapMethodError: call site initialization exception
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
>   at ConsoleScript33.method(ConsoleScript33:5)
>   at ConsoleScript33.run(ConsoleScript33:9)
>   at 
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:378)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:357)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:173)
>   at groovy.lang.GroovyShell$run$0.call(Unknown Source)
>   at 
> groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
>   at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
>   at groovy.lang.Closure.call(Closure.java:419)
>   at groovy.lang.Closure.call(Closure.java:413)
>   at groovy.lang.Closure.run(Closure.java:500)
>   at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
> parameters for instance method invokeVirtual 
> ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 
> 2 captured parameters, 1 functional interface method parameters, 3 
> implementation parameters
>   at 
> java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
>   at 
> java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
>   ... 23 more
> {noformat}



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


[jira] [Commented] (GROOVY-8499) Glitch with native lambda support possibly relating to multiple params

2018-03-07 Thread Daniel Sun (JIRA)

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

Daniel Sun commented on GROOVY-8499:


As the following test shows, multiple parameters should have been supported...

[https://github.com/apache/groovy/blob/master/src/test/groovy/transform/stc/LambdaTest.groovy#L72]
{code:java}
import groovy.transform.CompileStatic
import java.util.stream.Collectors
import java.util.stream.Stream

@CompileStatic
public class Test1 {
public static void main(String[] args) {
p();
}

public static void p() {
assert 13 == [1, 2, 3].stream().reduce(7, (Integer r, Integer 
e) -> r + e);
}
}
{code}

> Glitch with native lambda support possibly relating to multiple params
> --
>
> Key: GROOVY-8499
> URL: https://issues.apache.org/jira/browse/GROOVY-8499
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.x
>Reporter: Paul King
>Priority: Major
>
> The following code works:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ 
> println it }
> }
> method()
> {code}
> but the lambda equivalent doesn't:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
> "$x$y").forEach{ println it }
> }
> method()
> {code}
> giving the following error:
> {noformat}
> Exception thrown
> java.lang.BootstrapMethodError: call site initialization exception
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
>   at ConsoleScript33.method(ConsoleScript33:5)
>   at ConsoleScript33.run(ConsoleScript33:9)
>   at 
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:378)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:357)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:173)
>   at groovy.lang.GroovyShell$run$0.call(Unknown Source)
>   at 
> groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
>   at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
>   at groovy.lang.Closure.call(Closure.java:419)
>   at groovy.lang.Closure.call(Closure.java:413)
>   at groovy.lang.Closure.run(Closure.java:500)
>   at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
> parameters for instance method invokeVirtual 
> ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 
> 2 captured parameters, 1 functional interface method parameters, 3 
> implementation parameters
>   at 
> java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
>   at 
> java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
>   ... 23 more
> {noformat}



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


[jira] [Updated] (GROOVY-8498) Support `var` keyword of Java10

2018-03-07 Thread Paul King (JIRA)

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

Paul King updated GROOVY-8498:
--
Description: 
This is to provide compatibility with:
http://openjdk.java.net/jeps/286 (Java 10)
http://openjdk.java.net/jeps/323 (targeted for Java 11)

Java 10 provides var to allow reduced ceremony by avoiding manifest declaration 
of types for local variables for cases where type inferencing can be supported. 
Groovy already does this with "def" and has it's own approach for type 
inferencing within type-checked/compile static code. With this in mind, it 
seems to make most sense for Groovy to have "var" as an alias for "def" rather 
than closely mimic only the use cases allowed by Java.

> Support `var` keyword of Java10
> ---
>
> Key: GROOVY-8498
> URL: https://issues.apache.org/jira/browse/GROOVY-8498
> Project: Groovy
>  Issue Type: New Feature
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.0-alpha-2, 2.6.0-alpha-4
>
>
> This is to provide compatibility with:
> http://openjdk.java.net/jeps/286 (Java 10)
> http://openjdk.java.net/jeps/323 (targeted for Java 11)
> Java 10 provides var to allow reduced ceremony by avoiding manifest 
> declaration of types for local variables for cases where type inferencing can 
> be supported. Groovy already does this with "def" and has it's own approach 
> for type inferencing within type-checked/compile static code. With this in 
> mind, it seems to make most sense for Groovy to have "var" as an alias for 
> "def" rather than closely mimic only the use cases allowed by Java.



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


[jira] [Updated] (GROOVY-8499) Glitch with native lambda support possibly relating to multiple params

2018-03-07 Thread Paul King (JIRA)

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

Paul King updated GROOVY-8499:
--
Summary: Glitch with native lambda support possibly relating to multiple 
params  (was: Glitch with native lambda support)

> Glitch with native lambda support possibly relating to multiple params
> --
>
> Key: GROOVY-8499
> URL: https://issues.apache.org/jira/browse/GROOVY-8499
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.x
>Reporter: Paul King
>Priority: Major
>
> The following code works:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ 
> println it }
> }
> method()
> {code}
> but the lambda equivalent doesn't:
> {code}
> import groovy.transform.*
> @CompileStatic
> def method() {
>   ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
> "$x$y").forEach{ println it }
> }
> method()
> {code}
> giving the following error:
> {noformat}
> Exception thrown
> java.lang.BootstrapMethodError: call site initialization exception
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
>   at 
> java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
>   at ConsoleScript33.method(ConsoleScript33:5)
>   at ConsoleScript33.run(ConsoleScript33:9)
>   at 
> groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:378)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:357)
>   at groovy.lang.GroovyShell.run(GroovyShell.java:173)
>   at groovy.lang.GroovyShell$run$0.call(Unknown Source)
>   at 
> groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
>   at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
>   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
>   at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
>   at groovy.lang.Closure.call(Closure.java:419)
>   at groovy.lang.Closure.call(Closure.java:413)
>   at groovy.lang.Closure.run(Closure.java:500)
>   at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
> parameters for instance method invokeVirtual 
> ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 
> 2 captured parameters, 1 functional interface method parameters, 3 
> implementation parameters
>   at 
> java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
>   at 
> java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
>   at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
>   ... 23 more
> {noformat}



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


[jira] [Updated] (GROOVY-8499) Glitch with native lambda support

2018-03-07 Thread Paul King (JIRA)

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

Paul King updated GROOVY-8499:
--
Description: 
The following code works:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ println 
it }
}

method()
{code}
but the lambda equivalent doesn't:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
"$x$y").forEach{ println it }
}

method()
{code}
giving the following error:
{noformat}
Exception thrown
java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
at 
java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at 
java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at ConsoleScript33.method(ConsoleScript33:5)
at ConsoleScript33.run(ConsoleScript33:9)
at 
groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
at groovy.lang.GroovyShell.run(GroovyShell.java:378)
at groovy.lang.GroovyShell.run(GroovyShell.java:357)
at groovy.lang.GroovyShell.run(GroovyShell.java:173)
at groovy.lang.GroovyShell$run$0.call(Unknown Source)
at 
groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at 
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
at groovy.lang.Closure.call(Closure.java:419)
at groovy.lang.Closure.call(Closure.java:413)
at groovy.lang.Closure.run(Closure.java:500)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
parameters for instance method invokeVirtual 
ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 2 
captured parameters, 1 functional interface method parameters, 3 implementation 
parameters
at 
java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
at 
java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
... 23 more
{noformat}


  was:
The following code works:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ println 
it }
}

method()
{code}
but the lambda equivalent doesn't:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
"$x$y").forEach{ println it }
}

method()
{code}
giving the following error:
{noformat}
{color:red}Exception thrown{color}
java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
at 
java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at 
java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at ConsoleScript33.method(ConsoleScript33:5)
at ConsoleScript33.run(ConsoleScript33:9)
at 
groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
at groovy.lang.GroovyShell.run(GroovyShell.java:378)
at groovy.lang.GroovyShell.run(GroovyShell.java:357)
at groovy.lang.GroovyShell.run(GroovyShell.java:173)
at groovy.lang.GroovyShell$run$0.call(Unknown Source)
at 
groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at 

[jira] [Created] (GROOVY-8499) Glitch with native lambda support

2018-03-07 Thread Paul King (JIRA)
Paul King created GROOVY-8499:
-

 Summary: Glitch with native lambda support
 Key: GROOVY-8499
 URL: https://issues.apache.org/jira/browse/GROOVY-8499
 Project: Groovy
  Issue Type: Bug
Affects Versions: 3.x
Reporter: Paul King


The following code works:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().collect{x, y -> "$x$y"}.each{ println 
it }
}

method()
{code}
but the lambda equivalent doesn't:
{code}
import groovy.transform.*

@CompileStatic
def method() {
  ['ab'.chars, '12'.chars].combinations().stream().map((x, y) -> 
"$x$y").forEach{ println it }
}

method()
{code}
giving the following error:
{noformat}
{color:red}Exception thrown{color}
java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
at 
java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at 
java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at ConsoleScript33.method(ConsoleScript33:5)
at ConsoleScript33.run(ConsoleScript33:9)
at 
groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:265)
at groovy.lang.GroovyShell.run(GroovyShell.java:378)
at groovy.lang.GroovyShell.run(GroovyShell.java:357)
at groovy.lang.GroovyShell.run(GroovyShell.java:173)
at groovy.lang.GroovyShell$run$0.call(Unknown Source)
at 
groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy:1118)
at groovy.ui.Console$_runScriptImpl_closure18.doCall(Console.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:103)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at 
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1037)
at groovy.lang.Closure.call(Closure.java:419)
at groovy.lang.Closure.call(Closure.java:413)
at groovy.lang.Closure.run(Closure.java:500)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of 
parameters for instance method invokeVirtual 
ConsoleScript33$_method_lambda1.doCall:(ConsoleScript33,Object,Object)Object; 2 
captured parameters, 1 functional interface method parameters, 3 implementation 
parameters
at 
java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
at 
java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
... 23 more
{noformat}




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


[jira] [Closed] (GROOVY-8498) Support `var` keyword of Java10

2018-03-07 Thread Daniel Sun (JIRA)

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

Daniel Sun closed GROOVY-8498.
--
Resolution: Fixed

Fixed by: 
https://github.com/apache/groovy/commit/f30741f519f4012c7cca3959ade9e4ec12625e45

> Support `var` keyword of Java10
> ---
>
> Key: GROOVY-8498
> URL: https://issues.apache.org/jira/browse/GROOVY-8498
> Project: Groovy
>  Issue Type: New Feature
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.0-alpha-2, 2.6.0-alpha-4
>
>




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


[jira] [Created] (GROOVY-8498) Support `var` keyword of Java10

2018-03-07 Thread Daniel Sun (JIRA)
Daniel Sun created GROOVY-8498:
--

 Summary: Support `var` keyword of Java10
 Key: GROOVY-8498
 URL: https://issues.apache.org/jira/browse/GROOVY-8498
 Project: Groovy
  Issue Type: New Feature
Reporter: Daniel Sun
Assignee: Daniel Sun
 Fix For: 3.0.0-alpha-2, 2.6.0-alpha-4






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


[jira] [Created] (GROOVY-8497) Can't call getProperty() from Java

2018-03-07 Thread Daniil Ovchinnikov (JIRA)
Daniil Ovchinnikov created GROOVY-8497:
--

 Summary: Can't call getProperty() from Java
 Key: GROOVY-8497
 URL: https://issues.apache.org/jira/browse/GROOVY-8497
 Project: Groovy
  Issue Type: Bug
Reporter: Daniil Ovchinnikov


{code:title=GroovyClass.groovy}
class GroovyClass {}
{code}

{code:title=JavaClass.java}
class JavaClass {
void usage() {
new GroovyClass().getProperty("a"); 
// error: cannot find symbol: method getProperty(String)
}
}
{code}



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


[jira] [Updated] (GROOVY-8496) Can't call default getProperty() implementation from Java subclass

2018-03-07 Thread Daniil Ovchinnikov (JIRA)

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

Daniil Ovchinnikov updated GROOVY-8496:
---
Summary: Can't call default getProperty() implementation from Java subclass 
 (was: Can't call default getProperty() implementation from superclass)

> Can't call default getProperty() implementation from Java subclass
> --
>
> Key: GROOVY-8496
> URL: https://issues.apache.org/jira/browse/GROOVY-8496
> Project: Groovy
>  Issue Type: Bug
>Reporter: Daniil Ovchinnikov
>Priority: Major
>
> {code:title=GroovyClass.groovy}
> class GroovyClass {}
> {code}
> {code:title=JavaClass.java}
> class JavaClass extends GroovyClass { 
> @Override
> public Object getProperty(String propertyName) {
> return super.getProperty(propertyName); 
> // error: cannot find symbol: method getProperty(String)
> }
> }
> {code}



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


[jira] [Created] (GROOVY-8496) Can't call default getProperty() implementation from superclass

2018-03-07 Thread Daniil Ovchinnikov (JIRA)
Daniil Ovchinnikov created GROOVY-8496:
--

 Summary: Can't call default getProperty() implementation from 
superclass
 Key: GROOVY-8496
 URL: https://issues.apache.org/jira/browse/GROOVY-8496
 Project: Groovy
  Issue Type: Bug
Reporter: Daniil Ovchinnikov


{code:title=GroovyClass.groovy}
class GroovyClass {}
{code}

{code:title=JavaClass.java}
class JavaClass extends GroovyClass { 
@Override
public Object getProperty(String propertyName) {
return super.getProperty(propertyName); 
// error: cannot find symbol: method getProperty(String)
}
}
{code}



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