[jira] [Comment Edited] (GROOVY-8836) 'semantic analysis' fail

2018-10-09 Thread Paul King (JIRA)


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

Paul King edited comment on GROOVY-8836 at 10/10/18 3:55 AM:
-

This is due to running the program on JDK11 as per the linked issue. Also, as a 
side note, {{copyOfRange}} throws {{IllegalArgumentException}} if from > to. 
Groovy 2.5.3 which supports JDK11+ is due for release shortly.


was (Author: paulk):
This is due to running the program on JDK11 as per the linked issue. Also, as a 
side note, {{copyOfRange}} throws {{IllegalArgumentException}} if from > to.

> 'semantic analysis' fail
> 
>
> Key: GROOVY-8836
> URL: https://issues.apache.org/jira/browse/GROOVY-8836
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 3.0.0-alpha-3, 2.5.2
>Reporter: Behruz
>Priority: Blocker
>  Labels: intellij, java
>
> in intellij: Tried running following script:
> {code:java}
> def arr = (0..10).toArray()
> def reverted = Arrays.copyOfRange arr, arr.length, 0
> println reverted
> {code}
> Got following stack:
> {code:java}
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 
> (file:/ ... /groovy/3.0.0-alpha-3/groovy-3.0.0-alpha-3.jar) to constructor 
> java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
> WARNING: Please consider reporting this to the maintainers of 
> org.codehaus.groovy.vmplugin.v7.Java7$1
> WARNING: Use --illegal-access=warn to enable warnings of further illegal 
> reflective access operations
> WARNING: All illegal access operations will be denied in a future release
> Caught: BUG! exception in phase 'semantic analysis' in source unit '... 
> \.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
> BUG! exception in phase 'semantic analysis' in source unit '... 
> \.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
>at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> Caused by: java.lang.UnsupportedOperationException
>at 
> groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
>at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
>at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
>... 3 more
> {code}
> I know nothing about Groovy, but it said 'Bug!', so I report



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


[jira] [Closed] (GROOVY-8836) 'semantic analysis' fail

2018-10-09 Thread Paul King (JIRA)


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

Paul King closed GROOVY-8836.
-
Resolution: Duplicate

This is due to running the program on JDK11 as per the linked issue. Also, as a 
side note, {{copyOfRange}} throws {{IllegalArgumentException}} if from > to.

> 'semantic analysis' fail
> 
>
> Key: GROOVY-8836
> URL: https://issues.apache.org/jira/browse/GROOVY-8836
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 3.0.0-alpha-3, 2.5.2
>Reporter: Behruz
>Priority: Blocker
>  Labels: intellij, java
>
> in intellij: Tried running following script:
> {code:java}
> def arr = (0..10).toArray()
> def reverted = Arrays.copyOfRange arr, arr.length, 0
> println reverted
> {code}
> Got following stack:
> {code:java}
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 
> (file:/ ... /groovy/3.0.0-alpha-3/groovy-3.0.0-alpha-3.jar) to constructor 
> java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
> WARNING: Please consider reporting this to the maintainers of 
> org.codehaus.groovy.vmplugin.v7.Java7$1
> WARNING: Use --illegal-access=warn to enable warnings of further illegal 
> reflective access operations
> WARNING: All illegal access operations will be denied in a future release
> Caught: BUG! exception in phase 'semantic analysis' in source unit '... 
> \.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
> BUG! exception in phase 'semantic analysis' in source unit '... 
> \.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
>at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> Caused by: java.lang.UnsupportedOperationException
>at 
> groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
>at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
>at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
>... 3 more
> {code}
> I know nothing about Groovy, but it said 'Bug!', so I report



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


[jira] [Commented] (GROOVY-8837) Invalid type inference for redefined generic boundaries

2018-10-09 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8837:
---

Generics is definitely an area which needs more work but I was unable to 
reproduce with your example. But perhaps I changed something important. To get 
your example to work I moved the Groovy test file to {{src/test/groovy}} and I 
changed the Groovy dependency to be {{groovy}} and {{groovy-test}} instead of 
{{groovy-all}} (just in dependencies not under plugins). After those changes I 
get:
{noformat}
---
 T E S T S
---
Running sample.SubClassTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.188 sec

Results :

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] BUILD SUCCESS
[INFO] 
{noformat}

> Invalid type inference for redefined generic boundaries
> ---
>
> Key: GROOVY-8837
> URL: https://issues.apache.org/jira/browse/GROOVY-8837
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.5.2
>Reporter: Constantine Plotnikov
>Priority: Major
> Attachments: groovy-bug-generic-extension.zip
>
>
> Static compiler incorrectly calculates type boundary for chain calls with 
> generic types. When method is called, it takes boundary defined in the method 
> of the class (Base in sample), instead of the boundary redefined in subclass 
> (SubClass in sample).
> The bug was discovered when working with Lombok SuperBuilder generated 
> classes from Groovy. The attached project demonstrate the bug on the smaller 
> sample.
> Note that Java test infers type correctly, but groovy does not. However, the 
> groovy test works when CompileStatic annotation is disabled.
> IDEA also shows red code here, but it possibly follows Groovy logic.
> The bug also affects earlier versions.



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


[jira] [Comment Edited] (GROOVY-8837) Invalid type inference for redefined generic boundaries

2018-10-09 Thread Paul King (JIRA)


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

Paul King edited comment on GROOVY-8837 at 10/9/18 11:43 PM:
-

Generics is definitely an area which needs more work but I was unable to 
reproduce with your example. But perhaps I changed something important. To get 
your example to work I moved the Groovy test file to {{src/test/groovy}} and I 
changed the Groovy dependency to be {{groovy}} and {{groovy-test}} instead of 
{{groovy-all}} (just in dependencies not under plugins). After those changes I 
get:
{noformat}
---
 T E S T S
---
Running sample.SubClassTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.188 sec

Results :

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] BUILD SUCCESS
[INFO] 
{noformat}
I did see the text in {color:#d04437}red{color} in IDEA.


was (Author: paulk):
Generics is definitely an area which needs more work but I was unable to 
reproduce with your example. But perhaps I changed something important. To get 
your example to work I moved the Groovy test file to {{src/test/groovy}} and I 
changed the Groovy dependency to be {{groovy}} and {{groovy-test}} instead of 
{{groovy-all}} (just in dependencies not under plugins). After those changes I 
get:
{noformat}
---
 T E S T S
---
Running sample.SubClassTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.188 sec

Results :

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] BUILD SUCCESS
[INFO] 
{noformat}

> Invalid type inference for redefined generic boundaries
> ---
>
> Key: GROOVY-8837
> URL: https://issues.apache.org/jira/browse/GROOVY-8837
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.5.2
>Reporter: Constantine Plotnikov
>Priority: Major
> Attachments: groovy-bug-generic-extension.zip
>
>
> Static compiler incorrectly calculates type boundary for chain calls with 
> generic types. When method is called, it takes boundary defined in the method 
> of the class (Base in sample), instead of the boundary redefined in subclass 
> (SubClass in sample).
> The bug was discovered when working with Lombok SuperBuilder generated 
> classes from Groovy. The attached project demonstrate the bug on the smaller 
> sample.
> Note that Java test infers type correctly, but groovy does not. However, the 
> groovy test works when CompileStatic annotation is disabled.
> IDEA also shows red code here, but it possibly follows Groovy logic.
> The bug also affects earlier versions.



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


[jira] [Created] (GROOVY-8837) Invalid type inference for redefined generic boundaries

2018-10-09 Thread Constantine Plotnikov (JIRA)
Constantine Plotnikov created GROOVY-8837:
-

 Summary: Invalid type inference for redefined generic boundaries
 Key: GROOVY-8837
 URL: https://issues.apache.org/jira/browse/GROOVY-8837
 Project: Groovy
  Issue Type: Bug
  Components: Compiler
Affects Versions: 2.5.2
Reporter: Constantine Plotnikov
 Attachments: groovy-bug-generic-extension.zip

Static compiler incorrectly calculates type boundary for chain calls with 
generic types. When method is called, it takes boundary defined in the method 
of the class (Base in sample), instead of the boundary redefined in subclass 
(SubClass in sample).

The bug was discovered when working with Lombok SuperBuilder generated classes 
from Groovy. The attached project demonstrate the bug on the smaller sample.

Note that Java test infers type correctly, but groovy does not. However, the 
groovy test works when CompileStatic annotation is disabled.

IDEA also shows red code here, but it possibly follows Groovy logic.

The bug also affects earlier versions.



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


[jira] [Commented] (GROOVY-8727) JDK 11 Compilation Failure: ClassVisitor.visitNestMemberExperimental throws UnsupportedOperationException

2018-10-09 Thread Daniel Sun (JIRA)


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

Daniel Sun commented on GROOVY-8727:


2.6.0 is not maintained anymore for a long time.
Please try snapshots of 3.0 or 2.5


> JDK 11 Compilation Failure: ClassVisitor.visitNestMemberExperimental throws 
> UnsupportedOperationException 
> --
>
> Key: GROOVY-8727
> URL: https://issues.apache.org/jira/browse/GROOVY-8727
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.5.2
>Reporter: Misagh Moayyed
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> *Description:*
> Using JDK 11 and Gradle 4.9, the following compilation error is seen:
>  
> {code:java}
> > Task :core:cas-server-core-tickets:compileTestGroovy FAILED
> startup failed:
> General error during class generation: java.lang.UnsupportedOperationException
> java.lang.UnsupportedOperationException
>   at 
> groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
>   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
>   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
>   at 
> org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:83)
>   at 
> org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:254)
>   at 
> org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:192)
>   at 
> org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:172)
>   at 
> org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:128)
>   at 
> org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClassNullable(AsmReferenceResolver.java:59)
>   at 
> org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:46)
>   at 
> org.codehaus.groovy.ast.decompiled.TypeSignatureParser.visitEnd(TypeSignatureParser.java:112)
>   at 
> groovyjarjarasm.asm.signature.SignatureReader.parseType(SignatureReader.java:206)
>   at 
> groovyjarjarasm.asm.signature.SignatureReader.parseType(SignatureReader.java:235)
>   at 
> groovyjarjarasm.asm.signature.SignatureReader.accept(SignatureReader.java:114)
>   at 
> org.codehaus.groovy.ast.decompiled.MemberSignatureParser.createMethodNode(MemberSignatureParser.java:95)
>   at 
> org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lazyInitMembers(DecompiledClassNode.java:195)
>   at 
> org.codehaus.groovy.ast.decompiled.DecompiledClassNode.getMethods(DecompiledClassNode.java:103)
>   at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:399)
>   at 
> org.codehaus.groovy.classgen.AnnotationVisitor.checkIfMandatoryAnnotationValuesPassed(AnnotationVisitor.java:168)
>   at 
> org.codehaus.groovy.classgen.AnnotationVisitor.visit(AnnotationVisitor.java:80)
>   at 
> org.codehaus.groovy.classgen.ExtendedVerifier.visitAnnotation(ExtendedVerifier.java:311)
>   at 
> org.codehaus.groovy.classgen.ExtendedVerifier.visitAnnotations(ExtendedVerifier.java:157)
>   at 
> org.codehaus.groovy.classgen.ExtendedVerifier.visitConstructorOrMethod(ExtendedVerifier.java:112)
>   at 
> org.codehaus.groovy.classgen.ExtendedVerifier.visitMethod(ExtendedVerifier.java:108)
>   at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1103)
>   at 
> org.codehaus.groovy.classgen.ExtendedVerifier.visitClass(ExtendedVerifier.java:91)
>   at 
> org.codehaus.groovy.control.CompilationUnit$18.call(CompilationUnit.java:827)
>   at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
>   at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:631)
>   at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609)
>   at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586)
>   at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:565)
>   at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:179)
>   at 
> org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:57)
>   at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:77)
>   at 
> org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:65)
>   at 
> 

[jira] [Commented] (GROOVY-8727) JDK 11 Compilation Failure: ClassVisitor.visitNestMemberExperimental throws UnsupportedOperationException

2018-10-09 Thread Joshua Turner (JIRA)


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

Joshua Turner commented on GROOVY-8727:
---

[~daniel_sun] – just pulled GROOVY_2_6_0_ALPHA_4, from jitpack, and get the 
same Exception thrown in the same spot as the original reporter:
{noformat}
Caused by: java.lang.UnsupportedOperationException
at 
groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
at 
org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:83)
at 
org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:254)
at 
org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:192)
at 
org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:172)
at 
org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:128)
at 
org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:742)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:392)
at 
org.codehaus.groovy.control.ResolveVisitor.resolveFromDefaultImports(ResolveVisitor.java:520)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:390)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:353)
at 
org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:337)
at 
org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:349)
{noformat}
The 3_0_0_ALPHA_4 is not available in the linked jitpack.

A build using master-SNAPSHOT yields success, though. Eagerly awaiting a 
release.

> JDK 11 Compilation Failure: ClassVisitor.visitNestMemberExperimental throws 
> UnsupportedOperationException 
> --
>
> Key: GROOVY-8727
> URL: https://issues.apache.org/jira/browse/GROOVY-8727
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.5.2
>Reporter: Misagh Moayyed
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.3
>
>
> *Description:*
> Using JDK 11 and Gradle 4.9, the following compilation error is seen:
>  
> {code:java}
> > Task :core:cas-server-core-tickets:compileTestGroovy FAILED
> startup failed:
> General error during class generation: java.lang.UnsupportedOperationException
> java.lang.UnsupportedOperationException
>   at 
> groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
>   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
>   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
>   at 
> org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:83)
>   at 
> org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:254)
>   at 
> org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:192)
>   at 
> org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:172)
>   at 
> org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:128)
>   at 
> org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClassNullable(AsmReferenceResolver.java:59)
>   at 
> org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:46)
>   at 
> org.codehaus.groovy.ast.decompiled.TypeSignatureParser.visitEnd(TypeSignatureParser.java:112)
>   at 
> groovyjarjarasm.asm.signature.SignatureReader.parseType(SignatureReader.java:206)
>   at 
> groovyjarjarasm.asm.signature.SignatureReader.parseType(SignatureReader.java:235)
>   at 
> groovyjarjarasm.asm.signature.SignatureReader.accept(SignatureReader.java:114)
>   at 
> org.codehaus.groovy.ast.decompiled.MemberSignatureParser.createMethodNode(MemberSignatureParser.java:95)
>   at 
> org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lazyInitMembers(DecompiledClassNode.java:195)
>   at 
> org.codehaus.groovy.ast.decompiled.DecompiledClassNode.getMethods(DecompiledClassNode.java:103)
>   at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:399)
>   at 
> org.codehaus.groovy.classgen.AnnotationVisitor.checkIfMandatoryAnnotationValuesPassed(AnnotationVisitor.java:168)
>   at 
> org.codehaus.groovy.classgen.AnnotationVisitor.visit(AnnotationVisitor.java:80)
>   at 
> org.codehaus.groovy.classgen.ExtendedVerifier.visitAnnotation(ExtendedVerifier.java:311)
>   at 
> 

[jira] [Updated] (GROOVY-8836) 'semantic analysis' fail

2018-10-09 Thread Behruz (JIRA)


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

Behruz updated GROOVY-8836:
---
Description: 
in intellij: Tried running following script:
{code:java}
def arr = (0..10).toArray()

def reverted = Arrays.copyOfRange arr, arr.length, 0

println reverted
{code}
Got following stack:
{code:java}
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 
(file:/ ... /groovy/3.0.0-alpha-3/groovy-3.0.0-alpha-3.jar) to constructor 
java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of 
org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
Caught: BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
   at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: java.lang.UnsupportedOperationException
   at 
groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
   ... 3 more
{code}
I know nothing about Groovy, but it said 'Bug!', so I report

  was:
in intellij: Tried CTRL+SHIFT+F10'ing following script:
{code:java}
def arr = (0..10).toArray()

def reverted = Arrays.copyOfRange arr, arr.length, 0

println reverted
{code}
Got following stack:
{code:java}
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 
(file:/ ... /groovy/3.0.0-alpha-3/groovy-3.0.0-alpha-3.jar) to constructor 
java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of 
org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
Caught: BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
   at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: java.lang.UnsupportedOperationException
   at 
groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
   ... 3 more
{code}
I know nothing about Groovy, but it said 'Bug!', so I report


> 'semantic analysis' fail
> 
>
> Key: GROOVY-8836
> URL: https://issues.apache.org/jira/browse/GROOVY-8836
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 3.0.0-alpha-3, 2.5.2
>Reporter: Behruz
>Priority: Blocker
>  Labels: intellij, java
>
> in intellij: Tried running following script:
> {code:java}
> def arr = (0..10).toArray()
> def reverted = Arrays.copyOfRange arr, arr.length, 0
> println reverted
> {code}
> Got following stack:
> {code:java}
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 
> (file:/ ... /groovy/3.0.0-alpha-3/groovy-3.0.0-alpha-3.jar) to constructor 
> java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
> WARNING: Please consider reporting this to the maintainers of 
> org.codehaus.groovy.vmplugin.v7.Java7$1
> WARNING: Use --illegal-access=warn to enable warnings of further illegal 
> reflective access operations
> WARNING: All illegal access operations will be denied in a future release
> Caught: BUG! exception in phase 'semantic analysis' in source unit '... 
> \.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
> BUG! exception in phase 'semantic analysis' in source unit '... 
> 

[jira] [Updated] (GROOVY-8836) 'semantic analysis' fail

2018-10-09 Thread Behruz (JIRA)


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

Behruz updated GROOVY-8836:
---
Description: 
in intellij: Tried CTRL+SHIFT+F10'ing following script:
{code:java}
def arr = (0..10).toArray()

def reverted = Arrays.copyOfRange arr, arr.length, 0

println reverted
{code}
Got following stack:
{code:java}
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 
(file:/ ... /groovy/3.0.0-alpha-3/groovy-3.0.0-alpha-3.jar) to constructor 
java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of 
org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
Caught: BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
   at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: java.lang.UnsupportedOperationException
   at 
groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
   ... 3 more
{code}
I know nothing about Groovy, but it said 'Bug!', so I report

  was:
Tried CTRL+SHIFT+F10'ing following script:
{code:java}
def arr = (0..10).toArray()

def reverted = Arrays.copyOfRange arr, arr.length, 0

println reverted
{code}
Got following stack:
{code:java}
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 
(file:/ ... /groovy/3.0.0-alpha-3/groovy-3.0.0-alpha-3.jar) to constructor 
java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of 
org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
Caught: BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
   at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: java.lang.UnsupportedOperationException
   at 
groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
   ... 3 more
{code}
I know nothing about Groovy, but it said 'Bug!', so I report


> 'semantic analysis' fail
> 
>
> Key: GROOVY-8836
> URL: https://issues.apache.org/jira/browse/GROOVY-8836
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 3.0.0-alpha-3, 2.5.2
>Reporter: Behruz
>Priority: Blocker
>  Labels: intellij, java
>
> in intellij: Tried CTRL+SHIFT+F10'ing following script:
> {code:java}
> def arr = (0..10).toArray()
> def reverted = Arrays.copyOfRange arr, arr.length, 0
> println reverted
> {code}
> Got following stack:
> {code:java}
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 
> (file:/ ... /groovy/3.0.0-alpha-3/groovy-3.0.0-alpha-3.jar) to constructor 
> java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
> WARNING: Please consider reporting this to the maintainers of 
> org.codehaus.groovy.vmplugin.v7.Java7$1
> WARNING: Use --illegal-access=warn to enable warnings of further illegal 
> reflective access operations
> WARNING: All illegal access operations will be denied in a future release
> Caught: BUG! exception in phase 'semantic analysis' in source unit '... 
> \.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
> BUG! exception in phase 'semantic analysis' in source unit '... 
> 

[jira] [Created] (GROOVY-8836) 'semantic analysis' fail

2018-10-09 Thread Behruz (JIRA)
Behruz created GROOVY-8836:
--

 Summary: 'semantic analysis' fail
 Key: GROOVY-8836
 URL: https://issues.apache.org/jira/browse/GROOVY-8836
 Project: Groovy
  Issue Type: Bug
  Components: groovy-runtime
Affects Versions: 2.5.2, 3.0.0-alpha-3
Reporter: Behruz


Tried CTRL+SHIFT+F10'ing following script:
{code:java}
// def arr = (0..10).toArray()

def reverted = Arrays.copyOfRange arr, arr.length, 0

println reverted
{code}
Got following stack:
{code:java}
// WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 
(file:/ ... /groovy/3.0.0-alpha-3/groovy-3.0.0-alpha-3.jar) to constructor 
java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of 
org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
Caught: BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
BUG! exception in phase 'semantic analysis' in source unit '... 
\.IntelliJIdea2018.2\config\scratches\scratch.groovy' null
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
   at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: java.lang.UnsupportedOperationException
   at 
groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
   at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
   ... 3 more
{code}
I know nothing about Groovy, but it said 'Bug!', so I report



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


[GitHub] groovy pull request #808: Documentation for @TailRecursive

2018-10-09 Thread JacobAae
GitHub user JacobAae opened a pull request:

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

Documentation for @TailRecursive

Added a test with an example and included it in the language documentation 
with some of the limitations of the annotation

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

$ git pull https://github.com/JacobAae/groovy master

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

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


commit eca6d7b457959c13e9059663b392fb7c28ffdce3
Author: Jacob Aae Mikkelsen 
Date:   2018-10-09T12:07:16Z

Documentation for @TailRecursive




---


[jira] [Created] (GROOVY-8835) AstNodeToScriptVisitor - no token needed for EmptyStatement initialization

2018-10-09 Thread Anton Pryamostanov (JIRA)
Anton Pryamostanov created GROOVY-8835:
--

 Summary: AstNodeToScriptVisitor - no token needed for 
EmptyStatement initialization
 Key: GROOVY-8835
 URL: https://issues.apache.org/jira/browse/GROOVY-8835
 Project: Groovy
  Issue Type: Bug
  Components: Groovy Console, Swing
Affects Versions: 2.5.2
Reporter: Anton Pryamostanov


Consider the following example:
{code:java}
package groovy

import groovy.inspect.swingui.AstNodeToScriptVisitor
import org.codehaus.groovy.ast.expr.EmptyExpression
import org.codehaus.groovy.ast.tools.GeneralUtils

class SandBox {

static void main(String[] args) {
new SandBox().someMethod()
}

void someMethod() {
StringWriter stringWriter = new StringWriter()
GeneralUtils.declS(GeneralUtils.varX("someVariableName"), new 
EmptyExpression()).visit(new AstNodeToScriptVisitor(stringWriter))
System.out.println("Output: 
"+stringWriter.getBuffer().toString().replace("\$", ""))
}

}
{code}

Actual result:
{code}
Output: java.lang.Object someVariableName = 
{code}

Expected result:
{code}
Output: java.lang.Object someVariableName
{code}

When DeclarationExpression (or possibly other BinaryExpression) is initialized 
with EmptyExpression as "right" expression, *AstNodeToScriptVisitor* should not 
output the token ("=" in this example), as there is no corresponding expression 
printed after the token.



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


[jira] [Commented] (GROOVY-8826) Captured loop variables have surprising and Java-incompatible behavior

2018-10-09 Thread Daniel Sun (JIRA)


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

Daniel Sun commented on GROOVY-8826:


[~blackdrag] Thanks for your explanation in details. You are always my good 
mentor. The issue is more complex than I thought...

Could you tell me why the following code get two {{2}}? In other words, why 
will the capatured {{i}} be changed even if the {{i}} is captured by closure. 
As far as I know, closure will store capatured variables in its instance 
fields. If we assign the value to field, even if i changed, field will hold the 
original value(i.e. 1). I do not understand why field's value will change while 
{{i}} changes(See the second following code snippet). Thanks in advance!


{code:java}
import java.util.ArrayList;
import java.util.Arrays;

public class Test {
public static void main(String... args) {
ArrayList closures = new ArrayList<>();

for (int i: new int[] {1, 2})
closures.add(() -> System.out.println(i));

for (Runnable closure: closures)
closure.run();
}
}
{code}


{code:java}

Integer i = 1

Integer f = i // if we assign the value to f, even if i changed, f will hold 
the original value, i.e. 1

i = 2

println f // gets 1

{code}



> Captured loop variables have surprising and Java-incompatible behavior
> --
>
> Key: GROOVY-8826
> URL: https://issues.apache.org/jira/browse/GROOVY-8826
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.0-alpha-3
>Reporter: Роман Донченко
>Priority: Major
>
> Consider this source:
> {code:java}
> import java.util.ArrayList;
> import java.util.Arrays;
> public class Test {
> public static void main(String... args) {
> ArrayList closures = new ArrayList<>();
> for (int i: new int[] {1, 2})
> closures.add(() -> System.out.println(i));
> for (Runnable closure: closures)
> closure.run();
> }
> }
> {code}
> If it's compiled as Java, the output is:
> {code}
> 1
> 2
> {code}
> But if it's compiled as Groovy, the output is:
> {code}
> 2
> 2
> {code}
> In other words, in Java each iteration gets a unique instance of the {{i}} 
> variable, which is captured in the corresponding closure, while in Groovy, 
> only one {{i}} variable exists and is captured into both closures. IMO, the 
> Groovy behavior is significantly less useful, and it would be nice if in 3.0 
> it was changed to match Java.
> Groovy also exhibits the same behavior with Groovy closures and 
> {{for(...in...)}} loops. I just used Java-compatible syntax for this example 
> in order to contrast Groovy and Java.



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