mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
added new test classes from lombok make code generation for equals and hashCode more lombok like GitOrigin-RevId: 3765b27a943fc03fbab6af9d80e03dbd35f1249e
40 lines
987 B
Java
40 lines
987 B
Java
class EqualsAndHashCodeWithExistingMethods {
|
|
int x;
|
|
public int hashCode() {
|
|
return 42;
|
|
}
|
|
}
|
|
|
|
final class EqualsAndHashCodeWithExistingMethods2 {
|
|
int x;
|
|
public boolean equals(Object other) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
final class EqualsAndHashCodeWithExistingMethods3 extends EqualsAndHashCodeWithExistingMethods {
|
|
int x;
|
|
private boolean canEqual(Object other) {
|
|
return true;
|
|
}
|
|
@Override
|
|
@SuppressWarnings("all")
|
|
public boolean equals(final Object o) {
|
|
if (o == this) return true;
|
|
if (!(o instanceof EqualsAndHashCodeWithExistingMethods3)) return false;
|
|
final EqualsAndHashCodeWithExistingMethods3 other = (EqualsAndHashCodeWithExistingMethods3) o;
|
|
if (!other.canEqual((Object) this)) return false;
|
|
if (!super.equals(o)) return false;
|
|
if (this.x != other.x) return false;
|
|
return true;
|
|
}
|
|
@Override
|
|
@SuppressWarnings("all")
|
|
public int hashCode() {
|
|
final int PRIME = 59;
|
|
int result = super.hashCode();
|
|
result = result * PRIME + this.x;
|
|
return result;
|
|
}
|
|
}
|