// class and the base of the source file. This avoids having to read
// additional classes to determine the outmost class from any
// InnerClasses and EnclosingMethod attributes.
try {
String className = cf.getName();
SourceFile_attribute sf =
(SourceFile_attribute) cf.attributes.get(Attribute.SourceFile);
if (sf == null) {
report(messages.getMessage("err.no.SourceFile.attribute"));
return null;
}
String sourceFile = sf.getSourceFile(cf.constant_pool);
String fileBase = sourceFile.endsWith(".java")
? sourceFile.substring(0, sourceFile.length() - 5) : sourceFile;
int sep = className.lastIndexOf("/");
String pkgName = (sep == -1 ? "" : className.substring(0, sep+1));
String topClassName = (pkgName + fileBase).replace('/', '.');