[jira] [Updated] (GROOVY-8892) Trait instance init blocks are called only when there are fields defined in same Trait

2018-11-18 Thread Paul King (JIRA)


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

Paul King updated GROOVY-8892:
--
Fix Version/s: 3.0.0-alpha-4

> Trait instance init blocks are called only when there are fields defined in 
> same Trait
> --
>
> Key: GROOVY-8892
> URL: https://issues.apache.org/jira/browse/GROOVY-8892
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.5
>Reporter: Anton Pryamostanov
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.5
>
>
> With ref. to GROOVY-8880, it seems Instance Init Blocks in Traits are 
> appended/called only when there are fields defined in the same trait. 
> Example:
> {code}
> trait TraitOne {
> {
> System.out.println("Does not work")
> }
> }
> trait TraitTwo {
> Integer instanceCounter //immutable, non-shareable
> {
> System.out.println("Works")
> instanceCounter = 1
> }
> }
> class ClassWithTrait implements TraitOne, TraitTwo {
> }
> new ClassWithTrait().instanceCounter
> {code}
> Output:
> {code}
> Works
> {code}
> Expected output (order may differ):
> {code}
> Works
> Does not work
> {code}



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


[jira] [Resolved] (GROOVY-8892) Trait instance init blocks are called only when there are fields defined in same Trait

2018-11-18 Thread Paul King (JIRA)


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

Paul King resolved GROOVY-8892.
---
   Resolution: Fixed
 Assignee: Paul King
Fix Version/s: 2.5.5

Thanks for spotting that - out by one error in the original code! Meant the 
logic was within a conditional it wasn't supposed to be in.

> Trait instance init blocks are called only when there are fields defined in 
> same Trait
> --
>
> Key: GROOVY-8892
> URL: https://issues.apache.org/jira/browse/GROOVY-8892
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.5
>Reporter: Anton Pryamostanov
>Assignee: Paul King
>Priority: Major
> Fix For: 2.5.5
>
>
> With ref. to GROOVY-8880, it seems Instance Init Blocks in Traits are 
> appended/called only when there are fields defined in the same trait. 
> Example:
> {code}
> trait TraitOne {
> {
> System.out.println("Does not work")
> }
> }
> trait TraitTwo {
> Integer instanceCounter //immutable, non-shareable
> {
> System.out.println("Works")
> instanceCounter = 1
> }
> }
> class ClassWithTrait implements TraitOne, TraitTwo {
> }
> new ClassWithTrait().instanceCounter
> {code}
> Output:
> {code}
> Works
> {code}
> Expected output (order may differ):
> {code}
> Works
> Does not work
> {code}



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


[jira] [Commented] (GROOVY-8891) Trait Instance Init Block causes Runtime exception for Trait fields with default values

2018-11-18 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8891:
---

This is really a grammar issue which we aren't likely to fix. Add a semicolon 
or numerous other constructs like a method definition after the 0 and it will 
work.

> Trait Instance Init Block causes Runtime exception for Trait fields with 
> default values
> ---
>
> Key: GROOVY-8891
> URL: https://issues.apache.org/jira/browse/GROOVY-8891
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.5
>Reporter: Anton Pryamostanov
>Priority: Major
>
> With ref. to GROOVY-8880, when instance or static field has default value in 
> Trait, when same Trait has Instance Init Block, Runtime exception happens.
> Example code:
> {code}
> trait Trait {
> Integer fieldWithDefaultValue = 0
> {
> System.out.println("Only instance init block gives this problem")
> }
> }
> class ClassWithTrait implements Trait {
> }
> new ClassWithTrait().fieldWithDefaultValue
> {code}
> Runtime exception:
> {code}
> groovy.lang.MissingMethodException: No signature of method: 
> java.lang.Integer.call() is applicable for argument types: 
> (Trait$Trait$Helper$__init__closure1) values: 
> [Trait$Trait$Helper$__init__closure1@5833d058]
> Possible solutions: wait(), abs(), any(), wait(long), 
> each(groovy.lang.Closure), any(groovy.lang.Closure)
>   at Trait$Trait$Helper.$init$(ConsoleScript80:3)
>   at ClassWithTrait.(ConsoleScript80)
>   at ConsoleScript80.run(ConsoleScript80:9)
> {code}
> Note: It does not matter if field is static of instance.
> Note 2: Static Init Block in Trait does not cause same issue and works Ok.



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


[jira] [Resolved] (GROOVY-8880) Traits - static/instance init blocks

2018-11-18 Thread Anton Pryamostanov (JIRA)


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

Anton Pryamostanov resolved GROOVY-8880.

Resolution: Fixed

Retested OK 3.0.0.SNAPSHOT

I had to checkout and build on different machine. Need to investigate more what 
happens on machine where there is cache problem. That was IDE/environment issue 
probably.

Thank you!

> Traits - static/instance init blocks
> 
>
> Key: GROOVY-8880
> URL: https://issues.apache.org/jira/browse/GROOVY-8880
> Project: Groovy
>  Issue Type: Improvement
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.2
>Reporter: Anton Pryamostanov
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.5
>
>
> Let's consider the below examples of Traits with Init blocks:
>  *Instance init block:*
> {code}
> trait InstanceTrait {
> {
> System.out.println("Instance init")
> }
> }
> class InstanceTraitClass implements InstanceTrait {
> }
> new InstanceTraitClass()
> {code}
> This gives the below compilation exception:
> {code:java}
> General error during class generation: NPE while processing 
> script1542098577743.groovy
> groovy.lang.GroovyRuntimeException: NPE while processing 
> script1542098577743.groovy
> at 
> org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:2
> at 
> org.codehaus.groovy.control.CompilationUnit$17.call(CompilationUnit.java:8
> at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:10
> at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:6
> at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:5
> at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:5
> at org.codehaus.groovy.control.CompilationUnit$compile$1.call(Unknown Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter.compileToScript(AstNodeToScriptAdapter.groovy:
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter$compileToScript.call(Unknown 
> Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstBrowser$_decompile_closure6.doCall(AstBrowser.groovy:3
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> at java.lang.reflect.Method.invoke(Method.java:4
> at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:3
> at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:2
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.run(Closure.java:4
> at java.lang.Thread.run(Thread.java:7
> Caused by: java.lang.NullPointerException
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareCallSite(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:3
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:3
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:1
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:4
> at 
> org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:7
> at 
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:
> at 
> 

[jira] [Created] (GROOVY-8893) Breakpoints aren't working on NetBeans for dynamically loaded Groovy

2018-11-18 Thread Blake McBride (JIRA)
Blake McBride created GROOVY-8893:
-

 Summary: Breakpoints aren't working on NetBeans for dynamically 
loaded Groovy
 Key: GROOVY-8893
 URL: https://issues.apache.org/jira/browse/GROOVY-8893
 Project: Groovy
  Issue Type: Bug
  Components: bytecode
Affects Versions: 2.4.15
Reporter: Blake McBride


Greetings,
 
I am using Groovy 2.4.15 under NetBeans 8.2 and Java 8 on a 64 bit Linux box.
 
I am dynamically loading Groovy with the following code:
 
if (groovyLoader == null)
groovyLoader = new GroovyClassLoader(GroovyClass.class.getClassLoader());
groovyClass = groovyLoader.parseClass(new GroovyCodeSource(new File(path + 
sourceFile)), false);
 
 
Doing it this way, when debugging the loaded class, I am able to set 
breakpoints from within IntelliJ and it works as expected.  However, NetBeans & 
VSCode ignore the breakpoints.
 
I do a similar thing with Java files, and NetBeans & VSCode honors those 
breakpoints.
 
There must be something different between dynamically loaded Java and 
dynamically loaded Groovy.
 
Thanks.
 
Blake McBride



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


[jira] [Updated] (GROOVY-8891) Trait Instance Init Block causes Runtime exception for Trait fields with default values

2018-11-18 Thread Anton Pryamostanov (JIRA)


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

Anton Pryamostanov updated GROOVY-8891:
---
Description: 
With ref. to GROOVY-8880, when instance or static field has default value in 
Trait, when same Trait has Instance Init Block, Runtime exception happens.

Example code:

{code}
trait Trait {
Integer fieldWithDefaultValue = 0
{
System.out.println("Only instance init block gives this problem")
}
}
class ClassWithTrait implements Trait {
}
new ClassWithTrait().fieldWithDefaultValue
{code}

Runtime exception:
{code}
groovy.lang.MissingMethodException: No signature of method: 
java.lang.Integer.call() is applicable for argument types: 
(Trait$Trait$Helper$__init__closure1) values: 
[Trait$Trait$Helper$__init__closure1@5833d058]
Possible solutions: wait(), abs(), any(), wait(long), 
each(groovy.lang.Closure), any(groovy.lang.Closure)

at Trait$Trait$Helper.$init$(ConsoleScript80:3)

at ClassWithTrait.(ConsoleScript80)

at ConsoleScript80.run(ConsoleScript80:9)
{code}

Note: It does not matter if field is static of instance.
Note 2: Static Init Block in Trait does not cause same issue and works Ok. 
However Please see issue (TBD) which can mask this problem from appearing in 
Static Init Block also.

  was:
With ref. to GROOVY-8880, when instance or static field has default value in 
Trait, when same Trait has Instance Init Block, Runtime exception happens.

Example code:

{code}
trait Trait {
Integer fieldWithDefaultValue = 0
{
System.out.println("Only instance init block gives this problem")
}
}
class ClassWithTrait implements Trait {
}
new ClassWithTrait().fieldWithDefaultValue
{code}

Runtime exception:
{code}
{code}

Note: It does not matter if field is static of instance.
Note 2: Static Init Block in Trait does not cause same issue and works Ok. 
However Please see issue (TBD) which can mask this problem from appearing in 
Static Init Block also.


> Trait Instance Init Block causes Runtime exception for Trait fields with 
> default values
> ---
>
> Key: GROOVY-8891
> URL: https://issues.apache.org/jira/browse/GROOVY-8891
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.5
>Reporter: Anton Pryamostanov
>Priority: Major
>
> With ref. to GROOVY-8880, when instance or static field has default value in 
> Trait, when same Trait has Instance Init Block, Runtime exception happens.
> Example code:
> {code}
> trait Trait {
> Integer fieldWithDefaultValue = 0
> {
> System.out.println("Only instance init block gives this problem")
> }
> }
> class ClassWithTrait implements Trait {
> }
> new ClassWithTrait().fieldWithDefaultValue
> {code}
> Runtime exception:
> {code}
> groovy.lang.MissingMethodException: No signature of method: 
> java.lang.Integer.call() is applicable for argument types: 
> (Trait$Trait$Helper$__init__closure1) values: 
> [Trait$Trait$Helper$__init__closure1@5833d058]
> Possible solutions: wait(), abs(), any(), wait(long), 
> each(groovy.lang.Closure), any(groovy.lang.Closure)
>   at Trait$Trait$Helper.$init$(ConsoleScript80:3)
>   at ClassWithTrait.(ConsoleScript80)
>   at ConsoleScript80.run(ConsoleScript80:9)
> {code}
> Note: It does not matter if field is static of instance.
> Note 2: Static Init Block in Trait does not cause same issue and works Ok. 
> However Please see issue (TBD) which can mask this problem from appearing in 
> Static Init Block also.



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


[jira] [Commented] (GROOVY-8892) Trait instance init blocks are called only when there are fields defined in same Trait

2018-11-18 Thread Anton Pryamostanov (JIRA)


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

Anton Pryamostanov commented on GROOVY-8892:


[~paulk] FYI kindly

> Trait instance init blocks are called only when there are fields defined in 
> same Trait
> --
>
> Key: GROOVY-8892
> URL: https://issues.apache.org/jira/browse/GROOVY-8892
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.5
>Reporter: Anton Pryamostanov
>Priority: Major
>
> With ref. to GROOVY-8880, it seems Instance Init Blocks in Traits are 
> appended/called only when there are fields defined in the same trait. 
> Example:
> {code}
> trait TraitOne {
> {
> System.out.println("Does not work")
> }
> }
> trait TraitTwo {
> Integer instanceCounter //immutable, non-shareable
> {
> System.out.println("Works")
> instanceCounter = 1
> }
> }
> class ClassWithTrait implements TraitOne, TraitTwo {
> }
> new ClassWithTrait().instanceCounter
> {code}
> Output:
> {code}
> Works
> {code}
> Expected output (order may differ):
> {code}
> Works
> Does not work
> {code}



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


[jira] [Commented] (GROOVY-8880) Traits - static/instance init blocks

2018-11-18 Thread Anton Pryamostanov (JIRA)


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

Anton Pryamostanov commented on GROOVY-8880:


Hi [~paulk], please see related new issues:
GROOVY-8891, GROOVY-8892

Reg. this enhancement/new feature testing in 3.0.0.SNAPSHOT -  I will update 
here shortly.

> Traits - static/instance init blocks
> 
>
> Key: GROOVY-8880
> URL: https://issues.apache.org/jira/browse/GROOVY-8880
> Project: Groovy
>  Issue Type: Improvement
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.2
>Reporter: Anton Pryamostanov
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.5
>
>
> Let's consider the below examples of Traits with Init blocks:
>  *Instance init block:*
> {code}
> trait InstanceTrait {
> {
> System.out.println("Instance init")
> }
> }
> class InstanceTraitClass implements InstanceTrait {
> }
> new InstanceTraitClass()
> {code}
> This gives the below compilation exception:
> {code:java}
> General error during class generation: NPE while processing 
> script1542098577743.groovy
> groovy.lang.GroovyRuntimeException: NPE while processing 
> script1542098577743.groovy
> at 
> org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:2
> at 
> org.codehaus.groovy.control.CompilationUnit$17.call(CompilationUnit.java:8
> at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:10
> at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:6
> at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:5
> at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:5
> at org.codehaus.groovy.control.CompilationUnit$compile$1.call(Unknown Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter.compileToScript(AstNodeToScriptAdapter.groovy:
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter$compileToScript.call(Unknown 
> Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstBrowser$_decompile_closure6.doCall(AstBrowser.groovy:3
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> at java.lang.reflect.Method.invoke(Method.java:4
> at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:3
> at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:2
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.run(Closure.java:4
> at java.lang.Thread.run(Thread.java:7
> Caused by: java.lang.NullPointerException
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareCallSite(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:3
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:3
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:1
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:4
> at 
> org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:7
> at 
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:
> at 
> 

[jira] [Updated] (GROOVY-8892) Trait instance init blocks are called only when there are fields defined in same Trait

2018-11-18 Thread Anton Pryamostanov (JIRA)


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

Anton Pryamostanov updated GROOVY-8892:
---
Affects Version/s: 2.5.5
  Component/s: groovy-runtime
   Compiler

> Trait instance init blocks are called only when there are fields defined in 
> same Trait
> --
>
> Key: GROOVY-8892
> URL: https://issues.apache.org/jira/browse/GROOVY-8892
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.5
>Reporter: Anton Pryamostanov
>Priority: Major
>
> With ref. to GROOVY-8880, it seems Instance Init Blocks in Traits are 
> appended/called only when there are fields defined in the same trait. 
> Example:
> {code}
> trait TraitOne {
> {
> System.out.println("Does not work")
> }
> }
> trait TraitTwo {
> Integer instanceCounter //immutable, non-shareable
> {
> System.out.println("Works")
> instanceCounter = 1
> }
> }
> class ClassWithTrait implements TraitOne, TraitTwo {
> }
> new ClassWithTrait().instanceCounter
> {code}
> Output:
> {code}
> Works
> {code}
> Expected output (order may differ):
> {code}
> Works
> Does not work
> {code}



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


[jira] [Created] (GROOVY-8892) Trait instance init blocks are called only when there are fields defined in same Trait

2018-11-18 Thread Anton Pryamostanov (JIRA)
Anton Pryamostanov created GROOVY-8892:
--

 Summary: Trait instance init blocks are called only when there are 
fields defined in same Trait
 Key: GROOVY-8892
 URL: https://issues.apache.org/jira/browse/GROOVY-8892
 Project: Groovy
  Issue Type: Bug
Reporter: Anton Pryamostanov


With ref. to GROOVY-8880, it seems Instance Init Blocks in Traits are 
appended/called only when there are fields defined in the same trait. 

Example:
{code}
trait TraitOne {
{
System.out.println("Does not work")
}
}
trait TraitTwo {
Integer instanceCounter //immutable, non-shareable
{
System.out.println("Works")
instanceCounter = 1
}
}
class ClassWithTrait implements TraitOne, TraitTwo {
}
new ClassWithTrait().instanceCounter
{code}

Output:
{code}
Works
{code}

Expected output (order may differ):
{code}
Works
Does not work
{code}



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


[jira] [Updated] (GROOVY-8891) Trait Instance Init Block causes Runtime exception for Trait fields with default values

2018-11-18 Thread Anton Pryamostanov (JIRA)


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

Anton Pryamostanov updated GROOVY-8891:
---
Description: 
With ref. to GROOVY-8880, when instance or static field has default value in 
Trait, when same Trait has Instance Init Block, Runtime exception happens.

Example code:

{code}
trait Trait {
Integer fieldWithDefaultValue = 0
{
System.out.println("Only instance init block gives this problem")
}
}
class ClassWithTrait implements Trait {
}
new ClassWithTrait().fieldWithDefaultValue
{code}

Runtime exception:
{code}
groovy.lang.MissingMethodException: No signature of method: 
java.lang.Integer.call() is applicable for argument types: 
(Trait$Trait$Helper$__init__closure1) values: 
[Trait$Trait$Helper$__init__closure1@5833d058]
Possible solutions: wait(), abs(), any(), wait(long), 
each(groovy.lang.Closure), any(groovy.lang.Closure)

at Trait$Trait$Helper.$init$(ConsoleScript80:3)

at ClassWithTrait.(ConsoleScript80)

at ConsoleScript80.run(ConsoleScript80:9)
{code}

Note: It does not matter if field is static of instance.
Note 2: Static Init Block in Trait does not cause same issue and works Ok.

  was:
With ref. to GROOVY-8880, when instance or static field has default value in 
Trait, when same Trait has Instance Init Block, Runtime exception happens.

Example code:

{code}
trait Trait {
Integer fieldWithDefaultValue = 0
{
System.out.println("Only instance init block gives this problem")
}
}
class ClassWithTrait implements Trait {
}
new ClassWithTrait().fieldWithDefaultValue
{code}

Runtime exception:
{code}
groovy.lang.MissingMethodException: No signature of method: 
java.lang.Integer.call() is applicable for argument types: 
(Trait$Trait$Helper$__init__closure1) values: 
[Trait$Trait$Helper$__init__closure1@5833d058]
Possible solutions: wait(), abs(), any(), wait(long), 
each(groovy.lang.Closure), any(groovy.lang.Closure)

at Trait$Trait$Helper.$init$(ConsoleScript80:3)

at ClassWithTrait.(ConsoleScript80)

at ConsoleScript80.run(ConsoleScript80:9)
{code}

Note: It does not matter if field is static of instance.
Note 2: Static Init Block in Trait does not cause same issue and works Ok. 
However Please see issue (TBD) which can mask this problem from appearing in 
Static Init Block also.


> Trait Instance Init Block causes Runtime exception for Trait fields with 
> default values
> ---
>
> Key: GROOVY-8891
> URL: https://issues.apache.org/jira/browse/GROOVY-8891
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.5
>Reporter: Anton Pryamostanov
>Priority: Major
>
> With ref. to GROOVY-8880, when instance or static field has default value in 
> Trait, when same Trait has Instance Init Block, Runtime exception happens.
> Example code:
> {code}
> trait Trait {
> Integer fieldWithDefaultValue = 0
> {
> System.out.println("Only instance init block gives this problem")
> }
> }
> class ClassWithTrait implements Trait {
> }
> new ClassWithTrait().fieldWithDefaultValue
> {code}
> Runtime exception:
> {code}
> groovy.lang.MissingMethodException: No signature of method: 
> java.lang.Integer.call() is applicable for argument types: 
> (Trait$Trait$Helper$__init__closure1) values: 
> [Trait$Trait$Helper$__init__closure1@5833d058]
> Possible solutions: wait(), abs(), any(), wait(long), 
> each(groovy.lang.Closure), any(groovy.lang.Closure)
>   at Trait$Trait$Helper.$init$(ConsoleScript80:3)
>   at ClassWithTrait.(ConsoleScript80)
>   at ConsoleScript80.run(ConsoleScript80:9)
> {code}
> Note: It does not matter if field is static of instance.
> Note 2: Static Init Block in Trait does not cause same issue and works Ok.



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


[jira] [Created] (GROOVY-8891) Trait Instance Init Block causes Runtime exception for Trait fields with default values

2018-11-18 Thread Anton Pryamostanov (JIRA)
Anton Pryamostanov created GROOVY-8891:
--

 Summary: Trait Instance Init Block causes Runtime exception for 
Trait fields with default values
 Key: GROOVY-8891
 URL: https://issues.apache.org/jira/browse/GROOVY-8891
 Project: Groovy
  Issue Type: Bug
  Components: Compiler, groovy-runtime
Affects Versions: 2.5.5
Reporter: Anton Pryamostanov


With ref. to GROOVY-8880, when instance or static field has default value in 
Trait, when same Trait has Instance Init Block, Runtime exception happens.

Example code:

{code}
trait Trait {
Integer fieldWithDefaultValue = 0
{
System.out.println("Only instance init block gives this problem")
}
}
class ClassWithTrait implements Trait {
}
new ClassWithTrait().fieldWithDefaultValue
{code}

Runtime exception:
{code}
{code}

Note: It does not matter if field is static of instance.
Note 2: Static Init Block in Trait does not cause same issue and works Ok. 
However Please see issue (TBD) which can mask this problem from appearing in 
Static Init Block also.



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


[jira] [Commented] (GROOVY-8890) Make "Inspect Tokens" of groovy console support Parrot's tokens

2018-11-18 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on GROOVY-8890:


GitHub user danielsun1106 opened a pull request:

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

GROOVY-8890: Make "Inspect Tokens" of groovy console support Parrot's…

… tokens

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

$ git pull https://github.com/danielsun1106/groovy refine-console-tokens

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

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


commit 83ce8a2b87fc6f8d25421543cd1c7fafd53bcfa0
Author: danielsun1106 
Date:   2018-11-18T12:37:01Z

GROOVY-8890: Make "Inspect Tokens" of groovy console support Parrot's tokens




> Make "Inspect Tokens" of groovy console support Parrot's tokens
> ---
>
> Key: GROOVY-8890
> URL: https://issues.apache.org/jira/browse/GROOVY-8890
> Project: Groovy
>  Issue Type: Improvement
>  Components: Groovy Console
>Reporter: Daniel Sun
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 3.0.0-alpha-4
>
>




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


[GitHub] groovy pull request #825: GROOVY-8890: Make "Inspect Tokens" of groovy conso...

2018-11-18 Thread danielsun1106
GitHub user danielsun1106 opened a pull request:

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

GROOVY-8890: Make "Inspect Tokens" of groovy console support Parrot's…

… tokens

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

$ git pull https://github.com/danielsun1106/groovy refine-console-tokens

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

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


commit 83ce8a2b87fc6f8d25421543cd1c7fafd53bcfa0
Author: danielsun1106 
Date:   2018-11-18T12:37:01Z

GROOVY-8890: Make "Inspect Tokens" of groovy console support Parrot's tokens




---


[jira] [Created] (GROOVY-8890) Make "Inspect Tokens" of groovy console support Parrot's tokens

2018-11-18 Thread Daniel Sun (JIRA)
Daniel Sun created GROOVY-8890:
--

 Summary: Make "Inspect Tokens" of groovy console support Parrot's 
tokens
 Key: GROOVY-8890
 URL: https://issues.apache.org/jira/browse/GROOVY-8890
 Project: Groovy
  Issue Type: Improvement
  Components: Groovy Console
Reporter: Daniel Sun
Assignee: Daniel Sun
 Fix For: 3.0.0-alpha-4






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


[jira] [Commented] (GROOVY-8880) Traits - static/instance init blocks

2018-11-18 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8880:
---

The example works fine for me. I'd guess some kind of caching issue? Did you 
clean classes? Are you sure you have latest snapshot?

> Traits - static/instance init blocks
> 
>
> Key: GROOVY-8880
> URL: https://issues.apache.org/jira/browse/GROOVY-8880
> Project: Groovy
>  Issue Type: Improvement
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.2
>Reporter: Anton Pryamostanov
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.5
>
>
> Let's consider the below examples of Traits with Init blocks:
>  *Instance init block:*
> {code}
> trait InstanceTrait {
> {
> System.out.println("Instance init")
> }
> }
> class InstanceTraitClass implements InstanceTrait {
> }
> new InstanceTraitClass()
> {code}
> This gives the below compilation exception:
> {code:java}
> General error during class generation: NPE while processing 
> script1542098577743.groovy
> groovy.lang.GroovyRuntimeException: NPE while processing 
> script1542098577743.groovy
> at 
> org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:2
> at 
> org.codehaus.groovy.control.CompilationUnit$17.call(CompilationUnit.java:8
> at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:10
> at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:6
> at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:5
> at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:5
> at org.codehaus.groovy.control.CompilationUnit$compile$1.call(Unknown Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter.compileToScript(AstNodeToScriptAdapter.groovy:
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter$compileToScript.call(Unknown 
> Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstBrowser$_decompile_closure6.doCall(AstBrowser.groovy:3
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> at java.lang.reflect.Method.invoke(Method.java:4
> at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:3
> at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:2
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.run(Closure.java:4
> at java.lang.Thread.run(Thread.java:7
> Caused by: java.lang.NullPointerException
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareCallSite(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:3
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:3
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:1
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:4
> at 
> org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:7
> at 
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:
> at 
> 

[jira] [Comment Edited] (GROOVY-8880) Traits - static/instance init blocks

2018-11-18 Thread Anton Pryamostanov (JIRA)


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

Anton Pryamostanov edited comment on GROOVY-8880 at 11/18/18 10:15 AM:
---

hi [~paulk], yes - using "Clean" Maven task. Tried many times yesterday; works 
like charm in 2.5.5.SNAPSHOT but did not work in 3.0.0.

Also I validated that commit changes were in the project files used in my build.

There were some other issues with the build yesterday (related to Asciidoc 
plugin) and they are resolved now.

I will try again and will investigate more on what was happenning and post 
update here by today evening. Now going away from city.

 

I use "Dist" task for building and then I use Binary distribution (modifying 
GROOVY_HOME in its start_groovy.bat to be of the current directory with this 
latest build).


was (Author: anton.pryamostanov):
hi [~paulk], yes - using "Clean" Maven task. Tried many times yesterday; works 
like charm in 2.5.5.SNAPSHOT but did not work in 3.0.0.

Also I validated that commit changes were in the project files used in my build.

There were some other issues with the build yesterday (related to Asciidoc 
plugin) and they are resolved now.

I will try again and will investigate more on what was happenning and post 
update here by today evening. Now going away from city.

> Traits - static/instance init blocks
> 
>
> Key: GROOVY-8880
> URL: https://issues.apache.org/jira/browse/GROOVY-8880
> Project: Groovy
>  Issue Type: Improvement
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.2
>Reporter: Anton Pryamostanov
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.5
>
>
> Let's consider the below examples of Traits with Init blocks:
>  *Instance init block:*
> {code}
> trait InstanceTrait {
> {
> System.out.println("Instance init")
> }
> }
> class InstanceTraitClass implements InstanceTrait {
> }
> new InstanceTraitClass()
> {code}
> This gives the below compilation exception:
> {code:java}
> General error during class generation: NPE while processing 
> script1542098577743.groovy
> groovy.lang.GroovyRuntimeException: NPE while processing 
> script1542098577743.groovy
> at 
> org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:2
> at 
> org.codehaus.groovy.control.CompilationUnit$17.call(CompilationUnit.java:8
> at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:10
> at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:6
> at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:5
> at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:5
> at org.codehaus.groovy.control.CompilationUnit$compile$1.call(Unknown Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter.compileToScript(AstNodeToScriptAdapter.groovy:
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter$compileToScript.call(Unknown 
> Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstBrowser$_decompile_closure6.doCall(AstBrowser.groovy:3
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> at java.lang.reflect.Method.invoke(Method.java:4
> at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:3
> at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:2
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.run(Closure.java:4
> at java.lang.Thread.run(Thread.java:7
> Caused by: java.lang.NullPointerException
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareCallSite(CallSiteWriter.java:2
> at 
> 

[jira] [Comment Edited] (GROOVY-8880) Traits - static/instance init blocks

2018-11-18 Thread Anton Pryamostanov (JIRA)


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

Anton Pryamostanov edited comment on GROOVY-8880 at 11/18/18 10:14 AM:
---

hi [~paulk], yes - using "Clean" Maven task. Tried many times yesterday; works 
like charm in 2.5.5.SNAPSHOT but did not work in 3.0.0.

Also I validated that commit changes were in the project files used in my build.

There were some other issues with the build yesterday (related to Asciidoc 
plugin) and they are resolved now.

I will try again and will investigate more on what was happenning and post 
update here by today evening. Now going away from city.


was (Author: anton.pryamostanov):
hi [~paulk], yes - using "Clean" Maven task. Tried many times yesterday; works 
like charm in 2.5.5.SNAPSHOT but did not work in 3.0.0.

Also I validated that commit changes were in the project files used in my build.

There were some other issues with the build yesterday (related to Asciidoc 
plug) and they are resolved now.

I will try again and will investigate more on what was happenning and post 
update here by today evening. Now going away from city.

> Traits - static/instance init blocks
> 
>
> Key: GROOVY-8880
> URL: https://issues.apache.org/jira/browse/GROOVY-8880
> Project: Groovy
>  Issue Type: Improvement
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.2
>Reporter: Anton Pryamostanov
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.5
>
>
> Let's consider the below examples of Traits with Init blocks:
>  *Instance init block:*
> {code}
> trait InstanceTrait {
> {
> System.out.println("Instance init")
> }
> }
> class InstanceTraitClass implements InstanceTrait {
> }
> new InstanceTraitClass()
> {code}
> This gives the below compilation exception:
> {code:java}
> General error during class generation: NPE while processing 
> script1542098577743.groovy
> groovy.lang.GroovyRuntimeException: NPE while processing 
> script1542098577743.groovy
> at 
> org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:2
> at 
> org.codehaus.groovy.control.CompilationUnit$17.call(CompilationUnit.java:8
> at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:10
> at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:6
> at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:5
> at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:5
> at org.codehaus.groovy.control.CompilationUnit$compile$1.call(Unknown Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter.compileToScript(AstNodeToScriptAdapter.groovy:
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter$compileToScript.call(Unknown 
> Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstBrowser$_decompile_closure6.doCall(AstBrowser.groovy:3
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> at java.lang.reflect.Method.invoke(Method.java:4
> at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:3
> at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:2
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.run(Closure.java:4
> at java.lang.Thread.run(Thread.java:7
> Caused by: java.lang.NullPointerException
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareCallSite(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
>   

[jira] [Commented] (GROOVY-8880) Traits - static/instance init blocks

2018-11-18 Thread Anton Pryamostanov (JIRA)


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

Anton Pryamostanov commented on GROOVY-8880:


hi [~paulk], yes - using "Clean" Maven task. Tried many times yesterday; works 
like charm in 2.5.5.SNAPSHOT but did not work in 3.0.0.

Also I validated that commit changes were in the project files used in my build.

There were some other issues with the build yesterday (related to Asciidoc 
plug) and they are resolved now.

I will try again and will investigate more on what was happenning and post 
update here by today evening. Now going away from city.

> Traits - static/instance init blocks
> 
>
> Key: GROOVY-8880
> URL: https://issues.apache.org/jira/browse/GROOVY-8880
> Project: Groovy
>  Issue Type: Improvement
>  Components: Compiler, groovy-runtime
>Affects Versions: 2.5.2
>Reporter: Anton Pryamostanov
>Assignee: Paul King
>Priority: Major
> Fix For: 3.0.0-alpha-4, 2.5.5
>
>
> Let's consider the below examples of Traits with Init blocks:
>  *Instance init block:*
> {code}
> trait InstanceTrait {
> {
> System.out.println("Instance init")
> }
> }
> class InstanceTraitClass implements InstanceTrait {
> }
> new InstanceTraitClass()
> {code}
> This gives the below compilation exception:
> {code:java}
> General error during class generation: NPE while processing 
> script1542098577743.groovy
> groovy.lang.GroovyRuntimeException: NPE while processing 
> script1542098577743.groovy
> at 
> org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:2
> at 
> org.codehaus.groovy.control.CompilationUnit$17.call(CompilationUnit.java:8
> at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:10
> at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:6
> at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:5
> at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:5
> at org.codehaus.groovy.control.CompilationUnit$compile$1.call(Unknown Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter.compileToScript(AstNodeToScriptAdapter.groovy:
> at 
> groovy.inspect.swingui.AstNodeToScriptAdapter$compileToScript.call(Unknown 
> Sour
> at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:
> at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:1
> at 
> groovy.inspect.swingui.AstBrowser$_decompile_closure6.doCall(AstBrowser.groovy:3
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> at java.lang.reflect.Method.invoke(Method.java:4
> at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:3
> at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:2
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:10
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.call(Closure.java:4
> at groovy.lang.Closure.run(Closure.java:4
> at java.lang.Thread.run(Thread.java:7
> Caused by: java.lang.NullPointerException
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareCallSite(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:2
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:3
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:3
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:1
> at 
> org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:
> at 
> 

[jira] [Commented] (GROOVY-8888) Strict @NamedParams

2018-11-18 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-:
---

As per GROOVY-7632, this is a 2.5.5+ feature. But if you can test out the 
snapshot, that would be great.

> Strict @NamedParams
> ---
>
> Key: GROOVY-
> URL: https://issues.apache.org/jira/browse/GROOVY-
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Vladimír Oraný
>Priority: Major
>
> Thanks, [~paulk] for explaining how does all the "@Named*" annotation works. 
> I have one suggestion for improvement:
> At the moment when you add an extra entry in the map, the static compiler 
> won't complain. Would be nice to add "strict" property to "@NamedParams" 
> which will make any additional entry illegal.



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