@Test public void testAnnotationElementOrder() { ImmutableSet<ImmutableAnnotationElement> elements = ImmutableSet.of(new ImmutableAnnotationElement("zabaglione", ImmutableNullEncodedValue.INSTANCE), new ImmutableAnnotationElement("blah", ImmutableNullEncodedValue.INSTANCE)); ImmutableAnnotation annotation = new ImmutableAnnotation(AnnotationVisibility.RUNTIME, "Lorg/test/anno;", elements); ImmutableClassDef classDef = new ImmutableClassDef("Lorg/test/blah;", 0, "Ljava/lang/Object;", null, null, ImmutableSet.of(annotation), null, null); MemoryDataStore dataStore = new MemoryDataStore(); try { DexPool.writeTo(dataStore, new ImmutableDexFile(Opcodes.getDefault(), ImmutableSet.of(classDef))); } catch (IOException ex) { throw new RuntimeException(ex); } DexBackedDexFile dexFile = new DexBackedDexFile(Opcodes.getDefault(), dataStore.getData()); ClassDef dbClassDef = Iterables.getFirst(dexFile.getClasses(), null); Assert.assertNotNull(dbClassDef); Annotation dbAnnotation = Iterables.getFirst(dbClassDef.getAnnotations(), null); Assert.assertNotNull(dbAnnotation); List<AnnotationElement> dbElements = Lists.newArrayList(dbAnnotation.getElements()); Assert.assertEquals(2, dbElements.size()); Assert.assertEquals("blah", dbElements.get(0).getName()); Assert.assertEquals("zabaglione", dbElements.get(1).getName()); }
public void writeTo(@Nonnull DexDataStore dest) throws IOException { this.writeTo(dest, MemoryDeferredOutputStream.getFactory()); }
DexWriter { public void writeTo(@Nonnull DexDataStore dest) throws IOException { this.writeTo(dest, MemoryDeferredOutputStream.getFactory()); } }
DexWriter { public void writeTo(@Nonnull DexDataStore dest) throws IOException { this.writeTo(dest, MemoryDeferredOutputStream.getFactory()); } protected  DexWriter(Opcodes opcodes); }
DexWriter { public void writeTo(@Nonnull DexDataStore dest) throws IOException { this.writeTo(dest, MemoryDeferredOutputStream.getFactory()); } protected  DexWriter(Opcodes opcodes); @Nonnull List<String> getMethodReferences(); @Nonnull List<String> getFieldReferences(); @Nonnull List<String> getTypeReferences(); boolean hasOverflowed(); void writeTo(@Nonnull DexDataStore dest); void writeTo(@Nonnull DexDataStore dest,
                        @Nonnull DeferredOutputStreamFactory tempFactory); }
DexWriter { public void writeTo(@Nonnull DexDataStore dest) throws IOException { this.writeTo(dest, MemoryDeferredOutputStream.getFactory()); } protected  DexWriter(Opcodes opcodes); @Nonnull List<String> getMethodReferences(); @Nonnull List<String> getFieldReferences(); @Nonnull List<String> getTypeReferences(); boolean hasOverflowed(); void writeTo(@Nonnull DexDataStore dest); void writeTo(@Nonnull DexDataStore dest,
                        @Nonnull DeferredOutputStreamFactory tempFactory); static final int NO_INDEX; static final int NO_OFFSET; final StringSectionType stringSection; final TypeSectionType typeSection; final ProtoSectionType protoSection; final FieldSectionType fieldSection; final MethodSectionType methodSection; final ClassSectionType classSection; final TypeListSectionType typeListSection; final AnnotationSectionType annotationSection; final AnnotationSetSectionType annotationSetSection; }