public DexFileClassMap(DexFile dexFile) { for (ClassDefItem classDefItem: dexFile.ClassDefsSection.getItems()) { definedClasses.put(classDefItem.getClassType().getTypeDescriptor(), classDefItem); } }
public void loadDexFile(String dexFilePath, DexFile dexFile) { for (ClassDefItem classDefItem: dexFile.ClassDefsSection.getItems()) { try { //TODO: need to check if the class already exists. (and if so, what to do about it?) TempClassInfo tempClassInfo = new TempClassInfo(dexFilePath, classDefItem); tempClasses.put(tempClassInfo.classType, tempClassInfo); } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, String.format("Error while loading class %s", classDefItem.getClassType().getTypeDescriptor())); } } }
out.writeInt(dexFile.MapItem.getOffset()); out.annotate("string_ids_size: " + dexFile.StringIdsSection.getItems().size()); out.writeInt(dexFile.StringIdsSection.getItems().size()); out.annotate("type_ids_size: " + dexFile.TypeIdsSection.getItems().size()); out.writeInt(dexFile.TypeIdsSection.getItems().size()); out.annotate("proto_ids_size: " + dexFile.ProtoIdsSection.getItems().size()); out.writeInt(dexFile.ProtoIdsSection.getItems().size()); out.annotate("field_ids_size: " + dexFile.FieldIdsSection.getItems().size()); out.writeInt(dexFile.FieldIdsSection.getItems().size()); out.annotate("method_ids_size: " + dexFile.MethodIdsSection.getItems().size()); out.writeInt(dexFile.MethodIdsSection.getItems().size()); out.annotate("class_defs_size: " + dexFile.ClassDefsSection.getItems().size()); out.writeInt(dexFile.ClassDefsSection.getItems().size());
public DexFileClassMap(DexFile dexFile) { for (ClassDefItem classDefItem: dexFile.ClassDefsSection.getItems()) { definedClasses.put(classDefItem.getClassType().getTypeDescriptor(), classDefItem); } }
public Collection<TestCaseEvent> loadTestSuite() throws NoTestCasesFoundException { List<TestCaseEvent> testCaseEvents = dexFileExtractor.getDexFiles(instrumentationApkFile).stream() .map(dexFile -> dexFile.ClassDefsSection.getItems()) .flatMap(Collection::stream) .filter(c -> testClassMatcher.matchesPatterns(c.getClassType().getTypeDescriptor())) .map(this::convertClassToTestCaseEvents) .flatMap(Collection::stream) .collect(toList()); if (testCaseEvents.isEmpty()) { throw new NoTestCasesFoundException("No tests cases were found in the test APK: " + instrumentationApkFile.getAbsolutePath()); } return testCaseEvents; }
private void loadDexFile(String dexFilePath, DexFile dexFile) { for (ClassDefItem classDefItem: dexFile.ClassDefsSection.getItems()) { try { UnresolvedClassInfo unresolvedClassInfo = new UnresolvedClassInfo(dexFilePath, classDefItem); if (!unloadedClasses.containsKey(unresolvedClassInfo.classType)) { unloadedClasses.put(unresolvedClassInfo.classType, unresolvedClassInfo); } } catch (Exception ex) { throw ExceptionWithContext.withContext(ex, String.format("Error while loading class %s", classDefItem.getClassType().getTypeDescriptor())); } } }
out.writeInt(dexFile.MapItem.getOffset()); out.annotate("string_ids_size: " + dexFile.StringIdsSection.getItems().size()); out.writeInt(dexFile.StringIdsSection.getItems().size()); out.annotate("type_ids_size: " + dexFile.TypeIdsSection.getItems().size()); out.writeInt(dexFile.TypeIdsSection.getItems().size()); out.annotate("proto_ids_size: " + dexFile.ProtoIdsSection.getItems().size()); out.writeInt(dexFile.ProtoIdsSection.getItems().size()); out.annotate("field_ids_size: " + dexFile.FieldIdsSection.getItems().size()); out.writeInt(dexFile.FieldIdsSection.getItems().size()); out.annotate("method_ids_size: " + dexFile.MethodIdsSection.getItems().size()); out.writeInt(dexFile.MethodIdsSection.getItems().size()); out.annotate("class_defs_size: " + dexFile.ClassDefsSection.getItems().size()); out.writeInt(dexFile.ClassDefsSection.getItems().size());