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

Lombok 1.16.22 @EqualsHashCode uses transient field #1744

Closed
mucahitkurt opened this issue Jun 26, 2018 · 1 comment
Closed

Lombok 1.16.22 @EqualsHashCode uses transient field #1744

mucahitkurt opened this issue Jun 26, 2018 · 1 comment

Comments

@mucahitkurt
Copy link

Hello,
Lombok 1.16.22 uses both transient and non-transient fields to produce equals and hashCode methods.

I use IntelliJ 2018.1 with lombok plugin.

@Getter
@EqualsAndHashCode
public class SomeClass {

    private transient String someTransientField;
    private String someNonTransientField;

}

Lombok 1.16.22 produces;

public int hashCode() {
        int PRIME = true;
        int result = 1;
        Object $someTransientField = this.getSomeTransientField();
        int result = result * 59 + ($someTransientField == null ? 43 : $someTransientField.hashCode());
        Object $someNonTransientField = this.getSomeNonTransientField();
        result = result * 59 + ($someNonTransientField == null ? 43 : $someNonTransientField.hashCode());
        return result;
    }

Lombok 1.16.20 produces;

public int hashCode() {
        int PRIME = true;
        int result = 1;
        Object $someNonTransientField = this.getSomeNonTransientField();
        int result = result * 59 + ($someNonTransientField == null ? 43 : $someNonTransientField.hashCode());
        return result;
    }
@mucahitkurt mucahitkurt changed the title Lombok 1.16.22 @EqualsHashCode use transient field Lombok 1.16.22 @EqualsHashCode uses transient field Jun 26, 2018
@janrieke
Copy link
Contributor

Looks like a duplicate of #1724, which is already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants