-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit byte-buddy failure before removing
- Loading branch information
1 parent
624775b
commit 67b8bad
Showing
5 changed files
with
90 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
smalivm/src/main/java/org/cf/smalivm/smali/ClassDependencyCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.cf.smalivm.smali; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import org.jf.dexlib2.iface.ClassDef; | ||
import org.jf.dexlib2.iface.Field; | ||
import org.jf.dexlib2.iface.Method; | ||
|
||
public class ClassDependencyCollector { | ||
|
||
public static Set<String> collect(ClassDef classDef) { | ||
Set<String> dependencies = new HashSet<String>(); | ||
|
||
dependencies.add(classDef.getType()); | ||
dependencies.add(classDef.getSuperclass()); | ||
dependencies.addAll(classDef.getInterfaces()); | ||
dependencies.addAll(collectMethodDependencies(classDef.getMethods())); | ||
dependencies.addAll(collectFieldDependencies(classDef.getFields())); | ||
|
||
return dependencies; | ||
} | ||
|
||
private static Set<String> collectMethodDependencies(Iterable<? extends Method> methods) { | ||
Set<String> dependencies = new HashSet<String>(); | ||
for (Method method : methods) { | ||
for (CharSequence parameterType : method.getParameterTypes()) { | ||
dependencies.add(parameterType.toString()); | ||
} | ||
} | ||
|
||
return dependencies; | ||
} | ||
|
||
private static Set<String> collectFieldDependencies(Iterable<? extends Field> fields) { | ||
Set<String> dependencies = new HashSet<String>(); | ||
for (Field field : fields) { | ||
dependencies.add(field.getType()); | ||
} | ||
|
||
return dependencies; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters