camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [07/15] camel git commit: CAMEL-8137: Bean component should detect override methods that are assignable by type, so duplicate methods is not reported as error.
Date Wed, 10 Dec 2014 16:32:17 GMT
CAMEL-8137: Bean component should detect override methods that are assignable by type, so duplicate
methods is not reported as error.


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

Branch: refs/heads/master
Commit: 53b4e90c535ad419a101129b02feccc6625b5043
Parents: 7a0f2e8
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Dec 10 13:42:54 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Dec 10 13:42:54 2014 +0100

----------------------------------------------------------------------
 .../apache/camel/component/bean/BeanInfo.java   | 29 ++++++++++++--------
 1 file changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/53b4e90c/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
index 1c19945..fb9c533 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
@@ -311,22 +311,27 @@ public class BeanInfo {
             methods.addAll(extraMethods);
         }
 
-        // it may have duplicate methods already, even from declared or from interfaces +
declared
         Set<Method> overrides = new HashSet<Method>();
-        for (Method source : methods) {
-            for (Method target : methods) {
-                // skip ourselves
-                if (ObjectHelper.isOverridingMethod(source, target, true)) {
-                    continue;
-                }
-                // skip duplicates which may be assign compatible (favor keep first added
method when duplicate)
-                if (ObjectHelper.isOverridingMethod(source, target, false)) {
-                    overrides.add(target);
+
+        // do not remove duplicates form class from the Java itself as they have some "duplicates"
we need
+        boolean javaClass = clazz.getName().startsWith("java.") || clazz.getName().startsWith("javax.");
+        if (!javaClass) {
+            // it may have duplicate methods already, even from declared or from interfaces
+ declared
+            for (Method source : methods) {
+                for (Method target : methods) {
+                    // skip ourselves
+                    if (ObjectHelper.isOverridingMethod(source, target, true)) {
+                        continue;
+                    }
+                    // skip duplicates which may be assign compatible (favor keep first added
method when duplicate)
+                    if (ObjectHelper.isOverridingMethod(source, target, false)) {
+                        overrides.add(target);
+                    }
                 }
             }
+            methods.removeAll(overrides);
+            overrides.clear();
         }
-        methods.removeAll(overrides);
-        overrides.clear();
 
         // if we are a public class, then add non duplicate interface classes also
         if (Modifier.isPublic(clazz.getModifiers())) {


Mime
View raw message