| // 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.shaking; |
| |
| import com.android.tools.r8.CompilationFailedException; |
| import com.android.tools.r8.TestBase; |
| import java.io.IOException; |
| import org.junit.Ignore; |
| import org.junit.Test; |
| |
| class UnusedTypeInThrowing { |
| |
| public static void main(String[] args) throws UnusedTypeInThrowingThrowable { |
| System.out.print("42"); |
| } |
| } |
| |
| class UnusedTypeInThrowingThrowable extends Throwable {} |
| |
| public class UnusedTypeInThrowingTest extends TestBase { |
| |
| static final Class THROWABLE_CLASS = UnusedTypeInThrowingThrowable.class; |
| static final Class MAIN_CLASS = UnusedTypeInThrowing.class; |
| |
| @Test |
| @Ignore("b/124019003") |
| public void testTypeIsMarkedAsLive() throws IOException, CompilationFailedException { |
| testForR8(Backend.CF) |
| .addProgramClasses(MAIN_CLASS) |
| .addProgramClasses(THROWABLE_CLASS) |
| .addKeepMainRule(MAIN_CLASS) |
| .addKeepRules("-keepattributes Exceptions") |
| .run(MAIN_CLASS) |
| .assertSuccessWithOutput("42"); |
| } |
| } |