langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
changeset 7622 ee16e77d07f0
parent 7618 c933cd84d33e
child 7628 e7baeb97d164
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Dec 06 11:49:00 2010 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Dec 06 11:50:37 2010 +0000
@@ -2889,8 +2889,15 @@
     }
 
     public void visitTypeDisjunction(JCTypeDisjunction tree) {
-        List<Type> alternatives = attribTypes(tree.alternatives, env);
-        tree.type = result = check(tree, types.lub(alternatives), TYP, pkind, pt);
+        ListBuffer<Type> multicatchTypes = ListBuffer.lb();
+        for (JCExpression typeTree : tree.alternatives) {
+            Type ctype = attribType(typeTree, env);
+            ctype = chk.checkType(typeTree.pos(),
+                          chk.checkClassType(typeTree.pos(), ctype),
+                          syms.throwableType);
+            multicatchTypes.append(ctype);
+        }
+        tree.type = result = check(tree, types.lub(multicatchTypes.toList()), TYP, pkind, pt);
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {