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

The following examples show how to use proguard.classfile.constant.RefConstant#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: BasicInvocationUnit.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitAnyMethodrefConstant(Clazz clazz, RefConstant methodrefConstant)
{
    String type = methodrefConstant.getType(clazz);

    // Count the number of parameters.
    int parameterCount = ClassUtil.internalMethodParameterCount(type);
    if (!isStatic)
    {
        parameterCount++;
    }

    // Pop the parameters and the class reference, in reverse order.
    for (int parameterIndex = parameterCount-1; parameterIndex >= 0; parameterIndex--)
    {
        setMethodParameterValue(clazz, methodrefConstant, parameterIndex, stack.pop());
    }

    // Push the return value, if applicable.
    String returnType = ClassUtil.internalMethodReturnType(type);
    if (returnType.charAt(0) != ClassConstants.INTERNAL_TYPE_VOID)
    {
        stack.push(getMethodReturnValue(clazz, methodrefConstant, returnType));
    }
}
 
Example 2
Source File: ConstantInstruction.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private void visitRefConstant(Clazz clazz, RefConstant methodrefConstant)
{
    String type = methodrefConstant.getType(clazz);

    parameterStackDelta = ClassUtil.internalMethodParameterSize(type);
    typeStackDelta      = ClassUtil.internalTypeSize(ClassUtil.internalMethodReturnType(type));
}
 
Example 3
Source File: ClassReferenceInitializer.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
public void visitAnyRefConstant(Clazz clazz, RefConstant refConstant)
{
    String className = refConstant.getClassName(clazz);

    // Methods for array types should be found in the Object class.
    if (ClassUtil.isInternalArrayType(className))
    {
        className = ClassConstants.INTERNAL_NAME_JAVA_LANG_OBJECT;
    }

    // See if we can find the referenced class.
    // Unresolved references are assumed to refer to library classes
    // that will not change anyway.
    Clazz referencedClass = findClass(clazz.getName(), className);

    if (referencedClass != null)
    {
        String name = refConstant.getName(clazz);
        String type = refConstant.getType(clazz);

        boolean isFieldRef = refConstant.getTag() == ClassConstants.CONSTANT_Fieldref;

        // See if we can find the referenced class member somewhere in the
        // hierarchy.
        refConstant.referencedMember = memberFinder.findMember(clazz,
                                                               referencedClass,
                                                               name,
                                                               type,
                                                               isFieldRef);
        refConstant.referencedClass  = memberFinder.correspondingClass();

        if (refConstant.referencedMember == null)
        {
            // We haven't found the class member anywhere in the hierarchy.
            missingMemberWarningPrinter.print(clazz.getName(),
                                              className,
                                              "Warning: " +
                                              ClassUtil.externalClassName(clazz.getName()) +
                                              ": can't find referenced " +
                                              (isFieldRef ?
                                                  "field '"  + ClassUtil.externalFullFieldDescription(0, name, type) :
                                                  "method '" + ClassUtil.externalFullMethodDescription(className, 0, name, type)) +
                                              "' in class " +
                                              ClassUtil.externalClassName(className));
        }
    }
}