changeset 1197:96dae0a103f3

Merge
author asaha
date Wed, 25 Jan 2012 10:59:09 -0800
parents cbd359dd5439 (diff) b523f10b25ba (current diff)
children 2c7353f5f6ae
files .hgtags
diffstat 44 files changed, 1211 insertions(+), 234 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Jan 23 09:48:04 2012 -0800
+++ b/.hgtags	Wed Jan 25 10:59:09 2012 -0800
@@ -144,3 +144,9 @@
 fc0769df8cd03fffc38c7a1ab6b2e2e7cc2506a8 jdk7u3-b02
 0ffc4995457773085f61c39f6d33edc242b41bcf jdk7u3-b03
 f6de36b195cd315646213c7affd2cc15702edbfb jdk7u3-b04
+358c42289352a2288084039e7c9d3f134c9c29e9 jdk7u4-b04
+8556ecc20a5b32ae7f336ecf3c420d7feb88d323 jdk7u4-b02
+62ee502a464924d68d398899570c1ad27fbe6cc4 jdk7u4-b05
+083eac71addfccb75f2794b8b5ab5a74c10e005d jdk7u4-b06
+10a63f9cdcb9bbbcc1a5780c19a23087e216db40 jdk7u4-b07
+4be7205dae8923fc7906925a2ba30df55de6770c jdk7u4-b08
--- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Wed Jan 25 10:59:09 2012 -0800
@@ -216,6 +216,7 @@
 doclet.Same_package_name_used=Package name format used twice: {0}
 doclet.Serialization.Excluded_Class=Non-transient field {1} uses excluded class {0}.
 doclet.Serialization.Nonexcluded_Class=Non-transient field {1} uses hidden, non-included class {0}.
+doclet.exception_encountered=Exception encountered while processing {1}\n{0}
 doclet.usage=Provided by Standard doclet:\n\
   -d <directory>                    Destination directory for output files\n\
   -use                              Create class and package usage pages\n\
--- a/src/share/classes/com/sun/tools/javac/code/Kinds.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/Kinds.java	Wed Jan 25 10:59:09 2012 -0800
@@ -103,6 +103,8 @@
         VAL("kindname.value"),
         METHOD("kindname.method"),
         CLASS("kindname.class"),
+        STATIC_INIT("kindname.static.init"),
+        INSTANCE_INIT("kindname.instance.init"),
         PACKAGE("kindname.package");
 
         private String name;
@@ -170,9 +172,11 @@
             return KindName.CONSTRUCTOR;
 
         case METHOD:
+            return KindName.METHOD;
         case STATIC_INIT:
+            return KindName.STATIC_INIT;
         case INSTANCE_INIT:
-            return KindName.METHOD;
+            return KindName.INSTANCE_INIT;
 
         default:
             if (sym.kind == VAL)
--- a/src/share/classes/com/sun/tools/javac/code/Printer.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/Printer.java	Wed Jan 25 10:59:09 2012 -0800
@@ -311,7 +311,7 @@
 
     @Override
     public String visitMethodSymbol(MethodSymbol s, Locale locale) {
-        if ((s.flags() & BLOCK) != 0) {
+        if (s.isStaticOrInstanceInit()) {
             return s.owner.name.toString();
         } else {
             String ms = (s.name == s.name.table.names.init)
--- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Jan 25 10:59:09 2012 -0800
@@ -149,7 +149,8 @@
      * the default package; otherwise, the owner symbol is returned
      */
     public Symbol location() {
-        if (owner.name == null || (owner.name.isEmpty() && owner.kind != PCK && owner.kind != TYP)) {
+        if (owner.name == null || (owner.name.isEmpty() &&
+                (owner.flags() & BLOCK) == 0 && owner.kind != PCK && owner.kind != TYP)) {
             return null;
         }
         return owner;
@@ -725,6 +726,11 @@
          */
         public JavaFileObject classfile;
 
+        /** the list of translated local classes (used for generating
+         * InnerClasses attribute)
+         */
+        public List<ClassSymbol> trans_local;
+
         /** the constant pool of the class
          */
         public Pool pool;
@@ -1299,10 +1305,17 @@
                 return ElementKind.CONSTRUCTOR;
             else if (name == name.table.names.clinit)
                 return ElementKind.STATIC_INIT;
+            else if ((flags() & BLOCK) != 0)
+                return isStatic() ? ElementKind.STATIC_INIT : ElementKind.INSTANCE_INIT;
             else
                 return ElementKind.METHOD;
         }
 
+        public boolean isStaticOrInstanceInit() {
+            return getKind() == ElementKind.STATIC_INIT ||
+                    getKind() == ElementKind.INSTANCE_INIT;
+        }
+
         public Attribute getDefaultValue() {
             return defaultValue;
         }
--- a/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jan 25 10:59:09 2012 -0800
@@ -269,14 +269,15 @@
 
     // <editor-fold defaultstate="collapsed" desc="isConvertible">
     /**
-     * Is t a subtype of or convertiable via boxing/unboxing
-     * convertions to s?
+     * Is t a subtype of or convertible via boxing/unboxing
+     * conversion to s?
      */
     public boolean isConvertible(Type t, Type s, Warner warn) {
+        if (t.tag == ERROR)
+            return true;
         boolean tPrimitive = t.isPrimitive();
         boolean sPrimitive = s.isPrimitive();
         if (tPrimitive == sPrimitive) {
-            checkUnsafeVarargsConversion(t, s, warn);
             return isSubtypeUnchecked(t, s, warn);
         }
         if (!allowBoxing) return false;
@@ -284,27 +285,6 @@
             ? isSubtype(boxedClass(t).type, s)
             : isSubtype(unboxedType(t), s);
     }
-    //where
-    private void checkUnsafeVarargsConversion(Type t, Type s, Warner warn) {
-        if (t.tag != ARRAY || isReifiable(t)) return;
-        ArrayType from = (ArrayType)t;
-        boolean shouldWarn = false;
-        switch (s.tag) {
-            case ARRAY:
-                ArrayType to = (ArrayType)s;
-                shouldWarn = from.isVarargs() &&
-                        !to.isVarargs() &&
-                        !isReifiable(from);
-                break;
-            case CLASS:
-                shouldWarn = from.isVarargs() &&
-                        isSubtype(from, s);
-                break;
-        }
-        if (shouldWarn) {
-            warn.warn(LintCategory.VARARGS);
-        }
-    }
 
     /**
      * Is t a subtype of or convertiable via boxing/unboxing
@@ -326,42 +306,63 @@
      * Is t an unchecked subtype of s?
      */
     public boolean isSubtypeUnchecked(Type t, Type s, Warner warn) {
-        if (t.tag == ARRAY && s.tag == ARRAY) {
-            if (((ArrayType)t).elemtype.tag <= lastBaseTag) {
-                return isSameType(elemtype(t), elemtype(s));
-            } else {
-                ArrayType from = (ArrayType)t;
-                ArrayType to = (ArrayType)s;
-                if (from.isVarargs() &&
-                        !to.isVarargs() &&
-                        !isReifiable(from)) {
-                    warn.warn(LintCategory.VARARGS);
-                }
-                return isSubtypeUnchecked(elemtype(t), elemtype(s), warn);
-            }
-        } else if (isSubtype(t, s)) {
-            return true;
+        boolean result = isSubtypeUncheckedInternal(t, s, warn);
+        if (result) {
+            checkUnsafeVarargsConversion(t, s, warn);
         }
-        else if (t.tag == TYPEVAR) {
-            return isSubtypeUnchecked(t.getUpperBound(), s, warn);
-        }
-        else if (s.tag == UNDETVAR) {
-            UndetVar uv = (UndetVar)s;
-            if (uv.inst != null)
-                return isSubtypeUnchecked(t, uv.inst, warn);
-        }
-        else if (!s.isRaw()) {
-            Type t2 = asSuper(t, s.tsym);
-            if (t2 != null && t2.isRaw()) {
-                if (isReifiable(s))
-                    warn.silentWarn(LintCategory.UNCHECKED);
-                else
-                    warn.warn(LintCategory.UNCHECKED);
+        return result;
+    }
+    //where
+        private boolean isSubtypeUncheckedInternal(Type t, Type s, Warner warn) {
+            if (t.tag == ARRAY && s.tag == ARRAY) {
+                if (((ArrayType)t).elemtype.tag <= lastBaseTag) {
+                    return isSameType(elemtype(t), elemtype(s));
+                } else {
+                    return isSubtypeUnchecked(elemtype(t), elemtype(s), warn);
+                }
+            } else if (isSubtype(t, s)) {
                 return true;
             }
+            else if (t.tag == TYPEVAR) {
+                return isSubtypeUnchecked(t.getUpperBound(), s, warn);
+            }
+            else if (s.tag == UNDETVAR) {
+                UndetVar uv = (UndetVar)s;
+                if (uv.inst != null)
+                    return isSubtypeUnchecked(t, uv.inst, warn);
+            }
+            else if (!s.isRaw()) {
+                Type t2 = asSuper(t, s.tsym);
+                if (t2 != null && t2.isRaw()) {
+                    if (isReifiable(s))
+                        warn.silentWarn(LintCategory.UNCHECKED);
+                    else
+                        warn.warn(LintCategory.UNCHECKED);
+                    return true;
+                }
+            }
+            return false;
         }
-        return false;
-    }
+
+        private void checkUnsafeVarargsConversion(Type t, Type s, Warner warn) {
+            if (t.tag != ARRAY || isReifiable(t)) return;
+            ArrayType from = (ArrayType)t;
+            boolean shouldWarn = false;
+            switch (s.tag) {
+                case ARRAY:
+                    ArrayType to = (ArrayType)s;
+                    shouldWarn = from.isVarargs() &&
+                            !to.isVarargs() &&
+                            !isReifiable(from);
+                    break;
+                case CLASS:
+                    shouldWarn = from.isVarargs();
+                    break;
+            }
+            if (shouldWarn) {
+                warn.warn(LintCategory.VARARGS);
+            }
+        }
 
     /**
      * Is t a subtype of s?<br>
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jan 25 10:59:09 2012 -0800
@@ -306,7 +306,16 @@
      */
     void duplicateError(DiagnosticPosition pos, Symbol sym) {
         if (!sym.type.isErroneous()) {
-            log.error(pos, "already.defined", sym, sym.location());
+            Symbol location = sym.location();
+            if (location.kind == MTH &&
+                    ((MethodSymbol)location).isStaticOrInstanceInit()) {
+                log.error(pos, "already.defined.in.clinit", kindName(sym), sym,
+                        kindName(sym.location()), kindName(sym.location().enclClass()),
+                        sym.location().enclClass());
+            } else {
+                log.error(pos, "already.defined", kindName(sym), sym,
+                        kindName(sym.location()), sym.location());
+            }
         }
     }
 
--- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Wed Jan 25 10:59:09 2012 -0800
@@ -249,6 +249,13 @@
         }
     };
 
+    private final Filter<Type> botFilter = new Filter<Type>() {
+        @Override
+        public boolean accepts(Type t) {
+            return t.tag != BOT;
+        }
+    };
+
     /** Instantiate undetermined type variable to the lub of all its lower bounds.
      *  Throw a NoInstanceException if this not possible.
      */
@@ -269,21 +276,18 @@
             // VGJ: sort of inlined maximizeInst() below.  Adding
             // bounds can cause lobounds that are above hibounds.
             List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
+            Type hb = null;
             if (hibounds.isEmpty())
-                return;
-            Type hb = null;
-            if (hibounds.tail.isEmpty())
+                hb = syms.objectType;
+            else if (hibounds.tail.isEmpty())
                 hb = hibounds.head;
-            else for (List<Type> bs = hibounds;
-                      bs.nonEmpty() && hb == null;
-                      bs = bs.tail) {
-                if (isSubClass(bs.head, hibounds))
-                    hb = types.fromUnknownFun.apply(bs.head);
-            }
+            else
+                hb = types.glb(hibounds);
             if (hb == null ||
-                !types.isSubtypeUnchecked(hb, hibounds, warn) ||
-                !types.isSubtypeUnchecked(that.inst, hb, warn))
-                throw ambiguousNoInstanceException;
+                hb.isErroneous())
+                throw ambiguousNoInstanceException
+                        .setMessage("incompatible.upper.bounds",
+                                    that.qtype, hibounds);
         }
     }
 
@@ -470,7 +474,8 @@
                         UndetVar uv = (UndetVar)t;
                         if (uv.qtype == tv) {
                             switch (ck) {
-                                case EXTENDS: return uv.hibounds.appendList(types.subst(types.getBounds(tv), all_tvars, inferredTypes));
+                                case EXTENDS: return Type.filter(uv.hibounds, botFilter)
+                                        .appendList(types.subst(types.getBounds(tv), all_tvars, inferredTypes));
                                 case SUPER: return uv.lobounds;
                                 case EQUAL: return uv.inst != null ? List.of(uv.inst) : List.<Type>nil();
                             }
--- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Jan 25 10:59:09 2012 -0800
@@ -2271,6 +2271,14 @@
         tree.extending = translate(tree.extending);
         tree.implementing = translate(tree.implementing);
 
+        if (currentClass.isLocal()) {
+            ClassSymbol encl = currentClass.owner.enclClass();
+            if (encl.trans_local == null) {
+                encl.trans_local = List.nil();
+            }
+            encl.trans_local = encl.trans_local.prepend(currentClass);
+        }
+
         // Recursively translate members, taking into account that new members
         // might be created during the translation and prepended to the member
         // list `tree.defs'.
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Wed Jan 25 10:59:09 2012 -0800
@@ -863,10 +863,10 @@
         }
         if (c.type.tag != CLASS) return; // arrays
         if (pool != null && // pool might be null if called from xClassName
-            c.owner.kind != PCK &&
+            c.owner.enclClass() != null &&
             (innerClasses == null || !innerClasses.contains(c))) {
 //          log.errWriter.println("enter inner " + c);//DEBUG
-            if (c.owner.kind == TYP) enterInner((ClassSymbol)c.owner);
+            enterInner(c.owner.enclClass());
             pool.put(c);
             pool.put(c.name);
             if (innerClasses == null) {
@@ -1505,6 +1505,13 @@
             default : Assert.error();
             }
         }
+
+        if (c.trans_local != null) {
+            for (ClassSymbol local : c.trans_local) {
+                enterInner(local);
+            }
+        }
+
         databuf.appendChar(fieldsCount);
         writeFields(c.members().elems);
         databuf.appendChar(methodsCount);
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jan 25 10:59:09 2012 -0800
@@ -68,9 +68,13 @@
 compiler.err.already.annotated=\
     {0} {1} has already been annotated
 
-# 0: symbol, 1: symbol
+# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol
 compiler.err.already.defined=\
-    {0} is already defined in {1}
+    {0} {1} is already defined in {2} {3}
+
+# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol kind, 4: symbol
+compiler.err.already.defined.in.clinit=\
+    {0} {1} is already defined in {2} of {3} {4}
 
 # 0: string
 compiler.err.already.defined.single.import=\
@@ -1602,6 +1606,10 @@
 compiler.misc.no.unique.minimal.instance.exists=\
     no unique minimal instance exists for type variable {0} with lower bounds {1}
 
+# 0: type, 1: list of type
+compiler.misc.incompatible.upper.bounds=\
+    inference variable {0} has incompatible upper bounds {1}
+
 # 0: list of type, 1: type, 2: type
 compiler.misc.infer.no.conforming.instance.exists=\
     no instance(s) of type variable(s) {0} exist so that {1} conforms to {2}
@@ -1757,6 +1765,12 @@
 compiler.misc.kindname.package=\
     package
 
+compiler.misc.kindname.static.init=\
+    static initializer
+
+compiler.misc.kindname.instance.init=\
+    instance initializer
+
 #####
 
 compiler.misc.no.args=\
--- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Wed Jan 25 10:59:09 2012 -0800
@@ -412,7 +412,7 @@
         @Override
         public String visitMethodSymbol(MethodSymbol s, Locale locale) {
             String ownerName = visit(s.owner, locale);
-            if ((s.flags() & BLOCK) != 0) {
+            if (s.isStaticOrInstanceInit()) {
                return ownerName;
             } else {
                 String ms = (s.name == s.name.table.names.init)
--- a/src/share/classes/com/sun/tools/javadoc/JavadocTool.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/src/share/classes/com/sun/tools/javadoc/JavadocTool.java	Wed Jan 25 10:59:09 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -257,24 +257,15 @@
         for (String p: excludedPackages)
             includedPackages.put(p, false);
 
-        if (docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)) {
-            searchSubPackages(subPackages,
-                    includedPackages,
-                    packages, packageFiles,
-                    StandardLocation.SOURCE_PATH,
-                    EnumSet.of(JavaFileObject.Kind.SOURCE));
-            searchSubPackages(subPackages,
-                    includedPackages,
-                    packages, packageFiles,
-                    StandardLocation.CLASS_PATH,
-                    EnumSet.of(JavaFileObject.Kind.CLASS));
-        } else {
-            searchSubPackages(subPackages,
-                    includedPackages,
-                    packages, packageFiles,
-                    StandardLocation.CLASS_PATH,
-                    EnumSet.of(JavaFileObject.Kind.SOURCE, JavaFileObject.Kind.CLASS));
-        }
+        StandardLocation path = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
+                ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
+
+        searchSubPackages(subPackages,
+                includedPackages,
+                packages, packageFiles,
+                path,
+                EnumSet.of(JavaFileObject.Kind.SOURCE));
+
         return packageFiles;
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7003595/T7003595.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 7003595
+ * @summary IncompatibleClassChangeError with unreferenced local class with subclass
+ */
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.InnerClasses_attribute;
+import com.sun.tools.classfile.ConstantPool.*;
+import com.sun.tools.javac.api.JavacTool;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.ArrayList;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+
+public class T7003595 {
+
+    /** global decls ***/
+
+    // Create a single file manager and reuse it for each compile to save time.
+    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+
+    //statistics
+    static int checkCount = 0;
+
+    enum ClassKind {
+        NESTED("static class #N { #B }", "$", true),
+        INNER("class #N { #B }", "$", false),
+        LOCAL_REF("void test() { class #N { #B }; new #N(); }", "$1", false),
+        LOCAL_NOREF("void test() { class #N { #B }; }", "$1", false),
+        ANON("void test() { new Object() { #B }; }", "$1", false),
+        NONE("", "", false);
+
+        String memberInnerStr;
+        String sep;
+        boolean staticAllowed;
+
+        private ClassKind(String memberInnerStr, String sep, boolean staticAllowed) {
+            this.memberInnerStr = memberInnerStr;
+            this.sep = sep;
+            this.staticAllowed = staticAllowed;
+        }
+
+        String getSource(String className, String outerName, String nested) {
+            return memberInnerStr.replaceAll("#O", outerName).
+                    replaceAll("#N", className).replaceAll("#B", nested);
+        }
+
+        static String getClassfileName(String[] names, ClassKind[] outerKinds, int pos) {
+            System.out.println(" pos = " + pos + " kind = " + outerKinds[pos] + " sep = " + outerKinds[pos].sep);
+            String name = outerKinds[pos] != ANON ?
+                    names[pos] : "";
+            if (pos == 0) {
+                return "Test" + outerKinds[pos].sep + name;
+            } else {
+                String outerStr = getClassfileName(names, outerKinds, pos - 1);
+                return outerStr + outerKinds[pos].sep + name;
+            }
+        }
+
+        boolean isAllowed(ClassKind nestedKind) {
+            return nestedKind != NESTED ||
+                    staticAllowed;
+        }
+    }
+
+    enum LocalInnerClass {
+        LOCAL_REF("class L {}; new L();", "Test$1L"),
+        LOCAL_NOREF("class L {};", "Test$1L"),
+        ANON("new Object() {};", "Test$1"),
+        NONE("", "");
+
+        String localInnerStr;
+        String canonicalInnerStr;
+
+        private LocalInnerClass(String localInnerStr, String canonicalInnerStr) {
+            this.localInnerStr = localInnerStr;
+            this.canonicalInnerStr = canonicalInnerStr;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        for (ClassKind ck1 : ClassKind.values()) {
+            String cname1 = "C1";
+            for (ClassKind ck2 : ClassKind.values()) {
+                if (!ck1.isAllowed(ck2)) continue;
+                String cname2 = "C2";
+                for (ClassKind ck3 : ClassKind.values()) {
+                    if (!ck2.isAllowed(ck3)) continue;
+                    String cname3 = "C3";
+                    new T7003595(new ClassKind[] {ck1, ck2, ck3}, new String[] { cname1, cname2, cname3 }).compileAndCheck();
+                }
+            }
+        }
+
+        System.out.println("Total checks made: " + checkCount);
+    }
+
+    /** instance decls **/
+
+    ClassKind[] cks;
+    String[] cnames;
+
+    T7003595(ClassKind[] cks, String[] cnames) {
+        this.cks = cks;
+        this.cnames = cnames;
+    }
+
+    void compileAndCheck() throws Exception {
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        JavaSource source = new JavaSource();
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, null,
+                null, null, Arrays.asList(source));
+        ct.call();
+        verifyBytecode(source);
+    }
+
+    void verifyBytecode(JavaSource source) {
+        for (int i = 0; i < 3 ; i ++) {
+            if (cks[i] == ClassKind.NONE) break;
+            checkCount++;
+            String filename = cks[i].getClassfileName(cnames, cks, i);
+            File compiledTest = new File(filename + ".class");
+            try {
+                ClassFile cf = ClassFile.read(compiledTest);
+                if (cf == null) {
+                    throw new Error("Classfile not found: " + filename);
+                }
+
+                InnerClasses_attribute innerClasses = (InnerClasses_attribute)cf.getAttribute(Attribute.InnerClasses);
+
+                ArrayList<String> foundInnerSig = new ArrayList<>();
+                if (innerClasses != null) {
+                    for (InnerClasses_attribute.Info info : innerClasses.classes) {
+                        String foundSig = info.getInnerClassInfo(cf.constant_pool).getName();
+                        foundInnerSig.add(foundSig);
+                    }
+                }
+
+                ArrayList<String> expectedInnerSig = new ArrayList<>();
+                //add inner class (if any)
+                if (i < 2 && cks[i + 1] != ClassKind.NONE) {
+                    expectedInnerSig.add(cks[i + 1].getClassfileName(cnames, cks, i + 1));
+                }
+                //add inner classes
+                for (int j = 0 ; j != i + 1 && j < 3; j++) {
+                    expectedInnerSig.add(cks[j].getClassfileName(cnames, cks, j));
+                }
+
+                if (expectedInnerSig.size() != foundInnerSig.size()) {
+                    throw new Error("InnerClasses attribute for " + cnames[i] + " has wrong size\n" +
+                                    "expected " + expectedInnerSig.size() + "\n" +
+                                    "found " + innerClasses.number_of_classes + "\n" +
+                                    source);
+                }
+
+                for (String foundSig : foundInnerSig) {
+                    if (!expectedInnerSig.contains(foundSig)) {
+                        throw new Error("InnerClasses attribute for " + cnames[i] + " has unexpected signature: " +
+                                foundSig + "\n" + source + "\n" + expectedInnerSig);
+                    }
+                }
+
+                for (String expectedSig : expectedInnerSig) {
+                    if (!foundInnerSig.contains(expectedSig)) {
+                        throw new Error("InnerClasses attribute for " + cnames[i] + " does not contain expected signature: " +
+                                    expectedSig + "\n" + source);
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new Error("error reading " + compiledTest +": " + e);
+            }
+        }
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        static final String source_template = "class Test { #C }";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            String c3 = cks[2].getSource(cnames[2], cnames[1], "");
+            String c2 = cks[1].getSource(cnames[1], cnames[0], c3);
+            String c1 = cks[0].getSource(cnames[0], "Test", c2);
+            source = source_template.replace("#C", c1);
+        }
+
+        @Override
+        public String toString() {
+            return source;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7003595/T7003595b.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 7003595
+ * @summary IncompatibleClassChangeError with unreferenced local class with subclass
+ */
+
+public class T7003595b {
+    public static void main(String... args) throws Exception {
+        class A {}
+        class B extends A {}
+        B.class.getSuperclass().getDeclaringClass();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7085024/T7085024.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7085024
+ * @summary internal error; cannot instantiate Foo
+ * @compile/fail/ref=T7085024.out -XDrawDiagnostics T7085024.java
+ */
+
+class T7085024 {
+    T7085024 (boolean ret) { } //internal error goes away if constructor accepts a reference type
+
+    T7085024 f = new T7085024((NonExistentClass) null );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7085024/T7085024.out	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,2 @@
+T7085024.java:11:32: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, T7085024, null)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7086595/T7086595.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,32 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7086595
+ * @summary Error message bug: name of initializer is 'null'
+ * @compile/fail/ref=T7086595.out -XDrawDiagnostics T7086595.java
+ */
+
+class T7086595 {
+
+    String s = "x";
+    String s = nonExistent;
+
+    int foo() {
+        String s = "x";
+        String s = nonExistent;
+    }
+
+    static int bar() {
+        String s = "x";
+        String s = nonExistent;
+    }
+
+    {
+        String s = "x";
+        String s = nonExistent;
+    }
+
+    static {
+        String s = "x";
+        String s = nonExistent;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7086595/T7086595.out	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,11 @@
+T7086595.java:11:12: compiler.err.already.defined: kindname.variable, s, kindname.class, T7086595
+T7086595.java:11:16: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+T7086595.java:15:16: compiler.err.already.defined: kindname.variable, s, kindname.method, foo()
+T7086595.java:15:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+T7086595.java:20:16: compiler.err.already.defined: kindname.variable, s, kindname.method, bar()
+T7086595.java:20:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+T7086595.java:25:16: compiler.err.already.defined.in.clinit: kindname.variable, s, kindname.instance.init, kindname.class, T7086595
+T7086595.java:25:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+T7086595.java:30:16: compiler.err.already.defined.in.clinit: kindname.variable, s, kindname.static.init, kindname.class, T7086595
+T7086595.java:30:20: compiler.err.cant.resolve.location: kindname.variable, nonExistent, , , (compiler.misc.location: kindname.class, T7086595, null)
+10 errors
--- a/test/tools/javac/Diagnostics/6860795/T6860795.out	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/Diagnostics/6860795/T6860795.out	Wed Jan 25 10:59:09 2012 -0800
@@ -1,2 +1,2 @@
-T6860795.java:10:27: compiler.err.already.defined: x, foo
+T6860795.java:10:27: compiler.err.already.defined: kindname.variable, x, kindname.method, foo
 1 error
--- a/test/tools/javac/Diagnostics/6862608/T6862608a.out	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/Diagnostics/6862608/T6862608a.out	Wed Jan 25 10:59:09 2012 -0800
@@ -1,3 +1,3 @@
-T6862608a.java:19:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
+T6862608a.java:19:41: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<java.util.Comparator<?>>, java.lang.Iterable<? extends java.util.Comparator<? super java.lang.String>>)
 - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, java.lang.Object, kindname.method, <T>compound(java.lang.Iterable<? extends java.util.Comparator<? super T>>))}
 1 error
--- a/test/tools/javac/LocalClasses_2.out	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/LocalClasses_2.out	Wed Jan 25 10:59:09 2012 -0800
@@ -1,2 +1,2 @@
-LocalClasses_2.java:15:13: compiler.err.already.defined: Local, foo()
+LocalClasses_2.java:15:13: compiler.err.already.defined: kindname.class, Local, kindname.method, foo()
 1 error
--- a/test/tools/javac/NestedInnerClassNames.out	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/NestedInnerClassNames.out	Wed Jan 25 10:59:09 2012 -0800
@@ -1,18 +1,18 @@
-NestedInnerClassNames.java:16:5: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
-NestedInnerClassNames.java:23:9: compiler.err.already.defined: NestedInnerClassNames.foo, NestedInnerClassNames
-NestedInnerClassNames.java:34:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
-NestedInnerClassNames.java:45:9: compiler.err.already.defined: NestedInnerClassNames.baz, NestedInnerClassNames
-NestedInnerClassNames.java:46:13: compiler.err.already.defined: NestedInnerClassNames.baz.baz, NestedInnerClassNames.baz
-NestedInnerClassNames.java:59:9: compiler.err.already.defined: NestedInnerClassNames.foo$bar, NestedInnerClassNames
-NestedInnerClassNames.java:76:13: compiler.err.already.defined: NestedInnerClassNames.$bar, NestedInnerClassNames
-NestedInnerClassNames.java:90:13: compiler.err.already.defined: NestedInnerClassNames.bar$bar.bar, NestedInnerClassNames.bar$bar
+NestedInnerClassNames.java:16:5: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
+NestedInnerClassNames.java:23:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.foo, kindname.class, NestedInnerClassNames
+NestedInnerClassNames.java:34:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
+NestedInnerClassNames.java:45:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.baz, kindname.class, NestedInnerClassNames
+NestedInnerClassNames.java:46:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.baz.baz, kindname.class, NestedInnerClassNames.baz
+NestedInnerClassNames.java:59:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames.foo$bar, kindname.class, NestedInnerClassNames
+NestedInnerClassNames.java:76:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.$bar, kindname.class, NestedInnerClassNames
+NestedInnerClassNames.java:90:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames.bar$bar.bar, kindname.class, NestedInnerClassNames.bar$bar
 NestedInnerClassNames.java:109:5: compiler.err.duplicate.class: NestedInnerClassNames.foo.foo
-NestedInnerClassNames.java:19:9: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
-NestedInnerClassNames.java:28:13: compiler.err.already.defined: foo, m2()
-NestedInnerClassNames.java:40:13: compiler.err.already.defined: NestedInnerClassNames, compiler.misc.unnamed.package
-NestedInnerClassNames.java:52:13: compiler.err.already.defined: baz, m4()
-NestedInnerClassNames.java:53:17: compiler.err.already.defined: baz.baz, baz
-NestedInnerClassNames.java:67:13: compiler.err.already.defined: foo$bar, m5()
-NestedInnerClassNames.java:83:17: compiler.err.already.defined: $bar, m6()
-NestedInnerClassNames.java:97:17: compiler.err.already.defined: bar$bar.bar, bar$bar
+NestedInnerClassNames.java:19:9: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
+NestedInnerClassNames.java:28:13: compiler.err.already.defined: kindname.class, foo, kindname.method, m2()
+NestedInnerClassNames.java:40:13: compiler.err.already.defined: kindname.class, NestedInnerClassNames, kindname.package, compiler.misc.unnamed.package
+NestedInnerClassNames.java:52:13: compiler.err.already.defined: kindname.class, baz, kindname.method, m4()
+NestedInnerClassNames.java:53:17: compiler.err.already.defined: kindname.class, baz.baz, kindname.class, baz
+NestedInnerClassNames.java:67:13: compiler.err.already.defined: kindname.class, foo$bar, kindname.method, m5()
+NestedInnerClassNames.java:83:17: compiler.err.already.defined: kindname.class, $bar, kindname.method, m6()
+NestedInnerClassNames.java:97:17: compiler.err.already.defined: kindname.class, bar$bar.bar, kindname.class, bar$bar
 17 errors
--- a/test/tools/javac/TryWithResources/BadTwr.out	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/TryWithResources/BadTwr.out	Wed Jan 25 10:59:09 2012 -0800
@@ -1,5 +1,5 @@
-BadTwr.java:13:46: compiler.err.already.defined: r1, main(java.lang.String...)
-BadTwr.java:18:20: compiler.err.already.defined: args, main(java.lang.String...)
+BadTwr.java:13:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, main(java.lang.String...)
+BadTwr.java:18:20: compiler.err.already.defined: kindname.variable, args, kindname.method, main(java.lang.String...)
 BadTwr.java:21:13: compiler.err.cant.assign.val.to.final.var: thatsIt
-BadTwr.java:26:24: compiler.err.already.defined: name, main(java.lang.String...)
+BadTwr.java:26:24: compiler.err.already.defined: kindname.variable, name, kindname.method, main(java.lang.String...)
 4 errors
--- a/test/tools/javac/TryWithResources/DuplicateResourceDecl.out	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/TryWithResources/DuplicateResourceDecl.out	Wed Jan 25 10:59:09 2012 -0800
@@ -1,2 +1,2 @@
-DuplicateResourceDecl.java:12:56: compiler.err.already.defined: c, main(java.lang.String[])
+DuplicateResourceDecl.java:12:56: compiler.err.already.defined: kindname.variable, c, kindname.method, main(java.lang.String[])
 1 error
--- a/test/tools/javac/api/T6397104.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/api/T6397104.java	Wed Jan 25 10:59:09 2012 -0800
@@ -26,10 +26,10 @@
  * @bug     6397104
  * @summary JSR 199: JavaFileManager.getFileForOutput should have sibling argument
  * @author  Peter von der Ah\u00e9
- * @ignore  this test should be rewritten when fixing 6473901
  */
 
 import java.io.File;
+import java.net.URI;
 import java.util.Arrays;
 import javax.tools.*;
 import javax.tools.JavaFileManager.Location;
@@ -52,10 +52,14 @@
             : fm.getJavaFileObjectsFromFiles(Arrays.asList(siblingFile)).iterator().next();
         FileObject fileObject =
             fm.getFileForOutput(location, "java.lang", relName, sibling);
-        if (!fileObject.toUri().getPath().equals(expectedPath))
-            throw new AssertionError("Expected " + expectedPath +
-                                     ", got " + fileObject.toUri().getPath());
-        System.out.format("OK: (%s, %s) => %s%n", siblingFile, relName, fileObject.toUri());
+
+        File expectedFile = new File(expectedPath).getCanonicalFile();
+        File fileObjectFile = new File(fileObject.toUri()).getCanonicalFile();
+
+        if (!fileObjectFile.equals(expectedFile))
+            throw new AssertionError("Expected " + expectedFile +
+                                     ", got " + fileObjectFile);
+        System.out.format("OK: (%s, %s) => %s%n", siblingFile, relName, fileObjectFile);
     }
 
     void test(boolean hasLocation, File siblingFile, String relName, String expectedPath)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/AlreadyDefinedClinit.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+// key: compiler.err.already.defined.in.clinit
+
+class AlreadyDefinedClinit {
+    static {
+        int i;
+        int i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/IncompatibleUpperBounds.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+//key: compiler.err.cant.apply.symbols
+//key: compiler.misc.inapplicable.method
+//key: compiler.misc.arg.length.mismatch
+//key: compiler.misc.incompatible.upper.bounds
+
+import java.util.List;
+
+class IncompatibleUpperBounds {
+    <S> void m(List<? super S> s1, List<? super S> s2) { }
+    void m(Object o) {}
+
+    void test(List<Integer> li, List<String> ls) {
+        m(li, ls);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/KindnameInstanceInit.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+// key: compiler.err.already.defined.in.clinit
+// key: compiler.misc.kindname.instance.init
+// key: compiler.misc.kindname.class
+// key: compiler.misc.kindname.variable
+// key: compiler.misc.count.error
+// key: compiler.err.error
+// run: backdoor
+
+class KindnameInstanceInit {
+    {
+        int i;
+        int i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/KindnameStaticInit.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+// key: compiler.err.already.defined.in.clinit
+// key: compiler.misc.kindname.static.init
+// key: compiler.misc.kindname.class
+// key: compiler.misc.kindname.variable
+// key: compiler.misc.count.error
+// key: compiler.err.error
+// run: backdoor
+
+class KindnameStaticInit {
+    static {
+        int i;
+        int i;
+    }
+}
--- a/test/tools/javac/generics/6910550/T6910550d.out	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/generics/6910550/T6910550d.out	Wed Jan 25 10:59:09 2012 -0800
@@ -1,2 +1,2 @@
-T6910550d.java:12:14: compiler.err.already.defined: <X>m(X), T6910550d
+T6910550d.java:12:14: compiler.err.already.defined: kindname.method, <X>m(X), kindname.class, T6910550d
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712a.out	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/generics/inference/6638712/T6638712a.out	Wed Jan 25 10:59:09 2012 -0800
@@ -1,2 +1,2 @@
-T6638712a.java:16:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
+T6638712a.java:16:41: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<java.util.Comparator<?>>, java.lang.Iterable<? extends java.util.Comparator<? super java.lang.String>>)
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086586/T7086586.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,19 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 7086586
+ * @summary Inference producing null type argument
+ * @compile/fail/ref=T7086586.out -XDrawDiagnostics T7086586.java
+ */
+import java.util.List;
+
+class T7086586 {
+
+    <T> List<T> m(List<? super T> dummy) { return null; }
+
+    void test(List<?> l) {
+        String s = m(l).get(0);
+        Number n = m(l).get(0);
+        Exception e = m(l).get(0);
+        m(l).nonExistentMethod();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086586/T7086586.out	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,5 @@
+T7086586.java:14:21: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super java.lang.Object>)
+T7086586.java:15:21: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super java.lang.Object>)
+T7086586.java:16:24: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super java.lang.Object>)
+T7086586.java:17:10: compiler.err.invalid.inferred.types: T, (compiler.misc.no.conforming.assignment.exists: java.util.List<compiler.misc.type.captureof: 1, ?>, java.util.List<? super java.lang.Object>)
+4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086601/T7086601a.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,34 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 7086601
+ * @summary Error message bug: cause for method mismatch is 'null'
+ * @compile/fail/ref=T7086601a.out -XDrawDiagnostics T7086601a.java
+ */
+
+class T7086601 {
+    static <S> void m1(Iterable<? super S> s1, Iterable<? super S> s2) { }
+    static void m1(Object o) {}
+
+    static <S> void m2(Iterable<? super S> s1, Iterable<? super S> s2, Iterable<? super S> s3) { }
+    static void m2(Object o) {}
+
+    @SafeVarargs
+    static <S> void m3(Iterable<? super S>... ss) { }
+    static void m3(Object o) {}
+
+    static void test1(Iterable<String> is, Iterable<Integer> ii) {
+        m1(is, ii);
+    }
+
+    static void test2(Iterable<String> is, Iterable<Integer> ii, Iterable<Double> id) {
+        m2(is, ii, id);
+    }
+
+    static void test3(Iterable<String> is, Iterable<Integer> ii) {
+        m3(is, ii);
+    }
+
+    static void test4(Iterable<String> is, Iterable<Integer> ii, Iterable<Double> id) {
+        m3(is, ii, id);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086601/T7086601a.out	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,5 @@
+T7086601a.java:20:9: compiler.err.cant.apply.symbols: kindname.method, m1, java.lang.Iterable<java.lang.String>,java.lang.Iterable<java.lang.Integer>,{(compiler.misc.inapplicable.method: kindname.method, T7086601, m1(java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T7086601, <S>m1(java.lang.Iterable<? super S>,java.lang.Iterable<? super S>), (compiler.misc.incompatible.upper.bounds: S, java.lang.Integer,java.lang.String))}
+T7086601a.java:24:9: compiler.err.cant.apply.symbols: kindname.method, m2, java.lang.Iterable<java.lang.String>,java.lang.Iterable<java.lang.Integer>,java.lang.Iterable<java.lang.Double>,{(compiler.misc.inapplicable.method: kindname.method, T7086601, m2(java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T7086601, <S>m2(java.lang.Iterable<? super S>,java.lang.Iterable<? super S>,java.lang.Iterable<? super S>), (compiler.misc.incompatible.upper.bounds: S, java.lang.Double,java.lang.Integer,java.lang.String))}
+T7086601a.java:28:9: compiler.err.cant.apply.symbols: kindname.method, m3, java.lang.Iterable<java.lang.String>,java.lang.Iterable<java.lang.Integer>,{(compiler.misc.inapplicable.method: kindname.method, T7086601, m3(java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T7086601, <S>m3(java.lang.Iterable<? super S>...), (compiler.misc.incompatible.upper.bounds: S, java.lang.Integer,java.lang.String))}
+T7086601a.java:32:9: compiler.err.cant.apply.symbols: kindname.method, m3, java.lang.Iterable<java.lang.String>,java.lang.Iterable<java.lang.Integer>,java.lang.Iterable<java.lang.Double>,{(compiler.misc.inapplicable.method: kindname.method, T7086601, m3(java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T7086601, <S>m3(java.lang.Iterable<? super S>...), (compiler.misc.incompatible.upper.bounds: S, java.lang.Double,java.lang.Integer,java.lang.String))}
+4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/7086601/T7086601b.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 7086601
+ * @summary Error message bug: cause for method mismatch is 'null'
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.ArrayList;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+
+public class T7086601b {
+
+    static int checkCount = 0;
+
+    enum TypeKind {
+        STRING("String", false),
+        INTEGER("Integer", false),
+        NUMBER("Number", false),
+        SERIALIZABLE("java.io.Serializable", true),
+        CLONEABLE("Cloneable", true),
+        X("X", false),
+        Y("Y", false),
+        Z("Z", false);
+
+        String typeStr;
+        boolean isInterface;
+
+        private TypeKind(String typeStr, boolean isInterface) {
+            this.typeStr = typeStr;
+            this.isInterface = isInterface;
+        }
+
+        boolean isSubtypeof(TypeKind other) {
+            return (this == INTEGER && other == NUMBER ||
+                    this == Z && other == Y ||
+                    this == other);
+        }
+    }
+
+    enum MethodCallKind {
+        ARITY_ONE("m(a1);", 1),
+        ARITY_TWO("m(a1, a2);", 2),
+        ARITY_THREE("m(a1, a2, a3);", 3);
+
+        String invokeString;
+        int arity;
+
+        private MethodCallKind(String invokeString, int arity) {
+            this.invokeString = invokeString;
+            this.arity = arity;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (TypeKind a1 : TypeKind.values()) {
+            for (TypeKind a2 : TypeKind.values()) {
+                for (TypeKind a3 : TypeKind.values()) {
+                    for (MethodCallKind mck : MethodCallKind.values()) {
+                        new T7086601b(a1, a2, a3, mck).run(comp, fm);
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    TypeKind a1;
+    TypeKind a2;
+    TypeKind a3;
+    MethodCallKind mck;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    T7086601b(TypeKind a1, TypeKind a2, TypeKind a3, MethodCallKind mck) {
+        this.a1 = a1;
+        this.a2 = a2;
+        this.a3 = a3;
+        this.mck = mck;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        final String bodyTemplate = "import java.util.List;\n"+
+                              "class Test {\n" +
+                              "   <Z> void m(List<? super Z> l1) { }\n" +
+                              "   <Z> void m(List<? super Z> l1, List<? super Z> l2) { }\n" +
+                              "   <Z> void m(List<? super Z> l1, List<? super Z> l2, List<? super Z> l3) { }\n" +
+                              "   <X,Y,Z extends Y> void test(List<#A1> a1, List<#A2> a2, List<#A3> a3) { #MC } }";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = bodyTemplate.replace("#A1", a1.typeStr)
+                             .replace("#A2", a2.typeStr).replace("#A3", a3.typeStr)
+                             .replace("#MC", mck.invokeString);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        try {
+            ct.analyze();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thron when compiling the following code:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        checkCount++;
+
+        boolean errorExpected = false;
+
+        if (mck.arity > 1) {
+            TypeKind[] argtypes = { a1, a2, a3 };
+            ArrayList<TypeKind> classes = new ArrayList<>();
+            for (int i = 0 ; i < mck.arity ; i ++ ) {
+                if (!argtypes[i].isInterface) {
+                    classes.add(argtypes[i]);
+                }
+            }
+            boolean glb_exists = true;
+            for (TypeKind arg_i : classes) {
+                glb_exists = true;
+                for (TypeKind arg_j : classes) {
+                    if (!arg_i.isSubtypeof(arg_j)) {
+                        glb_exists = false;
+                        break;
+                    }
+                }
+                if (glb_exists) break;
+            }
+            errorExpected = !glb_exists;
+        }
+
+        if (errorExpected != diagChecker.errorFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + errorExpected);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- a/test/tools/javac/javazip/Test.sh	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/javazip/Test.sh	Wed Jan 25 10:59:09 2012 -0800
@@ -47,7 +47,7 @@
     ;;
   CYGWIN* )
     FS="/"
-    SCR=`pwd | cygpath -d`
+    SCR=`pwd | cygpath -d -f -`
     ;;
   Windows* )
     FS="\\"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/varargs/7097436/T7097436.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,18 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug     7097436
+ * @summary  ClassCastException occurs in assignment expressions without any heap pollutions
+ * @compile/fail/ref=T7097436.out -Xlint:varargs -Werror -XDrawDiagnostics T7097436.java
+ */
+
+import java.util.List;
+
+class T7097436 {
+    @SafeVarargs
+    static void m(List<String>... ls) {
+        Object o = ls; //warning
+        Object[] oArr = ls; //warning
+        String s = ls; // no warning
+        Integer[] iArr = ls; // no warning
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/varargs/7097436/T7097436.out	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,6 @@
+T7097436.java:13:20: compiler.warn.varargs.unsafe.use.varargs.param: ls
+T7097436.java:14:25: compiler.warn.varargs.unsafe.use.varargs.param: ls
+T7097436.java:15:20: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.util.List<java.lang.String>[], java.lang.String
+T7097436.java:16:26: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.util.List<java.lang.String>[], java.lang.Integer[]
+2 errors
+2 warnings
--- a/test/tools/javac/varargs/warning/Warn5.java	Mon Jan 23 09:48:04 2012 -0800
+++ b/test/tools/javac/varargs/warning/Warn5.java	Wed Jan 25 10:59:09 2012 -0800
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug     6993978
+ * @bug     6993978 7097436
  * @summary Project Coin: Annotation to reduce varargs warnings
  * @author  mcimadamore
  * @run main Warn5
@@ -31,8 +31,8 @@
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.api.JavacTool;
 import java.net.URI;
-import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.EnumSet;
 import javax.tools.Diagnostic;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
@@ -95,7 +95,6 @@
         METHOD("void m"),
         CONSTRUCTOR("Test");
 
-
         String name;
 
         MethodKind(String name) {
@@ -155,7 +154,124 @@
         }
     }
 
-    static class JavaSource extends SimpleJavaFileObject {
+    enum WarningKind {
+        UNSAFE_BODY,
+        UNSAFE_DECL,
+        MALFORMED_SAFEVARARGS,
+        REDUNDANT_SAFEVARARGS;
+    }
+
+    // Create a single file manager and reuse it for each compile to save time.
+    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+
+    public static void main(String... args) throws Exception {
+        for (SourceLevel sourceLevel : SourceLevel.values()) {
+            for (XlintOption xlint : XlintOption.values()) {
+                for (TrustMe trustMe : TrustMe.values()) {
+                    for (SuppressLevel suppressLevel : SuppressLevel.values()) {
+                        for (ModifierKind modKind : ModifierKind.values()) {
+                            for (MethodKind methKind : MethodKind.values()) {
+                                for (SignatureKind sig : SignatureKind.values()) {
+                                    for (BodyKind body : BodyKind.values()) {
+                                        new Warn5(sourceLevel,
+                                                xlint,
+                                                trustMe,
+                                                suppressLevel,
+                                                modKind,
+                                                methKind,
+                                                sig,
+                                                body).test();
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    final SourceLevel sourceLevel;
+    final XlintOption xlint;
+    final TrustMe trustMe;
+    final SuppressLevel suppressLevel;
+    final ModifierKind modKind;
+    final MethodKind methKind;
+    final SignatureKind sig;
+    final BodyKind body;
+    final JavaSource source;
+    final DiagnosticChecker dc;
+
+    public Warn5(SourceLevel sourceLevel, XlintOption xlint, TrustMe trustMe, SuppressLevel suppressLevel, ModifierKind modKind, MethodKind methKind, SignatureKind sig, BodyKind body) {
+        this.sourceLevel = sourceLevel;
+        this.xlint = xlint;
+        this.trustMe = trustMe;
+        this.suppressLevel = suppressLevel;
+        this.modKind = modKind;
+        this.methKind = methKind;
+        this.sig = sig;
+        this.body = body;
+        this.source = new JavaSource();
+        this.dc = new DiagnosticChecker();
+    }
+
+    void test() throws Exception {
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, dc,
+                Arrays.asList(xlint.getXlintOption(), "-source", sourceLevel.sourceKey), null, Arrays.asList(source));
+        ct.analyze();
+        check();
+    }
+
+    void check() {
+
+        EnumSet<WarningKind> expectedWarnings = EnumSet.noneOf(WarningKind.class);
+
+        if (sourceLevel == SourceLevel.JDK_7 &&
+                trustMe == TrustMe.TRUST &&
+                suppressLevel != SuppressLevel.VARARGS &&
+                xlint != XlintOption.NONE &&
+                sig.isVarargs && !sig.isReifiableArg && body.hasAliasing &&
+                (methKind == MethodKind.CONSTRUCTOR || (methKind == MethodKind.METHOD && modKind != ModifierKind.NONE))) {
+            expectedWarnings.add(WarningKind.UNSAFE_BODY);
+        }
+
+        if (sourceLevel == SourceLevel.JDK_7 &&
+                trustMe == TrustMe.DONT_TRUST &&
+                sig.isVarargs &&
+                !sig.isReifiableArg &&
+                xlint == XlintOption.ALL) {
+            expectedWarnings.add(WarningKind.UNSAFE_DECL);
+        }
+
+        if (sourceLevel == SourceLevel.JDK_7 &&
+                trustMe == TrustMe.TRUST &&
+                (!sig.isVarargs ||
+                (modKind == ModifierKind.NONE && methKind == MethodKind.METHOD))) {
+            expectedWarnings.add(WarningKind.MALFORMED_SAFEVARARGS);
+        }
+
+        if (sourceLevel == SourceLevel.JDK_7 &&
+                trustMe == TrustMe.TRUST &&
+                xlint != XlintOption.NONE &&
+                suppressLevel != SuppressLevel.VARARGS &&
+                (modKind != ModifierKind.NONE || methKind == MethodKind.CONSTRUCTOR) &&
+                sig.isVarargs &&
+                sig.isReifiableArg) {
+            expectedWarnings.add(WarningKind.REDUNDANT_SAFEVARARGS);
+        }
+
+        if (!expectedWarnings.containsAll(dc.warnings) ||
+                !dc.warnings.containsAll(expectedWarnings)) {
+            throw new Error("invalid diagnostics for source:\n" +
+                    source.getCharContent(true) +
+                    "\nOptions: " + xlint.getXlintOption() +
+                    "\nExpected warnings: " + expectedWarnings +
+                    "\nFound warnings: " + dc.warnings);
+        }
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
 
         String template = "import com.sun.tools.javac.api.*;\n" +
                           "import java.util.List;\n" +
@@ -167,12 +283,11 @@
 
         String source;
 
-        public JavaSource(TrustMe trustMe, SuppressLevel suppressLevel, ModifierKind modKind,
-                MethodKind methKind, SignatureKind meth, BodyKind body) {
+        public JavaSource() {
             super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
             source = template.replace("#T", trustMe.anno).
                     replace("#S", suppressLevel.getSuppressAnno()).
-                    replace("#M", meth.getSignature(modKind, methKind)).
+                    replace("#M", sig.getSignature(modKind, methKind)).
                     replace("#B", body.body);
         }
 
@@ -182,117 +297,34 @@
         }
     }
 
-    public static void main(String... args) throws Exception {
-        for (SourceLevel sourceLevel : SourceLevel.values()) {
-            for (XlintOption xlint : XlintOption.values()) {
-                for (TrustMe trustMe : TrustMe.values()) {
-                    for (SuppressLevel suppressLevel : SuppressLevel.values()) {
-                        for (ModifierKind modKind : ModifierKind.values()) {
-                            for (MethodKind methKind : MethodKind.values()) {
-                                for (SignatureKind sig : SignatureKind.values()) {
-                                    for (BodyKind body : BodyKind.values()) {
-                                        test(sourceLevel,
-                                                xlint,
-                                                trustMe,
-                                                suppressLevel,
-                                                modKind,
-                                                methKind,
-                                                sig,
-                                                body);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    // Create a single file manager and reuse it for each compile to save time.
-    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
-
-    static void test(SourceLevel sourceLevel, XlintOption xlint, TrustMe trustMe, SuppressLevel suppressLevel,
-            ModifierKind modKind, MethodKind methKind, SignatureKind sig, BodyKind body) throws Exception {
-        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
-        JavaSource source = new JavaSource(trustMe, suppressLevel, modKind, methKind, sig, body);
-        DiagnosticChecker dc = new DiagnosticChecker();
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, dc,
-                Arrays.asList(xlint.getXlintOption(), "-source", sourceLevel.sourceKey), null, Arrays.asList(source));
-        ct.analyze();
-        check(sourceLevel, dc, source, xlint, trustMe,
-                suppressLevel, modKind, methKind, sig, body);
-    }
-
-    static void check(SourceLevel sourceLevel, DiagnosticChecker dc, JavaSource source,
-            XlintOption xlint, TrustMe trustMe, SuppressLevel suppressLevel, ModifierKind modKind,
-            MethodKind methKind, SignatureKind meth, BodyKind body) {
+    class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
 
-        boolean hasPotentiallyUnsafeBody = sourceLevel == SourceLevel.JDK_7 &&
-                trustMe == TrustMe.TRUST &&
-                suppressLevel != SuppressLevel.VARARGS &&
-                xlint != XlintOption.NONE &&
-                meth.isVarargs && !meth.isReifiableArg && body.hasAliasing &&
-                (methKind == MethodKind.CONSTRUCTOR || (methKind == MethodKind.METHOD && modKind != ModifierKind.NONE));
-
-        boolean hasPotentiallyPollutingDecl = sourceLevel == SourceLevel.JDK_7 &&
-                trustMe == TrustMe.DONT_TRUST &&
-                meth.isVarargs &&
-                !meth.isReifiableArg &&
-                xlint == XlintOption.ALL;
-
-        boolean hasMalformedAnnoInDecl = sourceLevel == SourceLevel.JDK_7 &&
-                trustMe == TrustMe.TRUST &&
-                (!meth.isVarargs ||
-                (modKind == ModifierKind.NONE && methKind == MethodKind.METHOD));
-
-        boolean hasRedundantAnnoInDecl = sourceLevel == SourceLevel.JDK_7 &&
-                trustMe == TrustMe.TRUST &&
-                xlint != XlintOption.NONE &&
-                suppressLevel != SuppressLevel.VARARGS &&
-                (modKind != ModifierKind.NONE || methKind == MethodKind.CONSTRUCTOR) &&
-                meth.isVarargs &&
-                meth.isReifiableArg;
-
-        if (hasPotentiallyUnsafeBody != dc.hasPotentiallyUnsafeBody ||
-                hasPotentiallyPollutingDecl != dc.hasPotentiallyPollutingDecl ||
-                hasMalformedAnnoInDecl != dc.hasMalformedAnnoInDecl ||
-                hasRedundantAnnoInDecl != dc.hasRedundantAnnoInDecl) {
-            throw new Error("invalid diagnostics for source:\n" +
-                    source.getCharContent(true) +
-                    "\nOptions: " + xlint.getXlintOption() +
-                    "\nExpected potentially unsafe body warning: " + hasPotentiallyUnsafeBody +
-                    "\nExpected potentially polluting decl warning: " + hasPotentiallyPollutingDecl +
-                    "\nExpected malformed anno error: " + hasMalformedAnnoInDecl +
-                    "\nExpected redundant anno warning: " + hasRedundantAnnoInDecl +
-                    "\nFound potentially unsafe body warning: " + dc.hasPotentiallyUnsafeBody +
-                    "\nFound potentially polluting decl warning: " + dc.hasPotentiallyPollutingDecl +
-                    "\nFound malformed anno error: " + dc.hasMalformedAnnoInDecl +
-                    "\nFound redundant anno warning: " + dc.hasRedundantAnnoInDecl);
-        }
-    }
-
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
-
-        boolean hasPotentiallyUnsafeBody = false;
-        boolean hasPotentiallyPollutingDecl = false;
-        boolean hasMalformedAnnoInDecl = false;
-        boolean hasRedundantAnnoInDecl = false;
+        EnumSet<WarningKind> warnings = EnumSet.noneOf(WarningKind.class);
 
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             if (diagnostic.getKind() == Diagnostic.Kind.WARNING) {
                     if (diagnostic.getCode().contains("unsafe.use.varargs.param")) {
-                        hasPotentiallyUnsafeBody = true;
+                        setWarning(WarningKind.UNSAFE_BODY);
                     } else if (diagnostic.getCode().contains("redundant.trustme")) {
-                        hasRedundantAnnoInDecl = true;
+                        setWarning(WarningKind.REDUNDANT_SAFEVARARGS);
                     }
             } else if (diagnostic.getKind() == Diagnostic.Kind.MANDATORY_WARNING &&
                     diagnostic.getCode().contains("varargs.non.reifiable.type")) {
-                hasPotentiallyPollutingDecl = true;
+                setWarning(WarningKind.UNSAFE_DECL);
             } else if (diagnostic.getKind() == Diagnostic.Kind.ERROR &&
                     diagnostic.getCode().contains("invalid.trustme")) {
-                hasMalformedAnnoInDecl = true;
+                setWarning(WarningKind.MALFORMED_SAFEVARARGS);
             }
         }
+
+        void setWarning(WarningKind wk) {
+            if (!warnings.add(wk)) {
+                throw new AssertionError("Duplicate warning of kind " + wk + " in source:\n" + source);
+            }
+        }
+
+        boolean hasWarning(WarningKind wk) {
+            return warnings.contains(wk);
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javadoc/parser/7091528/T7091528.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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     7091528
+ * @summary javadoc attempts to parse .class files
+ * @compile p/C1.java p/q/C2.java
+ * @run main T7091528
+ */
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public class T7091528 {
+    public static void main(String... args) {
+        new T7091528().run();
+    }
+
+    void run() {
+        File testSrc = new File(System.getProperty("test.src"));
+        File testClasses = new File(System.getProperty("test.classes"));
+        String[] args = {
+            "-d", ".",
+            "-sourcepath", testClasses + File.pathSeparator + testSrc,
+            "-subpackages",
+            "p"
+        };
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String doclet = com.sun.tools.doclets.standard.Standard.class.getName();
+        int rc = com.sun.tools.javadoc.Main.execute("javadoc", pw, pw, pw, doclet, args);
+        pw.close();
+
+        String out = sw.toString();
+        if (!out.isEmpty()) {
+            System.err.println(out);
+        }
+
+        if (rc != 0)
+            System.err.println("javadoc failed: exit code = " + rc);
+
+        if (out.matches("(?s).*p/[^ ]+\\.class.*"))
+            throw new Error("reading .class files");
+
+        if (!new File("index.html").exists())
+            throw new Error("index.html not found");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javadoc/parser/7091528/p/C1.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+package p1;
+
+/** This is class C1. */
+public class C1 { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javadoc/parser/7091528/p/q/C2.java	Wed Jan 25 10:59:09 2012 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+package p.q;
+
+/** This is class p.q.C2. */
+public class C2 { }
+