Java Code Examples for sun.tools.java.ClassDefinition#getType()

The following examples show how to use sun.tools.java.ClassDefinition#getType() . 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: NCInterfaceType.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create an NCInterfaceType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static NCInterfaceType forNCInterface( ClassDefinition classDef,
                                              ContextStack stack) {
    if (stack.anyErrors()) return null;

    boolean doPop = false;
    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof NCInterfaceType)) return null; // False hit.

                            // Yep, so return it...

            return (NCInterfaceType) existing;
        }

        NCInterfaceType it = new NCInterfaceType(stack, classDef);
        putType(theType,it,stack);
        stack.push(it);
        doPop = true;

        if (it.initialize(stack)) {
            stack.pop(true);
            return it;
        } else {
            removeType(theType,stack);
            stack.pop(false);
            return null;
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
        return null;
    }
}
 
Example 2
Source File: NCInterfaceType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create an NCInterfaceType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static NCInterfaceType forNCInterface( ClassDefinition classDef,
                                              ContextStack stack) {
    if (stack.anyErrors()) return null;

    boolean doPop = false;
    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof NCInterfaceType)) return null; // False hit.

                            // Yep, so return it...

            return (NCInterfaceType) existing;
        }

        NCInterfaceType it = new NCInterfaceType(stack, classDef);
        putType(theType,it,stack);
        stack.push(it);
        doPop = true;

        if (it.initialize(stack)) {
            stack.pop(true);
            return it;
        } else {
            removeType(theType,stack);
            stack.pop(false);
            return null;
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
        return null;
    }
}
 
Example 3
Source File: NCInterfaceType.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create an NCInterfaceType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static NCInterfaceType forNCInterface( ClassDefinition classDef,
                                              ContextStack stack) {
    if (stack.anyErrors()) return null;

    boolean doPop = false;
    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof NCInterfaceType)) return null; // False hit.

                            // Yep, so return it...

            return (NCInterfaceType) existing;
        }

        NCInterfaceType it = new NCInterfaceType(stack, classDef);
        putType(theType,it,stack);
        stack.push(it);
        doPop = true;

        if (it.initialize(stack)) {
            stack.pop(true);
            return it;
        } else {
            removeType(theType,stack);
            stack.pop(false);
            return null;
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
        return null;
    }
}
 
Example 4
Source File: ValueType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an ValueType object for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static ValueType forValue(ClassDefinition classDef,
                                 ContextStack stack,
                                 boolean quiet) {

    if (stack.anyErrors()) return null;

    // Do we already have it?

    sun.tools.java.Type theType = classDef.getType();
    String typeKey = theType.toString();
    Type existing = getType(typeKey,stack);

    if (existing != null) {

        if (!(existing instanceof ValueType)) return null; // False hit.

        // Yep, so return it...

        return (ValueType) existing;
    }

    // Is this java.lang.Class?

    boolean javaLangClass = false;

    if (classDef.getClassDeclaration().getName() == idJavaLangClass) {

        // Yes, so replace classDef with one for
        // javax.rmi.CORBA.ClassDesc...

        javaLangClass = true;
        BatchEnvironment env = stack.getEnv();
        ClassDeclaration decl = env.getClassDeclaration(idClassDesc);
        ClassDefinition def = null;

        try {
            def = decl.getClassDefinition(env);
        } catch (ClassNotFound ex) {
            classNotFound(stack,ex);
            return null;
        }

        classDef = def;
    }

    // Could this be a value?

    if (couldBeValue(stack,classDef)) {

        // Yes, so check it...

        ValueType it = new ValueType(classDef,stack,javaLangClass);
        putType(typeKey,it,stack);
        stack.push(it);

        if (it.initialize(stack,quiet)) {
            stack.pop(true);
            return it;
        } else {
            removeType(typeKey,stack);
            stack.pop(false);
            return null;
        }
    } else {
        return null;
    }
}
 
Example 5
Source File: AbstractType.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an AbstractType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static AbstractType forAbstract(ClassDefinition classDef,
                                       ContextStack stack,
                                       boolean quiet)
{
    boolean doPop = false;
    AbstractType result = null;

    try {

        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof AbstractType)) return null; // False hit.

                            // Yep, so return it...

            return (AbstractType) existing;

        }

        // Could this be an abstract?

        if (couldBeAbstract(stack,classDef,quiet)) {

            // Yes, so try it...

            AbstractType it = new AbstractType(stack, classDef);
            putType(theType,it,stack);
            stack.push(it);
            doPop = true;

            if (it.initialize(quiet,stack)) {
                stack.pop(true);
                result = it;
            } else {
                removeType(theType,stack);
                stack.pop(false);
            }
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
    }

    return result;
}
 
Example 6
Source File: ImplementationType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an ImplementationType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static ImplementationType forImplementation(ClassDefinition classDef,
                                                   ContextStack stack,
                                                   boolean quiet) {
    if (stack.anyErrors()) return null;

    boolean doPop = false;
    ImplementationType result = null;

    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof ImplementationType)) return null; // False hit.

                            // Yep, so return it...

            return (ImplementationType) existing;

        }

        // Could this be an implementation?

        if (couldBeImplementation(quiet,stack,classDef)) {

            // Yes, so check it...

            ImplementationType it = new ImplementationType(stack, classDef);
            putType(theType,it,stack);
            stack.push(it);
            doPop = true;

            if (it.initialize(stack,quiet)) {
                stack.pop(true);
                result = it;
            } else {
                removeType(theType,stack);
                stack.pop(false);
            }
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
    }

    return result;
}
 
Example 7
Source File: SpecialInterfaceType.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a SpecialInterfaceType object for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static SpecialInterfaceType forSpecial ( ClassDefinition theClass,
                                                ContextStack stack) {

    if (stack.anyErrors()) return null;

    // Do we already have it?

    sun.tools.java.Type type = theClass.getType();
    Type existing = getType(type,stack);

    if (existing != null) {

        if (!(existing instanceof SpecialInterfaceType)) return null; // False hit.

        // Yep, so return it...

        return (SpecialInterfaceType) existing;
    }

    // Is it special?

    if (isSpecial(type,theClass,stack)) {

        // Yes...

        SpecialInterfaceType result = new SpecialInterfaceType(stack,0,theClass);
        putType(type,result,stack);
        stack.push(result);

        if (result.initialize(type,stack)) {
            stack.pop(true);
            return result;
        } else {
            removeType(type,stack);
            stack.pop(false);
            return null;
        }
    }
    return null;
}
 
Example 8
Source File: ValueType.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an ValueType object for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static ValueType forValue(ClassDefinition classDef,
                                 ContextStack stack,
                                 boolean quiet) {

    if (stack.anyErrors()) return null;

    // Do we already have it?

    sun.tools.java.Type theType = classDef.getType();
    String typeKey = theType.toString();
    Type existing = getType(typeKey,stack);

    if (existing != null) {

        if (!(existing instanceof ValueType)) return null; // False hit.

        // Yep, so return it...

        return (ValueType) existing;
    }

    // Is this java.lang.Class?

    boolean javaLangClass = false;

    if (classDef.getClassDeclaration().getName() == idJavaLangClass) {

        // Yes, so replace classDef with one for
        // javax.rmi.CORBA.ClassDesc...

        javaLangClass = true;
        BatchEnvironment env = stack.getEnv();
        ClassDeclaration decl = env.getClassDeclaration(idClassDesc);
        ClassDefinition def = null;

        try {
            def = decl.getClassDefinition(env);
        } catch (ClassNotFound ex) {
            classNotFound(stack,ex);
            return null;
        }

        classDef = def;
    }

    // Could this be a value?

    if (couldBeValue(stack,classDef)) {

        // Yes, so check it...

        ValueType it = new ValueType(classDef,stack,javaLangClass);
        putType(typeKey,it,stack);
        stack.push(it);

        if (it.initialize(stack,quiet)) {
            stack.pop(true);
            return it;
        } else {
            removeType(typeKey,stack);
            stack.pop(false);
            return null;
        }
    } else {
        return null;
    }
}
 
Example 9
Source File: NCClassType.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an NCClassType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static NCClassType forNCClass(ClassDefinition classDef,
                                     ContextStack stack) {

    if (stack.anyErrors()) return null;

    boolean doPop = false;
    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof NCClassType)) return null; // False hit.

                            // Yep, so return it...

            return (NCClassType) existing;

        }

        NCClassType it = new NCClassType(stack, classDef);
        putType(theType,it,stack);
        stack.push(it);
        doPop = true;

        if (it.initialize(stack)) {
            stack.pop(true);
            return it;
        } else {
            removeType(theType,stack);
            stack.pop(false);
            return null;
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
        return null;
    }
}
 
Example 10
Source File: ImplementationType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an ImplementationType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static ImplementationType forImplementation(ClassDefinition classDef,
                                                   ContextStack stack,
                                                   boolean quiet) {
    if (stack.anyErrors()) return null;

    boolean doPop = false;
    ImplementationType result = null;

    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof ImplementationType)) return null; // False hit.

                            // Yep, so return it...

            return (ImplementationType) existing;

        }

        // Could this be an implementation?

        if (couldBeImplementation(quiet,stack,classDef)) {

            // Yes, so check it...

            ImplementationType it = new ImplementationType(stack, classDef);
            putType(theType,it,stack);
            stack.push(it);
            doPop = true;

            if (it.initialize(stack,quiet)) {
                stack.pop(true);
                result = it;
            } else {
                removeType(theType,stack);
                stack.pop(false);
            }
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
    }

    return result;
}
 
Example 11
Source File: NCClassType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an NCClassType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static NCClassType forNCClass(ClassDefinition classDef,
                                     ContextStack stack) {

    if (stack.anyErrors()) return null;

    boolean doPop = false;
    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof NCClassType)) return null; // False hit.

                            // Yep, so return it...

            return (NCClassType) existing;

        }

        NCClassType it = new NCClassType(stack, classDef);
        putType(theType,it,stack);
        stack.push(it);
        doPop = true;

        if (it.initialize(stack)) {
            stack.pop(true);
            return it;
        } else {
            removeType(theType,stack);
            stack.pop(false);
            return null;
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
        return null;
    }
}
 
Example 12
Source File: RemoteType.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an RemoteType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static RemoteType forRemote(ClassDefinition classDef,
                                   ContextStack stack,
                                   boolean quiet) {

    if (stack.anyErrors()) return null;

    boolean doPop = false;
    RemoteType result = null;

    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof RemoteType)) return null; // False hit.

                            // Yep, so return it...

            return (RemoteType) existing;
        }

        // Could this be a remote type?

        if (couldBeRemote(quiet,stack,classDef)) {

            // Yes, so check it...

            RemoteType it = new RemoteType(stack,classDef);
            putType(theType,it,stack);
            stack.push(it);
            doPop = true;

            if (it.initialize(quiet,stack)) {
                stack.pop(true);
                result = it;
            } else {
                removeType(theType,stack);
                stack.pop(false);
            }
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
    }

    return result;
}
 
Example 13
Source File: SpecialInterfaceType.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a SpecialInterfaceType object for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static SpecialInterfaceType forSpecial ( ClassDefinition theClass,
                                                ContextStack stack) {

    if (stack.anyErrors()) return null;

    // Do we already have it?

    sun.tools.java.Type type = theClass.getType();
    Type existing = getType(type,stack);

    if (existing != null) {

        if (!(existing instanceof SpecialInterfaceType)) return null; // False hit.

        // Yep, so return it...

        return (SpecialInterfaceType) existing;
    }

    // Is it special?

    if (isSpecial(type,theClass,stack)) {

        // Yes...

        SpecialInterfaceType result = new SpecialInterfaceType(stack,0,theClass);
        putType(type,result,stack);
        stack.push(result);

        if (result.initialize(type,stack)) {
            stack.pop(true);
            return result;
        } else {
            removeType(type,stack);
            stack.pop(false);
            return null;
        }
    }
    return null;
}
 
Example 14
Source File: RemoteType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an RemoteType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static RemoteType forRemote(ClassDefinition classDef,
                                   ContextStack stack,
                                   boolean quiet) {

    if (stack.anyErrors()) return null;

    boolean doPop = false;
    RemoteType result = null;

    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof RemoteType)) return null; // False hit.

                            // Yep, so return it...

            return (RemoteType) existing;
        }

        // Could this be a remote type?

        if (couldBeRemote(quiet,stack,classDef)) {

            // Yes, so check it...

            RemoteType it = new RemoteType(stack,classDef);
            putType(theType,it,stack);
            stack.push(it);
            doPop = true;

            if (it.initialize(quiet,stack)) {
                stack.pop(true);
                result = it;
            } else {
                removeType(theType,stack);
                stack.pop(false);
            }
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
    }

    return result;
}
 
Example 15
Source File: SpecialInterfaceType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a SpecialInterfaceType object for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static SpecialInterfaceType forSpecial ( ClassDefinition theClass,
                                                ContextStack stack) {

    if (stack.anyErrors()) return null;

    // Do we already have it?

    sun.tools.java.Type type = theClass.getType();
    Type existing = getType(type,stack);

    if (existing != null) {

        if (!(existing instanceof SpecialInterfaceType)) return null; // False hit.

        // Yep, so return it...

        return (SpecialInterfaceType) existing;
    }

    // Is it special?

    if (isSpecial(type,theClass,stack)) {

        // Yes...

        SpecialInterfaceType result = new SpecialInterfaceType(stack,0,theClass);
        putType(type,result,stack);
        stack.push(result);

        if (result.initialize(type,stack)) {
            stack.pop(true);
            return result;
        } else {
            removeType(type,stack);
            stack.pop(false);
            return null;
        }
    }
    return null;
}
 
Example 16
Source File: AbstractType.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an AbstractType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static AbstractType forAbstract(ClassDefinition classDef,
                                       ContextStack stack,
                                       boolean quiet)
{
    boolean doPop = false;
    AbstractType result = null;

    try {

        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof AbstractType)) return null; // False hit.

                            // Yep, so return it...

            return (AbstractType) existing;

        }

        // Could this be an abstract?

        if (couldBeAbstract(stack,classDef,quiet)) {

            // Yes, so try it...

            AbstractType it = new AbstractType(stack, classDef);
            putType(theType,it,stack);
            stack.push(it);
            doPop = true;

            if (it.initialize(quiet,stack)) {
                stack.pop(true);
                result = it;
            } else {
                removeType(theType,stack);
                stack.pop(false);
            }
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
    }

    return result;
}
 
Example 17
Source File: NCClassType.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an NCClassType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static NCClassType forNCClass(ClassDefinition classDef,
                                     ContextStack stack) {

    if (stack.anyErrors()) return null;

    boolean doPop = false;
    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof NCClassType)) return null; // False hit.

                            // Yep, so return it...

            return (NCClassType) existing;

        }

        NCClassType it = new NCClassType(stack, classDef);
        putType(theType,it,stack);
        stack.push(it);
        doPop = true;

        if (it.initialize(stack)) {
            stack.pop(true);
            return it;
        } else {
            removeType(theType,stack);
            stack.pop(false);
            return null;
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
        return null;
    }
}
 
Example 18
Source File: AbstractType.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an AbstractType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static AbstractType forAbstract(ClassDefinition classDef,
                                       ContextStack stack,
                                       boolean quiet)
{
    boolean doPop = false;
    AbstractType result = null;

    try {

        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof AbstractType)) return null; // False hit.

                            // Yep, so return it...

            return (AbstractType) existing;

        }

        // Could this be an abstract?

        if (couldBeAbstract(stack,classDef,quiet)) {

            // Yes, so try it...

            AbstractType it = new AbstractType(stack, classDef);
            putType(theType,it,stack);
            stack.push(it);
            doPop = true;

            if (it.initialize(quiet,stack)) {
                stack.pop(true);
                result = it;
            } else {
                removeType(theType,stack);
                stack.pop(false);
            }
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
    }

    return result;
}
 
Example 19
Source File: ImplementationType.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an ImplementationType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static ImplementationType forImplementation(ClassDefinition classDef,
                                                   ContextStack stack,
                                                   boolean quiet) {
    if (stack.anyErrors()) return null;

    boolean doPop = false;
    ImplementationType result = null;

    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof ImplementationType)) return null; // False hit.

                            // Yep, so return it...

            return (ImplementationType) existing;

        }

        // Could this be an implementation?

        if (couldBeImplementation(quiet,stack,classDef)) {

            // Yes, so check it...

            ImplementationType it = new ImplementationType(stack, classDef);
            putType(theType,it,stack);
            stack.push(it);
            doPop = true;

            if (it.initialize(stack,quiet)) {
                stack.pop(true);
                result = it;
            } else {
                removeType(theType,stack);
                stack.pop(false);
            }
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
    }

    return result;
}
 
Example 20
Source File: SpecialInterfaceType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a SpecialInterfaceType object for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static SpecialInterfaceType forSpecial ( ClassDefinition theClass,
                                                ContextStack stack) {

    if (stack.anyErrors()) return null;

    // Do we already have it?

    sun.tools.java.Type type = theClass.getType();
    Type existing = getType(type,stack);

    if (existing != null) {

        if (!(existing instanceof SpecialInterfaceType)) return null; // False hit.

        // Yep, so return it...

        return (SpecialInterfaceType) existing;
    }

    // Is it special?

    if (isSpecial(type,theClass,stack)) {

        // Yes...

        SpecialInterfaceType result = new SpecialInterfaceType(stack,0,theClass);
        putType(type,result,stack);
        stack.push(result);

        if (result.initialize(type,stack)) {
            stack.pop(true);
            return result;
        } else {
            removeType(type,stack);
            stack.pop(false);
            return null;
        }
    }
    return null;
}