diff options
| author | mikaelpeltier <mikaelpeltier@google.com> | 2014-07-11 17:49:12 +0200 |
|---|---|---|
| committer | mikaelpeltier <mikaelpeltier@google.com> | 2014-07-15 17:57:04 +0200 |
| commit | b06a7dad8ea24fce8d2bc360d6d0ba1305643b35 (patch) | |
| tree | edb4356e7b7701e706824076a1ce101caf69400a /dexcomparator | |
| parent | c86f3351521d0268629836c18fb37831f9e773ba (diff) | |
| download | toolchain_jack-b06a7dad8ea24fce8d2bc360d6d0ba1305643b35.tar.gz toolchain_jack-b06a7dad8ea24fce8d2bc360d6d0ba1305643b35.tar.bz2 toolchain_jack-b06a7dad8ea24fce8d2bc360d6d0ba1305643b35.zip | |
Modify how annotation comparator get files
- Files to compare are passed as method parameters rather than as constructor
parameters. It will be homogeneous with dex comparator.
Change-Id: I6823da467c5f6fed26caf3e40c3a36d0b205d8b2
Diffstat (limited to 'dexcomparator')
3 files changed, 9 insertions, 15 deletions
diff --git a/dexcomparator/src/com/android/jack/DexAnnotationsComparator.java b/dexcomparator/src/com/android/jack/DexAnnotationsComparator.java index 088c0d9f..7df6d111 100644 --- a/dexcomparator/src/com/android/jack/DexAnnotationsComparator.java +++ b/dexcomparator/src/com/android/jack/DexAnnotationsComparator.java @@ -73,10 +73,6 @@ public class DexAnnotationsComparator { @Nonnull private final Logger logger; @Nonnull - private final DexFile referenceDexFile; - @Nonnull - private final DexFile candidateDexFile; - @Nonnull private static final Level ERROR_LEVEL = Level.SEVERE; @Nonnull private static final Level DEBUG_LEVEL = Level.FINE; @@ -86,17 +82,16 @@ public class DexAnnotationsComparator { private static final boolean TOLERATE_MISSING_INITS = true; private static final boolean TOLERATE_MISSING_CLINITS = true; - public DexAnnotationsComparator( - @Nonnull File referenceFile, @Nonnull File candidateFile) throws IOException { + public DexAnnotationsComparator() { logger = Logger.getLogger(this.getClass().getName()); logger.setLevel(ERROR_LEVEL); - - referenceDexFile = new DexFile(referenceFile); - candidateDexFile = new DexFile(candidateFile); } @SuppressWarnings("unchecked") - public void compare() throws DifferenceFoundException { + public void compare(@Nonnull File referenceFile, @Nonnull File candidateFile) + throws DifferenceFoundException, IOException { + DexFile referenceDexFile = new DexFile(referenceFile); + DexFile candidateDexFile = new DexFile(candidateFile); /* Reuse delegate instance for maximum memory saving */ CompareElementAnnotation compareElementAnnotation = diff --git a/dexcomparator/src/com/android/jack/DexComparator.java b/dexcomparator/src/com/android/jack/DexComparator.java index 2e980544..5b0aeb7f 100644 --- a/dexcomparator/src/com/android/jack/DexComparator.java +++ b/dexcomparator/src/com/android/jack/DexComparator.java @@ -1021,5 +1021,4 @@ public class DexComparator { return position; } } - } diff --git a/dexcomparator/testing/com/android/jack/dexcomparator/test/AnnotationComparisonTest.java b/dexcomparator/testing/com/android/jack/dexcomparator/test/AnnotationComparisonTest.java index 131220a1..9060077d 100644 --- a/dexcomparator/testing/com/android/jack/dexcomparator/test/AnnotationComparisonTest.java +++ b/dexcomparator/testing/com/android/jack/dexcomparator/test/AnnotationComparisonTest.java @@ -48,7 +48,7 @@ public class AnnotationComparisonTest { File dex2 = File.createTempFile("dex2", ".dex"); dex2.deleteOnExit(); TestTools.compileToDexWithJack(a2, dex2); - new DexAnnotationsComparator(dex1, dex2).compare(); + new DexAnnotationsComparator().compare(dex1, dex2); } @Test @@ -63,7 +63,7 @@ public class AnnotationComparisonTest { File dex2 = File.createTempFile("dex2", ".dex"); dex2.deleteOnExit(); TestTools.compileToDexWithJack(a2, dex2); - new DexAnnotationsComparator(dex1, dex2).compare(); + new DexAnnotationsComparator().compare(dex1, dex2); } @Test @@ -83,7 +83,7 @@ public class AnnotationComparisonTest { sourceList2.add(new File(testSource2, sourcePath2)); TestTools.compileToDexWithJack(sourceList2, dex2); try { - new DexAnnotationsComparator(dex1, dex2).compare(); + new DexAnnotationsComparator().compare(dex1, dex2); Assert.fail(); } catch (DifferenceFoundException e) { } @@ -100,7 +100,7 @@ public class AnnotationComparisonTest { sourceList1.add(new File(testSource1, sourcePath1)); sourceList1.add(new File(testSource1, sourcePath2)); TestTools.compileToDexWithJack(sourceList1, dex1); - new DexAnnotationsComparator(dex1, dex1).compare(); + new DexAnnotationsComparator().compare(dex1, dex1); } } |
