Java Code Examples for proguard.classfile.ClassConstants#TYPE_CLASS_END

The following examples show how to use proguard.classfile.ClassConstants#TYPE_CLASS_END . 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
private void skipClass()
{
    while (true)
    {
        char c = descriptor.charAt(index++);
        switch (c)
        {
            case ClassConstants.TYPE_GENERIC_START:
                skipGeneric();
                break;

            case ClassConstants.TYPE_CLASS_END:
                return;
        }
    }
}
 
Example 2
Source File: InternalTypeEnumeration.java    From bazel with Apache License 2.0 6 votes vote down vote up
private void skipClass()
{
    while (true)
    {
        char c = descriptor.charAt(index++);
        switch (c)
        {
            case ClassConstants.TYPE_GENERIC_START:
                skipGeneric();
                break;

            case ClassConstants.TYPE_CLASS_END:
                return;
        }
    }
}
 
Example 3
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 4
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)))));
}
 
Example 5
Source File: ClassNameParser.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
public StringMatcher parse(String regularExpression)
{
    int           index;
    StringMatcher nextMatcher = new EmptyStringMatcher();

    // Look for wildcards.
    for (index = 0; index < regularExpression.length(); index++)
    {
        // Is there an 'L///;' wildcard?
        if (regularExpression.regionMatches(index, "L///;", 0, 5))
        {
            SettableMatcher settableMatcher = new SettableMatcher();

            // Create a matcher, recursively, for the remainder of the
            // string, optionally preceded by any type.
            nextMatcher =
                new OrMatcher(parse(regularExpression.substring(index + 5)),
                              createAnyTypeMatcher(settableMatcher));

            settableMatcher.setMatcher(nextMatcher);

            break;
        }

        // Is there an 'L***;' wildcard?
        if (regularExpression.regionMatches(index, "L***;", 0, 5))
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                createAnyTypeMatcher(parse(regularExpression.substring(index + 5)));
            break;
        }

        // Is there a '**' wildcard?
        if (regularExpression.regionMatches(index, "**", 0, 2))
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                new VariableStringMatcher(null,
                                          new char[] { ClassConstants.TYPE_CLASS_END },
                                          0,
                                          Integer.MAX_VALUE,
                                          parse(regularExpression.substring(index + 2)));
            break;
        }

        // Is there a '*' wildcard?
        else if (regularExpression.charAt(index) == '*')
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                new VariableStringMatcher(null,
                                          new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR },
                                          0,
                                          Integer.MAX_VALUE,
                                          parse(regularExpression.substring(index + 1)));
            break;
        }

        // Is there a '?' wildcard?
        else if (regularExpression.charAt(index) == '?')
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                new VariableStringMatcher(null,
                                          new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR },
                                          1,
                                          1,
                                          parse(regularExpression.substring(index + 1)));
            break;
        }

        // Is there a '%' wildcard?
        else if (regularExpression.charAt(index) == '%')
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                new VariableStringMatcher(INTERNAL_PRIMITIVE_TYPES,
                                          null,
                                          1,
                                          1,
                                          parse(regularExpression.substring(index + 1)));
            break;
        }
    }

    // Return a matcher for the fixed first part of the regular expression,
    // if any, and the remainder.
    return index != 0 ?
        (StringMatcher)new FixedStringMatcher(regularExpression.substring(0, index), nextMatcher) :
        (StringMatcher)nextMatcher;
}
 
Example 6
Source File: ClassNameParser.java    From bazel with Apache License 2.0 4 votes vote down vote up
public StringMatcher parse(String regularExpression)
{
    int           index;
    StringMatcher nextMatcher = new EmptyStringMatcher();

    // Look for wildcards.
    for (index = 0; index < regularExpression.length(); index++)
    {
        // Is there an 'L///;' wildcard?
        if (regularExpression.regionMatches(index, "L///;", 0, 5))
        {
            SettableMatcher settableMatcher = new SettableMatcher();

            // Create a matcher, recursively, for the remainder of the
            // string, optionally preceded by any type.
            nextMatcher =
                new OrMatcher(parse(regularExpression.substring(index + 5)),
                              createAnyTypeMatcher(settableMatcher));

            settableMatcher.setMatcher(nextMatcher);

            break;
        }

        // Is there an 'L***;' wildcard?
        if (regularExpression.regionMatches(index, "L***;", 0, 5))
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                createAnyTypeMatcher(parse(regularExpression.substring(index + 5)));
            break;
        }

        // Is there a '**' wildcard?
        if (regularExpression.regionMatches(index, "**", 0, 2))
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                new VariableStringMatcher(null,
                                          new char[] { ClassConstants.TYPE_CLASS_END },
                                          0,
                                          Integer.MAX_VALUE,
                                          parse(regularExpression.substring(index + 2)));
            break;
        }

        // Is there a '*' wildcard?
        else if (regularExpression.charAt(index) == '*')
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                new VariableStringMatcher(null,
                                          new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR },
                                          0,
                                          Integer.MAX_VALUE,
                                          parse(regularExpression.substring(index + 1)));
            break;
        }

        // Is there a '?' wildcard?
        else if (regularExpression.charAt(index) == '?')
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                new VariableStringMatcher(null,
                                          new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR },
                                          1,
                                          1,
                                          parse(regularExpression.substring(index + 1)));
            break;
        }

        // Is there a '%' wildcard?
        else if (regularExpression.charAt(index) == '%')
        {
            // Create a matcher for the wildcard and, recursively, for the
            // remainder of the string.
            nextMatcher =
                new VariableStringMatcher(INTERNAL_PRIMITIVE_TYPES,
                                          null,
                                          1,
                                          1,
                                          parse(regularExpression.substring(index + 1)));
            break;
        }
    }

    // Return a matcher for the fixed first part of the regular expression,
    // if any, and the remainder.
    return index != 0 ?
        (StringMatcher)new FixedStringMatcher(regularExpression.substring(0, index), nextMatcher) :
        (StringMatcher)nextMatcher;
}