< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Attribute.java

Print this page

        

@@ -61,10 +61,27 @@
     @DefinedBy(Api.LANGUAGE_MODEL)
     public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
         throw new UnsupportedOperationException();
     }
 
+    @Override
+    @DefinedBy(Api.LANGUAGE_MODEL)
+    public boolean equals(Object o) {
+        if (o instanceof AnnotationValue) {
+            AnnotationValue that = (AnnotationValue) o;
+            return getValue().equals(that.getValue());
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    @DefinedBy(Api.LANGUAGE_MODEL)
+    public int hashCode() {
+        return getValue().hashCode();
+    }
+
     public boolean isSynthesized() {
         return false;
     }
 
     public TypeAnnotationPosition getPosition() { return null; }

@@ -260,10 +277,30 @@
                 buf.append(')');
             }
             return buf.toString();
         }
 
+        @Override
+        @DefinedBy(Api.LANGUAGE_MODEL)
+        public boolean equals(Object o) {
+            if (o instanceof AnnotationMirror) {
+                AnnotationMirror that = (AnnotationMirror) o;
+                return
+                    getAnnotationType().equals(that.getAnnotationType()) &&
+                    getElementValues().equals(that.getElementValues());
+            } else {
+                return false;
+            }
+        }
+
+        @Override
+        @DefinedBy(Api.LANGUAGE_MODEL)
+        public int hashCode() {
+             return getAnnotationType().hashCode() ^
+                 getElementValues().hashCode();
+        }
+
         public Attribute member(Name member) {
             Pair<MethodSymbol,Attribute> res = getElemPair(member);
             return res == null ? null : res.snd;
         }
 
< prev index next >