8040181: Silent failure in Code.findExceptionIndex
authoremc
Mon, 14 Apr 2014 18:48:29 -0400
changeset 23966 b9646c1a1666
parent 23816 b47e02119575
child 23967 8e99a0524d72
8040181: Silent failure in Code.findExceptionIndex Summary: Remove silent failure when exception index has not been set properly. Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Wed Jul 05 19:36:17 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Mon Apr 14 18:48:29 2014 -0400
@@ -2154,6 +2154,9 @@
                 // A TA position is shared for all type annotations in the
                 // same location; updating one is enough.
                 // Use -666 as a marker that the exception_index was already updated.
+                Assert.check(p.type_index != Integer.MIN_VALUE,
+                             "type_index of exception parameter type annotation " +
+                             ta + " was not set correctly");
                 if (p.type_index != -666) {
                     p.exception_index = findExceptionIndex(p.type_index);
                     p.type_index = -666;
@@ -2163,12 +2166,6 @@
     }
 
     private int findExceptionIndex(int catchType) {
-        if (catchType == Integer.MIN_VALUE) {
-            // We didn't set the catch type index correctly.
-            // This shouldn't happen.
-            // TODO: issue error?
-            return -1;
-        }
         List<char[]> iter = catchInfo.toList();
         int len = catchInfo.length();
         for (int i = 0; i < len; ++i) {