Merge
authorasaha
Tue, 11 Aug 2009 08:22:46 -0700
changeset 3563 7d8bbbd3ef4e
parent 3562 60eb7d466a84 (current diff)
parent 3560 bbfccbd92afe (diff)
child 3564 2db7ecd6bcd6
Merge
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Tue Aug 11 08:22:46 2009 -0700
@@ -193,7 +193,7 @@
 
     public void initType(Type type, String name, String bname) {
         initType(type, name);
-        boxedName[type.tag] = names.fromString("java.lang." + bname);
+            boxedName[type.tag] = names.fromString("java.lang." + bname);
     }
 
     /** The class symbol that owns all predefined symbols.
@@ -467,6 +467,7 @@
         synthesizeMHTypeIfMissing(invokeDynamicType);
         synthesizeBoxTypeIfMissing(doubleType);
         synthesizeBoxTypeIfMissing(floatType);
+        synthesizeBoxTypeIfMissing(voidType);
 
         // Enter a synthetic class that is used to mark Sun
         // proprietary classes in ct.sym.  This class does not have a
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Aug 11 08:22:46 2009 -0700
@@ -1247,14 +1247,18 @@
 
             @Override
             public Boolean visitClassType(ClassType t, Void ignored) {
-                if (!t.isParameterized())
+                if (t.isCompound())
+                    return false;
+                else {
+                    if (!t.isParameterized())
+                        return true;
+
+                    for (Type param : t.allparams()) {
+                        if (!param.isUnbound())
+                            return false;
+                    }
                     return true;
-
-                for (Type param : t.allparams()) {
-                    if (!param.isUnbound())
-                        return false;
                 }
-                return true;
             }
 
             @Override
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Aug 11 08:22:46 2009 -0700
@@ -1239,7 +1239,10 @@
                 }
 
                 if (site.tag == CLASS) {
-                    if (site.getEnclosingType().tag == CLASS) {
+                    Type encl = site.getEnclosingType();
+                    while (encl != null && encl.tag == TYPEVAR)
+                        encl = encl.getUpperBound();
+                    if (encl.tag == CLASS) {
                         // we are calling a nested class
 
                         if (tree.meth.getTag() == JCTree.SELECT) {
@@ -1251,7 +1254,7 @@
                             // to the outer instance type of the class.
                             chk.checkRefType(qualifier.pos(),
                                              attribExpr(qualifier, localEnv,
-                                                        site.getEnclosingType()));
+                                                        encl));
                         } else if (methName == names._super) {
                             // qualifier omitted; check for existence
                             // of an appropriate implicit qualifier.
@@ -1554,13 +1557,18 @@
                     typeargtypes, true, tree.varargsElement != null);
                 assert sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous();
                 tree.constructor = sym;
-                tree.constructorType = checkMethod(clazztype,
-                                            tree.constructor,
-                                            localEnv,
-                                            tree.args,
-                                            argtypes,
-                                            typeargtypes,
-                                            localEnv.info.varArgs);
+                if (tree.constructor.kind > ERRONEOUS) {
+                    tree.constructorType =  syms.errType;
+                }
+                else {
+                    tree.constructorType = checkMethod(clazztype,
+                            tree.constructor,
+                            localEnv,
+                            tree.args,
+                            argtypes,
+                            typeargtypes,
+                            localEnv.info.varArgs);
+                }
             }
 
             if (tree.constructor != null && tree.constructor.kind == MTH)
@@ -2037,7 +2045,7 @@
                 Symbol sym = (site.getUpperBound() != null)
                     ? selectSym(tree, capture(site.getUpperBound()), env, pt, pkind)
                     : null;
-                if (sym == null || isType(sym)) {
+                if (sym == null) {
                     log.error(pos, "type.var.cant.be.deref");
                     return syms.errSymbol;
                 } else {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue Aug 11 08:22:46 2009 -0700
@@ -65,6 +65,7 @@
     private final Types types;
     private final JCDiagnostic.Factory diags;
     private final boolean skipAnnotations;
+    private boolean warnOnSyntheticConflicts;
     private final TreeInfo treeinfo;
 
     // The set of lint options currently in effect. It is initialized
@@ -99,6 +100,7 @@
         allowAnnotations = source.allowAnnotations();
         complexInference = options.get("-complexinference") != null;
         skipAnnotations = options.get("skipAnnotations") != null;
+        warnOnSyntheticConflicts = options.get("warnOnSyntheticConflicts") != null;
 
         boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
         boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
@@ -1041,7 +1043,7 @@
      *  @param thrown     The list of thrown exceptions.
      *  @param handled    The list of handled exceptions.
      */
-    List<Type> unHandled(List<Type> thrown, List<Type> handled) {
+    List<Type> unhandled(List<Type> thrown, List<Type> handled) {
         List<Type> unhandled = List.nil();
         for (List<Type> l = thrown; l.nonEmpty(); l = l.tail)
             if (!isHandled(l.head, handled)) unhandled = unhandled.prepend(l.head);
@@ -1198,29 +1200,36 @@
                 m.owner.isSubClass(other.owner, types)) {
                 // allow limited interoperability with covariant returns
             } else {
-                typeError(TreeInfo.diagnosticPositionFor(m, tree),
-                          diags.fragment("override.incompatible.ret",
-                                         cannotOverride(m, other)),
+                log.error(TreeInfo.diagnosticPositionFor(m, tree),
+                          "override.incompatible.ret",
+                          cannotOverride(m, other),
                           mtres, otres);
                 return;
             }
         } else if (overrideWarner.warned) {
             warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree),
-                          "prob.found.req",
-                          diags.fragment("override.unchecked.ret",
-                                              uncheckedOverrides(m, other)),
-                          mtres, otres);
+                    "override.unchecked.ret",
+                    uncheckedOverrides(m, other),
+                    mtres, otres);
         }
 
         // Error if overriding method throws an exception not reported
         // by overridden method.
         List<Type> otthrown = types.subst(ot.getThrownTypes(), otvars, mtvars);
-        List<Type> unhandled = unHandled(mt.getThrownTypes(), otthrown);
-        if (unhandled.nonEmpty()) {
+        List<Type> unhandledErased = unhandled(mt.getThrownTypes(), types.erasure(otthrown));
+        List<Type> unhandledUnerased = unhandled(mt.getThrownTypes(), otthrown);
+        if (unhandledErased.nonEmpty()) {
             log.error(TreeInfo.diagnosticPositionFor(m, tree),
                       "override.meth.doesnt.throw",
                       cannotOverride(m, other),
-                      unhandled.head);
+                      unhandledUnerased.head);
+            return;
+        }
+        else if (unhandledUnerased.nonEmpty()) {
+            warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree),
+                          "override.unchecked.thrown",
+                         cannotOverride(m, other),
+                         unhandledUnerased.head);
             return;
         }
 
@@ -1709,6 +1718,35 @@
         checkCompatibleConcretes(pos, c);
     }
 
+    void checkConflicts(DiagnosticPosition pos, Symbol sym, TypeSymbol c) {
+        for (Type ct = c.type; ct != Type.noType ; ct = types.supertype(ct)) {
+            for (Scope.Entry e = ct.tsym.members().lookup(sym.name); e.scope == ct.tsym.members(); e = e.next()) {
+                // VM allows methods and variables with differing types
+                if (sym.kind == e.sym.kind &&
+                    types.isSameType(types.erasure(sym.type), types.erasure(e.sym.type)) &&
+                    sym != e.sym &&
+                    (sym.flags() & Flags.SYNTHETIC) != (e.sym.flags() & Flags.SYNTHETIC) &&
+                    (sym.flags() & BRIDGE) == 0 && (e.sym.flags() & BRIDGE) == 0) {
+                    syntheticError(pos, (e.sym.flags() & SYNTHETIC) == 0 ? e.sym : sym);
+                    return;
+                }
+            }
+        }
+    }
+
+    /** Report a conflict between a user symbol and a synthetic symbol.
+     */
+    private void syntheticError(DiagnosticPosition pos, Symbol sym) {
+        if (!sym.type.isErroneous()) {
+            if (warnOnSyntheticConflicts) {
+                log.warning(pos, "synthetic.name.conflict", sym, sym.location());
+            }
+            else {
+                log.error(pos, "synthetic.name.conflict", sym, sym.location());
+            }
+        }
+    }
+
     /** Check that class c does not implement directly or indirectly
      *  the same parameterized interface with two different argument lists.
      *  @param pos          Position to be used for error reporting.
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Tue Aug 11 08:22:46 2009 -0700
@@ -596,34 +596,56 @@
  * Symbol manipulation utilities
  *************************************************************************/
 
-    /** Report a conflict between a user symbol and a synthetic symbol.
-     */
-    private void duplicateError(DiagnosticPosition pos, Symbol sym) {
-        if (!sym.type.isErroneous()) {
-            log.error(pos, "synthetic.name.conflict", sym, sym.location());
-        }
-    }
-
     /** Enter a synthetic symbol in a given scope, but complain if there was already one there.
      *  @param pos           Position for error reporting.
      *  @param sym           The symbol.
      *  @param s             The scope.
      */
     private void enterSynthetic(DiagnosticPosition pos, Symbol sym, Scope s) {
-        if (sym.name != names.error && sym.name != names.empty) {
-            for (Scope.Entry e = s.lookup(sym.name); e.scope == s; e = e.next()) {
-                if (sym != e.sym && sym.kind == e.sym.kind) {
-                    // VM allows methods and variables with differing types
-                    if ((sym.kind & (MTH|VAR)) != 0 &&
-                        !types.erasure(sym.type).equals(types.erasure(e.sym.type)))
-                        continue;
-                    duplicateError(pos, e.sym);
-                    break;
-                }
+        s.enter(sym);
+    }
+
+    /** Check whether synthetic symbols generated during lowering conflict
+     *  with user-defined symbols.
+     *
+     *  @param translatedTrees lowered class trees
+     */
+    void checkConflicts(List<JCTree> translatedTrees) {
+        for (JCTree t : translatedTrees) {
+            t.accept(conflictsChecker);
+        }
+    }
+
+    JCTree.Visitor conflictsChecker = new TreeScanner() {
+
+        TypeSymbol currentClass;
+
+        @Override
+        public void visitMethodDef(JCMethodDecl that) {
+            chk.checkConflicts(that.pos(), that.sym, currentClass);
+            super.visitMethodDef(that);
+        }
+
+        @Override
+        public void visitVarDef(JCVariableDecl that) {
+            if (that.sym.owner.kind == TYP) {
+                chk.checkConflicts(that.pos(), that.sym, currentClass);
+            }
+            super.visitVarDef(that);
+        }
+
+        @Override
+        public void visitClassDef(JCClassDecl that) {
+            TypeSymbol prevCurrentClass = currentClass;
+            currentClass = that.sym;
+            try {
+                super.visitClassDef(that);
+            }
+            finally {
+                currentClass = prevCurrentClass;
             }
         }
-        s.enter(sym);
-    }
+    };
 
     /** Look up a synthetic name in a given scope.
      *  @param scope        The scope.
@@ -3192,6 +3214,7 @@
                 makeAccessible(l.head);
             for (EnumMapping map : enumSwitchMap.values())
                 map.translate();
+            checkConflicts(this.translated.toList());
             translated = this.translated;
         } finally {
             // note that recursive invocations of this method fail hard
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Tue Aug 11 08:22:46 2009 -0700
@@ -631,7 +631,7 @@
     }
 
     public void visitAssignop(JCAssignOp tree) {
-        tree.lhs = translate(tree.lhs, tree.operator.type.getParameterTypes().head);
+        tree.lhs = translate(tree.lhs, null);
         tree.rhs = translate(tree.rhs, tree.operator.type.getParameterTypes().tail.head);
         tree.type = erasure(tree.type);
         result = tree;
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Tue Aug 11 08:22:46 2009 -0700
@@ -1207,6 +1207,9 @@
         return stopIfError(CompileState.FLOW, results);
     }
 
+    HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>> desugaredEnvs =
+            new HashMap<Env<AttrContext>, Queue<Pair<Env<AttrContext>, JCClassDecl>>>();
+
     /**
      * Prepare attributed parse trees, in conjunction with their attribution contexts,
      * for source or code generation. If the file was not listed on the command line,
@@ -1222,10 +1225,17 @@
             return;
         }
 
+        if (compileStates.isDone(env, CompileState.LOWER)) {
+            results.addAll(desugaredEnvs.get(env));
+            return;
+        }
+
         /**
-         * As erasure (TransTypes) destroys information needed in flow analysis,
-         * including information in supertypes, we need to ensure that supertypes
-         * are processed through attribute and flow before subtypes are translated.
+         * Ensure that superclasses of C are desugared before C itself. This is
+         * required for two reasons: (i) as erasure (TransTypes) destroys
+         * information needed in flow analysis and (ii) as some checks carried
+         * out during lowering require that all synthetic fields/methods have
+         * already been added to C and its superclasses.
          */
         class ScanNested extends TreeScanner {
             Set<Env<AttrContext>> dependencies = new LinkedHashSet<Env<AttrContext>>();
@@ -1246,8 +1256,8 @@
         ScanNested scanner = new ScanNested();
         scanner.scan(env.tree);
         for (Env<AttrContext> dep: scanner.dependencies) {
-            if (!compileStates.isDone(dep, CompileState.FLOW))
-                flow(attribute(dep));
+        if (!compileStates.isDone(dep, CompileState.FLOW))
+            desugaredEnvs.put(dep, desugar(flow(attribute(dep))));
         }
 
         //We need to check for error another time as more classes might
@@ -1298,6 +1308,7 @@
                 return;
 
             env.tree = transTypes.translateTopLevelClass(env.tree, localMake);
+            compileStates.put(env, CompileState.TRANSTYPES);
 
             if (shouldStop(CompileState.LOWER))
                 return;
@@ -1315,6 +1326,7 @@
 
             //translate out inner classes
             List<JCTree> cdefs = lower.translateTopLevelClass(env, env.tree, localMake);
+            compileStates.put(env, CompileState.LOWER);
 
             if (shouldStop(CompileState.LOWER))
                 return;
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Aug 11 08:22:46 2009 -0700
@@ -431,6 +431,8 @@
     static import only from classes and interfaces
 compiler.err.synthetic.name.conflict=\
     the symbol {0} conflicts with a compiler-synthesized symbol in {1}
+compiler.warn.synthetic.name.conflict=\
+    the symbol {0} conflicts with a compiler-synthesized symbol in {1}
 
 compiler.err.throws.not.allowed.in.intf.annotation=\
     throws clause not allowed in @interface members
@@ -761,7 +763,7 @@
     found: {3}
 
 compiler.warn.unchecked.generic.array.creation=\
-    [unchecked] unchecked generic array creation of type {0} for varargs parameter
+    [unchecked] unchecked generic array creation for varargs parameter of type {0}
 
 compiler.warn.missing.deprecated.annotation=\
     [dep-ann] deprecated item is not annotated with @Deprecated
@@ -1091,23 +1093,33 @@
     no arguments
 
 compiler.err.override.static=\
-    {0}; overriding method is static
+    {0}\n\
+    overriding method is static
 compiler.err.override.meth=\
-    {0}; overridden method is {1}
+    {0}\n\
+    overridden method is {1}
 
 compiler.err.override.meth.doesnt.throw=\
-    {0}; overridden method does not throw {1}
+    {0}\n\
+    overridden method does not throw {1}
 
 # In the following string {1} is a space separated list of Java Keywords, as
 # they would have been declared in the source code
 compiler.err.override.weaker.access=\
-    {0}; attempting to assign weaker access privileges; was {1}
+    {0}\n\
+    attempting to assign weaker access privileges; was {1}
+
+compiler.err.override.incompatible.ret=\
+    {0}\n\
+    return type {1} is not compatible with {2}
 
-compiler.misc.override.incompatible.ret=\
-    {0}; attempting to use incompatible return type
+compiler.warn.override.unchecked.ret=\
+    [unchecked] {0}\n\
+    return type requires unchecked conversion from {1} to {2}
 
-compiler.misc.override.unchecked.ret=\
-    {0}; return type requires unchecked conversion
+compiler.warn.override.unchecked.thrown=\
+    [unchecked] {0}\n\
+    overridden method does not throw {1}
 
 ## The following are all possible strings for the first argument ({0}) of the
 ## above strings.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6390045/T6390045a.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6390045
+ * @summary Unexpected error "cannot access java.lang.Void" with '-target cldc1.0' with -source >=1.5
+ *
+ * @author mcimadamore
+ * @compile -XDfailcomplete=java.lang.Void T6390045a.java
+ */
+
+class T6390045a {
+    boolean b;
+    short s;
+    Object o;
+    Object p = b ? o : s;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6390045/T6390045b.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6390045
+ * @summary Unexpected error "cannot access java.lang.Void" with '-target cldc1.0' with -source >=1.5
+ *
+ * @author mcimadamore
+ * @compile -XDfailcomplete=java.lang.Void T6390045b.java
+ */
+
+class T6390045b {
+    short s;
+    Object o;
+    Object p = choose(o, s);
+    <T> T choose(T t1, T t2) { return t1; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/T6521805a.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6521805
+ * @summary Regression: JDK5/JDK6 javac allows write access to outer class reference
+ * @author mcimadamore
+ *
+ * @compile/fail/ref=T6521805a_1.out T6521805a.java -XDrawDiagnostics
+ * @compile/ref=T6521805a_2.out T6521805a.java -XDwarnOnSyntheticConflicts -XDrawDiagnostics
+ */
+
+class T6521805a {
+
+    static class Outer {
+        T6521805a this$0 = null;
+    }
+
+    public class Inner extends Outer {
+        public void foo() {
+            this$0 = new T6521805a();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/T6521805a_1.out	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,2 @@
+T6521805a.java:40:12: compiler.err.synthetic.name.conflict: this$0, T6521805a.Outer
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/T6521805a_2.out	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,2 @@
+T6521805a.java:40:12: compiler.warn.synthetic.name.conflict: this$0, T6521805a.Outer
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/T6521805b.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6521805
+ * @summary Regression: JDK5/JDK6 javac allows write access to outer class reference
+ * @author mcimadamore
+ *
+ * @compile T6521805b.java
+ */
+
+class T6521805b {
+
+    static class Outer {
+        String this$0 = null;
+    }
+
+    public class Inner extends Outer {
+        public void foo() {
+            this$0 = "Hello!";
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/T6521805c.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6521805
+ * @summary Regression: JDK5/JDK6 javac allows write access to outer class reference
+ * @author mcimadamore
+ *
+ * @compile T6521805c.java
+ */
+
+class T6521805c {
+
+    static class Outer {
+         T6521805c this$0() { return null;}
+    }
+
+    public class Inner extends Outer {
+        public void foo() {
+            this$0();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/T6521805d.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6521805
+ * @summary Regression: JDK5/JDK6 javac allows write access to outer class reference
+ * @author mcimadamore
+ *
+ * @compile/fail/ref=T6521805d.out T6521805d.java -XDrawDiagnostics
+ */
+
+class T6521805 {
+
+    static class Inner extends T6521805.Outer {
+
+        Inner(T6521805 t) {
+            t.super();
+        }
+
+        T6521805 this$0 = null;
+
+        public void foo() {
+            this$0 = new T6521805();
+        }
+    }
+
+    class Outer {}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/T6521805d.out	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,2 @@
+T6521805d.java:41:18: compiler.err.synthetic.name.conflict: this$0, T6521805.Inner
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/T6521805e.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6521805
+ * @summary Regression: JDK5/JDK6 javac allows write access to outer class reference
+ * @author mcimadamore
+ *
+ * @compile/fail/ref=T6521805e.out p/Outer.java p/Sub.java -XDrawDiagnostics
+ * @compile/fail/ref=T6521805e.out p/Sub.java p/Outer.java -XDrawDiagnostics
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/T6521805e.out	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,2 @@
+Sub.java:8:11: compiler.err.synthetic.name.conflict: this$0, p.Inner
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/p/Outer.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,5 @@
+package p;
+
+class Outer {
+    class Super {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6521805/p/Sub.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,13 @@
+package p;
+
+class Inner extends Outer.Super {
+    Inner(Outer t) {
+        t.super();
+    }
+
+    Outer this$0 = null;
+
+    public void foo() {
+        this$0 = new Outer();
+    }
+}
--- a/langtools/test/tools/javac/6734819/T6734819a.out	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/test/tools/javac/6734819/T6734819a.out	Tue Aug 11 08:22:46 2009 -0700
@@ -4,9 +4,9 @@
 [flow W]
 [attribute Z]
 [flow Z]
+[desugar Z]
+[desugar W]
 [desugar Y]
 [generate code Y]
-[desugar W]
 [generate code W]
-[desugar Z]
 [generate code Z]
--- a/langtools/test/tools/javac/6734819/T6734819b.out	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/test/tools/javac/6734819/T6734819b.out	Tue Aug 11 08:22:46 2009 -0700
@@ -2,8 +2,8 @@
 [flow A]
 [attribute B]
 [flow B]
+[desugar B]
 [desugar A]
 [generate code A]
-[desugar B]
 [generate code B.C]
 [generate code B]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6840059/T6840059.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6840059
+ * @summary 6758789: Some method resolution diagnostic should be improved
+ * @author Maurizio Cimadamore
+ *
+ * @compile/fail/ref=T6840059.out -XDrawDiagnostics T6840059.java
+ */
+
+class T6840059 {
+
+    T6840059(Integer x) {}
+
+    void test() {
+        new T6840059(""){};
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6840059/T6840059.out	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,3 @@
+T6840059.java:38:9: compiler.err.cant.resolve.location.args: kindname.constructor, T6840059, , java.lang.String, kindname.class, T6840059
+T6840059.java:38:25: compiler.err.cant.resolve.location.args: kindname.constructor, T6840059, , , kindname.class, T6840059
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/OverrideChecks/6199153/T6199153.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 6199153
+ * @summary Generic throws and overriding
+ * @author  mcimadamore
+ * @compile/fail/ref=T6199153.out -Xlint -Werror -XDrawDiagnostics T6199153.java
+ */
+
+import java.io.IOException;
+
+class T6199153 {
+
+    static class A {
+        public <T extends IOException> void m() throws T {}
+    }
+
+    static class B extends A {
+        public void m() throws IOException {}
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/OverrideChecks/6199153/T6199153.out	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,4 @@
+T6199153.java:41:21: compiler.warn.override.unchecked.thrown: (compiler.misc.cant.override: m(), T6199153.B, <T>m(), T6199153.A), java.io.IOException
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/T6869075.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug     6869075
+ * @summary regression: javac crashes when compiling compound string assignment with generics
+ * @author mcimadamore
+ */
+
+public class T6869075 {
+
+    static class Foo<X> {
+        X x;
+        Foo (X x) {
+            this.x = x;
+        }
+    }
+
+    static void test1(Foo<String> foo) {
+        String start = foo.x;
+        equals(foo.x += "foo", start + "foo");
+    }
+
+    static void test2(Foo<String> foo) {
+        String start = foo.x;
+        equals((foo.x += "foo"), (start + "foo"));
+    }
+
+    static void test3(Foo<String> foo) {
+        String start = foo.x;
+        equals(((foo.x += "foo")), ((start + "foo")));
+    }
+
+    public static void main(String[] args) {
+        test1(new Foo<String>("Hello!"));
+        test2(new Foo<String>("Hello!"));
+        test3(new Foo<String>("Hello!"));
+    }
+
+    static void equals(String found, String req) {
+        if (!found.equals(req)) {
+            throw new AssertionError("Error (expected: "+ req +
+                                     " - found: " + found + ")");
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6569404/T6569404a.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug     6569404
+ * @summary Regression: Cannot instantiate an inner class of a type variable
+ * @author  mcimadamore
+ */
+
+public class T6569404a {
+
+    static class Outer {
+      public class Inner {}
+    }
+
+    static class Test<T extends Outer> {
+       public Test(T t) {
+          Outer.Inner inner = t.new Inner();
+       }
+    }
+
+    public static void main(String[] args) {
+       new Test<Outer>(new Outer());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6569404/T6569404b.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug     6569404
+ * @summary Regression: Cannot instantiate an inner class of a type variable
+ * @author  mcimadamore
+ * @compile/fail/ref=T6569404b.out T6569404b.java -XDrawDiagnostics
+ */
+
+class T6569404b {
+
+    static class A<X> {}
+
+    static class B<T extends Outer> extends A<T.Inner> {}
+
+    static class Outer {
+        public class Inner {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6569404/T6569404b.out	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,2 @@
+T6569404b.java:36:48: compiler.err.type.var.cant.be.deref
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/typevars/6569404/T6569404c.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug     6569404
+ * @summary Regression: Cannot instantiate an inner class of a type variable
+ * @author  mcimadamore
+ */
+
+public class T6569404c {
+    static class Outer {
+      class Inner {}
+    }
+
+    static class Test<X extends Outer>  {
+       class InnerTest extends X.Inner { InnerTest(Outer o) {o.super();} }
+    }
+
+    public static void main(String[] args) {
+       new Test<Outer>().new InnerTest(new Outer());
+    }
+}
--- a/langtools/test/tools/javac/policy/test2/byfile.AB.out	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/test/tools/javac/policy/test2/byfile.AB.out	Tue Aug 11 08:22:46 2009 -0700
@@ -2,6 +2,7 @@
 [flow A]
 [attribute B]
 [flow B]
+[desugar B]
 [desugar A]
 [generate code A.A1]
 [generate code A.A2]
@@ -10,6 +11,5 @@
 [generate code <anonymous A$A4$1>]
 [generate code A.A4]
 [generate code A]
-[desugar B]
 [generate code B.Inner]
 [generate code B]
--- a/langtools/test/tools/javac/policy/test2/bytodo.AB.out	Mon Aug 10 09:36:40 2009 -0700
+++ b/langtools/test/tools/javac/policy/test2/bytodo.AB.out	Tue Aug 11 08:22:46 2009 -0700
@@ -2,6 +2,7 @@
 [flow A]
 [attribute B]
 [flow B]
+[desugar B]
 [desugar A]
 [generate code A.A1]
 [generate code A.A2]
@@ -10,6 +11,5 @@
 [generate code <anonymous A$A4$1>]
 [generate code A.A4]
 [generate code A]
-[desugar B]
 [generate code B.Inner]
 [generate code B]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/6806876/T6806876.java	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug     6806876
+ * @author mcimadamore
+ * @summary  ClassCastException occurs in assignment expressions without any heap pollutions
+ * @compile/fail/ref=T6806876.out -Xlint:unchecked -Werror -XDrawDiagnostics T6806876.java
+ */
+
+class T6806876 {
+    void test(Integer i, Long l) {
+        Comparable<?>[] res = m(i, l);
+    }
+
+    <T> T[] m(T...a) {
+        return null;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/6806876/T6806876.out	Tue Aug 11 08:22:46 2009 -0700
@@ -0,0 +1,4 @@
+T6806876.java:34:32: compiler.warn.unchecked.generic.array.creation: java.lang.Number&java.lang.Comparable<? extends java.lang.Number&java.lang.Comparable<?>>[]
+- compiler.err.warnings.and.werror
+1 error
+1 warning