langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
changeset 5492 515e4b33b335
parent 5004 6c2694dc2da0
child 5520 86e4b9a9da40
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Sun May 02 15:55:02 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon May 03 17:12:59 2010 -0700
@@ -1454,20 +1454,26 @@
                       int startpc, int endpc,
                       List<Integer> gaps) {
             if (startpc != endpc) {
-                int catchType = makeRef(tree.pos(), tree.param.type);
-                while (gaps.nonEmpty()) {
-                    int end = gaps.head.intValue();
-                    registerCatch(tree.pos(),
-                                  startpc,  end, code.curPc(),
-                                  catchType);
-                    gaps = gaps.tail;
-                    startpc = gaps.head.intValue();
-                    gaps = gaps.tail;
+                List<JCExpression> subClauses = TreeInfo.isMultiCatch(tree) ?
+                    ((JCTypeDisjoint)tree.param.vartype).components :
+                    List.of(tree.param.vartype);
+                for (JCExpression subCatch : subClauses) {
+                    int catchType = makeRef(tree.pos(), subCatch.type);
+                    List<Integer> lGaps = gaps;
+                    while (lGaps.nonEmpty()) {
+                        int end = lGaps.head.intValue();
+                        registerCatch(tree.pos(),
+                                      startpc,  end, code.curPc(),
+                                      catchType);
+                        lGaps = lGaps.tail;
+                        startpc = lGaps.head.intValue();
+                        lGaps = lGaps.tail;
+                    }
+                    if (startpc < endpc)
+                        registerCatch(tree.pos(),
+                                      startpc, endpc, code.curPc(),
+                                      catchType);
                 }
-                if (startpc < endpc)
-                    registerCatch(tree.pos(),
-                                  startpc, endpc, code.curPc(),
-                                  catchType);
                 VarSymbol exparam = tree.param.sym;
                 code.statBegin(tree.pos);
                 code.markStatBegin();