Java Code Examples for org.jf.dexlib2.iface.ClassDef#getType()
The following examples show how to use
org.jf.dexlib2.iface.ClassDef#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImmutableClassDef.java From ZjDroid with Apache License 2.0 | 6 votes |
public static ImmutableClassDef of(ClassDef classDef) { if (classDef instanceof ImmutableClassDef) { return (ImmutableClassDef)classDef; } return new ImmutableClassDef( classDef.getType(), classDef.getAccessFlags(), classDef.getSuperclass(), classDef.getInterfaces(), classDef.getSourceFile(), classDef.getAnnotations(), classDef.getStaticFields(), classDef.getInstanceFields(), classDef.getDirectMethods(), classDef.getVirtualMethods()); }
Example 2
Source File: ImmutableClassDef.java From zjdroid with Apache License 2.0 | 6 votes |
public static ImmutableClassDef of(ClassDef classDef) { if (classDef instanceof ImmutableClassDef) { return (ImmutableClassDef)classDef; } return new ImmutableClassDef( classDef.getType(), classDef.getAccessFlags(), classDef.getSuperclass(), classDef.getInterfaces(), classDef.getSourceFile(), classDef.getAnnotations(), classDef.getStaticFields(), classDef.getInstanceFields(), classDef.getDirectMethods(), classDef.getVirtualMethods()); }
Example 3
Source File: ImmutableClassDef.java From HeyGirl with Apache License 2.0 | 6 votes |
public static ImmutableClassDef of(ClassDef classDef) { if (classDef instanceof ImmutableClassDef) { return (ImmutableClassDef)classDef; } return new ImmutableClassDef( classDef.getType(), classDef.getAccessFlags(), classDef.getSuperclass(), classDef.getInterfaces(), classDef.getSourceFile(), classDef.getAnnotations(), classDef.getStaticFields(), classDef.getInstanceFields(), classDef.getDirectMethods(), classDef.getVirtualMethods()); }
Example 4
Source File: ImmutableClassDef.java From ZjDroid with Apache License 2.0 | 6 votes |
public static ImmutableClassDef of(ClassDef classDef) { if (classDef instanceof ImmutableClassDef) { return (ImmutableClassDef)classDef; } return new ImmutableClassDef( classDef.getType(), classDef.getAccessFlags(), classDef.getSuperclass(), classDef.getInterfaces(), classDef.getSourceFile(), classDef.getAnnotations(), classDef.getStaticFields(), classDef.getInstanceFields(), classDef.getDirectMethods(), classDef.getVirtualMethods()); }
Example 5
Source File: ProcessManifest.java From DroidRA with GNU Lesser General Public License v2.1 | 5 votes |
private Set<String> getDexClasses() { Set<String> dexClasses = new HashSet<String>(); try { DexFile dexFile = DexFileFactory.loadDexFile(new File(apk.getAbsolutePath()), targetSdkVersion()); for (ClassDef classDef: dexFile.getClasses()) { String cls = classDef.getType(); if (cls.contains("$")) { //do not consider sub-classes continue; } cls = cls.replace("/", ".").substring(1, cls.length()-1); dexClasses.add(cls); } } catch (IOException e) { e.printStackTrace(); } return dexClasses; }
Example 6
Source File: DexlibAdapter.java From android-classyshark with Apache License 2.0 | 5 votes |
public static ClassDef getClassDefByName(String className, DexFile dexFile) throws Exception { ClassDef result = null; String dexName; for (ClassDef currentClassDef : dexFile.getClasses()) { dexName = currentClassDef.getType(); if (isMatchFromDex(className, dexName)) { result = currentClassDef; break; } } return result; }
Example 7
Source File: AbIClassDef.java From atlas with Apache License 2.0 | 4 votes |
@Override public ClassDef reClassDef(ClassDef classDef) { Iterable<? extends Method> methods = classDef.getMethods(); LinkedHashSet<Method> newMethods = new LinkedHashSet<Method>(); Iterable<? extends Field> fields = classDef.getFields(); LinkedHashSet<Field>newFields = new LinkedHashSet<Field>(); Set<? extends Annotation> annotations = classDef.getAnnotations(); List<String>interfaces = classDef.getInterfaces(); Set<String>newInterfaces = new HashSet<String>(); Set<Annotation>immutableAnnotations = new HashSet<Annotation>(); String type = classDef.getType(); reType = reType(type); String superClass = classDef.getSuperclass(); for (String inter:interfaces){ newInterfaces.add(reInterface(inter)); } String reSuperClass = reSuperClass(superClass); for (Annotation annotation:annotations){ immutableAnnotations.add(reAnnotation(annotation)); } for (Field field:fields){ newFields.add(reField(field)); } for (Method method:methods){ if (method.getName().equals("<cinit>")||method.getName().equals("<init>")){ newMethods.add(reMethod(method)); continue; } // if (method.getName().equals("getArchiveFile")) { newMethods.add(reMethod(method)); // } } return new ImmutableClassDef( reType, classDef.getAccessFlags(), reSuperClass, newInterfaces, classDef.getSourceFile(), immutableAnnotations, newFields, newMethods); }
Example 8
Source File: SyntheticAccessorsInspector.java From android-classyshark with Apache License 2.0 | 3 votes |
public List<String> getSyntheticAccessors() { LinkedList<String> result = new LinkedList<>(); Set<? extends ClassDef> allClasses = dxFile.getClasses(); for (ClassDef classDef : allClasses) { Iterator<? extends Method> allMethodsIter = classDef.getMethods().iterator(); while (allMethodsIter.hasNext()) { Method element = allMethodsIter.next(); String name = element.getName(); String nClassName = classDef.getType(); if (name.contains("access$")) { String cleanClassName = DexlibAdapter.getClassStringFromDex(nClassName); if (!result.contains(cleanClassName)) { result.add(cleanClassName); } } } } return result; }