diff options
author | kmb <kmb@google.com> | 2018-03-02 14:41:23 -0800 |
---|---|---|
committer | Ivan Gavrilovic <gavra@google.com> | 2018-05-04 10:39:36 +0100 |
commit | 1c433fd1116c4ca655503e7cffa13679c31f0b99 (patch) | |
tree | c91dd3ce1c94d5d7bf6591fc5667eb01ec498c8c /test | |
parent | 63cde3a65d10f7f94460547042566f940d5453f0 (diff) | |
download | desugar-1c433fd1116c4ca655503e7cffa13679c31f0b99.tar.gz |
emulate dynamic dispatch of emulated default interface methods
RELNOTES: None.
PiperOrigin-RevId: 187671513
GitOrigin-RevId: babbfdc6cb98a23fe0dadf02d7dc407504e9cac5
Change-Id: Ie23b521a82464d07f625cefad8418c502f0978f0
Diffstat (limited to 'test')
-rw-r--r-- | test/java/com/google/devtools/build/android/desugar/CoreLibrarySupportTest.java | 36 | ||||
-rw-r--r-- | test/java/com/google/devtools/build/android/desugar/CorePackageRenamerTest.java | 1 |
2 files changed, 23 insertions, 14 deletions
diff --git a/test/java/com/google/devtools/build/android/desugar/CoreLibrarySupportTest.java b/test/java/com/google/devtools/build/android/desugar/CoreLibrarySupportTest.java index e6f34ba..ec4e16d 100644 --- a/test/java/com/google/devtools/build/android/desugar/CoreLibrarySupportTest.java +++ b/test/java/com/google/devtools/build/android/desugar/CoreLibrarySupportTest.java @@ -34,7 +34,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), null, - null, ImmutableList.of("java/time/"), ImmutableList.of(), ImmutableList.of(), @@ -53,7 +52,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter("__/"), null, - null, ImmutableList.of("java/time/"), ImmutableList.of(), ImmutableList.of(), @@ -72,7 +70,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), null, - null, ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), @@ -87,7 +84,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter("__/"), null, - null, ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), @@ -102,7 +98,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter("__/"), null, - null, ImmutableList.of("java/util/Helper"), ImmutableList.of(), ImmutableList.of("java/util/Existing#match -> java/util/Helper"), @@ -119,7 +114,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), Thread.currentThread().getContextClassLoader(), - null, ImmutableList.of("java/util/concurrent/"), ImmutableList.of("java/util/Map"), ImmutableList.of(), @@ -139,7 +133,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), Thread.currentThread().getContextClassLoader(), - null, ImmutableList.of(), ImmutableList.of("java/util/Collection"), ImmutableList.of(), @@ -176,7 +169,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), Thread.currentThread().getContextClassLoader(), - null, ImmutableList.of(), ImmutableList.of("java/util/Collection"), ImmutableList.of(), @@ -205,7 +197,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), Thread.currentThread().getContextClassLoader(), - null, ImmutableList.of(), ImmutableList.of("java/util/Map"), ImmutableList.of(), @@ -242,7 +233,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), Thread.currentThread().getContextClassLoader(), - null, ImmutableList.of(), ImmutableList.of("java/util/Comparator"), ImmutableList.of(), @@ -267,7 +257,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), Thread.currentThread().getContextClassLoader(), - null, ImmutableList.of("java/util/"), ImmutableList.of(), ImmutableList.of(), @@ -337,7 +326,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), Thread.currentThread().getContextClassLoader(), - null, ImmutableList.of("java/util/concurrent/"), // should return null for these ImmutableList.of("java/util/Map"), ImmutableList.of(), @@ -366,7 +354,6 @@ public class CoreLibrarySupportTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), Thread.currentThread().getContextClassLoader(), - null, ImmutableList.of(), ImmutableList.of("java/util/Collection"), ImmutableList.of(), @@ -388,4 +375,27 @@ public class CoreLibrarySupportTest { false)) .isNull(); } + + @Test + public void testEmulatedMethod_nullExceptions() throws Exception { + CoreLibrarySupport.EmulatedMethod m = + CoreLibrarySupport.EmulatedMethod.create(1, Number.class, "a", "()V", null); + assertThat(m.access()).isEqualTo(1); + assertThat(m.owner()).isEqualTo(Number.class); + assertThat(m.name()).isEqualTo("a"); + assertThat(m.descriptor()).isEqualTo("()V"); + assertThat(m.exceptions()).isEmpty(); + } + + @Test + public void testEmulatedMethod_givenExceptions() throws Exception { + CoreLibrarySupport.EmulatedMethod m = + CoreLibrarySupport.EmulatedMethod.create( + 1, Number.class, "a", "()V", new String[] {"b", "c"}); + assertThat(m.access()).isEqualTo(1); + assertThat(m.owner()).isEqualTo(Number.class); + assertThat(m.name()).isEqualTo("a"); + assertThat(m.descriptor()).isEqualTo("()V"); + assertThat(m.exceptions()).containsExactly("b", "c").inOrder(); + } } diff --git a/test/java/com/google/devtools/build/android/desugar/CorePackageRenamerTest.java b/test/java/com/google/devtools/build/android/desugar/CorePackageRenamerTest.java index 95d7b41..2bdd58b 100644 --- a/test/java/com/google/devtools/build/android/desugar/CorePackageRenamerTest.java +++ b/test/java/com/google/devtools/build/android/desugar/CorePackageRenamerTest.java @@ -35,7 +35,6 @@ public class CorePackageRenamerTest { new CoreLibrarySupport( new CoreLibraryRewriter(""), null, - null, ImmutableList.of("java/time/"), ImmutableList.of(), ImmutableList.of("java/util/A#m->java/time/B"), |