Do not create a HBoundType when the instruction is non-null.
We don't need to refine the type after a null check, if the
instruction is known non null or null. As a side effect, this
avoids replacing HLoadClass instructions with HBoundType instructions.
bug:22116987
(cherry picked from commit 3abd437507f8ba30a238a52c273c9944dcb9d5a1)
Change-Id: I5e56de293554534195ade9770b7d1e4b078d685b
diff --git a/test/519-bound-load-class/src/Main.java b/test/519-bound-load-class/src/Main.java
index 41bb951..cddeb09 100644
--- a/test/519-bound-load-class/src/Main.java
+++ b/test/519-bound-load-class/src/Main.java
@@ -16,9 +16,24 @@
public class Main {
public static void main(String[] args) {
+ testInstanceOf();
+ try {
+ testNull();
+ throw new Error("Expected ClassClastException");
+ } catch (ClassCastException e) { /* ignore */ }
+ }
+
+ public static void testInstanceOf() {
Object o = Main.class;
if (o instanceof Main) {
System.out.println((Main)o);
}
}
+
+ public static void testNull() {
+ Object o = Main.class;
+ if (o != null) {
+ System.out.println((Main)o);
+ }
+ }
}