Java Code Examples for proguard.classfile.ClassConstants

The following examples show how to use proguard.classfile.ClassConstants. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: java-n-IDE-for-Android   Source File: Preverifier.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Performs preverification of the given program class pool.
 */
public void execute(ClassPool programClassPool)
{
    // Clean up any old visitor info.
    programClassPool.classesAccept(new ClassCleaner());

    // Preverify all methods.
    ClassVisitor preverifier =
        new AllMethodVisitor(
        new AllAttributeVisitor(
        new CodePreverifier(configuration.microEdition)));

    // In Java Standard Edition, only class files from Java 6 or higher
    // should be preverified.
    if (!configuration.microEdition)
    {
        preverifier =
            new ClassVersionFilter(ClassConstants.INTERNAL_CLASS_VERSION_1_6,
                                   Integer.MAX_VALUE,
                                   preverifier);
    }

    programClassPool.classesAccept(preverifier);
}
 
Example 2
Source Project: java-n-IDE-for-Android   Source File: SubroutineInliner.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Performs subroutine inlining of the given program class pool.
 */
public void execute(ClassPool programClassPool)
{
    // Clean up any old visitor info.
    programClassPool.classesAccept(new ClassCleaner());

    // Inline all subroutines.
    ClassVisitor inliner =
        new AllMethodVisitor(
        new AllAttributeVisitor(
        new CodeSubroutineInliner()));

    // In Java Standard Edition, only class files from Java 6 or higher
    // should be preverified.
    if (!configuration.microEdition)
    {
        inliner =
            new ClassVersionFilter(ClassConstants.INTERNAL_CLASS_VERSION_1_6,
                                   Integer.MAX_VALUE,
                                   inliner);
    }

    programClassPool.classesAccept(inliner);
}
 
Example 3
Source Project: java-n-IDE-for-Android   Source File: ClassObfuscator.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new package prefix in the given new superpackage, with the
 * given package name factory.
 */
private String generateUniquePackagePrefix(String      newSuperPackagePrefix,
                                           NameFactory packageNameFactory)
{
    // Come up with package names until we get an original one.
    String newPackagePrefix;
    do
    {
        // Let the factory produce a package name.
        newPackagePrefix = newSuperPackagePrefix +
                           packageNameFactory.nextName() +
                           ClassConstants.INTERNAL_PACKAGE_SEPARATOR;
    }
    while (packagePrefixMap.containsValue(newPackagePrefix));

    return newPackagePrefix;
}
 
Example 4
Source Project: java-n-IDE-for-Android   Source File: MethodStaticizer.java    License: Apache License 2.0 6 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    // Is the 'this' parameter being used?
    if (!ParameterUsageMarker.isParameterUsed(programMethod, 0))
    {
        // Make the method static.
        programMethod.u2accessFlags =
            (programMethod.getAccessFlags() & ~ClassConstants.INTERNAL_ACC_FINAL) |
            ClassConstants.INTERNAL_ACC_STATIC;

        // Visit the method, if required.
        if (extraStaticMemberVisitor != null)
        {
            extraStaticMemberVisitor.visitProgramMethod(programClass, programMethod);
        }
    }
}
 
Example 5
Source Project: java-n-IDE-for-Android   Source File: ClassMerger.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns whether the two given classes have initializers with the same
 * descriptors.
 */
private boolean haveAnyIdenticalInitializers(Clazz clazz, Clazz targetClass)
{
    MemberCounter counter = new MemberCounter();

    // TODO: Currently checking shared methods, not just initializers.
    // TODO: Allow identical methods.
    // Visit all methods, counting the ones that are also present in the
    // target class.
    clazz.methodsAccept(//new MemberNameFilter(new FixedStringMatcher(ClassConstants.INTERNAL_METHOD_NAME_INIT),
                        new SimilarMemberVisitor(targetClass, true, false, false, false,
                        new MemberAccessFilter(0, ClassConstants.INTERNAL_ACC_ABSTRACT,
                        counter)));

    return counter.getCount() > 0;
}
 
Example 6
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    // All parameters of non-static methods are shifted by one in the local
    // variable frame.
    int firstParameterIndex =
        (programMethod.getAccessFlags() & ClassConstants.INTERNAL_ACC_STATIC) != 0 ?
            0 : 1;

    int parameterCount =
        ClassUtil.internalMethodParameterCount(programMethod.getDescriptor(programClass));

    for (int index = firstParameterIndex; index < parameterCount; index++)
    {
        Value value = StoringInvocationUnit.getMethodParameterValue(programMethod, index);
        if (value != null &&
            value.isParticular())
        {
            constantParameterVisitor.visitProgramMethod(programClass, programMethod);
        }
    }
}
 
Example 7
Source Project: java-n-IDE-for-Android   Source File: ConstantPoolEditor.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Finds or creates a FloatConstant constant pool entry with the given
 * value.
 * @return the constant pool index of the FloatConstant.
 */
public int addFloatConstant(float value)
{
    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_Float)
        {
            FloatConstant floatConstant = (FloatConstant)constant;
            if (floatConstant.getValue() == value)
            {
                return index;
            }
        }
    }

    return addConstant(new FloatConstant(value));
}
 
Example 8
Source Project: java-n-IDE-for-Android   Source File: MemberPrivatizer.java    License: Apache License 2.0 6 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    // Is the method unmarked?
    if (NonPrivateMemberMarker.canBeMadePrivate(programMethod))
    {
        // Make the method private.
        programMethod.u2accessFlags =
            AccessUtil.replaceAccessFlags(programMethod.u2accessFlags,
                                          ClassConstants.INTERNAL_ACC_PRIVATE);

        // Visit the method, if required.
        if (extraMemberVisitor != null)
        {
            extraMemberVisitor.visitProgramMethod(programClass, programMethod);
        }
    }
}
 
Example 9
Source Project: java-n-IDE-for-Android   Source File: ConstantPoolEditor.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Finds or creates a DoubleConstant constant pool entry with the given
 * value.
 * @return the constant pool index of the DoubleConstant.
 */
public int addDoubleConstant(double value)
{
    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_Double)
        {
            DoubleConstant doubleConstant = (DoubleConstant)constant;
            if (doubleConstant.getValue() == value)
            {
                return index;
            }
        }
    }

    return addConstant(new DoubleConstant(value));
}
 
Example 10
Source Project: java-n-IDE-for-Android   Source File: BridgeMethodFixer.java    License: Apache License 2.0 6 votes vote down vote up
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    switch (constantInstruction.opcode)
    {
        case InstructionConstants.OP_INVOKEVIRTUAL:
        case InstructionConstants.OP_INVOKESPECIAL:
        case InstructionConstants.OP_INVOKESTATIC:
        case InstructionConstants.OP_INVOKEINTERFACE:
            // Get the name of the bridged method.
            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);

            // Check if the name is different.
            if (!method.getName(clazz).equals(bridgedMethodName))
            {
                if (DEBUG)
                {
                    System.out.println("BridgeMethodFixer: ["+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"] does not bridge to ["+bridgedMethodName+"]");
                }

                // Clear the bridge flag.
                ((ProgramMethod)method).u2accessFlags &= ~ClassConstants.INTERNAL_ACC_BRIDGE;
            }
            break;
    }
}
 
Example 11
Source Project: java-n-IDE-for-Android   Source File: ConstantPoolEditor.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Finds or creates a LongConstant constant pool entry with the given value.
 * @return the constant pool index of the LongConstant.
 */
public int addLongConstant(long value)
{
    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_Long)
        {
            LongConstant longConstant = (LongConstant)constant;
            if (longConstant.getValue() == value)
            {
                return index;
            }
        }
    }

    return addConstant(new LongConstant(value));
}
 
Example 12
/**
 * Returns the next type from the method descriptor.
 */
public String nextType()
{
    int startIndex = index;

    skipArray();

    char c = descriptor.charAt(index++);
    switch (c)
    {
        case ClassConstants.INTERNAL_TYPE_CLASS_START:
        case ClassConstants.INTERNAL_TYPE_GENERIC_VARIABLE_START:
        {
            skipClass();
            break;
        }
        case ClassConstants.INTERNAL_TYPE_GENERIC_START:
        {
            skipGeneric();
            break;
        }
    }

    return descriptor.substring(startIndex, index);
}
 
Example 13
public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
{
    // Check if this class entry is an array type.
    if (ClassUtil.isInternalArrayType(classConstant.getName(clazz)))
    {
        isInterfaceMethod = false;
    }
    else
    {
        // Check if this class entry refers to an interface class.
        Clazz referencedClass = classConstant.referencedClass;
        if (referencedClass != null)
        {
            isInterfaceMethod = (referencedClass.getAccessFlags() & ClassConstants.INTERNAL_ACC_INTERFACE) != 0;
        }
    }
}
 
Example 14
Source Project: java-n-IDE-for-Android   Source File: MemberPrivatizer.java    License: Apache License 2.0 6 votes vote down vote up
public void visitProgramField(ProgramClass programClass, ProgramField programField)
{
    // Is the field unmarked?
    if (NonPrivateMemberMarker.canBeMadePrivate(programField))
    {
        // Make the field private.
        programField.u2accessFlags =
            AccessUtil.replaceAccessFlags(programField.u2accessFlags,
                                          ClassConstants.INTERNAL_ACC_PRIVATE);

        // Visit the field, if required.
        if (extraMemberVisitor != null)
        {
            extraMemberVisitor.visitProgramField(programClass, programField);
        }
    }
}
 
Example 15
/**
 * Returns the next type from the method descriptor.
 */
public String nextType()
{
    int startIndex = index;

    skipArray();

    char c = descriptor.charAt(index++);
    switch (c)
    {
        case ClassConstants.TYPE_CLASS_START:
        case ClassConstants.TYPE_GENERIC_VARIABLE_START:
        {
            skipClass();
            break;
        }
        case ClassConstants.TYPE_GENERIC_START:
        {
            skipGeneric();
            break;
        }
    }

    return descriptor.substring(startIndex, index);
}
 
Example 16
public String nextType()
{
    int startIndex = index;

    // Find the next separating comma.
    index = descriptor.indexOf(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_SEPARATOR,
                               startIndex);

    // Otherwise find the closing parenthesis.
    if (index < 0)
    {
        index = descriptor.indexOf(ClassConstants.EXTERNAL_METHOD_ARGUMENTS_CLOSE,
                                   startIndex);
        if (index < 0)
        {
            throw new IllegalArgumentException("Missing closing parenthesis in descriptor ["+descriptor+"]");
        }
    }

    return descriptor.substring(startIndex, index++).trim();
}
 
Example 17
Source Project: java-n-IDE-for-Android   Source File: ProgramClassReader.java    License: Apache License 2.0 6 votes vote down vote up
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");
    }
}
 
Example 18
Source Project: java-n-IDE-for-Android   Source File: ConstantPoolEditor.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Finds or creates a IntegerConstant constant pool entry with the given
 * value.
 * @return the constant pool index of the Utf8Constant.
 */
public int addIntegerConstant(int value)
{
    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_Integer)
        {
            IntegerConstant integerConstant = (IntegerConstant)constant;
            if (integerConstant.getValue() == value)
            {
                return index;
            }
        }
    }

    return addConstant(new IntegerConstant(value));
}
 
Example 19
Source Project: java-n-IDE-for-Android   Source File: MappingPrinter.java    License: Apache License 2.0 6 votes vote down vote up
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
{
    // Special cases: <clinit> and <init> are always kept unchanged.
    // We can ignore them here.
    String name = programMethod.getName(programClass);
    if (name.equals(ClassConstants.INTERNAL_METHOD_NAME_CLINIT) ||
        name.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT))
    {
        return;
    }

    String newName = MemberObfuscator.newMemberName(programMethod);
    if (newName != null)
    {
        ps.println("    " +
                   lineNumberRange(programClass, programMethod) +
                   ClassUtil.externalFullMethodDescription(
                       programClass.getName(),
                       0,
                       programMethod.getName(programClass),
                       programMethod.getDescriptor(programClass)) +
                   " -> " +
                   newName);
    }
}
 
Example 20
Source Project: java-n-IDE-for-Android   Source File: MappingKeeper.java    License: Apache License 2.0 5 votes vote down vote up
public void processMethodMapping(String className,
                                 int    firstLineNumber,
                                 int    lastLineNumber,
                                 String methodReturnType,
                                 String methodName,
                                 String methodArguments,
                                 String newMethodName)
{
    if (clazz != null)
    {
        // Find the method.
        String descriptor = ClassUtil.internalMethodDescriptor(methodReturnType,
                                                               ListUtil.commaSeparatedList(methodArguments));

        Method method = clazz.findMethod(methodName, descriptor);
        if (method != null)
        {
            // Print out a warning if the mapping conflicts with a name that
            // was set before.
            if (warningPrinter != null)
            {
                String currentNewName = MemberObfuscator.newMemberName(method);
                if (currentNewName != null &&
                    !currentNewName.equals(newMethodName))
                {
                    warningPrinter.print(ClassUtil.internalClassName(className),
                                         "Warning: " +
                                         className +
                                         ": method '" + methodReturnType + " " + methodName + ClassConstants.EXTERNAL_METHOD_ARGUMENTS_OPEN + methodArguments + ClassConstants.EXTERNAL_METHOD_ARGUMENTS_CLOSE +
                                         "' is not being kept as '" + currentNewName +
                                         "', but remapped to '" + newMethodName + "'");
                }
            }

            // Make sure the mapping name will be kept.
            MemberObfuscator.setFixedNewMemberName(method, newMethodName);
        }
    }
}
 
Example 21
Source Project: java-n-IDE-for-Android   Source File: MemberAdder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns a unique class member name, based on the given name and descriptor.
 */
private String newUniqueMemberName(String name, String descriptor)
{
    return name.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT) ?
        ClassConstants.INTERNAL_METHOD_NAME_INIT :
        name + ClassConstants.SPECIAL_MEMBER_SEPARATOR + Long.toHexString(Math.abs((descriptor).hashCode()));
}
 
Example 22
Source Project: java-n-IDE-for-Android   Source File: DataEntryRewriter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Writes the given word to the given writer, after having adapted it,
 * based on the renamed class names.
 */
private void writeUpdatedWord(Writer writer, String word)
throws IOException
{
    if (word.length() > 0)
    {
        String newWord = word;

        boolean containsDots = word.indexOf('.') >= 0;

        // Replace dots by forward slashes.
        String className = containsDots ?
            word.replace('.', ClassConstants.INTERNAL_PACKAGE_SEPARATOR) :
            word;

        // Find the class corrsponding to the word.
        Clazz clazz = classPool.getClass(className);
        if (clazz != null)
        {
            // Update the word if necessary.
            String newClassName = clazz.getName();
            if (!className.equals(newClassName))
            {
                // Replace forward slashes by dots.
                newWord = containsDots ?
                    newClassName.replace(ClassConstants.INTERNAL_PACKAGE_SEPARATOR, '.') :
                    newClassName;
            }
        }

        writer.write(newWord);
    }
}
 
Example 23
Source Project: java-n-IDE-for-Android   Source File: DataEntryRenamer.java    License: Apache License 2.0 5 votes vote down vote up
public void read(DataEntry dataEntry) throws IOException
{
    String name = dataEntry.getName();

    // Add a directory separator if necessary.
    if (dataEntry.isDirectory() &&
        name.length() > 0)
    {
        name += ClassConstants.INTERNAL_PACKAGE_SEPARATOR;
    }

    String newName = (String)nameMap.get(name);
    if (newName != null)
    {
        // Remove the directory separator if necessary.
        if (dataEntry.isDirectory() &&
            newName.length() > 0)
        {
            newName = newName.substring(0, newName.length() -  1);
        }

        renamedDataEntryReader.read(new RenamedDataEntry(dataEntry, newName));
    }
    else if (missingDataEntryReader != null)
    {
        missingDataEntryReader.read(dataEntry);
    }
}
 
Example 24
Source Project: java-n-IDE-for-Android   Source File: ClassMerger.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns whether the given class would introduce any abstract methods
 * in the target class.
 */
private boolean introducesUnwantedAbstractMethods(Clazz        clazz,
                                                  ProgramClass targetClass)
{
    // It's ok if the target class is already abstract and it has at most
    // the class as a subclass.
    if ((targetClass.getAccessFlags() &
         (ClassConstants.INTERNAL_ACC_ABSTRACT |
          ClassConstants.INTERNAL_ACC_INTERFACE)) != 0 &&
        (targetClass.subClasses == null ||
         isOnlySubClass(clazz, targetClass)))
    {
        return false;
    }

    MemberCounter counter   = new MemberCounter();
    Set           targetSet = new HashSet();

    // Collect all abstract methods, and similar abstract methods in the
    // class hierarchy of the target class.
    clazz.methodsAccept(new MemberAccessFilter(ClassConstants.INTERNAL_ACC_ABSTRACT, 0,
                        new MultiMemberVisitor(new MemberVisitor[]
                        {
                            counter,
                            new SimilarMemberVisitor(targetClass, true, true, true, false,
                                                     new MemberAccessFilter(ClassConstants.INTERNAL_ACC_ABSTRACT, 0,
                                                     new MemberCollector(targetSet)))
                        })));

    return targetSet.size() < counter.getCount();
}
 
Example 25
Source Project: java-n-IDE-for-Android   Source File: ValueFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ReferenceValue for arrays of the given type and length,
 * containing the given element. The type must be a fully specified internal
 * type for primitives, classes, or arrays.
 */
public ReferenceValue createArrayReferenceValue(String       type,
                                                Clazz referencedClass,
                                                IntegerValue arrayLength,
                                                Value elementValue)
{
    return createReferenceValue(ClassConstants.INTERNAL_TYPE_ARRAY + type,
                                referencedClass,
                                false);
}
 
Example 26
Source Project: java-n-IDE-for-Android   Source File: ClassFilter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ClassFilter that delegates to either of the two given
 * readers.
 */
public ClassFilter(DataEntryReader classReader,
                   DataEntryReader dataEntryReader)
{
    super(new DataEntryNameFilter(
          new ExtensionMatcher(ClassConstants.CLASS_FILE_EXTENSION)),
          classReader,
          dataEntryReader);
}
 
Example 27
public void visitClassConstant(Clazz clazz, ClassConstant classConstant)
{
    // Create a Class reference instead of a reference to the class.
    value = valueFactory.createReferenceValue(ClassConstants.INTERNAL_NAME_JAVA_LANG_CLASS,
                                              classConstant.javaLangClassClass,
                                              false);
}
 
Example 28
/**
 * Checks whether the given access flags are valid field access flags,
 * throwing a ParseException if they aren't.
 */
private void checkFieldAccessFlags(int requiredSetMemberAccessFlags,
                                   int requiredUnsetMemberAccessFlags)
throws ParseException
{
    if (((requiredSetMemberAccessFlags |
          requiredUnsetMemberAccessFlags) &
        ~ClassConstants.VALID_INTERNAL_ACC_FIELD) != 0)
    {
        throw new ParseException("Invalid method access modifier for field before " +
                                 reader.locationDescription());
    }
}
 
Example 29
public void visitAnyClass(Clazz clazz)
{
    // Check the class itself.
    if ((clazz.getAccessFlags() & ClassConstants.INTERNAL_ACC_PUBLIC) == 0)
    {
        setPackageVisibleMembers(clazz);
    }
    else
    {
        // Check the members.
        clazz.fieldsAccept(this);
        clazz.methodsAccept(this);
    }
}
 
Example 30
Source Project: java-n-IDE-for-Android   Source File: ConstantPoolEditor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Finds or creates a InterfaceMethodrefConstant constant pool entry with the
 * given class constant pool entry index and name and type constant pool
 * entry index.
 * @return the constant pool index of the InterfaceMethodrefConstant.
 */
public int addInterfaceMethodrefConstant(int    classIndex,
                                         int    nameAndTypeIndex,
                                         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_InterfaceMethodref)
        {
            InterfaceMethodrefConstant methodrefConstant = (InterfaceMethodrefConstant)constant;
            if (methodrefConstant.u2classIndex       == classIndex &&
                methodrefConstant.u2nameAndTypeIndex == nameAndTypeIndex)
            {
                return index;
            }
        }
    }

    return addConstant(new InterfaceMethodrefConstant(classIndex,
                                                      nameAndTypeIndex,
                                                      referencedClass,
                                                      referencedMember));
}