onX bug with JDK8 #778

lombokissues opened this Issue Jul 14, 2015 · 10 comments


None yet

6 participants


Migrated from Google Code (issue 743)


๐Ÿ‘ค carlos@contaazul.com ย  ๐Ÿ•— Oct 15, 2014 at 19:18 UTC

What steps will reproduce the problem?

  1. When compiling code like this:

@ Getter(onMethod = @ __(@ XmlElement(name = "xmlName")))

the build breaks with the following error:

[ERROR] diagnostic: /home/carlos/Code/project/src/main/java/packages/MyClass.java:15: error: duplicate element '<any?>' in annotation @<any?>.
@ Getter(onMethod = @ __(@ XmlElement(name = "xmlName")))
[ERROR] error on execute: error during compilation

What is the expected output? What do you see instead?

Build success.

What version of the product are you using? On what operating system?


Please provide any additional information below.


๐Ÿ‘ค carlos@contaazul.com ย  ๐Ÿ•— Oct 15, 2014 at 19:24 UTC

I can confirm that it also happens in version 1.14.8.


๐Ÿ‘ค steven.dick.1972 ย  ๐Ÿ•— Jun 10, 2015 at 07:26 UTC

We're trying to upgrade a project to building with Java 8 and get this problem too.

Works fine in Eclipse Luna, but fails with our Gradle 2.1 build.

I've tried with Lombok 1.16.2 and 1.16.4

Compiling with Oracle JDK 1.8.0_45 with source and target compatibility set to 1.7 in our Gradle build works, but setting source and target compatibility set to 1.8 and we get:

symbol: class __
location: class IVValMTDTransaction
C:\Users\sdick\git\hedgesphere-mt\HSMtApi\src\main\java\ch\hedgesphere\transaction\domain\InvestingPosUIVTrx.java:162: error: cannot find symbol
@ Getter(onMethod=@ __({@ XmlElement(name = "uInvestable")}))

As well as the same error as that originally reported:

C:\Users\sdick\git\hedgesphere-mt\HSMtApi\src\main\java\ch\hedgesphere\transaction\domain\InvestingPosUIVTrx.java:162: error: duplicate element '<any?>' in annotation @<any?>.
@ Getter(onMethod=@ __({@ XmlElement(name = "uInvestable")}))

I notice the problem is around the same JAXB annoation, @ XmlElement.

Googling suggests the @<any?> error is related to applying the same annotation multiple times to the same element. That doesn't look like the case here.


End of migration


hmmm, 1.16.4 / 1.8.0_45 works in eclipse luna, but not in maven 3.3.3


confirmed with 1.8.0_60

LeRiton commented Mar 1, 2016

Any chance to get this fixed despite onX experimental status ?

@JLengenfeld JLengenfeld added a commit to JLengenfeld/deckcompare that referenced this issue Mar 22, 2016
@JLengenfeld JLengenfeld Write getters with JAX Annotations by hand
There seems to be a problem with the onX feature from lombok in JDK8. See rzwitserloot/lombok#778.

Same here with lombok 1.16.8 and 1.8.0_20

maseev commented Jan 28, 2017 edited

I've just run into the same problem. The following class declaration:

@RequiredArgsConstructor(onConstructor = @__(@Autowired(required = false)))
public class MagicSpringBean {
  // some fields

fails the build with:

duplicate element '<any?>' in annotation @<any?>.

This one doesn't:

@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class MagicSpringBean {
  // some fields

Lombok version: 1.16.2
JDK version: 1.8.0_112

zayats103 commented Feb 15, 2017 edited

maven 3.3.9, maven-compiler-plugin 3.6.1, Lombok 1.16.14, JDK 1.8.0_91 same issue
It seems that maven-compiler-plugin can not handle @ Getter(onMethod = @ __(@ XmlElement(name = "xmlName"))) annotation with field name declaration. In this case some annotations like @Annotation(field = "value") will not work, but @Annotation("value") will work fine (if Annotation has only value field and we don't need to specify the name of the field).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment