--- 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) {