Merge "Disable class merging in R8KotlinPropertiesTest"
diff --git a/src/test/java/com/android/tools/r8/kotlin/R8KotlinPropertiesTest.java b/src/test/java/com/android/tools/r8/kotlin/R8KotlinPropertiesTest.java
index 74e3d5e..6ebb08b 100644
--- a/src/test/java/com/android/tools/r8/kotlin/R8KotlinPropertiesTest.java
+++ b/src/test/java/com/android/tools/r8/kotlin/R8KotlinPropertiesTest.java
@@ -83,13 +83,16 @@
.addProperty("internalLateInitProp", JAVA_LANG_STRING, Visibility.INTERNAL)
.addProperty("publicLateInitProp", JAVA_LANG_STRING, Visibility.PUBLIC);
- private Consumer<InternalOptions> disableClassInliner = o -> o.enableClassInlining = false;
+ private Consumer<InternalOptions> disableClassInliningAndMerging = o -> {
+ o.enableClassInlining = false;
+ o.enableClassMerging = false;
+ };
@Test
public void testMutableProperty_getterAndSetterAreRemoveIfNotUsed() throws Exception {
String mainClass = addMainToClasspath("properties/MutablePropertyKt",
"mutableProperty_noUseOfProperties");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
MUTABLE_PROPERTY_CLASS.getClassName());
@@ -112,7 +115,7 @@
public void testMutableProperty_privateIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath("properties/MutablePropertyKt",
"mutableProperty_usePrivateProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
MUTABLE_PROPERTY_CLASS.getClassName());
@@ -134,7 +137,7 @@
public void testMutableProperty_protectedIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath("properties/MutablePropertyKt",
"mutableProperty_useProtectedProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
MUTABLE_PROPERTY_CLASS.getClassName());
@@ -157,7 +160,7 @@
public void testMutableProperty_internalIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath("properties/MutablePropertyKt",
"mutableProperty_useInternalProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
MUTABLE_PROPERTY_CLASS.getClassName());
@@ -180,7 +183,7 @@
public void testMutableProperty_publicIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath("properties/MutablePropertyKt",
"mutableProperty_usePublicProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
MUTABLE_PROPERTY_CLASS.getClassName());
@@ -203,7 +206,7 @@
public void testMutableProperty_primitivePropertyIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath("properties/MutablePropertyKt",
"mutableProperty_usePrimitiveProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
MUTABLE_PROPERTY_CLASS.getClassName());
@@ -228,7 +231,7 @@
public void testLateInitProperty_getterAndSetterAreRemoveIfNotUsed() throws Exception {
String mainClass = addMainToClasspath("properties/LateInitPropertyKt",
"lateInitProperty_noUseOfProperties");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
LATE_INIT_PROPERTY_CLASS.getClassName());
@@ -252,7 +255,7 @@
public void testLateInitProperty_privateIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath(
"properties/LateInitPropertyKt", "lateInitProperty_usePrivateLateInitProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
LATE_INIT_PROPERTY_CLASS.getClassName());
@@ -275,7 +278,7 @@
public void testLateInitProperty_protectedIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath("properties/LateInitPropertyKt",
"lateInitProperty_useProtectedLateInitProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
LATE_INIT_PROPERTY_CLASS.getClassName());
@@ -296,7 +299,7 @@
public void testLateInitProperty_internalIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath(
"properties/LateInitPropertyKt", "lateInitProperty_useInternalLateInitProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
LATE_INIT_PROPERTY_CLASS.getClassName());
@@ -315,7 +318,7 @@
public void testLateInitProperty_publicIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath(
"properties/LateInitPropertyKt", "lateInitProperty_usePublicLateInitProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
LATE_INIT_PROPERTY_CLASS.getClassName());
@@ -334,7 +337,7 @@
public void testUserDefinedProperty_getterAndSetterAreRemoveIfNotUsed() throws Exception {
String mainClass = addMainToClasspath(
"properties/UserDefinedPropertyKt", "userDefinedProperty_noUseOfProperties");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
USER_DEFINED_PROPERTY_CLASS.getClassName());
@@ -351,7 +354,7 @@
public void testUserDefinedProperty_publicIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath(
"properties/UserDefinedPropertyKt", "userDefinedProperty_useProperties");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject classSubject = checkClassIsKept(dexInspector,
USER_DEFINED_PROPERTY_CLASS.getClassName());
@@ -377,7 +380,7 @@
public void testCompanionProperty_primitivePropertyCannotBeInlined() throws Exception {
String mainClass = addMainToClasspath(
"properties.CompanionPropertiesKt", "companionProperties_usePrimitiveProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject outerClass = checkClassIsKept(dexInspector,
"properties.CompanionProperties");
@@ -408,7 +411,7 @@
public void testCompanionProperty_privatePropertyIsAlwaysInlined() throws Exception {
String mainClass = addMainToClasspath(
"properties.CompanionPropertiesKt", "companionProperties_usePrivateProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject outerClass = checkClassIsKept(dexInspector,
"properties.CompanionProperties");
@@ -442,7 +445,7 @@
public void testCompanionProperty_internalPropertyCannotBeInlined() throws Exception {
String mainClass = addMainToClasspath(
"properties.CompanionPropertiesKt", "companionProperties_useInternalProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject outerClass = checkClassIsKept(dexInspector,
"properties.CompanionProperties");
@@ -473,7 +476,7 @@
public void testCompanionProperty_publicPropertyCannotBeInlined() throws Exception {
String mainClass = addMainToClasspath(
"properties.CompanionPropertiesKt", "companionProperties_usePublicProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject outerClass = checkClassIsKept(dexInspector,
"properties.CompanionProperties");
@@ -505,7 +508,7 @@
final TestKotlinCompanionClass testedClass = COMPANION_LATE_INIT_PROPERTY_CLASS;
String mainClass = addMainToClasspath("properties.CompanionLateInitPropertiesKt",
"companionLateInitProperties_usePrivateLateInitProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject outerClass = checkClassIsKept(dexInspector, testedClass.getOuterClassName());
ClassSubject companionClass = checkClassIsKept(dexInspector, testedClass.getClassName());
@@ -536,7 +539,7 @@
final TestKotlinCompanionClass testedClass = COMPANION_LATE_INIT_PROPERTY_CLASS;
String mainClass = addMainToClasspath("properties.CompanionLateInitPropertiesKt",
"companionLateInitProperties_useInternalLateInitProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject outerClass = checkClassIsKept(dexInspector, testedClass.getOuterClassName());
ClassSubject companionClass = checkClassIsKept(dexInspector, testedClass.getClassName());
@@ -560,7 +563,7 @@
final TestKotlinCompanionClass testedClass = COMPANION_LATE_INIT_PROPERTY_CLASS;
String mainClass = addMainToClasspath("properties.CompanionLateInitPropertiesKt",
"companionLateInitProperties_usePublicLateInitProp");
- runTest(PACKAGE_NAME, mainClass, disableClassInliner, (app) -> {
+ runTest(PACKAGE_NAME, mainClass, disableClassInliningAndMerging, (app) -> {
DexInspector dexInspector = new DexInspector(app);
ClassSubject outerClass = checkClassIsKept(dexInspector, testedClass.getOuterClassName());
ClassSubject companionClass = checkClassIsKept(dexInspector, testedClass.getClassName());