mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-15 08:17:18 +00:00
[fixes #2838] Handle anonymous classes properly
Generated qualified names (e.g. Outer.Inner) now stop at anonymous classes instead of adding an empty part. All handlers that add static fields/methods/types now add error messages instead of generating invalid code.
This commit is contained in:
1 parent
6758714ed5
commit
60f575496b
75 files changed
+1103
-28
No files matched your search
@@ -0,0 +1,46 @@
|
||||
public class ValueInAnonymousClass {
|
||||
Object annonymous = new Object() {
|
||||
|
||||
final class Inner {
|
||||
private final String string;
|
||||
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public Inner(final String string) {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public String getString() {
|
||||
return this.string;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public boolean equals(final java.lang.Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof Inner)) return false;
|
||||
final Inner other = (Inner) o;
|
||||
final java.lang.Object this$string = this.getString();
|
||||
final java.lang.Object other$string = other.getString();
|
||||
if (this$string == null ? other$string != null : !this$string.equals(other$string)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
final java.lang.Object $string = this.getString();
|
||||
result = result * PRIME + ($string == null ? 43 : $string.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public java.lang.String toString() {
|
||||
return "Inner(string=" + this.getString() + ")";
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user