blob: 1f2328349dd0b73d95909784d4ba945a2d49a5c6 [file] [log] [blame]
// Copyright (c) 2021, 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.naming.adaptclassstrings;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestParametersCollection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
/** This is a regression test for b/210699098 */
public class RepackageMinificationNameClashTest extends TestBase {
@Parameter() public TestParameters parameters;
@Parameters(name = "{0}")
public static TestParametersCollection data() {
return getTestParameters().withAllRuntimesAndApiLevels().build();
}
@Test
public void testR8() throws Exception {
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.setMinApi(parameters.getApiLevel())
.addKeepRules("-repackageclasses ''")
.addKeepRules("-adaptclassstrings")
.addKeepClassRulesWithAllowObfuscation(Foo.class)
.addKeepMainRule(Main.class)
.run(parameters.getRuntime(), Main.class)
.assertSuccessWithOutputLines("RepackageMinificationNameClashTest$Foo");
}
public static class Foo {}
public static class Main {
public static void main(String[] args) {
System.out.println("RepackageMinificationNameClashTest$Foo");
}
}
}