blob: 24969a0ebaa879e732d8ad0ef7faa6f861606da8 [file] [log] [blame]
// 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.desugaredlibrary;
import static com.android.tools.r8.desugar.desugaredlibrary.test.CompilationSpecification.D8_L8DEBUG;
import static com.android.tools.r8.desugar.desugaredlibrary.test.CompilationSpecification.D8_L8SHRINK;
import static com.android.tools.r8.desugar.desugaredlibrary.test.LibraryDesugaringSpecification.JDK11_CHM_ONLY;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.desugar.desugaredlibrary.test.CompilationSpecification;
import com.android.tools.r8.desugar.desugaredlibrary.test.LibraryDesugaringSpecification;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.google.common.collect.ImmutableList;
import java.util.List;
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 DesugaredLibraryCHMOnlyContentTest extends DesugaredLibraryTestBase {
private final CompilationSpecification compilationSpecification;
private final LibraryDesugaringSpecification libraryDesugaringSpecification;
@Parameters(name = "{0}, spec: {1}, {2}")
public static List<Object[]> data() {
return buildParameters(
getTestParameters().withNoneRuntime().build(),
ImmutableList.of(JDK11_CHM_ONLY),
ImmutableList.of(D8_L8DEBUG, D8_L8SHRINK));
}
public DesugaredLibraryCHMOnlyContentTest(
TestParameters parameters,
LibraryDesugaringSpecification libraryDesugaringSpecification,
CompilationSpecification compilationSpecification) {
this.compilationSpecification = compilationSpecification;
this.libraryDesugaringSpecification = libraryDesugaringSpecification;
}
@Test
public void testDesugaredLibraryContentCHMOnly() throws Throwable {
testForL8(AndroidApiLevel.B)
.apply(
b ->
libraryDesugaringSpecification.configureL8TestBuilder(
b, compilationSpecification.isL8Shrink(), "-keep class * { *; }"))
.compile()
.inspect(
inspector -> {
assert inspector.clazz("j$.util.concurrent.ConcurrentHashMap").isPresent();
});
}
}