-
-
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
onlyExplicitlyIncluded does not work neither JDK 8 nor JDK 9 (might be Gradle issue) #1709
Comments
The same problem happens in Intellij Idea(Not only gradle). |
So just to confirm, this didn't make it in time for 1.18? I don't get an error, but setting onlyExplicitlyIncluded to true has no effect - the equals and hashcode methods are still using all fields (when I run Delombok in IntelliJ). EDIT: Actually, even manually marking them with @EqualsAndHashCode.Exclude still includes the fields when I DeLombok. |
Delombok in IntelliJ use a lombok-intellij-plugin and it always worked horrible (not saying that at least it uses older version of lombok or even just some internal considerations which doesn't know new stuff). Use the 'java -jar lombok.jar..' It will produce the proper result. |
That makes sense. Though if the IntelliJ plugin has this problem, does it
also mean that this will behave the same way when I Run/Debug from within
IntelliJ? If so, then I will have to avoid these particular things until
the plugin itself updated/fixed...
…On Thu., 5 Jul. 2018, 10:00 soberich, ***@***.***> wrote:
Delombok in IntelliJ use a lombok-intellij-plugin and it always worked
horrible (not saying that at least it uses older version of lombok which
doesn't know new stuff). Use the 'java -jar lombok.jar..' It will produce
the proper result.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1709 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB_uhLs7TBSYA4E0V_Th5ddB4AZdil02ks5uDVcngaJpZM4UT-cW>
.
|
For those who Googled this up: It is fixed in 1.18.4 . |
I still see this problem in 1.18.6 I slightly rewrote the test from above
Output: Should be true as the id should be the only field included. "onlyExplicitlyIncluded" is completely disregarded. It also doesn't matter if the field is annotated with "@EqualsAndHashCode.Exclude", the field is always included. This is a very problematic bug causing hard to track down problems in production when .equals() shows unexpected behaviour. Just noticed it by chance having a detached JPA entity where equals() throwed an exception trying to walk an excluded, lazy-loaded relation field in order to calculate the hash. So please add a test case or remove the option altogether if doesn't work reliably. |
@sierracc This is correct ) (AFAIK) |
@soberich: Thanks, the I missed posting the minor version. Update: I also checked that my Eclipse Lombok plugin isn't culprit - it was old (1.16.20), but updating to the current one (1.18.6) and a restart didn't change anything about the problem. |
Cannot reproduce. Tried in both eclipse2019.03 and javac12 with 1.18.7 (current master branch): package test;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Value;
@Value
@Builder
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class Test {
@EqualsAndHashCode.Include String x;
String y;
public static void main(String[] args) {
System.out.println(new Test("a", "b").equals(new Test("a", "c")));
System.out.println(new Test("a", "b").equals(new Test("b", "b")));
}
} |
I am using Lombok 1.18.6 in a maven multi module project with JDK 8.
can not compile: Workaround: It also works when i provide the lombok dependency in the parent pom.xml |
I'm confused: What other option is there beside a) putting Lombok in the module POM, and b) putting it in the parent POM? |
i had this case which lead to the compile error (" can't translate a class...")
module_a was using (onlyExplicitlyIncluded = true) |
That's a setup which is not supported. Lombok must be added as |
A simple 1 file of java code with 1.16.22
causes
stacktrace
The text was updated successfully, but these errors were encountered: