mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-16 08:15:19 +00:00
[i660] canEqual is now protected instead of public.
Also fixed the total lack of canEqual in the usage examples.
This commit is contained in:
1 parent
db71f39c27
commit
4d24542dac
42 files changed
+160
-81
No files matched your search
+20
-2
@@ -17,7 +17,7 @@ class EqualsAndHashCodeWithSomeExistingMethods {
|
||||
}
|
||||
class EqualsAndHashCodeWithSomeExistingMethods2 {
|
||||
int x;
|
||||
public boolean canEqual(Object other) {
|
||||
protected boolean canEqual(Object other) {
|
||||
return false;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
@@ -25,6 +25,24 @@ class EqualsAndHashCodeWithSomeExistingMethods2 {
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public boolean equals(final java.lang.Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof EqualsAndHashCodeWithSomeExistingMethods2)) return false;
|
||||
final EqualsAndHashCodeWithSomeExistingMethods2 other = (EqualsAndHashCodeWithSomeExistingMethods2)o;
|
||||
if (!other.canEqual((java.lang.Object)this)) return false;
|
||||
if (this.x != other.x) return false;
|
||||
return true;
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
result = result * PRIME + this.x;
|
||||
return result;
|
||||
}
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public java.lang.String toString() {
|
||||
return "EqualsAndHashCodeWithSomeExistingMethods2(x=" + this.x + ")";
|
||||
}
|
||||
@@ -63,7 +81,7 @@ class EqualsAndHashCodeWithNoExistingMethods {
|
||||
return true;
|
||||
}
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public boolean canEqual(final java.lang.Object other) {
|
||||
protected boolean canEqual(final java.lang.Object other) {
|
||||
return other instanceof EqualsAndHashCodeWithNoExistingMethods;
|
||||
}
|
||||
@java.lang.Override
|
||||
|
||||
Reference in new issue
Block a user