| // Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| package com.android.tools.r8.desugar.corelib; |
| |
| import com.android.tools.r8.TestParameters; |
| import com.android.tools.r8.TestParametersCollection; |
| import com.android.tools.r8.utils.StringUtils; |
| import java.time.chrono.Chronology; |
| import java.util.Map; |
| import org.junit.Test; |
| import org.junit.runner.RunWith; |
| import org.junit.runners.Parameterized; |
| import org.junit.runners.Parameterized.Parameters; |
| |
| @RunWith(Parameterized.class) |
| public class StaticInterfaceMethodTest extends CoreLibDesugarTestBase { |
| |
| private final TestParameters parameters; |
| |
| @Parameters(name = "{0}") |
| public static TestParametersCollection data() { |
| return getTestParameters().withDexRuntimes().withAllApiLevels().build(); |
| } |
| |
| public StaticInterfaceMethodTest(TestParameters parameters) { |
| this.parameters = parameters; |
| } |
| |
| @Test |
| public void testStaticInterfaceMethods() throws Exception { |
| testForD8() |
| .addInnerClasses(StaticInterfaceMethodTest.class) |
| .setMinApi(parameters.getApiLevel()) |
| .enableCoreLibraryDesugaring(parameters.getApiLevel()) |
| .compile() |
| .addDesugaredCoreLibraryRunClassPath(this::buildDesugaredLibrary, parameters.getApiLevel()) |
| .run(parameters.getRuntime(), Executor.class) |
| .assertSuccessWithOutput(StringUtils.lines("false", "java.util.HashSet")); |
| } |
| |
| static class Executor { |
| |
| public static void main(String[] args) { |
| System.out.println(Map.Entry.comparingByKey() == null); |
| System.out.println(Chronology.getAvailableChronologies().getClass().getName()); |
| } |
| } |
| } |