changeset 558:1f2a6005435d

*) Added support for exception transparency. Exception transparency is supported through so-called 'throws' type-variables. Such type-variables are dealt with in a special way: during type-inference the compiler doesn't apply lub(). As such, throws type-variable are inherently disjunctive. *) Added support for disjunctive types and retrifitted the multicatch implementation in order to leverage disjunctive types. Disjunctive types are only supported in the 'throws' clause of a method declaration, as the type of a 'catch' clause and in type-parameter position (where the corresponding formal type-variable is a 'throws' type-variable).
author mcimadamore
date Tue, 15 Jun 2010 11:22:08 +0100
parents d74a4b240764
children 3e219523bf43
files src/share/classes/com/sun/tools/javac/code/Flags.java src/share/classes/com/sun/tools/javac/code/Printer.java src/share/classes/com/sun/tools/javac/code/Source.java src/share/classes/com/sun/tools/javac/code/Symtab.java src/share/classes/com/sun/tools/javac/code/Type.java src/share/classes/com/sun/tools/javac/code/TypeTags.java src/share/classes/com/sun/tools/javac/code/Types.java src/share/classes/com/sun/tools/javac/comp/Attr.java src/share/classes/com/sun/tools/javac/comp/AttrContext.java src/share/classes/com/sun/tools/javac/comp/Check.java src/share/classes/com/sun/tools/javac/comp/Flow.java src/share/classes/com/sun/tools/javac/comp/Infer.java src/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java src/share/classes/com/sun/tools/javac/jvm/Code.java src/share/classes/com/sun/tools/javac/jvm/Gen.java src/share/classes/com/sun/tools/javac/parser/JavacParser.java src/share/classes/com/sun/tools/javac/parser/Lexer.java src/share/classes/com/sun/tools/javac/parser/Scanner.java src/share/classes/com/sun/tools/javac/resources/compiler.properties src/share/classes/com/sun/tools/javac/tree/JCTree.java src/share/classes/com/sun/tools/javac/tree/TreeCopier.java src/share/classes/com/sun/tools/javac/tree/TreeInfo.java src/share/classes/com/sun/tools/javac/tree/TreeMaker.java src/share/classes/com/sun/tools/javac/util/Names.java src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java test/tools/javac/generics/diamond/neg/Neg01.out test/tools/javac/generics/diamond/neg/Neg02.out test/tools/javac/generics/diamond/neg/Neg03.out test/tools/javac/generics/diamond/neg/Neg04.out test/tools/javac/lambda/BadAccess.java test/tools/javac/lambda/BadLambdaCall.java test/tools/javac/lambda/BadReturn.java test/tools/javac/lambda/ExceptionTransparency01.java test/tools/javac/lambda/FuncType01.java test/tools/javac/lambda/LambdaCapture01.java test/tools/javac/lambda/LambdaCapture02.java test/tools/javac/lambda/LambdaCapture03.java test/tools/javac/lambda/LambdaCapture04.java test/tools/javac/lambda/LambdaCapture05.java test/tools/javac/lambda/LambdaConv01.java test/tools/javac/lambda/LambdaConv02.java test/tools/javac/lambda/LambdaConv03.java test/tools/javac/lambda/LambdaConv04.java test/tools/javac/lambda/LambdaConv05.java test/tools/javac/lambda/LambdaExpr01.java test/tools/javac/lambda/LambdaExpr02.java test/tools/javac/lambda/LambdaExpr03.java test/tools/javac/lambda/LambdaScope01.java test/tools/javac/lambda/LambdaScope02.java test/tools/javac/lambda/NakedThis.java test/tools/javac/transparency/Neg01.java test/tools/javac/transparency/Neg01.out test/tools/javac/transparency/Neg02.java test/tools/javac/transparency/Neg02.out test/tools/javac/transparency/Neg03.java test/tools/javac/transparency/Neg03.out test/tools/javac/transparency/Neg04.java test/tools/javac/transparency/Neg04.out test/tools/javac/transparency/Neg05.java test/tools/javac/transparency/Neg05.out test/tools/javac/transparency/Neg06.java test/tools/javac/transparency/Neg06.out test/tools/javac/transparency/Neg07.java test/tools/javac/transparency/Neg07.out test/tools/javac/transparency/Neg08.java test/tools/javac/transparency/Neg08.out test/tools/javac/transparency/Pos01.java test/tools/javac/transparency/Pos02.java test/tools/javac/transparency/Pos03.java
diffstat 70 files changed, 1439 insertions(+), 271 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Tue Jun 15 11:22:08 2010 +0100
@@ -84,6 +84,7 @@
         if ((mask&ACYCLIC) != 0) flags.add(Flag.ACYCLIC);
         if ((mask&PARAMETER) != 0) flags.add(Flag.PARAMETER);
         if ((mask&VARARGS) != 0) flags.add(Flag.VARARGS);
+        if ((mask&THROWS) != 0) flags.add(Flag.THROW);
         return flags;
     }
 
@@ -231,9 +232,9 @@
     public static final long PROPRIETARY = 1L<<38;
 
     /**
-     * Flag that marks a disjoint var in a multi-catch clause
+     * Flag that marks a throw type-parameter
      */
-    public static final long DISJOINT = 1L<<39;
+    public static final long THROWS = 1L<<39;
 
     /**
      * Flag that marks a method symbol representing a lambda expression
@@ -331,7 +332,8 @@
         ACYCLIC("acyclic"),
         PARAMETER("parameter"),
         VARARGS("varargs"),
-        PACKAGE("package");
+        PACKAGE("package"),
+        THROW("throw");
 
         String name;
 
--- a/src/share/classes/com/sun/tools/javac/code/Printer.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Printer.java	Tue Jun 15 11:22:08 2010 +0100
@@ -219,6 +219,11 @@
     }
 
     @Override
+    public String visitDisjunctiveType(DisjunctiveType t, Locale locale) {
+        return t.types.toString("|");
+    }
+
+    @Override
     public String visitPackageType(PackageType t, Locale locale) {
         return t.tsym.getQualifiedName().toString();
     }
--- a/src/share/classes/com/sun/tools/javac/code/Source.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Source.java	Tue Jun 15 11:22:08 2010 +0100
@@ -174,6 +174,9 @@
     public boolean allowLambda() {
         return compareTo(JDK1_7) >= 0;
     }
+    public boolean allowThrowTypeParameters() {
+        return compareTo(JDK1_7) >= 0;
+    }
     public static SourceVersion toSourceVersion(Source source) {
         switch(source) {
         case JDK1_2:
--- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Tue Jun 15 11:22:08 2010 +0100
@@ -109,6 +109,9 @@
     /** The builtin type of all methods. */
     public final ClassSymbol methodClass;
 
+    /** The builtin type of all disjunctive types. */
+    public final ClassSymbol disjointClass;
+
     /** Predefined types.
      */
     public final Type objectType;
@@ -396,6 +399,9 @@
         // the builtin class of all methods
         methodClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Method, noSymbol);
 
+        // the builtin class of all disjunctive types
+        disjointClass = new ClassSymbol(PUBLIC|ACYCLIC, names.Disjoint, noSymbol);
+
         // Create class to hold all predefined constants and operations.
         predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage);
         Scope scope = new Scope(predefClass);
--- a/src/share/classes/com/sun/tools/javac/code/Type.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Tue Jun 15 11:22:08 2010 +0100
@@ -890,6 +890,31 @@
         }
     }
 
+    /** Multiple types used in a throws type parameter */
+    public static class DisjunctiveType extends Type {
+
+        public List<Type> types;
+
+        public List<Type> getTypes() {
+            return types;
+        }
+
+        public DisjunctiveType(List<Type> types, TypeSymbol tsym) {
+            super(TypeTags.DISJOINT, tsym);
+            this.types = types;
+        }
+
+        public String toString() {
+            return types.toString("|");
+        }
+
+        @Override
+        public <R,S> R accept(Type.Visitor<R,S> v, S s) {
+            return v.visitDisjunctiveType(this, s);
+        }
+    }
+
+
     public static class MethodType extends Type
                     implements Cloneable, ExecutableType {
 
@@ -1411,6 +1436,7 @@
         R visitWildcardType(WildcardType t, S s);
         R visitArrayType(ArrayType t, S s);
         R visitMethodType(MethodType t, S s);
+        R visitDisjunctiveType(DisjunctiveType t, S s);
         R visitFunctionType(FunctionType t, S s);
         R visitPackageType(PackageType t, S s);
         R visitTypeVar(TypeVar t, S s);
--- a/src/share/classes/com/sun/tools/javac/code/TypeTags.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/TypeTags.java	Tue Jun 15 11:22:08 2010 +0100
@@ -102,9 +102,13 @@
      */
     public static final int FORALL = WILDCARD+1;
 
+    /** The tag of all disjunctive types.
+     */
+    public static final int DISJOINT = FORALL+1;
+
     /** The tag of the bottom type <null>.
      */
-    public static final int BOT = FORALL+1;
+    public static final int BOT = DISJOINT+1;
 
     /** The tag of a missing type.
      */
--- a/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Jun 15 11:22:08 2010 +0100
@@ -425,6 +425,14 @@
             return true;
         }
 
+        if (s.tag == DISJOINT && t.tag != DISJOINT) {
+            for (Type s2 : ((DisjunctiveType)s).types) {
+                if (isSubtype(t, s2, capture))
+                    return true;
+            }
+            return false;
+        }
+
         Type lower = lowerBound(s);
         if (s != lower)
             return isSubtype(capture ? capture(t) : t, lower, false);
@@ -524,6 +532,15 @@
             }
 
             @Override
+            public Boolean visitDisjunctiveType(DisjunctiveType t, Type s) {
+                List<Type> ss = s.tag == DISJOINT ?
+                    ((DisjunctiveType)s).types :
+                    List.of(s);
+
+                return chk.unhandled(t.types, ss).isEmpty();
+            }
+
+            @Override
             public Boolean visitClassType(ClassType t, Type s) {
                 Type sup = asSuper(t, s.tsym);
                 return sup != null
@@ -787,6 +804,31 @@
             }
 
             @Override
+            public Boolean visitDisjunctiveType(DisjunctiveType t, Type s) {
+                if (s.tag != DISJOINT) {
+                    return t.types.size() == 1 &&
+                            visit(t.types.head,s);
+                }
+                DisjunctiveType s2 = (DisjunctiveType)s;
+                if (t.types.length() != s2.types.length()) {
+                    return false;
+                }
+                //check commutativity
+                for (Type t2 : t.types) {
+                    boolean ok = false;
+                    for (Type s3 : s2.types) {
+                        if (visit(t2, s3)) {
+                            ok = true;
+                        }
+                    }
+                    if (!ok) {
+                        return false;
+                    }
+                }
+                return true;
+            }
+
+            @Override
             public Boolean visitErrorType(ErrorType t, Type s) {
                 return true;
             }
@@ -1070,6 +1112,11 @@
                     return visitClassType((ClassType)s, t);
                 }
 
+                if (s.tag == DISJOINT) {
+                    // call recursively to reuse the disjunctive type code
+                    return visitDisjunctiveType((DisjunctiveType)s, t);
+                }
+
                 if (s.tag == CLASS || s.tag == ARRAY) {
                     boolean upcast;
                     if ((upcast = isSubtype(erasure(t), erasure(s)))
@@ -1191,6 +1238,16 @@
             }
 
             @Override
+            public Boolean visitDisjunctiveType(DisjunctiveType t, Type s) {
+                for (Type t2 : t.types) {
+                    if (isCastable(t2, s)) {
+                        return true;
+                    }
+                }
+                return false;
+            }
+
+            @Override
             public Boolean visitErrorType(ErrorType t, Type s) {
                 return true;
             }
@@ -1225,7 +1282,7 @@
             private Set<TypePair> cache = new HashSet<TypePair>();
 
             public Boolean visitType(Type t, Type s) {
-                if (s.tag == WILDCARD)
+                if (s.tag == WILDCARD || s.tag == DISJOINT)
                     return visit(s, t);
                 else
                     return notSoftSubtypeRecursive(t, s) || notSoftSubtypeRecursive(s, t);
@@ -1283,6 +1340,11 @@
                 }
                 return false;
             }
+
+            @Override
+            public Boolean visitDisjunctiveType(DisjunctiveType t, Type s) {
+                return notSoftSubtypeRecursive(t, s) && notSoftSubtypeRecursive(s, t);
+            }
         };
     // </editor-fold>
 
@@ -1684,6 +1746,11 @@
             }
 
             @Override
+            public Type visitDisjunctiveType(DisjunctiveType t, Boolean recurse) {
+                return erasure(lub(t.types));
+            }
+
+            @Override
             public Type visitTypeVar(TypeVar t, Boolean recurse) {
                 return erasure(t.bound, recurse);
             }
@@ -1829,6 +1896,11 @@
             }
 
             @Override
+            public Type visitDisjunctiveType(DisjunctiveType t, Void ignored) {
+                return lub(t.types);
+            }
+
+            @Override
             public Type visitArrayType(ArrayType t, Void ignored) {
                 if (t.elemtype.isPrimitive() || isSameType(t.elemtype, syms.objectType))
                     return arraySuperType();
@@ -2290,6 +2362,14 @@
         }
 
         @Override
+        public Type visitDisjunctiveType(DisjunctiveType t, Void s) {
+            List<Type> types1 = subst(t.types);
+            return (types1 != t.types) ?
+                new DisjunctiveType(types1, syms.disjointClass) :
+                t;
+        }
+
+        @Override
         public Type visitErrorType(ErrorType t, Void ignored) {
             return t;
         }
@@ -3523,6 +3603,7 @@
         public R visitWildcardType(WildcardType t, S s) { return visitType(t, s); }
         public R visitArrayType(ArrayType t, S s)       { return visitType(t, s); }
         public R visitMethodType(MethodType t, S s)     { return visitType(t, s); }
+        public R visitDisjunctiveType(DisjunctiveType t, S s)  { return visitType(t, s); }
         public R visitFunctionType(FunctionType t, S s)  { return visitType(t, s); }
         public R visitPackageType(PackageType t, S s)   { return visitType(t, s); }
         public R visitTypeVar(TypeVar t, S s)           { return visitType(t, s); }
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Jun 15 11:22:08 2010 +0100
@@ -500,17 +500,22 @@
     void attribTypeVariables(List<JCTypeParameter> typarams, Env<AttrContext> env) {
         for (JCTypeParameter tvar : typarams) {
             TypeVar a = (TypeVar)tvar.type;
+            Type pt = Type.noType;
             a.tsym.flags_field |= UNATTRIBUTED;
+            if ((tvar.flags & THROWS) != 0) {
+                pt = syms.exceptionType;
+                a.tsym.flags_field |= THROWS;
+            }
             a.bound = Type.noType;
             if (!tvar.bounds.isEmpty()) {
-                List<Type> bounds = List.of(attribType(tvar.bounds.head, env));
+                List<Type> bounds = List.of(attribType(tvar.bounds.head, env, pt));
                 for (JCExpression bound : tvar.bounds.tail)
-                    bounds = bounds.prepend(attribType(bound, env));
+                    bounds = bounds.prepend(attribType(bound, env, pt));
                 types.setBounds(a, bounds.reverse());
             } else {
                 // if no bounds are given, assume a single bound of
                 // java.lang.Object.
-                types.setBounds(a, List.of(syms.objectType));
+                types.setBounds(a, List.of((tvar.flags & THROWS) != 0 ? syms.exceptionType : syms.objectType));
             }
             a.tsym.flags_field &= ~UNATTRIBUTED;
         }
@@ -990,19 +995,19 @@
             JCCatch c = l.head;
             Env<AttrContext> catchEnv =
                 env.dup(c, env.info.dup(env.info.scope.dup()));
+            catchEnv.info.allowsDisjointTypes = true;
             Type ctype = attribStat(c.param, catchEnv);
             if (TreeInfo.isMultiCatch(c)) {
                 //check that multi-catch parameter is marked as final
                 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;
             }
             if (c.param.type.tsym.kind == Kinds.VAR) {
                 c.param.sym.setData(ElementKind.EXCEPTION_PARAMETER);
             }
             chk.checkType(c.param.vartype.pos(),
-                          chk.checkClassType(c.param.vartype.pos(), ctype),
+                          chk.checkClassOrDisjunctiveType(c.param.vartype.pos(), ctype),
                           syms.throwableType);
             attribStat(c.body, catchEnv);
             catchEnv.info.scope.leave();
@@ -1412,7 +1417,7 @@
             }
 
             if (!typeargtypesNonRefOK) {
-                chk.checkRefTypes(tree.typeargs, typeargtypes);
+                chk.checkParameterTypes(tree.typeargs, typeargtypes, TreeInfo.symbol(tree.meth).type.getTypeArguments());
             }
 
             // Check that value of resulting type is admissible in the
@@ -1925,7 +1930,7 @@
                 resType == syms.botType ?
                     syms.objectType :
                     resType,
-                List.<Type>nil(),
+                null,
                 syms.methodHandleType.tsym);
         flow.analyzeLambda(that, make);
         that.sym.type = that.type.asMethodType(types);
@@ -2369,6 +2374,11 @@
                     rs.access(sym2, pos, site, name, true);
                     return sym;
                 }
+            case DISJOINT: {
+                DisjunctiveType ut = (DisjunctiveType) site;
+                tree.selected.type = site = types.lub(ut.types);
+                return selectSym(tree, site, env, pt, pkind);
+            }
             case ERROR:
                 // preserve identifier names through errors
                 return types.createErrorType(name, site.tsym, site).tsym;
@@ -2822,7 +2832,8 @@
         Type clazztype = chk.checkClassType(tree.clazz.pos(), attribType(tree.clazz, env));
 
         // Attribute type parameters
-        List<Type> actuals = attribTypes(tree.arguments, env);
+        List<Type> actuals = attribAnyTypes(tree.arguments, env);
+        actuals = chk.checkParameterTypes(tree.arguments, actuals, clazztype.tsym.type.getTypeArguments());
 
         if (clazztype.tag == CLASS) {
             List<Type> formals = clazztype.tsym.type.getTypeArguments();
@@ -2869,7 +2880,20 @@
 
     public void visitTypeDisjoint(JCTypeDisjoint tree) {
         List<Type> componentTypes = attribTypes(tree.components, env);
-        tree.type = result = check(tree, types.lub(componentTypes), TYP, pkind, pt);
+        List<Type> union = chk.union(componentTypes);
+
+        //build a mapping from types in the union to component AST nodes
+        //this is required in order to generate correct diagnostic
+        //since chk.union might swap types
+        for (Type t1 : union) {
+            for (JCExpression comp : tree.components) {
+                if (t1 == comp.type) {
+                    tree.componentsFromTypeMap.put(t1, comp);
+                }
+            }
+        }
+        Type owntype = new DisjunctiveType(union, syms.disjointClass);
+        tree.type = result = check(tree, owntype, TYP, pkind, pt);
     }
 
     @Override
@@ -2956,6 +2980,9 @@
         Type type = (tree.kind.kind == BoundKind.UNBOUND)
             ? syms.objectType
             : attribType(tree.inner, env);
+        if (type.tag == VOID) {
+            type = new DisjunctiveType(List.<Type>nil(), syms.disjointClass);
+        }
         result = check(tree, new WildcardType(chk.checkRefType(tree.pos(), type),
                                               tree.kind.kind,
                                               syms.boundClass),
--- a/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Tue Jun 15 11:22:08 2010 +0100
@@ -71,6 +71,10 @@
      */
     Symbol enclVar = null;
 
+    /** are disjoint types allowed in this context?
+     */
+    boolean allowsDisjointTypes = false;
+
     /** Duplicate this context, replacing scope field and copying all others.
      */
     AttrContext dup(Scope scope) {
@@ -83,6 +87,7 @@
         info.tvars = tvars;
         info.lint = lint;
         info.enclVar = enclVar;
+        info.allowsDisjointTypes = allowsDisjointTypes;
         return info;
     }
 
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue Jun 15 11:22:08 2010 +0100
@@ -464,25 +464,47 @@
      *  @param a             The type that should be bounded by bs.
      *  @param bs            The bound.
      */
-    private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) {
-         if (a.isUnbound()) {
-             return;
-         } else if (a.tag != WILDCARD) {
-             a = types.upperBound(a);
-             for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
-                 if (!types.isSubtype(a, l.head)) {
-                     log.error(pos, "not.within.bounds", a);
-                     return;
-                 }
-             }
-         } else if (a.isExtendsBound()) {
-             if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings))
-                 log.error(pos, "not.within.bounds", a);
-         } else if (a.isSuperBound()) {
-             if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound()))
-                 log.error(pos, "not.within.bounds", a);
-         }
-     }
+    private boolean checkExtends(JCExpression tree, Type a, TypeVar bs) {
+        Type s = a.tag == WILDCARD ?
+            a.isExtendsBound() ?
+                types.upperBound(a) :
+                types.lowerBound(a) :
+            types.upperBound(a);
+        Type f = bs.getUpperBound();
+        BoundKind bk = a.tag == WILDCARD ?
+            ((WildcardType)a).kind :
+            null;
+        tree = bk != null && bk != BoundKind.UNBOUND ?
+            TreeInfo.typeIn(((JCWildcard)TreeInfo.typeIn(tree)).getBound()) :
+            tree;        
+        List<Type> ss = s.tag == DISJOINT ?
+            ((DisjunctiveType)s).types :
+            List.of(s);
+        boolean isOk = true;
+        for (Type s2 : ss) {
+            if (!checkExtends1(s2, f, bk)) {
+                DiagnosticPosition pos = tree.getTag() == JCTree.TYPEDISJOINT ?
+                    ((JCTypeDisjoint)tree).componentsFromTypeMap.get(s2).pos() :
+                    tree.pos();
+                log.error(pos, "not.within.bounds", s2, types.getBounds(bs));
+                isOk = false;
+            }
+        }
+        return isOk;
+    }
+
+    boolean checkExtends1(Type s, Type f, BoundKind bk) {
+        if (bk == null) {
+            return types.isSubtype(s, f);
+        } else {
+            switch (bk) {
+                case UNBOUND: return true;
+                case EXTENDS: return types.isCastable(f, s, Warner.noWarnings);
+                case SUPER: return !types.notSoftSubtype(s, f);
+                default: return false;
+            }
+        }
+    }
 
     /** Check that a type is within some bounds.
      *
@@ -516,6 +538,20 @@
         }
     }
 
+    Type checkClassOrDisjunctiveType(DiagnosticPosition pos, Type t) {
+        if (t.tag != CLASS &&
+                t.tag != DISJOINT &&
+                t.tag != ERROR &&
+                (t.tag != TYPEVAR || (t.tsym.flags() & THROWS) == 0))
+            return typeTagError(pos,
+                                diags.fragment("type.req.class.disjoint"),
+                                (t.tag == TYPEVAR)
+                                ? diags.fragment("type.parameter", t)
+                                : t);
+        else
+            return t;
+    }
+
     /** Check that type is a class or interface type.
      *  @param pos           Position to be used for error reporting.
      *  @param t             The type to be checked.
@@ -579,6 +615,7 @@
         case ARRAY:
         case TYPEVAR:
         case WILDCARD:
+        case DISJOINT:
         case ERROR:
             return t;
         default:
@@ -602,6 +639,37 @@
         return types;
     }
 
+    /** Check that each type is a valid type for an instantiation of a type-parameter
+     *  i.e. a class, interface or array type or a type variable. Void type is only allowed
+     *  to mean niladic disjunctive type (in which case 'void' is replaced with
+     *  an empty disjunctive type).
+     *
+     *  @param trees         Original trees, used for error reporting.
+     *  @param actuals         The types to be checked.
+     *  @param formals         Expected type-parameters types.
+     */
+    List<Type> checkParameterTypes(List<JCExpression> trees, List<Type> actuals, List<Type> formals) {
+        List<JCExpression> tl = trees;
+        List<Type> fs = formals;
+        for (List<Type> l = actuals; l.nonEmpty() && fs.nonEmpty(); l = l.tail) {
+            l.head = checkParameterType(tl.head, l.head, fs.head);
+            tl = tl.tail;
+            fs = fs.tail;
+        }
+        return actuals;
+    }
+
+    Type checkParameterType(JCExpression tree, Type actual, Type formal) {
+        if ((formal.tsym.flags() & THROWS) != 0 &&
+                actual.tag == VOID) {
+            tree.type = new DisjunctiveType(List.<Type>nil(), syms.disjointClass);
+            return tree.type;
+        }
+        else {
+            return checkRefType(tree.pos(), actual);
+        }
+    }
+
     /** Check that type is a null or reference type.
      *  @param pos           Position to be used for error reporting.
      *  @param t             The type to be checked.
@@ -905,7 +973,14 @@
 
         @Override
         public void visitTypeArray(JCArrayTypeTree tree) {
-            validate(tree.elemtype, env);
+            boolean prevAllowsThrowsTyparams = env.info.allowsDisjointTypes;
+            try {
+                env.info.allowsDisjointTypes = false;
+                validate(tree.elemtype, env);
+            }
+            finally {
+                env.info.allowsDisjointTypes = prevAllowsThrowsTyparams;
+            }
         }
 
         @Override
@@ -915,12 +990,20 @@
                 List<Type> actuals = tree.type.allparams();
                 List<JCExpression> args = tree.arguments;
                 List<Type> forms = tree.type.tsym.type.getTypeArguments();
-                ListBuffer<TypeVar> tvars_buf = new ListBuffer<TypeVar>();
+                ListBuffer<Type> tvars_buf = new ListBuffer<Type>();
 
                 // For matching pairs of actual argument types `a' and
                 // formal type parameters with declared bound `b' ...
                 while (args.nonEmpty() && forms.nonEmpty()) {
-                    validate(args.head, env);
+                    boolean prevAllowsThrowsTyparams = env.info.allowsDisjointTypes;
+                    try {
+                        env.info.allowsDisjointTypes =
+                                (forms.head.tsym.flags() & THROWS) != 0;
+                        validate(args.head, env);
+                    }
+                    finally {
+                        env.info.allowsDisjointTypes = prevAllowsThrowsTyparams;
+                    }
 
                     // exact type arguments needs to know their
                     // bounds (for upper and lower bound
@@ -946,17 +1029,24 @@
                 }
 
                 args = tree.arguments;
-                List<TypeVar> tvars = tvars_buf.toList();
+                List<Type> tvars = tvars_buf.toList();
+                boolean isOk = true;
 
                 while (args.nonEmpty() && tvars.nonEmpty()) {
-                    checkExtends(args.head.pos(),
-                                 args.head.type,
-                                 tvars.head);
+                    Type actual = types.subst(args.head.type,
+                         tree.type.tsym.type.getTypeArguments(),
+                         tvars_buf.toList());
+                    if (!checkExtends(args.head,
+                                  actual, (TypeVar)tvars.head))
+                        isOk = false;
                     args = args.tail;
                     tvars = tvars.tail;
                 }
 
-                checkCapture(tree);
+                if (isOk) {
+                    //avoid redundant diagnostics
+                    checkCapture(tree);
+                }
 
                 // Check that this type is either fully parameterized, or
                 // not parameterized at all.
@@ -974,12 +1064,28 @@
         }
 
         @Override
+        public void visitTypeDisjoint(JCTypeDisjoint tree) {            
+            if (!env.info.allowsDisjointTypes) {
+                log.error(tree.pos, "disjoint.type.not.allowed.here");
+            }
+            validate(tree.components, env);
+        }
+
+        @Override
         public void visitWildcard(JCWildcard tree) {
             if (tree.inner != null)
                 validate(tree.inner, env);
         }
 
         @Override
+        public void visitIdent(JCIdent tree) {
+            if ((tree.sym.flags() & THROWS) != 0 &&
+                    !env.info.allowsDisjointTypes) {
+                log.error(tree.pos, "throws.typaram.not.allowed.here");
+            }
+        }
+
+        @Override
         public void visitSelect(JCFieldAccess tree) {
             if (tree.type.tag == CLASS) {
                 visitSelectInternal(tree);
@@ -1061,7 +1167,13 @@
             else return ts1.prepend(ts.head);
         }
     }
-
+    
+    /** Form the union of a list of types.
+     */
+    public List<Type> union(List<Type> ts1) {
+        return union(List.<Type>nil(), ts1);
+    }
+    
     /** Form the union of two type set lists.
      */
     public List<Type> union(List<Type> ts1, List<Type> ts2) {
--- a/src/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java	Tue Jun 15 11:22:08 2010 +0100
@@ -35,6 +35,7 @@
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -321,9 +322,19 @@
      */
     void markThrown(JCTree tree, Type exc) {
         if (!chk.isUnchecked(tree.pos(), exc)) {
-            if (!chk.isHandled(exc, caught))
-                pendingExits.append(new PendingExit(tree, exc));
-            thrown = chk.incl(exc, thrown);
+            if (exc.tag == DISJOINT) {
+                DisjunctiveType dt = (DisjunctiveType)exc;
+                for (Type exc2 : dt.types) {
+                    if (!chk.isHandled(exc2, caught))
+                        pendingExits.append(new PendingExit(tree, exc2));
+                    thrown = chk.incl(exc2, thrown);
+                }
+            }
+            else {
+                if (!chk.isHandled(exc, caught))
+                    pendingExits.append(new PendingExit(tree, exc));
+                thrown = chk.incl(exc, thrown);
+            }
         }
     }
 
@@ -362,7 +373,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.type.tag == DISJOINT) { //multi-catch parameter
                         log.error(pos, "multicatch.parameter.may.not.be.assigned",
                                   sym);
                     }
@@ -970,7 +981,7 @@
                     ((JCTypeDisjoint)l.head.param.vartype).components :
                     List.of(l.head.param.vartype);
             for (JCExpression ct : subClauses) {
-                caught = chk.incl(ct.type, caught);
+                caught = chk.incl(types.erasure(ct.type), caught);
             }
         }
         Bits uninitsTryPrev = uninitsTry;
@@ -998,7 +1009,7 @@
             List<Type> ctypes = List.nil();
             List<Type> rethrownTypes = chk.diff(thrownInTry, caughtInTry);
             for (JCExpression ct : subClauses) {
-                Type exc = ct.type;
+                Type exc = types.erasure(ct.type);
                 ctypes = ctypes.append(exc);
                 if (types.isSameType(exc, syms.objectType))
                     continue;
--- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Jun 15 11:22:08 2010 +0100
@@ -212,7 +212,9 @@
             else if (that.lobounds.tail.isEmpty())
                 that.inst = that.lobounds.head.isPrimitive() ? syms.errType : that.lobounds.head;
             else {
-                that.inst = types.lub(that.lobounds);
+                that.inst = (that.qtype.tsym.flags() & Flags.THROWS) == 0 ?
+                    types.lub(that.lobounds) :
+                    new DisjunctiveType(chk.union(that.lobounds), syms.disjointClass);
             }
             if (that.inst == null || that.inst.tag == ERROR)
                     throw ambiguousNoInstanceException
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue Jun 15 11:22:08 2010 +0100
@@ -616,6 +616,12 @@
                 */
                 return t;
             }
+        case '|':
+            {
+                sigp++;
+                List<Type> argtypes = sigToTypes(';');
+                return new DisjunctiveType(argtypes, syms.disjointClass);
+            }
         case 'S':
             sigp++;
             return syms.shortType;
@@ -798,12 +804,18 @@
     /** Convert (implicit) signature to type parameter.
      */
     Type sigToTypeParam() {
-        int start = sigp;
+        boolean isThrowsTyparam = signature[sigp] == '|';
+        int start = isThrowsTyparam ?
+            sigp + 1:
+            sigp;
         while (signature[sigp] != ':') sigp++;
         Name name = names.fromUtf(signature, start, sigp - start);
         TypeVar tvar;
         if (sigEnterPhase) {
             tvar = new TypeVar(name, currentOwner, syms.botType);
+            if (isThrowsTyparam) {
+                tvar.tsym.flags_field |= THROWS;
+            }
             typevars.enter(tvar.tsym);
         } else {
             tvar = (TypeVar)findTypeVar(name);
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue Jun 15 11:22:08 2010 +0100
@@ -345,6 +345,12 @@
             assembleParamsSig(ft.tvars);
             assembleSig(ft.qtype);
             break;
+        case DISJOINT:
+            DisjunctiveType dt = (DisjunctiveType)type;
+            sigbuf.appendByte('|');
+            assembleSig(dt.types);
+            sigbuf.appendByte(';');
+            break;
         case UNINITIALIZED_THIS:
         case UNINITIALIZED_OBJECT:
             // we don't yet have a spec for uninitialized types in the
@@ -401,6 +407,9 @@
         sigbuf.appendByte('<');
         for (List<Type> ts = typarams; ts.nonEmpty(); ts = ts.tail) {
             TypeVar tvar = (TypeVar)ts.head;
+            if ((tvar.tsym.flags() & THROWS) != 0) {
+                sigbuf.appendByte('|');
+            }
             sigbuf.appendName(tvar.tsym.name);
             List<Type> bounds = types.getBounds(tvar);
             if ((bounds.head.tsym.flags() & INTERFACE) != 0) {
--- a/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java	Tue Jun 15 11:22:08 2010 +0100
@@ -235,6 +235,7 @@
         case BOOLEAN: return BYTEcode;
         case VOID: return VOIDcode;
         case CLASS:
+        case DISJOINT:
         case ARRAY:
         case METHOD:
         case BOT:
--- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1370,7 +1370,7 @@
             endFinalizerGap(env);
             if (startpc != endpc) for (List<JCCatch> l = catchers; l.nonEmpty(); l = l.tail) {
                 // start off with exception on stack
-                code.entryPoint(stateTry, l.head.param.sym.type);
+                code.entryPoint(stateTry, l.head.param.type);
                 genCatch(l.head, env, startpc, endpc, gaps);
                 genFinalizer(env);
                 if (hasFinalizer || l.tail.nonEmpty()) {
--- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Tue Jun 15 11:22:08 2010 +0100
@@ -135,6 +135,7 @@
         this.allowDiamond = source.allowDiamond();
         this.allowMulticatch = source.allowMulticatch();
         this.allowTypeAnnotations = source.allowTypeAnnotations();
+        this.allowThrowTypeParameters = source.allowThrowTypeParameters();
         this.allowLambda = source.allowLambda();
         this.allowFunctionTypes = source.allowLambda() &&
                 fac.options.get("allowFunctionTypes") != null;
@@ -198,6 +199,10 @@
      */
     boolean allowFunctionTypes;
 
+    /** Switch: should we recognize throw type-parameters?
+     */
+    boolean allowThrowTypeParameters;
+
     /** Switch: should we keep docComments?
      */
     boolean keepDocComments;
@@ -217,6 +222,7 @@
     static final int NOPARAMS = 0x4;
     static final int TYPEARG = 0x8;
     static final int DIAMOND = 0x10;
+    static final int DISJOINT = 0x20;
 
     /** The current mode.
      */
@@ -639,22 +645,27 @@
      * Note that this method sets {@code mode} to {@code TYPE} first, before
      * parsing annotations.
      */
+    public JCExpression parseType(int mode) {
+        List<JCTypeAnnotation> annotations = typeAnnotationsOpt();
+        return parseType(annotations, mode);
+    }
+
     public JCExpression parseType() {
         List<JCTypeAnnotation> annotations = typeAnnotationsOpt();
-        return parseType(annotations);
+        return parseType(annotations, TYPE);
     }
 
-    public JCExpression parseType(List<JCTypeAnnotation> annotations) {
-        JCExpression result = unannotatedType();
-
+    public JCExpression parseType(List<JCTypeAnnotation> annotations, int mode) {
+        JCExpression result = unannotatedType(mode);
+        
         if (!annotations.isEmpty())
             result = F.AnnotatedType(annotations, result);
 
         return result;
     }
 
-    public JCExpression unannotatedType() {
-        return term(TYPE);
+    public JCExpression unannotatedType(int mode) {
+        return term(mode);
     }
 
     JCExpression term(int newmode) {
@@ -958,6 +969,7 @@
             break;
         case LPAREN:
             if (typeArgs == null && (mode & EXPR) != 0) {
+                S.pushState();
                 S.nextToken();
                 mode = EXPR | TYPE | NOPARAMS;
                 t = term3();
@@ -967,7 +979,7 @@
                     int pos1 = S.pos();
                     S.nextToken();
                     mode &= (EXPR | TYPE);
-                    mode |= TYPEARG;
+                    mode |= TYPEARG | DISJOINT;
                     JCExpression t1 = term3();
                     if ((mode & TYPE) != 0 &&
                         (S.token() == COMMA || S.token() == GT)) {
@@ -1000,6 +1012,13 @@
                 else {
                     t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
                 }
+                //if not PAREN the pop saved state and rollback (with expression)
+                if (S.token() != RPAREN) {
+                    S.popState();
+                    mode = EXPR;
+                    t = parExpression();
+                    break;
+                }
                 accept(RPAREN);
                 lastmode = mode;
                 mode = EXPR;
@@ -1193,7 +1212,11 @@
             break;
         case VOID:
             if (typeArgs != null) illegal();
-            if ((mode & EXPR) != 0) {
+            if ((mode & DISJOINT) != 0) {
+                accept(VOID);
+                return toP(F.at(pos).TypeIdent(TypeTags.VOID));
+            }
+            else if ((mode & EXPR) != 0) {
                 S.nextToken();
                 if (S.token() == DOT) {
                     JCPrimitiveTypeTree ti = toP(F.at(pos).TypeIdent(TypeTags.VOID));
@@ -1240,6 +1263,22 @@
                     t = to(F.at(pos1).Indexed(t, t1));
                 }
                 accept(RBRACKET);
+            } else if (S.token() == BAR) {
+                if ((mode & DISJOINT) != 0) {
+                    int oldmode = mode;
+                    mode = TYPE;
+                    List<JCExpression> types = List.of(t);
+                    checkThrowTypeParameters();
+                    while (S.token() == BAR) {                        
+                        accept(BAR);
+                        types = types.append(parseType());
+                    }
+                    t = toP(F.at(t.getStartPosition()).TypeDisjoint(types));
+                    mode = oldmode;
+                }
+                else {
+                    break;
+                }
             } else if (S.token() == DOT) {
                 S.nextToken();
                 typeArgs = typeArgumentsOpt(EXPR);
@@ -1331,9 +1370,9 @@
         if (S.token() == LPAREN &&
                 S.peekToken() == THROWS) {
             S.nextToken();
-            accept(THROWS);
-            thrown = qualidentList();
-            accept(RPAREN);
+                accept(THROWS);
+                thrown = qualidentList();
+                accept(RPAREN);
         }
         return toP(F.at(S.pos()).FunctionType(args, retType, thrown));
     }
@@ -1405,7 +1444,7 @@
         if (S.token() == LT &&
             (mode & TYPE) != 0 &&
             (mode & NOPARAMS) == 0) {
-            mode = TYPE;
+            mode = TYPE | DISJOINT;
             checkGenerics();
             return typeArguments(t);
         } else {
@@ -1413,7 +1452,7 @@
         }
     }
     List<JCExpression> typeArgumentsOpt() {
-        return typeArgumentsOpt(TYPE);
+        return typeArgumentsOpt(TYPE | DISJOINT);
     }
 
     List<JCExpression> typeArgumentsOpt(int useMode) {
@@ -1431,7 +1470,7 @@
 
     /**  TypeArguments  = "<" TypeArgument {"," TypeArgument} ">"
      */
-    List<JCExpression> typeArguments() {
+    List<JCExpression> typeArguments() {        
         ListBuffer<JCExpression> args = lb();
         if (S.token() == LT) {
             S.nextToken();
@@ -1440,10 +1479,10 @@
                 S.nextToken();
                 return List.nil();
             }
-            args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
+            args.append(((mode & EXPR) == 0) ? typeArgument() : parseType(TYPE | DISJOINT));
             while (S.token() == COMMA) {
                 S.nextToken();
-                args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
+                args.append(((mode & EXPR) == 0) ? typeArgument() : parseType(TYPE | DISJOINT));
             }
             switch (S.token()) {
             case GTGTGTEQ:
@@ -1470,7 +1509,7 @@
         }
         return args.toList();
     }
-
+    
     /** TypeArgument = Type
      *               | [Annotations] "?"
      *               | [Annotations] "?" EXTENDS Type {"&" Type}
@@ -1478,19 +1517,19 @@
      */
     JCExpression typeArgument() {
         List<JCTypeAnnotation> annotations = typeAnnotationsOpt();
-        if (S.token() != QUES) return parseType(annotations);
+        if (S.token() != QUES) return parseType(annotations, TYPE | DISJOINT);
         int pos = S.pos();
-        S.nextToken();
+            S.nextToken();
         JCExpression result;
         if (S.token() == EXTENDS) {
             TypeBoundKind t = to(F.at(pos).TypeBoundKind(BoundKind.EXTENDS));
             S.nextToken();
-            JCExpression bound = parseType();
+            JCExpression bound = parseType(TYPE | DISJOINT);
             result = F.at(pos).Wildcard(t, bound);
         } else if (S.token() == SUPER) {
             TypeBoundKind t = to(F.at(pos).TypeBoundKind(BoundKind.SUPER));
             S.nextToken();
-            JCExpression bound = parseType();
+            JCExpression bound = parseType(TYPE | DISJOINT);
             result = F.at(pos).Wildcard(t, bound);
         } else if (S.token() == IDENTIFIER) {
             //error recovery
@@ -2761,9 +2800,13 @@
     /** TypeList = Type {"," Type}
      */
     List<JCExpression> typeList() {
+        return typeList(COMMA);
+    }
+
+    List<JCExpression> typeList(Token sep) {
         ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
         ts.append(parseType());
-        while (S.token() == COMMA) {
+        while (S.token() == sep) {
             S.nextToken();
             ts.append(parseType());
         }
@@ -2847,7 +2890,7 @@
                             mods.pos = mods.annotations.head.pos;
                     }
                     // method returns types are un-annotated types
-                    type = unannotatedType();
+                    type = unannotatedType(TYPE);
                 }
                 if (S.token() == LPAREN && !isInterface && type.getTag() == JCTree.IDENT) {
                     if (isInterface || name != className)
@@ -3021,6 +3064,12 @@
     JCTypeParameter typeParameter() {
         int pos = S.pos();
         List<JCTypeAnnotation> annos = typeAnnotationsOpt();
+        long flags = 0;        
+        if (S.token() == THROWS) {
+            checkThrowTypeParameters();
+            flags |= Flags.THROWS;
+            accept(THROWS);
+        }
         Name name = ident();
         ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>();
         if (S.token() == EXTENDS) {
@@ -3031,7 +3080,7 @@
                 bounds.append(parseType());
             }
         }
-        return toP(F.at(pos).TypeParameter(name, bounds.toList(), annos));
+        return toP(F.at(pos).TypeParameter(flags, name, bounds.toList(), annos));
     }
 
     /** FormalParameters = "(" [ FormalParameterList ] ")"
@@ -3316,4 +3365,10 @@
             allowFunctionTypes = true;
         }
     }
+    void checkThrowTypeParameters() {
+        if (!allowThrowTypeParameters) {
+            log.error(S.pos(), "throw.typarams.not.supported.in.source", source.name);
+            allowThrowTypeParameters = true;
+        }
+    }
 }
--- a/src/share/classes/com/sun/tools/javac/parser/Lexer.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/Lexer.java	Tue Jun 15 11:22:08 2010 +0100
@@ -144,4 +144,14 @@
      * Sets the current token.
      */
     void token(Token token);
+
+    /**
+     * Save the current lexer state
+     */
+    void pushState();
+
+    /**
+     * Restore the previously saved lexer state
+     */
+    void popState();
 }
--- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Tue Jun 15 11:22:08 2010 +0100
@@ -112,6 +112,10 @@
      */
     private Source source;
 
+    /** The input buffer
+     */
+    private char[] buf;
+
     /** The token's position, 0-based offset from beginning of text.
      */
     private int pos;
@@ -146,10 +150,9 @@
     private char[] sbuf = new char[128];
     private int sp;
 
-    /** The input buffer, index of next chacter to be read,
+    /** The index of next chacter to be read,
      *  index of one past last character in buffer.
      */
-    private char[] buf;
     private int bp;
     private int buflen;
     private int eofPos;
@@ -162,6 +165,69 @@
      */
     private int unicodeConversionBp = -1;
 
+    /**
+     * This class is used to sae the lexer state. In principle we could avoid
+     * to redundancy by always accessing the lexer state through an instance of
+     * this class. On the other hand, this approach don't affect negatively
+     * lexer performances (e.g. by requiring an extra field access/method call
+     * each time the lexer state needs to be accessed) - which is important.
+     */
+    class ScannerState {
+        private Token savedToken;
+        private int savedPos;
+        private int savedEndPos;
+        private int savedPrevEndPos;
+        private int savedErrPos;
+        private Name savedName;
+        private int savedRadix;
+        protected boolean savedDeprecatedFlag;
+        private char[] savedSbuf;
+        private int savedSp;
+        private int savedBp;
+        private int savedBuflen;
+        private int savedEofPos;
+        private char savedCh;
+        private int savedUnicodeConversionBp;
+
+        ScannerState() {
+            savedToken = token;
+            savedPos = pos;
+            savedEndPos = endPos;
+            savedPrevEndPos = prevEndPos;
+            savedErrPos = errPos;
+            savedName = name;
+            savedRadix = radix;
+            savedDeprecatedFlag = deprecatedFlag;
+            savedSbuf = sbuf;
+            savedSp = sp;
+            savedBp = bp;
+            savedBuflen = buflen;
+            savedEofPos = eofPos;
+            savedCh = ch;
+            savedUnicodeConversionBp = unicodeConversionBp;
+        }
+
+        void restore() {
+            token = savedToken;
+            pos = savedPos;
+            endPos = savedEndPos;
+            prevEndPos = savedPrevEndPos;
+            errPos = savedErrPos;
+            name = savedName;
+            radix = savedRadix;
+            deprecatedFlag = savedDeprecatedFlag;
+            sbuf = savedSbuf;
+            sp = savedSp;
+            bp = savedBp;
+            buflen = savedBuflen;
+            eofPos =  savedEofPos;
+            ch = savedCh;
+            unicodeConversionBp = savedUnicodeConversionBp;
+        }
+    }
+
+    private List<ScannerState> stateStack;
+
     /** The log to be used for error reporting.
      */
     private final Log log;
@@ -181,6 +247,16 @@
         allowBinaryLiterals = source.allowBinaryLiterals();
         allowHexFloats = source.allowHexFloats();
         allowUnderscoresInLiterals = source.allowBinaryLiterals();
+        stateStack = List.of(new ScannerState());
+    }
+
+    public void pushState() {
+        stateStack = stateStack.prepend(new ScannerState());
+    }
+
+    public void popState() {
+        stateStack.head.restore();
+        stateStack = stateStack.tail;
     }
 
     private static final boolean hexFloatsWork = hexFloatsWork();
@@ -810,25 +886,13 @@
     }
 
     public Token peekToken() {
-        Token prevToken = token;
-        int prevPos = pos;
-        int _prevEndPos = endPos;
-        int prevPrevEndPos = prevEndPos;
-        char prevCh = ch;
-        int prevBp = bp;
         try {
-            if (token != EOF) {
-                nextToken();
-            }
+            pushState();
+            nextToken();
             return token;
         }
         finally {
-            token = prevToken;
-            pos = prevPos;
-            endPos = _prevEndPos;
-            prevEndPos = prevPrevEndPos;
-            ch = prevCh;
-            bp = prevBp;
+            popState();
         }
     }
 
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Jun 15 11:22:08 2010 +0100
@@ -260,6 +260,8 @@
     interface expected here
 compiler.err.intf.meth.cant.have.body=\
     interface methods cannot have body
+compiler.err.throws.typarg.expected.here=\
+    ''throws'' type-argument expected here
 compiler.err.invalid.annotation.member.type=\
     invalid type for annotation member
 compiler.err.invalid.binary.number=\
@@ -517,6 +519,10 @@
     hexadecimal floating-point literals are not supported on this VM
 compiler.err.void.not.allowed.here=\
     ''void'' type not allowed here
+compiler.err.throws.typaram.not.allowed.here=\
+    ''throws'' type-parameter not allowed here
+compiler.err.disjoint.type.not.allowed.here=\
+    disjoint type argument not allowed here
 
 compiler.err.wrong.number.type.args=\
     wrong number of type arguments; required {0}
@@ -956,10 +962,14 @@
 #####
 
 compiler.err.not.within.bounds=\
-    type parameter {0} is not within its bound
+    type parameter is not within its bound\n\
+    found:  {0}\n\
+    bounds: {1}
 
 compiler.err.not.within.bounds.explain=\
-    type parameter {0} is not within its bound; {1}
+    type parameter is not within its bound; {1}\n\
+    found:  {0}\n\
+    bounds: {1}
 
 ## The following are all possible strings for the second argument ({1}) of the
 ## above string.
@@ -1021,6 +1031,8 @@
 ## above string.
 compiler.misc.type.req.class=\
     class
+compiler.misc.type.req.class.disjoint=\
+    class or disjunctive type
 compiler.misc.type.req.class.array=\
     class or array
 compiler.misc.type.req.ref=\
@@ -1294,9 +1306,13 @@
 compiler.misc.captured.type=\
     CAP#{0}
 
-# <INT#n> (where n is an int id) is an abbreviation for 'intersection type'
+# <AND#n> (where n is an int id) is an abbreviation for 'intersection type'
 compiler.misc.intersection.type=\
-    INT#{0}
+    AND#{0}
+
+# <OR#n> (where n is an int id) is an abbreviation for 'disjunctive type'
+compiler.misc.disjunctive.type=\
+    OR#{0}
 
 # where clause for captured type: contains upper ('extends {1}') and lower
 # ('super {2}') bound along with the wildcard that generated this captured type ({3})
@@ -1323,6 +1339,14 @@
 compiler.misc.where.intersection=\
     {0} extends {1}
 
+# where clause for disjunctive type: contains all the types ('extends {1}')
+# in this disjunctive type
+compiler.misc.where.disjunctive=\
+    {0} has components: {1}
+
+compiler.misc.where.disjunctive.nil=\
+    {0} has no components
+
 ### Where clause headers ###
 compiler.misc.where.description.captured=\
     where {0} is a fresh type-variable:
@@ -1330,11 +1354,13 @@
     where {0} is a type-variable:
 compiler.misc.where.description.intersection=\
     where {0} is an intersection type:
+compiler.misc.where.description.disjunctive=\
+    where {0} is a disjunctive type:
 compiler.misc.where.description.captured.1=\
     where {0} are fresh type-variables:
 compiler.misc.where.description.typevar.1=\
     where {0} are type-variables:
 compiler.misc.where.description.intersection.1=\
     where {0} are intersection types:
-
-
+compiler.misc.where.description.disjunctive.1=\
+    where {0} are disjunctive types:
--- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1936,6 +1936,7 @@
     public static class JCTypeDisjoint extends JCExpression implements DisjointTypeTree {
 
         public List<JCExpression> components;
+        public HashMap<Type, JCExpression> componentsFromTypeMap = new HashMap<Type, JCExpression>();
 
         protected JCTypeDisjoint(List<JCExpression> components) {
             this.components = components;
@@ -2007,10 +2008,12 @@
      * @param bounds bounds
      */
     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
+        public long flags;
         public Name name;
         public List<JCExpression> bounds;
         public List<JCTypeAnnotation> annotations;
-        protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
+        protected JCTypeParameter(long flags, Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
+            this.flags = flags;
             this.name = name;
             this.bounds = bounds;
             this.annotations = annotations;
@@ -2038,8 +2041,8 @@
 
     public static class JCWildcard extends JCExpression implements WildcardTree {
         public TypeBoundKind kind;
-        public JCTree inner;
-        protected JCWildcard(TypeBoundKind kind, JCTree inner) {
+        public JCExpression inner;
+        protected JCWildcard(TypeBoundKind kind, JCExpression inner) {
             kind.getClass(); // null-check
             this.kind = kind;
             this.inner = inner;
@@ -2059,7 +2062,7 @@
                 throw new AssertionError("Unknown wildcard bound " + kind);
             }
         }
-        public JCTree getBound() { return inner; }
+        public JCExpression getBound() { return inner; }
         @Override
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitWildcard(this, d);
@@ -2306,7 +2309,7 @@
         JCArrayTypeTree TypeArray(JCExpression elemtype);
         JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
         JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
-        JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
+        JCWildcard Wildcard(TypeBoundKind kind, JCExpression type);
         TypeBoundKind TypeBoundKind(BoundKind kind);
         JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
         JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
--- a/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Tue Jun 15 11:22:08 2010 +0100
@@ -422,7 +422,7 @@
     public JCTree visitWildcard(WildcardTree node, P p) {
         JCWildcard t = (JCWildcard) node;
         TypeBoundKind kind = M.at(t.kind.pos).TypeBoundKind(t.kind.kind);
-        JCTree inner = copy(t.inner, p);
+        JCExpression inner = copy(t.inner, p);
         return M.at(t.pos).Wildcard(kind, inner);
     }
 
--- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Tue Jun 15 11:22:08 2010 +0100
@@ -902,6 +902,7 @@
         case JCTree.WILDCARD: /* wild cards */
         case JCTree.TYPEPARAMETER: /* type parameters */
         case JCTree.TYPEAPPLY: /* parameterized types */
+        case JCTree.TYPEDISJOINT: /* disjoint types */
             return tree;
         default:
             throw new AssertionError("Unexpected type tree: " + tree);
--- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Tue Jun 15 11:22:08 2010 +0100
@@ -469,12 +469,16 @@
     }
 
     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annos) {
-        JCTypeParameter tree = new JCTypeParameter(name, bounds, annos);
+        return TypeParameter(0, name, bounds, annos);
+    }
+
+    public JCTypeParameter TypeParameter(long flags, Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annos) {
+        JCTypeParameter tree = new JCTypeParameter(flags, name, bounds, annos);
         tree.pos = pos;
         return tree;
     }
 
-    public JCWildcard Wildcard(TypeBoundKind kind, JCTree type) {
+    public JCWildcard Wildcard(TypeBoundKind kind, JCExpression type) {
         JCWildcard tree = new JCWildcard(kind, type);
         tree.pos = pos;
         return tree;
--- a/src/share/classes/com/sun/tools/javac/util/Names.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/Names.java	Tue Jun 15 11:22:08 2010 +0100
@@ -139,6 +139,7 @@
     public final Name RUNTIME;
     public final Name Array;
     public final Name Method;
+    public final Name Disjoint;
     public final Name Bound;
     public final Name clone;
     public final Name getComponentType;
@@ -262,6 +263,7 @@
 
         Array = fromString("Array");
         Method = fromString("Method");
+        Disjoint = fromString("Disjoint");
         Bound = fromString("Bound");
         clone = fromString("clone");
         getComponentType = fromString("getComponentType");
--- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Tue Jun 15 11:22:08 2010 +0100
@@ -212,7 +212,9 @@
     private int indexOf(Type type, WhereClauseKind kind) {
         int index = 1;
         for (Type t : whereClauses.get(kind).keySet()) {
-            if (t.tsym == type.tsym) {
+            if (t.tag == TYPEVAR ?
+                t.tsym == type.tsym :
+                types.isSameType(type, t)) {
                 return index;
             }
             if (kind != WhereClauseKind.TYPEVAR ||
@@ -246,7 +248,9 @@
         /** where clause regarding a captured type */
         CAPTURED("where.description.captured"),
         /** where clause regarding an intersection type */
-        INTERSECTION("where.description.intersection");
+        INTERSECTION("where.description.intersection"),
+        /** where clause regarding a disjunctive type */
+        DISJUNCTIVE("where.description.disjunctive");
 
         /** resource key for this where clause kind */
         private String key;
@@ -355,6 +359,17 @@
         }
 
         @Override
+        public String visitDisjunctiveType(DisjunctiveType t, Locale locale) {
+            if (getConfiguration().isEnabled(RichFormatterFeature.WHERE_CLAUSES)) {
+                return localize(locale,
+                    "compiler.misc.disjunctive.type",
+                    indexOf(t, WhereClauseKind.DISJUNCTIVE));
+            }
+            else
+                return super.visitDisjunctiveType(t, locale);
+        }
+
+        @Override
         public String visitClassType(ClassType t, Locale locale) {
             if (t.isCompound() &&
                     getConfiguration().isEnabled(RichFormatterFeature.WHERE_CLAUSES)) {
@@ -474,6 +489,19 @@
         }
 
         @Override
+        public Void visitDisjunctiveType(DisjunctiveType t, Void ignored) {
+            if (indexOf(t, WhereClauseKind.DISJUNCTIVE) == -1) {
+                String subkey = t.types.isEmpty() ?
+                    ".nil" :
+                    "";
+                JCDiagnostic d = diags.fragment("where.disjunctive" + subkey, t, t.types);
+                whereClauses.get(WhereClauseKind.DISJUNCTIVE).put(t, d);
+                visit(t.types);
+            }
+            return null;
+        }
+
+        @Override
         public Void visitErrorType(ErrorType t, Void ignored) {
             Type ot = t.getOriginalType();
             if (ot != null)
--- a/test/tools/javac/generics/diamond/neg/Neg01.out	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg01.out	Tue Jun 15 11:22:08 2010 +0100
@@ -1,29 +1,29 @@
-Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:18:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:19:25: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:19:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:20:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String
+Neg01.java:21:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:23:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:24:25: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:24:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:25:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String
+Neg01.java:26:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:28:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:29:25: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:29:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:30:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , kindname.class, Neg01<X>
 Neg01.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String
+Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:33:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg01.java:34:25: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:34:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:35:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String
+Neg01.java:36:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg01.java:36:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 28 errors
--- a/test/tools/javac/generics/diamond/neg/Neg02.out	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg02.out	Tue Jun 15 11:22:08 2010 +0100
@@ -1,57 +1,57 @@
-Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:20:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:22:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:25:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:27:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:30:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:32:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:35:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:37:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:42:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:44:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:47:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:49:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:52:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:54:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String
+Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg02.java:57:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg02.java:59:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg02.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 56 errors
--- a/test/tools/javac/generics/diamond/neg/Neg03.out	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg03.out	Tue Jun 15 11:22:08 2010 +0100
@@ -1,85 +1,85 @@
-Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:20:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:22:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:25:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:27:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:30:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:32:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:35:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:37:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:42:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:44:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:47:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:49:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:52:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:54:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:57:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:59:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:63:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:64:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:64:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:65:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:66:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:66:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:68:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:69:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:69:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:70:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:71:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:71:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:73:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:74:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:74:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:75:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:76:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:76:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String
+Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:78:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg03.java:79:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:79:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:80:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg03.java:81:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg03.java:81:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 84 errors
--- a/test/tools/javac/generics/diamond/neg/Neg04.out	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg04.out	Tue Jun 15 11:22:08 2010 +0100
@@ -1,29 +1,29 @@
-Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:18:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:19:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:19:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:20:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:21:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:21:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:23:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:24:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:24:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:25:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:26:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:26:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:28:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:29:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:29:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:30:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:31:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String
+Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:33:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String
+Neg04.java:34:23: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:34:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:35:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String
+Neg04.java:36:21: compiler.err.not.within.bounds: java.lang.String, java.lang.Number
 Neg04.java:36:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 28 errors
--- a/test/tools/javac/lambda/BadAccess.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/BadAccess.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/BadLambdaCall.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/BadLambdaCall.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/BadReturn.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/BadReturn.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/ExceptionTransparency01.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary basic test for exception transparency
+ * @author  Maurizio Cimadamore
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles ExceptionTransparency01
+ */
+
+import java.lang.annotation.*;
+
+public class ExceptionTransparency01 {
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface CatchNumber {
+        int value();
+    }
+
+    @CatchNumber(1)
+    static class A extends Exception {}
+
+    @CatchNumber(2)
+    static class B extends Exception {}
+
+    interface Foo<throws E extends Exception> {
+        void choose() throws E;
+    }
+
+    static int total = 0;
+
+    static <throws X extends Exception> void call(Foo<X> foo) throws X { foo.choose(); }
+
+    static void test(final boolean cond) {
+        try {
+            call(#() { if (cond) throw new A(); else throw new B();});
+        }
+        catch (final A|B ex) {
+            CatchNumber catchNumber = ex.getClass().getAnnotation(CatchNumber.class);
+            total += catchNumber.value();
+        }
+    }
+
+    public static void main(String[] args) {
+        ExceptionTransparency01.test(true);
+        ExceptionTransparency01.test(false);
+        if (total != 3) {
+            throw new Error("bad checksum - expected:3, found:" + total);
+        }
+    }
+}
--- a/test/tools/javac/lambda/FuncType01.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/FuncType01.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaCapture01.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaCapture01.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaCapture02.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaCapture02.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaCapture03.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaCapture03.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaCapture04.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaCapture04.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaCapture05.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaCapture05.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaConv01.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaConv01.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaConv02.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaConv02.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaConv03.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaConv03.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaConv04.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaConv04.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaConv05.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaConv05.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaExpr01.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaExpr01.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaExpr02.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaExpr02.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaExpr03.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaExpr03.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaScope01.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaScope01.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/LambdaScope02.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/LambdaScope02.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- a/test/tools/javac/lambda/NakedThis.java	Fri Jun 04 12:34:09 2010 +0100
+++ b/test/tools/javac/lambda/NakedThis.java	Tue Jun 15 11:22:08 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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
@@ -16,9 +16,9 @@
  * 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.
+ * 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.
  */
 
 /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg01.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary disjunctive types and type disjointness
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=Neg01.out -XDrawDiagnostics Neg01.java
+ */
+
+class Neg01 {
+    static class A extends Exception {}
+    static class B extends Exception {}
+    static class C extends Exception {}
+    static class D extends Exception {}
+
+    interface Foo<throws E> {}
+
+    static class T implements Foo<A|B> {}
+    static class S extends T implements Foo<C|D> {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg01.out	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,2 @@
+Neg01.java:40:12: compiler.err.cant.inherit.diff.arg: Neg01.Foo, Neg01.D|Neg01.C, Neg01.B|Neg01.A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg02.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary bounds of a throws type-variable must be subtype of Exception
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=Neg02.out -XDrawDiagnostics Neg02.java
+ */
+
+class Neg02<throws E extends Number> {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg02.out	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,2 @@
+Neg02.java:31:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Number, java.lang.Exception
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg03.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary components of a disjunctive type must be subtype of exception
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java
+ */
+
+import java.util.Comparator;
+
+class Neg03<throws E> {
+   Neg03<Exception> v0;
+   Neg03<Object> v1;
+   Neg03<Object|Number> v2;
+   Neg03<Comparator<?>|Number|String> v3;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg03.out	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,6 @@
+Neg03.java:35:10: compiler.err.not.within.bounds: java.lang.Object, java.lang.Exception
+Neg03.java:36:10: compiler.err.not.within.bounds: java.lang.Object, java.lang.Exception
+Neg03.java:37:31: compiler.err.not.within.bounds: java.lang.String, java.lang.Exception
+Neg03.java:37:24: compiler.err.not.within.bounds: java.lang.Number, java.lang.Exception
+Neg03.java:37:20: compiler.err.not.within.bounds: java.util.Comparator<?>, java.lang.Exception
+5 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg04.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary test that disjunctive types are only allowed in certain positions
+ * @author  Alex Buckley
+ * @compile/fail/ref=Neg04.out -XDrawDiagnostics Neg04.java
+ */
+
+interface Neg04<throws E> {
+
+    interface Splittable<X,throws Y> {}
+    interface Callable<X> {}
+
+    void m1(E x);                             // Illegal
+    void m2(Splittable<String, E> x);  // Legal
+    void m3(Callable<String> x) throws E;     // Legal
+    E m4();                                   // Illegal
+    Splittable<String, E> m5();        // Legal
+
+    <throws F> void m6(F x);                             // Illegal
+    <throws F> void m7(Splittable<String, F> x);  // Legal
+    <throws F> void m8(Callable<String> x) throws F;     // Legal
+    <throws F> F m9();                                   // Illegal
+    <throws F> Splittable<String, F> m10();       // Legal
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg04.out	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,5 @@
+Neg04.java:36:13: compiler.err.throws.typaram.not.allowed.here
+Neg04.java:39:5: compiler.err.throws.typaram.not.allowed.here
+Neg04.java:42:24: compiler.err.throws.typaram.not.allowed.here
+Neg04.java:45:16: compiler.err.throws.typaram.not.allowed.here
+4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg05.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary throws type-parameter in catch clause
+ * @author  Alex Buckley
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=Neg05.out -XDrawDiagnostics Neg05.java
+ */
+
+class Neg05 {
+    static interface Function<throws X> {
+        void invoke() throws X;
+    }
+
+    <throws X, throws Y> void m(Function<X> first, Function<Y> second) {
+        try {
+            first.invoke();
+            second.invoke();
+        }
+        catch (X x) { System.out.println("First blew up!"); }
+        catch (Y y) { System.out.println("Second blew up!"); }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg05.out	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,2 @@
+Neg05.java:43:9: compiler.err.except.already.caught: java.lang.Exception
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg06.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary test disjointess w.r.t. disjunctive types
+ * @author  Alex Buckley
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=Neg06.out -Xlint:unchecked -XDrawDiagnostics Neg06.java
+ */
+
+class Neg06 {
+    class A extends Exception {}
+    class B extends Exception {}
+    class C extends A {}
+    class D extends B {}
+    class E extends Exception {}
+    class F extends Exception {}
+
+    class Foo<throws E> {}
+
+    Foo<? extends A|B> foo1 = (Foo<? extends A|B>)(Foo<? extends Exception>)null;
+    Foo<? extends Exception> foo2 = (Foo<? extends Exception>)(Foo<? extends A|B>)null;
+    Foo<? extends A|B> foo3 = (Foo<? extends A|B>)(Foo<? extends C|D>)null;
+    Foo<? extends C|D> foo4 = (Foo<? extends C|D>)(Foo<? extends A|B>)null;
+    Foo<? extends A|B> foo5 = (Foo<? extends A|B>)(Foo<? extends E|F>)null;
+    Foo<? extends E|F> foo6 = (Foo<? extends E|F>)(Foo<? extends A|B>)null;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg06.out	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,6 @@
+Neg06.java:42:51: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), Neg06.Foo<compiler.misc.type.captureof: 1, ? extends java.lang.Exception>, Neg06.Foo<? extends Neg06.B|Neg06.A>
+Neg06.java:45:51: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), Neg06.Foo<compiler.misc.type.captureof: 1, ? extends Neg06.B|Neg06.A>, Neg06.Foo<? extends Neg06.D|Neg06.C>
+Neg06.java:46:51: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), Neg06.Foo<compiler.misc.type.captureof: 1, ? extends Neg06.F|Neg06.E>, Neg06.Foo<? extends Neg06.B|Neg06.A>
+Neg06.java:47:51: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), Neg06.Foo<compiler.misc.type.captureof: 1, ? extends Neg06.B|Neg06.A>, Neg06.Foo<? extends Neg06.F|Neg06.E>
+2 errors
+2 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg07.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary check covariant type-arguments
+ * @author  Alex Buckley
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=Neg07.out -Xlint:unchecked -XDrawDiagnostics Neg07.java
+ */
+
+class Neg07 {
+    static class A extends Exception {}
+    static class B extends Exception {}
+
+    class Foo<throws E> {}
+
+    Foo<? extends A|B> fooAB = null;
+    Foo<? extends A> fooA = null;
+    Foo<? extends B> fooB = null;
+    Foo<? extends Exception> fooEx = null;
+    Foo<? extends void> fooNil = null;
+
+
+    {
+        fooNil = fooAB;
+        fooNil = fooA;
+        fooNil = fooB;
+        fooNil = fooEx;
+
+        fooA = fooB;
+        fooA = fooAB;
+        fooA = fooEx;
+
+        fooB = fooA;
+        fooB = fooAB;
+        fooB = fooEx;
+
+        fooAB = fooEx;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg07.out	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,12 @@
+Neg07.java:46:18: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends Neg07.B|Neg07.A>, Neg07.Foo<? extends >
+Neg07.java:47:18: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends Neg07.A>, Neg07.Foo<? extends >
+Neg07.java:48:18: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends Neg07.B>, Neg07.Foo<? extends >
+Neg07.java:49:18: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends java.lang.Exception>, Neg07.Foo<? extends >
+Neg07.java:51:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends Neg07.B>, Neg07.Foo<? extends Neg07.A>
+Neg07.java:52:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends Neg07.B|Neg07.A>, Neg07.Foo<? extends Neg07.A>
+Neg07.java:53:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends java.lang.Exception>, Neg07.Foo<? extends Neg07.A>
+Neg07.java:55:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends Neg07.A>, Neg07.Foo<? extends Neg07.B>
+Neg07.java:56:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends Neg07.B|Neg07.A>, Neg07.Foo<? extends Neg07.B>
+Neg07.java:57:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends java.lang.Exception>, Neg07.Foo<? extends Neg07.B>
+Neg07.java:59:17: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg07.Foo<compiler.misc.type.captureof: 1, ? extends java.lang.Exception>, Neg07.Foo<? extends Neg07.B|Neg07.A>
+11 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg08.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary check contravariant exception type-arguments
+ * @author  Alex Buckley
+ * @author  Maurizio Cimadamore
+ * @compile/fail/ref=Neg08.out -XDrawDiagnostics Neg08.java
+ */
+
+class Neg08 {
+    static class A extends Exception {}
+    static class B extends Exception {}
+
+    class Foo<throws E> {}
+
+    Foo<? super A|B> fooAB = null;
+    Foo<? super A> fooA = null;
+    Foo<? super B> fooB = null;
+    Foo<? super Exception> fooEx = null;
+    Foo<? super void> fooNil = null;
+
+
+    {
+        fooAB = fooNil;
+        fooA = fooNil;
+        fooB = fooNil;
+        fooEx = fooNil;
+
+        fooAB = fooA;
+        fooAB = fooB;
+
+        fooEx = fooA;
+        fooEx = fooB;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Neg08.out	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,9 @@
+Neg08.java:46:17: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg08.Foo<compiler.misc.type.captureof: 1, ? super >, Neg08.Foo<? super Neg08.B|Neg08.A>
+Neg08.java:47:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg08.Foo<compiler.misc.type.captureof: 1, ? super >, Neg08.Foo<? super Neg08.A>
+Neg08.java:48:16: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg08.Foo<compiler.misc.type.captureof: 1, ? super >, Neg08.Foo<? super Neg08.B>
+Neg08.java:49:17: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg08.Foo<compiler.misc.type.captureof: 1, ? super >, Neg08.Foo<? super java.lang.Exception>
+Neg08.java:51:17: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg08.Foo<compiler.misc.type.captureof: 1, ? super Neg08.A>, Neg08.Foo<? super Neg08.B|Neg08.A>
+Neg08.java:52:17: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg08.Foo<compiler.misc.type.captureof: 1, ? super Neg08.B>, Neg08.Foo<? super Neg08.B|Neg08.A>
+Neg08.java:54:17: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg08.Foo<compiler.misc.type.captureof: 1, ? super Neg08.A>, Neg08.Foo<? super java.lang.Exception>
+Neg08.java:55:17: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg08.Foo<compiler.misc.type.captureof: 1, ? super Neg08.B>, Neg08.Foo<? super java.lang.Exception>
+8 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Pos01.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary basic test for exception transparency
+ * @author  Maurizio Cimadamore
+ */
+
+import java.lang.annotation.*;
+
+public class Pos01 {
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface CatchNumber {
+        int value();
+    }
+
+    @CatchNumber(1)
+    static class A extends Exception {}
+
+    @CatchNumber(2)
+    static class B extends Exception {}
+
+    interface Foo<throws E extends Exception> {
+        void choose() throws E;
+    }
+
+    static int total = 0;
+
+    static <throws X extends Exception> void call(Foo<X> foo) throws X { foo.choose(); }
+
+    static void test(final boolean cond) {
+        try {
+            call(new Foo<A|B>() { public void choose()  throws A,B { if (cond) throw new A(); else throw new B();}});
+        }
+        catch (final A|B ex) {
+            CatchNumber catchNumber = ex.getClass().getAnnotation(CatchNumber.class);
+            total += catchNumber.value();
+        }
+    }
+
+    public static void main(String[] args) {
+        Pos01.test(true);
+        Pos01.test(false);
+        if (total != 3) {
+            throw new Error("bad checksum - expected:3, found:" + total);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Pos02.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary check covariant exception type-arguments
+ * @author  Alex Buckley
+ * @author  Maurizio Cimadamore
+ * @compile Pos02.java
+ */
+
+class Pos02 {
+    static class A extends Exception {}
+    static class B extends Exception {}
+
+    class Foo<throws E> {}
+
+    Foo<? extends A|B> fooAB = null;
+    Foo<? extends A> fooA = null;
+    Foo<? extends B> fooB = null;
+    Foo<? extends Exception> fooEx = null;
+    Foo<? extends void> fooNil = null;
+
+
+    {
+        fooAB = fooNil;
+        fooA = fooNil;
+        fooB = fooNil;
+        fooEx = fooNil;
+
+        fooAB = fooA;
+        fooAB = fooB;
+
+        fooEx = fooA;
+        fooEx = fooB;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/transparency/Pos03.java	Tue Jun 15 11:22:08 2010 +0100
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @summary check contravariant exception type-arguments
+ * @author  Alex Buckley
+ * @author  Maurizio Cimadamore
+ * @compile Pos03.java
+ */
+
+class Pos02 {
+    static class A extends Exception {}
+    static class B extends Exception {}
+
+    class Foo<throws E> {}
+
+    Foo<? super A|B> fooAB = null;
+    Foo<? super A> fooA = null;
+    Foo<? super B> fooB = null;
+    Foo<? super Exception> fooEx = null;
+    Foo<? super void> fooNil = null;
+
+
+    {
+        fooNil = fooAB;
+        fooNil = fooA;
+        fooNil = fooB;
+        fooNil = fooEx;
+        
+        fooA = fooAB;
+        fooA = fooEx;
+        
+        fooB = fooAB;
+        fooB = fooEx;
+
+        fooAB = fooEx;
+    }
+}