You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/09/26 22:57:31 UTC
[groovy] branch GROOVY_3_0_X updated: GROOVY-9760: parameterizeType
for raw type should be T
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
new c95a41a GROOVY-9760: parameterizeType for raw type should be T<Object> not T<X> (port to 2_5_X fix)
c95a41a is described below
commit c95a41a44295095d43288a833d74178151272a1d
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sun Sep 27 08:57:23 2020 +1000
GROOVY-9760: parameterizeType for raw type should be T<Object> not T<X> (port to 2_5_X fix)
---
.../java/org/codehaus/groovy/ast/tools/GenericsUtils.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
index 2f30e7b..6d16916 100644
--- a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
+++ b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
@@ -536,6 +536,15 @@ public class GenericsUtils {
return superClass;
}
+ private static GenericsType asGenericsType(ClassNode type) {
+ if (!type.isGenericsPlaceHolder()) {
+ return new GenericsType(type);
+ } else {
+ ClassNode upper = (type.redirect() != null ? type.redirect() : type);
+ return new GenericsType(type, new ClassNode[]{upper}, null);
+ }
+ }
+
private static void extractSuperClassGenerics(final GenericsType[] usage, final GenericsType[] declaration, final Map<String, ClassNode> spec) {
// if declaration does not provide generics, there is no connection to make
if (declaration == null || declaration.length == 0) return;
@@ -547,7 +556,7 @@ public class GenericsUtils {
ClassNode type = spec.get(name);
if (type != null && type.isGenericsPlaceHolder()
&& type.getUnresolvedName().equals(name)) {
- type = type.asGenericsType().getUpperBounds()[0];
+ type = asGenericsType(type).getUpperBounds()[0];
spec.put(name, type);
}
}