commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1582776 - /commons/proper/proxy/trunk/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java
Date Fri, 28 Mar 2014 15:23:21 GMT
Author: mbenson
Date: Fri Mar 28 15:23:21 2014
New Revision: 1582776

URL: http://svn.apache.org/r1582776
Log:
join two static init blocks; remove unnecessary checks on method identity (name/args are enough
to identify a method)

Modified:
    commons/proper/proxy/trunk/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java

Modified: commons/proper/proxy/trunk/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java?rev=1582776&r1=1582775&r2=1582776&view=diff
==============================================================================
--- commons/proper/proxy/trunk/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java
(original)
+++ commons/proper/proxy/trunk/core/src/main/java/org/apache/commons/proxy2/ProxyUtils.java
Fri Mar 28 15:23:21 2014
@@ -57,10 +57,7 @@ public final class ProxyUtils
         wrappers.put(Double.TYPE, Double.class);
         wrappers.put(Byte.TYPE, Byte.class);
         WRAPPER_CLASS_MAP = Collections.unmodifiableMap(wrappers);
-    }
 
-    static
-    {
         final Map<Class<?>, Object> nullValues = new HashMap<Class<?>,
Object>();
         nullValues.put(Integer.TYPE, Integer.valueOf(0));
         nullValues.put(Long.TYPE, Long.valueOf(0));
@@ -153,12 +150,12 @@ public final class ProxyUtils
      * 
      * @param method
      *            to compare
-     * @return <code>true</code> for a method with signature <code>boolean
equals(Object)</code>
+     * @return <code>true</code> for a method with signature <code>equals(Object)</code>
      */
     public static boolean isEqualsMethod(Method method)
     {
-        return "equals".equals(method.getName()) && Boolean.TYPE.equals(method.getReturnType())
-                && method.getParameterTypes().length == 1 && Object.class.equals(method.getParameterTypes()[0]);
+        return "equals".equals(method.getName()) && method.getParameterTypes().length
== 1
+                && Object.class.equals(method.getParameterTypes()[0]);
     }
 
     /**
@@ -166,12 +163,11 @@ public final class ProxyUtils
      * 
      * @param method
      *            to compare
-     * @return true for a method with signature <code>int hashCode()</code>
+     * @return true for a method with signature <code>hashCode()</code>
      */
     public static boolean isHashCode(Method method)
     {
-        return "hashCode".equals(method.getName()) && Integer.TYPE.equals(method.getReturnType())
-                && method.getParameterTypes().length == 0;
+        return "hashCode".equals(method.getName()) && method.getParameterTypes().length
== 0;
     }
 
     /**



Mime
View raw message