Shadow-Devil commented on code in PR #1824:
URL: https://github.com/apache/groovy/pull/1824#discussion_r1020468865


##########
src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java:
##########
@@ -855,10 +855,16 @@ private static Map<GenericsType, GenericsType> 
doMakeDeclaringAndActualGenericsT
             GenericsType[] targetGenericsTypes = 
parameterizedType.redirect().getGenericsTypes();
             if (targetGenericsTypes != null) {
                 GenericsType[] sourceGenericsTypes = 
parameterizedType.getGenericsTypes();
-                if (sourceGenericsTypes == null) sourceGenericsTypes = 
EMPTY_GENERICS_ARRAY;
                 map = new LinkedHashMap<>();
-                for (int i = 0, m = sourceGenericsTypes.length, n = 
targetGenericsTypes.length; i < n; i += 1) {
-                    map.put(targetGenericsTypes[i], i < m ? 
sourceGenericsTypes[i] : targetGenericsTypes[i]);
+                if (sourceGenericsTypes == null) {
+                    //We have no sourceGenerics, so we need to return the 
erasures for the raw types (Groovy-10813)
+                    for (GenericsType targetGenericsType : 
targetGenericsTypes) {
+                        map.put(targetGenericsType, 
ClassHelper.OBJECT_TYPE.asGenericsType());

Review Comment:
   Another example where the type parameter has an upper bound: 
   ´´´java
   interface A<T extends String> extends Function<T, T> {}
   class B implements A{
       @Override
       Object apply(Object input) {
           return null
       }
   }
   ´´´



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@groovy.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to