[jira] [Comment Edited] (GROOVY-8760) can't instantiate a class that inherits from base class marked with @MapConstructor

2018-08-21 Thread Paul King (JIRA)


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

Paul King edited comment on GROOVY-8760 at 8/21/18 10:58 PM:
-

The first statement automatically added for any constructor is a call to 
{{super()}} unless you have an explicit call to {{super}} yourself. This also 
applies to the generated MapConstructor for B. Note that the {{super()}} call 
has no args so expects to find a no-arg constructor in A. Adding MapConstructor 
on A adds a constructor with a Map argument which removes the automatic no-arg 
constructor that would be added otherwise.
 Many combinations will work depending on what you are trying to do:
 (1) Don't use any AST transforms. Named argument calling is still supported 
without it. It will call the no-arg constructor followed by setters. You can't 
have final properties except constants.
{code:java}
import groovy.transform.*

class A {
  final long id = new Random().nextInt()
  String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

class B extends A {
  String extra
  String toString() {
 "B ($name, id:$id, extra:$extra, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true, extra: 'foo')
println myB
{code}
(2) You can use {{@MapConstructor}} on A and {{@InheritConstructors}} on B 
provided you have no additional properties in B - this will call {{super}} 
correctly and allows properties to be final - so obviously can only be set in 
the constructor.
{code:java}
import groovy.transform.*

@MapConstructor (post = {id = new Random().nextInt() })
class A {
  final long id
  final String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

@InheritConstructors
class B extends A {
  String toString() {
 "B ($name, id:$id, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true)
println myB
{code}
(3) Use MapConstructor (allowing e.g. final properties) and add a corrected 
call to super yourself in {{pre}}.
{code:java}
import groovy.transform.*

@MapConstructor (post = {id = new Random().nextInt() })
class A {
  final long id
  final String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

@MapConstructor (pre = { super(args) }) // post not needed since called in super
class B extends A {
  final String extra
  String toString() {
 "B ($name, id:$id, extra:$extra)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", extra: 'foo')
println myB
{code}
(4) Use {{includeSuperProperties}} in B and {{noArg}} in A.
{code:java}
import groovy.transform.*

@MapConstructor (noArg = true)
class A {
  final long id = new Random().nextInt()
  String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

@MapConstructor (includeSuperProperties = true)
class B extends A {
  final String extra
  String toString() {
 "B ($name, id:$id, extra:$extra, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true, extra: 'foo')
println myB
{code}
I'd recommend pasting any of the above into the groovyConsole and then looking 
under {{Script -> Inspect AST}} which will show you what is produced for 
different phases of the compiler. Jump along to at least Canonical phase.


was (Author: paulk):
The first statement automatically added for any constructor is a call to 
{{super()}} unless you have an explicit call to {{super}} yourself. This also 
applies to the generated MapConstructor for B. Note that the {{super()}} call 
has no args so expects to find a no-arg constructor in A. Adding MapConstructor 
on A adds a constructor with a Map argument which removes the automatic no-arg 
constructor that would be added otherwise.
 Many combinations will work depending on what you are trying to do:
 (1) Don't use any AST transforms. Named argument calling is still supported 
without it. It will call the no-arg constructor followed by setters. You can't 
have final properties except constants.
{code:java}
import groovy.transform.*

class A {
  final long id = new Random().nextInt()
  String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

class B extends A {
  String extra
  String toString() {
 "B ($name, id:$id, extra:$extra, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true, extra: 'foo')
println myB
{code}
(2) You can use {{@MapConstructor}} on A and {{@InheritConstructors}} on B 
provided you have no additional properties in B - this will call {{super}} 
correctly and allows properties to be final - so obviously can only set in the 
constructor.
{code:java}
import groovy.transform.*

@MapConstructor (post = {id = new Random().nextInt() })
class A {
  final long id
  final String 

[jira] [Comment Edited] (GROOVY-8760) can't instantiate a class that inherits from base class marked with @MapConstructor

2018-08-21 Thread Paul King (JIRA)


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

Paul King edited comment on GROOVY-8760 at 8/21/18 10:56 PM:
-

The first statement automatically added for any constructor is a call to 
{{super()}} unless you have an explicit call to {{super}} yourself. This also 
applies to the generated MapConstructor for B. Note that the {{super()}} call 
has no args so expects to find a no-arg constructor in A. Adding MapConstructor 
on A adds a constructor with a Map argument which removes the automatic no-arg 
constructor that would be added otherwise.
 Many combinations will work depending on what you are trying to do:
 (1) Don't use any AST transforms. Named argument calling is still supported 
without it. It will call the no-arg constructor followed by setters. You can't 
have final properties except constants.
{code:java}
import groovy.transform.*

class A {
  final long id = new Random().nextInt()
  String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

class B extends A {
  String extra
  String toString() {
 "B ($name, id:$id, extra:$extra, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true, extra: 'foo')
println myB
{code}
(2) You can use {{@MapConstructor}} on A and {{@InheritConstructors}} on B 
provided you have no additional properties in B - this will call {{super}} 
correctly and allows properties to be final - so obviously can only set in the 
constructor.
{code:java}
import groovy.transform.*

@MapConstructor (post = {id = new Random().nextInt() })
class A {
  final long id
  final String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

@InheritConstructors
class B extends A {
  String toString() {
 "B ($name, id:$id, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true)
println myB
{code}
(3) Use MapConstructor (allowing e.g. final properties) and add a corrected 
call to super yourself in {{pre}}.
{code:java}
import groovy.transform.*

@MapConstructor (post = {id = new Random().nextInt() })
class A {
  final long id
  final String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

@MapConstructor (pre = { super(args) }) // post not needed since called in super
class B extends A {
  final String extra
  String toString() {
 "B ($name, id:$id, extra:$extra)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", extra: 'foo')
println myB
{code}
(4) Use {{includeSuperProperties}} in B and {{noArg}} in A.
{code:java}
import groovy.transform.*

@MapConstructor (noArg = true)
class A {
  final long id = new Random().nextInt()
  String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

@MapConstructor (includeSuperProperties = true)
class B extends A {
  final String extra
  String toString() {
 "B ($name, id:$id, extra:$extra, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true, extra: 'foo')
println myB
{code}
I'd recommend pasting any of the above into the groovyConsole and then looking 
under {{Script -> Inspect AST}} which will show you what is produced for 
different phases of the compiler. Jump along to at least Canonical phase.


was (Author: paulk):
The first statement automatically added for any constructor is a call to 
{{super()}} unless you have an explicit call to {{super}} yourself. This also 
applies to the generated MapConstructor for B. Note that the {{super()}} call 
has no args so expects to find a no-arg constructor in A. Adding MapConstructor 
on A adds a constructor with a Map argument which removes the automatic no-arg 
constructor that would be added otherwise.
 Many combinations will work depending on what you are trying to do:
 (1) Don't use any AST transforms. Named argument calling is still supported 
without it. It will call the no-arg constructor followed by setters. You can't 
have final properties except constants.
{code:java}
import groovy.transform.*

class A {
  final long id = new Random().nextInt()
  String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

class B extends A {
  String extra
  String toString() {
 "B ($name, id:$id, extra:$extra, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true, extra: 'foo')
println myB
{code}
(2) You can use {{@MapConstructor}} on A and {{@InheritConstructors}} on B 
provided you have no additional properties in B - this will call {{super}} 
correctly and allows properties to be final - so long as they are only set in 
the constructor.
{code:java}
import groovy.transform.*

@MapConstructor (post = {id = new Random().nextInt() })
class A {
  final long id
  final String 

[jira] [Commented] (GROOVY-8760) can't instantiate a class that inherits from base class marked with @MapConstructor

2018-08-21 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8760:
---

The first statement automatically added for any constructor is a call to 
{{super()}} unless you have an explicit call to {{super}} yourself. This also 
applies to the generated MapConstructor for B. Note that the {{super()}} call 
has no args so expects to find a no-arg constructor in A. Adding MapConstructor 
on A adds a constructor with a Map argument which removes the automatic no-arg 
constructor that would be added otherwise.
 Many combinations will work depending on what you are trying to do:
 (1) Don't use any AST transforms. Named argument calling is still supported 
without it. It will call the no-arg constructor followed by setters. You can't 
have final properties except constants.
{code:java}
import groovy.transform.*

class A {
  final long id = new Random().nextInt()
  String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

class B extends A {
  String extra
  String toString() {
 "B ($name, id:$id, extra:$extra, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true, extra: 'foo')
println myB
{code}
(2) You can use {{@MapConstructor}} on A and {{@InheritConstructors}} on B 
provided you have no additional properties in B - this will call {{super}} 
correctly and allows properties to be final - so long as they are only set in 
the constructor.
{code:java}
import groovy.transform.*

@MapConstructor (post = {id = new Random().nextInt() })
class A {
  final long id
  final String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

@InheritConstructors
class B extends A {
  String toString() {
 "B ($name, id:$id, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true)
println myB
{code}
(3) Use MapConstructor (allowing e.g. final properties) and add a corrected 
call to super yourself in {{pre}}.
{code:java}
import groovy.transform.*

@MapConstructor (post = {id = new Random().nextInt() })
class A {
  final long id
  final String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

@MapConstructor (pre = { super(args) }) // post not needed since called in super
class B extends A {
  final String extra
  String toString() {
 "B ($name, id:$id, extra:$extra)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", extra: 'foo')
println myB
{code}
(4) Use {{includeSuperProperties}} in B and {{noArg}} in A.
{code:java}
import groovy.transform.*

@MapConstructor (noArg = true)
class A {
  final long id = new Random().nextInt()
  String name
  Boolean isDead

  String toString() {
"A ($name, id:$id)"
  }
}

@MapConstructor (includeSuperProperties = true)
class B extends A {
  final String extra
  String toString() {
 "B ($name, id:$id, extra:$extra, isDead:$isDead)"
  }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred", isDead: true, extra: 'foo')
println myB
{code}

> can't instantiate a class that inherits from base class marked with 
> @MapConstructor
> ---
>
> Key: GROOVY-8760
> URL: https://issues.apache.org/jira/browse/GROOVY-8760
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.5.1
> Environment: intellij 2018.1.4, java jdk 8.0_172, groovy 2.5.1
>Reporter: William Woodman
>Priority: Major
>  Labels: features
>
> basic inheritance where parent is tagged with @MapConstructor then child 
> class cant be instantiated
> example as follows 
>  
> {code}
> @MapConstructor
> class A {
>  String name
>  A() {}
>  String toString() {
>  "A ($name)"
>  }
> }
> class B extends A {
>  String toString() {
>  "B ($name)"
>  }
> }
> def myA = new A(name:"will")
> println myA
> def myB = new B(name:"fred")
> println myB
> {code}
> run this and get a RT exception 
> {noformat}
> A (will)
> Caught: java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V 
> not found
> java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V not 
> found
>  at com.softwood.scripts.B.(TestOfferingAttributeGroup.groovy)
>  at 
> com.softwood.scripts.TestOfferingAttributeGroup.run(TestOfferingAttributeGroup.groovy:28)
> {noformat}



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


[jira] [Created] (GROOVY-8762) Invalid this reference in nested class

2018-08-21 Thread paolo di tommaso (JIRA)
paolo di tommaso created GROOVY-8762:


 Summary: Invalid this reference in nested class
 Key: GROOVY-8762
 URL: https://issues.apache.org/jira/browse/GROOVY-8762
 Project: Groovy
  Issue Type: Bug
Affects Versions: 2.5.1, 2.4.15
Reporter: paolo di tommaso


The following snippet throws an exception when trying to initialise the `y` 
attribute
{code:java}
class Foo {

static class Bar extends Closure {

private int x

private int y

Bar(int a) {
super(null, null);
x = a
this.y = a 
}

public int getMaximumNumberOfParameters() {
throw new UnsupportedOperationException()
}

public Class[] getParameterTypes() {
throw new UnsupportedOperationException()
}

public Object call(final Object... args) {
throw new UnsupportedOperationException()
}

public Object call(final Object arguments) {
throw new UnsupportedOperationException()
}

public Object call() {
throw new UnsupportedOperationException()
}
}

def doSomething() {
new Bar(1)
}
}


assert new Foo().doSomething() 
{code}

Reported error:
{code}
java.lang.NullPointerException
at Foo$Bar.(ConsoleScript8:12)
at Foo.doSomething(ConsoleScript8:37)
at Foo$doSomething.call(Unknown Source)
at ConsoleScript8.run(ConsoleScript8:42)
{code}



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


[jira] [Commented] (GROOVY-8760) can't instantiate a class that inherits from base class marked with @MapConstructor

2018-08-21 Thread William Woodman (JIRA)


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

William Woodman commented on GROOVY-8760:
-

um - its not quite idempotent - i think i mi=ust have a tried in a some order 
and broken it - this work 

 

@MapConstructor (post = \{id = SequenceGenerator.standard.next() })
class A {
 long id
 String name

 Boolean isDead
 Boolean died

 A() {}

 String toString() {
 "A ($name, id:$id)"
 }
}

@InheritConstructors
class B extends A {
 String toString() {
 "B ($name)"
 }
}

however if i try this - this will fail 

 

@MapConstructor (post = \{id = SequenceGenerator.standard.next() })
class A {
 long id
 String name

 Boolean isDead
 Boolean died

 A() {}

 String toString() {
 "A ($name, id:$id)"
 }
}

@MapConstructor (post = \{id = SequenceGenerator.standard.next() })
@InheritConstructors
class B extends A {
 String toString() {
 "B ($name)"
 }
}

like this 

A (will, id:1)
Caught: java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V 
not found
java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V not found
 at com.softwood.scripts.B.(TestOfferingAttributeGroup.groovy)
 at 
com.softwood.scripts.TestOfferingAttributeGroup.run(TestOfferingAttributeGroup.groovy:39)

 

and only define the map constructor on a chil 


class A {
 long id
 String name

 Boolean isDead
 Boolean died

 A() {}

 String toString() {
 "A ($name, id:$id)"
 }
}


@MapConstructor (post = \{id = SequenceGenerator.standard.next() })
@InheritConstructors
class B extends A {
 String toString() {
 "B ($name)"
 }
}

 

will work - but if you create a constructor on the parent - your map 
constructor is auto disabled ( i wanted the map constructor and  on both parent 
and child as i was using that to set this id field inherited from the parent) 

 

from groovy implementation perspective if you have applied the @MapContructor 
on a parent - shouldnt it be idempotent on the child?

 

for now i'm just going have to check carefully and test it does what i 
expect/doesnt fail 

 

Will 

 

> can't instantiate a class that inherits from base class marked with 
> @MapConstructor
> ---
>
> Key: GROOVY-8760
> URL: https://issues.apache.org/jira/browse/GROOVY-8760
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.5.1
> Environment: intellij 2018.1.4, java jdk 8.0_172, groovy 2.5.1
>Reporter: William Woodman
>Priority: Major
>  Labels: features
>
> basic inheritance where parent is tagged with @MapConstructor then child 
> class cant be instantiated
> example as follows 
>  
> {code}
> @MapConstructor
> class A {
>  String name
>  A() {}
>  String toString() {
>  "A ($name)"
>  }
> }
> class B extends A {
>  String toString() {
>  "B ($name)"
>  }
> }
> def myA = new A(name:"will")
> println myA
> def myB = new B(name:"fred")
> println myB
> {code}
> run this and get a RT exception 
> {noformat}
> A (will)
> Caught: java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V 
> not found
> java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V not 
> found
>  at com.softwood.scripts.B.(TestOfferingAttributeGroup.groovy)
>  at 
> com.softwood.scripts.TestOfferingAttributeGroup.run(TestOfferingAttributeGroup.groovy:28)
> {noformat}



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


[jira] [Closed] (GROOVY-8761) Exception in phase 'instruction selection'

2018-08-21 Thread paolo di tommaso (JIRA)


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

paolo di tommaso closed GROOVY-8761.

   Resolution: Duplicate
Fix Version/s: 2.5.3

Duplicate of GROOVY-8753

> Exception in phase 'instruction selection'
> --
>
> Key: GROOVY-8761
> URL: https://issues.apache.org/jira/browse/GROOVY-8761
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.2
>Reporter: paolo di tommaso
>Priority: Major
> Fix For: 2.5.3
>
>
> Upgrading to groovy 2.5.2 the compiler returns the following error message. 
>  
> {code:java}
> BUG! exception in phase 'instruction selection' in source unit 
> '/Users/pditommaso/projects/nextflow/src/main/groovy/nextflow/extension/TapOp.groovy'
>  Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[outputs]].
> {code}
>  
> The class under compilation can be found at [this 
> link|https://github.com/nextflow-io/nextflow/blob/daded334b2478596d9821fb9049f91e05fc22699/src/main/groovy/nextflow/extension/TapOp.groovy#L36-L117].
>  the compilation is fine up to groovy 2.5.1
>  



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


[jira] [Commented] (GROOVY-8761) Exception in phase 'instruction selection'

2018-08-21 Thread paolo di tommaso (JIRA)


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

paolo di tommaso commented on GROOVY-8761:
--

I confirm that 2.5.3-SNAPSHOT fix the problem. I'm closing this issue.  

> Exception in phase 'instruction selection'
> --
>
> Key: GROOVY-8761
> URL: https://issues.apache.org/jira/browse/GROOVY-8761
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.2
>Reporter: paolo di tommaso
>Priority: Major
>
> Upgrading to groovy 2.5.2 the compiler returns the following error message. 
>  
> {code:java}
> BUG! exception in phase 'instruction selection' in source unit 
> '/Users/pditommaso/projects/nextflow/src/main/groovy/nextflow/extension/TapOp.groovy'
>  Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[outputs]].
> {code}
>  
> The class under compilation can be found at [this 
> link|https://github.com/nextflow-io/nextflow/blob/daded334b2478596d9821fb9049f91e05fc22699/src/main/groovy/nextflow/extension/TapOp.groovy#L36-L117].
>  the compilation is fine up to groovy 2.5.1
>  



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


[jira] [Commented] (GROOVY-8761) Exception in phase 'instruction selection'

2018-08-21 Thread paolo di tommaso (JIRA)


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

paolo di tommaso commented on GROOVY-8761:
--

Nice.

> Exception in phase 'instruction selection'
> --
>
> Key: GROOVY-8761
> URL: https://issues.apache.org/jira/browse/GROOVY-8761
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.2
>Reporter: paolo di tommaso
>Priority: Major
>
> Upgrading to groovy 2.5.2 the compiler returns the following error message. 
>  
> {code:java}
> BUG! exception in phase 'instruction selection' in source unit 
> '/Users/pditommaso/projects/nextflow/src/main/groovy/nextflow/extension/TapOp.groovy'
>  Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[outputs]].
> {code}
>  
> The class under compilation can be found at [this 
> link|https://github.com/nextflow-io/nextflow/blob/daded334b2478596d9821fb9049f91e05fc22699/src/main/groovy/nextflow/extension/TapOp.groovy#L36-L117].
>  the compilation is fine up to groovy 2.5.1
>  



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


[jira] [Commented] (GROOVY-8761) Exception in phase 'instruction selection'

2018-08-21 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8761:
---

Yep, it should always be putNodeMetaData not setNodeMetaData if the code path 
can be visited twice. In an earlier change all my test cases only ever visited 
once but as per GROOVY-8753 and your example, that is not the case. I'll do a 
2.5.3 release not too far down the track.

> Exception in phase 'instruction selection'
> --
>
> Key: GROOVY-8761
> URL: https://issues.apache.org/jira/browse/GROOVY-8761
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.2
>Reporter: paolo di tommaso
>Priority: Major
>
> Upgrading to groovy 2.5.2 the compiler returns the following error message. 
>  
> {code:java}
> BUG! exception in phase 'instruction selection' in source unit 
> '/Users/pditommaso/projects/nextflow/src/main/groovy/nextflow/extension/TapOp.groovy'
>  Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[outputs]].
> {code}
>  
> The class under compilation can be found at [this 
> link|https://github.com/nextflow-io/nextflow/blob/daded334b2478596d9821fb9049f91e05fc22699/src/main/groovy/nextflow/extension/TapOp.groovy#L36-L117].
>  the compilation is fine up to groovy 2.5.1
>  



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


[jira] [Comment Edited] (GROOVY-8761) Exception in phase 'instruction selection'

2018-08-21 Thread Paul King (JIRA)


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

Paul King edited comment on GROOVY-8761 at 8/21/18 10:36 AM:
-

Yep, it should always be putNodeMetaData not setNodeMetaData if the code path 
can be visited more than once. In an earlier change all my test cases only ever 
visited once but as per GROOVY-8753 and your example, that is not the case. 
I'll do a 2.5.3 release not too far down the track.


was (Author: paulk):
Yep, it should always be putNodeMetaData not setNodeMetaData if the code path 
can be visited twice. In an earlier change all my test cases only ever visited 
once but as per GROOVY-8753 and your example, that is not the case. I'll do a 
2.5.3 release not too far down the track.

> Exception in phase 'instruction selection'
> --
>
> Key: GROOVY-8761
> URL: https://issues.apache.org/jira/browse/GROOVY-8761
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.2
>Reporter: paolo di tommaso
>Priority: Major
>
> Upgrading to groovy 2.5.2 the compiler returns the following error message. 
>  
> {code:java}
> BUG! exception in phase 'instruction selection' in source unit 
> '/Users/pditommaso/projects/nextflow/src/main/groovy/nextflow/extension/TapOp.groovy'
>  Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[outputs]].
> {code}
>  
> The class under compilation can be found at [this 
> link|https://github.com/nextflow-io/nextflow/blob/daded334b2478596d9821fb9049f91e05fc22699/src/main/groovy/nextflow/extension/TapOp.groovy#L36-L117].
>  the compilation is fine up to groovy 2.5.1
>  



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


[jira] [Commented] (GROOVY-8761) Exception in phase 'instruction selection'

2018-08-21 Thread paolo di tommaso (JIRA)


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

paolo di tommaso commented on GROOVY-8761:
--

This is the complete error stack trace: 

{code}
Error:Groovyc: While compiling nextflow_main: BUG! exception in phase 
'instruction selection' in source unit 
'/Users/pditommaso/projects/nextflow/src/main/groovy/nextflow/extension/TapOp.groovy'
 Tried to overwrite existing meta data 
org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] property: 
ConstantExpression[outputs]].
at org.codehaus.groovy.ast.ASTNode.setNodeMetaData(ASTNode.java:154)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkOrMarkPrivateAccess(StaticTypeCheckingVisitor.java:501)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.storeField(StaticTypeCheckingVisitor.java:1711)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1473)
at 
org.codehaus.groovy.transform.sc.StaticCompilationVisitor.existsProperty(StaticCompilationVisitor.java:522)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.existsProperty(StaticTypeCheckingVisitor.java:1381)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitPropertyExpressionSilent(StaticTypeCheckingVisitor.java:726)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.tryVariableExpressionAsProperty(StaticTypeCheckingVisitor.java:711)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(StaticTypeCheckingVisitor.java:630)
at 
org.codehaus.groovy.ast.expr.VariableExpression.visit(VariableExpression.java:72)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBinaryExpression(StaticTypeCheckingVisitor.java:785)
at 
org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
at 
org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
at 
org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at 
org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
at 
org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at 
org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClosureExpression(StaticTypeCheckingVisitor.java:2286)
at 
org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2596)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:3286)
at 
org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:397)
at 
org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at 
org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
at 
org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at 
org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitBlockStatement(StaticTypeCheckingVisitor.java:3628)
at 
org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:110)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:121)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:2043)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:128)
at 

[jira] [Commented] (GROOVY-8760) can't instantiate a class that inherits from base class marked with @MapConstructor

2018-08-21 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8760:
---

Using @MapConstructor(noArg=true) on A or @InheritConstructors on class B works 
for me.

> can't instantiate a class that inherits from base class marked with 
> @MapConstructor
> ---
>
> Key: GROOVY-8760
> URL: https://issues.apache.org/jira/browse/GROOVY-8760
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.5.1
> Environment: intellij 2018.1.4, java jdk 8.0_172, groovy 2.5.1
>Reporter: William Woodman
>Priority: Major
>  Labels: features
>
> basic inheritance where parent is tagged with @MapConstructor then child 
> class cant be instantiated
> example as follows 
>  
> {code}
> @MapConstructor
> class A {
>  String name
>  A() {}
>  String toString() {
>  "A ($name)"
>  }
> }
> class B extends A {
>  String toString() {
>  "B ($name)"
>  }
> }
> def myA = new A(name:"will")
> println myA
> def myB = new B(name:"fred")
> println myB
> {code}
> run this and get a RT exception 
> {noformat}
> A (will)
> Caught: java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V 
> not found
> java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V not 
> found
>  at com.softwood.scripts.B.(TestOfferingAttributeGroup.groovy)
>  at 
> com.softwood.scripts.TestOfferingAttributeGroup.run(TestOfferingAttributeGroup.groovy:28)
> {noformat}



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


[jira] [Updated] (GROOVY-8760) can't instantiate a class that inherits from base class marked with @MapConstructor

2018-08-21 Thread Paul King (JIRA)


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

Paul King updated GROOVY-8760:
--
Description: 
basic inheritance where parent is tagged with @MapConstructor then child class 
cant be instantiated

example as follows 
 
{code}
@MapConstructor
class A {
 String name

 A() {}

 String toString() {
 "A ($name)"
 }
}

class B extends A {
 String toString() {
 "B ($name)"
 }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred")
println myB
{code}
run this and get a RT exception 
{noformat}
A (will)
Caught: java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V 
not found
java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V not found
 at com.softwood.scripts.B.(TestOfferingAttributeGroup.groovy)
 at 
com.softwood.scripts.TestOfferingAttributeGroup.run(TestOfferingAttributeGroup.groovy:28)
{noformat}


  was:
basic inheritance where parent is tagged with @MapConstructor then child class 
cant be instantiated

 

example as follows 

 

@MapConstructor
class A {
 String name

 A() {}

 String toString() {
 "A ($name)"
 }
}

class B extends A {
 String toString() {
 "B ($name)"
 }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred")
println myB

 

run this and get a RT exception 

A (will)
Caught: java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V 
not found
java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V not found
 at com.softwood.scripts.B.(TestOfferingAttributeGroup.groovy)
 at 
com.softwood.scripts.TestOfferingAttributeGroup.run(TestOfferingAttributeGroup.groovy:28)


> can't instantiate a class that inherits from base class marked with 
> @MapConstructor
> ---
>
> Key: GROOVY-8760
> URL: https://issues.apache.org/jira/browse/GROOVY-8760
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.5.1
> Environment: intellij 2018.1.4, java jdk 8.0_172, groovy 2.5.1
>Reporter: William Woodman
>Priority: Major
>  Labels: features
>
> basic inheritance where parent is tagged with @MapConstructor then child 
> class cant be instantiated
> example as follows 
>  
> {code}
> @MapConstructor
> class A {
>  String name
>  A() {}
>  String toString() {
>  "A ($name)"
>  }
> }
> class B extends A {
>  String toString() {
>  "B ($name)"
>  }
> }
> def myA = new A(name:"will")
> println myA
> def myB = new B(name:"fred")
> println myB
> {code}
> run this and get a RT exception 
> {noformat}
> A (will)
> Caught: java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V 
> not found
> java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V not 
> found
>  at com.softwood.scripts.B.(TestOfferingAttributeGroup.groovy)
>  at 
> com.softwood.scripts.TestOfferingAttributeGroup.run(TestOfferingAttributeGroup.groovy:28)
> {noformat}



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


[jira] [Commented] (GROOVY-8761) Exception in phase 'instruction selection'

2018-08-21 Thread Paul King (JIRA)


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

Paul King commented on GROOVY-8761:
---

Probably a duplicate of GROOVY-8753

> Exception in phase 'instruction selection'
> --
>
> Key: GROOVY-8761
> URL: https://issues.apache.org/jira/browse/GROOVY-8761
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.5.2
>Reporter: paolo di tommaso
>Priority: Major
>
> Upgrading to groovy 2.5.2 the compiler returns the following error message. 
>  
> {code:java}
> BUG! exception in phase 'instruction selection' in source unit 
> '/Users/pditommaso/projects/nextflow/src/main/groovy/nextflow/extension/TapOp.groovy'
>  Tried to overwrite existing meta data 
> org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
> org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] 
> property: ConstantExpression[outputs]].
> {code}
>  
> The class under compilation can be found at [this 
> link|https://github.com/nextflow-io/nextflow/blob/daded334b2478596d9821fb9049f91e05fc22699/src/main/groovy/nextflow/extension/TapOp.groovy#L36-L117].
>  the compilation is fine up to groovy 2.5.1
>  



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


[jira] [Created] (GROOVY-8761) Exception in phase 'instruction selection'

2018-08-21 Thread paolo di tommaso (JIRA)
paolo di tommaso created GROOVY-8761:


 Summary: Exception in phase 'instruction selection'
 Key: GROOVY-8761
 URL: https://issues.apache.org/jira/browse/GROOVY-8761
 Project: Groovy
  Issue Type: Bug
Affects Versions: 2.5.2
Reporter: paolo di tommaso


Upgrading to groovy 2.5.2 the compiler returns the following error message. 

 
{code:java}
BUG! exception in phase 'instruction selection' in source unit 
'/Users/pditommaso/projects/nextflow/src/main/groovy/nextflow/extension/TapOp.groovy'
 Tried to overwrite existing meta data 
org.codehaus.groovy.ast.expr.PropertyExpression@d9f41[object: 
org.codehaus.groovy.ast.expr.VariableExpression@d9f41[variable: this] property: 
ConstantExpression[outputs]].

{code}
 

The class under compilation can be found at [this 
link|https://github.com/nextflow-io/nextflow/blob/daded334b2478596d9821fb9049f91e05fc22699/src/main/groovy/nextflow/extension/TapOp.groovy#L36-L117].
 the compilation is fine up to groovy 2.5.1

 



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


[jira] [Commented] (GROOVY-8760) can't instantiate a class that inherits from base class marked with @MapConstructor

2018-08-21 Thread William Woodman (JIRA)


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

William Woodman commented on GROOVY-8760:
-

tried with @InheritConstructors in child class - didnt seem to help

> can't instantiate a class that inherits from base class marked with 
> @MapConstructor
> ---
>
> Key: GROOVY-8760
> URL: https://issues.apache.org/jira/browse/GROOVY-8760
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.5.1
> Environment: intellij 2018.1.4, java jdk 8.0_172, groovy 2.5.1
>Reporter: William Woodman
>Priority: Major
>  Labels: features
>
> basic inheritance where parent is tagged with @MapConstructor then child 
> class cant be instantiated
>  
> example as follows 
>  
> @MapConstructor
> class A {
>  String name
>  A() {}
>  String toString() {
>  "A ($name)"
>  }
> }
> class B extends A {
>  String toString() {
>  "B ($name)"
>  }
> }
> def myA = new A(name:"will")
> println myA
> def myB = new B(name:"fred")
> println myB
>  
> run this and get a RT exception 
> A (will)
> Caught: java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V 
> not found
> java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V not 
> found
>  at com.softwood.scripts.B.(TestOfferingAttributeGroup.groovy)
>  at 
> com.softwood.scripts.TestOfferingAttributeGroup.run(TestOfferingAttributeGroup.groovy:28)



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


[jira] [Created] (GROOVY-8760) can't instantiate a class that inherits from base class marked with @MapConstructor

2018-08-21 Thread William Woodman (JIRA)
William Woodman created GROOVY-8760:
---

 Summary: can't instantiate a class that inherits from base class 
marked with @MapConstructor
 Key: GROOVY-8760
 URL: https://issues.apache.org/jira/browse/GROOVY-8760
 Project: Groovy
  Issue Type: Bug
  Components: groovy-runtime
Affects Versions: 2.5.1
 Environment: intellij 2018.1.4, java jdk 8.0_172, groovy 2.5.1
Reporter: William Woodman


basic inheritance where parent is tagged with @MapConstructor then child class 
cant be instantiated

 

example as follows 

 

@MapConstructor
class A {
 String name

 A() {}

 String toString() {
 "A ($name)"
 }
}

class B extends A {
 String toString() {
 "B ($name)"
 }
}

def myA = new A(name:"will")
println myA

def myB = new B(name:"fred")
println myB

 

run this and get a RT exception 

A (will)
Caught: java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V 
not found
java.lang.NoSuchMethodError: com.softwood.scripts.A: method ()V not found
 at com.softwood.scripts.B.(TestOfferingAttributeGroup.groovy)
 at 
com.softwood.scripts.TestOfferingAttributeGroup.run(TestOfferingAttributeGroup.groovy:28)



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