return null;
}
}
private ClassMirror lookupNewClassMirror(String name) {
ClassSymbol classSymbol = null;
String outerName = name;
/*
* This madness here tries to look for a class, and if it fails, tries to resolve it
* from its parent class. This is required because a.b.C.D (where D is an inner class
* of C) is not found in symtab.classes but in C's ClassSymbol.enclosedElements.
*/
// make sure we load the class file, since we no longer complete packages unless we absolutely must
loadClass(outerName);
do{
// we must first try with no postfix, because we can have a valid class foo.bar in Java,
// when in Ceylon it would be foo.bar_
classSymbol = symtab.classes.get(names.fromString(Util.quoteJavaKeywords(outerName)));
// try again with a postfix "_"
if (classSymbol == null && lastPartHasLowerInitial(outerName) && !outerName.endsWith("_")) {
classSymbol = symtab.classes.get(names.fromString(Util.quoteJavaKeywords(outerName+"_")));
}
if(classSymbol != null){
// if we got a source symbol for something non-Java it's a slipery slope
if(Util.isLoadedFromSource(classSymbol) && !Util.isJavaSource(classSymbol))
return null;
if(outerName.length() != name.length()){
try{
classSymbol = lookupInnerClass(classSymbol, name.substring(outerName.length()+1).split("\\."));
}catch(CompletionFailure x){
// something wrong, we will report it properly elsewhere
classSymbol = null;
}
}
if(classSymbol != null && classSymbol.classfile == null && classSymbol.sourcefile == null){
// try to complete it if that changes anything
try{
classSymbol.complete();
}catch(CompletionFailure x){
// if we can't complete it it doesn't exist, its classfile will remain null
}
if(classSymbol.classfile == null){
PackageSymbol pkg = classSymbol.packge();
// do not log an error for missing oracle jdk stuff
if(pkg == null || !JDKUtils.isOracleJDKAnyPackage(pkg.getQualifiedName().toString())){
// do not log an error because it will be logged elsewhere
logVerbose("Unable to find required class file for "+name);
}