Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ public static TreeNode build(String[] paths) throws Exception {
// our class path API 17
// Class<?> clazz = Class.forName(className, false, loader);
ClassDescriptor clazz = ClassRepo.findClass(className);
generate(clazz, root);
if (clazz == null) {
throw new ClassNotFoundException("Class " + className + " not found in the input android libraries.");
} else {
generate(clazz, root);
}
} catch (Throwable e) {
System.out.println("Skip " + className);
System.out.println("\tError: " + e.toString());
Expand Down Expand Up @@ -248,6 +252,12 @@ private static TreeNode getOrCreateNode(TreeNode root, TypeDescriptor type)
} else {
String name = ClassUtil.getCanonicalName(type.getSignature());
ClassDescriptor clazz = ClassRepo.findClass(name);

// if clazz is not found in the ClassRepo, the method/field being analyzed will be skipped
if (clazz == null) {
return null;
}

node = getOrCreateNode(root, clazz, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ private ClassRepo() {
private static ArrayList<ClassMapProvider> cachedProviders = new ArrayList<ClassMapProvider>();

public static void addToCache(ClassMapProvider classMapProvider) {
for (String className : classMapProvider.getClassMap().keySet()) {
for (ClassMapProvider cachedProvider : cachedProviders) {
ClassDescriptor clazz = cachedProvider.getClassMap().get(className);
if (clazz != null) {
String errMsg = "Class " + className + " conflict: "
+ classMapProvider.getPath() + " and " + cachedProvider.getPath();
throw new IllegalArgumentException(errMsg);
}
}
}
cachedProviders.add(classMapProvider);
}

Expand All @@ -33,6 +23,7 @@ public static ClassDescriptor findClass(String className) {
break;
}
}

return clazz;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void main(String[] args) throws Exception {
"You need to pass an output directory!");
}

if (args != null && args.length > 1) {
if (args.length > 1) {
params = new String[args.length - 1];
for (int i = 1; i < args.length; i++) {
params[i - 1] = args[i];
Expand Down