groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harry Chan (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (GROOVY-7492) Groovy should allow CompileStatic classes to not implement GroovyObject
Date Thu, 19 Oct 2017 13:49:00 GMT

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

Harry Chan edited comment on GROOVY-7492 at 10/19/17 1:48 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.
Please check: https://github.com/hei1233212000/eclipselink-groovy-enum-not-working

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)
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

> 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)

Mime
View raw message