Add a test that we do not remove abstract methods if they only
shadow library methods.
Bug:
Change-Id: I980b6450f75c69b534058c14b4e7bbf81248ec7b
diff --git a/src/test/examples/shaking17/AbstractProgramClass.java b/src/test/examples/shaking17/AbstractProgramClass.java
new file mode 100644
index 0000000..d3b696b
--- /dev/null
+++ b/src/test/examples/shaking17/AbstractProgramClass.java
@@ -0,0 +1,9 @@
+// Copyright (c) 2017, 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 shaking17;
+
+public abstract class AbstractProgramClass extends shakinglib.AbstractLibraryClass {
+
+ public abstract int abstractMethod();
+}
diff --git a/src/test/examples/shaking17/Shaking.java b/src/test/examples/shaking17/Shaking.java
new file mode 100644
index 0000000..78cc495
--- /dev/null
+++ b/src/test/examples/shaking17/Shaking.java
@@ -0,0 +1,16 @@
+// Copyright (c) 2017, 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 shaking17;
+
+public class Shaking {
+
+ public static void main(String[] args) {
+ Subclass subclass = new Subclass();
+ callTheMethod(subclass);
+ }
+
+ private static void callTheMethod(AbstractProgramClass abstractProgramClass) {
+ System.out.print(abstractProgramClass.abstractMethod());
+ }
+}
diff --git a/src/test/examples/shaking17/Subclass.java b/src/test/examples/shaking17/Subclass.java
new file mode 100644
index 0000000..237dca9
--- /dev/null
+++ b/src/test/examples/shaking17/Subclass.java
@@ -0,0 +1,12 @@
+// Copyright (c) 2017, 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 shaking17;
+
+public class Subclass extends AbstractProgramClass {
+
+ @Override
+ public int abstractMethod() {
+ return 42;
+ }
+}
diff --git a/src/test/examples/shaking17/keep-rules.txt b/src/test/examples/shaking17/keep-rules.txt
new file mode 100644
index 0000000..27dd8f3
--- /dev/null
+++ b/src/test/examples/shaking17/keep-rules.txt
@@ -0,0 +1,9 @@
+# Copyright (c) 2017, 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.
+
+# Keep the application entry point. Get rid of everything that is not
+# reachable from there.
+-keep public class shaking17.Shaking {
+ public static void main(...);
+}
diff --git a/src/test/examples/shakinglib/AbstractLibraryClass.java b/src/test/examples/shakinglib/AbstractLibraryClass.java
new file mode 100644
index 0000000..614b53e
--- /dev/null
+++ b/src/test/examples/shakinglib/AbstractLibraryClass.java
@@ -0,0 +1,9 @@
+// Copyright (c) 2017, 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 shakinglib;
+
+public abstract class AbstractLibraryClass {
+
+ public abstract int abstractMethod();
+}