7033809: Rename "disjunctive" to "union" in javax.lang.model
Reviewed-by: mcimadamore, jjg
This commit is contained in:
parent
243b526b99
commit
777c93481f
langtools/src/share/classes
com/sun
source
tools/javac
javax/lang/model
@ -232,9 +232,9 @@ public interface Tree {
|
||||
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}.
|
||||
|
@ -95,7 +95,7 @@ public interface TreeVisitor<R,P> {
|
||||
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);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -28,13 +28,12 @@ package com.sun.source.tree;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A tree node for a disjunctive type expression in a multicatch var declaration.
|
||||
*
|
||||
* A tree node for a union type expression in a multicatch var declaration.
|
||||
*
|
||||
* @author Maurizio Cimadamore
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
public interface DisjunctiveTypeTree extends Tree {
|
||||
public interface UnionTypeTree extends Tree {
|
||||
List<? extends Tree> getTypeAlternatives();
|
||||
}
|
@ -228,7 +228,7 @@ public class SimpleTreeVisitor <R,P> implements TreeVisitor<R,P> {
|
||||
return defaultAction(node, p);
|
||||
}
|
||||
|
||||
public R visitDisjunctiveType(DisjunctiveTypeTree node, P p) {
|
||||
public R visitUnionType(UnionTypeTree node, P p) {
|
||||
return defaultAction(node, p);
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> {
|
||||
return r;
|
||||
}
|
||||
|
||||
public R visitDisjunctiveType(DisjunctiveTypeTree node, P p) {
|
||||
public R visitUnionType(UnionTypeTree node, P p) {
|
||||
return scan(node.getTypeAlternatives(), p);
|
||||
}
|
||||
|
||||
|
@ -231,9 +231,9 @@ public class Flags {
|
||||
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.
|
||||
|
@ -1112,7 +1112,7 @@ public class Attr extends JCTree.Visitor {
|
||||
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 @@ public class Attr extends JCTree.Visitor {
|
||||
result = check(tree, owntype, TYP, pkind, pt);
|
||||
}
|
||||
|
||||
public void visitTypeDisjunction(JCTypeDisjunction tree) {
|
||||
public void visitTypeUnion(JCTypeUnion tree) {
|
||||
ListBuffer<Type> multicatchTypes = ListBuffer.lb();
|
||||
for (JCExpression typeTree : tree.alternatives) {
|
||||
Type ctype = attribType(typeTree, env);
|
||||
@ -2916,7 +2916,7 @@ public class Attr extends JCTree.Visitor {
|
||||
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) {
|
||||
|
@ -381,7 +381,7 @@ public class Flow extends TreeScanner {
|
||||
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 @@ public class Flow extends TreeScanner {
|
||||
thrown = List.nil();
|
||||
for (List<JCCatch> l = tree.catchers; l.nonEmpty(); l = l.tail) {
|
||||
List<JCExpression> 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 @@ public class Flow extends TreeScanner {
|
||||
alive = true;
|
||||
JCVariableDecl param = l.head.param;
|
||||
List<JCExpression> subClauses = TreeInfo.isMultiCatch(l.head) ?
|
||||
((JCTypeDisjunction)l.head.param.vartype).alternatives :
|
||||
((JCTypeUnion)l.head.param.vartype).alternatives :
|
||||
List.of(l.head.param.vartype);
|
||||
List<Type> ctypes = List.nil();
|
||||
List<Type> rethrownTypes = chk.diff(thrownInTry, caughtInTry);
|
||||
|
@ -1456,7 +1456,7 @@ public class Gen extends JCTree.Visitor {
|
||||
List<Integer> gaps) {
|
||||
if (startpc != endpc) {
|
||||
List<JCExpression> 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) {
|
||||
|
@ -1837,7 +1837,7 @@ public class JavacParser implements Parser {
|
||||
JCModifiers mods = optFinal(Flags.PARAMETER);
|
||||
List<JCExpression> 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);
|
||||
|
@ -236,13 +236,13 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
|
||||
*/
|
||||
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 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<JCExpression> alternatives;
|
||||
|
||||
protected JCTypeDisjunction(List<JCExpression> components) {
|
||||
protected JCTypeUnion(List<JCExpression> 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<JCExpression> getTypeAlternatives() {
|
||||
return alternatives;
|
||||
}
|
||||
@Override
|
||||
public <R,D> R accept(TreeVisitor<R,D> 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 abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
|
||||
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); }
|
||||
|
@ -1169,7 +1169,7 @@ public class Pretty extends JCTree.Visitor {
|
||||
}
|
||||
}
|
||||
|
||||
public void visitTypeDisjunction(JCTypeDisjunction tree) {
|
||||
public void visitTypeUnion(JCTypeUnion tree) {
|
||||
try {
|
||||
printExprs(tree.alternatives, " | ");
|
||||
} catch (IOException e) {
|
||||
|
@ -338,10 +338,10 @@ public class TreeCopier<P> implements TreeVisitor<JCTree,P> {
|
||||
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<JCExpression> 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) {
|
||||
|
@ -119,7 +119,7 @@ public class TreeInfo {
|
||||
}
|
||||
|
||||
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?
|
||||
|
@ -435,8 +435,8 @@ public class TreeMaker implements JCTree.Factory {
|
||||
return tree;
|
||||
}
|
||||
|
||||
public JCTypeDisjunction TypeDisjunction(List<JCExpression> components) {
|
||||
JCTypeDisjunction tree = new JCTypeDisjunction(components);
|
||||
public JCTypeUnion TypeUnion(List<JCExpression> components) {
|
||||
JCTypeUnion tree = new JCTypeUnion(components);
|
||||
tree.pos = pos;
|
||||
return tree;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ public class TreeScanner extends Visitor {
|
||||
scan(tree.arguments);
|
||||
}
|
||||
|
||||
public void visitTypeDisjunction(JCTypeDisjunction tree) {
|
||||
public void visitTypeUnion(JCTypeUnion tree) {
|
||||
scan(tree.alternatives);
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ public class TreeTranslator extends JCTree.Visitor {
|
||||
result = tree;
|
||||
}
|
||||
|
||||
public void visitTypeDisjunction(JCTypeDisjunction tree) {
|
||||
public void visitTypeUnion(JCTypeUnion tree) {
|
||||
tree.alternatives = translate(tree.alternatives);
|
||||
result = tree;
|
||||
}
|
||||
|
@ -140,11 +140,11 @@ public enum TypeKind {
|
||||
OTHER,
|
||||
|
||||
/**
|
||||
* A disjunctive type.
|
||||
* A union type.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
DISJUNCTIVE;
|
||||
UNION;
|
||||
|
||||
/**
|
||||
* Returns {@code true} if this kind corresponds to a primitive
|
||||
|
@ -164,12 +164,12 @@ public interface TypeVisitor<R, P> {
|
||||
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);
|
||||
}
|
||||
|
@ -28,22 +28,20 @@ package javax.lang.model.type;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a disjunctive type.
|
||||
* Represents a union type.
|
||||
*
|
||||
* As of the {@link javax.lang.model.SourceVersion#RELEASE_7
|
||||
* RELEASE_7} source version, disjunctive types can appear as the type
|
||||
* RELEASE_7} source version, union types can appear as the type
|
||||
* of a multi-catch exception parameter.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
public interface DisjunctiveType extends TypeMirror {
|
||||
public interface UnionType extends TypeMirror {
|
||||
|
||||
/**
|
||||
* Return the alternatives comprising this disjunctive type.
|
||||
* Return the alternatives comprising this union type.
|
||||
*
|
||||
* The alternatives are formally referred to as <i>disjuncts</i>.
|
||||
*
|
||||
* @return the alternatives comprising this disjunctive type.
|
||||
* @return the alternatives comprising this union type.
|
||||
*/
|
||||
List<? extends TypeMirror> getAlternatives();
|
||||
}
|
@ -96,7 +96,7 @@ public abstract class AbstractTypeVisitor6<R, P> implements TypeVisitor<R, P> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Visits a {@code DisjunctiveType} element by calling {@code
|
||||
* Visits a {@code UnionType} element by calling {@code
|
||||
* visitUnknown}.
|
||||
|
||||
* @param t {@inheritDoc}
|
||||
@ -105,7 +105,7 @@ public abstract class AbstractTypeVisitor6<R, P> implements TypeVisitor<R, P> {
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
public R visitDisjunctive(DisjunctiveType t, P p) {
|
||||
public R visitUnion(UnionType t, P p) {
|
||||
return visitUnknown(t, p);
|
||||
}
|
||||
|
||||
|
@ -67,11 +67,11 @@ public abstract class AbstractTypeVisitor7<R, P> extends AbstractTypeVisitor6<R,
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class SimpleTypeVisitor7<R, P> extends SimpleTypeVisitor6<R, P> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 @@ public class SimpleTypeVisitor7<R, P> extends SimpleTypeVisitor6<R, P> {
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class TypeKindVisitor7<R, P> extends TypeKindVisitor6<R, P> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 @@ public class TypeKindVisitor7<R, P> extends TypeKindVisitor6<R, P> {
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user