6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')

Reviewed-by: jjg, darcy
This commit is contained in:
Maurizio Cimadamore 2010-05-03 17:12:59 -07:00
parent 3c813135d9
commit de2b567108
32 changed files with 773 additions and 33 deletions

View file

@ -0,0 +1,40 @@
/*
* Copyright 2010 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.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<? extends Tree> getTypeComponents();
}

View file

@ -233,6 +233,11 @@ public interface Tree {
*/
PARAMETERIZED_TYPE(ParameterizedTypeTree.class),
/**
* Used for instances of {@link DisjointTypeTree}.
*/
DISJOINT_TYPE(DisjointTypeTree.class),
/**
* Used for instances of {@link TypeCastTree}.
*/

View file

@ -96,6 +96,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 visitDisjointType(DisjointTypeTree node, P p);
R visitArrayType(ArrayTypeTree node, P p);
R visitTypeCast(TypeCastTree node, P p);
R visitPrimitiveType(PrimitiveTypeTree node, P p);

View file

@ -228,6 +228,10 @@ public class SimpleTreeVisitor <R,P> implements TreeVisitor<R,P> {
return defaultAction(node, p);
}
public R visitDisjointType(DisjointTypeTree node, P p) {
return defaultAction(node, p);
}
public R visitTypeParameter(TypeParameterTree node, P p) {
return defaultAction(node, p);
}

View file

@ -354,6 +354,10 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> {
return r;
}
public R visitDisjointType(DisjointTypeTree node, P p) {
return scan(node.getTypeComponents(), p);
}
public R visitTypeParameter(TypeParameterTree node, P p) {
R r = scan(node.getAnnotations(), p);
r = scanAndReduce(node.getBounds(), p, r);