Merge
diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
index a61630b..9eeff69 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java
@@ -49,6 +49,7 @@
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.TypeSymbol;
 import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Enter;
@@ -230,7 +231,7 @@
     public boolean isAccessible(Scope scope, TypeElement type) {
         if (scope instanceof JavacScope && type instanceof ClassSymbol) {
             Env<AttrContext> env = ((JavacScope) scope).env;
-            return resolve.isAccessible(env, (ClassSymbol)type);
+            return resolve.isAccessible(env, (ClassSymbol)type, true);
         } else
             return false;
     }
@@ -240,7 +241,7 @@
                 && member instanceof Symbol
                 && type instanceof com.sun.tools.javac.code.Type) {
             Env<AttrContext> env = ((JavacScope) scope).env;
-            return resolve.isAccessible(env, (com.sun.tools.javac.code.Type)type, (Symbol)member);
+            return resolve.isAccessible(env, (com.sun.tools.javac.code.Type)type, (Symbol)member, true);
         } else
             return false;
     }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
index 5b0b8bad..a7abe98 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
@@ -247,6 +247,11 @@
      */
     public static final long OVERRIDE_BRIDGE = 1L<<41;
 
+    /**
+     * Flag that marks an 'effectively final' local variable
+     */
+    public static final long EFFECTIVELY_FINAL = 1L<<42;
+
     /** Modifier masks.
      */
     public static final int
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java
index 3b9ca6f..5145ca2 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java
@@ -212,9 +212,9 @@
         VARARGS("varargs"),
 
         /**
-         * Warn about arm resources
+         * Warn about issues relating to use of try blocks (i.e. try-with-resources)
          */
-        ARM("arm");
+        TRY("try");
 
         LintCategory(String option) {
             this(option, false);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java b/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java
index 8bbc73d..b491a49 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -31,7 +31,8 @@
 /** A scope represents an area of visibility in a Java program. The
  *  Scope class is a container for symbols which provides
  *  efficient access to symbols given their names. Scopes are implemented
- *  as hash tables. Scopes can be nested; the next field of a scope points
+ *  as hash tables with "open addressing" and "double hashing".
+ *  Scopes can be nested; the next field of a scope points
  *  to its next outer scope. Nested scopes can share their hash tables.
  *
  *  <p><b>This is NOT part of any supported API.
@@ -55,7 +56,7 @@
 
     /** A hash table for the scope's entries.
      */
-    public Entry[] table;
+    Entry[] table;
 
     /** Mask for hash codes, always equal to (table.length - 1).
      */
@@ -67,8 +68,9 @@
     public Entry elems;
 
     /** The number of elements in this scope.
+     * This includes deleted elements, whose value is the sentinel.
      */
-    public int nelems = 0;
+    int nelems = 0;
 
     /** A timestamp - useful to quickly check whether a scope has changed or not
      */
@@ -109,7 +111,8 @@
         }
     }
 
-    /** Every hash bucket is a list of Entry's which ends in sentinel.
+    /** Use as a "not-found" result for lookup.
+     * Also used to mark deleted entries in the table.
      */
     private static final Entry sentinel = new Entry(null, null, null, null);
 
@@ -130,12 +133,15 @@
         this.owner = owner;
         this.table = table;
         this.hashMask = table.length - 1;
-        this.elems = null;
-        this.nelems = 0;
-        this.shared = 0;
         this.scopeCounter = scopeCounter;
     }
 
+    /** Convenience constructor used for dup and dupUnshared. */
+    private Scope(Scope next, Symbol owner, Entry[] table) {
+        this(next, owner, table, next.scopeCounter);
+        this.nelems = next.nelems;
+    }
+
     /** Construct a new scope, within scope next, with given owner,
      *  using a fresh table of length INITIAL_SIZE.
      */
@@ -145,7 +151,6 @@
 
     protected Scope(Symbol owner, ScopeCounter scopeCounter) {
         this(null, owner, new Entry[INITIAL_SIZE], scopeCounter);
-        for (int i = 0; i < INITIAL_SIZE; i++) table[i] = sentinel;
     }
 
     /** Construct a fresh scope within this scope, with same owner,
@@ -154,11 +159,7 @@
      *  of fresh tables.
      */
     public Scope dup() {
-        Scope result = new Scope(this, this.owner, this.table, scopeCounter);
-        shared++;
-        // System.out.println("====> duping scope " + this.hashCode() + " owned by " + this.owner + " to " + result.hashCode());
-        // new Error().printStackTrace(System.out);
-        return result;
+        return dup(this.owner);
     }
 
     /** Construct a fresh scope within this scope, with new owner,
@@ -167,7 +168,7 @@
      *  of fresh tables.
      */
     public Scope dup(Symbol newOwner) {
-        Scope result = new Scope(this, newOwner, this.table, scopeCounter);
+        Scope result = new Scope(this, newOwner, this.table);
         shared++;
         // System.out.println("====> duping scope " + this.hashCode() + " owned by " + newOwner + " to " + result.hashCode());
         // new Error().printStackTrace(System.out);
@@ -179,7 +180,7 @@
      *  the table of its outer scope.
      */
     public Scope dupUnshared() {
-        return new Scope(this, this.owner, this.table.clone(), scopeCounter);
+        return new Scope(this, this.owner, this.table.clone());
     }
 
     /** Remove all entries of this scope from its table, if shared
@@ -189,7 +190,7 @@
         assert shared == 0;
         if (table != next.table) return next;
         while (elems != null) {
-            int hash = elems.sym.name.hashCode() & hashMask;
+            int hash = getIndex(elems.sym.name);
             Entry e = table[hash];
             assert e == elems : elems.sym;
             table[hash] = elems.shadowed;
@@ -197,6 +198,7 @@
         }
         assert next.shared > 0;
         next.shared--;
+        next.nelems = nelems;
         // System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode());
         // new Error().printStackTrace(System.out);
         return next;
@@ -215,19 +217,17 @@
                 s.hashMask = newtable.length - 1;
             }
         }
-        for (int i = 0; i < newtable.length; i++) newtable[i] = sentinel;
-        for (int i = 0; i < oldtable.length; i++) copy(oldtable[i]);
-    }
-
-    /** Copy the given entry and all entries shadowed by it to table
-     */
-    private void copy(Entry e) {
-        if (e.sym != null) {
-            copy(e.shadowed);
-            int hash = e.sym.name.hashCode() & hashMask;
-            e.shadowed = table[hash];
-            table[hash] = e;
+        int n = 0;
+        for (int i = oldtable.length; --i >= 0; ) {
+            Entry e = oldtable[i];
+            if (e != null && e != sentinel && ! e.isBogus()) {
+                table[getIndex(e.sym.name)] = e;
+                n++;
+            }
         }
+        // We don't need to update nelems for shared inherited scopes,
+        // since that gets handled by leave().
+        nelems = n;
     }
 
     /** Enter symbol sym in this scope.
@@ -248,13 +248,17 @@
      */
     public void enter(Symbol sym, Scope s, Scope origin) {
         assert shared == 0;
-        // Temporarily disabled (bug 6460352):
-        // if (nelems * 3 >= hashMask * 2) dble();
-        int hash = sym.name.hashCode() & hashMask;
-        Entry e = makeEntry(sym, table[hash], elems, s, origin);
+        if (nelems * 3 >= hashMask * 2)
+            dble();
+        int hash = getIndex(sym.name);
+        Entry old = table[hash];
+        if (old == null) {
+            old = sentinel;
+            nelems++;
+        }
+        Entry e = makeEntry(sym, old, elems, s, origin);
         table[hash] = e;
         elems = e;
-        nelems++;
         scopeCounter.inc();
     }
 
@@ -268,15 +272,15 @@
     public void remove(Symbol sym) {
         assert shared == 0;
         Entry e = lookup(sym.name);
-        while (e.scope == this && e.sym != sym) e = e.next();
         if (e.scope == null) return;
 
         scopeCounter.inc();
 
         // remove e from table and shadowed list;
-        Entry te = table[sym.name.hashCode() & hashMask];
+        int i = getIndex(sym.name);
+        Entry te = table[i];
         if (te == e)
-            table[sym.name.hashCode() & hashMask] = e.shadowed;
+            table[i] = e.shadowed;
         else while (true) {
             if (te.shadowed == e) {
                 te.shadowed = e.shadowed;
@@ -335,12 +339,50 @@
         return lookup(name, noFilter);
     }
     public Entry lookup(Name name, Filter<Symbol> sf) {
-        Entry e = table[name.hashCode() & hashMask];
+        Entry e = table[getIndex(name)];
+        if (e == null || e == sentinel)
+            return sentinel;
         while (e.scope != null && (e.sym.name != name || !sf.accepts(e.sym)))
             e = e.shadowed;
         return e;
     }
 
+    /*void dump (java.io.PrintStream out) {
+        out.println(this);
+        for (int l=0; l < table.length; l++) {
+            Entry le = table[l];
+            out.print("#"+l+": ");
+            if (le==sentinel) out.println("sentinel");
+            else if(le == null) out.println("null");
+            else out.println(""+le+" s:"+le.sym);
+        }
+    }*/
+
+    /** Look for slot in the table.
+     *  We use open addressing with double hashing.
+     */
+    int getIndex (Name name) {
+        int h = name.hashCode();
+        int i = h & hashMask;
+        // The expression below is always odd, so it is guaranteed
+        // be be mutually prime with table.length, a power of 2.
+        int x = hashMask - ((h + (h >> 16)) << 1);
+        int d = -1; // Index of a deleted item.
+        for (;;) {
+            Entry e = table[i];
+            if (e == null)
+                return d >= 0 ? d : i;
+            if (e == sentinel) {
+                // We have to keep searching even if we see a deleted item.
+                // However, remember the index in case we fail to find the name.
+                if (d < 0)
+                    d = i;
+            } else if (e.sym.name == name)
+                return i;
+            i = (i + x) & hashMask;
+        }
+    }
+
     public Iterable<Symbol> getElements() {
         return getElements(noFilter);
     }
@@ -441,10 +483,7 @@
          *  outwards if not found in this scope.
          */
         public Entry next() {
-            Entry e = shadowed;
-            while (e.scope != null && e.sym.name != sym.name)
-                e = e.shadowed;
-            return e;
+            return shadowed;
         }
 
         public Scope getOrigin() {
@@ -456,6 +495,8 @@
             // in many cases.
             return scope;
         }
+
+        protected boolean isBogus () { return false; }
     }
 
     public static class ImportScope extends Scope {
@@ -470,22 +511,10 @@
         }
 
         public Entry lookup(Name name) {
-            Entry e = table[name.hashCode() & hashMask];
-            while (e.scope != null &&
-                   (e.sym.name != name ||
-                    /* Since an inner class will show up in package and
-                     * import scopes until its inner class attribute has
-                     * been processed, we have to weed it out here.  This
-                     * is done by comparing the owners of the entry's
-                     * scope and symbol fields.  The scope field's owner
-                     * points to where the class originally was imported
-                     * from.  The symbol field's owner points to where the
-                     * class is situated now.  This can change when an
-                     * inner class is read (see ClassReader.enterClass).
-                     * By comparing the two fields we make sure that we do
-                     * not accidentally import an inner class that started
-                     * life as a flat class in a package. */
-                    e.sym.owner != e.scope.owner))
+            Entry e = table[getIndex(name)];
+            if (e == null)
+                return sentinel;
+            while (e.isBogus())
                 e = e.shadowed;
             return e;
         }
@@ -499,15 +528,33 @@
             }
             public Entry next() {
                 Entry e = super.shadowed;
-                while (e.scope != null &&
-                       (e.sym.name != sym.name ||
-                        e.sym.owner != e.scope.owner)) // see lookup()
+                while (isBogus())
                     e = e.shadowed;
                 return e;
             }
 
             @Override
             public Scope getOrigin() { return origin; }
+
+            /**
+             * Is this a bogus inner-class import?
+             * An inner class {@code Outer$Inner.class} read from a class file
+             * starts out in a package scope under the name {@code Outer$Inner},
+             * which (if star-imported) gets copied to the import scope.
+             * When the InnerClasses attribute is processed, the ClassSymbol
+             * is renamed in place (to {@code Inner}), and the owner changed
+             * to the {@code Outer} class.  The ImportScope still has the old
+             * Entry that was created and hashed as {@code "Outer$Inner"},
+             * but whose name was changed to {@code "Inner"}.  This violates
+             * the invariants for the Scope hash table, and so is pretty bogus.
+             * When the symbol was renamed, it should have been removed from
+             * the import scope (and not just the package scope); however,
+             * doing so is difficult.  A better fix would be to change
+             * import scopes to indirectly reference package symbols, rather
+             * than copy from them.
+             * Until then, we detect and skip the bogus entries using this test.
+             */
+            protected boolean isBogus () { return sym.owner != scope.owner; }
         }
     }
 
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
index f6fd8fd..d9bd17e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
@@ -3151,7 +3151,7 @@
         return to.isParameterized() &&
                 (!(isUnbounded(to) ||
                 isSubtype(from, to) ||
-                ((subFrom != null) && isSameType(subFrom, to))));
+                ((subFrom != null) && containsType(to.allparams(), subFrom.allparams()))));
     }
 
     private List<Type> superClosure(Type t, Type s) {
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
index 610698b..54b2c84 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -252,10 +252,12 @@
                (base.getTag() == JCTree.IDENT && TreeInfo.name(base) == names._this)) &&
                isAssignableAsBlankFinal(v, env)))) {
             if (v.isResourceVariable()) { //TWR resource
-                log.error(pos, "twr.resource.may.not.be.assigned", v);
+                log.error(pos, "try.resource.may.not.be.assigned", v);
             } else {
                 log.error(pos, "cant.assign.val.to.final.var", v);
             }
+        } else if ((v.flags() & EFFECTIVELY_FINAL) != 0) {
+            v.flags_field &= ~EFFECTIVELY_FINAL;
         }
     }
 
@@ -799,6 +801,7 @@
                 memberEnter.memberEnter(tree, env);
                 annotate.flush();
             }
+            tree.sym.flags_field |= EFFECTIVELY_FINAL;
         }
 
         VarSymbol v = tree.sym;
@@ -1042,11 +1045,11 @@
         for (JCTree resource : tree.resources) {
             if (resource.getTag() == JCTree.VARDEF) {
                 attribStat(resource, tryEnv);
-                chk.checkType(resource, resource.type, syms.autoCloseableType, "twr.not.applicable.to.type");
+                chk.checkType(resource, resource.type, syms.autoCloseableType, "try.not.applicable.to.type");
                 VarSymbol var = (VarSymbol)TreeInfo.symbolFor(resource);
                 var.setData(ElementKind.RESOURCE_VARIABLE);
             } else {
-                attribExpr(resource, tryEnv, syms.autoCloseableType, "twr.not.applicable.to.type");
+                attribExpr(resource, tryEnv, syms.autoCloseableType, "try.not.applicable.to.type");
             }
         }
         // Attribute body
@@ -1061,11 +1064,8 @@
                 localEnv.dup(c, localEnv.info.dup(localEnv.info.scope.dup()));
             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() | DISJUNCTION;
+                //multi-catch parameter is implicitly marked as final
+                c.param.sym.flags_field |= FINAL | DISJUNCTION;
             }
             if (c.param.sym.kind == Kinds.VAR) {
                 c.param.sym.setData(ElementKind.EXCEPTION_PARAMETER);
@@ -1552,7 +1552,7 @@
         // Attribute clazz expression and store
         // symbol + type back into the attributed tree.
         Type clazztype = attribType(clazz, env);
-        Pair<Scope,Scope> mapping = getSyntheticScopeMapping(clazztype);
+        Pair<Scope,Scope> mapping = getSyntheticScopeMapping(clazztype, cdef != null);
         if (!TreeInfo.isDiamond(tree)) {
             clazztype = chk.checkClassType(
                 tree.clazz.pos(), clazztype, true);
@@ -1849,7 +1849,7 @@
      *  inference. The inferred return type of the synthetic constructor IS
      *  the inferred type for the diamond operator.
      */
-    private Pair<Scope, Scope> getSyntheticScopeMapping(Type ctype) {
+    private Pair<Scope, Scope> getSyntheticScopeMapping(Type ctype, boolean overrideProtectedAccess) {
         if (ctype.tag != CLASS) {
             return erroneousMapping;
         }
@@ -1860,6 +1860,12 @@
                 e.scope != null;
                 e = e.next()) {
             MethodSymbol newConstr = (MethodSymbol) e.sym.clone(ctype.tsym);
+            if (overrideProtectedAccess && (newConstr.flags() & PROTECTED) != 0) {
+                //make protected constructor public (this is required for
+                //anonymous inner class creation expressions using diamond)
+                newConstr.flags_field |= PUBLIC;
+                newConstr.flags_field &= ~PROTECTED;
+            }
             newConstr.name = names.init;
             List<Type> oldTypeargs = List.nil();
             if (newConstr.type.tag == FORALL) {
@@ -2252,8 +2258,8 @@
                 ((VarSymbol)sitesym).isResourceVariable() &&
                 sym.kind == MTH &&
                 sym.overrides(syms.autoCloseableClose, sitesym.type.tsym, types, true) &&
-                env.info.lint.isEnabled(Lint.LintCategory.ARM)) {
-            log.warning(tree, "twr.explicit.close.call");
+                env.info.lint.isEnabled(Lint.LintCategory.TRY)) {
+            log.warning(Lint.LintCategory.TRY, tree, "try.explicit.close.call");
         }
 
         // Disallow selecting a type from an expression
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
index 07d95cc..af05ee9 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
@@ -1510,14 +1510,7 @@
                                             Type t1,
                                             Type t2,
                                             Type site) {
-        Symbol sym = firstIncompatibility(t1, t2, site);
-        if (sym != null) {
-            log.error(pos, "types.incompatible.diff.ret",
-                      t1, t2, sym.name +
-                      "(" + types.memberType(t2, sym).getParameterTypes() + ")");
-            return false;
-        }
-        return true;
+        return firstIncompatibility(pos, t1, t2, site) == null;
     }
 
     /** Return the first method which is defined with same args
@@ -1528,7 +1521,7 @@
      *  @param site   The most derived type.
      *  @returns symbol from t2 that conflicts with one in t1.
      */
-    private Symbol firstIncompatibility(Type t1, Type t2, Type site) {
+    private Symbol firstIncompatibility(DiagnosticPosition pos, Type t1, Type t2, Type site) {
         Map<TypeSymbol,Type> interfaces1 = new HashMap<TypeSymbol,Type>();
         closure(t1, interfaces1);
         Map<TypeSymbol,Type> interfaces2;
@@ -1539,7 +1532,7 @@
 
         for (Type t3 : interfaces1.values()) {
             for (Type t4 : interfaces2.values()) {
-                Symbol s = firstDirectIncompatibility(t3, t4, site);
+                Symbol s = firstDirectIncompatibility(pos, t3, t4, site);
                 if (s != null) return s;
             }
         }
@@ -1568,7 +1561,7 @@
     }
 
     /** Return the first method in t2 that conflicts with a method from t1. */
-    private Symbol firstDirectIncompatibility(Type t1, Type t2, Type site) {
+    private Symbol firstDirectIncompatibility(DiagnosticPosition pos, Type t1, Type t2, Type site) {
         for (Scope.Entry e1 = t1.tsym.members().elems; e1 != null; e1 = e1.sibling) {
             Symbol s1 = e1.sym;
             Type st1 = null;
@@ -1592,7 +1585,18 @@
                         (types.covariantReturnType(rt1, rt2, Warner.noWarnings) ||
                          types.covariantReturnType(rt2, rt1, Warner.noWarnings)) ||
                          checkCommonOverriderIn(s1,s2,site);
-                    if (!compat) return s2;
+                    if (!compat) {
+                        log.error(pos, "types.incompatible.diff.ret",
+                            t1, t2, s2.name +
+                            "(" + types.memberType(t2, s2).getParameterTypes() + ")");
+                        return s2;
+                    }
+                } else if (!checkNameClash((ClassSymbol)site.tsym, s1, s2)) {
+                    log.error(pos,
+                            "name.clash.same.erasure.no.override",
+                            s1, s1.location(),
+                            s2, s2.location());
+                    return s2;
                 }
             }
         }
@@ -1644,32 +1648,52 @@
                 log.error(tree.pos(), "enum.no.finalize");
                 return;
             }
-        for (Type t = types.supertype(origin.type); t.tag == CLASS;
+        for (Type t = origin.type; t.tag == CLASS;
              t = types.supertype(t)) {
-            TypeSymbol c = t.tsym;
-            Scope.Entry e = c.members().lookup(m.name);
-            while (e.scope != null) {
-                if (m.overrides(e.sym, origin, types, false))
-                    checkOverride(tree, m, (MethodSymbol)e.sym, origin);
-                else if (e.sym.kind == MTH &&
-                        e.sym.isInheritedIn(origin, types) &&
-                        (e.sym.flags() & SYNTHETIC) == 0 &&
-                        !m.isConstructor()) {
-                    Type er1 = m.erasure(types);
-                    Type er2 = e.sym.erasure(types);
-                    if (types.isSameTypes(er1.getParameterTypes(),
-                            er2.getParameterTypes())) {
-                            log.error(TreeInfo.diagnosticPositionFor(m, tree),
-                                    "name.clash.same.erasure.no.override",
-                                    m, m.location(),
-                                    e.sym, e.sym.location());
-                    }
-                }
-                e = e.next();
+            if (t != origin.type) {
+                checkOverride(tree, t, origin, m);
+            }
+            for (Type t2 : types.interfaces(t)) {
+                checkOverride(tree, t2, origin, m);
             }
         }
     }
 
+    void checkOverride(JCTree tree, Type site, ClassSymbol origin, MethodSymbol m) {
+        TypeSymbol c = site.tsym;
+        Scope.Entry e = c.members().lookup(m.name);
+        while (e.scope != null) {
+            if (m.overrides(e.sym, origin, types, false)) {
+                if ((e.sym.flags() & ABSTRACT) == 0) {
+                    checkOverride(tree, m, (MethodSymbol)e.sym, origin);
+                }
+            }
+            else if (!checkNameClash(origin, e.sym, m)) {
+                log.error(tree,
+                            "name.clash.same.erasure.no.override",
+                            m, m.location(),
+                            e.sym, e.sym.location());
+            }
+            e = e.next();
+        }
+    }
+
+    private boolean checkNameClash(ClassSymbol origin, Symbol s1, Symbol s2) {
+        if (s1.kind == MTH &&
+                    s1.isInheritedIn(origin, types) &&
+                    (s1.flags() & SYNTHETIC) == 0 &&
+                    !s2.isConstructor()) {
+            Type er1 = s2.erasure(types);
+            Type er2 = s1.erasure(types);
+            if (types.isSameTypes(er1.getParameterTypes(),
+                    er2.getParameterTypes())) {
+                    return false;
+            }
+        }
+        return true;
+    }
+
+
     /** Check that all abstract members of given class have definitions.
      *  @param pos          Position to be used for error reporting.
      *  @param c            The class.
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
index fad6dad..c6e04e1 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
@@ -226,7 +226,7 @@
      */
     Bits uninits;
 
-    HashMap<Symbol, List<Type>> multicatchTypes;
+    HashMap<Symbol, List<Type>> preciseRethrowTypes;
 
     /** The set of variables that are definitely unassigned everywhere
      *  in current try block. This variable is maintained lazily; it is
@@ -332,7 +332,7 @@
         if (!chk.isUnchecked(tree.pos(), exc)) {
             if (!chk.isHandled(exc, caught))
                 pendingExits.append(new PendingExit(tree, exc));
-            thrown = chk.incl(exc, thrown);
+                thrown = chk.incl(exc, thrown);
         }
     }
 
@@ -1037,10 +1037,10 @@
         int nextadrCatch = nextadr;
 
         if (!unrefdResources.isEmpty() &&
-                lint.isEnabled(Lint.LintCategory.ARM)) {
+                lint.isEnabled(Lint.LintCategory.TRY)) {
             for (Map.Entry<VarSymbol, JCVariableDecl> e : unrefdResources.entrySet()) {
-                log.warning(e.getValue().pos(),
-                            "automatic.resource.not.referenced", e.getKey());
+                log.warning(Lint.LintCategory.TRY, e.getValue().pos(),
+                            "try.resource.not.referenced", e.getKey());
             }
         }
 
@@ -1077,12 +1077,12 @@
             scan(param);
             inits.incl(param.sym.adr);
             uninits.excl(param.sym.adr);
-            multicatchTypes.put(param.sym, chk.intersect(ctypes, rethrownTypes));
+            preciseRethrowTypes.put(param.sym, chk.intersect(ctypes, rethrownTypes));
             scanStat(l.head.body);
             initsEnd.andSet(inits);
             uninitsEnd.andSet(uninits);
             nextadr = nextadrCatch;
-            multicatchTypes.remove(param.sym);
+            preciseRethrowTypes.remove(param.sym);
             aliveEnd |= alive;
         }
         if (tree.finalizer != null) {
@@ -1215,10 +1215,10 @@
         Symbol sym = TreeInfo.symbol(tree.expr);
         if (sym != null &&
             sym.kind == VAR &&
-            (sym.flags() & FINAL) != 0 &&
-            multicatchTypes.get(sym) != null &&
+            (sym.flags() & (FINAL | EFFECTIVELY_FINAL)) != 0 &&
+            preciseRethrowTypes.get(sym) != null &&
             allowRethrowAnalysis) {
-            for (Type t : multicatchTypes.get(sym)) {
+            for (Type t : preciseRethrowTypes.get(sym)) {
                 markThrown(tree, t);
             }
         }
@@ -1371,11 +1371,24 @@
         if (!tree.type.isErroneous()
             && lint.isEnabled(Lint.LintCategory.CAST)
             && types.isSameType(tree.expr.type, tree.clazz.type)
-            && !(ignoreAnnotatedCasts && containsTypeAnnotation(tree.clazz))) {
+            && !(ignoreAnnotatedCasts && containsTypeAnnotation(tree.clazz))
+            && !is292targetTypeCast(tree)) {
             log.warning(Lint.LintCategory.CAST,
                     tree.pos(), "redundant.cast", tree.expr.type);
         }
     }
+    //where
+        private boolean is292targetTypeCast(JCTypeCast tree) {
+            boolean is292targetTypeCast = false;
+            if (tree.expr.getTag() == JCTree.APPLY) {
+                JCMethodInvocation apply = (JCMethodInvocation)tree.expr;
+                Symbol sym = TreeInfo.symbol(apply.meth);
+                is292targetTypeCast = sym != null &&
+                    sym.kind == MTH &&
+                    (sym.flags() & POLYMORPHIC_SIGNATURE) != 0;
+            }
+            return is292targetTypeCast;
+        }
 
     public void visitTopLevel(JCCompilationUnit tree) {
         // Do nothing for TopLevel since each class is visited individually
@@ -1422,7 +1435,7 @@
             firstadr = 0;
             nextadr = 0;
             pendingExits = new ListBuffer<PendingExit>();
-            multicatchTypes = new HashMap<Symbol, List<Type>>();
+            preciseRethrowTypes = new HashMap<Symbol, List<Type>>();
             alive = true;
             this.thrown = this.caught = null;
             this.classDef = null;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
index 9498781..f7fdf8e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -1509,17 +1509,17 @@
     }
 
     private JCBlock makeArmFinallyClause(Symbol primaryException, JCExpression resource) {
-        // primaryException.addSuppressedException(catchException);
+        // primaryException.addSuppressed(catchException);
         VarSymbol catchException =
             new VarSymbol(0, make.paramName(2),
                           syms.throwableType,
                           currentMethodSym);
         JCStatement addSuppressionStatement =
             make.Exec(makeCall(make.Ident(primaryException),
-                               names.fromString("addSuppressedException"),
+                               names.addSuppressed,
                                List.<JCExpression>of(make.Ident(catchException))));
 
-        // try { resource.close(); } catch (e) { primaryException.addSuppressedException(e); }
+        // try { resource.close(); } catch (e) { primaryException.addSuppressed(e); }
         JCBlock tryBlock =
             make.Block(0L, List.<JCStatement>of(makeResourceCloseInvocation(resource)));
         JCVariableDecl catchExceptionDecl = make.VarDef(catchException, null);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
index 85d8161..c8b83de 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
@@ -159,33 +159,45 @@
      *  @param c      The class whose accessibility is checked.
      */
     public boolean isAccessible(Env<AttrContext> env, TypeSymbol c) {
+        return isAccessible(env, c, false);
+    }
+
+    public boolean isAccessible(Env<AttrContext> env, TypeSymbol c, boolean checkInner) {
+        boolean isAccessible = false;
         switch ((short)(c.flags() & AccessFlags)) {
-        case PRIVATE:
-            return
-                env.enclClass.sym.outermostClass() ==
-                c.owner.outermostClass();
-        case 0:
-            return
-                env.toplevel.packge == c.owner // fast special case
-                ||
-                env.toplevel.packge == c.packge()
-                ||
-                // Hack: this case is added since synthesized default constructors
-                // of anonymous classes should be allowed to access
-                // classes which would be inaccessible otherwise.
-                env.enclMethod != null &&
-                (env.enclMethod.mods.flags & ANONCONSTR) != 0;
-        default: // error recovery
-        case PUBLIC:
-            return true;
-        case PROTECTED:
-            return
-                env.toplevel.packge == c.owner // fast special case
-                ||
-                env.toplevel.packge == c.packge()
-                ||
-                isInnerSubClass(env.enclClass.sym, c.owner);
+            case PRIVATE:
+                isAccessible =
+                    env.enclClass.sym.outermostClass() ==
+                    c.owner.outermostClass();
+                break;
+            case 0:
+                isAccessible =
+                    env.toplevel.packge == c.owner // fast special case
+                    ||
+                    env.toplevel.packge == c.packge()
+                    ||
+                    // Hack: this case is added since synthesized default constructors
+                    // of anonymous classes should be allowed to access
+                    // classes which would be inaccessible otherwise.
+                    env.enclMethod != null &&
+                    (env.enclMethod.mods.flags & ANONCONSTR) != 0;
+                break;
+            default: // error recovery
+            case PUBLIC:
+                isAccessible = true;
+                break;
+            case PROTECTED:
+                isAccessible =
+                    env.toplevel.packge == c.owner // fast special case
+                    ||
+                    env.toplevel.packge == c.packge()
+                    ||
+                    isInnerSubClass(env.enclClass.sym, c.owner);
+                break;
         }
+        return (checkInner == false || c.type.getEnclosingType() == Type.noType) ?
+            isAccessible :
+            isAccessible & isAccessible(env, c.type.getEnclosingType(), checkInner);
     }
     //where
         /** Is given class a subclass of given base class, or an inner class
@@ -202,9 +214,13 @@
         }
 
     boolean isAccessible(Env<AttrContext> env, Type t) {
+        return isAccessible(env, t, false);
+    }
+
+    boolean isAccessible(Env<AttrContext> env, Type t, boolean checkInner) {
         return (t.tag == ARRAY)
             ? isAccessible(env, types.elemtype(t))
-            : isAccessible(env, t.tsym);
+            : isAccessible(env, t.tsym, checkInner);
     }
 
     /** Is symbol accessible as a member of given type in given evironment?
@@ -214,6 +230,9 @@
      *  @param sym    The symbol.
      */
     public boolean isAccessible(Env<AttrContext> env, Type site, Symbol sym) {
+        return isAccessible(env, site, sym, false);
+    }
+    public boolean isAccessible(Env<AttrContext> env, Type site, Symbol sym, boolean checkInner) {
         if (sym.name == names.init && sym.owner != site.tsym) return false;
         ClassSymbol sub;
         switch ((short)(sym.flags() & AccessFlags)) {
@@ -231,7 +250,7 @@
                  ||
                  env.toplevel.packge == sym.packge())
                 &&
-                isAccessible(env, site)
+                isAccessible(env, site, checkInner)
                 &&
                 sym.isInheritedIn(site.tsym, types)
                 &&
@@ -248,11 +267,11 @@
                  // (but type names should be disallowed elsewhere!)
                  env.info.selectSuper && (sym.flags() & STATIC) == 0 && sym.kind != TYP)
                 &&
-                isAccessible(env, site)
+                isAccessible(env, site, checkInner)
                 &&
                 notOverriddenIn(site, sym);
         default: // this case includes erroneous combinations as well
-            return isAccessible(env, site) && notOverriddenIn(site, sym);
+            return isAccessible(env, site, checkInner) && notOverriddenIn(site, sym);
         }
     }
     //where
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
index 08797b6..dc1f597 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
@@ -993,7 +993,9 @@
     /** Enter an inner class into the `innerClasses' set/queue.
      */
     void enterInner(ClassSymbol c) {
-        assert !c.type.isCompound();
+        if (c.type.isCompound()) {
+            throw new AssertionError("Unexpected intersection type: " + c.type);
+        }
         try {
             c.complete();
         } catch (CompletionFailure ex) {
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
index d96613f..639d9c7 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java
@@ -1304,7 +1304,7 @@
         stackCount = 0;
         for (int i=0; i<state.stacksize; i++) {
             if (state.stack[i] != null) {
-                frame.stack[stackCount++] = state.stack[i];
+                frame.stack[stackCount++] = types.erasure(state.stack[i]);
             }
         }
 
diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
index 214ee97..8df853e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -1712,7 +1712,7 @@
             S.nextToken();
             List<JCTree> resources = List.<JCTree>nil();
             if (S.token() == LPAREN) {
-                checkAutomaticResourceManagement();
+                checkTryWithResources();
                 S.nextToken();
                 resources = resources();
                 accept(RPAREN);
@@ -2970,9 +2970,9 @@
             allowMulticatch = true;
         }
     }
-    void checkAutomaticResourceManagement() {
+    void checkTryWithResources() {
         if (!allowTWR) {
-            error(S.pos(), "automatic.resource.management.not.supported.in.source", source.name);
+            error(S.pos(), "try.with.resources.not.supported.in.source", source.name);
             allowTWR = true;
         }
     }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
index 175c69a..7fb2e66 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
@@ -63,8 +63,6 @@
     anonymous class implements interface; cannot have type arguments
 compiler.err.anon.class.impl.intf.no.qual.for.new=\
     anonymous class implements interface; cannot have qualifier for new
-compiler.misc.twr.not.applicable.to.type=\
-    automatic resource management not applicable to variable type
 compiler.err.array.and.varargs=\
     cannot declare both {0} and {1} in {2}
 compiler.err.array.dimension.missing=\
@@ -183,12 +181,10 @@
 
 compiler.err.final.parameter.may.not.be.assigned=\
     final parameter {0} may not be assigned
-compiler.err.twr.resource.may.not.be.assigned=\
-    automatic resource {0} may not be assigned
+compiler.err.try.resource.may.not.be.assigned=\
+    auto-closeable resource {0} may not be assigned
 compiler.err.multicatch.parameter.may.not.be.assigned=\
     multi-catch parameter {0} may not be assigned
-compiler.err.multicatch.param.must.be.final=\
-    multi-catch parameter {0} must be final
 compiler.err.finally.without.try=\
     ''finally'' without ''try''
 compiler.err.foreach.not.applicable.to.type=\
@@ -825,10 +821,10 @@
 compiler.warn.proc.unmatched.processor.options=\
     The following options were not recognized by any processor: ''{0}''
 
-compiler.warn.twr.explicit.close.call=\
-    [arm] explicit call to close() on an automatic resource
-compiler.warn.automatic.resource.not.referenced=\
-    [arm] automatic resource {0} is never referenced in body of corresponding try statement
+compiler.warn.try.explicit.close.call=\
+    explicit call to close() on an auto-closeable resource
+compiler.warn.try.resource.not.referenced=\
+    auto-closeable resource {0} is never referenced in body of corresponding try statement
 compiler.warn.unchecked.assign=\
     unchecked assignment: {0} to {1}
 compiler.warn.unchecked.assign.to.var=\
@@ -1052,6 +1048,9 @@
 # compiler.err.no.elem.type=\
 #     \[\*\] cannot have a type
 
+compiler.misc.try.not.applicable.to.type=\
+    try-with-resources not applicable to variable type
+
 #####
 
 compiler.err.type.found.req=\
@@ -1274,9 +1273,9 @@
     exotic identifiers #"___" are not supported in -source {0}\n\
 (use -source 7 or higher to enable exotic identifiers)
 
-compiler.err.automatic.resource.management.not.supported.in.source=\
-    automatic resource management is not supported in -source {0}\n\
-(use -source 7 or higher to enable automatic resource management)
+compiler.err.try.with.resources.not.supported.in.source=\
+    try-with-resources is not supported in -source {0}\n\
+(use -source 7 or higher to enable try-with-resources)
 
 compiler.warn.enum.as.identifier=\
     as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java
index 9b939ea..08a56da 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -150,6 +150,7 @@
     public final Name finalize;
     public final Name java_lang_AutoCloseable;
     public final Name close;
+    public final Name addSuppressed;
 
     public final Name.Table table;
 
@@ -268,6 +269,7 @@
 
         java_lang_AutoCloseable = fromString("java.lang.AutoCloseable");
         close = fromString("close");
+        addSuppressed = fromString("addSuppressed");
     }
 
     protected Name.Table createTable(Options options) {
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/6996626/Main.java
similarity index 69%
copy from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
copy to langtools/test/tools/javac/6996626/Main.java
index 219f22a..6c38480 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/6996626/Main.java
@@ -21,18 +21,25 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
+/* @test
+ * @bug 6996626
+ * @summary Scope fix issues for ImportScope
+ * @compile pack1/Symbol.java
+ * @compile Main.java
+ */
 
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
+import pack1.*;
+import pack1.Symbol.*;
 
-    void m() {
-        try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
-        }
+// The following imports are just to trigger re-hashing (in
+// com.sun.tools.javac.code.Scope.dble()) of the star-import scope.
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+public class Main {
+    public void main (String[] args) {
+        throw new CompletionFailure();
     }
 }
+
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/6996626/pack1/Symbol.java
similarity index 74%
rename from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
rename to langtools/test/tools/javac/6996626/pack1/Symbol.java
index 219f22a..583cd64 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/6996626/pack1/Symbol.java
@@ -21,18 +21,11 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
+package pack1;
 
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
-
-    void m() {
-        try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
-        }
-    }
+public class Symbol {
+   public static class CompletionFailure extends RuntimeException { }
 }
+
+
+
diff --git a/langtools/test/tools/javac/TryWithResources/ArmLint.out b/langtools/test/tools/javac/TryWithResources/ArmLint.out
deleted file mode 100644
index f60161a..0000000
--- a/langtools/test/tools/javac/TryWithResources/ArmLint.out
+++ /dev/null
@@ -1,3 +0,0 @@
-ArmLint.java:14:15: compiler.warn.twr.explicit.close.call
-ArmLint.java:13:13: compiler.warn.automatic.resource.not.referenced: r3
-2 warnings
diff --git a/langtools/test/tools/javac/TryWithResources/ImplicitFinal.out b/langtools/test/tools/javac/TryWithResources/ImplicitFinal.out
index 0e33814..062fd46 100644
--- a/langtools/test/tools/javac/TryWithResources/ImplicitFinal.out
+++ b/langtools/test/tools/javac/TryWithResources/ImplicitFinal.out
@@ -1,2 +1,2 @@
-ImplicitFinal.java:14:13: compiler.err.twr.resource.may.not.be.assigned: r
+ImplicitFinal.java:14:13: compiler.err.try.resource.may.not.be.assigned: r
 1 error
diff --git a/langtools/test/tools/javac/TryWithResources/ArmLint.java b/langtools/test/tools/javac/TryWithResources/TwrLint.java
similarity index 69%
rename from langtools/test/tools/javac/TryWithResources/ArmLint.java
rename to langtools/test/tools/javac/TryWithResources/TwrLint.java
index 2a5a223..39c5ed6 100644
--- a/langtools/test/tools/javac/TryWithResources/ArmLint.java
+++ b/langtools/test/tools/javac/TryWithResources/TwrLint.java
@@ -2,15 +2,15 @@
  * @test  /nodynamiccopyright/
  * @bug 6911256 6964740 6965277 6967065
  * @author Joseph D. Darcy
- * @summary Check that -Xlint:arm warnings are generated as expected
- * @compile/ref=ArmLint.out -Xlint:arm,deprecation -XDrawDiagnostics ArmLint.java
+ * @summary Check that -Xlint:twr warnings are generated as expected
+ * @compile/ref=TwrLint.out -Xlint:try,deprecation -XDrawDiagnostics TwrLint.java
  */
 
-class ArmLint implements AutoCloseable {
+class TwrLint implements AutoCloseable {
     private static void test1() {
-        try(ArmLint r1 = new ArmLint();
-            ArmLint r2 = new ArmLint();
-            ArmLint r3 = new ArmLint()) {
+        try(TwrLint r1 = new TwrLint();
+            TwrLint r2 = new TwrLint();
+            TwrLint r3 = new TwrLint()) {
             r1.close();   // The resource's close
             r2.close(42); // *Not* the resource's close
             // r3 not referenced
@@ -18,11 +18,11 @@
 
     }
 
-    @SuppressWarnings("arm")
+    @SuppressWarnings("try")
     private static void test2() {
         try(@SuppressWarnings("deprecation") AutoCloseable r4 =
             new DeprecatedAutoCloseable()) {
-            // r4 not referenced
+            // r4 not referenced - but no warning is generated because of @SuppressWarnings
         } catch(Exception e) {
             ;
         }
diff --git a/langtools/test/tools/javac/TryWithResources/TwrLint.out b/langtools/test/tools/javac/TryWithResources/TwrLint.out
new file mode 100644
index 0000000..9b3f618
--- /dev/null
+++ b/langtools/test/tools/javac/TryWithResources/TwrLint.out
@@ -0,0 +1,3 @@
+TwrLint.java:14:15: compiler.warn.try.explicit.close.call
+TwrLint.java:13:13: compiler.warn.try.resource.not.referenced: r3
+2 warnings
diff --git a/langtools/test/tools/javac/TryWithResources/TwrOnNonResource.out b/langtools/test/tools/javac/TryWithResources/TwrOnNonResource.out
index a894aff..eafdbfb 100644
--- a/langtools/test/tools/javac/TryWithResources/TwrOnNonResource.out
+++ b/langtools/test/tools/javac/TryWithResources/TwrOnNonResource.out
@@ -1,7 +1,7 @@
-TwrOnNonResource.java:12:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
-TwrOnNonResource.java:15:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
-TwrOnNonResource.java:18:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
-TwrOnNonResource.java:24:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
-TwrOnNonResource.java:27:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
-TwrOnNonResource.java:30:13: compiler.err.prob.found.req: (compiler.misc.twr.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:12:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:15:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:18:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:24:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:27:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
+TwrOnNonResource.java:30:13: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type), TwrOnNonResource, java.lang.AutoCloseable
 6 errors
diff --git a/langtools/test/tools/javac/TryWithResources/TwrSuppression.java b/langtools/test/tools/javac/TryWithResources/TwrSuppression.java
index 2b06b0f..9834d5a 100644
--- a/langtools/test/tools/javac/TryWithResources/TwrSuppression.java
+++ b/langtools/test/tools/javac/TryWithResources/TwrSuppression.java
@@ -36,7 +36,7 @@
                 throw new RuntimeException();
             }
         } catch(RuntimeException e) {
-            Throwable[] suppressedExceptions = e.getSuppressedExceptions();
+            Throwable[] suppressedExceptions = e.getSuppressed();
             int length = suppressedExceptions.length;
             if (length != 2)
                 throw new RuntimeException("Unexpected length " + length);
diff --git a/langtools/test/tools/javac/TryWithResources/TwrTests.java b/langtools/test/tools/javac/TryWithResources/TwrTests.java
index c3ca617..1242279 100644
--- a/langtools/test/tools/javac/TryWithResources/TwrTests.java
+++ b/langtools/test/tools/javac/TryWithResources/TwrTests.java
@@ -90,7 +90,7 @@
                 } catch (Resource.CreateFailException e) {
                     creationFailuresDetected++;
                     checkCreateFailureId(e.resourceId(), createFailureId);
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     throw new AssertionError("Secondary exception suppression failed");
                 }
@@ -112,7 +112,7 @@
                 } catch (Resource.CreateFailException e) {
                     creationFailuresDetected++;
                     checkCreateFailureId(e.resourceId(), createFailureId);
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     throw new AssertionError("Secondary exception suppression failed");
                 }
@@ -134,7 +134,7 @@
                 } catch (Resource.CreateFailException e) {
                     creationFailuresDetected++;
                     checkCreateFailureId(e.resourceId(), createFailureId);
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     throw new AssertionError("Secondary exception suppression failed:" + e);
                 }
@@ -158,7 +158,7 @@
                 } catch (Resource.CreateFailException e) {
                     creationFailuresDetected++;
                     checkCreateFailureId(e.resourceId(), createFailureId);
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     throw new AssertionError("Secondary exception suppression failed:" + e);
                 }
@@ -181,7 +181,7 @@
                 } catch (Resource.CreateFailException e) {
                     creationFailuresDetected++;
                     checkCreateFailureId(e.resourceId(), createFailureId);
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     throw new AssertionError("Secondary exception suppression failed:" + e);
                 }
@@ -207,7 +207,7 @@
                 } catch (Resource.CreateFailException e) {
                     creationFailuresDetected++;
                     checkCreateFailureId(e.resourceId(), createFailureId);
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     throw new AssertionError("Secondary exception suppression failed:" + e);
                 }
@@ -231,7 +231,7 @@
                 } catch (Resource.CreateFailException e) {
                     creationFailuresDetected++;
                     checkCreateFailureId(e.resourceId(), createFailureId);
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     throw new AssertionError("Secondary exception suppression failed:" + e);
                 }
@@ -259,7 +259,7 @@
                 } catch (Resource.CreateFailException e) {
                     creationFailuresDetected++;
                     checkCreateFailureId(e.resourceId(), createFailureId);
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     throw new AssertionError("Secondary exception suppression failed:" + e);
                 }
@@ -310,7 +310,7 @@
      * Check for proper suppressed exceptions in proper order.
      *
      * @param suppressedExceptions the suppressed exceptions array returned by
-     *        getSuppressedExceptions()
+     *        getSuppressed()
      * @bitmap a bitmap indicating which suppressed exceptions are expected.
      *         Bit i is set iff id should throw a CloseFailException.
      */
@@ -376,7 +376,7 @@
                 } catch (MyKindOfException e) {
                     if (failure == 0)
                         throw new AssertionError("Unexpected MyKindOfException");
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     if (failure == 1)
                         throw new AssertionError("Secondary exception suppression failed");
@@ -388,7 +388,7 @@
                         throw new AssertionError("CloseFailException: got id " + id
                                                  + ", expected lg(" + highestCloseFailBit +")");
                     }
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
                 }
                 checkClosedList(closedList, 1);
             }
@@ -409,7 +409,7 @@
                 } catch (MyKindOfException e) {
                     if (failure == 0)
                         throw new AssertionError("Unexpected MyKindOfException");
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     if (failure == 1)
                         throw new AssertionError("Secondary exception suppression failed");
@@ -421,7 +421,7 @@
                         throw new AssertionError("CloseFailException: got id " + id
                                                  + ", expected lg(" + highestCloseFailBit +")");
                     }
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
                 }
                 checkClosedList(closedList, 2);
             }
@@ -443,7 +443,7 @@
                 } catch (MyKindOfException e) {
                     if (failure == 0)
                         throw new AssertionError("Unexpected MyKindOfException");
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     if (failure == 1)
                         throw new AssertionError("Secondary exception suppression failed");
@@ -455,7 +455,7 @@
                         throw new AssertionError("CloseFailException: got id " + id
                                                  + ", expected lg(" + highestCloseFailBit +")");
                     }
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
                 }
                 checkClosedList(closedList, 2);
             }
@@ -477,7 +477,7 @@
                 } catch (MyKindOfException e) {
                     if (failure == 0)
                         throw new AssertionError("Unexpected MyKindOfException");
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     if (failure == 1)
                         throw new AssertionError("Secondary exception suppression failed");
@@ -489,7 +489,7 @@
                         throw new AssertionError("CloseFailException: got id " + id
                                                  + ", expected lg(" + highestCloseFailBit +")");
                     }
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
                 }
                 checkClosedList(closedList, 3);
             }
@@ -513,7 +513,7 @@
                 } catch (MyKindOfException e) {
                     if (failure == 0)
                         throw new AssertionError("Unexpected MyKindOfException");
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     if (failure == 1)
                         throw new AssertionError("Secondary exception suppression failed");
@@ -525,7 +525,7 @@
                         throw new AssertionError("CloseFailException: got id " + id
                                                  + ", expected lg(" + highestCloseFailBit +")");
                     }
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
                 }
                 checkClosedList(closedList, 3);
             }
@@ -548,7 +548,7 @@
                 } catch (MyKindOfException e) {
                     if (failure == 0)
                         throw new AssertionError("Unexpected MyKindOfException");
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     if (failure == 1)
                         throw new AssertionError("Secondary exception suppression failed");
@@ -560,7 +560,7 @@
                         throw new AssertionError("CloseFailException: got id " + id
                                                  + ", expected lg(" + highestCloseFailBit +")");
                     }
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
                 }
                 checkClosedList(closedList, 4);
             }
@@ -586,7 +586,7 @@
                 } catch (MyKindOfException e) {
                     if (failure == 0)
                         throw new AssertionError("Unexpected MyKindOfException");
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     if (failure == 1)
                         throw new AssertionError("Secondary exception suppression failed");
@@ -598,7 +598,7 @@
                         throw new AssertionError("CloseFailException: got id " + id
                                                  + ", expected lg(" + highestCloseFailBit +")");
                     }
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
                 }
                 checkClosedList(closedList, 4);
             }
@@ -621,7 +621,7 @@
                 } catch (MyKindOfException e) {
                     if (failure == 0)
                         throw new AssertionError("Unexpected MyKindOfException");
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     if (failure == 1)
                         throw new AssertionError("Secondary exception suppression failed");
@@ -633,7 +633,7 @@
                         throw new AssertionError("CloseFailException: got id " + id
                                                  + ", expected lg(" + highestCloseFailBit +")");
                     }
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
                 }
                 checkClosedList(closedList, 5);
             }
@@ -660,7 +660,7 @@
                 } catch (MyKindOfException e) {
                     if (failure == 0)
                         throw new AssertionError("Unexpected MyKindOfException");
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap);
                 } catch (Resource.CloseFailException e) {
                     if (failure == 1)
                         throw new AssertionError("Secondary exception suppression failed");
@@ -672,7 +672,7 @@
                         throw new AssertionError("CloseFailException: got id " + id
                                                  + ", expected lg(" + highestCloseFailBit +")");
                     }
-                    checkSuppressedExceptions(e.getSuppressedExceptions(), bitMap & ~highestCloseFailBit);
+                    checkSuppressedExceptions(e.getSuppressed(), bitMap & ~highestCloseFailBit);
                 }
                 checkClosedList(closedList, 5);
             }
diff --git a/langtools/test/tools/javac/api/6598108/T6598108.java b/langtools/test/tools/javac/api/6598108/T6598108.java
new file mode 100644
index 0000000..a7ca259
--- /dev/null
+++ b/langtools/test/tools/javac/api/6598108/T6598108.java
@@ -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
+ * @bug     6598108
+ * @summary com.sun.source.util.Trees.isAccessible incorrect
+ * @author  Jan Lahoda
+ */
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.Scope;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.Trees;
+import java.net.URI;
+import java.util.Arrays;
+import javax.lang.model.element.TypeElement;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class T6598108 {
+    public static void main(String[] args) throws Exception {
+        final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        assert tool != null;
+        final JavacTask ct = (JavacTask)tool.getTask(null, null, null, Arrays.asList("-bootclasspath",  bootPath), null, Arrays.asList(new MyFileObject()));
+
+        CompilationUnitTree cut = ct.parse().iterator().next();
+        TreePath tp = new TreePath(new TreePath(cut), cut.getTypeDecls().get(0));
+        Scope s = Trees.instance(ct).getScope(tp);
+        TypeElement type = ct.getElements().getTypeElement("com.sun.java.util.jar.pack.Package.File");
+
+        if (Trees.instance(ct).isAccessible(s, type)) {
+            //com.sun.java.util.jar.pack.Package.File is a public innerclass inside a non-accessible class, so
+            //"false" would be expected here.
+            throw new IllegalStateException("");
+        }
+    }
+
+    static class MyFileObject extends SimpleJavaFileObject {
+        public MyFileObject() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+        }
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return "public class Test<TTT> { public void test() {TTT ttt;}}";
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/api/T6412669.java b/langtools/test/tools/javac/api/T6412669.java
index 465ee25..ef4eeef 100644
--- a/langtools/test/tools/javac/api/T6412669.java
+++ b/langtools/test/tools/javac/api/T6412669.java
@@ -23,11 +23,12 @@
 
 /*
  * @test
- * @bug 6412669
+ * @bug 6412669 6997958
  * @summary Should be able to get SourcePositions from 269 world
  */
 
 import java.io.*;
+import java.net.*;
 import java.util.*;
 import javax.annotation.*;
 import javax.annotation.processing.*;
@@ -39,28 +40,59 @@
 
 @SupportedAnnotationTypes("*")
 public class T6412669 extends AbstractProcessor {
-    public static void main(String... args) throws IOException {
-        String testSrc = System.getProperty("test.src", ".");
-        String testClasses = System.getProperty("test.classes", ".");
+    public static void main(String... args) throws Exception {
+        File testSrc = new File(System.getProperty("test.src", "."));
+        File testClasses = new File(System.getProperty("test.classes", "."));
+
+        // Determine location of necessary tools classes. Assume all in one place.
+        // Likely candidates are typically tools.jar (when testing JDK build)
+        // or build/classes or dist/javac.jar (when testing langtools, using -Xbootclasspath/p:)
+        File toolsClasses;
+        URL u = T6412669.class.getClassLoader().getResource("com/sun/source/util/JavacTask.class");
+        switch (u.getProtocol()) {
+            case "file":
+                toolsClasses = new File(u.toURI());
+                break;
+            case "jar":
+                String s = u.getFile(); // will be file:path!/entry
+                int sep = s.indexOf("!");
+                toolsClasses = new File(new URI(s.substring(0, sep)));
+                break;
+            default:
+                throw new AssertionError("Cannot locate tools classes");
+        }
+        //System.err.println("toolsClasses: " + toolsClasses);
 
         JavacTool tool = JavacTool.create();
         StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
-        fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(new File(testClasses)));
+        fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses, toolsClasses));
         Iterable<? extends JavaFileObject> files =
             fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6412669.class.getName()+".java")));
-        String[] opts = { "-proc:only", "-processor", T6412669.class.getName(),
-                          "-classpath", new File(testClasses).getPath() };
-        JavacTask task = tool.getTask(null, fm, null, Arrays.asList(opts), null, files);
-        if (!task.call())
-            throw new AssertionError("test failed");
+        String[] opts = { "-proc:only", "-processor", T6412669.class.getName()};
+        StringWriter sw = new StringWriter();
+        JavacTask task = tool.getTask(sw, fm, null, Arrays.asList(opts), null, files);
+        boolean ok = task.call();
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out);
+        if (!ok)
+            throw new AssertionError("compilation of test program failed");
+        // verify we found an annotated element to exercise the SourcePositions API
+        if (!out.contains("processing element"))
+            throw new AssertionError("expected text not found in compilation output");
     }
 
     public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         Trees trees = Trees.instance(processingEnv);
         SourcePositions sp = trees.getSourcePositions();
         Messager m = processingEnv.getMessager();
+        m.printMessage(Diagnostic.Kind.NOTE, "processing annotations");
+        int count = 0;
         for (TypeElement anno: annotations) {
+            count++;
+            m.printMessage(Diagnostic.Kind.NOTE, "  processing annotation " + anno);
             for (Element e: roundEnv.getElementsAnnotatedWith(anno)) {
+                m.printMessage(Diagnostic.Kind.NOTE, "    processing element " + e);
                 TreePath p = trees.getPath(e);
                 long start = sp.getStartPosition(p.getCompilationUnit(), p.getLeaf());
                 long end = sp.getEndPosition(p.getCompilationUnit(), p.getLeaf());
@@ -69,6 +101,8 @@
                 m.printMessage(k, "test [" + start + "," + end + "]", e);
             }
         }
+        if (count == 0)
+            m.printMessage(Diagnostic.Kind.NOTE, "no annotations found");
         return true;
     }
 
diff --git a/langtools/test/tools/javac/cast/6467183/T6467183a.out b/langtools/test/tools/javac/cast/6467183/T6467183a.out
index 972d54d..562a48a 100644
--- a/langtools/test/tools/javac/cast/6467183/T6467183a.out
+++ b/langtools/test/tools/javac/cast/6467183/T6467183a.out
@@ -1,6 +1,4 @@
 T6467183a.java:16:26: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), T6467183a<T>.B, T6467183a<T>.A<T>
-T6467183a.java:24:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), T6467183a<T>.A<java.lang.Integer>, T6467183a<T>.C<? extends java.lang.Number>
-T6467183a.java:28:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), T6467183a<T>.A<java.lang.Integer>, T6467183a<T>.C<? extends java.lang.Integer>
 - compiler.err.warnings.and.werror
 1 error
-3 warnings
+1 warning
diff --git a/langtools/test/tools/javac/cast/6714835/T6714835.java b/langtools/test/tools/javac/cast/6714835/T6714835.java
new file mode 100644
index 0000000..6c31596
--- /dev/null
+++ b/langtools/test/tools/javac/cast/6714835/T6714835.java
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @author mcimadamore
+ * @bug     6714835
+ * @summary Safe cast is rejected (with warning) by javac
+ * @compile/fail/ref=T6714835.out -Xlint:unchecked -Werror -XDrawDiagnostics T6714835.java
+ */
+
+import java.util.*;
+
+class T6714835 {
+    void cast1(Iterable<? extends Integer> x) {
+        Collection<? extends Number> x1 = (Collection<? extends Number>)x; //ok
+        Collection<? super Integer> x2 = (Collection<? super Integer>)x; //warn
+    }
+
+    void cast2(Iterable<? super Number> x) {
+        Collection<? super Integer> x1 = (Collection<? super Integer>)x; //ok
+        Collection<? extends Number> x2 = (Collection<? extends Number>)x; //warn
+    }
+}
diff --git a/langtools/test/tools/javac/cast/6714835/T6714835.out b/langtools/test/tools/javac/cast/6714835/T6714835.out
new file mode 100644
index 0000000..dc4a86b
--- /dev/null
+++ b/langtools/test/tools/javac/cast/6714835/T6714835.out
@@ -0,0 +1,5 @@
+T6714835.java:14:71: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Iterable<compiler.misc.type.captureof: 1, ? extends java.lang.Integer>, java.util.Collection<? super java.lang.Integer>
+T6714835.java:19:73: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Iterable<compiler.misc.type.captureof: 1, ? super java.lang.Number>, java.util.Collection<? extends java.lang.Number>
+- compiler.err.warnings.and.werror
+1 error
+2 warnings
diff --git a/langtools/test/tools/javac/diags/examples/ResourceClosed.java b/langtools/test/tools/javac/diags/examples/ResourceClosed.java
index 6f08187..08b2391 100644
--- a/langtools/test/tools/javac/diags/examples/ResourceClosed.java
+++ b/langtools/test/tools/javac/diags/examples/ResourceClosed.java
@@ -21,8 +21,8 @@
  * questions.
  */
 
-// key: compiler.warn.twr.explicit.close.call
-// options: -Xlint:arm
+// key: compiler.warn.try.explicit.close.call
+// options: -Xlint:try
 
 import java.io.*;
 
diff --git a/langtools/test/tools/javac/diags/examples/ResourceMayNotBeAssigned.java b/langtools/test/tools/javac/diags/examples/ResourceMayNotBeAssigned.java
index e8d5edf..b66245f 100644
--- a/langtools/test/tools/javac/diags/examples/ResourceMayNotBeAssigned.java
+++ b/langtools/test/tools/javac/diags/examples/ResourceMayNotBeAssigned.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-// key: compiler.err.twr.resource.may.not.be.assigned
+// key: compiler.err.try.resource.may.not.be.assigned
 
 import java.io.*;
 
diff --git a/langtools/test/tools/javac/diags/examples/ResourceNotApplicableToType.java b/langtools/test/tools/javac/diags/examples/ResourceNotApplicableToType.java
index 95890cf..f34477e 100644
--- a/langtools/test/tools/javac/diags/examples/ResourceNotApplicableToType.java
+++ b/langtools/test/tools/javac/diags/examples/ResourceNotApplicableToType.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-// key: compiler.misc.twr.not.applicable.to.type
+// key: compiler.misc.try.not.applicable.to.type
 // key: compiler.err.prob.found.req
 
 class ResourceNotApplicableToType {
diff --git a/langtools/test/tools/javac/diags/examples/ResourceNotReferenced.java b/langtools/test/tools/javac/diags/examples/ResourceNotReferenced.java
index e4d9d9f..8f6cfb2 100644
--- a/langtools/test/tools/javac/diags/examples/ResourceNotReferenced.java
+++ b/langtools/test/tools/javac/diags/examples/ResourceNotReferenced.java
@@ -21,8 +21,8 @@
  * questions.
  */
 
-// key: compiler.warn.automatic.resource.not.referenced
-// options: -Xlint:arm
+// key: compiler.warn.try.resource.not.referenced
+// options: -Xlint:try
 
 import java.io.*;
 
diff --git a/langtools/test/tools/javac/diags/examples/TryResourceNotSupported.java b/langtools/test/tools/javac/diags/examples/TryResourceNotSupported.java
index 4f2ca7c..9063dc9 100644
--- a/langtools/test/tools/javac/diags/examples/TryResourceNotSupported.java
+++ b/langtools/test/tools/javac/diags/examples/TryResourceNotSupported.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-// key: compiler.err.automatic.resource.management.not.supported.in.source
+// key: compiler.err.try.with.resources.not.supported.in.source
 // options: -source 1.6
 
 import java.io.*;
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719a.java b/langtools/test/tools/javac/generics/6985719/T6985719a.java
new file mode 100644
index 0000000..aef4ba2
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719a.java
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6985719
+ * @summary Alike methods in interfaces (Inheritance and Overriding)
+ * @author  mcimadamore
+ * @compile/fail/ref=T6985719a.out -XDrawDiagnostics T6985719a.java
+ */
+
+import java.util.List;
+
+class T6985719a {
+    interface A { void f(List<String> ls); }
+    interface B { void f(List<Integer> ls); }
+    interface C extends A,B {}
+}
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719a.out b/langtools/test/tools/javac/generics/6985719/T6985719a.out
new file mode 100644
index 0000000..9948d6c
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719a.out
@@ -0,0 +1,2 @@
+T6985719a.java:14:5: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719a.B, f(java.util.List<java.lang.String>), T6985719a.A
+1 error
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719b.java b/langtools/test/tools/javac/generics/6985719/T6985719b.java
new file mode 100644
index 0000000..7e4e928
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719b.java
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6985719
+ * @summary Alike methods in interfaces (Inheritance and Overriding)
+ * @author  mcimadamore
+ * @compile/fail/ref=T6985719b.out -XDrawDiagnostics T6985719b.java
+ */
+
+import java.util.List;
+
+class T6985719b {
+    abstract class A { abstract void f(List<String> ls); }
+    interface B { void f(List<Integer> ls); }
+    abstract class C extends A implements B {}
+}
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719b.out b/langtools/test/tools/javac/generics/6985719/T6985719b.out
new file mode 100644
index 0000000..ef2ab84
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719b.out
@@ -0,0 +1,2 @@
+T6985719b.java:14:14: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719b.B, f(java.util.List<java.lang.String>), T6985719b.A
+1 error
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719c.java b/langtools/test/tools/javac/generics/6985719/T6985719c.java
new file mode 100644
index 0000000..51e52c0
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719c.java
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6985719
+ * @summary Alike methods in interfaces (Inheritance and Overriding)
+ * @author  mcimadamore
+ * @compile/fail/ref=T6985719c.out -XDrawDiagnostics T6985719c.java
+ */
+
+import java.util.List;
+
+class T6985719c {
+    interface A { void f(List<String> ls); }
+    interface B<X> { void f(List<X> ls); }
+    interface C extends A,B<Integer> {}
+}
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719c.out b/langtools/test/tools/javac/generics/6985719/T6985719c.out
new file mode 100644
index 0000000..23d2ba7
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719c.out
@@ -0,0 +1,2 @@
+T6985719c.java:14:5: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<X>), T6985719c.B, f(java.util.List<java.lang.String>), T6985719c.A
+1 error
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719d.java b/langtools/test/tools/javac/generics/6985719/T6985719d.java
new file mode 100644
index 0000000..df2d940
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719d.java
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6985719
+ * @summary Alike methods in interfaces (Inheritance and Overriding)
+ * @author  mcimadamore
+ * @compile/fail/ref=T6985719d.out -XDrawDiagnostics T6985719d.java
+ */
+
+import java.util.List;
+
+class T6985719d {
+    abstract class A { abstract void f(List<String> ls); }
+    interface B<X> { void f(List<X> ls); }
+    abstract class C extends A implements B<Integer> {}
+}
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719d.out b/langtools/test/tools/javac/generics/6985719/T6985719d.out
new file mode 100644
index 0000000..c46439c
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719d.out
@@ -0,0 +1,2 @@
+T6985719d.java:14:14: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<X>), T6985719d.B, f(java.util.List<java.lang.String>), T6985719d.A
+1 error
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719e.java b/langtools/test/tools/javac/generics/6985719/T6985719e.java
new file mode 100644
index 0000000..1b3e6a5
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719e.java
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6985719
+ * @summary Alike methods in interfaces (Inheritance and Overriding)
+ * @author  mcimadamore
+ * @compile/fail/ref=T6985719e.out -XDrawDiagnostics T6985719e.java
+ */
+
+import java.util.List;
+
+class T6985719e {
+    interface A { void f(List<String> ls); }
+    interface B extends A { void f(List<Integer> ls); }
+}
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719e.out b/langtools/test/tools/javac/generics/6985719/T6985719e.out
new file mode 100644
index 0000000..82fd2cd
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719e.out
@@ -0,0 +1,2 @@
+T6985719e.java:13:34: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719e.B, f(java.util.List<java.lang.String>), T6985719e.A
+1 error
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719f.java b/langtools/test/tools/javac/generics/6985719/T6985719f.java
new file mode 100644
index 0000000..54b5c30
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719f.java
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6985719
+ * @summary Alike methods in interfaces (Inheritance and Overriding)
+ * @author  mcimadamore
+ * @compile/fail/ref=T6985719f.out -XDrawDiagnostics T6985719f.java
+ */
+
+import java.util.List;
+
+class T6985719f {
+    abstract class A { abstract void f(List<String> ls); }
+    abstract class B extends A { void f(List<Integer> ls); }
+}
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719f.out b/langtools/test/tools/javac/generics/6985719/T6985719f.out
new file mode 100644
index 0000000..12a07a2
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719f.out
@@ -0,0 +1,2 @@
+T6985719f.java:13:39: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719f.B, f(java.util.List<java.lang.String>), T6985719f.A
+1 error
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719g.java b/langtools/test/tools/javac/generics/6985719/T6985719g.java
new file mode 100644
index 0000000..df8afa0
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719g.java
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6985719
+ * @summary Alike methods in interfaces (Inheritance and Overriding)
+ * @author  mcimadamore
+ * @compile/fail/ref=T6985719g.out -XDrawDiagnostics T6985719g.java
+ */
+
+import java.util.List;
+
+class T6985719g {
+    interface A<X> { void f(List<X> ls); }
+    interface B extends A<String> { void f(List<Integer> ls); }
+}
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719g.out b/langtools/test/tools/javac/generics/6985719/T6985719g.out
new file mode 100644
index 0000000..1d37a78
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719g.out
@@ -0,0 +1,2 @@
+T6985719g.java:13:42: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719g.B, f(java.util.List<X>), T6985719g.A
+1 error
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719h.java b/langtools/test/tools/javac/generics/6985719/T6985719h.java
new file mode 100644
index 0000000..9bcc143
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719h.java
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     6985719
+ * @summary Alike methods in interfaces (Inheritance and Overriding)
+ * @author  mcimadamore
+ * @compile/fail/ref=T6985719h.out -XDrawDiagnostics T6985719h.java
+ */
+
+import java.util.List;
+
+class T6985719h {
+    abstract class A<X> { abstract void f(List<X> ls); }
+    abstract class B extends A<String> { abstract void f(List<Integer> ls); }
+}
diff --git a/langtools/test/tools/javac/generics/6985719/T6985719h.out b/langtools/test/tools/javac/generics/6985719/T6985719h.out
new file mode 100644
index 0000000..64b3e4a
--- /dev/null
+++ b/langtools/test/tools/javac/generics/6985719/T6985719h.out
@@ -0,0 +1,2 @@
+T6985719h.java:13:56: compiler.err.name.clash.same.erasure.no.override: f(java.util.List<java.lang.Integer>), T6985719h.B, f(java.util.List<X>), T6985719h.A
+1 error
diff --git a/langtools/test/tools/javac/generics/diamond/6996914/T6996914a.java b/langtools/test/tools/javac/generics/diamond/6996914/T6996914a.java
new file mode 100644
index 0000000..b0bc084
--- /dev/null
+++ b/langtools/test/tools/javac/generics/diamond/6996914/T6996914a.java
@@ -0,0 +1,171 @@
+/*
+ * 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
+ * @bug 6996914
+ * @summary  Diamond inference: problem when accessing protected constructor
+ * @run main T6996914a
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class T6996914a {
+
+    enum PackageKind {
+        DEFAULT("", ""),
+        A("package a;", "import a.*;");
+
+        String pkgDecl;
+        String importDecl;
+
+        PackageKind(String pkgDecl, String importDecl) {
+            this.pkgDecl = pkgDecl;
+            this.importDecl = importDecl;
+        }
+    }
+
+    enum DiamondKind {
+        STANDARD("new Foo<>();"),
+        ANON("new Foo<>() {};");
+
+        String expr;
+
+        DiamondKind(String expr) {
+            this.expr = expr;
+        }
+    }
+
+    enum ConstructorKind {
+        PACKAGE(""),
+        PROTECTED("protected"),
+        PRIVATE("private"),
+        PUBLIC("public");
+
+        String mod;
+
+        ConstructorKind(String mod) {
+            this.mod = mod;
+        }
+    }
+
+    static class FooClass extends SimpleJavaFileObject {
+
+        final static String sourceStub =
+                        "#P\n" +
+                        "public class Foo<X> {\n" +
+                        "  #M Foo() {}\n" +
+                        "}\n";
+
+        String source;
+
+        public FooClass(PackageKind pk, ConstructorKind ck) {
+            super(URI.create("myfo:/" + (pk != PackageKind.DEFAULT ? "a/Foo.java" : "Foo.java")),
+                    JavaFileObject.Kind.SOURCE);
+            source = sourceStub.replace("#P", pk.pkgDecl).replace("#M", ck.mod);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    static class ClientClass extends SimpleJavaFileObject {
+
+        final static String sourceStub =
+                        "#I\n" +
+                        "class Test {\n" +
+                        "  Foo<String> fs = #D\n" +
+                        "}\n";
+
+        String source;
+
+        public ClientClass(PackageKind pk, DiamondKind dk) {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = sourceStub.replace("#I", pk.importDecl).replace("#D", dk.expr);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        for (PackageKind pk : PackageKind.values()) {
+            for (ConstructorKind ck : ConstructorKind.values()) {
+                for (DiamondKind dk : DiamondKind.values()) {
+                    compileAndCheck(pk, ck, dk);
+                }
+            }
+        }
+    }
+
+    static void compileAndCheck(PackageKind pk, ConstructorKind ck, DiamondKind dk) throws Exception {
+        FooClass foo = new FooClass(pk, ck);
+        ClientClass client = new ClientClass(pk, dk);
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        ErrorListener el = new ErrorListener();
+        JavacTask ct = (JavacTask)tool.getTask(null, null, el,
+                null, null, Arrays.asList(foo, client));
+        ct.analyze();
+        if (el.errors > 0 == check(pk, ck, dk)) {
+            String msg = el.errors > 0 ?
+                "Error compiling files" :
+                "No error when compiling files";
+            throw new AssertionError(msg + ": \n" + foo.source + "\n" + client.source);
+        }
+    }
+
+    static boolean check(PackageKind pk, ConstructorKind ck, DiamondKind dk) {
+        switch (pk) {
+            case A: return ck == ConstructorKind.PUBLIC ||
+                    (ck  == ConstructorKind.PROTECTED && dk == DiamondKind.ANON);
+            case DEFAULT: return ck != ConstructorKind.PRIVATE;
+            default: throw new AssertionError("Unknown package kind");
+        }
+    }
+
+    /**
+     * DiagnosticListener to count any errors that occur
+     */
+    private static class ErrorListener implements DiagnosticListener<JavaFileObject> {
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            switch (diagnostic.getKind()) {
+                case ERROR:
+                    errors++;
+            }
+        }
+        int errors;
+    }
+}
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/generics/diamond/6996914/T6996914b.java
similarity index 73%
copy from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
copy to langtools/test/tools/javac/generics/diamond/6996914/T6996914b.java
index 219f22a..d82e799 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/generics/diamond/6996914/T6996914b.java
@@ -21,18 +21,19 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
+/*
+ * @test
+ * @bug 6996914
+ * @summary  Diamond inference: problem when accessing protected constructor
+ * @compile T6996914b.java
+ */
 
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
+class Super<X,Y> {
+    private Super(Integer i, Y y, X x) {}
+    public Super(Number n, X x, Y y) {}
+}
 
-    void m() {
-        try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
-        }
-    }
+class Test {
+    Super<String,Integer> ssi1 = new Super<>(1, "", 2);
+    Super<String,Integer> ssi2 = new Super<>(1, "", 2) {};
 }
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/meth/XlintWarn.java
similarity index 65%
copy from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
copy to langtools/test/tools/javac/meth/XlintWarn.java
index 219f22a..294cd34 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/meth/XlintWarn.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -21,18 +21,22 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
+/*
+ * @test
+ * @bug 6999067
+ * @summary cast for invokeExact call gets redundant cast to <type> warnings
+ * @author mcimadamore
+ *
+ * @compile -Werror -Xlint:cast XlintWarn.java
+ */
 
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
+import java.dyn.*;
 
-    void m() {
-        try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
-        }
+class XlintWarn {
+    void test(MethodHandle mh) throws Throwable {
+        int i1 = (int)mh.invoke();
+        int i2 = (int)mh.invokeExact();
+        int i3 = (int)mh.invokeVarargs();
+        int i4 = (int)InvokeDynamic.test();
     }
 }
diff --git a/langtools/test/tools/javac/multicatch/Neg01eff_final.java b/langtools/test/tools/javac/multicatch/Neg01eff_final.java
new file mode 100644
index 0000000..46a23b2
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/Neg01eff_final.java
@@ -0,0 +1,28 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6943289
+ *
+ * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
+ * @author darcy
+ * @compile/fail/ref=Neg01eff_final.out -XDrawDiagnostics Neg01eff_final.java
+ * @compile -source 6 -XDrawDiagnostics Neg01eff_final.java
+ *
+ */
+
+class Neg01eff_final {
+    static class A extends Exception {}
+    static class B1 extends A {}
+    static class B2 extends A {}
+
+    class Test {
+        void m() throws A {
+            try {
+                throw new B1();
+            } catch (A ex1) {
+                try {
+                    throw ex1; // used to throw A, now throws B1!
+                } catch (B2 ex2) { }//unreachable
+            }
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/multicatch/Neg01eff_final.out b/langtools/test/tools/javac/multicatch/Neg01eff_final.out
new file mode 100644
index 0000000..6b6ab61
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/Neg01eff_final.out
@@ -0,0 +1,2 @@
+Neg01eff_final.java:24:19: compiler.err.except.never.thrown.in.try: Neg01eff_final.B2
+1 error
diff --git a/langtools/test/tools/javac/multicatch/Neg02.java b/langtools/test/tools/javac/multicatch/Neg02.java
index 6312447..d4bd407 100644
--- a/langtools/test/tools/javac/multicatch/Neg02.java
+++ b/langtools/test/tools/javac/multicatch/Neg02.java
@@ -20,6 +20,8 @@
             else {
                 throw new B();
             }
-        } catch (A | B ex) {  }
+        } catch (final A | B ex) {
+            ex = new B();
+        }
     }
 }
diff --git a/langtools/test/tools/javac/multicatch/Neg02.out b/langtools/test/tools/javac/multicatch/Neg02.out
index f140457..5033a5f 100644
--- a/langtools/test/tools/javac/multicatch/Neg02.out
+++ b/langtools/test/tools/javac/multicatch/Neg02.out
@@ -1,2 +1,2 @@
-Neg02.java:23:24: compiler.err.multicatch.param.must.be.final: ex
+Neg02.java:24:13: compiler.err.multicatch.parameter.may.not.be.assigned: ex
 1 error
diff --git a/langtools/test/tools/javac/multicatch/Neg02eff_final.java b/langtools/test/tools/javac/multicatch/Neg02eff_final.java
new file mode 100644
index 0000000..6430b54
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/Neg02eff_final.java
@@ -0,0 +1,27 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6943289 6993963
+ *
+ * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
+ * @author mcimadamore
+ * @compile/fail/ref=Neg02eff_final.out -XDrawDiagnostics Neg02eff_final.java
+ *
+ */
+
+class Neg02eff_final {
+    static class A extends Exception {}
+    static class B extends Exception {}
+
+    void m() {
+        try {
+            if (true) {
+                throw new A();
+            }
+            else {
+                throw new B();
+            }
+        } catch (A | B ex) {
+            ex = new B();
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/multicatch/Neg02eff_final.out b/langtools/test/tools/javac/multicatch/Neg02eff_final.out
new file mode 100644
index 0000000..2d735a4
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/Neg02eff_final.out
@@ -0,0 +1,2 @@
+Neg02eff_final.java:24:13: compiler.err.multicatch.parameter.may.not.be.assigned: ex
+1 error
diff --git a/langtools/test/tools/javac/multicatch/Neg03.java b/langtools/test/tools/javac/multicatch/Neg03.java
index c9e0b20..cf13a63 100644
--- a/langtools/test/tools/javac/multicatch/Neg03.java
+++ b/langtools/test/tools/javac/multicatch/Neg03.java
@@ -9,19 +9,22 @@
  */
 
 class Neg03 {
-    static class A extends Exception {}
-    static class B extends Exception {}
 
-    void m() {
+    static class A extends Exception { public void m() {}; public Object f;}
+    static class B1 extends A {}
+    static class B2 extends A {}
+
+    void m() throws B1, B2 {
         try {
             if (true) {
-                throw new A();
+                throw new B1();
             }
             else {
-                throw new B();
+                throw new B2();
             }
-        } catch (final A | B ex) {
-            ex = new B();
+        } catch (Exception ex) {
+            ex = new B2(); //effectively final analysis disabled!
+            throw ex;
         }
     }
 }
diff --git a/langtools/test/tools/javac/multicatch/Neg03.out b/langtools/test/tools/javac/multicatch/Neg03.out
index c854ee9..f3487a5 100644
--- a/langtools/test/tools/javac/multicatch/Neg03.out
+++ b/langtools/test/tools/javac/multicatch/Neg03.out
@@ -1,2 +1,2 @@
-Neg03.java:24:13: compiler.err.multicatch.parameter.may.not.be.assigned: ex
+Neg03.java:27:13: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
 1 error
diff --git a/langtools/test/tools/javac/multicatch/Neg04eff_final.java b/langtools/test/tools/javac/multicatch/Neg04eff_final.java
new file mode 100644
index 0000000..ea2548d
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/Neg04eff_final.java
@@ -0,0 +1,31 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6943289
+ *
+ * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
+ * @author mcimadamore
+ * @compile/fail/ref=Neg04eff_final.out -XDrawDiagnostics Neg04eff_final.java
+ *
+ */
+
+class Neg04eff_final {
+    static class A extends Exception {}
+    static class B extends Exception {}
+
+    void test() throws B {
+        try {
+            if (true) {
+                throw new A();
+            } else if (false) {
+                throw new B();
+            } else {
+                throw (Throwable)new Exception();
+            }
+        }
+        catch (A e) {}
+        catch (Exception e) {
+            throw e;
+        }
+        catch (Throwable t) {}
+    }
+}
diff --git a/langtools/test/tools/javac/multicatch/Neg04eff_final.out b/langtools/test/tools/javac/multicatch/Neg04eff_final.out
new file mode 100644
index 0000000..e5b2e3d
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/Neg04eff_final.out
@@ -0,0 +1,2 @@
+Neg04eff_final.java:27:13: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
+1 error
diff --git a/langtools/test/tools/javac/multicatch/Neg05.java b/langtools/test/tools/javac/multicatch/Neg05.java
new file mode 100644
index 0000000..0dcb7db
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/Neg05.java
@@ -0,0 +1,33 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6943289
+ *
+ * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
+ * @author mcimadamore
+ * @compile/fail/ref=Neg05.out -XDrawDiagnostics Neg05.java
+ *
+ */
+
+class Neg02 {
+
+    static class Foo<X> {
+       Foo(X x) {}
+    }
+
+    static interface Base<X> {}
+    static class A extends Exception implements Base<String> {}
+    static class B extends Exception implements Base<Integer> {}
+
+    void m() {
+        try {
+            if (true) {
+                throw new A();
+            }
+            else {
+                throw new B();
+            }
+        } catch (A | B ex) {
+            Foo<?> f = new Foo<>(ex);
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/multicatch/Neg05.out b/langtools/test/tools/javac/multicatch/Neg05.out
new file mode 100644
index 0000000..fbd0551
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/Neg05.out
@@ -0,0 +1,2 @@
+Neg05.java:30:31: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg02.Foo), (compiler.misc.diamond.invalid.arg: java.lang.Exception&Neg02.Base<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, (compiler.misc.diamond: Neg02.Foo))
+1 error
diff --git a/langtools/test/tools/javac/multicatch/Pos06.java b/langtools/test/tools/javac/multicatch/Pos06.java
new file mode 100644
index 0000000..4819b0a
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/Pos06.java
@@ -0,0 +1,27 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6993963
+ *
+ * @summary Project Coin: Use precise exception analysis for effectively final catch parameters
+ * @author mcimadamore
+ * @compile Pos06.java
+ *
+ */
+
+class Pos06 {
+    static class A extends Exception {}
+    static class B extends Exception {}
+
+    void m() {
+        try {
+            if (true) {
+                throw new A();
+            }
+            else {
+                throw new B();
+            }
+        } catch (A | B ex) {
+            System.out.println(ex);
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/multicatch/Pos07.java
similarity index 65%
copy from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
copy to langtools/test/tools/javac/multicatch/Pos07.java
index 219f22a..3136ad2 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/multicatch/Pos07.java
@@ -21,18 +21,29 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
+/*
+ * @test
+ * @bug 6993963
+ * @summary Project Coin: Use precise exception analysis for effectively final catch parameters
+ * @compile Pos07.java
+ */
 
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
+class Pos07 {
 
-    void m() {
+    static class A extends Exception { public void m() {}; public Object f;}
+    static class B1 extends A {}
+    static class B2 extends A {}
+
+    void m() throws B1, B2 {
         try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
+            if (true) {
+                throw new B1();
+            }
+            else {
+                throw new B2();
+            }
+        } catch (Exception ex) { //effectively final analysis
+            throw ex;
         }
     }
 }
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/multicatch/Pos08.java
similarity index 70%
copy from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
copy to langtools/test/tools/javac/multicatch/Pos08.java
index 219f22a..7491e22 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/multicatch/Pos08.java
@@ -21,18 +21,26 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
+/*
+ * @test
+ * @bug 6993963
+ * @summary Multicatch: crash while compiling simple code with a multicatch parameter
+ * @compile Pos08.java
+ */
 
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
+class Pos08 {
 
-    void m() {
+    interface Foo {}
+    static class X1 extends Exception implements Foo {}
+    static class X2 extends Exception implements Foo {}
+
+    void m(boolean cond) {
         try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
+            if (cond)
+                throw new X1();
+            else
+                throw new X2();
         }
+        catch (final X1 | X2 ex) {}
     }
 }
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/multicatch/Pos08eff_final.java
similarity index 69%
copy from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
copy to langtools/test/tools/javac/multicatch/Pos08eff_final.java
index 219f22a..034aa67 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/multicatch/Pos08eff_final.java
@@ -21,18 +21,26 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
+/*
+ * @test
+ * @bug 6993963
+ * @summary Multicatch: crash while compiling simple code with a multicatch parameter
+ * @compile Pos08eff_final.java
+ */
 
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
+class Pos08eff_final {
 
-    void m() {
+    interface Foo {}
+    static class X1 extends Exception implements Foo {}
+    static class X2 extends Exception implements Foo {}
+
+    void m(boolean cond) {
         try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
+            if (cond)
+                throw new X1();
+            else
+                throw new X2();
         }
+        catch (X1 | X2 ex) {}
     }
 }
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/multicatch/model/Check.java
similarity index 73%
copy from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
copy to langtools/test/tools/javac/multicatch/model/Check.java
index 219f22a..0f633e8 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/multicatch/model/Check.java
@@ -21,18 +21,7 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
-
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
-
-    void m() {
-        try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
-        }
-    }
-}
+/**
+ * Annotation used by ModelChecker to mark the class whose model is to be checked
+ */
+@interface Check {}
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/multicatch/model/Member.java
similarity index 73%
copy from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
copy to langtools/test/tools/javac/multicatch/model/Member.java
index 219f22a..bf19ab1 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/multicatch/model/Member.java
@@ -21,18 +21,11 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
+import javax.lang.model.element.ElementKind;
 
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
-
-    void m() {
-        try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
-        }
-    }
+/**
+ * Annotation used by ModelChecker to mark a member that is to be checked
+ */
+@interface Member {
+   ElementKind value();
 }
diff --git a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java b/langtools/test/tools/javac/multicatch/model/Model01.java
similarity index 71%
copy from langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
copy to langtools/test/tools/javac/multicatch/model/Model01.java
index 219f22a..4a734ef 100644
--- a/langtools/test/tools/javac/diags/examples/MulticatchMustBeFinal.java
+++ b/langtools/test/tools/javac/multicatch/model/Model01.java
@@ -21,18 +21,28 @@
  * questions.
  */
 
-// key: compiler.err.multicatch.param.must.be.final
+import javax.lang.model.element.ElementKind;
 
-class MulticatchMustBeFinal {
-    void e1() throws NullPointerException { }
-    void e2() throws IllegalArgumentException { }
+@Check
+class Test {
 
-    void m() {
+    class A extends Exception {
+        @Member(ElementKind.METHOD)
+        public void m() {};
+        @Member(ElementKind.FIELD)
+        public Object f;
+    }
+
+    class B1 extends A {}
+    class B2 extends A {}
+
+    void test(){
         try {
-            e1();
-            e2();
-        } catch (NullPointerException | IllegalArgumentException e) {
-            e.printStackTrace();
+            if (true)
+                throw new B1();
+            else
+                throw new B2();
         }
+        catch(B1 | B2 ex) { }
     }
 }
diff --git a/langtools/test/tools/javac/multicatch/model/ModelChecker.java b/langtools/test/tools/javac/multicatch/model/ModelChecker.java
new file mode 100644
index 0000000..2d1423c
--- /dev/null
+++ b/langtools/test/tools/javac/multicatch/model/ModelChecker.java
@@ -0,0 +1,95 @@
+/*
+ * 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
+ * @bug 6993963
+ * @summary Project Coin: Use precise exception analysis for effectively final catch parameters
+ * @library ../../lib
+ * @build JavacTestingAbstractProcessor ModelChecker
+ * @compile -processor ModelChecker Model01.java
+ */
+
+import com.sun.source.tree.VariableTree;
+import com.sun.source.util.TreePathScanner;
+import com.sun.source.util.Trees;
+import com.sun.source.util.TreePath;
+
+import java.util.Set;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("Check")
+public class ModelChecker extends JavacTestingAbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (roundEnv.processingOver())
+            return true;
+
+        Trees trees = Trees.instance(processingEnv);
+
+        TypeElement testAnno = elements.getTypeElement("Check");
+        for (Element elem: roundEnv.getElementsAnnotatedWith(testAnno)) {
+            TreePath p = trees.getPath(elem);
+            new MulticatchParamTester(trees).scan(p, null);
+        }
+        return true;
+    }
+
+    class MulticatchParamTester extends TreePathScanner<Void, Void> {
+        Trees trees;
+
+        public MulticatchParamTester(Trees trees) {
+            super();
+            this.trees = trees;
+        }
+
+        @Override
+        public Void visitVariable(VariableTree node, Void p) {
+            Element ex = trees.getElement(getCurrentPath());
+            if (ex.getSimpleName().contentEquals("ex")) {
+                assertTrue(ex.getKind() == ElementKind.EXCEPTION_PARAMETER, "Expected EXCEPTION_PARAMETER - found " + ex.getKind());
+                for (Element e : types.asElement(ex.asType()).getEnclosedElements()) {
+                    Member m = e.getAnnotation(Member.class);
+                    if (m != null) {
+                        assertTrue(e.getKind() == m.value(), "Expected " + m.value() + " - found " + e.getKind());
+                    }
+                }
+                assertTrue(assertionCount == 3, "Expected 3 assertions - found " + assertionCount);
+            }
+            return super.visitVariable(node, p);
+        }
+    }
+
+    private static void assertTrue(boolean cond, String msg) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError(msg);
+    }
+
+    static int assertionCount = 0;
+}