8016218: Warnings building corba repo due to missing hashCode methods
authoralanb
Mon, 10 Jun 2013 17:15:42 +0100
changeset 18302 3b06314efbd0
parent 17815 b72ae39e1329
child 18303 e3d69bc54ecd
8016218: Warnings building corba repo due to missing hashCode methods Reviewed-by: chegar, coffeys, dfuchs
corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java
corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java
corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java
corba/src/share/classes/sun/rmi/rmic/iiop/CompoundType.java
--- a/corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java	Wed Jul 05 18:58:01 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java	Mon Jun 10 17:15:42 2013 +0100
@@ -147,6 +147,14 @@
             return ior.equals( other.ior ) ;
     }
 
+    public int hashCode() {
+        if (ior == null) {
+            return 0;
+        } else {
+            return ior.hashCode();
+        }
+    }
+
     /**
      * Returns a string representation of this stub. Returns the same string
      * for all stubs that represent the same remote object.
--- a/corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java	Wed Jul 05 18:58:01 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java	Mon Jun 10 17:15:42 2013 +0100
@@ -455,6 +455,10 @@
             return other instanceof TestBadServerIdHandler ;
         }
 
+        public int hashCode() {
+            return 1;
+        }
+
         public void handle( ObjectKey objectKey )
         {
         }
@@ -518,6 +522,10 @@
             return other instanceof TestLegacyORBSocketFactory ;
         }
 
+        public int hashCode() {
+            return 1;
+        }
+
         public ServerSocket createServerSocket( String type, int port )
         {
             return null ;
@@ -543,6 +551,10 @@
             return other instanceof TestORBSocketFactory ;
         }
 
+        public int hashCode() {
+            return 1;
+        }
+
         public void setORB(ORB orb)
         {
         }
@@ -572,6 +584,10 @@
             return other instanceof TestIORToSocketInfo;
         }
 
+        public int hashCode() {
+            return 1;
+        }
+
         public List getSocketInfo(IOR ior)
         {
             return null;
@@ -608,6 +624,10 @@
             return other instanceof TestContactInfoListFactory;
         }
 
+        public int hashCode() {
+            return 1;
+        }
+
         public void setORB(ORB orb) { }
 
         public CorbaContactInfoList create( IOR ior ) { return null; }
@@ -865,6 +885,10 @@
             return other instanceof TestORBInitializer1 ;
         }
 
+        public int hashCode() {
+            return 1;
+        }
+
         public void pre_init( ORBInitInfo info )
         {
         }
@@ -882,6 +906,10 @@
             return other instanceof TestORBInitializer2 ;
         }
 
+        public int hashCode() {
+            return 1;
+        }
+
         public void pre_init( ORBInitInfo info )
         {
         }
@@ -950,6 +978,8 @@
         {
             return other instanceof TestAcceptor1 ;
         }
+
+        public int hashCode() { return 1; }
         public boolean initialize() { return true; }
         public boolean initialized() { return true; }
         public String getConnectionCacheType() { return "FOO"; }
@@ -981,6 +1011,7 @@
         {
             return other instanceof TestAcceptor2 ;
         }
+        public int hashCode() { return 1; }
         public boolean initialize() { return true; }
         public boolean initialized() { return true; }
         public String getConnectionCacheType() { return "FOO"; }
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java	Wed Jul 05 18:58:01 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java	Mon Jun 10 17:15:42 2013 +0100
@@ -151,7 +151,9 @@
     }
 
     // Constructor used for factory/utility cases
-    public RepIdDelegator() {}
+    public RepIdDelegator() {
+        this(null);
+    }
 
     // Constructor used by getIdFromString.  All non-static
     // RepositoryId methods will use the provided delegate.
@@ -159,7 +161,7 @@
         this.delegate = _delegate;
     }
 
-    private RepositoryId delegate;
+    private final RepositoryId delegate;
 
     public String toString() {
         if (delegate != null)
@@ -174,4 +176,12 @@
         else
             return super.equals(obj);
     }
+
+    public int hashCode() {
+        if (delegate != null) {
+            return delegate.hashCode();
+        } else {
+            return super.hashCode();
+        }
+    }
 }
--- a/corba/src/share/classes/sun/rmi/rmic/iiop/CompoundType.java	Wed Jul 05 18:58:01 2017 +0200
+++ b/corba/src/share/classes/sun/rmi/rmic/iiop/CompoundType.java	Mon Jun 10 17:15:42 2013 +0100
@@ -32,6 +32,7 @@
 
 package sun.rmi.rmic.iiop;
 
+import java.util.Arrays;
 import java.util.Vector;
 import sun.tools.java.Identifier;
 import sun.tools.java.ClassNotFound;
@@ -1851,6 +1852,10 @@
             return false;
         }
 
+        public int hashCode() {
+            return getName().hashCode() ^ Arrays.hashCode(arguments);
+        }
+
         /**
          * Return a new Method object that is a legal combination of
          * this method object and another one.