int typeSort = type.getSort(); if (typeSort == Type.OBJECT) { return addConstantClass(type.getInternalName()); } else if (typeSort == Type.METHOD) { return addConstantMethodType(type.getDescriptor());
/** * Returns the internal names of the given types. * * @param types * a set of types. * @return the internal names of the given types. */ private static String[] getInternalNames(final Type[] types) { if (types == null) { return null; } String[] names = new String[types.length]; for (int i = 0; i < names.length; ++i) { names[i] = types[i].getInternalName(); } return names; }
/** * Generates a type dependent instruction. * * @param opcode * the instruction's opcode. * @param type * the instruction's operand. */ private void typeInsn(final int opcode, final Type type) { mv.visitTypeInsn(opcode, type.getInternalName()); }
public void anew(final Type type) { mv.visitTypeInsn(Opcodes.NEW, type.getInternalName()); }
public void checkcast(final Type type) { mv.visitTypeInsn(Opcodes.CHECKCAST, type.getInternalName()); }
public void instanceOf(final Type type) { mv.visitTypeInsn(Opcodes.INSTANCEOF, type.getInternalName()); }
/** * Generates a get field or set field instruction. * * @param opcode * the instruction's opcode. * @param ownerType * the class in which the field is defined. * @param name * the name of the field. * @param fieldType * the type of the field. */ private void fieldInsn(final int opcode, final Type ownerType, final String name, final Type fieldType) { mv.visitFieldInsn(opcode, ownerType.getInternalName(), name, fieldType.getDescriptor()); }
locals.add(types[i].getInternalName());
t = type.getInternalName(); break;
break; default: mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName()); return;
/** * Marks the start of an exception handler. * * @param start * beginning of the exception handler's scope (inclusive). * @param end * end of the exception handler's scope (exclusive). * @param exception * internal name of the type of exceptions handled by the * handler. */ public void catchException(final Label start, final Label end, final Type exception) { if (exception == null) { mv.visitTryCatchBlock(start, end, mark(), null); } else { mv.visitTryCatchBlock(start, end, mark(), exception.getInternalName()); } } }
/** * Generates an invoke method instruction. * * @param opcode * the instruction's opcode. * @param type * the class in which the method is defined. * @param method * the method to be invoked. */ private void invokeInsn(final int opcode, final Type type, final Method method) { String owner = type.getSort() == Type.ARRAY ? type.getDescriptor() : type.getInternalName(); mv.visitMethodInsn(opcode, owner, method.getName(), method.getDescriptor()); }
int s = t.getSort(); if (s == Type.OBJECT) { return newClassItem(t.getInternalName()); } else if (s == Type.METHOD) { return newMethodTypeItem(t.getDescriptor());
t = type.getInternalName(); break;
if(k.isPrimitive()) mv.visitTypeInsn(CHECKCAST, Type.getType(boxClass(k)).getInternalName()); if(k.isPrimitive()) String b = Type.getType(boxClass(k)).getInternalName(); String p = Type.getType(k).getDescriptor(); String n = k.getName();