-
-
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
ClassCastException for Lombok 1.6.22 and Gradle 4.8 #1716
Comments
The title is wrong. It is not 1.6.12, it is 1.16.22. What happens with 1.18.0? |
1.18.0 causes the same error with the same stacktrace. |
I have a similar issue on all lombok "@"Data annotation. Example error:
I'm using:
PS: I have |
With:
I receive this error. Reverting to Gradle 4.7 results in proper functionality. |
@pkubowicz @arana198 This started to show up again starting form Gradle 4.6 see #1603 |
… change in Gradle 4.8 and above
looks like Gradle internals changed in 4.8, necessitating some case handling— ☝️ should address that |
Funny, this is the code where the error happens: /**
* This class casts the given filer to a JavacFiler. In case of
* gradle incremental compilation, the delegate Filer of the gradle wrapper is returned.
*/
public JavacFiler getJavacFiler(Filer filer) {
final Class<?> filerSuperClass = filer.getClass().getSuperclass();
if (filerSuperClass.getName().equals("org.gradle.api.internal.tasks.compile.processing.IncrementalFiler")) {
try {
Field field = filerSuperClass.getDeclaredField("delegate");
field.setAccessible(true);
Object delegate = field.get(filer);
return (JavacFiler) delegate;
} catch (final Exception e) {
e.printStackTrace();
processingEnv.getMessager().printMessage(Kind.WARNING,
"Can't get the delegate of the gradle IncrementalFiler. Lombok won't work.");
}
}
return (JavacFiler) filer;
} The code is clearly aware of gradle's Also, that if a reflection exception happens and is caught in the exception handler, a |
Also, the code could test if the |
Can you release this soon? In Gradle 4.9 you cannot use Lombok 1.18.0 or 1.16.22 at all - not even for non-incremental compilation (tested on the same project configuration as in the original bug report). To get Java sources compiled with Gradle 4.9 you need to downgrade to Lombok 1.16.20. |
Gradle 4.9 just hit the Arch Linux repo, so I suspect more people will start suffering from this. |
After upgrade to Gradle 4.9 my project failed to compile. JDK 10.0.1
|
@pkubowicz Unfortunately I cannot downgrade Lombok to 1.16.20 because I use JDK 10 and this version doesn't support it |
To reproduce:
Run
gradle init --type java-library
and modify generated project:build.gradle
Foo.java
Running
gradle build
causes error:Note that the error appears in file not annotated with Lombok annotations (created by
gradle init
).Workaround - either:
The text was updated successfully, but these errors were encountered: