| // Copyright (c) 2020, 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.classmerging.horizontal; |
| |
| import com.android.tools.r8.TestBase; |
| import com.android.tools.r8.TestParameters; |
| import com.android.tools.r8.TestParametersCollection; |
| import com.android.tools.r8.synthesis.SyntheticItemsTestUtils; |
| import com.android.tools.r8.utils.codeinspector.ClassSubject; |
| import com.android.tools.r8.utils.codeinspector.CodeInspector; |
| import org.junit.runner.RunWith; |
| import org.junit.runners.Parameterized; |
| |
| @RunWith(Parameterized.class) |
| public abstract class HorizontalClassMergingTestBase extends TestBase { |
| |
| protected final TestParameters parameters; |
| |
| protected HorizontalClassMergingTestBase(TestParameters parameters) { |
| this.parameters = parameters; |
| } |
| |
| @Parameterized.Parameters(name = "{0}") |
| public static TestParametersCollection data() { |
| return getTestParameters().withAllRuntimesAndApiLevels().build(); |
| } |
| |
| protected ClassSubject getSynthesizedArgumentClassSubject(CodeInspector codeInspector) { |
| return codeInspector.allClasses().stream() |
| .filter( |
| clazz -> |
| SyntheticItemsTestUtils.isHorizontalInitializerTypeArgument( |
| clazz.getOriginalReference())) |
| .findFirst() |
| .get(); |
| } |
| } |