eric-milles commented on code in PR #1824: URL: https://github.com/apache/groovy/pull/1824#discussion_r1019717220
########## src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java: ########## @@ -950,7 +956,7 @@ public static boolean hasUnresolvedGenerics(final ClassNode type) { public static Tuple2<ClassNode[], ClassNode> parameterizeSAM(final ClassNode samType) { MethodNode abstractMethod = ClassHelper.findSAM(samType); - Map<GenericsType, GenericsType> generics = makeDeclaringAndActualGenericsTypeMapOfExactType(abstractMethod.getDeclaringClass(), samType); + Map<GenericsType, GenericsType> generics = makeDeclaringAndActualGenericsTypeMap(abstractMethod.getDeclaringClass(), samType); Review Comment: We have been moving away from `makeDeclaringAndActualGenericsTypeMap` towards `makeDeclaringAndActualGenericsTypeMapOfExactType`. Can you explain this change? ########## src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java: ########## @@ -950,7 +956,7 @@ public static boolean hasUnresolvedGenerics(final ClassNode type) { public static Tuple2<ClassNode[], ClassNode> parameterizeSAM(final ClassNode samType) { MethodNode abstractMethod = ClassHelper.findSAM(samType); - Map<GenericsType, GenericsType> generics = makeDeclaringAndActualGenericsTypeMapOfExactType(abstractMethod.getDeclaringClass(), samType); + Map<GenericsType, GenericsType> generics = makeDeclaringAndActualGenericsTypeMap(abstractMethod.getDeclaringClass(), samType); Review Comment: Is this the stuff that sits under parametwrizeSAM? That was the key method for fixing lambda param types. ########## 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: The erasure type is not always Object. Can you create an example where it is another type? -- 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