# HG changeset patch # User jjg # Date 1288128588 25200 # Node ID 0183c3f9614e8f5893aa667a64eb5c928ef62488 # Parent c27644ae58554371fafbc2c687d9aa9691538027 6949587: rename "DisjointType" to "DisjunctType" Reviewed-by: mcimadamore diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/source/tree/DisjointTypeTree.java --- a/langtools/src/share/classes/com/sun/source/tree/DisjointTypeTree.java Fri Oct 22 14:04:33 2010 -0700 +++ /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 disjoint type expression in a multicatch var declaration. - * - * - * @author Maurizio Cimadamore - * - * @since 1.7 - */ -public interface DisjointTypeTree extends Tree { - List getTypeComponents(); -} diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/source/tree/DisjunctiveTypeTree.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/source/tree/DisjunctiveTypeTree.java Tue Oct 26 14:29:48 2010 -0700 @@ -0,0 +1,40 @@ +/* + * 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 c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/source/tree/Tree.java --- a/langtools/src/share/classes/com/sun/source/tree/Tree.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/Tree.java Tue Oct 26 14:29:48 2010 -0700 @@ -234,9 +234,9 @@ PARAMETERIZED_TYPE(ParameterizedTypeTree.class), /** - * Used for instances of {@link DisjointTypeTree}. + * Used for instances of {@link DisjunctiveTypeTree}. */ - DISJOINT_TYPE(DisjointTypeTree.class), + DISJUNCTIVE_TYPE(DisjunctiveTypeTree.class), /** * Used for instances of {@link TypeCastTree}. diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java --- a/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java Tue Oct 26 14:29:48 2010 -0700 @@ -96,7 +96,7 @@ R visitCompilationUnit(CompilationUnitTree node, P p); R visitTry(TryTree node, P p); R visitParameterizedType(ParameterizedTypeTree node, P p); - R visitDisjointType(DisjointTypeTree node, P p); + R visitDisjunctiveType(DisjunctiveTypeTree node, P p); R visitArrayType(ArrayTypeTree node, P p); R visitTypeCast(TypeCastTree node, P p); R visitPrimitiveType(PrimitiveTypeTree node, P p); diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java --- a/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Tue Oct 26 14:29:48 2010 -0700 @@ -228,7 +228,7 @@ return defaultAction(node, p); } - public R visitDisjointType(DisjointTypeTree node, P p) { + public R visitDisjunctiveType(DisjunctiveTypeTree node, P p) { return defaultAction(node, p); } diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/source/util/TreeScanner.java --- a/langtools/src/share/classes/com/sun/source/util/TreeScanner.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/TreeScanner.java Tue Oct 26 14:29:48 2010 -0700 @@ -356,8 +356,8 @@ return r; } - public R visitDisjointType(DisjointTypeTree node, P p) { - return scan(node.getTypeComponents(), p); + public R visitDisjunctiveType(DisjunctiveTypeTree node, P p) { + return scan(node.getTypeAlternatives(), p); } public R visitTypeParameter(TypeParameterTree node, P p) { diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/code/Flags.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Tue Oct 26 14:29:48 2010 -0700 @@ -231,9 +231,9 @@ public static final long PROPRIETARY = 1L<<38; /** - * Flag that marks a disjoint var in a multi-catch clause + * Flag that marks a disjunction var in a multi-catch clause */ - public static final long DISJOINT = 1L<<39; + public static final long DISJUNCTION = 1L<<39; /** * Flag that marks a signature-polymorphic invoke method. diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Oct 26 14:29:48 2010 -0700 @@ -1053,7 +1053,7 @@ if ((c.param.sym.flags() & FINAL) == 0) { log.error(c.param.pos(), "multicatch.param.must.be.final", c.param.sym); } - c.param.sym.flags_field = c.param.sym.flags() | DISJOINT; + c.param.sym.flags_field = c.param.sym.flags() | DISJUNCTION; } if (c.param.sym.kind == Kinds.VAR) { c.param.sym.setData(ElementKind.EXCEPTION_PARAMETER); @@ -2839,9 +2839,9 @@ result = check(tree, owntype, TYP, pkind, pt); } - public void visitTypeDisjoint(JCTypeDisjoint tree) { - List componentTypes = attribTypes(tree.components, env); - tree.type = result = check(tree, types.lub(componentTypes), TYP, pkind, pt); + public void visitTypeDisjunction(JCTypeDisjunction tree) { + List alternatives = attribTypes(tree.alternatives, env); + tree.type = result = check(tree, types.lub(alternatives), TYP, pkind, pt); } public void visitTypeParameter(JCTypeParameter tree) { diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Tue Oct 26 14:29:48 2010 -0700 @@ -371,7 +371,7 @@ if (sym.adr >= firstadr && trackable(sym)) { if ((sym.flags() & FINAL) != 0) { if ((sym.flags() & PARAMETER) != 0) { - if ((sym.flags() & DISJOINT) != 0) { //multi-catch parameter + if ((sym.flags() & DISJUNCTION) != 0) { //multi-catch parameter log.error(pos, "multicatch.parameter.may.not.be.assigned", sym); } @@ -983,7 +983,7 @@ thrown = List.nil(); for (List l = tree.catchers; l.nonEmpty(); l = l.tail) { List subClauses = TreeInfo.isMultiCatch(l.head) ? - ((JCTypeDisjoint)l.head.param.vartype).components : + ((JCTypeDisjunction)l.head.param.vartype).alternatives : List.of(l.head.param.vartype); for (JCExpression ct : subClauses) { caught = chk.incl(ct.type, caught); @@ -1049,7 +1049,7 @@ alive = true; JCVariableDecl param = l.head.param; List subClauses = TreeInfo.isMultiCatch(l.head) ? - ((JCTypeDisjoint)l.head.param.vartype).components : + ((JCTypeDisjunction)l.head.param.vartype).alternatives : List.of(l.head.param.vartype); List ctypes = List.nil(); List rethrownTypes = chk.diff(thrownInTry, caughtInTry); diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Tue Oct 26 14:29:48 2010 -0700 @@ -1456,7 +1456,7 @@ List gaps) { if (startpc != endpc) { List subClauses = TreeInfo.isMultiCatch(tree) ? - ((JCTypeDisjoint)tree.param.vartype).components : + ((JCTypeDisjunction)tree.param.vartype).alternatives : List.of(tree.param.vartype); while (gaps.nonEmpty()) { for (JCExpression subCatch : subClauses) { diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Tue Oct 26 14:29:48 2010 -0700 @@ -1827,7 +1827,7 @@ JCModifiers mods = optFinal(Flags.PARAMETER); List catchTypes = catchTypes(); JCExpression paramType = catchTypes.size() > 1 ? - toP(F.at(catchTypes.head.getStartPosition()).TypeDisjoint(catchTypes)) : + toP(F.at(catchTypes.head.getStartPosition()).TypeDisjunction(catchTypes)) : catchTypes.head; JCVariableDecl formal = variableDeclaratorId(mods, paramType); accept(RPAREN); diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Tue Oct 26 14:29:48 2010 -0700 @@ -236,13 +236,13 @@ */ public static final int TYPEAPPLY = TYPEARRAY + 1; - /** Disjunctive types, of type TypeDisjoint. + /** Disjunction types, of type TypeDisjunction */ - public static final int TYPEDISJOINT = TYPEAPPLY + 1; + public static final int TYPEDISJUNCTION = TYPEAPPLY + 1; /** Formal type parameters, of type TypeParameter. */ - public static final int TYPEPARAMETER = TYPEDISJOINT + 1; + public static final int TYPEPARAMETER = TYPEDISJUNCTION + 1; /** Type argument. */ @@ -1888,30 +1888,30 @@ } /** - * A disjoint type, T1 | T2 | ... Tn (used in multicatch statements) + * A disjunction type, T1 | T2 | ... Tn (used in multicatch statements) */ - public static class JCTypeDisjoint extends JCExpression implements DisjointTypeTree { + public static class JCTypeDisjunction extends JCExpression implements DisjunctiveTypeTree { - public List components; + public List alternatives; - protected JCTypeDisjoint(List components) { - this.components = components; + protected JCTypeDisjunction(List components) { + this.alternatives = components; } @Override - public void accept(Visitor v) { v.visitTypeDisjoint(this); } + public void accept(Visitor v) { v.visitTypeDisjunction(this); } - public Kind getKind() { return Kind.DISJOINT_TYPE; } + public Kind getKind() { return Kind.DISJUNCTIVE_TYPE; } - public List getTypeComponents() { - return components; + public List getTypeAlternatives() { + return alternatives; } @Override public R accept(TreeVisitor v, D d) { - return v.visitDisjointType(this, d); + return v.visitDisjunctiveType(this, d); } @Override public int getTag() { - return TYPEDISJOINT; + return TYPEDISJUNCTION; } } @@ -2284,7 +2284,7 @@ public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); } public void visitTypeArray(JCArrayTypeTree that) { visitTree(that); } public void visitTypeApply(JCTypeApply that) { visitTree(that); } - public void visitTypeDisjoint(JCTypeDisjoint that) { visitTree(that); } + public void visitTypeDisjunction(JCTypeDisjunction 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 c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java Tue Oct 26 14:29:48 2010 -0700 @@ -1195,9 +1195,9 @@ } } - public void visitTypeDisjoint(JCTypeDisjoint tree) { + public void visitTypeDisjunction(JCTypeDisjunction tree) { try { - printExprs(tree.components, " | "); + printExprs(tree.alternatives, " | "); } catch (IOException e) { throw new UncheckedIOException(e); } diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java Tue Oct 26 14:29:48 2010 -0700 @@ -346,10 +346,10 @@ return M.at(t.pos).TypeApply(clazz, arguments); } - public JCTree visitDisjointType(DisjointTypeTree node, P p) { - JCTypeDisjoint t = (JCTypeDisjoint) node; - List components = copy(t.components, p); - return M.at(t.pos).TypeDisjoint(components); + public JCTree visitDisjunctiveType(DisjunctiveTypeTree node, P p) { + JCTypeDisjunction t = (JCTypeDisjunction) node; + List components = copy(t.alternatives, p); + return M.at(t.pos).TypeDisjunction(components); } public JCTree visitArrayType(ArrayTypeTree node, P p) { diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Tue Oct 26 14:29:48 2010 -0700 @@ -119,7 +119,7 @@ } public static boolean isMultiCatch(JCCatch catchClause) { - return catchClause.param.vartype.getTag() == JCTree.TYPEDISJOINT; + return catchClause.param.vartype.getTag() == JCTree.TYPEDISJUNCTION; } /** Is statement an initializer for a synthetic field? diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Tue Oct 26 14:29:48 2010 -0700 @@ -451,8 +451,8 @@ return tree; } - public JCTypeDisjoint TypeDisjoint(List components) { - JCTypeDisjoint tree = new JCTypeDisjoint(components); + public JCTypeDisjunction TypeDisjunction(List components) { + JCTypeDisjunction tree = new JCTypeDisjunction(components); tree.pos = pos; return tree; } diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java Tue Oct 26 14:29:48 2010 -0700 @@ -276,8 +276,8 @@ scan(tree.arguments); } - public void visitTypeDisjoint(JCTypeDisjoint tree) { - scan(tree.components); + public void visitTypeDisjunction(JCTypeDisjunction tree) { + scan(tree.alternatives); } public void visitTypeParameter(JCTypeParameter tree) { diff -r c27644ae5855 -r 0183c3f9614e langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java Fri Oct 22 14:04:33 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java Tue Oct 26 14:29:48 2010 -0700 @@ -368,8 +368,8 @@ result = tree; } - public void visitTypeDisjoint(JCTypeDisjoint tree) { - tree.components = translate(tree.components); + public void visitTypeDisjunction(JCTypeDisjunction tree) { + tree.alternatives = translate(tree.alternatives); result = tree; }