Skip to content
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

[BUG] 1.18.8 regression: ClassCastException in Eclipse #2156

Closed
Maia-Everett opened this issue Jun 18, 2019 · 11 comments
Closed

[BUG] 1.18.8 regression: ClassCastException in Eclipse #2156

Maia-Everett opened this issue Jun 18, 2019 · 11 comments
Labels
parked Without further feedback this bug cannot be processed. If no feedback is provided, we close these.

Comments

@Maia-Everett
Copy link

Maia-Everett commented Jun 18, 2019

Describe the bug
When building the project in Eclipse 2019-03, the following exception occurs:

Errors occurred during the build. Errors running builder 'Java Builder' on project 'project_name'. class org.eclipse.jdt.internal.compiler.lookup.MethodBinding cannot be cast to class org.eclipse.jdt.internal.compiler.lookup.FieldBinding (org.eclipse.jdt.internal.compiler.lookup.MethodBinding and org.eclipse.jdt.internal.compiler.lookup.FieldBinding are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @3566d527)

To Reproduce
I'm not sure what specific source code triggers this bug — it's a large project. I haven't been able to isolate the code that breaks Lombok.

However, it occurs in Eclipse 2019-03 running under Java 11 with Lombok 1.18.8. Neither 1.18.4 nor 1.18.6 are affected.

The version of Lombok used as the project build dependency does not seem to matter. The project currently uses 1.18.4.

Expected behavior
The project should build normally, as it does with 1.18.4 and 1.18.6.

Version info (please complete the following information):

  • Lombok 1.18.8
  • Eclipse: Version: 2019-03 (4.11.0) Build id: 20190314-1200
@ldwqh0
Copy link

ldwqh0 commented Jun 24, 2019

Yes,I found the same problem too !

@ehealthexperts-rk
Copy link

Same issue in Eclipse 2019-06 (4.12.0; ID 20190614-1200) after updating from lombok 1.18.6 to 1.18.8.

Also found this related issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=547244

@ehealthexperts-rk
Copy link

I tried to make a sample to reproduce the issue but failed. Once I removed other non-lombok classes from the project, or copied the class that presumably failed or removed class members step by step, or removed the lombok annotations then eclipse could compile the workspace again (I cleaned the project between all steps). The only combination that fails is the project as is but this I cannot share unfortunately.

@Maia-Everett
Copy link
Author

I tried to make a sample to reproduce the issue but failed. Once I removed other non-lombok classes from the project, or copied the class that presumably failed or removed class members step by step, or removed the lombok annotations then eclipse could compile the workspace again (I cleaned the project between all steps). The only combination that fails is the project as is but this I cannot share unfortunately.

I had the same problem. I tried copying the lombok-enabled class listed in the error message into a new project, but its compilation then succeeded.

@dnovak1
Copy link

dnovak1 commented Jun 26, 2019

I had the same problem, was able to fix it by switching to lombok-1.18.2

@projectlombok projectlombok deleted a comment from PratheepV Jul 25, 2019
@rspilker
Copy link
Collaborator

rspilker commented Jul 25, 2019

Can someone please provide a stacktrace?

Oh, and instead of adding a comment with just "+1", please use the +:smile: on the right hand top of the comment you're +1-ing

@rspilker rspilker added the parked Without further feedback this bug cannot be processed. If no feedback is provided, we close these. label Jul 25, 2019
@bostsnow
Copy link

bostsnow commented Aug 15, 2019

Am facing same issue::
Eclipse IDE for Enterprise Java Developers.
Version: 2019-03 (4.11.0)
Build id: 20190314-1200
lombok-1.18.4

Markers
Description Resource Path Location Type
Internal compiler error: java.lang.ClassCastException ABC.java /com/test line 0 Java Problem

@rspilker
Copy link
Collaborator

A slightly different message:

Internal compiler error: java.lang.ClassCastException: class org.eclipse.jdt.internal.compiler.lookup.MethodBinding cannot be cast to class org.eclipse.jdt.internal.compiler.lookup.FieldBinding (org.eclipse.jdt.internal.compiler.lookup.MethodBinding and org.eclipse.jdt.internal.compiler.lookup.FieldBinding are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @2433bcd4) at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveAnnotations(ASTNode.java:822)

@rspilker
Copy link
Collaborator

Okay, we've found a probable cause.

We've found a problem when annotations we're copied to the setter. Since v1.18.8 we have built-in support for handling @JsonProperty and @JsonValue. But it is also possibly to configure your own list of annotations that should be copied to the setter.

@rspilker
Copy link
Collaborator

This one was a bit harder to find because it only occurs if the annotation is copied from the field to the method after it has already been resolved. Presumably, this only happens under certain circumstances.

In my companies we have 30+ compilation units that generate a setter on @JsonProperty, but only one gave the CCE.

@antoinevulcain
Copy link

antoinevulcain commented Mar 18, 2020

For all developer out there having same issue:

@setter gives this issue with eclipse replace it with @data and it fixes the problems for me thanks @rspilker for pointing me to the right direction with your comment about @settter!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parked Without further feedback this bug cannot be processed. If no feedback is provided, we close these.
Projects
None yet
Development

No branches or pull requests

7 participants