本文整理汇总了Java中sun.tools.java.ClassDefinition.getName方法的典型用法代码示例。如果您正苦于以下问题:Java ClassDefinition.getName方法的具体用法?Java ClassDefinition.getName怎么用?Java ClassDefinition.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.tools.java.ClassDefinition
的用法示例。
在下文中一共展示了ClassDefinition.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CompoundType
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create a CompoundType instance for the given class. The resulting
* object is not yet completely initialized.
*/
protected CompoundType(ContextStack stack, ClassDefinition classDef,
int typeCode) {
super(stack,typeCode);
this.classDef = classDef;
classDecl = classDef.getClassDeclaration();
// If we are an inner class/interface, reset the type codes...
if (classDef.isInnerClass()) {
setTypeCode(typeCode | TM_INNER);
}
// Set special flags...
setFlags();
// Set names...
Identifier id = classDef.getName();
String idlName;
String[] idlModuleNames;
try {
// These can fail if we get case-sensitive name matches...
idlName = IDLNames.getClassOrInterfaceName(id,env);
idlModuleNames = IDLNames.getModuleNames(id,isBoxed(),env);
setNames(id,idlModuleNames,idlName);
// Is this an exception?
if (isException()) {
// Yes, so set our mangled exception names...
isException = true;
idlExceptionName = IDLNames.getExceptionName(getIDLName());
qualifiedIDLExceptionName =
IDLNames.getQualifiedName(getIDLModuleNames(),idlExceptionName);
}
// Set interfaces, methods and members...
interfaces = null; // set in initialize()
methods = null; // set in initialize()
members = null; // set in initialize()
} catch (Exception e) {
failedConstraint(7,false,stack,id.toString(),e.getMessage());
throw new CompilerError("");
}
}
示例2: getMethodExceptions
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
protected ValueType[] getMethodExceptions (MemberDefinition member,
boolean quiet,
ContextStack stack) throws Exception {
boolean result = true;
stack.setNewContextCode(ContextStack.METHOD_EXCEPTION);
ClassDeclaration[] except = member.getExceptions(env);
ValueType[] exceptions = new ValueType[except.length];
try {
for (int i = 0; i < except.length; i++) {
ClassDefinition theClass = except[i].getClassDefinition(env);
try {
ValueType type = ValueType.forValue(theClass,stack,false);
if (type != null) {
exceptions[i] = type;
} else {
result = false;
}
} catch (ClassCastException e1) {
failedConstraint(22,quiet,stack,getQualifiedName());
throw new CompilerError("Method: exception " + theClass.getName() + " not a class type!");
} catch (NullPointerException e2) {
failedConstraint(23,quiet,stack,getQualifiedName());
throw new CompilerError("Method: caught null pointer exception");
}
}
} catch (ClassNotFound e) {
classNotFound(quiet,stack,e);
result = false;
}
if (!result) {
throw new Exception();
}
// Remove any duplicates (javac seems to allow them, but rmic will
// generate bad ties)...
int dupCount = 0;
for (int i = 0; i < exceptions.length; i++) {
for (int j = 0; j < exceptions.length; j++) {
if (i != j && exceptions[i] != null && exceptions[i] == exceptions[j]) {
exceptions[j] = null;
dupCount++;
}
}
}
if (dupCount > 0) {
int offset = 0;
ValueType[] temp = new ValueType[exceptions.length - dupCount];
for (int i = 0; i < exceptions.length; i++) {
if (exceptions[i] != null) {
temp[offset++] = exceptions[i];
}
}
exceptions = temp;
}
return exceptions;
}
示例3: SpecialClassType
import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
* Create an SpecialClassType instance for the given class.
*/
private SpecialClassType(ContextStack stack, int typeCode,
ClassDefinition theClass) {
super(stack,typeCode | TM_SPECIAL_CLASS | TM_CLASS | TM_COMPOUND, theClass);
Identifier id = theClass.getName();
String idlName = null;
String[] idlModuleName = null;
boolean constant = stack.size() > 0 && stack.getContext().isConstant();
// Set names...
switch (typeCode) {
case TYPE_STRING: {
idlName = IDLNames.getTypeName(typeCode,constant);
if (!constant) {
idlModuleName = IDL_CORBA_MODULE;
}
break;
}
case TYPE_ANY: {
idlName = IDL_JAVA_LANG_OBJECT;
idlModuleName = IDL_JAVA_LANG_MODULE;
break;
}
}
setNames(id,idlModuleName,idlName);
// Init parents...
if (!initParents(stack)) {
// Should not be possible!
throw new CompilerError("SpecialClassType found invalid parent.");
}
// Initialize CompoundType...
initialize(null,null,null,stack,false);
}