Java Code Examples for proguard.classfile.util.ClassUtil#isInternalArrayType()

The following examples show how to use proguard.classfile.util.ClassUtil#isInternalArrayType() . 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: MethodInvocationFixer.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
public void visitAnyMethodrefConstant(Clazz clazz, RefConstant refConstant)
{
    // Remember the referenced class. Note that we're interested in the
    // class of the method reference, not in the class in which the
    // method was actually found, unless it is an array type.
    //
    if (ClassUtil.isInternalArrayType(refConstant.getClassName(clazz)))
    {
        // For an array type, the class will be java.lang.Object.
        referencedClass = refConstant.referencedClass;
    }
    else
    {
        clazz.constantPoolEntryAccept(refConstant.u2classIndex, this);
    }

    // Remember the referenced method.
    referencedMethodClass = refConstant.referencedClass;
    referencedMethod      = refConstant.referencedMember;
}
 
Example 2
Source File: MemberReferenceFixer.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
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 3
Source File: ReferenceValue.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the value of the array at the given index, assuming this type
 * is an array.
 */
public Value arrayLoad(IntegerValue integerValue, ValueFactory valueFactory)
{
    return
        type == null                         ? ValueFactory.REFERENCE_VALUE_NULL                        :
        !ClassUtil.isInternalArrayType(type) ? ValueFactory.REFERENCE_VALUE_JAVA_LANG_OBJECT_MAYBE_NULL :
                                               valueFactory.createValue(type.substring(1),
                                                                        referencedClass,
                                                                        true);
}
 
Example 4
Source File: ReferenceValue.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public final String internalType()
{
    return
        type == null                        ? ClassConstants.INTERNAL_TYPE_JAVA_LANG_OBJECT :
        ClassUtil.isInternalArrayType(type) ? type                                          :
                                              ClassConstants.INTERNAL_TYPE_CLASS_START +
                                              type +
                                              ClassConstants.INTERNAL_TYPE_CLASS_END;
}
 
Example 5
Source File: DetailedArrayReferenceValue.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new array reference value with the given ID.
 */
public DetailedArrayReferenceValue(String       type,
                                   Clazz        referencedClass,
                                   IntegerValue arrayLength,
                                   ValueFactory valuefactory,
                                   int          id)
{
    super(type, referencedClass, arrayLength, valuefactory, id);

    // Is the array short enough to analyze?
    if (arrayLength.isParticular() &&
        arrayLength.value() <= MAXIMUM_STORED_ARRAY_LENGTH)
    {
        // Initialize the values of the array.
        InitialValueFactory initialValueFactory =
            new InitialValueFactory(valuefactory);

        String elementType = ClassUtil.isInternalArrayType(type) ?
            type.substring(1) :
            type;

        this.values = new Value[arrayLength.value()];

        for (int index = 0; index < values.length; index++)
        {
            values[index] = initialValueFactory.createValue(elementType);
        }
    }
    else
    {
        // Just ignore the values of the array.
        this.values = null;
    }
}
 
Example 6
Source File: TypedReferenceValue.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
public ReferenceValue referenceArrayLoad(IntegerValue indexValue, ValueFactory valueFactory)
{
    return
        type == null                         ? ValueFactory.REFERENCE_VALUE_NULL                        :
        !ClassUtil.isInternalArrayType(type) ? ValueFactory.REFERENCE_VALUE_JAVA_LANG_OBJECT_MAYBE_NULL :
                                               valueFactory.createValue(type.substring(1),
                                                                        referencedClass,
                                                                        true).referenceValue();
}
 
Example 7
Source File: TypedReferenceValue.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
public final String internalType()
{
    return
        type == null                        ? ClassConstants.TYPE_JAVA_LANG_OBJECT :
        ClassUtil.isInternalArrayType(type) ? type                                 :
                                              ClassConstants.TYPE_CLASS_START +
                                              type +
                                              ClassConstants.TYPE_CLASS_END;
}
 
Example 8
Source File: DetailedArrayReferenceValue.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new array reference value with the given ID.
 */
public DetailedArrayReferenceValue(String       type,
                                   Clazz        referencedClass,
                                   IntegerValue arrayLength,
                                   ValueFactory valuefactory,
                                   int          id)
{
    super(type, referencedClass, arrayLength, valuefactory, id);

    // Is the array short enough to analyze?
    if (arrayLength.isParticular() &&
        arrayLength.value() <= MAXIMUM_STORED_ARRAY_LENGTH)
    {
        // Initialize the values of the array.
        InitialValueFactory initialValueFactory =
            new InitialValueFactory(valuefactory);

        String elementType = ClassUtil.isInternalArrayType(type) ?
            type.substring(1) :
            type;

        this.values = new Value[arrayLength.value()];

        for (int index = 0; index < values.length; index++)
        {
            values[index] = initialValueFactory.createValue(elementType);
        }
    }
    else
    {
        // Just ignore the values of the array.
        this.values = null;
    }
}
 
Example 9
Source File: TypedReferenceValue.java    From bazel with Apache License 2.0 5 votes vote down vote up
public ReferenceValue referenceArrayLoad(IntegerValue indexValue, ValueFactory valueFactory)
{
    return
        type == null                         ? ValueFactory.REFERENCE_VALUE_NULL                        :
        !ClassUtil.isInternalArrayType(type) ? ValueFactory.REFERENCE_VALUE_JAVA_LANG_OBJECT_MAYBE_NULL :
                                               valueFactory.createValue(type.substring(1),
                                                                        referencedClass,
                                                                        true).referenceValue();
}
 
Example 10
Source File: TypedReferenceValue.java    From bazel with Apache License 2.0 5 votes vote down vote up
public final String internalType()
{
    return
        type == null                        ? ClassConstants.TYPE_JAVA_LANG_OBJECT :
        ClassUtil.isInternalArrayType(type) ? type                                 :
                                              ClassConstants.TYPE_CLASS_START +
                                              type +
                                              ClassConstants.TYPE_CLASS_END;
}