Java Code Examples for proguard.classfile.ClassConstants#INTERNAL_TYPE_VOID

The following examples show how to use proguard.classfile.ClassConstants#INTERNAL_TYPE_VOID . 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: ValueFactory.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new Value of the given type.
 * The type must be a fully specified internal type for primitives, classes,
 * or arrays.
 */
public Value createValue(String type, Clazz referencedClass, boolean mayBeNull)
{
    switch (type.charAt(0))
    {
        case ClassConstants.INTERNAL_TYPE_VOID:    return null;
        case ClassConstants.INTERNAL_TYPE_BOOLEAN:
        case ClassConstants.INTERNAL_TYPE_BYTE:
        case ClassConstants.INTERNAL_TYPE_CHAR:
        case ClassConstants.INTERNAL_TYPE_SHORT:
        case ClassConstants.INTERNAL_TYPE_INT:     return createIntegerValue();
        case ClassConstants.INTERNAL_TYPE_LONG:    return createLongValue();
        case ClassConstants.INTERNAL_TYPE_FLOAT:   return createFloatValue();
        case ClassConstants.INTERNAL_TYPE_DOUBLE:  return createDoubleValue();
        default:                                   return createReferenceValue(ClassUtil.isInternalArrayType(type) ?
                                                                                   type :
                                                                                   ClassUtil.internalClassNameFromClassType(type),
                                                                               referencedClass,
                                                                               mayBeNull);
    }
}
 
Example 3
Source File: ClassUtil.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the size taken up on the stack by the given internal type.
 * The size is 1, except for long and double types, for which it is 2,
 * and for the void type, for which 0 is returned.
 * @param internalType the internal type,
 *                     e.g. "<code>I</code>".
 * @return the size taken up on the stack,
 *                     e.g. 1.
 */
public static int internalTypeSize(String internalType)
{
    if (internalType.length() == 1)
    {
        char internalPrimitiveType = internalType.charAt(0);
        if      (internalPrimitiveType == ClassConstants.INTERNAL_TYPE_LONG ||
                 internalPrimitiveType == ClassConstants.INTERNAL_TYPE_DOUBLE)
        {
            return 2;
        }
        else if (internalPrimitiveType == ClassConstants.INTERNAL_TYPE_VOID)
        {
            return 0;
        }
    }

    return 1;
}