8058708: java.lang.AssertionError compiling source code
authorvromero
Thu, 25 Sep 2014 17:09:23 -0700
changeset 26784 6be305e56bcb
parent 26783 73a2b5540efc
child 26785 e185fbd15994
8058708: java.lang.AssertionError compiling source code Reviewed-by: jjg
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java
langtools/test/tools/javac/flow/LVTHarness.java
langtools/test/tools/javac/flow/tests/TestCaseIf.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Sep 25 16:21:30 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Sep 25 17:09:23 2014 -0700
@@ -2032,12 +2032,11 @@
 
     void adjustAliveRanges(int oldCP, int delta) {
         for (LocalVar localVar: lvar) {
-            if (localVar == null) {
-                return;
-            }
-            for (LocalVar.Range range: localVar.aliveRanges) {
-                if (range.closed() && range.start_pc + range.length >= oldCP) {
-                    range.length += delta;
+            if (localVar != null) {
+                for (LocalVar.Range range: localVar.aliveRanges) {
+                    if (range.closed() && range.start_pc + range.length >= oldCP) {
+                        range.length += delta;
+                    }
                 }
             }
         }
--- a/langtools/test/tools/javac/flow/LVTHarness.java	Thu Sep 25 16:21:30 2014 -0700
+++ b/langtools/test/tools/javac/flow/LVTHarness.java	Thu Sep 25 17:09:23 2014 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7047734 8027660 8037937 8047719
+ * @bug 7047734 8027660 8037937 8047719 8058708
  * @summary The LVT is not generated correctly during some try/catch scenarios
  *          javac crash while creating LVT entry for a local variable defined in
  *          an inner block
--- a/langtools/test/tools/javac/flow/tests/TestCaseIf.java	Thu Sep 25 16:21:30 2014 -0700
+++ b/langtools/test/tools/javac/flow/tests/TestCaseIf.java	Thu Sep 25 17:09:23 2014 -0700
@@ -58,4 +58,18 @@
         }
         o = "";
     }
+
+    @AliveRange(varName="finalLocal", bytecodeStart=11, bytecodeLength=6)
+    @AliveRange(varName="used", bytecodeStart=13, bytecodeLength=4)
+    void m5(Object o) {
+        if (o != null) {
+            Object notUsed;
+            Object used;
+            if (o != null) {
+                final Object finalLocal = null;
+                used = null;
+                if (o == null) {}
+            }
+        }
+    }
 }