refactor
Project: http://git-wip-us.apache.org/repos/asf/bval/repo Commit: http://git-wip-us.apache.org/repos/asf/bval/commit/3a1ac76d Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/3a1ac76d Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/3a1ac76d Branch: refs/heads/master Commit: 3a1ac76da64868e4dc5ba60ab5d1ecdf77f82d6b Parents: de6ff20 Author: Matt Benson <[email protected]> Authored: Wed Oct 19 21:05:56 2016 +0000 Committer: Matt Benson <[email protected]> Committed: Wed Oct 19 21:05:56 2016 +0000 ---------------------------------------------------------------------- .../main/java/org/apache/bval/jsr/util/Proxies.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bval/blob/3a1ac76d/bval-jsr/src/main/java/org/apache/bval/jsr/util/Proxies.java ---------------------------------------------------------------------- diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/util/Proxies.java b/bval-jsr/src/main/java/org/apache/bval/jsr/util/Proxies.java index 9ce7cbb..0722d4e 100644 --- a/bval-jsr/src/main/java/org/apache/bval/jsr/util/Proxies.java +++ b/bval-jsr/src/main/java/org/apache/bval/jsr/util/Proxies.java @@ -21,10 +21,17 @@ package org.apache.bval.jsr.util; public final class Proxies { // get rid of proxies which probably contains wrong annotation metamodel public static <T> Class<?> classFor(final Class<?> clazz) { // TODO: do we want a SPI with impl for guice, owb, openejb, ...? - if (!clazz.getSimpleName().contains("$$")) { // a lot of proxies use this convention to avoid conflicts with inner/anonymous classes - return clazz; + if (isProxyClass(clazz)) { + final Class<?> parent = clazz.getSuperclass(); + if (parent != null) { + return classFor(clazz.getSuperclass()); + } } - return classFor(clazz.getSuperclass()); + return clazz; + } + + private static boolean isProxyClass(Class<?> clazz) { + return clazz.getSimpleName().contains("$$");// a lot of proxies use this convention to avoid conflicts with inner/anonymous classes } private Proxies() {
