jdaugherty commented on code in PR #3079:
URL: https://github.com/apache/groovy/pull/3079#discussion_r4449834961


##########
src/main/java/org/codehaus/groovy/classgen/asm/ClosureWriter.java:
##########
@@ -1475,7 +1475,9 @@ protected ClassNode createClosureClass(final 
ClosureExpression expression, final
         // GROOVY-9971: closure return type is mapped to Groovy cast by 
classgen
         ClassNode returnType = 
expression.getNodeMetaData(INFERRED_RETURN_TYPE);
         if (returnType == null) returnType = ClassHelper.OBJECT_TYPE; // not 
STC or unknown path
-        else if (returnType.isPrimaryClassNode()) returnType = 
returnType.getPlainNodeReference();
+        // the class node itself carries the declared type parameters; a 
parameterized reference to a class of the
+        // compilation unit keeps its type arguments, as a reference to a 
class read from bytecode does
+        else if (returnType.isPrimaryClassNode() && 
!returnType.isRedirectNode()) returnType = returnType.getPlainNodeReference();

Review Comment:
   You are seeing right, the two blocks were identical. The copy came in with 
the packed closure path, and this PR touched both. `createClosureClass` now 
calls `inferredClosureReturnType`: 75775b7553.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to