]> source.dussan.org Git - aspectj.git/commitdiff
Make TypeSafeEnum immutable
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Sun, 10 Apr 2022 02:38:16 +0000 (09:38 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Sun, 10 Apr 2022 02:38:46 +0000 (09:38 +0700)
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
util/src/main/java/org/aspectj/util/TypeSafeEnum.java

index 760c2ef6783fa119797752e2d3276f840f0c4f6a..fc0de82c93ce7738f67da95f90bea4e4534b9f35 100644 (file)
@@ -16,8 +16,8 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 
 public class TypeSafeEnum {
-       private byte key;
-       private String name;
+       private final byte key;
+       private final String name;
 
        public TypeSafeEnum(String name, int key) {
                this.name = name;
@@ -50,7 +50,7 @@ public class TypeSafeEnum {
        @Override
        public boolean equals(Object o) {
                return (o instanceof TypeSafeEnum) &&
-                          ((TypeSafeEnum)o).key == key &&
-                          ((TypeSafeEnum)o).name.equals(name);
+                       ((TypeSafeEnum)o).key == key &&
+                       ((TypeSafeEnum)o).name.equals(name);
        }
 }