Skip to content

Commit

Permalink
Strongly link in parameter and return types used in method signatures to
Browse files Browse the repository at this point in the history
prevent ClassNotFoundExceptions when calling Method.getParameterTypes()/
Method.getReturnType() for methods which reference unused types. (fixes #1023)
  • Loading branch information
ntherning committed Jun 26, 2015
1 parent 824e59f commit b8083d6
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions compiler/src/main/java/org/robovm/compiler/ClassCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -891,17 +891,11 @@ private void compile(Clazz clazz, OutputStream out) throws IOException {
}
for (SootMethod m : sootClass.getMethods()) {
MethodInfo mi = ci.getMethod(m.getName(), getDescriptor(m));
addClassDependencyIfNeeded(clazz, mi, m.getReturnType(), true);
addClassDependencyIfNeeded(clazz, mi, m.getReturnType(), false);
@SuppressWarnings("unchecked")
List<soot.Type> paramTypes = (List<soot.Type>) m.getParameterTypes();
for (soot.Type type : paramTypes) {
/*
* Constructors are strongly linked even in aggressive tree
* shaking mode. Make sure to add the parameters of constructors
* as strong dependencies. For all other methods we add
* parameters as weak dependencies.
*/
addClassDependencyIfNeeded(clazz, mi, type, !m.getName().equals("<init>"));
addClassDependencyIfNeeded(clazz, mi, type, false);
}
}
ci.addClassDependencies(attributesEncoder.getDependencies(), false);
Expand Down

0 comments on commit b8083d6

Please sign in to comment.