[jira] [Commented] (GROOVY-8356) Use javax.validation 2.0 API results in GroovyBugError

2017-10-17 Thread Paul King (JIRA)

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

Paul King commented on GROOVY-8356:
---

I haven't looked into the error yet but TYPE_USE is defined in this file:
https://github.com/apache/groovy/blob/GROOVY_2_5_X/src/main/org/codehaus/groovy/vmplugin/v8/Java8.java

> Use javax.validation 2.0 API results in GroovyBugError
> --
>
> Key: GROOVY-8356
> URL: https://issues.apache.org/jira/browse/GROOVY-8356
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.4.12, 2.5.0-beta-2
>Reporter: Graeme Rocher
>
> If you use the javax.validation 2.0 API using certain annotations results in:
> {code}
> BUG! exception in phase 'class generation' in source unit 
> '.../validation/ValidatedSpec.groovy' unsupported Target TYPE_USE
> {code}
> Example code:
> {code}
> class Foo {
> String testMe(@Pattern(regexp = "\\d+") String number) {
> return number
> }
> }
> {code}
> Seems 
> https://github.com/apache/groovy/blob/GROOVY_2_5_X/src/main/org/codehaus/groovy/vmplugin/v5/Java5.java#L327
>  needs updating for Java 8 `TYPE_USE`



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-1705) stop running GroovyScriptEngine

2017-10-17 Thread Jochen Theodorou (JIRA)

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

Jochen Theodorou commented on GROOVY-1705:
--

See http://docs.groovy-lang.org/next/html/documentation/#_safer_scripting for 
transforms that do give you the ability to interrupt scripts. Even though the 
original message is 5 years old, the idea of adding the transform to the 
configuration used by the script engine is still the right now. See also 
http://mrhaki.blogspot.de/2011/06/groovy-goodness-add-asttransformations.html 
for how to use the transform

> stop running GroovyScriptEngine
> ---
>
> Key: GROOVY-1705
> URL: https://issues.apache.org/jira/browse/GROOVY-1705
> Project: Groovy
>  Issue Type: Improvement
>  Components: GroovyScriptEngine
>Affects Versions: 1.0-JSR-6
> Environment: OS:WindowsXp
>Reporter: Rajendra Kothari
>Assignee: Jochen Theodorou
> Fix For: 1.8.0
>
>
> Once GroovyScriptEngine starts executing a script it does stop untill it 
> finish whole script. There should be mechanism to stop a running script.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-1705) stop running GroovyScriptEngine

2017-10-17 Thread Evgeni Kumanov (JIRA)

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

Evgeni Kumanov commented on GROOVY-1705:


Jochen Theodorou, can you elaborate more on that solution? I'm not familiar 
with groovy, I am a Java developer and currently trying to fix something in an 
existing project: being able to stop a running groovy script execution. Is 
there an easy Java solution? I see you suggest a compiler configuration but I 
don't know what that means in details. Can you give me an example? Also, I see 
this issue has been fixed but I can't see how and what's the solution for 
stopping scripts. What I seek is a very simple solution for stopping script 
execution from Java without having to rely on groovy transformations (if I 
understand correctly what that means, namely adding some groovy stuff to the 
scripts that will wrap them in a stoppable logic?).

> stop running GroovyScriptEngine
> ---
>
> Key: GROOVY-1705
> URL: https://issues.apache.org/jira/browse/GROOVY-1705
> Project: Groovy
>  Issue Type: Improvement
>  Components: GroovyScriptEngine
>Affects Versions: 1.0-JSR-6
> Environment: OS:WindowsXp
>Reporter: Rajendra Kothari
>Assignee: Jochen Theodorou
> Fix For: 1.8.0
>
>
> Once GroovyScriptEngine starts executing a script it does stop untill it 
> finish whole script. There should be mechanism to stop a running script.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-8355) Instanceof inference does not work on field assigning

2017-10-17 Thread Shil Sinha (JIRA)

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

Shil Sinha commented on GROOVY-8355:


This shouldn't be expected to work since the type checker can't make any 
guarantees about concurrent usage of Foo objects e.g. another thread could set 
the 'str' field to a non-string object prior to the toUpperCase call.

> Instanceof inference does not work on field assigning
> -
>
> Key: GROOVY-8355
> URL: https://issues.apache.org/jira/browse/GROOVY-8355
> Project: Groovy
>  Issue Type: Bug
>  Components: Static compilation, Static Type Checker
>Reporter: Alexey Afanasiev
>
> If instanceof inference works as expected 
> [https://issues.apache.org/jira/browse/GROOVY-8293] So probably this code 
> should work to:
> {code}
> import groovy.transform.CompileStatic
> @CompileStatic
> class Foo {
> Object str = new Object()
> def bar() {
> str = "str"
> str.toUpperCase() // here compile error
> }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (GROOVY-7492) Groovy should allow CompileStatic classes to not implement GroovyObject

2017-10-17 Thread Harry Chan (JIRA)

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

Harry Chan edited comment on GROOVY-7492 at 10/17/17 3:50 PM:
--

I just encountered 2 cases which will make the @POJO be very useful:
* Using [Yasson|https://github.com/eclipse/yasson]/JSON-B with Groovy. Yasson 
will throw exception when converting a POGO into JSON because of the 
[MetaClassImpl.getAttribute()|http://docs.groovy-lang.org/latest/html/api/groovy/lang/MetaClassImpl.html#getAttribute-java.lang.Class-java.lang.Object-java.lang.String-boolean-]
 is NOT a pure getter (getter should have NO argument)
Please check :https://github.com/hei1233212000/yasson-groovy-not-working
* Using the Eclipselink with Groovy. Eclipselink will failed to convert the 
enum (by using the JPA converter to convert the enum to String value) defined 
in Groovy file where Eclipselink is going to convert the String into 
GroovyObject but failed.

So, in my opinion, this feature would make Groovy more active in JEE world


was (Author: harry.chan):
I just encountered 2 cases which will make the @POJO be very useful:
* Using [Yasson|https://github.com/eclipse/yasson]/JSON-B with Groovy. Yasson 
will throw exception when converting a POGO into JSON because of the 
[MetaClassImpl.getAttribute()|http://docs.groovy-lang.org/latest/html/api/groovy/lang/MetaClassImpl.html#getAttribute-java.lang.Class-java.lang.Object-java.lang.String-boolean-]
 is NOT a pure getter (getter should have NO argument)
* Using the Eclipselink with Groovy. Eclipselink will failed to convert the 
enum (by using the JPA converter to convert the enum to String value) defined 
in Groovy file where Eclipselink is going to convert the String into 
GroovyObject but failed.

So, in my opinion, this feature would make Groovy more active in JEE world

> Groovy should allow CompileStatic classes to not implement GroovyObject
> ---
>
> Key: GROOVY-7492
> URL: https://issues.apache.org/jira/browse/GROOVY-7492
> Project: Groovy
>  Issue Type: New Feature
>Reporter: Paul King
>  Labels: experimental
>
> Groovy's powerful AST transformation capabilities are extremely useful even 
> in mostly Java projects but the fact that generated classes implement 
> GroovyObject means that Groovy must be on the classpath when using any of the 
> generated artifacts. This proposed new feature allows an opt-out {{@POJO}} 
> marker interface which still applies Groovy's AST transforms but then leaves 
> them in a much more Java-like state. The mechanism currently is only enabled 
> when using @CompileStatic since it produces Java-like code. This opens up 
> some of Groovy's powerful transforms to the wider Java community. Groovy can 
> effectively be used as a Lombok-style pre-processor for some Java classes. 
> Note that this is still an experimental feature - it isn't guaranteed at this 
> stage to always produce code which is free from any Groovy jar dependency. As 
> an example, @Immutable for instance might require the Groovy jar. We might 
> also consider producing some trivial size jar if we can't remove all usages 
> of Groovy code.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-8356) Use javax.validation 2.0 API results in GroovyBugError

2017-10-17 Thread Graeme Rocher (JIRA)

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

Graeme Rocher commented on GROOVY-8356:
---

I would say this issue is pretty serious, as it makes `javax.validation` 2.0 
and above unusable in Groovy as every annotation in `javax.validation` has an 
inner annotation defined as:

{code}
/**
 * Defines several {@link Digits} annotations on the same element.
 *
 * @see Digits
 */
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, 
TYPE_USE })
@Retention(RUNTIME)
@Documented
@interface List {

Digits[] value();
}
{code}

The `TYPE_USE` definition here is causing the error

> Use javax.validation 2.0 API results in GroovyBugError
> --
>
> Key: GROOVY-8356
> URL: https://issues.apache.org/jira/browse/GROOVY-8356
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 2.4.12, 2.5.0-beta-2
>Reporter: Graeme Rocher
>
> If you use the javax.validation 2.0 API using certain annotations results in:
> {code}
> BUG! exception in phase 'class generation' in source unit 
> '.../validation/ValidatedSpec.groovy' unsupported Target TYPE_USE
> {code}
> Example code:
> {code}
> class Foo {
> String testMe(@Pattern(regexp = "\\d+") String number) {
> return number
> }
> }
> {code}
> Seems 
> https://github.com/apache/groovy/blob/GROOVY_2_5_X/src/main/org/codehaus/groovy/vmplugin/v5/Java5.java#L327
>  needs updating for Java 8 `TYPE_USE`



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (GROOVY-8356) Use javax.validation 2.0 API results in GroovyBugError

2017-10-17 Thread Graeme Rocher (JIRA)
Graeme Rocher created GROOVY-8356:
-

 Summary: Use javax.validation 2.0 API results in GroovyBugError
 Key: GROOVY-8356
 URL: https://issues.apache.org/jira/browse/GROOVY-8356
 Project: Groovy
  Issue Type: Bug
Affects Versions: 2.5.0-beta-2, 2.4.12
Reporter: Graeme Rocher


If you use the javax.validation 2.0 API using certain annotations results in:

{code}
BUG! exception in phase 'class generation' in source unit 
'.../validation/ValidatedSpec.groovy' unsupported Target TYPE_USE
{code}

Example code:

{code}
class Foo {
String testMe(@Pattern(regexp = "\\d+") String number) {
return number
}
}
{code}

Seems 
https://github.com/apache/groovy/blob/GROOVY_2_5_X/src/main/org/codehaus/groovy/vmplugin/v5/Java5.java#L327
 needs updating for Java 8 `TYPE_USE`



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-7492) Groovy should allow CompileStatic classes to not implement GroovyObject

2017-10-17 Thread Harry Chan (JIRA)

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

Harry Chan commented on GROOVY-7492:


I just encountered 2 cases which will make the @POJO be very useful:
* Using [Yasson|https://github.com/eclipse/yasson]/JSON-B with Groovy. Yasson 
will throw exception when converting a POGO into JSON because of the 
[MetaClassImpl.getAttribute()|http://docs.groovy-lang.org/latest/html/api/groovy/lang/MetaClassImpl.html#getAttribute-java.lang.Class-java.lang.Object-java.lang.String-boolean-]
 is NOT a pure getter (getter should have NO argument)
* Using the Eclipselink with Groovy. Eclipselink will failed to convert the 
enum (by using the JPA converter to convert the enum to String value) defined 
in Groovy file where Eclipselink is going to convert the String into 
GroovyObject but failed.

So, in my opinion, this feature would make Groovy more active in JEE world

> Groovy should allow CompileStatic classes to not implement GroovyObject
> ---
>
> Key: GROOVY-7492
> URL: https://issues.apache.org/jira/browse/GROOVY-7492
> Project: Groovy
>  Issue Type: New Feature
>Reporter: Paul King
>  Labels: experimental
>
> Groovy's powerful AST transformation capabilities are extremely useful even 
> in mostly Java projects but the fact that generated classes implement 
> GroovyObject means that Groovy must be on the classpath when using any of the 
> generated artifacts. This proposed new feature allows an opt-out {{@POJO}} 
> marker interface which still applies Groovy's AST transforms but then leaves 
> them in a much more Java-like state. The mechanism currently is only enabled 
> when using @CompileStatic since it produces Java-like code. This opens up 
> some of Groovy's powerful transforms to the wider Java community. Groovy can 
> effectively be used as a Lombok-style pre-processor for some Java classes. 
> Note that this is still an experimental feature - it isn't guaranteed at this 
> stage to always produce code which is free from any Groovy jar dependency. As 
> an example, @Immutable for instance might require the Groovy jar. We might 
> also consider producing some trivial size jar if we can't remove all usages 
> of Groovy code.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Assigned] (GROOVY-8343) Issue implementing Java interface

2017-10-17 Thread Paul King (JIRA)

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

Paul King reassigned GROOVY-8343:
-

Assignee: Paul King

> Issue implementing Java interface
> -
>
> Key: GROOVY-8343
> URL: https://issues.apache.org/jira/browse/GROOVY-8343
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.5.0-beta-2
>Reporter: James Kleeh
>Assignee: Paul King
>
> Groovy compiler fails with a message saying a method is not implemented in 
> the Groovy class that exists in the Java interface.
> The error can be seen here: 
> https://travis-ci.org/grails/grails-core/builds/284244075
> The file in question does in fact implement the method. 
> https://github.com/grails/grails-core/blob/spring_5/grails-bootstrap/src/main/groovy/org/grails/io/support/ByteArrayResource.groovy#L64



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-8343) Issue implementing Java interface

2017-10-17 Thread Paul King (JIRA)

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

Paul King commented on GROOVY-8343:
---

Workaround is to fully qualify the return type, e.g.:
{code}
org.grails.io.support.Resource
{code}
You obviously shouldn't have to do that. I can think of several ways to fix 
this but I will have to try some things out first.

> Issue implementing Java interface
> -
>
> Key: GROOVY-8343
> URL: https://issues.apache.org/jira/browse/GROOVY-8343
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.5.0-beta-2
>Reporter: James Kleeh
>
> Groovy compiler fails with a message saying a method is not implemented in 
> the Groovy class that exists in the Java interface.
> The error can be seen here: 
> https://travis-ci.org/grails/grails-core/builds/284244075
> The file in question does in fact implement the method. 
> https://github.com/grails/grails-core/blob/spring_5/grails-bootstrap/src/main/groovy/org/grails/io/support/ByteArrayResource.groovy#L64



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)