public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Argument of ldc instruction. switch (label) { case LABEL_LOAD_MEMBER_NAME: break; default: // For other states, we'll treat this as a potential // initial method name, without a known class. referencedClass = null; break; } // Whatever state, we'll treat this as a potential method name. memberNameInstructionOffset = instructionOffset; memberName = stringConstant.getString(clazz); label = LABEL_LOAD_CLASS_ARRAY_SIZE; }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Check the referenced class or class member, if any. stringConstant.referencedClassAccept(this); stringConstant.referencedMemberAccept(this); }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Mark the referenced method, if any. stringConstant.referencedMemberAccept(this); }
/** * Finds or creates a StringConstant constant pool entry with the given * value. * @return the constant pool index of the StringConstant. */ public int addStringConstant(String string, Clazz referencedClass, Member referencedMember) { int constantPoolCount = targetClass.u2constantPoolCount; Constant[] constantPool = targetClass.constantPool; // Check if the entry already exists. for (int index = 1; index < constantPoolCount; index++) { Constant constant = constantPool[index]; if (constant != null && constant.getTag() == ClassConstants.CONSTANT_String) { StringConstant stringConstant = (StringConstant)constant; if (stringConstant.getString(targetClass).equals(string)) { return index; } } } return addConstant(new StringConstant(addUtf8Constant(string), referencedClass, referencedMember)); }
private Constant createConstant() { int u1tag = dataInput.readUnsignedByte(); switch (u1tag) { case ClassConstants.CONSTANT_Utf8: return new Utf8Constant(); case ClassConstants.CONSTANT_Integer: return new IntegerConstant(); case ClassConstants.CONSTANT_Float: return new FloatConstant(); case ClassConstants.CONSTANT_Long: return new LongConstant(); case ClassConstants.CONSTANT_Double: return new DoubleConstant(); case ClassConstants.CONSTANT_String: return new StringConstant(); case ClassConstants.CONSTANT_Fieldref: return new FieldrefConstant(); case ClassConstants.CONSTANT_Methodref: return new MethodrefConstant(); case ClassConstants.CONSTANT_InterfaceMethodref: return new InterfaceMethodrefConstant(); case ClassConstants.CONSTANT_Class: return new ClassConstant(); case ClassConstants.CONSTANT_NameAndType: return new NameAndTypeConstant(); default: throw new RuntimeException("Unknown constant type ["+u1tag+"] in constant pool"); } }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Visit the referenced class from the Class.forName construct, if any. stringConstant.referencedClassAccept(classVisitor); } }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Mark the referenced method, if any. stringConstant.referencedMemberAccept(filteredMethodMarker); }
stringConstant.getString(targetClass).equals(string) && stringConstant.referencedClass == referencedClass && stringConstant.referencedMember == referencedMember) return addConstant(new StringConstant(addUtf8Constant(string), referencedClass, referencedMember));
private Constant createConstant() { int u1tag = dataInput.readUnsignedByte(); switch (u1tag) { case ClassConstants.CONSTANT_Utf8: return new Utf8Constant(); case ClassConstants.CONSTANT_Integer: return new IntegerConstant(); case ClassConstants.CONSTANT_Float: return new FloatConstant(); case ClassConstants.CONSTANT_Long: return new LongConstant(); case ClassConstants.CONSTANT_Double: return new DoubleConstant(); case ClassConstants.CONSTANT_String: return new StringConstant(); case ClassConstants.CONSTANT_Fieldref: return new FieldrefConstant(); case ClassConstants.CONSTANT_Methodref: return new MethodrefConstant(); case ClassConstants.CONSTANT_InterfaceMethodref: return new InterfaceMethodrefConstant(); case ClassConstants.CONSTANT_Class: return new ClassConstant(); case ClassConstants.CONSTANT_NameAndType: return new NameAndTypeConstant(); default: throw new RuntimeException("Unknown constant type ["+u1tag+"] in constant pool"); } }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Let the visitor visit the class referenced in the string constant. stringConstant.referencedClassAccept(classVisitor); }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Check the referenced class and class member, if any. if (stringConstant.referencedClass != clazz) { referencingClass = clazz; stringConstant.referencedClassAccept(this); stringConstant.referencedMemberAccept(this); } }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Mark the referenced field, if any. stringConstant.referencedMemberAccept(this); }
stringConstant.getString(targetClass).equals(string) && stringConstant.referencedClass == referencedClass && stringConstant.referencedMember == referencedMember) return addConstant(new StringConstant(addUtf8Constant(string), referencedClass, referencedMember));
private Constant createConstant() { int u1tag = dataInput.readUnsignedByte(); switch (u1tag) { case ClassConstants.CONSTANT_Integer: return new IntegerConstant(); case ClassConstants.CONSTANT_Float: return new FloatConstant(); case ClassConstants.CONSTANT_Long: return new LongConstant(); case ClassConstants.CONSTANT_Double: return new DoubleConstant(); case ClassConstants.CONSTANT_String: return new StringConstant(); case ClassConstants.CONSTANT_Utf8: return new Utf8Constant(); case ClassConstants.CONSTANT_InvokeDynamic: return new InvokeDynamicConstant(); case ClassConstants.CONSTANT_MethodHandle: return new MethodHandleConstant(); case ClassConstants.CONSTANT_Fieldref: return new FieldrefConstant(); case ClassConstants.CONSTANT_Methodref: return new MethodrefConstant(); case ClassConstants.CONSTANT_InterfaceMethodref: return new InterfaceMethodrefConstant(); case ClassConstants.CONSTANT_Class: return new ClassConstant(); case ClassConstants.CONSTANT_MethodType: return new MethodTypeConstant(); case ClassConstants.CONSTANT_NameAndType: return new NameAndTypeConstant(); case ClassConstants.CONSTANT_Module: return new ModuleConstant(); case ClassConstants.CONSTANT_Package: return new PackageConstant(); default: throw new RuntimeException("Unknown constant type ["+u1tag+"] in constant pool"); } }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Let the visitor visit the class referenced in the string constant. stringConstant.referencedClassAccept(classVisitor); }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Argument of ldc instruction. switch (label) { case LABEL_LOAD_MEMBER_NAME: break; default: // For other states, we'll treat this as a potential // initial method name, without a known class. referencedClass = null; break; } // Whatever state, we'll treat this as a potential method name. memberNameInstructionOffset = instructionOffset; memberName = stringConstant.getString(clazz); label = LABEL_LOAD_CLASS_ARRAY_SIZE; }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Check the referenced class or class member, if any. stringConstant.referencedClassAccept(this); stringConstant.referencedMemberAccept(this); }
public void visitStringConstant(Clazz clazz, StringConstant stringConstant) { // Mark the referenced field, if any. stringConstant.referencedMemberAccept(this); }
stringConstant.getString(targetClass).equals(string) && stringConstant.referencedClass == referencedClass && stringConstant.referencedMember == referencedMember) return addConstant(new StringConstant(addUtf8Constant(string), referencedClass, referencedMember));