}
// 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(relativePath, resource);
try {
// Check if we have a package-info
if (relativePath.endsWith("/package-info.class")) {
// package-info can contain an Export annotation
Map<String, String> info = contained.get(pack);
parsePackageInfoClass(clazz, info);
} else {
// Otherwise we just parse it simply
clazz.parseClassFile();
}
} finally {
in.close();
}
} catch (Throwable e) {
error("Invalid class file: " + relativePath, e);
e.printStackTrace();
continue next;
}
String calculatedPath = clazz.getClassName() + ".class";
if (!calculatedPath.equals(relativePath)) {
if (!isNoBundle()) {
error("Class in different directory than declared. Path from class name is "
+ calculatedPath
+ " but the path in the jar is "
+ relativePath + " from " + jar);
}
}
classSpace.put(relativePath, clazz);
// Look at the referred packages
// and copy them to our baseline
for (String p : clazz.getReferred()) {
Map<String, String> attrs = referred.get(p);
if (attrs == null) {
attrs = newMap();
referred.put(p, attrs);
}
}
// Add all the used packages
// to this package
Set<String> t = uses.get(pack);
if (t == null)
uses.put(pack, t = new LinkedHashSet<String>());
t.addAll(clazz.getReferred());
t.remove(pack);
}
}
}
}