You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2024/05/29 13:46:00 UTC
[jira] [Commented] (GROOVY-11388) Does Groovy support Java Anntotation Processors?
[ https://issues.apache.org/jira/browse/GROOVY-11388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17850374#comment-17850374 ]
Paul King commented on GROOVY-11388:
------------------------------------
In mixed Java/Groovy codebases, Annotation processors can be used on the Java files but not on the Groovy files. In general, Groovy's AST transforms are more powerful that annotation processors. Most Lombok annotations have Groovy transform equivalents. Certainly, if you think there is some commonly used Lombok feature that you don't believe has an equivalent in Groovy, let us know.
It may be possible to have some annotation processor integration with Groovy but it wouldn't be straight forward - except perhaps for some special edge cases like perhaps Java stub files. We'd certainly be keen if anyone has time to look into this further.
> Does Groovy support Java Anntotation Processors?
> -------------------------------------------------
>
> Key: GROOVY-11388
> URL: https://issues.apache.org/jira/browse/GROOVY-11388
> Project: Groovy
> Issue Type: Question
> Reporter: Christoph Henrici
> Priority: Major
>
> My question is simple : Does Groovy support Annotation Processors, like Mapstruct , Lombok or even custom Processors : [https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html] ?
> Something like:
>
> {code:java}
> import lombok.Builder
> import lombok.NonNull
> import lombok.Value
> @Value
> @Builder
> class TestE {
> …
> {code}
>
> Please, no opionated answers, just facts and fact based explanations. There are many confuseing, strongly subjective and optinated posts in the web (Stacktrace and such, and even here), which trend towards no, you don‘t need it, i don't recommend, Lombok is a hack etc etc, but nothing really conclusive, substantial and objective.
> My Testcase does seems to indicate that at least the Lombok Annotation Processor is not supported , see : [https://github.com/chhex/groovylombok/tree/main]
> But it also may well be, that i am missing something in the Gradle Build.
> The enviroment i tested in:
> {code:java}
> $ ./gradlew -versionGradle 7.3.3Build time: 2021-12-22 12:37:54 UTC
> Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71Kotlin: 1.5.31
> Groovy: 3.0.9
> Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
> JVM: 17.0.3 (Eclipse Adoptium 17.0.3+7)
> OS: Mac OS X 13.2.1 aarch64{code}
>
> Where the Groovy Version used by gradle is the same for the application.
> If this is a redundant post, sorry! I really like Groovy and am using it frequently, it would be just great to have good understanding of it‘s limitations, if that is the case.
> Best thanks for any help.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)