Esempio n. 1
0
 /**
  * Returns the type name for a visitTypeInsn operand, which is the internal name for an object
  * type and the descriptor for an array type. Must not be called for a non-reference type.
  */
 private static String getTypeInstName(Type type) {
   if (type.getSort() == Type.OBJECT) {
     return type.getInternalName();
   } else if (type.getSort() == Type.ARRAY) {
     return type.getDescriptor();
   } else {
     throw new IllegalStateException();
   }
 }
Esempio n. 2
0
 /**
  * Call this method before comparing a non-reference operand to zero as an int, for example, with
  * IFNE, IFEQ, IFLT, etc. If the operand is a long, float or double, this method will compare it
  * to zero and leave the result as an int operand.
  */
 private static void genBeforeCompareToZero(MethodVisitor mv, Type type) {
   switch (type.getSort()) {
     case Type.LONG:
       mv.visitInsn(LCONST_0);
       mv.visitInsn(LCMP);
       break;
     case Type.FLOAT:
       mv.visitInsn(FCONST_0);
       mv.visitInsn(FCMPL);
       break;
     case Type.DOUBLE:
       mv.visitInsn(DCONST_0);
       mv.visitInsn(DCMPL);
       break;
   }
 }
Esempio n. 3
0
 FieldInfo(FieldVisitor parent, String name, String desc) {
   this.parent = parent;
   this.name = name;
   type = Type.getType(desc);
 }
Esempio n. 4
0
 /** Returns true if the given type is an object or array. */
 private static boolean isRefType(Type type) {
   int sort = type.getSort();
   return (sort == Type.OBJECT || sort == Type.ARRAY);
 }