sun.tools.java.CompilerError Java Examples
The following examples show how to use
sun.tools.java.CompilerError.
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: PrimitiveType.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * IDL_Naming * Create an PrimitiveType instance for the given class. */ private PrimitiveType(ContextStack stack, int typeCode) { super(stack,typeCode | TM_PRIMITIVE); // Validate type and set names... String idlName = IDLNames.getTypeName(typeCode,false); Identifier id = null; switch (typeCode) { case TYPE_VOID: id = idVoid; break; case TYPE_BOOLEAN: id = idBoolean; break; case TYPE_BYTE: id = idByte; break; case TYPE_CHAR: id = idChar; break; case TYPE_SHORT: id = idShort; break; case TYPE_INT: id = idInt; break; case TYPE_LONG: id = idLong; break; case TYPE_FLOAT: id = idFloat; break; case TYPE_DOUBLE: id = idDouble; break; default: throw new CompilerError("Not a primitive type"); } setNames(id,null,idlName); setRepositoryID(); }
Example #2
Source File: ClassType.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected boolean initParents(ContextStack stack) { stack.setNewContextCode(ContextStack.EXTENDS); BatchEnvironment env = stack.getEnv(); // Init parent... boolean result = true; try { ClassDeclaration parentDecl = getClassDefinition().getSuperClass(env); if (parentDecl != null) { ClassDefinition parentDef = parentDecl.getClassDefinition(env); parent = (ClassType) makeType(parentDef.getType(),parentDef,stack); if (parent == null) { result = false; } } } catch (ClassNotFound e) { classNotFound(stack,e); throw new CompilerError("ClassType constructor"); } return result; }
Example #3
Source File: PrimitiveType.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * IDL_Naming * Create an PrimitiveType instance for the given class. */ private PrimitiveType(ContextStack stack, int typeCode) { super(stack,typeCode | TM_PRIMITIVE); // Validate type and set names... String idlName = IDLNames.getTypeName(typeCode,false); Identifier id = null; switch (typeCode) { case TYPE_VOID: id = idVoid; break; case TYPE_BOOLEAN: id = idBoolean; break; case TYPE_BYTE: id = idByte; break; case TYPE_CHAR: id = idChar; break; case TYPE_SHORT: id = idShort; break; case TYPE_INT: id = idInt; break; case TYPE_LONG: id = idLong; break; case TYPE_FLOAT: id = idFloat; break; case TYPE_DOUBLE: id = idDouble; break; default: throw new CompilerError("Not a primitive type"); } setNames(id,null,idlName); setRepositoryID(); }
Example #4
Source File: ClassType.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected boolean initParents(ContextStack stack) { stack.setNewContextCode(ContextStack.EXTENDS); BatchEnvironment env = stack.getEnv(); // Init parent... boolean result = true; try { ClassDeclaration parentDecl = getClassDefinition().getSuperClass(env); if (parentDecl != null) { ClassDefinition parentDef = parentDecl.getClassDefinition(env); parent = (ClassType) makeType(parentDef.getType(),parentDef,stack); if (parent == null) { result = false; } } } catch (ClassNotFound e) { classNotFound(stack,e); throw new CompilerError("ClassType constructor"); } return result; }
Example #5
Source File: PrimitiveType.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * IDL_Naming * Create an PrimitiveType instance for the given class. */ private PrimitiveType(ContextStack stack, int typeCode) { super(stack,typeCode | TM_PRIMITIVE); // Validate type and set names... String idlName = IDLNames.getTypeName(typeCode,false); Identifier id = null; switch (typeCode) { case TYPE_VOID: id = idVoid; break; case TYPE_BOOLEAN: id = idBoolean; break; case TYPE_BYTE: id = idByte; break; case TYPE_CHAR: id = idChar; break; case TYPE_SHORT: id = idShort; break; case TYPE_INT: id = idInt; break; case TYPE_LONG: id = idLong; break; case TYPE_FLOAT: id = idFloat; break; case TYPE_DOUBLE: id = idDouble; break; default: throw new CompilerError("Not a primitive type"); } setNames(id,null,idlName); setRepositoryID(); }
Example #6
Source File: PrimitiveType.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * IDL_Naming * Create an PrimitiveType instance for the given class. */ private PrimitiveType(ContextStack stack, int typeCode) { super(stack,typeCode | TM_PRIMITIVE); // Validate type and set names... String idlName = IDLNames.getTypeName(typeCode,false); Identifier id = null; switch (typeCode) { case TYPE_VOID: id = idVoid; break; case TYPE_BOOLEAN: id = idBoolean; break; case TYPE_BYTE: id = idByte; break; case TYPE_CHAR: id = idChar; break; case TYPE_SHORT: id = idShort; break; case TYPE_INT: id = idInt; break; case TYPE_LONG: id = idLong; break; case TYPE_FLOAT: id = idFloat; break; case TYPE_DOUBLE: id = idDouble; break; default: throw new CompilerError("Not a primitive type"); } setNames(id,null,idlName); setRepositoryID(); }
Example #7
Source File: ClassType.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected boolean initParents(ContextStack stack) { stack.setNewContextCode(ContextStack.EXTENDS); BatchEnvironment env = stack.getEnv(); // Init parent... boolean result = true; try { ClassDeclaration parentDecl = getClassDefinition().getSuperClass(env); if (parentDecl != null) { ClassDefinition parentDef = parentDecl.getClassDefinition(env); parent = (ClassType) makeType(parentDef.getType(),parentDef,stack); if (parent == null) { result = false; } } } catch (ClassNotFound e) { classNotFound(stack,e); throw new CompilerError("ClassType constructor"); } return result; }
Example #8
Source File: ClassType.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
protected boolean initParents(ContextStack stack) { stack.setNewContextCode(ContextStack.EXTENDS); BatchEnvironment env = stack.getEnv(); // Init parent... boolean result = true; try { ClassDeclaration parentDecl = getClassDefinition().getSuperClass(env); if (parentDecl != null) { ClassDefinition parentDef = parentDecl.getClassDefinition(env); parent = (ClassType) makeType(parentDef.getType(),parentDef,stack); if (parent == null) { result = false; } } } catch (ClassNotFound e) { classNotFound(stack,e); throw new CompilerError("ClassType constructor"); } return result; }
Example #9
Source File: PrimitiveType.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected Class loadClass() { switch (getTypeCode()) { case TYPE_VOID: return Null.class; case TYPE_BOOLEAN: return boolean.class; case TYPE_BYTE: return byte.class; case TYPE_CHAR: return char.class; case TYPE_SHORT: return short.class; case TYPE_INT: return int.class; case TYPE_LONG: return long.class; case TYPE_FLOAT: return float.class; case TYPE_DOUBLE: return double.class; default: throw new CompilerError("Not a primitive type"); } }
Example #10
Source File: InterfaceType.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Create a InterfaceType instance for the given class. The resulting * object is not yet completely initialized. Subclasses must call * initialize(directInterfaces,directInterfaces,directConstants); */ protected InterfaceType(ContextStack stack, ClassDefinition classDef, int typeCode) { super(stack,classDef,typeCode); if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) { throw new CompilerError("Not an interface"); } }
Example #11
Source File: NCInterfaceType.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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 #12
Source File: ClassType.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Create a ClassType instance for the given class. NOTE: This constructor * is ONLY for SpecialClassType. */ protected ClassType(ContextStack stack, int typeCode, ClassDefinition classDef) { super(stack,typeCode,classDef); // Call special parent constructor. if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) { throw new CompilerError("Not a class"); } parent = null; }
Example #13
Source File: ClassType.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Create a ClassType instance for the given class. NOTE: This constructor * is ONLY for ImplementationType. It does not walk the parent chain. */ protected ClassType(int typeCode, ClassDefinition classDef,ContextStack stack) { super(stack,classDef,typeCode); if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) { throw new CompilerError("Not a class"); } parent = null; }
Example #14
Source File: InterfaceType.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Create a InterfaceType instance for the given class. NOTE: This constructor * is ONLY for SpecialInterfaceType. */ protected InterfaceType(ContextStack stack, int typeCode, ClassDefinition classDef) { super(stack,typeCode,classDef); // Call special parent constructor. if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) { throw new CompilerError("Not an interface"); } }
Example #15
Source File: ClassType.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Create an ClassType instance for the given class. The resulting * object is not yet completely initialized. Subclasses must call * initialize(directInterfaces,directInterfaces,directConstants); */ protected ClassType(ContextStack stack, ClassDefinition classDef, int typeCode) { super(stack,classDef,typeCode); if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) { throw new CompilerError("Not a class"); } parent = null; }
Example #16
Source File: InterfaceType.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Create a InterfaceType instance for the given class. The resulting * object is not yet completely initialized. Subclasses must call * initialize(directInterfaces,directInterfaces,directConstants); */ protected InterfaceType(ContextStack stack, ClassDefinition classDef, int typeCode) { super(stack,classDef,typeCode); if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) { throw new CompilerError("Not an interface"); } }
Example #17
Source File: InterfaceType.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Create a InterfaceType instance for the given class. NOTE: This constructor * is ONLY for SpecialInterfaceType. */ protected InterfaceType(ContextStack stack, int typeCode, ClassDefinition classDef) { super(stack,typeCode,classDef); // Call special parent constructor. if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) { throw new CompilerError("Not an interface"); } }
Example #18
Source File: ContextStack.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Pop an element from the stack. * @return the new current element or null if top. */ public TypeContext pop (boolean wasValid) { if (currentIndex < 0) { throw new CompilerError("Nothing on stack!"); } newCode = stack[currentIndex].getCode(); traceln(toResultString(stack[currentIndex],wasValid,false)); Type last = stack[currentIndex].getCandidateType(); if (last != null) { // Set status... if (wasValid) { last.setStatus(Constants.STATUS_VALID); } else { last.setStatus(Constants.STATUS_INVALID); } } currentIndex--; if (currentIndex < 0) { // Done parsing, so update the invalid types // if this type was valid... if (wasValid) { Type.updateAllInvalidTypes(this); } return null; } else { return stack[currentIndex]; } }
Example #19
Source File: ClassType.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Create a ClassType instance for the given class. NOTE: This constructor * is ONLY for ImplementationType. It does not walk the parent chain. */ protected ClassType(int typeCode, ClassDefinition classDef,ContextStack stack) { super(stack,classDef,typeCode); if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) { throw new CompilerError("Not a class"); } parent = null; }
Example #20
Source File: ContextStack.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Pop an element from the stack. * @return the new current element or null if top. */ public TypeContext pop (boolean wasValid) { if (currentIndex < 0) { throw new CompilerError("Nothing on stack!"); } newCode = stack[currentIndex].getCode(); traceln(toResultString(stack[currentIndex],wasValid,false)); Type last = stack[currentIndex].getCandidateType(); if (last != null) { // Set status... if (wasValid) { last.setStatus(Constants.STATUS_VALID); } else { last.setStatus(Constants.STATUS_INVALID); } } currentIndex--; if (currentIndex < 0) { // Done parsing, so update the invalid types // if this type was valid... if (wasValid) { Type.updateAllInvalidTypes(this); } return null; } else { return stack[currentIndex]; } }
Example #21
Source File: InterfaceType.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Create a InterfaceType instance for the given class. NOTE: This constructor * is ONLY for SpecialInterfaceType. */ protected InterfaceType(ContextStack stack, int typeCode, ClassDefinition classDef) { super(stack,typeCode,classDef); // Call special parent constructor. if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) { throw new CompilerError("Not an interface"); } }
Example #22
Source File: InterfaceType.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Create a InterfaceType instance for the given class. The resulting * object is not yet completely initialized. Subclasses must call * initialize(directInterfaces,directInterfaces,directConstants); */ protected InterfaceType(ContextStack stack, ClassDefinition classDef, int typeCode) { super(stack,classDef,typeCode); if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) { throw new CompilerError("Not an interface"); } }
Example #23
Source File: PrimitiveType.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected Class loadClass() { switch (getTypeCode()) { case TYPE_VOID: return Null.class; case TYPE_BOOLEAN: return boolean.class; case TYPE_BYTE: return byte.class; case TYPE_CHAR: return char.class; case TYPE_SHORT: return short.class; case TYPE_INT: return int.class; case TYPE_LONG: return long.class; case TYPE_FLOAT: return float.class; case TYPE_DOUBLE: return double.class; default: throw new CompilerError("Not a primitive type"); } }
Example #24
Source File: PrimitiveType.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected Class loadClass() { switch (getTypeCode()) { case TYPE_VOID: return Null.class; case TYPE_BOOLEAN: return boolean.class; case TYPE_BYTE: return byte.class; case TYPE_CHAR: return char.class; case TYPE_SHORT: return short.class; case TYPE_INT: return int.class; case TYPE_LONG: return long.class; case TYPE_FLOAT: return float.class; case TYPE_DOUBLE: return double.class; default: throw new CompilerError("Not a primitive type"); } }
Example #25
Source File: NCInterfaceType.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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 #26
Source File: ClassType.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Create a ClassType instance for the given class. NOTE: This constructor * is ONLY for ImplementationType. It does not walk the parent chain. */ protected ClassType(int typeCode, ClassDefinition classDef,ContextStack stack) { super(stack,classDef,typeCode); if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) { throw new CompilerError("Not a class"); } parent = null; }
Example #27
Source File: ClassType.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Create an ClassType instance for the given class. The resulting * object is not yet completely initialized. Subclasses must call * initialize(directInterfaces,directInterfaces,directConstants); */ protected ClassType(ContextStack stack, ClassDefinition classDef, int typeCode) { super(stack,classDef,typeCode); if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) { throw new CompilerError("Not a class"); } parent = null; }
Example #28
Source File: ContextStack.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Pop an element from the stack. * @return the new current element or null if top. */ public TypeContext pop (boolean wasValid) { if (currentIndex < 0) { throw new CompilerError("Nothing on stack!"); } newCode = stack[currentIndex].getCode(); traceln(toResultString(stack[currentIndex],wasValid,false)); Type last = stack[currentIndex].getCandidateType(); if (last != null) { // Set status... if (wasValid) { last.setStatus(Constants.STATUS_VALID); } else { last.setStatus(Constants.STATUS_INVALID); } } currentIndex--; if (currentIndex < 0) { // Done parsing, so update the invalid types // if this type was valid... if (wasValid) { Type.updateAllInvalidTypes(this); } return null; } else { return stack[currentIndex]; } }
Example #29
Source File: ClassType.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Create a ClassType instance for the given class. NOTE: This constructor * is ONLY for SpecialClassType. */ protected ClassType(ContextStack stack, int typeCode, ClassDefinition classDef) { super(stack,typeCode,classDef); // Call special parent constructor. if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) { throw new CompilerError("Not a class"); } parent = null; }
Example #30
Source File: NCInterfaceType.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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; } }