cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject [1/3] cxf git commit: [CXF-6438] Optimize ExtensionInvocationHandler
Date Thu, 04 Jun 2015 14:13:37 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 32812b2bd -> 99311036f


[CXF-6438] Optimize ExtensionInvocationHandler


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e76de136
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e76de136
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e76de136

Branch: refs/heads/3.0.x-fixes
Commit: e76de136822100ba01f8f9902e689ce28e44a964
Parents: 32812b2
Author: Alessio Soldano <asoldano@redhat.com>
Authored: Thu Jun 4 16:07:25 2015 +0200
Committer: Alessio Soldano <asoldano@redhat.com>
Committed: Thu Jun 4 16:11:57 2015 +0200

----------------------------------------------------------------------
 .../cxf/common/util/ExtensionInvocationHandler.java | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e76de136/core/src/main/java/org/apache/cxf/common/util/ExtensionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/util/ExtensionInvocationHandler.java
b/core/src/main/java/org/apache/cxf/common/util/ExtensionInvocationHandler.java
index 1524c18..7672382 100644
--- a/core/src/main/java/org/apache/cxf/common/util/ExtensionInvocationHandler.java
+++ b/core/src/main/java/org/apache/cxf/common/util/ExtensionInvocationHandler.java
@@ -30,15 +30,13 @@ public class ExtensionInvocationHandler implements InvocationHandler {
     }
 
     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-        Class<?>[] clzs = null;
-        if (args != null) {
-            clzs = new Class[args.length];
-            for (int i = 0; i < args.length; i++) {
-                clzs[i] = args[i].getClass();
-            }
+        if (method.getDeclaringClass().isAssignableFrom(obj.getClass())) {
+            return method.invoke(obj, args);
+        } else {
+            //in case obj has the required method with exact signature despite it's class
+            //not being assignable from the class declaring the specified method
+            Method m = obj.getClass().getMethod(method.getName(), method.getParameterTypes());
+            return m.invoke(obj, args);
         }
-        
-        Method m = obj.getClass().getMethod(method.getName(), method.getParameterTypes());
-        return m.invoke(obj, args);
     }
 }


Mime
View raw message