int n = relativePath.lastIndexOf('/');
if (n < 0)
n = relativePath.length();
String relativeDir = relativePath.substring(0, n);
PackageRef packageRef = getPackageRef(relativeDir);
learnPackage(jar, packageRef, contained);
}
// Check class resources, we need to analyze them
if (path.endsWith(".class")) {
Resource resource = jar.getResource(path);
Clazz clazz;
try {
InputStream in = resource.openInputStream();
clazz = new Clazz(this, path, resource);
try {
clazz.parseClassFile();
}
finally {
in.close();
}
}
catch (Throwable e) {
error("Invalid class file %s (%s)", e, relativePath, e);
e.printStackTrace();
continue next;
}
String calculatedPath = clazz.getClassName().getPath();
if (!calculatedPath.equals(relativePath)) {
// If there is a mismatch we
// warning
if (okToIncludeDirs) // assume already reported
mismatched.put(clazz.getAbsolutePath(), clazz);
} else {
classspace.put(clazz.getClassName(), clazz);
PackageRef packageRef = clazz.getClassName().getPackageRef();
learnPackage(jar, packageRef, contained);
// Look at the referred packages
// and copy them to our baseline
Set<PackageRef> refs = Create.set();