-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onX bug with JDK8 #778
Comments
👤 carlos@contaazul.com 🕗 Oct 15, 2014 at 19:18 UTC What steps will reproduce the problem?
@ 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?>. What is the expected output? What do you see instead? Build success. What version of the product are you using? On what operating system? 1.12.6 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 __ 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?>. 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 |
Any chance to get this fixed despite onX experimental status ? |
There seems to be a problem with the onX feature from lombok in JDK8. See projectlombok/lombok#778.
Same here with lombok 1.16.8 and 1.8.0_20 |
I've just run into the same problem. The following class declaration: @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired(required = false)))
public class MagicSpringBean {
// some fields
} fails the build with:
This one doesn't: @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class MagicSpringBean {
// some fields
} Lombok version: 1.16.2 |
maven 3.3.9, maven-compiler-plugin 3.6.1, Lombok 1.16.14, JDK 1.8.0_91 same issue |
Did some research on this. The following holds: Lombok needs to be invoked by javac, or all bets are off. If we're never called we can't fix anything. So, where I say 'does not work', I mean: We don't ever get invoked, so, there's simply nothing we can do about it. Assume the following annotation:
Given that
That's nice and clean but doesn't work on 7/8. It's how onX used to work a long time ago. The following works fine on 7, but fails on 8 with error ('duplicate <any?>'). This means we cannot fix this issue; it's a bug in javac (but note that snippet 2b, 2c, and 2d do work; it fails only if you have a named param:
The following works fine on 8 but fails in 7:
Currently, snippet2 is what we suggest you do, and snippet1 technically still gets processed by lombok in case you somehow are still stuck on javac6. We propose to also make snippet3 be processed by lombok. We'll make up names. Note that this solution is sucky but it's the best we can do. To wit:
|
@rzwitserloot I have played around it a little and I have created a new issue about it - #1317. Looks like it works with maven 3 and Java 8 with named annotation parameters. Problem appeared when I was trying to use maven-compiler-plugin with Java 8. You can look at description of newly created issue. Thank you! |
Migrated from Google Code (issue 743)
The text was updated successfully, but these errors were encountered: