983 Commits

Author SHA1 Message Date
Ben Gruver
7dff6ada5e Add tests for DexWriter (and fixes to DexWriter, to make said tests pass) 2012-12-28 16:37:41 -08:00
Ben Gruver
9a90c5560c Refactor DexWriter to write to a generic OutputStream 2012-12-28 16:28:35 -08:00
Izzat Bahadirov
9393c08e36 Using tempBuf when writing encoded floats and doubles. Otherwise, output dex file gets corrupted. 2012-12-27 19:19:38 -08:00
Izzat Bahadirov
fcd1286d41 Added support for getting dex file stats: checkum, signature, map. 2012-12-27 19:19:32 -08:00
Izzat Bahadirov
8aef982e0c Add support for writing header_item 2012-12-27 19:18:40 -08:00
Izzat Bahadirov
085cfce948 Add support for writing map_item 2012-12-27 19:18:34 -08:00
Izzat Bahadirov
e68daf22aa Add support for writing class_def_items and class_data 2012-12-26 20:40:35 -08:00
Izzat Bahadirov
f3c33259dd Add support for writing code_items 2012-12-26 20:24:25 -08:00
Izzat Bahadirov
56c7adde03 ExceptionHandlers are now stored in a List rather than a Set. Order matters. 2012-12-26 20:18:15 -08:00
Izzat Bahadirov
03411559cf Setting an index in iterator correctly. 2012-12-26 20:18:15 -08:00
Ben Gruver
3952733b85 Return an offset of 0 for an empty annotation directory item 2012-12-11 23:37:24 -08:00
Ben Gruver
280b97e995 Add support for writing debug_info_items 2012-11-18 19:00:22 -08:00
Ben Gruver
4ffbfa2e71 Initial commit of writer functionality
It's not fully functional yet, but the structure is there, and it's
got most item types
2012-11-18 14:33:32 -08:00
Ben Gruver
22c3185bb7 Major cleanup of the interface and library in general 2012-11-17 17:51:36 -08:00
Ben Gruver
bea9627ed7 Change the nomenclature from CodeOffset to CodeAddress for absolute code positions 2012-11-16 22:54:14 -08:00
Ben Gruver
cb5cf3d6c0 Delete the MethodPrototype interface 2012-11-16 22:53:03 -08:00
Ben Gruver
85b3146224 Use final and a private constructor for non-instantiable classes 2012-11-16 22:35:12 -08:00
Ben Gruver
d71c98f6b9 Return the correct register count in ImmutableMethodImplementation 2012-11-12 23:03:18 -08:00
Ben Gruver
2d7e111135 Add sorted interface and immutable implementations 2012-11-12 22:55:06 -08:00
Ben Gruver
ddf2021942 Add @Nonnull for ImmutableListConverter methods 2012-11-12 22:25:15 -08:00
Ben Gruver
60ca2ce0ae Add base implementations of Annotation and AnnotationElement 2012-11-12 22:25:15 -08:00
Ben Gruver
8f14d3641c Make StringReference and TypeReference implement CharSequence 2012-11-12 22:25:11 -08:00
Ben Gruver
c6e54994a7 Use collections of annotations, not lists. 2012-11-12 22:20:39 -08:00
Ben Gruver
07cf2064e6 Fix logic that determine if an immutable list needs to be copied 2012-11-12 22:20:39 -08:00
Ben Gruver
12b970ed4d Use collections instead of lists for variable size "lists" in the dex file
Only things that can be accessed in the dex file in a random access manner
should be exposed as a list. If the list must be read sequentially, it is
exposed in the interface as a Collection if the size is available up-front
or as an Iterable if the size can only be determined by iterating over the
list.
2012-11-12 22:20:33 -08:00
Ben Gruver
65d969c23b Rename VariableSizeIterator to VariableSizeLookaheadIterator
This improves the implementation, and is now used for debug info
2012-11-11 12:49:38 -08:00
Ben Gruver
b26b492fcc Get rid of BaseAnnotation 2012-11-10 21:04:31 -08:00
Ben Gruver
e27e44bee3 Refactor EnumEncodedValue to use a field reference 2012-11-10 17:36:16 -08:00
Ben Gruver
b76e75c8bc Implement hashCode and equals for encoded values 2012-11-10 17:33:28 -08:00
Ben Gruver
ff9eb9fa61 Remove the unnecessary abstract methods from the base reference implementations 2012-11-10 16:21:30 -08:00
Ben Gruver
f7823c4fe1 Add MethodPrototype interface 2012-11-10 16:03:43 -08:00
Ben Gruver
b7b15efc03 Replace BasicMethodParameter with TypeReference 2012-11-10 13:30:07 -08:00
Ben Gruver
f81150ad43 Implement hashCode and equals for references 2012-11-10 13:08:06 -08:00
Ben Gruver
4060490e85 Get rid of old commented code block for methods in ClassDefinition 2012-11-09 23:56:13 -08:00
Ben Gruver
98eede2ce1 Don't write default field values for static final fields that are set in <clinit> 2012-11-09 23:55:15 -08:00
Ben Gruver
60631f684f Detect static final fields that are set in the static initializer 2012-11-09 23:55:12 -08:00
Ben Gruver
987cdc3e0e Sort the classes before disassembling 2012-11-09 22:54:39 -08:00
Ben Gruver
42b6dc3e37 Minor cleanup of synthetic accessor code 2012-11-09 22:34:20 -08:00
Ben Gruver
3563a20427 Fix invalid cast in ImmutableInstruction20t 2012-11-09 21:16:55 -08:00
Ben Gruver
2b8845bb24 Re-implement SyntheticAccessorResolver 2012-11-09 21:16:51 -08:00
Ben Gruver
db389aa3a1 Make ClassDef implement TypeReference 2012-11-04 22:49:36 -08:00
Ben Gruver
b116cb0ac9 Add DexBacked implementations for all instructions 2012-11-04 16:47:20 -08:00
Ben Gruver
f4662586da Clean up imports in dexlib2 2012-11-04 13:56:09 -08:00
Ben Gruver
b0383884fa Add and use ImmutabeleListUtils.nullToEmptyList() 2012-11-04 13:53:41 -08:00
Ben Gruver
a8e05220c1 Refactor how method/field/string/type references are handled 2012-11-04 13:04:21 -08:00
Ben Gruver
c42ffd8dbe Fix the offset calculation for paramater annotations 2012-11-03 18:06:47 -07:00
Ben Gruver
7fe0543b66 Cache the MethodParameters in MethodDefinition 2012-11-03 18:06:47 -07:00
Ben Gruver
6b93c7cc35 Don't precompute the full method string in MethodDefinition 2012-11-03 18:06:47 -07:00
Ben Gruver
d1662b67fe Refactor dexbacked implementations
Made construction of a new dexbacked item as light weight as possible,
only the very mimimum in computed/stored. Some of the values that were
previously calculated/loaded in the constructor are now lazily loaded
upon first use.

In general, nothing is cached, unless the item can't be fully read by
the consumer without causing the value to be computed multiple times.
Otherwise, it is up to the consume to decide if/when/what they want to
cache.
2012-11-03 18:06:41 -07:00
Ben Gruver
8ae711cf3b Get rid of the vestigal commented out code in IndentingWriter 2012-11-03 01:08:04 -07:00