langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
changeset 24396 3c36c6afcbca
parent 23975 c7c81595aea9
child 24648 3b639cd0c8bd
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri May 09 08:52:57 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri May 09 09:28:47 2014 -0400
@@ -928,7 +928,7 @@
         if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
         if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
         if (o instanceof Type) {
-            Type ty = ((Type)o).unannotatedType();
+            Type ty = (Type) o;
 
             if (ty instanceof Type.ArrayType) return syms.classType;
             if (ty instanceof Type.MethodType) return syms.methodTypeType;
@@ -1579,8 +1579,8 @@
 
     /** Add a catch clause to code.
      */
-    public void addCatch(
-        char startPc, char endPc, char handlerPc, char catchType) {
+    public void addCatch(char startPc, char endPc,
+                         char handlerPc, char catchType) {
             catchInfo.append(new char[]{startPc, endPc, handlerPc, catchType});
         }
 
@@ -2149,7 +2149,7 @@
             for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) {
                 TypeAnnotationPosition p = ta.position;
                 if (p.hasCatchType()) {
-                    final int idx = findExceptionIndex(p.getCatchType());
+                    final int idx = findExceptionIndex(p);
                     if (idx == -1)
                         Assert.error("Could not find exception index for type annotation " +
                                      ta + " on exception parameter");
@@ -2159,14 +2159,17 @@
         }
     }
 
-    private int findExceptionIndex(int catchType) {
+    private int findExceptionIndex(TypeAnnotationPosition p) {
+        final int catchType = p.getCatchType();
+        final int startPos = p.getStartPos();
+        final int len = catchInfo.length();
         List<char[]> iter = catchInfo.toList();
-        int len = catchInfo.length();
         for (int i = 0; i < len; ++i) {
             char[] catchEntry = iter.head;
             iter = iter.tail;
-            char ct = catchEntry[3];
-            if (catchType == ct) {
+            int ct = catchEntry[3];
+            int sp = catchEntry[0];
+            if (catchType == ct && sp == startPos) {
                 return i;
             }
         }