# HG changeset patch # User darcy # Date 1302143457 25200 # Node ID c2de4dd9853ba72da9438d530d362ab770ed98b7 # Parent 7c9ef56ec288feb178d07c62cb8a404f3012b7e9 7033809: Rename "disjunctive" to "union" in javax.lang.model Reviewed-by: mcimadamore, jjg diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/source/tree/DisjunctiveTypeTree.java --- a/langtools/src/share/classes/com/sun/source/tree/DisjunctiveTypeTree.java Mon Apr 04 19:36:26 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.source.tree; - -import java.util.List; - -/** - * A tree node for a disjunctive type expression in a multicatch var declaration. - * - * - * @author Maurizio Cimadamore - * - * @since 1.7 - */ -public interface DisjunctiveTypeTree extends Tree { - List getTypeAlternatives(); -} diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/source/tree/Tree.java --- a/langtools/src/share/classes/com/sun/source/tree/Tree.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/source/tree/Tree.java Wed Apr 06 19:30:57 2011 -0700 @@ -232,9 +232,9 @@ PARAMETERIZED_TYPE(ParameterizedTypeTree.class), /** - * Used for instances of {@link DisjunctiveTypeTree}. + * Used for instances of {@link UnionTypeTree}. */ - DISJUNCTIVE_TYPE(DisjunctiveTypeTree.class), + UNION_TYPE(UnionTypeTree.class), /** * Used for instances of {@link TypeCastTree}. diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java --- a/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java Wed Apr 06 19:30:57 2011 -0700 @@ -95,7 +95,7 @@ R visitCompilationUnit(CompilationUnitTree node, P p); R visitTry(TryTree node, P p); R visitParameterizedType(ParameterizedTypeTree node, P p); - R visitDisjunctiveType(DisjunctiveTypeTree node, P p); + R visitUnionType(UnionTypeTree node, P p); R visitArrayType(ArrayTypeTree node, P p); R visitTypeCast(TypeCastTree node, P p); R visitPrimitiveType(PrimitiveTypeTree node, P p); diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/source/tree/UnionTypeTree.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/source/tree/UnionTypeTree.java Wed Apr 06 19:30:57 2011 -0700 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.source.tree; + +import java.util.List; + +/** + * A tree node for a union type expression in a multicatch var declaration. + * + * @author Maurizio Cimadamore + * + * @since 1.7 + */ +public interface UnionTypeTree extends Tree { + List getTypeAlternatives(); +} diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java --- a/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Wed Apr 06 19:30:57 2011 -0700 @@ -228,7 +228,7 @@ return defaultAction(node, p); } - public R visitDisjunctiveType(DisjunctiveTypeTree node, P p) { + public R visitUnionType(UnionTypeTree node, P p) { return defaultAction(node, p); } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/source/util/TreeScanner.java --- a/langtools/src/share/classes/com/sun/source/util/TreeScanner.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/source/util/TreeScanner.java Wed Apr 06 19:30:57 2011 -0700 @@ -355,7 +355,7 @@ return r; } - public R visitDisjunctiveType(DisjunctiveTypeTree node, P p) { + public R visitUnionType(UnionTypeTree node, P p) { return scan(node.getTypeAlternatives(), p); } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/code/Flags.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Wed Apr 06 19:30:57 2011 -0700 @@ -231,9 +231,9 @@ public static final long PROPRIETARY = 1L<<38; /** - * Flag that marks a disjunction var in a multi-catch clause + * Flag that marks a a multi-catch parameter */ - public static final long DISJUNCTION = 1L<<39; + public static final long UNION = 1L<<39; /** * Flag that marks a signature-polymorphic invoke method. diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Apr 06 19:30:57 2011 -0700 @@ -1112,7 +1112,7 @@ Type ctype = attribStat(c.param, catchEnv); if (TreeInfo.isMultiCatch(c)) { //multi-catch parameter is implicitly marked as final - c.param.sym.flags_field |= FINAL | DISJUNCTION; + c.param.sym.flags_field |= FINAL | UNION; } if (c.param.sym.kind == Kinds.VAR) { c.param.sym.setData(ElementKind.EXCEPTION_PARAMETER); @@ -2908,7 +2908,7 @@ result = check(tree, owntype, TYP, pkind, pt); } - public void visitTypeDisjunction(JCTypeDisjunction tree) { + public void visitTypeUnion(JCTypeUnion tree) { ListBuffer multicatchTypes = ListBuffer.lb(); for (JCExpression typeTree : tree.alternatives) { Type ctype = attribType(typeTree, env); @@ -2916,7 +2916,7 @@ chk.checkClassType(typeTree.pos(), ctype), syms.throwableType); if (!ctype.isErroneous()) { - //check that alternatives of a disjunctive type are pairwise + //check that alternatives of a union type are pairwise //unrelated w.r.t. subtyping if (chk.intersects(ctype, multicatchTypes.toList())) { for (Type t : multicatchTypes) { diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Wed Apr 06 19:30:57 2011 -0700 @@ -381,7 +381,7 @@ if (sym.adr >= firstadr && trackable(sym)) { if ((sym.flags() & FINAL) != 0) { if ((sym.flags() & PARAMETER) != 0) { - if ((sym.flags() & DISJUNCTION) != 0) { //multi-catch parameter + if ((sym.flags() & UNION) != 0) { //multi-catch parameter log.error(pos, "multicatch.parameter.may.not.be.assigned", sym); } @@ -1003,7 +1003,7 @@ thrown = List.nil(); for (List l = tree.catchers; l.nonEmpty(); l = l.tail) { List subClauses = TreeInfo.isMultiCatch(l.head) ? - ((JCTypeDisjunction)l.head.param.vartype).alternatives : + ((JCTypeUnion)l.head.param.vartype).alternatives : List.of(l.head.param.vartype); for (JCExpression ct : subClauses) { caught = chk.incl(ct.type, caught); @@ -1075,7 +1075,7 @@ alive = true; JCVariableDecl param = l.head.param; List subClauses = TreeInfo.isMultiCatch(l.head) ? - ((JCTypeDisjunction)l.head.param.vartype).alternatives : + ((JCTypeUnion)l.head.param.vartype).alternatives : List.of(l.head.param.vartype); List ctypes = List.nil(); List rethrownTypes = chk.diff(thrownInTry, caughtInTry); diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Wed Apr 06 19:30:57 2011 -0700 @@ -1456,7 +1456,7 @@ List gaps) { if (startpc != endpc) { List subClauses = TreeInfo.isMultiCatch(tree) ? - ((JCTypeDisjunction)tree.param.vartype).alternatives : + ((JCTypeUnion)tree.param.vartype).alternatives : List.of(tree.param.vartype); while (gaps.nonEmpty()) { for (JCExpression subCatch : subClauses) { diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Apr 06 19:30:57 2011 -0700 @@ -1837,7 +1837,7 @@ JCModifiers mods = optFinal(Flags.PARAMETER); List catchTypes = catchTypes(); JCExpression paramType = catchTypes.size() > 1 ? - toP(F.at(catchTypes.head.getStartPosition()).TypeDisjunction(catchTypes)) : + toP(F.at(catchTypes.head.getStartPosition()).TypeUnion(catchTypes)) : catchTypes.head; JCVariableDecl formal = variableDeclaratorId(mods, paramType); accept(RPAREN); diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Wed Apr 06 19:30:57 2011 -0700 @@ -236,13 +236,13 @@ */ public static final int TYPEAPPLY = TYPEARRAY + 1; - /** Disjunction types, of type TypeDisjunction + /** Union types, of type TypeUnion */ - public static final int TYPEDISJUNCTION = TYPEAPPLY + 1; + public static final int TYPEUNION = TYPEAPPLY + 1; /** Formal type parameters, of type TypeParameter. */ - public static final int TYPEPARAMETER = TYPEDISJUNCTION + 1; + public static final int TYPEPARAMETER = TYPEUNION + 1; /** Type argument. */ @@ -1881,30 +1881,30 @@ } /** - * A disjunction type, T1 | T2 | ... Tn (used in multicatch statements) + * A union type, T1 | T2 | ... Tn (used in multicatch statements) */ - public static class JCTypeDisjunction extends JCExpression implements DisjunctiveTypeTree { + public static class JCTypeUnion extends JCExpression implements UnionTypeTree { public List alternatives; - protected JCTypeDisjunction(List components) { + protected JCTypeUnion(List components) { this.alternatives = components; } @Override - public void accept(Visitor v) { v.visitTypeDisjunction(this); } + public void accept(Visitor v) { v.visitTypeUnion(this); } - public Kind getKind() { return Kind.DISJUNCTIVE_TYPE; } + public Kind getKind() { return Kind.UNION_TYPE; } public List getTypeAlternatives() { return alternatives; } @Override public R accept(TreeVisitor v, D d) { - return v.visitDisjunctiveType(this, d); + return v.visitUnionType(this, d); } @Override public int getTag() { - return TYPEDISJUNCTION; + return TYPEUNION; } } @@ -2227,7 +2227,7 @@ public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); } public void visitTypeArray(JCArrayTypeTree that) { visitTree(that); } public void visitTypeApply(JCTypeApply that) { visitTree(that); } - public void visitTypeDisjunction(JCTypeDisjunction that) { visitTree(that); } + public void visitTypeUnion(JCTypeUnion that) { visitTree(that); } public void visitTypeParameter(JCTypeParameter that) { visitTree(that); } public void visitWildcard(JCWildcard that) { visitTree(that); } public void visitTypeBoundKind(TypeBoundKind that) { visitTree(that); } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java Wed Apr 06 19:30:57 2011 -0700 @@ -1169,7 +1169,7 @@ } } - public void visitTypeDisjunction(JCTypeDisjunction tree) { + public void visitTypeUnion(JCTypeUnion tree) { try { printExprs(tree.alternatives, " | "); } catch (IOException e) { diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Wed Apr 06 19:30:57 2011 -0700 @@ -338,10 +338,10 @@ return M.at(t.pos).TypeApply(clazz, arguments); } - public JCTree visitDisjunctiveType(DisjunctiveTypeTree node, P p) { - JCTypeDisjunction t = (JCTypeDisjunction) node; + public JCTree visitUnionType(UnionTypeTree node, P p) { + JCTypeUnion t = (JCTypeUnion) node; List components = copy(t.alternatives, p); - return M.at(t.pos).TypeDisjunction(components); + return M.at(t.pos).TypeUnion(components); } public JCTree visitArrayType(ArrayTypeTree node, P p) { diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Apr 06 19:30:57 2011 -0700 @@ -119,7 +119,7 @@ } public static boolean isMultiCatch(JCCatch catchClause) { - return catchClause.param.vartype.getTag() == JCTree.TYPEDISJUNCTION; + return catchClause.param.vartype.getTag() == JCTree.TYPEUNION; } /** Is statement an initializer for a synthetic field? diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Wed Apr 06 19:30:57 2011 -0700 @@ -435,8 +435,8 @@ return tree; } - public JCTypeDisjunction TypeDisjunction(List components) { - JCTypeDisjunction tree = new JCTypeDisjunction(components); + public JCTypeUnion TypeUnion(List components) { + JCTypeUnion tree = new JCTypeUnion(components); tree.pos = pos; return tree; } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java Wed Apr 06 19:30:57 2011 -0700 @@ -272,7 +272,7 @@ scan(tree.arguments); } - public void visitTypeDisjunction(JCTypeDisjunction tree) { + public void visitTypeUnion(JCTypeUnion tree) { scan(tree.alternatives); } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java Wed Apr 06 19:30:57 2011 -0700 @@ -363,7 +363,7 @@ result = tree; } - public void visitTypeDisjunction(JCTypeDisjunction tree) { + public void visitTypeUnion(JCTypeUnion tree) { tree.alternatives = translate(tree.alternatives); result = tree; } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/javax/lang/model/type/DisjunctiveType.java --- a/langtools/src/share/classes/javax/lang/model/type/DisjunctiveType.java Mon Apr 04 19:36:26 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package javax.lang.model.type; - -import java.util.List; - -/** - * Represents a disjunctive type. - * - * As of the {@link javax.lang.model.SourceVersion#RELEASE_7 - * RELEASE_7} source version, disjunctive types can appear as the type - * of a multi-catch exception parameter. - * - * @since 1.7 - */ -public interface DisjunctiveType extends TypeMirror { - - /** - * Return the alternatives comprising this disjunctive type. - * - * The alternatives are formally referred to as disjuncts. - * - * @return the alternatives comprising this disjunctive type. - */ - List getAlternatives(); -} diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/javax/lang/model/type/TypeKind.java --- a/langtools/src/share/classes/javax/lang/model/type/TypeKind.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/javax/lang/model/type/TypeKind.java Wed Apr 06 19:30:57 2011 -0700 @@ -140,11 +140,11 @@ OTHER, /** - * A disjunctive type. + * A union type. * * @since 1.7 */ - DISJUNCTIVE; + UNION; /** * Returns {@code true} if this kind corresponds to a primitive diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/javax/lang/model/type/TypeVisitor.java --- a/langtools/src/share/classes/javax/lang/model/type/TypeVisitor.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/javax/lang/model/type/TypeVisitor.java Wed Apr 06 19:30:57 2011 -0700 @@ -164,12 +164,12 @@ R visitUnknown(TypeMirror t, P p); /** - * Visits a disjunctive type. + * Visits a union type. * * @param t the type to visit * @param p a visitor-specified parameter * @return a visitor-specified result * @since 1.7 */ - R visitDisjunctive(DisjunctiveType t, P p); + R visitUnion(UnionType t, P p); } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/javax/lang/model/type/UnionType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/javax/lang/model/type/UnionType.java Wed Apr 06 19:30:57 2011 -0700 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.lang.model.type; + +import java.util.List; + +/** + * Represents a union type. + * + * As of the {@link javax.lang.model.SourceVersion#RELEASE_7 + * RELEASE_7} source version, union types can appear as the type + * of a multi-catch exception parameter. + * + * @since 1.7 + */ +public interface UnionType extends TypeMirror { + + /** + * Return the alternatives comprising this union type. + * + * @return the alternatives comprising this union type. + */ + List getAlternatives(); +} diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java --- a/langtools/src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java Wed Apr 06 19:30:57 2011 -0700 @@ -96,7 +96,7 @@ } /** - * Visits a {@code DisjunctiveType} element by calling {@code + * Visits a {@code UnionType} element by calling {@code * visitUnknown}. * @param t {@inheritDoc} @@ -105,7 +105,7 @@ * * @since 1.7 */ - public R visitDisjunctive(DisjunctiveType t, P p) { + public R visitUnion(UnionType t, P p) { return visitUnknown(t, p); } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java --- a/langtools/src/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java Wed Apr 06 19:30:57 2011 -0700 @@ -67,11 +67,11 @@ } /** - * Visits a {@code DisjunctiveType} in a manner defined by a subclass. + * Visits a {@code UnionType} in a manner defined by a subclass. * * @param t {@inheritDoc} * @param p {@inheritDoc} * @return the result of the visit as defined by a subclass */ - public abstract R visitDisjunctive(DisjunctiveType t, P p); + public abstract R visitUnion(UnionType t, P p); } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java --- a/langtools/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java Wed Apr 06 19:30:57 2011 -0700 @@ -91,7 +91,7 @@ } /** - * This implementation visits a {@code DisjunctiveType} by calling + * This implementation visits a {@code UnionType} by calling * {@code defaultAction}. * * @param t {@inheritDoc} @@ -99,7 +99,7 @@ * @return the result of {@code defaultAction} */ @Override - public R visitDisjunctive(DisjunctiveType t, P p) { + public R visitUnion(UnionType t, P p) { return defaultAction(t, p); } } diff -r 7c9ef56ec288 -r c2de4dd9853b langtools/src/share/classes/javax/lang/model/util/TypeKindVisitor7.java --- a/langtools/src/share/classes/javax/lang/model/util/TypeKindVisitor7.java Mon Apr 04 19:36:26 2011 +0100 +++ b/langtools/src/share/classes/javax/lang/model/util/TypeKindVisitor7.java Wed Apr 06 19:30:57 2011 -0700 @@ -94,7 +94,7 @@ } /** - * This implementation visits a {@code DisjunctiveType} by calling + * This implementation visits a {@code UnionType} by calling * {@code defaultAction}. * * @param t {@inheritDoc} @@ -102,7 +102,7 @@ * @return the result of {@code defaultAction} */ @Override - public R visitDisjunctive(DisjunctiveType t, P p) { + public R visitUnion(UnionType t, P p) { return defaultAction(t, p); } }