8016592: Clean-up Javac Overrides Warnings In javax/management/NotificationBroadcasterSupport.java
authordxu
Wed, 19 Jun 2013 13:00:53 -0700
changeset 18291 18803e8ff87c
parent 18290 5f508485bf37
child 18292 3d40978f5ff8
8016592: Clean-up Javac Overrides Warnings In javax/management/NotificationBroadcasterSupport.java Summary: Add hashCode() methods to ListenerInfo and WildcardListenerInfo classes Reviewed-by: dfuchs, alanb, sjiang, chegar
jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java
--- a/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java	Wed Jun 19 17:32:08 2013 +0100
+++ b/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java	Wed Jun 19 13:00:53 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Objects;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Executor;
 
@@ -288,6 +289,7 @@
             this.handback = handback;
         }
 
+        @Override
         public boolean equals(Object o) {
             if (!(o instanceof ListenerInfo))
                 return false;
@@ -298,6 +300,11 @@
                 return (li.listener == listener && li.filter == filter
                         && li.handback == handback);
         }
+
+        @Override
+        public int hashCode() {
+            return Objects.hashCode(listener);
+        }
     }
 
     private static class WildcardListenerInfo extends ListenerInfo {
@@ -305,10 +312,16 @@
             super(listener, null, null);
         }
 
+        @Override
         public boolean equals(Object o) {
             assert (!(o instanceof WildcardListenerInfo));
             return o.equals(this);
         }
+
+        @Override
+        public int hashCode() {
+            return super.hashCode();
+        }
     }
 
     private List<ListenerInfo> listenerList =