classSection.getClassEntryByType(classSection.getSuperclass(key)); nextIndex = writeClass(indexWriter, offsetWriter, nextIndex, superEntry); for (TypeKey interfaceTypeKey: typeListSection.getTypes(classSection.getInterfaces(key))) { Map.Entry<? extends ClassKey, Integer> interfaceEntry = classSection.getClassEntryByType(interfaceTypeKey); nextIndex = writeClass(indexWriter, offsetWriter, nextIndex, interfaceEntry); indexWriter.writeInt(typeSection.getItemIndex(classSection.getType(key))); indexWriter.writeInt(classSection.getAccessFlags(key)); indexWriter.writeInt(typeSection.getNullableItemIndex(classSection.getSuperclass(key))); indexWriter.writeInt(typeListSection.getNullableItemOffset(classSection.getInterfaces(key))); indexWriter.writeInt(stringSection.getNullableItemIndex(classSection.getSourceFile(key))); indexWriter.writeInt(classSection.getAnnotationDirectoryOffset(key)); Collection<? extends FieldKey> staticFields = classSection.getSortedStaticFields(key); Collection<? extends FieldKey> instanceFields = classSection.getSortedInstanceFields(key); Collection<? extends MethodKey> directMethods = classSection.getSortedDirectMethods(key); Collection<? extends MethodKey> virtualMethods = classSection.getSortedVirtualMethods(key); boolean classHasData = staticFields.size() > 0 || instanceFields.size() > 0 || EncodedArrayKey staticInitializers = classSection.getStaticInitializers(key); if (staticInitializers != null) { indexWriter.writeInt(encodedArraySection.getItemOffset(staticInitializers));
tempBuffer.order(ByteOrder.LITTLE_ENDIAN); for (ClassKey key: classSection.getSortedClasses()) { Collection<? extends FieldKey> fields = classSection.getSortedFields(key); Collection<? extends MethodKey> methods = classSection.getSortedMethods(key); AnnotationSetKey fieldAnnotationsKey = classSection.getFieldAnnotations(field); if (fieldAnnotationsKey != null) { fieldAnnotations++; AnnotationSetKey methodAnnotationsKey = classSection.getMethodAnnotations(method); if (methodAnnotationsKey != null) { methodAnnotations++; int offset = classSection.getAnnotationSetRefListOffset(method); if (offset != DexWriter.NO_OFFSET) { parameterAnnotations++; AnnotationSetKey classAnnotationKey = classSection.getClassAnnotations(key); if (fieldAnnotations == 0 && methodAnnotations == 0 && parameterAnnotations == 0) { if (classAnnotationKey != null) { classSection.setAnnotationDirectoryOffset(key, directoryOffset); continue; } else { classSection.setAnnotationDirectoryOffset(key, writer.getPosition());
private void writeEncodedMethods(@Nonnull DexDataWriter writer, @Nonnull Collection<? extends MethodKey> methods) throws IOException { int prevIndex = 0; for (MethodKey key: methods) { int index = methodSection.getMethodIndex(key); writer.writeUleb128(index-prevIndex); writer.writeUleb128(classSection.getMethodAccessFlags(key)); writer.writeUleb128(classSection.getCodeItemOffset(key)); prevIndex = index; } }
for (ClassKey classKey: classSection.getSortedClasses()) { Collection<? extends MethodKey> directMethods = classSection.getSortedDirectMethods(classKey); Collection<? extends MethodKey> virtualMethods = classSection.getSortedVirtualMethods(classKey); classSection.getTryBlocks(methodKey); Iterable<? extends Instruction> instructions = classSection.getInstructions(methodKey); Iterable<? extends DebugItem> debugItems = classSection.getDebugItems(methodKey); classSection.makeMutableMethodImplementation(methodKey); fixInstructions(mutableMethodImplementation); classSection.getParameterNames(methodKey), debugItems); int codeItemOffset; try { classSection.setCodeItemOffset(codeOffset.method, codeSectionOffset + codeOffset.codeOffset);
classSection.getClassEntryByType(classSection.getSuperclass(key)); nextIndex = writeClass(indexWriter, offsetWriter, nextIndex, superEntry); for (TypeKey interfaceTypeKey: typeListSection.getTypes(classSection.getSortedInterfaces(key))) { Map.Entry<? extends ClassKey, Integer> interfaceEntry = classSection.getClassEntryByType(interfaceTypeKey); nextIndex = writeClass(indexWriter, offsetWriter, nextIndex, interfaceEntry); indexWriter.writeInt(typeSection.getItemIndex(classSection.getType(key))); indexWriter.writeInt(classSection.getAccessFlags(key)); indexWriter.writeInt(typeSection.getNullableItemIndex(classSection.getSuperclass(key))); indexWriter.writeInt(typeListSection.getNullableItemOffset(classSection.getSortedInterfaces(key))); indexWriter.writeInt(stringSection.getNullableItemIndex(classSection.getSourceFile(key))); indexWriter.writeInt(classSection.getAnnotationDirectoryOffset(key)); Collection<? extends FieldKey> staticFields = classSection.getSortedStaticFields(key); Collection<? extends FieldKey> instanceFields = classSection.getSortedInstanceFields(key); Collection<? extends MethodKey> directMethods = classSection.getSortedDirectMethods(key); Collection<? extends MethodKey> virtualMethods = classSection.getSortedVirtualMethods(key); boolean classHasData = staticFields.size() > 0 || instanceFields.size() > 0 || indexWriter.writeInt(classSection.getEncodedArrayOffset(key));
writer.writeUshort(classSection.getRegisterCount(methodKey)); boolean isStatic = AccessFlags.STATIC.isSet(classSection.getMethodAccessFlags(methodKey)); Collection<? extends TypeKey> parameters = typeListSection.getTypes( protoSection.getParameters(methodSection.getPrototype(methodKey))); TypeKey exceptionTypeKey = classSection.getExceptionType(eh);
private void writeEncodedFields(@Nonnull DexDataWriter writer, @Nonnull Collection<? extends FieldKey> fields) throws IOException { int prevIndex = 0; for (FieldKey key: fields) { int index = fieldSection.getFieldIndex(key); writer.writeUleb128(index - prevIndex); writer.writeUleb128(classSection.getFieldAccessFlags(key)); prevIndex = index; } }
for (ClassKey classKey: classSection.getSortedClasses()) { Collection<? extends MethodKey> directMethods = classSection.getSortedDirectMethods(classKey); Collection<? extends MethodKey> virtualMethods = classSection.getSortedVirtualMethods(classKey); classSection.getTryBlocks(methodKey); Iterable<? extends Instruction> instructions = classSection.getInstructions(methodKey); Iterable<? extends DebugItem> debugItems = classSection.getDebugItems(methodKey); classSection.makeMutableMethodImplementation(methodKey); fixInstructions(mutableMethodImplementation); classSection.getParameterNames(methodKey), debugItems); int codeItemOffset = writeCodeItem(codeWriter, ehBuf, methodKey, tryBlocks, instructions, debugItemOffset); classSection.setCodeItemOffset(codeOffset.method, codeSectionOffset + codeOffset.codeOffset);
writer.writeUshort(classSection.getRegisterCount(methodKey)); boolean isStatic = AccessFlags.STATIC.isSet(classSection.getMethodAccessFlags(methodKey)); Collection<? extends TypeKey> parameters = typeListSection.getTypes( protoSection.getParameters(methodSection.getPrototype(methodKey))); TypeKey exceptionTypeKey = classSection.getExceptionType(eh);
private void writeEncodedFields(@Nonnull DexDataWriter writer, @Nonnull Collection<? extends FieldKey> fields) throws IOException { int prevIndex = 0; for (FieldKey key: fields) { int index = fieldSection.getFieldIndex(key); writer.writeUleb128(index - prevIndex); writer.writeUleb128(classSection.getFieldAccessFlags(key)); prevIndex = index; } }
classSection.getClassEntryByType(classSection.getSuperclass(key)); nextIndex = writeClass(indexWriter, offsetWriter, nextIndex, superEntry); for (TypeKey interfaceTypeKey: typeListSection.getTypes(classSection.getInterfaces(key))) { Map.Entry<? extends ClassKey, Integer> interfaceEntry = classSection.getClassEntryByType(interfaceTypeKey); nextIndex = writeClass(indexWriter, offsetWriter, nextIndex, interfaceEntry); indexWriter.writeInt(typeSection.getItemIndex(classSection.getType(key))); indexWriter.writeInt(classSection.getAccessFlags(key)); indexWriter.writeInt(typeSection.getNullableItemIndex(classSection.getSuperclass(key))); indexWriter.writeInt(typeListSection.getNullableItemOffset(classSection.getInterfaces(key))); indexWriter.writeInt(stringSection.getNullableItemIndex(classSection.getSourceFile(key))); indexWriter.writeInt(classSection.getAnnotationDirectoryOffset(key)); Collection<? extends FieldKey> staticFields = classSection.getSortedStaticFields(key); Collection<? extends FieldKey> instanceFields = classSection.getSortedInstanceFields(key); Collection<? extends MethodKey> directMethods = classSection.getSortedDirectMethods(key); Collection<? extends MethodKey> virtualMethods = classSection.getSortedVirtualMethods(key); boolean classHasData = staticFields.size() > 0 || instanceFields.size() > 0 || EncodedArrayKey staticInitializers = classSection.getStaticInitializers(key); if (staticInitializers != null) { indexWriter.writeInt(encodedArraySection.getItemOffset(staticInitializers));
for (ClassKey classKey: classSection.getSortedClasses()) { Collection<? extends MethodKey> directMethods = classSection.getSortedDirectMethods(classKey); Collection<? extends MethodKey> virtualMethods = classSection.getSortedVirtualMethods(classKey); classSection.getTryBlocks(methodKey); Iterable<? extends Instruction> instructions = classSection.getInstructions(methodKey); Iterable<? extends DebugItem> debugItems = classSection.getDebugItems(methodKey); classSection.makeMutableMethodImplementation(methodKey); fixInstructions(mutableMethodImplementation); classSection.getParameterNames(methodKey), debugItems); int codeItemOffset; try { classSection.setCodeItemOffset(codeOffset.method, codeSectionOffset + codeOffset.codeOffset);
tempBuffer.order(ByteOrder.LITTLE_ENDIAN); for (ClassKey key: classSection.getSortedClasses()) { Collection<? extends FieldKey> fields = classSection.getSortedFields(key); Collection<? extends MethodKey> methods = classSection.getSortedMethods(key); AnnotationSetKey fieldAnnotationsKey = classSection.getFieldAnnotations(field); if (fieldAnnotationsKey != null) { fieldAnnotations++; AnnotationSetKey methodAnnotationsKey = classSection.getMethodAnnotations(method); if (methodAnnotationsKey != null) { methodAnnotations++; int offset = classSection.getAnnotationSetRefListOffset(method); if (offset != DexWriter.NO_OFFSET) { parameterAnnotations++; AnnotationSetKey classAnnotationKey = classSection.getClassAnnotations(key); if (fieldAnnotations == 0 && methodAnnotations == 0 && parameterAnnotations == 0) { if (classAnnotationKey != null) { classSection.setAnnotationDirectoryOffset(key, directoryOffset); continue; } else { classSection.setAnnotationDirectoryOffset(key, writer.getPosition());
writer.writeUshort(classSection.getRegisterCount(methodKey)); boolean isStatic = AccessFlags.STATIC.isSet(classSection.getMethodAccessFlags(methodKey)); Collection<? extends TypeKey> parameters = typeListSection.getTypes( protoSection.getParameters(methodSection.getPrototype(methodKey))); TypeKey exceptionTypeKey = classSection.getExceptionType(eh);
private void writeEncodedMethods(@Nonnull DexDataWriter writer, @Nonnull Collection<? extends MethodKey> methods) throws IOException { int prevIndex = 0; for (MethodKey key: methods) { int index = methodSection.getMethodIndex(key); writer.writeUleb128(index-prevIndex); writer.writeUleb128(classSection.getMethodAccessFlags(key)); writer.writeUleb128(classSection.getCodeItemOffset(key)); prevIndex = index; } }
private void writeEncodedFields(@Nonnull DexDataWriter writer, @Nonnull Collection<? extends FieldKey> fields) throws IOException { int prevIndex = 0; for (FieldKey key: fields) { int index = fieldSection.getFieldIndex(key); writer.writeUleb128(index - prevIndex); writer.writeUleb128(classSection.getFieldAccessFlags(key)); prevIndex = index; } }
tempBuffer.order(ByteOrder.LITTLE_ENDIAN); for (ClassKey key: classSection.getSortedClasses()) { Collection<? extends FieldKey> fields = classSection.getSortedFields(key); Collection<? extends MethodKey> methods = classSection.getSortedMethods(key); AnnotationSetKey fieldAnnotationsKey = classSection.getFieldAnnotations(field); if (fieldAnnotationsKey != null) { fieldAnnotations++; AnnotationSetKey methodAnnotationsKey = classSection.getMethodAnnotations(method); if (methodAnnotationsKey != null) { methodAnnotations++; int offset = classSection.getAnnotationSetRefListOffset(method); if (offset != DexWriter.NO_OFFSET) { parameterAnnotations++; AnnotationSetKey classAnnotationKey = classSection.getClassAnnotations(key); if (fieldAnnotations == 0 && methodAnnotations == 0 && parameterAnnotations == 0) { if (classAnnotationKey != null) { classSection.setAnnotationDirectoryOffset(key, directoryOffset); continue; } else { classSection.setAnnotationDirectoryOffset(key, writer.getPosition());
private void writeEncodedMethods(@Nonnull DexDataWriter writer, @Nonnull Collection<? extends MethodKey> methods) throws IOException { int prevIndex = 0; for (MethodKey key: methods) { int index = methodSection.getMethodIndex(key); writer.writeUleb128(index-prevIndex); writer.writeUleb128(classSection.getMethodAccessFlags(key)); writer.writeUleb128(classSection.getCodeItemOffset(key)); prevIndex = index; } }