Java Code Examples for proguard.classfile.ClassConstants#TYPE_GENERIC_START

The following examples show how to use proguard.classfile.ClassConstants#TYPE_GENERIC_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 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 3
Source File: InternalTypeEnumeration.java    From proguard with GNU General Public License v2.0 6 votes vote down vote up
private void skipGeneric()
{
    int nestingLevel = 1;

    do
    {
        char c = descriptor.charAt(index++);
        switch (c)
        {
            case ClassConstants.TYPE_GENERIC_START:
                nestingLevel++;
                break;

            case ClassConstants.TYPE_GENERIC_END:
                nestingLevel--;
                break;
        }
    }
    while (nestingLevel > 0);
}
 
Example 4
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 5
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 6
Source File: InternalTypeEnumeration.java    From bazel with Apache License 2.0 6 votes vote down vote up
private void skipGeneric()
{
    int nestingLevel = 1;

    do
    {
        char c = descriptor.charAt(index++);
        switch (c)
        {
            case ClassConstants.TYPE_GENERIC_START:
                nestingLevel++;
                break;

            case ClassConstants.TYPE_GENERIC_END:
                nestingLevel--;
                break;
        }
    }
    while (nestingLevel > 0);
}
 
Example 7
Source File: InternalTypeEnumeration.java    From proguard with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new InternalTypeEnumeration for the given method descriptor.
 */
public InternalTypeEnumeration(String descriptor)
{
    this.descriptor = descriptor;

    // Find any formal type parameters.
    if (descriptor.charAt(0) == ClassConstants.TYPE_GENERIC_START)
    {
        formalTypeParametersIndex = 1;

        int nestingLevel = 1;
        do
        {
            char c = descriptor.charAt(formalTypeParametersIndex++);
            switch (c)
            {
                case ClassConstants.TYPE_GENERIC_START:
                {
                    nestingLevel++;
                    break;
                }
                case ClassConstants.TYPE_GENERIC_END:
                {
                    nestingLevel--;
                    break;
                }
            }
        }
        while (nestingLevel > 0);
    }

    this.openIndex  = descriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_OPEN,
                                         formalTypeParametersIndex);

    this.closeIndex = openIndex >= 0 ?
        descriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_CLOSE, openIndex) :
        descriptor.length();

    this.index = openIndex >= 0 ?
        openIndex + 1 :
        formalTypeParametersIndex;
}
 
Example 8
Source File: InternalTypeEnumeration.java    From bazel with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new InternalTypeEnumeration for the given method descriptor.
 */
public InternalTypeEnumeration(String descriptor)
{
    this.descriptor = descriptor;

    // Find any formal type parameters.
    if (descriptor.charAt(0) == ClassConstants.TYPE_GENERIC_START)
    {
        formalTypeParametersIndex = 1;

        int nestingLevel = 1;
        do
        {
            char c = descriptor.charAt(formalTypeParametersIndex++);
            switch (c)
            {
                case ClassConstants.TYPE_GENERIC_START:
                {
                    nestingLevel++;
                    break;
                }
                case ClassConstants.TYPE_GENERIC_END:
                {
                    nestingLevel--;
                    break;
                }
            }
        }
        while (nestingLevel > 0);
    }

    this.openIndex  = descriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_OPEN,
                                         formalTypeParametersIndex);

    this.closeIndex = openIndex >= 0 ?
        descriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_CLOSE, openIndex) :
        descriptor.length();

    this.index = openIndex >= 0 ?
        openIndex + 1 :
        formalTypeParametersIndex;
}