Java Code Examples for proguard.classfile.constant.MethodrefConstant#getType()

The following examples show how to use proguard.classfile.constant.MethodrefConstant#getType() . 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 File: DynamicClassReferenceInitializer.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Checks whether the referenced method is a .class method.
 */
public void visitMethodrefConstant(Clazz clazz, MethodrefConstant methodrefConstant)
{
    String methodType = methodrefConstant.getType(clazz);

    // Do the method's class and type match?
    if (methodType.equals(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JAVAC) ||
        methodType.equals(ClassConstants.INTERNAL_METHOD_TYPE_DOT_CLASS_JIKES))
    {
        String methodName = methodrefConstant.getName(clazz);

        // Does the method's name match one of the special names?
        isClassForNameInvocation =
            methodName.equals(ClassConstants.INTERNAL_METHOD_NAME_DOT_CLASS_JAVAC) ||
            methodName.equals(ClassConstants.INTERNAL_METHOD_NAME_DOT_CLASS_JIKES);

        if (isClassForNameInvocation)
        {
            return;
        }

        String className = methodrefConstant.getClassName(clazz);

        // Note that we look for the class by name, since the referenced
        // class has not been initialized yet.
        Clazz referencedClass = programClassPool.getClass(className);
        if (referencedClass != null)
        {
            // Check if the code of the referenced method is .class code.
            // Note that we look for the method by name and type, since the
            // referenced method has not been initialized yet.
            referencedClass.methodAccept(methodName,
                                         methodType,
                                         new AllAttributeVisitor(this));
        }
    }
}
 
Example 2
Source File: DuplicateInitializerInvocationFixer.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitMethodrefConstant(Clazz clazz, MethodrefConstant methodrefConstant)
{
    // Check the referenced constructor descriptor.
    descriptor = methodrefConstant.getType(clazz);
    methodrefConstant.referencedMemberAccept(this);
}