]> source.dussan.org Git - javassist.git/commitdiff
Implement hashCode for Annotation.
authornickl- <github@jigsoft.co.za>
Mon, 30 Oct 2017 04:50:20 +0000 (06:50 +0200)
committernickl- <github@jigsoft.co.za>
Mon, 30 Oct 2017 04:50:20 +0000 (06:50 +0200)
To honour the Object.equals contract.

src/main/javassist/bytecode/annotation/Annotation.java

index 10ceb8eeeffa35a6aa3dfea94662f96be8237579..d19f6f5659d3a1845f09f9454dfdd4d6e765b2f8 100644 (file)
@@ -331,6 +331,12 @@ public class Annotation {
         }
     }
 
+    @Override
+    public int hashCode() {
+        return getTypeName().hashCode() + 
+                (members == null ? 0 : members.hashCode());
+    }
+
     /**
      * Returns true if the given object represents the same annotation
      * as this object.  The equality test checks the member values.