private JRealClassType createType(TypeData typeData,
CollectClassData collectClassData, CollectClassData enclosingClassData) {
int access = collectClassData.getAccess();
String qualifiedSourceName = typeData.sourceName;
String className = Shared.getShortName(qualifiedSourceName);
JRealClassType resultType = null;
String jpkgName = typeData.packageName;
JPackage pkg = typeOracle.getOrCreatePackage(jpkgName);
boolean isIntf = (access & Opcodes.ACC_INTERFACE) != 0;
assert !collectClassData.hasNoExternalName();
String enclosingTypeName = null;
if (enclosingClassData != null) {
enclosingTypeName = InternalName.toSourceName(InternalName.getClassName(enclosingClassData.getName()));
}
if ((access & Opcodes.ACC_ANNOTATION) != 0) {
resultType = newAnnotationType(pkg, enclosingTypeName, className);
} else if ((access & Opcodes.ACC_ENUM) != 0) {
resultType = newEnumType(pkg, enclosingTypeName, className);
} else {
JTypeParameter[] typeParams = getTypeParametersForClass(collectClassData);
if ((typeParams != null && typeParams.length > 0)
|| nonStaticInsideGeneric(collectClassData, enclosingClassData)) {
resultType = new JGenericType(typeOracle, pkg, enclosingTypeName,
className, isIntf, typeParams);
} else {
resultType = newRealClassType(pkg, enclosingTypeName, className, isIntf);
}
}
/*
* Add modifiers since these are needed for
* TypeOracle.getParameterizedType's error checking code.
*/
resultType.addModifierBits(mapBits(ASM_TO_SHARED_MODIFIERS, access));
if (isIntf) {
// Always add implicit modifiers on interfaces.
resultType.addModifierBits(Shared.MOD_STATIC | Shared.MOD_ABSTRACT);
}
/*
* Add a reference to the byteCode
*/
resultType.addByteCode(typeData.byteCode);
return resultType;
}