1110 Env<AttrContext> catchEnv = |
1110 Env<AttrContext> catchEnv = |
1111 localEnv.dup(c, localEnv.info.dup(localEnv.info.scope.dup())); |
1111 localEnv.dup(c, localEnv.info.dup(localEnv.info.scope.dup())); |
1112 Type ctype = attribStat(c.param, catchEnv); |
1112 Type ctype = attribStat(c.param, catchEnv); |
1113 if (TreeInfo.isMultiCatch(c)) { |
1113 if (TreeInfo.isMultiCatch(c)) { |
1114 //multi-catch parameter is implicitly marked as final |
1114 //multi-catch parameter is implicitly marked as final |
1115 c.param.sym.flags_field |= FINAL | DISJUNCTION; |
1115 c.param.sym.flags_field |= FINAL | UNION; |
1116 } |
1116 } |
1117 if (c.param.sym.kind == Kinds.VAR) { |
1117 if (c.param.sym.kind == Kinds.VAR) { |
1118 c.param.sym.setData(ElementKind.EXCEPTION_PARAMETER); |
1118 c.param.sym.setData(ElementKind.EXCEPTION_PARAMETER); |
1119 } |
1119 } |
1120 chk.checkType(c.param.vartype.pos(), |
1120 chk.checkType(c.param.vartype.pos(), |
2906 } |
2906 } |
2907 } |
2907 } |
2908 result = check(tree, owntype, TYP, pkind, pt); |
2908 result = check(tree, owntype, TYP, pkind, pt); |
2909 } |
2909 } |
2910 |
2910 |
2911 public void visitTypeDisjunction(JCTypeDisjunction tree) { |
2911 public void visitTypeUnion(JCTypeUnion tree) { |
2912 ListBuffer<Type> multicatchTypes = ListBuffer.lb(); |
2912 ListBuffer<Type> multicatchTypes = ListBuffer.lb(); |
2913 for (JCExpression typeTree : tree.alternatives) { |
2913 for (JCExpression typeTree : tree.alternatives) { |
2914 Type ctype = attribType(typeTree, env); |
2914 Type ctype = attribType(typeTree, env); |
2915 ctype = chk.checkType(typeTree.pos(), |
2915 ctype = chk.checkType(typeTree.pos(), |
2916 chk.checkClassType(typeTree.pos(), ctype), |
2916 chk.checkClassType(typeTree.pos(), ctype), |
2917 syms.throwableType); |
2917 syms.throwableType); |
2918 if (!ctype.isErroneous()) { |
2918 if (!ctype.isErroneous()) { |
2919 //check that alternatives of a disjunctive type are pairwise |
2919 //check that alternatives of a union type are pairwise |
2920 //unrelated w.r.t. subtyping |
2920 //unrelated w.r.t. subtyping |
2921 if (chk.intersects(ctype, multicatchTypes.toList())) { |
2921 if (chk.intersects(ctype, multicatchTypes.toList())) { |
2922 for (Type t : multicatchTypes) { |
2922 for (Type t : multicatchTypes) { |
2923 boolean sub = types.isSubtype(ctype, t); |
2923 boolean sub = types.isSubtype(ctype, t); |
2924 boolean sup = types.isSubtype(t, ctype); |
2924 boolean sup = types.isSubtype(t, ctype); |