diff options
author | cushon <cushon@google.com> | 2018-10-21 15:10:51 -0700 |
---|---|---|
committer | Liam Miller-Cushon <cushon@google.com> | 2018-10-22 12:48:53 -0700 |
commit | 7867013530435dd5718b0b80637fa3cda7361c03 (patch) | |
tree | 9c3d63dbebbbeba4fc63f078a7008026c550629f /java/com/google/turbine/binder/bound/EnumConstantValue.java | |
parent | db60838c741ffebfe7141071da243beb901384e4 (diff) | |
download | turbine-7867013530435dd5718b0b80637fa3cda7361c03.tar.gz |
Implement equals, hashCode, and toString for `Const` model objects
MOE_MIGRATED_REVID=218089802
Diffstat (limited to 'java/com/google/turbine/binder/bound/EnumConstantValue.java')
-rw-r--r-- | java/com/google/turbine/binder/bound/EnumConstantValue.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/java/com/google/turbine/binder/bound/EnumConstantValue.java b/java/com/google/turbine/binder/bound/EnumConstantValue.java index 07bb29c..4083ae3 100644 --- a/java/com/google/turbine/binder/bound/EnumConstantValue.java +++ b/java/com/google/turbine/binder/bound/EnumConstantValue.java @@ -36,4 +36,14 @@ public class EnumConstantValue extends Const { public Kind kind() { return Kind.ENUM_CONSTANT; } + + @Override + public int hashCode() { + return sym.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof EnumConstantValue && sym().equals(((EnumConstantValue) obj).sym()); + } } |