Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

GROOVY-6611: fix compiler problem if generic signature and implements…

… clause of the class mismatch by using only getGenericInterfaces()

Conflicts:

	src/main/org/codehaus/groovy/vmplugin/v5/Java5.java
  • Loading branch information...
commit f1e8f93c7e4c09300cb95b23847d5455e93ae8bf 1 parent 860a9e1
@blackdrag blackdrag authored
Showing with 17 additions and 2 deletions.
  1. +17 −2 src/main/org/codehaus/groovy/vmplugin/v5/Java5.java
View
19 src/main/org/codehaus/groovy/vmplugin/v5/Java5.java
@@ -24,6 +24,12 @@
import java.lang.annotation.*;
import java.lang.reflect.*;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.Arrays;
import java.util.List;
/**
@@ -359,10 +365,19 @@ private void makeInterfaceTypes(CompileUnit cu, ClassNode classNode, Class clazz
if (interfaceTypes.length == 0) {
classNode.setInterfaces(ClassNode.EMPTY_ARRAY);
} else {
- Class[] interfaceClasses = clazz.getInterfaces();
ClassNode[] ret = new ClassNode[interfaceTypes.length];
for (int i = 0; i < interfaceTypes.length; i++) {
- ret[i] = makeClassNode(cu, interfaceTypes[i], interfaceClasses[i]);
+ Type type = interfaceTypes[i];
+ while (!(type instanceof Class)) {
+ ParameterizedType pt = (ParameterizedType) type;
+ Type t2 = pt.getRawType();
+ if (t2==type) {
+ throw new GroovyBugError("Cannot transform generic signature of "+clazz+
+ " with generic interface "+interfaceTypes[i]+" to a class.");
+ }
+ type = t2;
+ }
+ ret[i] = makeClassNode(cu, interfaceTypes[i], (Class) type);
}
classNode.setInterfaces(ret);
}
Please sign in to comment.
Something went wrong with that request. Please try again.