forked from Vertispan/turbine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't emit duplicate
toString
, equals
, and hashCode
methods in …
…records These methods are only emitted if they don't already exist, per JLS 8.10.3. bazelbuild/bazel#17181 PiperOrigin-RevId: 501618070
- Loading branch information
1 parent
8b280f3
commit e6d6f3c
Showing
3 changed files
with
120 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
javatests/com/google/turbine/lower/testdata/record_tostring.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
=== Records.java === | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Target; | ||
import java.util.Objects; | ||
|
||
class Records { | ||
public record A() { | ||
@Override | ||
public String toString() { | ||
return "A"; | ||
} | ||
} | ||
|
||
public record B() { | ||
@Override | ||
public final String toString() { | ||
return "B"; | ||
} | ||
} | ||
|
||
public record C() { | ||
@Override | ||
public final boolean equals(Object o) { | ||
return false; | ||
} | ||
} | ||
|
||
public record D() { | ||
@Override | ||
public final int hashCode() { | ||
return -1; | ||
} | ||
} | ||
} |