mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 04:16:19 +00:00
[fixes #1628] Lombok now marks the result field used in the generated hashCode method as final if it isn’t modified. This doesn’t change its behavior whatsoever, but some linters and especially eclipse save actions (specifically: ‘mark local variables final if possible’) cause issues when they try to mess with generated code. Of course, now any save action with ‘remove useless modifiers’ would cause an issue but those don’t (yet…) exist.
This commit is contained in:
1 parent
a685d0828c
commit
db19327cb4
25 files changed
+139
-32
No files matched your search
@@ -0,0 +1,46 @@
|
||||
@lombok.EqualsAndHashCode class EqualsAndHashCodeEmpty {
|
||||
EqualsAndHashCodeEmpty() {
|
||||
super();
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
|
||||
if ((o == this))
|
||||
return true;
|
||||
if ((! (o instanceof EqualsAndHashCodeEmpty)))
|
||||
return false;
|
||||
final EqualsAndHashCodeEmpty other = (EqualsAndHashCodeEmpty) o;
|
||||
if ((! other.canEqual((java.lang.Object) this)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
|
||||
return (other instanceof EqualsAndHashCodeEmpty);
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
|
||||
final int result = 1;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@lombok.EqualsAndHashCode(callSuper = true) class EqualsAndHashCodeEmptyWithSuper extends EqualsAndHashCodeEmpty {
|
||||
EqualsAndHashCodeEmptyWithSuper() {
|
||||
super();
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
|
||||
if ((o == this))
|
||||
return true;
|
||||
if ((! (o instanceof EqualsAndHashCodeEmptyWithSuper)))
|
||||
return false;
|
||||
final EqualsAndHashCodeEmptyWithSuper other = (EqualsAndHashCodeEmptyWithSuper) o;
|
||||
if ((! other.canEqual((java.lang.Object) this)))
|
||||
return false;
|
||||
if ((! super.equals(o)))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
|
||||
return (other instanceof EqualsAndHashCodeEmptyWithSuper);
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
|
||||
final int result = super.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user