Initial push.
diff --git a/src/test/examples/shaking12/AnimalClass.java b/src/test/examples/shaking12/AnimalClass.java
new file mode 100644
index 0000000..87557b3
--- /dev/null
+++ b/src/test/examples/shaking12/AnimalClass.java
@@ -0,0 +1,12 @@
+// Copyright (c) 2016, 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 shaking12;
+
+public class AnimalClass extends Named {
+
+ @Override
+ public String getName() {
+ return "AnimalClass";
+ }
+}
diff --git a/src/test/examples/shaking12/MetaphorClass.java b/src/test/examples/shaking12/MetaphorClass.java
new file mode 100644
index 0000000..3192368
--- /dev/null
+++ b/src/test/examples/shaking12/MetaphorClass.java
@@ -0,0 +1,11 @@
+// Copyright (c) 2016, 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 shaking12;
+
+public class MetaphorClass extends Named {
+
+ public String getName() {
+ return "MetaphorClass";
+ }
+}
diff --git a/src/test/examples/shaking12/Named.java b/src/test/examples/shaking12/Named.java
new file mode 100644
index 0000000..b829050
--- /dev/null
+++ b/src/test/examples/shaking12/Named.java
@@ -0,0 +1,9 @@
+// Copyright (c) 2016, 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 shaking12;
+
+public abstract class Named {
+
+ public abstract String getName();
+}
diff --git a/src/test/examples/shaking12/PeopleClass.java b/src/test/examples/shaking12/PeopleClass.java
new file mode 100644
index 0000000..24c1f3e
--- /dev/null
+++ b/src/test/examples/shaking12/PeopleClass.java
@@ -0,0 +1,12 @@
+// Copyright (c) 2016, 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 shaking12;
+
+public class PeopleClass extends Named {
+
+ @Override
+ public String getName() {
+ return "PeopleClass";
+ }
+}
diff --git a/src/test/examples/shaking12/Shaking.java b/src/test/examples/shaking12/Shaking.java
new file mode 100644
index 0000000..3d1c40e
--- /dev/null
+++ b/src/test/examples/shaking12/Shaking.java
@@ -0,0 +1,41 @@
+// Copyright (c) 2016, 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 shaking12;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class Shaking {
+
+ static private Named createInstance(Class<? extends Named> aClass) {
+ try {
+ return aClass.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return new Named() {
+ @Override
+ public String getName() {
+ return "Unknown";
+ }
+ };
+ }
+
+ public static void main(String[] args) {
+ List<Class<? extends Named>> classes = new ArrayList<>(3);
+ classes.add(MetaphorClass.class);
+ classes.add(PeopleClass.class);
+ classes.add(ThingClass.class);
+ Iterator<Class<? extends Named>> iterator = classes.iterator();
+ iterator.next();
+ while (iterator.hasNext()) {
+ Named item = createInstance(iterator.next());
+ if (item instanceof AnimalClass) {
+ System.out.println("An animal!");
+ }
+ System.out.println(createInstance(iterator.next()).getName());
+ }
+ }
+}
diff --git a/src/test/examples/shaking12/ThingClass.java b/src/test/examples/shaking12/ThingClass.java
new file mode 100644
index 0000000..554b87b
--- /dev/null
+++ b/src/test/examples/shaking12/ThingClass.java
@@ -0,0 +1,11 @@
+// Copyright (c) 2016, 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 shaking12;
+
+public class ThingClass extends Named {
+
+ public String getName() {
+ return "ThingClass";
+ }
+}
diff --git a/src/test/examples/shaking12/keep-rules.txt b/src/test/examples/shaking12/keep-rules.txt
new file mode 100644
index 0000000..6a5e277
--- /dev/null
+++ b/src/test/examples/shaking12/keep-rules.txt
@@ -0,0 +1,17 @@
+# Copyright (c) 2016, 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 shaking12.Shaking {
+ public static void main(...);
+}
+
+# Keep the constructors that are used via newInstance.
+-keep public class shaking12.ThingClass,shaking12.PeopleClass {
+ <init>(...);
+}
+
+# allow access modification to enable minifcation
+-allowaccessmodification
\ No newline at end of file