本文整理汇总了Java中sun.tools.java.CompilerError类的典型用法代码示例。如果您正苦于以下问题:Java CompilerError类的具体用法?Java CompilerError怎么用?Java CompilerError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompilerError类属于sun.tools.java包,在下文中一共展示了CompilerError类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initParents
import sun.tools.java.CompilerError; //导入依赖的package包/类
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;
}
示例2: PrimitiveType
import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
* 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();
}
示例3: ClassType
import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
* 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;
}
示例4: pop
import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
* 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];
}
}
示例5: InterfaceType
import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
* 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");
}
}
示例6: loadClass
import sun.tools.java.CompilerError; //导入依赖的package包/类
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");
}
}
示例7: forNCInterface
import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
* 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;
}
}