Java Code Examples for proguard.classfile.ClassConstants#TYPE_CLASS_START

The following examples show how to use proguard.classfile.ClassConstants#TYPE_CLASS_START . 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: InternalTypeEnumeration.java    From proguard with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 2
Source File: InternalTypeEnumeration.java    From bazel with Apache License 2.0 6 votes vote down vote up
/**
 * 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 3
Source File: InitialValueFactory.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an initial value (0, 0L, 0.0f, 0.0, null) of the given type.
 */
public Value createValue(String type)
{
    switch (type.charAt(0))
    {
        case ClassConstants.TYPE_BOOLEAN:
        case ClassConstants.TYPE_BYTE:
        case ClassConstants.TYPE_CHAR:
        case ClassConstants.TYPE_SHORT:
        case ClassConstants.TYPE_INT:
            return valueFactory.createIntegerValue(0);

        case ClassConstants.TYPE_LONG:
            return valueFactory.createLongValue(0L);

        case ClassConstants.TYPE_FLOAT:
            return valueFactory.createFloatValue(0.0f);

        case ClassConstants.TYPE_DOUBLE:
            return valueFactory.createDoubleValue(0.0);

        case ClassConstants.TYPE_CLASS_START:
        case ClassConstants.TYPE_ARRAY:
            return valueFactory.createReferenceValueNull();

        default:
            throw new IllegalArgumentException("Invalid type ["+type+"]");
    }
}
 
Example 4
Source File: ClassNameParser.java    From proguard with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a StringMatcher that matches any type (class or primitive type,
 * array or non-array) and then the given matcher.
 */
private VariableStringMatcher createAnyTypeMatcher(StringMatcher nextMatcher)
{
    return new VariableStringMatcher(new char[] { ClassConstants.TYPE_ARRAY },
                              null,
                              0,
                              255,
    new OrMatcher(
    new VariableStringMatcher(INTERNAL_PRIMITIVE_TYPES,
                              null,
                              1,
                              1,
                              nextMatcher),
    new VariableStringMatcher(new char[] { ClassConstants.TYPE_CLASS_START },
                              null,
                              1,
                              1,
    new VariableStringMatcher(null,
                              new char[] { ClassConstants.TYPE_CLASS_END },
                              0,
                              Integer.MAX_VALUE,
    new VariableStringMatcher(new char[] { ClassConstants.TYPE_CLASS_END },
                              null,
                              1,
                              1,
                              nextMatcher)))));
}
 
Example 5
Source File: InitialValueFactory.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an initial value (0, 0L, 0.0f, 0.0, null) of the given type.
 */
public Value createValue(String type)
{
    switch (type.charAt(0))
    {
        case ClassConstants.TYPE_BOOLEAN:
        case ClassConstants.TYPE_BYTE:
        case ClassConstants.TYPE_CHAR:
        case ClassConstants.TYPE_SHORT:
        case ClassConstants.TYPE_INT:
            return valueFactory.createIntegerValue(0);

        case ClassConstants.TYPE_LONG:
            return valueFactory.createLongValue(0L);

        case ClassConstants.TYPE_FLOAT:
            return valueFactory.createFloatValue(0.0f);

        case ClassConstants.TYPE_DOUBLE:
            return valueFactory.createDoubleValue(0.0);

        case ClassConstants.TYPE_CLASS_START:
        case ClassConstants.TYPE_ARRAY:
            return valueFactory.createReferenceValueNull();

        default:
            throw new IllegalArgumentException("Invalid type ["+type+"]");
    }
}
 
Example 6
Source File: ClassNameParser.java    From bazel with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a StringMatcher that matches any type (class or primitive type,
 * array or non-array) and then the given matcher.
 */
private VariableStringMatcher createAnyTypeMatcher(StringMatcher nextMatcher)
{
    return new VariableStringMatcher(new char[] { ClassConstants.TYPE_ARRAY },
                              null,
                              0,
                              255,
    new OrMatcher(
    new VariableStringMatcher(INTERNAL_PRIMITIVE_TYPES,
                              null,
                              1,
                              1,
                              nextMatcher),
    new VariableStringMatcher(new char[] { ClassConstants.TYPE_CLASS_START },
                              null,
                              1,
                              1,
    new VariableStringMatcher(null,
                              new char[] { ClassConstants.TYPE_CLASS_END },
                              0,
                              Integer.MAX_VALUE,
    new VariableStringMatcher(new char[] { ClassConstants.TYPE_CLASS_END },
                              null,
                              1,
                              1,
                              nextMatcher)))));
}