Add support for generic types in synthetic classes such as weld proxies (#2589) (#2754)

Co-authored-by: Tarek Ahmed <tarek.ahmed@agfa.com>
This commit is contained in:
tarekmamdouh 2021-10-27 05:54:52 -04:00 committed by GitHub
parent e81ff9a769
commit 2db1fe2c93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -90,6 +90,15 @@ public class MethodUtil {
if (Collection.class.isAssignableFrom(parameterType)) {
innerCollectionType = (Class<? extends java.util.Collection<?>>) parameterType;
parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(theMethod, paramIndex);
if(parameterType == null && theMethod.getDeclaringClass().isSynthetic()) {
try {
theMethod = theMethod.getDeclaringClass().getSuperclass().getMethod(theMethod.getName(), parameterTypes);
parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(theMethod, paramIndex);
} catch (NoSuchMethodException e) {
throw new ConfigurationException("A method with name '" + theMethod.getName() + "' does not exist for super class '"
+ theMethod.getDeclaringClass().getSuperclass() + "'");
}
}
declaredParameterType = parameterType;
}
if (Collection.class.isAssignableFrom(parameterType)) {