예제 #1
1
파일: Java5.java 프로젝트: TTwxj/groovy
 private void makeInterfaceTypes(CompileUnit cu, ClassNode classNode, Class clazz) {
   Type[] interfaceTypes = clazz.getGenericInterfaces();
   if (interfaceTypes.length == 0) {
     classNode.setInterfaces(ClassNode.EMPTY_ARRAY);
   } else {
     ClassNode[] ret = new ClassNode[interfaceTypes.length];
     for (int i = 0; i < interfaceTypes.length; 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);
   }
 }
예제 #2
0
파일: Java5.java 프로젝트: bodiam/discobot
 private void makeInterfaceTypes(CompileUnit cu, ClassNode classNode, Class clazz) {
   Type[] interfaceTypes = clazz.getGenericInterfaces();
   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]);
     }
     classNode.setInterfaces(ret);
   }
 }