示例#1
0
 /** Finds the most specific common super class of the given classes by considering array types. */
 public static org.hotswap.agent.javassist.CtClass commonSuperClassEx(
     org.hotswap.agent.javassist.CtClass one, org.hotswap.agent.javassist.CtClass two)
     throws org.hotswap.agent.javassist.NotFoundException {
   if (one == two) {
     return one;
   } else if (one.isArray() && two.isArray()) {
     org.hotswap.agent.javassist.CtClass ele1 = one.getComponentType();
     org.hotswap.agent.javassist.CtClass ele2 = two.getComponentType();
     org.hotswap.agent.javassist.CtClass element = commonSuperClassEx(ele1, ele2);
     if (element == ele1) {
       return one;
     } else if (element == ele2) {
       return two;
     } else {
       return one.getClassPool()
           .get(element == null ? "java.lang.Object" : element.getName() + "[]");
     }
   } else if (one.isPrimitive() || two.isPrimitive()) {
     return null; // TOP
   } else if (one.isArray() || two.isArray()) {
     // two.isArray())
     return one.getClassPool().get("java.lang.Object");
   } else {
     return commonSuperClass(one, two);
   }
 }