Skip to content
Permalink
Browse files
[CXF-5524] More addType fixes
Patch from Denis Simonov, although hard to apply and may have missed something

git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1562238 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
dkulp committed Jan 28, 2014
1 parent 7408a93 commit 6a8766e9d4de7c1f4f6fcbd83edb2f3dca0f3a23
Showing 1 changed file with 21 additions and 5 deletions.
@@ -233,10 +233,13 @@ private void addType(Type cls, boolean allowArray) {
addClass((Class<?>)cls);
}
} else if (cls instanceof ParameterizedType) {
addType(((ParameterizedType)cls).getRawType());
if (!((ParameterizedType)cls).getRawType().equals(Enum.class)) {
for (Type t2 : ((ParameterizedType)cls).getActualTypeArguments()) {
addType(t2);
final ParameterizedType parameterizedType = (ParameterizedType)cls;
addType(parameterizedType.getRawType());
if (!parameterizedType.getRawType().equals(Enum.class)) {
for (Type t2 : parameterizedType.getActualTypeArguments()) {
if (shouldTypeBeAdded(t2, parameterizedType)) {
addType(t2);
}
}
}
} else if (cls instanceof GenericArrayType) {
@@ -275,7 +278,20 @@ private void addType(Type cls, boolean allowArray) {
}
}


private boolean shouldTypeBeAdded(final Type t2, final ParameterizedType parameterizedType) {
if (!(t2 instanceof TypeVariable)) {
return true;
}
TypeVariable<?> typeVariable = (TypeVariable<?>) t2;
final Type[] bounds = typeVariable.getBounds();
for (Type bound : bounds) {
if (bound instanceof ParameterizedType && bound.equals(parameterizedType)) {
return false;
}
}
return true;
}

void addClass(Class<?> claz) {
if (Throwable.class.isAssignableFrom(claz)) {
if (!Throwable.class.equals(claz)

0 comments on commit 6a8766e

Please sign in to comment.