Merge
diff --git a/langtools/.hgtags b/langtools/.hgtags
index 8ae4f89..e56bf69 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -233,3 +233,4 @@
 985abf1cd327169a317d4ff4f318a8162a5cd47d jdk8-b109
 41541097533aa3933a018c8c1c426c1871dfd76e jdk8-b110
 af6244ba81b6b8d1bf4ab06587a2067e021e4570 jdk8-b111
+954dd199d6ff3e4cfc42b894c1f611150526eecd jdk8-b112
diff --git a/langtools/make/build.properties b/langtools/make/build.properties
index d16be20..ee72517 100644
--- a/langtools/make/build.properties
+++ b/langtools/make/build.properties
@@ -163,11 +163,11 @@
 #
 
 sjavac.includes = \
-        com/sun/tools/sjavac/ 
+        com/sun/tools/sjavac/
 
 sjavac.tests = \
         tools/sjavac
-        
+
 #
 
 # The following files require the latest JDK to be available.
diff --git a/langtools/make/build.xml b/langtools/make/build.xml
index d242e72..b612a22 100644
--- a/langtools/make/build.xml
+++ b/langtools/make/build.xml
@@ -89,7 +89,7 @@
       build-classes-TOOL        build the classes for the tool
       build-TOOL                build the jar file and script for the tool
       jtreg-TOOL                build the tool and run the appropriate tests
-      findbugs-TOOL             run findbugs on the tool's source oode
+      findbugs-TOOL             run findbugs on the tool's source code
       TOOL                      build the tool, run the tests, and run findbugs
  - utility definitions
  -->
@@ -360,7 +360,7 @@
             datafile="${build.coverage.dir}/cobertura.ser"/>
     </target>
 
-    <target name="diags-examples" depends="build-javac">
+    <target name="diags-examples" depends="build-javac,build-javap">
         <!-- can override the following on the command line if desired. -->
         <property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>
         <mkdir dir="${build.dir}/diag-examples/classes"/>
@@ -370,7 +370,7 @@
             destdir="${build.dir}/diag-examples/classes"
             includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
             sourcepath=""
-            classpath="${dist.lib.dir}/javac.jar"
+            classpath="${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
             includeAntRuntime="no"
             debug="${javac.debug}"
             debuglevel="${javac.debuglevel}">
@@ -379,7 +379,7 @@
         <java fork="true"
             jvm="${target.java.home}/bin/java"
             dir="test/tools/javac/diags"
-            classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar"
+            classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
             classname="RunExamples">
             <jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>
             <arg value="-examples"/>
diff --git a/langtools/make/jprt.properties b/langtools/make/jprt.properties
index 734fa8c..f2d5638 100644
--- a/langtools/make/jprt.properties
+++ b/langtools/make/jprt.properties
@@ -33,9 +33,7 @@
 
 # Standard list of jprt build targets for this source tree
 jprt.build.targets=                                             \
-    solaris_sparc_5.10-{product|fastdebug},                     \
     solaris_sparcv9_5.10-{product|fastdebug},                   \
-    solaris_i586_5.10-{product|fastdebug},                      \
     solaris_x64_5.10-{product|fastdebug},                       \
     linux_i586_2.6-{product|fastdebug},                         \
     linux_x64_2.6-{product|fastdebug},                          \
@@ -45,9 +43,7 @@
 
 # Test target list (no fastdebug & limited c2 testing)
 jprt.my.test.target.set= 					\
-    solaris_sparc_5.10-product-c1-TESTNAME,                     \
     solaris_sparcv9_5.10-product-c2-TESTNAME,                   \
-    solaris_i586_5.10-product-c1-TESTNAME,                      \
     solaris_x64_5.10-product-c2-TESTNAME,                       \
     linux_i586_2.6-product-{c1|c2}-TESTNAME,                    \
     linux_x64_2.6-product-c2-TESTNAME,                          \
@@ -64,9 +60,7 @@
 
 # Test target list (no fastdebug & limited c2 testing)
 jprt.my.test.target.set= 					\
-    solaris_sparc_5.10-product-c1-TESTNAME,                     \
     solaris_sparcv9_5.10-product-c2-TESTNAME,                   \
-    solaris_i586_5.10-product-c1-TESTNAME,                      \
     solaris_x64_5.10-product-c2-TESTNAME,                       \
     linux_i586_2.6-product-{c1|c2}-TESTNAME,                    \
     linux_x64_2.6-product-c2-TESTNAME,                          \
diff --git a/langtools/src/share/classes/com/sun/javadoc/package.html b/langtools/src/share/classes/com/sun/javadoc/package-info.java
similarity index 68%
rename from langtools/src/share/classes/com/sun/javadoc/package.html
rename to langtools/src/share/classes/com/sun/javadoc/package-info.java
index b44dd46..15a0fd1 100644
--- a/langtools/src/share/classes/com/sun/javadoc/package.html
+++ b/langtools/src/share/classes/com/sun/javadoc/package-info.java
@@ -1,54 +1,49 @@
-<html>
-<head>
-<TITLE>Doclet API Package</TITLE>
-<!--
- 
-Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+/*
+ * Copyright (c) 1998, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
 
-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.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-</head>
-<body bgcolor="white">
-
+/**
 The Doclet API (also called the Javadoc API) provides a mechanism
-for clients to inspect the source-level structure of programs and 
+for clients to inspect the source-level structure of programs and
 libraries, including javadoc comments embedded in the source.
 This is useful for documentation, program checking, automatic
 code generation and many other tools.
 <p>
 
-Doclets are invoked by javadoc and use this API to write out 
+Doclets are invoked by javadoc and use this API to write out
 program information to files.  For example, the standard doclet is called
 by default and writes out documentation to HTML files.
 <p>
 
-The invocation is defined by the abstract {@link com.sun.javadoc.Doclet} class 
+The invocation is defined by the abstract {@link com.sun.javadoc.Doclet} class
 -- the entry point is the {@link com.sun.javadoc.Doclet#start(RootDoc) start} method:
 <pre>
     public static boolean <b>start</b>(RootDoc root)
 </pre>
 The {@link com.sun.javadoc.RootDoc} instance holds the root of the program structure
-information. From this root all other program structure 
-information can be extracted.  
+information. From this root all other program structure
+information can be extracted.
 <p>
 
 <a name="terminology"></a>
@@ -56,28 +51,28 @@
 
 <a name="included"></a>
 When calling javadoc, you pass in package names and source file names --
-these are called the <em>specified</em> packages and classes.  
-You also pass in Javadoc options; the <em>access control</em> Javadoc options 
-(<code>-public</code>, <code>-protected</code>, <code>-package</code>, 
-and <code>-private</code>) filter program elements, producing a 
+these are called the <em>specified</em> packages and classes.
+You also pass in Javadoc options; the <em>access control</em> Javadoc options
+(<code>-public</code>, <code>-protected</code>, <code>-package</code>,
+and <code>-private</code>) filter program elements, producing a
 result set, called the <em>included</em> set, or "documented" set.
-(The unfiltered set is also available through 
+(The unfiltered set is also available through
 {@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.)
 <p>
 
 <a name="class"></a>
 Throughout this API, the term <em>class</em> is normally a
-shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc}, 
+shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc},
 {@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and
 {@link com.sun.javadoc.PackageDoc#findClass(String) findClass(String)}.
-In only a couple of other places, it means "class, as opposed to interface", 
+In only a couple of other places, it means "class, as opposed to interface",
 as in:  {@link com.sun.javadoc.Doc#isClass()}.
 In the second sense, this API calls out four kinds of classes:
-{@linkplain com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes}, 
+{@linkplain com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes},
 {@linkplain com.sun.javadoc.Doc#isEnum() enums},
-{@linkplain com.sun.javadoc.Doc#isError() errors} and 
+{@linkplain com.sun.javadoc.Doc#isError() errors} and
 {@linkplain com.sun.javadoc.Doc#isException() exceptions}.
-Throughout the API, the detailed description of each program element 
+Throughout the API, the detailed description of each program element
 describes explicitly which meaning is being used.
 <p>
 
@@ -89,8 +84,8 @@
 
 <a name="example"></a>
 <h3>Example</h3>
- 
-The following is an example doclet that 
+
+The following is an example doclet that
 displays information in the <code>@param</code> tags of the processed
 classes:
 <pre>
@@ -117,17 +112,17 @@
                     + " - " + params[j].<font color=red title="Doclet API">parameterComment</font>());
             }
         }
-    }        
+    }
 }
 </pre>
-Interfaces and methods from the Javadoc API are marked in 
-<font color=red title="Doclet API">red</font>. 
-{@link com.sun.javadoc.Doclet Doclet} is an abstract class that specifies 
-the invocation interface for doclets, 
-{@link com.sun.javadoc.Doclet Doclet} holds class or interface information, 
+Interfaces and methods from the Javadoc API are marked in
+<font color=red title="Doclet API">red</font>.
+{@link com.sun.javadoc.Doclet Doclet} is an abstract class that specifies
+the invocation interface for doclets,
+{@link com.sun.javadoc.Doclet Doclet} holds class or interface information,
 {@link com.sun.javadoc.ExecutableMemberDoc} is a
-superinterface of {@link com.sun.javadoc.MethodDoc} and 
-{@link com.sun.javadoc.ConstructorDoc}, 
+superinterface of {@link com.sun.javadoc.MethodDoc} and
+{@link com.sun.javadoc.ConstructorDoc},
 and {@link com.sun.javadoc.ParamTag} holds information
 from "<code>@param</code>" tags.
 <p>
@@ -148,5 +143,6 @@
 </pre>
 @see com.sun.javadoc.Doclet
 @see com.sun.javadoc.RootDoc
-</BODY>
-</HTML>
+*/
+@jdk.Exported
+package com.sun.javadoc;
diff --git a/langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java b/langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java
index f951366..01236e7 100644
--- a/langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java
+++ b/langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java
@@ -25,7 +25,7 @@
 
 package com.sun.source.tree;
 
-import com.sun.tools.javac.util.List;
+import java.util.List;
 
 /**
  * A tree node for an expression to create a new instance of an array.
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/package-info.java b/langtools/src/share/classes/com/sun/tools/classfile/package-info.java
new file mode 100644
index 0000000..588ae3b
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/classfile/package-info.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+    A minimalist library to read and write class files into objects closely
+    based on the corresponding definitions in
+    <cite>The Java&trade; Virtual Machine Specification</cite> (JVMS).
+
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.classfile;
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/package.html b/langtools/src/share/classes/com/sun/tools/classfile/package.html
deleted file mode 100644
index 765dfb1..0000000
--- a/langtools/src/share/classes/com/sun/tools/classfile/package.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <title></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-  </head>
-  <body>
-    A minimalist library to read and write class files into objects closely 
-    based on the corresponding definitions in 
-    <cite>The Java&trade; Virtual Machine Specification</cite> (JVMS).
-  </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
index 9c20777..23f4f00 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
@@ -305,6 +305,6 @@
             buf.append(t.dimension());
         }
         buf.append(")");
-        return foundTypeVariable ? buf.toString() : null;
+        return foundTypeVariable ? writer.getName(buf.toString()) : null;
     }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
index 87a5bce..4b7ca05 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
@@ -89,10 +89,11 @@
      * @param memberlist List of members for the unicode character
      * @param contentTree the content tree to which the information will be added
      */
-    protected void addContents(Character unicode, List<? extends Doc> memberlist,
+    protected void addContents(Character uc, List<? extends Doc> memberlist,
             Content contentTree) {
-        contentTree.addContent(getMarkerAnchor("_" + unicode + "_"));
-        Content headContent = new StringContent(unicode.toString());
+        String unicode = uc.toString();
+        contentTree.addContent(getMarkerAnchorForIndex(unicode));
+        Content headContent = new StringContent(unicode);
         Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false,
                 HtmlStyle.title, headContent);
         contentTree.addContent(heading);
@@ -253,4 +254,24 @@
         addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
                 false, contentTree);
     }
+
+    /**
+     * Get the marker anchor which will be added to the index documentation tree.
+     *
+     * @param anchorNameForIndex the anchor name attribute for index page
+     * @return a content tree for the marker anchor
+     */
+    public Content getMarkerAnchorForIndex(String anchorNameForIndex) {
+        return getMarkerAnchor(getNameForIndex(anchorNameForIndex), null);
+    }
+
+    /**
+     * Generate a valid HTML name for member index page.
+     *
+     * @param unicode the string that needs to be converted to valid HTML name.
+     * @return a valid HTML name string.
+     */
+    public String getNameForIndex(String unicode) {
+        return "I:" + getName(unicode);
+    }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java
index f4c7c68..bb936d3 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java
@@ -88,7 +88,7 @@
             Content memberDetailsTree) {
         if (!writer.printedAnnotationFieldHeading) {
             memberDetailsTree.addContent(writer.getMarkerAnchor(
-                    "annotation_type_field_detail"));
+                    SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
             Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
                     writer.fieldDetailsLabel);
             memberDetailsTree.addContent(heading);
@@ -217,7 +217,7 @@
      */
     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
         memberTree.addContent(writer.getMarkerAnchor(
-                "annotation_type_field_summary"));
+                SectionName.ANNOTATION_TYPE_FIELD_SUMMARY));
     }
 
     /**
@@ -272,7 +272,8 @@
      */
     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
         if (link) {
-            return writer.getHyperLink("annotation_type_field_summary",
+            return writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_FIELD_SUMMARY,
                     writer.getResource("doclet.navField"));
         } else {
             return writer.getResource("doclet.navField");
@@ -284,7 +285,8 @@
      */
     protected void addNavDetailLink(boolean link, Content liNav) {
         if (link) {
-            liNav.addContent(writer.getHyperLink("annotation_type_field_detail",
+            liNav.addContent(writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_FIELD_DETAIL,
                     writer.getResource("doclet.navField")));
         } else {
             liNav.addContent(writer.getResource("doclet.navField"));
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
index ff8fc10..9a586a0 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
@@ -133,7 +133,7 @@
      */
     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
         memberTree.addContent(writer.getMarkerAnchor(
-                "annotation_type_optional_element_summary"));
+                SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY));
     }
 
     /**
@@ -141,7 +141,8 @@
      */
     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
         if (link) {
-            return writer.getHyperLink("annotation_type_optional_element_summary",
+            return writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY,
                     writer.getResource("doclet.navAnnotationTypeOptionalMember"));
         } else {
             return writer.getResource("doclet.navAnnotationTypeOptionalMember");
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
index 1833d26..bdbe8d5 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
@@ -89,7 +89,7 @@
             Content memberDetailsTree) {
         if (!writer.printedAnnotationHeading) {
             memberDetailsTree.addContent(writer.getMarkerAnchor(
-                    "annotation_type_element_detail"));
+                    SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
             Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
                     writer.annotationTypeDetailsLabel);
             memberDetailsTree.addContent(heading);
@@ -219,7 +219,7 @@
      */
     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
         memberTree.addContent(writer.getMarkerAnchor(
-                "annotation_type_required_element_summary"));
+                SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY));
     }
 
     /**
@@ -274,7 +274,8 @@
      */
     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
         if (link) {
-            return writer.getHyperLink("annotation_type_required_element_summary",
+            return writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY,
                     writer.getResource("doclet.navAnnotationTypeRequiredMember"));
         } else {
             return writer.getResource("doclet.navAnnotationTypeRequiredMember");
@@ -286,7 +287,8 @@
      */
     protected void addNavDetailLink(boolean link, Content liNav) {
         if (link) {
-            liNav.addContent(writer.getHyperLink("annotation_type_element_detail",
+            liNav.addContent(writer.getHyperLink(
+                    SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL,
                     writer.getResource("doclet.navAnnotationTypeMember")));
         } else {
             liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
index cb9ab3e..21f0c21 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
@@ -107,7 +107,8 @@
         //add link to summary
         Content link;
         if (packageName.length() == 0) {
-            link = getHyperLink(DocLink.fragment(DocletConstants.UNNAMED_PACKAGE_ANCHOR),
+            link = getHyperLink(getDocLink(
+                    SectionName.UNNAMED_PACKAGE_ANCHOR),
                     defaultPackageLabel, "", "");
         } else {
             Content packageNameContent = getPackageLabel(parsedPackageName);
@@ -153,7 +154,7 @@
         Content pkgNameContent;
         if (parsedPackageName.length() == 0) {
             summariesTree.addContent(getMarkerAnchor(
-                    DocletConstants.UNNAMED_PACKAGE_ANCHOR));
+                    SectionName.UNNAMED_PACKAGE_ANCHOR));
             pkgNameContent = defaultPackageLabel;
         } else {
             summariesTree.addContent(getMarkerAnchor(
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
index 4967370..856a482 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
@@ -97,7 +97,8 @@
             Content memberDetailsTree) {
         memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS);
         Content constructorDetailsTree = writer.getMemberTreeHeader();
-        constructorDetailsTree.addContent(writer.getMarkerAnchor("constructor_detail"));
+        constructorDetailsTree.addContent(writer.getMarkerAnchor(
+                SectionName.CONSTRUCTOR_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
                 writer.constructorDetailsLabel);
         constructorDetailsTree.addContent(heading);
@@ -256,7 +257,8 @@
      * {@inheritDoc}
      */
     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
-        memberTree.addContent(writer.getMarkerAnchor("constructor_summary"));
+        memberTree.addContent(writer.getMarkerAnchor(
+                SectionName.CONSTRUCTOR_SUMMARY));
     }
 
     /**
@@ -280,7 +282,7 @@
      */
     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
         if (link) {
-            return writer.getHyperLink("constructor_summary",
+            return writer.getHyperLink(SectionName.CONSTRUCTOR_SUMMARY,
                     writer.getResource("doclet.navConstructor"));
         } else {
             return writer.getResource("doclet.navConstructor");
@@ -292,7 +294,8 @@
      */
     protected void addNavDetailLink(boolean link, Content liNav) {
         if (link) {
-            liNav.addContent(writer.getHyperLink("constructor_detail",
+            liNav.addContent(writer.getHyperLink(
+                    SectionName.CONSTRUCTOR_DETAIL,
                     writer.getResource("doclet.navConstructor")));
         } else {
             liNav.addContent(writer.getResource("doclet.navConstructor"));
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
index 00135fc..63c8143 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
@@ -48,8 +48,8 @@
 
     private static final String[] ANCHORS = new String[] {
         "package", "interface", "class", "enum", "exception", "error",
-        "annotation_type", "field", "method", "constructor", "enum_constant",
-        "annotation_type_member"
+        "annotation.type", "field", "method", "constructor", "enum.constant",
+        "annotation.type.member"
     };
 
     private static final String[] HEADING_KEYS = new String[] {
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
index 382f16f..b971d07 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
@@ -73,7 +73,8 @@
             Content memberDetailsTree) {
         memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS);
         Content enumConstantsDetailsTree = writer.getMemberTreeHeader();
-        enumConstantsDetailsTree.addContent(writer.getMarkerAnchor("enum_constant_detail"));
+        enumConstantsDetailsTree.addContent(writer.getMarkerAnchor(
+                SectionName.ENUM_CONSTANT_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
                 writer.enumConstantsDetailsLabel);
         enumConstantsDetailsTree.addContent(heading);
@@ -202,7 +203,8 @@
      * {@inheritDoc}
      */
     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
-        memberTree.addContent(writer.getMarkerAnchor("enum_constant_summary"));
+        memberTree.addContent(writer.getMarkerAnchor(
+                SectionName.ENUM_CONSTANT_SUMMARY));
     }
 
     /**
@@ -263,11 +265,14 @@
      */
     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
         if (link) {
-            return writer.getHyperLink((cd == null)?
-                "enum_constant_summary":
-                "enum_constants_inherited_from_class_" +
-                configuration.getClassName(cd),
-                writer.getResource("doclet.navEnum"));
+            if (cd == null) {
+                return writer.getHyperLink(SectionName.ENUM_CONSTANT_SUMMARY,
+                        writer.getResource("doclet.navEnum"));
+            } else {
+                return writer.getHyperLink(
+                        SectionName.ENUM_CONSTANTS_INHERITANCE,
+                        configuration.getClassName(cd), writer.getResource("doclet.navEnum"));
+            }
         } else {
             return writer.getResource("doclet.navEnum");
         }
@@ -278,7 +283,8 @@
      */
     protected void addNavDetailLink(boolean link, Content liNav) {
         if (link) {
-            liNav.addContent(writer.getHyperLink("enum_constant_detail",
+            liNav.addContent(writer.getHyperLink(
+                    SectionName.ENUM_CONSTANT_DETAIL,
                     writer.getResource("doclet.navEnum")));
         } else {
             liNav.addContent(writer.getResource("doclet.navEnum"));
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
index f599ac2..1049671 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
@@ -74,7 +74,8 @@
             Content memberDetailsTree) {
         memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS);
         Content fieldDetailsTree = writer.getMemberTreeHeader();
-        fieldDetailsTree.addContent(writer.getMarkerAnchor("field_detail"));
+        fieldDetailsTree.addContent(writer.getMarkerAnchor(
+                SectionName.FIELD_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
                 writer.fieldDetailsLabel);
         fieldDetailsTree.addContent(heading);
@@ -224,7 +225,8 @@
      * {@inheritDoc}
      */
     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
-        memberTree.addContent(writer.getMarkerAnchor("field_summary"));
+        memberTree.addContent(writer.getMarkerAnchor(
+                SectionName.FIELD_SUMMARY));
     }
 
     /**
@@ -232,7 +234,7 @@
      */
     public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
         inheritedTree.addContent(writer.getMarkerAnchor(
-                "fields_inherited_from_class_" + configuration.getClassName(cd)));
+                SectionName.FIELDS_INHERITANCE, configuration.getClassName(cd)));
     }
 
     /**
@@ -293,11 +295,15 @@
      */
     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
         if (link) {
-            return writer.getHyperLink((cd == null)?
-                "field_summary":
-                "fields_inherited_from_class_" +
-                configuration.getClassName(cd),
-                writer.getResource("doclet.navField"));
+            if (cd == null) {
+                return writer.getHyperLink(
+                        SectionName.FIELD_SUMMARY,
+                        writer.getResource("doclet.navField"));
+            } else {
+                return writer.getHyperLink(
+                        SectionName.FIELDS_INHERITANCE,
+                        configuration.getClassName(cd), writer.getResource("doclet.navField"));
+            }
         } else {
             return writer.getResource("doclet.navField");
         }
@@ -308,7 +314,8 @@
      */
     protected void addNavDetailLink(boolean link, Content liNav) {
         if (link) {
-            liNav.addContent(writer.getHyperLink("field_detail",
+            liNav.addContent(writer.getHyperLink(
+                    SectionName.FIELD_DETAIL,
                     writer.getResource("doclet.navField")));
         } else {
             liNav.addContent(writer.getResource("doclet.navField"));
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
index 3bdcf6a..19a578c 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
@@ -509,28 +509,28 @@
                 body.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
                 navDiv.addStyle(HtmlStyle.topNav);
                 allClassesId += "navbar_top";
-                Content a = getMarkerAnchor("navbar_top");
+                Content a = getMarkerAnchor(SectionName.NAVBAR_TOP);
                 //WCAG - Hyperlinks should contain text or an image with alt text - for AT tools
                 navDiv.addContent(a);
                 Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
-                    DocLink.fragment("skip-navbar_top"), skipNavLinks,
+                    getDocLink(SectionName.SKIP_NAVBAR_TOP), skipNavLinks,
                     skipNavLinks.toString(), ""));
                 navDiv.addContent(skipLinkContent);
             } else {
                 body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
                 navDiv.addStyle(HtmlStyle.bottomNav);
                 allClassesId += "navbar_bottom";
-                Content a = getMarkerAnchor("navbar_bottom");
+                Content a = getMarkerAnchor(SectionName.NAVBAR_BOTTOM);
                 navDiv.addContent(a);
                 Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
-                    DocLink.fragment("skip-navbar_bottom"), skipNavLinks,
+                    getDocLink(SectionName.SKIP_NAVBAR_BOTTOM), skipNavLinks,
                     skipNavLinks.toString(), ""));
                 navDiv.addContent(skipLinkContent);
             }
             if (header) {
-                navDiv.addContent(getMarkerAnchor("navbar_top_firstrow"));
+                navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_TOP_FIRSTROW));
             } else {
-                navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow"));
+                navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_BOTTOM_FIRSTROW));
             }
             HtmlTree navList = new HtmlTree(HtmlTag.UL);
             navList.addStyle(HtmlStyle.navList);
@@ -577,11 +577,11 @@
             subDiv.addContent(getAllClassesLinkScript(allClassesId.toString()));
             addSummaryDetailLinks(subDiv);
             if (header) {
-                subDiv.addContent(getMarkerAnchor("skip-navbar_top"));
+                subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_TOP));
                 body.addContent(subDiv);
                 body.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
             } else {
-                subDiv.addContent(getMarkerAnchor("skip-navbar_bottom"));
+                subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM));
                 body.addContent(subDiv);
                 body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
             }
@@ -886,7 +886,28 @@
      * @return a content tree for the marker anchor
      */
     public Content getMarkerAnchor(String anchorName) {
-        return getMarkerAnchor(anchorName, null);
+        return getMarkerAnchor(getName(anchorName), null);
+    }
+
+    /**
+     * Get the marker anchor which will be added to the documentation tree.
+     *
+     * @param sectionName the section name anchor attribute for page
+     * @return a content tree for the marker anchor
+     */
+    public Content getMarkerAnchor(SectionName sectionName) {
+        return getMarkerAnchor(sectionName.getName(), null);
+    }
+
+    /**
+     * Get the marker anchor which will be added to the documentation tree.
+     *
+     * @param sectionName the section name anchor attribute for page
+     * @param anchorName the anchor name combined with section name attribute for the page
+     * @return a content tree for the marker anchor
+     */
+    public Content getMarkerAnchor(SectionName sectionName, String anchorName) {
+        return getMarkerAnchor(sectionName.getName() + getName(anchorName), null);
     }
 
     /**
@@ -1291,10 +1312,10 @@
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
             return getLink(new LinkInfoImpl(configuration, context, classDoc)
-                .label(label).where(getAnchor(emd, isProperty)).strong(strong));
+                .label(label).where(getName(getAnchor(emd, isProperty))).strong(strong));
         } else if (doc instanceof MemberDoc) {
             return getLink(new LinkInfoImpl(configuration, context, classDoc)
-                .label(label).where(doc.name()).strong(strong));
+                .label(label).where(getName(doc.name())).strong(strong));
         } else {
             return label;
         }
@@ -1319,10 +1340,10 @@
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc) doc;
             return getLink(new LinkInfoImpl(configuration, context, classDoc)
-                .label(label).where(getAnchor(emd)));
+                .label(label).where(getName(getAnchor(emd))));
         } else if (doc instanceof MemberDoc) {
             return getLink(new LinkInfoImpl(configuration, context, classDoc)
-                .label(label).where(doc.name()));
+                .label(label).where(getName(doc.name())));
         } else {
             return label;
         }
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
index 8918889..8597ada 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
@@ -49,8 +49,6 @@
         implements SerializedFormWriter.SerialFieldWriter {
     ProgramElementDoc[] members = null;
 
-    private boolean printedOverallAnchor = false;
-
     public HtmlSerialFieldWriter(SubWriterHolderWriter writer,
                                     ClassDoc classdoc) {
         super(writer, classdoc);
@@ -98,10 +96,6 @@
         HtmlTree li = new HtmlTree(HtmlTag.LI);
         li.addStyle(HtmlStyle.blockList);
         if (serializableFieldsTree.isValid()) {
-            if (!printedOverallAnchor) {
-                li.addContent(writer.getMarkerAnchor("serializedForm"));
-                printedOverallAnchor = true;
-            }
             Content headingContent = new StringContent(heading);
             Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
                     headingContent);
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
index 4e5da21..082745d 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java
@@ -85,12 +85,10 @@
      * @return a content tree for the serializable methods content
      */
     public Content getSerializableMethods(String heading, Content serializableMethodContent) {
-        Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor(
-                "serialized_methods"));
         Content headingContent = new StringContent(heading);
         Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
                 headingContent);
-        li.addContent(serialHeading);
+        Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading);
         li.addContent(serializableMethodContent);
         return li;
     }
@@ -113,8 +111,6 @@
      * @param methodsContentTree the content tree to which the member header will be added
      */
     public void addMemberHeader(MethodDoc member, Content methodsContentTree) {
-        methodsContentTree.addContent(writer.getMarkerAnchor(
-                writer.getAnchor(member)));
         methodsContentTree.addContent(getHead(member));
         methodsContentTree.addContent(getSignature(member));
     }
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
index bb67b99..8b3712d 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
@@ -85,7 +85,8 @@
             Content memberDetailsTree) {
         memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS);
         Content methodDetailsTree = writer.getMemberTreeHeader();
-        methodDetailsTree.addContent(writer.getMarkerAnchor("method_detail"));
+        methodDetailsTree.addContent(writer.getMarkerAnchor(
+                SectionName.METHOD_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
                 writer.methodDetailsLabel);
         methodDetailsTree.addContent(heading);
@@ -244,7 +245,8 @@
      * {@inheritDoc}
      */
     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
-        memberTree.addContent(writer.getMarkerAnchor("method_summary"));
+        memberTree.addContent(writer.getMarkerAnchor(
+                SectionName.METHOD_SUMMARY));
     }
 
     /**
@@ -252,8 +254,7 @@
      */
     public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
         inheritedTree.addContent(writer.getMarkerAnchor(
-                "methods_inherited_from_class_" +
-                configuration.getClassName(cd)));
+                SectionName.METHODS_INHERITANCE, configuration.getClassName(cd)));
     }
 
     /**
@@ -318,7 +319,7 @@
             Content methlink = writer.getLink(
                     new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
                     overriddenType.asClassDoc())
-                    .where(writer.getAnchor(method)).label(name));
+                    .where(writer.getName(writer.getAnchor(method))).label(name));
             Content codeMethLink = HtmlTree.CODE(methlink);
             Content dd = HtmlTree.DD(codeMethLink);
             dd.addContent(writer.getSpace());
@@ -400,11 +401,15 @@
      */
     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
         if (link) {
-            return writer.getHyperLink((cd == null)?
-                "method_summary":
-                "methods_inherited_from_class_" +
-                configuration.getClassName(cd),
-                writer.getResource("doclet.navMethod"));
+            if (cd == null) {
+                return writer.getHyperLink(
+                        SectionName.METHOD_SUMMARY,
+                        writer.getResource("doclet.navMethod"));
+            } else {
+                return writer.getHyperLink(
+                        SectionName.METHODS_INHERITANCE,
+                        configuration.getClassName(cd), writer.getResource("doclet.navMethod"));
+            }
         } else {
             return writer.getResource("doclet.navMethod");
         }
@@ -415,8 +420,8 @@
      */
     protected void addNavDetailLink(boolean link, Content liNav) {
         if (link) {
-            liNav.addContent(writer.getHyperLink("method_detail",
-                    writer.getResource("doclet.navMethod")));
+            liNav.addContent(writer.getHyperLink(
+                    SectionName.METHOD_DETAIL, writer.getResource("doclet.navMethod")));
         } else {
             liNav.addContent(writer.getResource("doclet.navMethod"));
         }
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
index d44dd25..d0537af 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
@@ -132,7 +132,8 @@
      * {@inheritDoc}
      */
     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
-        memberTree.addContent(writer.getMarkerAnchor("nested_class_summary"));
+        memberTree.addContent(writer.getMarkerAnchor(
+                SectionName.NESTED_CLASS_SUMMARY));
     }
 
     /**
@@ -140,7 +141,8 @@
      */
     public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
         inheritedTree.addContent(writer.getMarkerAnchor(
-                "nested_classes_inherited_from_class_" + cd.qualifiedName()));
+                SectionName.NESTED_CLASSES_INHERITANCE,
+                cd.qualifiedName()));
     }
 
     /**
@@ -202,9 +204,15 @@
      */
     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
         if (link) {
-            return writer.getHyperLink((cd == null) ? "nested_class_summary":
-                "nested_classes_inherited_from_class_" + cd.qualifiedName(),
-                writer.getResource("doclet.navNested"));
+            if (cd == null) {
+                return writer.getHyperLink(
+                        SectionName.NESTED_CLASS_SUMMARY,
+                        writer.getResource("doclet.navNested"));
+            } else {
+                return writer.getHyperLink(
+                        SectionName.NESTED_CLASSES_INHERITANCE,
+                        cd.qualifiedName(), writer.getResource("doclet.navNested"));
+            }
         } else {
             return writer.getResource("doclet.navNested");
         }
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
index caf0e09..ffb93b7 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
@@ -203,8 +203,9 @@
             Content see = seeLabel;
             see.addContent(" ");
             Content descPara = HtmlTree.P(see);
-            Content descLink = getHyperLink(DocLink.fragment("overview_description"),
-                descriptionLabel, "", "");
+            Content descLink = getHyperLink(getDocLink(
+                    SectionName.OVERVIEW_DESCRIPTION),
+                    descriptionLabel, "", "");
             descPara.addContent(descLink);
             div.addContent(descPara);
             body.addContent(div);
@@ -220,7 +221,8 @@
      */
     protected void addOverviewComment(Content htmltree) {
         if (root.inlineTags().length > 0) {
-            htmltree.addContent(getMarkerAnchor("overview_description"));
+            htmltree.addContent(
+                    getMarkerAnchor(SectionName.OVERVIEW_DESCRIPTION));
             addInlineComment(root, htmltree);
         }
     }
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
index f0325b5..c19bf2d 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
@@ -112,7 +112,8 @@
             addSummaryComment(packageDoc, docSummaryDiv);
             div.addContent(docSummaryDiv);
             Content space = getSpace();
-            Content descLink = getHyperLink(DocLink.fragment("package_description"),
+            Content descLink = getHyperLink(getDocLink(
+                    SectionName.PACKAGE_DESCRIPTION),
                     descriptionLabel, "", "");
             Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
             div.addContent(descPara);
@@ -211,7 +212,8 @@
      */
     public void addPackageDescription(Content packageContentTree) {
         if (packageDoc.inlineTags().length > 0) {
-            packageContentTree.addContent(getMarkerAnchor("package_description"));
+            packageContentTree.addContent(
+                    getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
             Content h2Content = new StringContent(
                     configuration.getText("doclet.Package_Description",
                     packageDoc.name()));
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java
index 1de03f4..7f2c6e6 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java
@@ -129,7 +129,8 @@
             addSummaryComment(packageDoc, docSummaryDiv);
             div.addContent(docSummaryDiv);
             Content space = getSpace();
-            Content descLink = getHyperLink(DocLink.fragment("package_description"),
+            Content descLink = getHyperLink(getDocLink(
+                    SectionName.PACKAGE_DESCRIPTION),
                     descriptionLabel, "", "");
             Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
             div.addContent(descPara);
@@ -192,7 +193,8 @@
      */
     public void addPackageDescription(Content packageContentTree) {
         if (packageDoc.inlineTags().length > 0) {
-            packageContentTree.addContent(getMarkerAnchor("package_description"));
+            packageContentTree.addContent(
+                    getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
             Content h2Content = new StringContent(
                     configuration.getText("doclet.Package_Description",
                     packageDoc.name()));
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java
index 838732b..9bf4bf0 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java
@@ -70,7 +70,8 @@
             Content memberDetailsTree) {
         memberDetailsTree.addContent(HtmlConstants.START_OF_PROPERTY_DETAILS);
         Content propertyDetailsTree = writer.getMemberTreeHeader();
-        propertyDetailsTree.addContent(writer.getMarkerAnchor("property_detail"));
+        propertyDetailsTree.addContent(writer.getMarkerAnchor(
+                SectionName.PROPERTY_DETAIL));
         Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
                 writer.propertyDetailsLabel);
         propertyDetailsTree.addContent(heading);
@@ -220,7 +221,8 @@
      * {@inheritDoc}
      */
     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
-        memberTree.addContent(writer.getMarkerAnchor("property_summary"));
+        memberTree.addContent(writer.getMarkerAnchor(
+                SectionName.PROPERTY_SUMMARY));
     }
 
     /**
@@ -228,7 +230,8 @@
      */
     public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
         inheritedTree.addContent(writer.getMarkerAnchor(
-                "properties_inherited_from_class_" + configuration.getClassName(cd)));
+                SectionName.PROPERTIES_INHERITANCE,
+                configuration.getClassName(cd)));
     }
 
     /**
@@ -297,11 +300,15 @@
      */
     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
         if (link) {
-            return writer.getHyperLink((cd == null)?
-                "property_summary":
-                "properties_inherited_from_class_" +
-                configuration.getClassName(cd),
+            if (cd == null) {
+                return writer.getHyperLink(
+                SectionName.PROPERTY_SUMMARY,
                 writer.getResource("doclet.navProperty"));
+            } else {
+                return writer.getHyperLink(
+                SectionName.PROPERTIES_INHERITANCE,
+                configuration.getClassName(cd), writer.getResource("doclet.navProperty"));
+            }
         } else {
             return writer.getResource("doclet.navProperty");
         }
@@ -312,7 +319,8 @@
      */
     protected void addNavDetailLink(boolean link, Content liNav) {
         if (link) {
-            liNav.addContent(writer.getHyperLink("property_detail",
+            liNav.addContent(writer.getHyperLink(
+                    SectionName.PROPERTY_DETAIL,
                     writer.getResource("doclet.navProperty")));
         } else {
             liNav.addContent(writer.getResource("doclet.navProperty"));
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SectionName.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SectionName.java
new file mode 100644
index 0000000..b27949f
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SectionName.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+/**
+ * Enum representing various section names of generated API documentation.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public enum SectionName {
+
+    ANNOTATION_TYPE_ELEMENT_DETAIL("annotation.type.element.detail"),
+    ANNOTATION_TYPE_FIELD_DETAIL("annotation.type.field.detail"),
+    ANNOTATION_TYPE_FIELD_SUMMARY("annotation.type.field.summary"),
+    ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY("annotation.type.optional.element.summary"),
+    ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY("annotation.type.required.element.summary"),
+    CONSTRUCTOR_DETAIL("constructor.detail"),
+    CONSTRUCTOR_SUMMARY("constructor.summary"),
+    ENUM_CONSTANT_DETAIL("enum.constant.detail"),
+    ENUM_CONSTANTS_INHERITANCE("enum.constants.inherited.from.class."),
+    ENUM_CONSTANT_SUMMARY("enum.constant.summary"),
+    FIELD_DETAIL("field.detail"),
+    FIELDS_INHERITANCE("fields.inherited.from.class."),
+    FIELD_SUMMARY("field.summary"),
+    METHOD_DETAIL("method.detail"),
+    METHODS_INHERITANCE("methods.inherited.from.class."),
+    METHOD_SUMMARY("method.summary"),
+    NAVBAR_BOTTOM("navbar.bottom"),
+    NAVBAR_BOTTOM_FIRSTROW("navbar.bottom.firstrow"),
+    NAVBAR_TOP("navbar.top"),
+    NAVBAR_TOP_FIRSTROW("navbar.top.firstrow"),
+    NESTED_CLASSES_INHERITANCE("nested.classes.inherited.from.class."),
+    NESTED_CLASS_SUMMARY("nested.class.summary"),
+    OVERVIEW_DESCRIPTION("overview.description"),
+    PACKAGE_DESCRIPTION("package.description"),
+    PROPERTY_DETAIL("property.detail"),
+    PROPERTIES_INHERITANCE("properties.inherited.from.class."),
+    PROPERTY_SUMMARY("property.summary"),
+    SKIP_NAVBAR_BOTTOM("skip.navbar.bottom"),
+    SKIP_NAVBAR_TOP("skip.navbar.top"),
+    UNNAMED_PACKAGE_ANCHOR("unnamed.package");
+
+    private final String value;
+
+    SectionName(String sName) {
+        this.value = sName;
+    }
+
+    public String getName() {
+        return this.value;
+    }
+}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
index 43718e4..a561a03 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java
@@ -115,7 +115,8 @@
         for (int i = 0; i < indexbuilder.elements().length; i++) {
             String unicode = (indexbuilder.elements())[i].toString();
             contentTree.addContent(
-                    getHyperLink("_" + unicode + "_", new StringContent(unicode)));
+                    getHyperLink(getNameForIndex(unicode),
+                    new StringContent(unicode)));
             contentTree.addContent(getSpace());
         }
     }
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
index 95e9a74..7ff2e2e 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
@@ -118,7 +118,8 @@
                 if (deprs.length > 0) {
                     Content body = commentTagsToOutput(null, doc,
                         deprs[0].inlineTags(), false);
-                    result.addContent(HtmlTree.SPAN(HtmlStyle.italic, body));
+                    if (!body.isEmpty())
+                        result.addContent(HtmlTree.SPAN(HtmlStyle.italic, body));
                 }
             } else {
                 if (Util.isDeprecated(member.containingClass())) {
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java
index a586627..58eb68c 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java
@@ -41,8 +41,6 @@
     @Override
     public void addContent(Content content) {
         nullCheck(content);
-        if ((content instanceof ContentBuilder) && content.isEmpty())
-            return;
         ensureMutableContents();
         if (content instanceof ContentBuilder) {
             contents.addAll(((ContentBuilder) content).contents);
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
index c780e96..ee8cc9c 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
@@ -30,6 +30,7 @@
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.formats.html.ConfigurationImpl;
+import com.sun.tools.doclets.formats.html.SectionName;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.DocFile;
 import com.sun.tools.doclets.internal.toolkit.util.DocLink;
@@ -78,7 +79,7 @@
     }
 
     /**
-     * Get Html Hyper Link string.
+     * Get Html Hyper Link Content.
      *
      * @param where      Position of the link in the file. Character '#' is not
      *                   needed.
@@ -87,7 +88,125 @@
      */
     public Content getHyperLink(String where,
                                Content label) {
-        return getHyperLink(DocLink.fragment(where), label, "", "");
+        return getHyperLink(getDocLink(where), label, "", "");
+    }
+
+    /**
+     * Get Html Hyper Link Content.
+     *
+     * @param sectionName      The section name to which the link will be created.
+     * @param label            Tag for the link.
+     * @return a content tree for the hyper link
+     */
+    public Content getHyperLink(SectionName sectionName,
+                               Content label) {
+        return getHyperLink(getDocLink(sectionName), label, "", "");
+    }
+
+    /**
+     * Get Html Hyper Link Content.
+     *
+     * @param sectionName      The section name combined with where to which the link
+     *                         will be created.
+     * @param where            The fragment combined with sectionName to which the link
+     *                         will be created.
+     * @param label            Tag for the link.
+     * @return a content tree for the hyper link
+     */
+    public Content getHyperLink(SectionName sectionName, String where,
+                               Content label) {
+        return getHyperLink(getDocLink(sectionName, where), label, "", "");
+    }
+
+    /**
+     * Get the link.
+     *
+     * @param where      Position of the link in the file.
+     * @return a DocLink object for the hyper link
+     */
+    public DocLink getDocLink(String where) {
+        return DocLink.fragment(getName(where));
+    }
+
+    /**
+     * Get the link.
+     *
+     * @param sectionName      The section name to which the link will be created.
+     * @return a DocLink object for the hyper link
+     */
+    public DocLink getDocLink(SectionName sectionName) {
+        return DocLink.fragment(sectionName.getName());
+    }
+
+    /**
+     * Get the link.
+     *
+     * @param sectionName      The section name combined with where to which the link
+     *                         will be created.
+     * @param where            The fragment combined with sectionName to which the link
+     *                         will be created.
+     * @return a DocLink object for the hyper link
+     */
+    public DocLink getDocLink(SectionName sectionName, String where) {
+        return DocLink.fragment(sectionName.getName() + getName(where));
+    }
+
+    /**
+     * Convert the name to a valid HTML name.
+     *
+     * @param name the name that needs to be converted to valid HTML name.
+     * @return a valid HTML name string.
+     */
+    public String getName(String name) {
+        StringBuilder sb = new StringBuilder();
+        char ch;
+        /* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions
+         * that the name/id should begin with a letter followed by other valid characters.
+         * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction
+         * is that it should be at least one character long and should not contain spaces.
+         * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute.
+         *
+         * For HTML 4, we need to check for non-characters at the beginning of the name and
+         * substitute it accordingly, "_" and "$" can appear at the beginning of a member name.
+         * The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z".
+         */
+        for (int i = 0; i < name.length(); i++) {
+            ch = name.charAt(i);
+            switch (ch) {
+                case '(':
+                case ')':
+                case '<':
+                case '>':
+                case ',':
+                    sb.append('-');
+                    break;
+                case ' ':
+                case '[':
+                    break;
+                case ']':
+                    sb.append(":A");
+                    break;
+                // Any appearance of $ needs to be substituted with ":D" and not with hyphen
+                // since a field name "P$$ and a method P(), both valid member names, can end
+                // up as "P--". A member name beginning with $ needs to be substituted with
+                // "Z:Z:D".
+                case '$':
+                    if (i == 0)
+                        sb.append("Z:Z");
+                    sb.append(":D");
+                    break;
+                // A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor
+                // names can only begin with a letter.
+                case '_':
+                    if (i == 0)
+                        sb.append("Z:Z");
+                    sb.append(ch);
+                    break;
+                default:
+                    sb.append(ch);
+            }
+        }
+        return sb.toString();
     }
 
     /**
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
index e0badbe..8ad5fa2 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
@@ -102,7 +102,12 @@
      * @param tagContent tag content to be added
      */
     public void addContent(Content tagContent) {
-        if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
+        if (tagContent instanceof ContentBuilder) {
+            for (Content content: ((ContentBuilder)tagContent).contents) {
+                addContent(content);
+            }
+        }
+        else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
             if (content.isEmpty())
                 content = new ArrayList<Content>();
             content.add(tagContent);
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
index 0764a6b..f74c084 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
@@ -312,7 +312,7 @@
             String scriptCode = "<!--" + DocletConstants.NL +
                     "    try {" + DocletConstants.NL +
                     "        if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
-                    "            parent.document.title=\"" + winTitle + "\";" + DocletConstants.NL +
+                    "            parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL +
                     "        }" + DocletConstants.NL +
                     "    }" + DocletConstants.NL +
                     "    catch(err) {" + DocletConstants.NL +
@@ -325,6 +325,53 @@
     }
 
     /**
+     * Returns a String with escaped special JavaScript characters.
+     *
+     * @param s String that needs to be escaped
+     * @return a valid escaped JavaScript string
+     */
+    private static String escapeJavaScriptChars(String s) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < s.length(); i++) {
+            char ch = s.charAt(i);
+            switch (ch) {
+                case '\b':
+                    sb.append("\\b");
+                    break;
+                case '\t':
+                    sb.append("\\t");
+                    break;
+                case '\n':
+                    sb.append("\\n");
+                    break;
+                case '\f':
+                    sb.append("\\f");
+                    break;
+                case '\r':
+                    sb.append("\\r");
+                    break;
+                case '"':
+                    sb.append("\\\"");
+                    break;
+                case '\'':
+                    sb.append("\\\'");
+                    break;
+                case '\\':
+                    sb.append("\\\\");
+                    break;
+                default:
+                    if (ch < 32 || ch >= 127) {
+                        sb.append(String.format("\\u%04X", (int)ch));
+                    } else {
+                        sb.append(ch);
+                    }
+                    break;
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
      * Returns a content tree for the SCRIPT tag for the main page(index.html).
      *
      * @return a content for the SCRIPT tag
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/package-info.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/package-info.java
new file mode 100644
index 0000000..3503e95
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2007, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+    This package contains classes that write HTML markup tags.
+
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+ */
+@jdk.Exported(false)
+package com.sun.tools.doclets.formats.html.markup;
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/package.html b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/package.html
deleted file mode 100644
index 7030fae..0000000
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/package.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
- Copyright (c) 2003, 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.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.formats.html.markup package</title>
-<body bgcolor="white">
-        This package contains classes that write HTML markup tags.
-    </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/package-info.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/package-info.java
new file mode 100644
index 0000000..e4d51f6
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/package-info.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2003, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+    This is the default doclet provided with JDK that produces Javadoc's
+    default HTML-formatted API output.  For more documentation
+    on this doclet, please refer to the link below.
+
+    @see <a href="http://www.java.sun.com/javadoc/standard-doclet.html">
+            http://www.java.sun.com/javadoc/standard-doclet.html </a>
+
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.formats.html;
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/package.html b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/package.html
deleted file mode 100644
index ef2bcd2..0000000
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/package.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
- Copyright (c) 2003, 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.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.formats.html package</title>
-</head>
-<body bgcolor="white">
-        This is the default doclet provided with JDK that produces Javadoc's 
-        default HTML-formatted API output.  For more documentation
-        on this doclet, please refer to the link below.
-        
-        @see <a href="http://www.java.sun.com/javadoc/standard-doclet.html">
-                http://www.java.sun.com/javadoc/standard-doclet.html </a>
-    </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package-info.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package-info.java
new file mode 100644
index 0000000..a5e2db3
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package-info.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+    This doclet-independent package has a set of classes and
+    interfaces that are the building blocks for doclets. They
+    define the basic structure of doclets and make doclet
+    writing much easier because they provide the content generation
+    code to be shared among different doclets. Builders only provide
+    the structure and content of API documentation.
+    They will not provide any style markup.
+
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit.builders;
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package.html b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package.html
deleted file mode 100644
index ab9d7ad..0000000
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!--
- Copyright (c) 2003, 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.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.internal.toolkit.builders package</title>
-</head>
-<body bgcolor="white">
-        This doclet-independent package has a set of classes and 
-        interfaces that are the building blocks for doclets. They 
-        define the basic structure of doclets and make doclet
-        writing much easier because they provide the content generation 
-        code to be shared among different doclets. Builders only provide 
-        the structure and content of API documentation.
-        They will not provide any style markup.
-        <p>
-        This code is not part of an API.
-        It is implementation that is subject to change.
-        Do not use it as an API.
-    </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/package-info.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/package-info.java
new file mode 100644
index 0000000..5e3f61f
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/package-info.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2003, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+    Contains the base classes that make up a doclet.  Doclets that reuse
+    the functionality provided by the toolkit should have the following
+    characteristics:
+    <ul>
+        <li>
+            The main driver class should extend
+            {@link com.sun.tools.doclets.internal.toolkit.AbstractDoclet}.
+        </li>
+        <li>
+            The doclet configuration class should extend
+            {@link com.sun.tools.doclets.internal.toolkit.Configuration}.
+        </li>
+        <li>
+            The doclet should have a writer factory that implements
+            {@link com.sun.tools.doclets.internal.toolkit.WriterFactory}.
+            This class constructs writers that write doclet specific output.
+        </li>
+        <li>
+            The doclet should have a taglet writer that extends
+            {@link com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter}.
+             This writer determines how to output each given tag.
+        </li>
+    </ul>
+
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit;
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/package.html b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/package.html
deleted file mode 100644
index 65d21d5..0000000
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/package.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!--
- Copyright (c) 2003, 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.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.internal.toolkit package</title>
-</head>
-<body bgcolor="white">
-
-        Contains the base classes that make up a doclet.  Doclets that reuse
-        the functionality provided by the toolkit should have the following
-        characteristics:
-        <ul>
-            <li> 
-                The main driver class should extend 
-                {@link com.sun.tools.doclets.internal.toolkit.AbstractDoclet}.
-            </li>
-            <li> 
-                The doclet configuration class should extend 
-                {@link com.sun.tools.doclets.internal.toolkit.Configuration}.
-            </li>
-            <li> 
-                The doclet should have a writer factory that implements
-                {@link com.sun.tools.doclets.internal.toolkit.WriterFactory}.  
-                This class constructs writers that write doclet specific output.
-            </li>
-            <li> 
-                The doclet should have a taglet writer that extends
-                {@link com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter}. 
-                 This writer determines how to output each given tag.
-            </li>
-    </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package-info.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package-info.java
new file mode 100644
index 0000000..cb7d6b6
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package-info.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2003, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+    This package has classes used to generate Javadoc tag documentation.
+    Doclets no longer have to implement its own version of standard tags
+    such as &#64;param and &#64;throws.  This is the single, doclet
+    implementation of each standard tag that is shared by all
+    doclets.  Each doclet must have a taglet writer that takes a taglet
+    as input and writes doclet-dependent output. The taglet itself will
+    do the tag processing. For example, suppose we are outputing
+    &#64;throws tags. The taglet would:
+    <ul>
+        <li> Retrieve the list of throws tags to be documented.
+        <li> Replace {&#64;inheritDoc} with the appropriate documentation.
+        <li> Add throws documentation for exceptions that are declared in
+             the signature of the method but
+             not documented with the throws tags.
+    </ul>
+    After doing the steps above, the taglet would pass the information to
+    the taglet writer for writing. The taglets are essentially builders for
+    tags.
+
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit.taglets;
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package.html b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package.html
deleted file mode 100644
index 14034c0..0000000
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!--
- Copyright (c) 2003, 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.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.internal.toolkit.taglets package</title>
-</head>
-<body bgcolor="white">
-        This package has classes used to generate Javadoc tag documentation. 
-        Doclets no longer have to implement its own version of standard tags 
-        such as &#64;param and &#64;throws.  This is the single, doclet 
-        implementation of each standard tag that is shared by all
-        doclets.  Each doclet must have a taglet writer that takes a taglet 
-        as input and writes doclet-dependent output. The taglet itself will 
-        do the tag processing. For example, suppose we are outputing
-        &#64;throws tags. The taglet would:
-        <ul>
-            <li> Retrieve the list of throws tags to be documented.
-            <li> Replace {&#64;inheritDoc} with the appropriate documentation.
-            <li> Add throws documentation for exceptions that are declared in 
-            	 the signature of the method but
-                 not documented with the throws tags.
-        </ul>
-        After doing the steps above, the taglet would pass the information to 
-        the taglet writer for writing. The taglets are essentially builders for 
-        tags.
-        <p>
-        This code is not part of an API.
-        It is implementation that is subject to change.
-        Do not use it as an API.
-    </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java
index c76b2ed..5742cd0 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java
@@ -58,9 +58,4 @@
      * The default package file name.
      */
     public static final String DEFAULT_PACKAGE_FILE_NAME = "default";
-
-    /**
-     * The anchor for the default package.
-     */
-    public static final String UNNAMED_PACKAGE_ANCHOR = "unnamed_package";
 }
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package-info.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package-info.java
new file mode 100644
index 0000000..7244b53
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package-info.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2003, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+    Provides a factory for constructing links.
+
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit.util.links;
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package.html b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package.html
deleted file mode 100644
index b58ed33..0000000
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- Copyright (c) 2003, 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.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.interal.toolkit.util.links package</title>
-</head>
-<body bgcolor="white">
-        Provides a factory for constructing links.
-    </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/package-info.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/package-info.java
new file mode 100644
index 0000000..39f37a3
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/package-info.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+    This package has utility classes that perform common services required
+    for API documentation generation.
+
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit.util;
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/package.html b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/package.html
deleted file mode 100644
index 3b46f51..0000000
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/package.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
- Copyright (c) 2003, 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.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.internal.toolkit.util package</title>
-</head>
-<body bgcolor="white">
-        This package has utility classes that perform common services required 
-        for API documentation generation.
-        <p>
-        This code is not part of an API.
-        It is implementation that is subject to change.
-        Do not use it as an API.
-    </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/package-info.java b/langtools/src/share/classes/com/sun/tools/doclets/package-info.java
new file mode 100644
index 0000000..6df5c2b
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/package-info.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+    As of JDK version 1.5, replaced by
+    {@code com.sun.tools.doclets.internal.toolkit.util}.
+
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets;
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/package.html b/langtools/src/share/classes/com/sun/tools/doclets/package.html
deleted file mode 100644
index bc5abe1..0000000
--- a/langtools/src/share/classes/com/sun/tools/doclets/package.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
- Copyright (c) 2003, 2012, 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.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<head>
-<title>com.sun.tools/doclets package</title>
-</head>
-<body bgcolor="white">
-        As of JDK version 1.5, replaced by 
-        {@code com.sun.tools.doclets.internal.toolkit.util}.
-    </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java
index bc4b86b..d3ed9c2 100644
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java
@@ -213,6 +213,7 @@
     public Void visitDocComment(DocCommentTree tree, Void ignore) {
         super.visitDocComment(tree, ignore);
         for (TagStackItem tsi: tagStack) {
+            warnIfEmpty(tsi, null);
             if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT
                     && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) {
                 StartElementTree t = (StartElementTree) tsi.tree;
@@ -270,7 +271,6 @@
 
     @Override
     public Void visitStartElement(StartElementTree tree, Void ignore) {
-        markEnclosingTag(Flag.HAS_ELEMENT);
         final Name treeName = tree.getName();
         final HtmlTag t = HtmlTag.get(treeName);
         if (t == null) {
@@ -279,7 +279,10 @@
             boolean done = false;
             for (TagStackItem tsi: tagStack) {
                 if (tsi.tag.accepts(t)) {
-                    while (tagStack.peek() != tsi) tagStack.pop();
+                    while (tagStack.peek() != tsi) {
+                        warnIfEmpty(tagStack.peek(), null);
+                        tagStack.pop();
+                    }
                     done = true;
                     break;
                 } else if (tsi.tag.endKind != HtmlTag.EndKind.OPTIONAL) {
@@ -288,9 +291,13 @@
                 }
             }
             if (!done && HtmlTag.BODY.accepts(t)) {
-                tagStack.clear();
+                while (!tagStack.isEmpty()) {
+                    warnIfEmpty(tagStack.peek(), null);
+                    tagStack.pop();
+                }
             }
 
+            markEnclosingTag(Flag.HAS_ELEMENT);
             checkStructure(tree, t);
 
             // tag specific checks
@@ -447,12 +454,7 @@
                                         "dc.no.summary.or.caption.for.table");
                             }
                     }
-                    if (t.flags.contains(HtmlTag.Flag.EXPECT_CONTENT)
-                            && !top.flags.contains(Flag.HAS_TEXT)
-                            && !top.flags.contains(Flag.HAS_ELEMENT)
-                            && !top.flags.contains(Flag.HAS_INLINE_TAG)) {
-                        env.messages.warning(HTML, tree, "dc.tag.empty", treeName);
-                    }
+                    warnIfEmpty(top, tree);
                     tagStack.pop();
                     done = true;
                     break;
@@ -485,6 +487,20 @@
 
         return super.visitEndElement(tree, ignore);
     }
+
+    void warnIfEmpty(TagStackItem tsi, DocTree endTree) {
+        if (tsi.tag != null && tsi.tree instanceof StartElementTree) {
+            if (tsi.tag.flags.contains(HtmlTag.Flag.EXPECT_CONTENT)
+                    && !tsi.flags.contains(Flag.HAS_TEXT)
+                    && !tsi.flags.contains(Flag.HAS_ELEMENT)
+                    && !tsi.flags.contains(Flag.HAS_INLINE_TAG)) {
+                DocTree tree = (endTree != null) ? endTree : tsi.tree;
+                Name treeName = ((StartElementTree) tsi.tree).getName();
+                env.messages.warning(HTML, tree, "dc.tag.empty", treeName);
+            }
+        }
+    }
+
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="HTML attributes">
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java b/langtools/src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java
new file mode 100644
index 0000000..052336b
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2005, 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.javac.code;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.lang.model.AnnotatedConstruct;
+
+import com.sun.tools.javac.model.AnnotationProxyMaker;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+
+/**
+ * Common super type for annotated constructs such as Types and Symbols.
+ *
+ * This class should *not* contain any fields since it would have a significant
+ * impact on the javac memory footprint.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public abstract class AnnoConstruct implements AnnotatedConstruct {
+
+
+    // Override to enforce a narrower return type.
+    @Override
+    public abstract List<? extends Attribute.Compound> getAnnotationMirrors();
+
+
+    // This method is part of the javax.lang.model API, do not use this in javac code.
+    protected <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) {
+        String name = annoType.getName();
+
+        for (Attribute.Compound anno : getAnnotationMirrors()) {
+            if (name.equals(anno.type.tsym.flatName().toString()))
+                return anno;
+        }
+
+        return null;
+    }
+
+
+    @SuppressWarnings("unchecked")
+    protected <A extends Annotation> A[] getInheritedAnnotations(Class<A> annoType) {
+        return (A[]) java.lang.reflect.Array.newInstance(annoType, 0);  // annoType is the Class for A
+    }
+
+
+    // This method is part of the javax.lang.model API, do not use this in javac code.
+    public <A extends Annotation> A[] getAnnotationsByType(Class<A> annoType) {
+
+        if (!annoType.isAnnotation())
+            throw new IllegalArgumentException("Not an annotation type: "
+                                               + annoType);
+        // If annoType does not declare a container this is equivalent to wrapping
+        // getAnnotation(...) in an array.
+        Class <? extends Annotation> containerType = getContainer(annoType);
+        if (containerType == null) {
+            A res = getAnnotation(annoType);
+            int size = res == null ? 0 : 1;
+
+            @SuppressWarnings("unchecked") // annoType is the Class for A
+            A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
+            if (res != null)
+                arr[0] = res;
+            return arr;
+        }
+
+        // So we have a containing type
+        String annoTypeName = annoType.getName();
+        String containerTypeName = containerType.getName();
+        int directIndex = -1, containerIndex = -1;
+        Attribute.Compound direct = null, container = null;
+        // Find directly (explicit or implicit) present annotations
+        int index = -1;
+        for (Attribute.Compound attribute : getAnnotationMirrors()) {
+            index++;
+            if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
+                directIndex = index;
+                direct = attribute;
+            } else if(containerTypeName != null &&
+                      attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
+                containerIndex = index;
+                container = attribute;
+            }
+        }
+
+        // Deal with inherited annotations
+        if (direct == null && container == null)
+            return getInheritedAnnotations(annoType);
+
+        // Pack them in an array
+        Attribute[] contained0 = null;
+        if (container != null)
+            contained0 = unpackAttributes(container);
+        ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
+        if (contained0 != null) {
+            for (Attribute a : contained0)
+                if (a instanceof Attribute.Compound)
+                    compounds = compounds.append((Attribute.Compound)a);
+        }
+        Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
+
+        int size = (direct == null ? 0 : 1) + contained.length;
+        @SuppressWarnings("unchecked") // annoType is the Class for A
+        A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
+
+        // if direct && container, which is first?
+        int insert = -1;
+        int length = arr.length;
+        if (directIndex >= 0 && containerIndex >= 0) {
+            if (directIndex < containerIndex) {
+                arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+                insert = 1;
+            } else {
+                arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+                insert = 0;
+                length--;
+            }
+        } else if (directIndex >= 0) {
+            arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+            return arr;
+        } else {
+            // Only container
+            insert = 0;
+        }
+
+        for (int i = 0; i + insert < length; i++)
+            arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
+
+        return arr;
+    }
+
+
+    // This method is part of the javax.lang.model API, do not use this in javac code.
+    public <A extends Annotation> A getAnnotation(Class<A> annoType) {
+
+        if (!annoType.isAnnotation())
+            throw new IllegalArgumentException("Not an annotation type: " + annoType);
+
+        Attribute.Compound c = getAttribute(annoType);
+        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
+    }
+
+    // Needed to unpack the runtime view of containing annotations
+    private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable();
+    private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
+
+    private static Class<? extends Annotation> initRepeatable() {
+        try {
+            // Repeatable will not be available when bootstrapping on
+            // JDK 7 so use a reflective lookup instead of a class
+            // literal for Repeatable.class.
+            return Class.forName("java.lang.annotation.Repeatable").asSubclass(Annotation.class);
+        } catch (ClassNotFoundException | SecurityException e) {
+            return null;
+        }
+    }
+
+    private static Method initValueElementMethod() {
+        if (REPEATABLE_CLASS == null)
+            return null;
+
+        Method m = null;
+        try {
+            m = REPEATABLE_CLASS.getMethod("value");
+            if (m != null)
+                m.setAccessible(true);
+            return m;
+        } catch (NoSuchMethodException e) {
+            return null;
+        }
+    }
+
+
+    // Helper to getAnnotationsByType
+    private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
+        // Since we can not refer to java.lang.annotation.Repeatable until we are
+        // bootstrapping with java 8 we need to get the Repeatable annotation using
+        // reflective invocations instead of just using its type and element method.
+        if (REPEATABLE_CLASS != null &&
+            VALUE_ELEMENT_METHOD != null) {
+            // Get the Repeatable instance on the annotations declaration
+            Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS);
+            if (repeatable != null) {
+                try {
+                    // Get the value element, it should be a class
+                    // indicating the containing annotation type
+                    @SuppressWarnings("unchecked")
+                    Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable);
+                    if (containerType == null)
+                        return null;
+
+                    return containerType;
+                } catch (ClassCastException | IllegalAccessException | InvocationTargetException e) {
+                    return null;
+                }
+            }
+        }
+        return null;
+    }
+
+
+    // Helper to getAnnotationsByType
+    private static Attribute[] unpackAttributes(Attribute.Compound container) {
+        // We now have an instance of the container,
+        // unpack it returning an instance of the
+        // contained type or null
+        return ((Attribute.Array)container.member(container.type.tsym.name.table.names.value)).values;
+    }
+
+}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
index 990ea0d..ec2cd4e 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java
@@ -64,6 +64,8 @@
         return false;
     }
 
+    public TypeAnnotationPosition getPosition() { return null; };
+
     /** The value for an annotation element of primitive type or String. */
     public static class Constant extends Attribute {
         public final Object value;
@@ -191,8 +193,13 @@
         }
 
         public Attribute member(Name member) {
+            Pair<MethodSymbol,Attribute> res = getElemPair(member);
+            return res == null ? null : res.snd;
+        }
+
+        private Pair<MethodSymbol, Attribute> getElemPair(Name member) {
             for (Pair<MethodSymbol,Attribute> pair : values)
-                if (pair.fst.name == member) return pair.snd;
+                if (pair.fst.name == member) return pair;
             return null;
         }
 
@@ -208,6 +215,16 @@
             return (DeclaredType) type;
         }
 
+        @Override
+        public TypeAnnotationPosition getPosition() {
+            if (values.size() != 0) {
+                Name valueName = values.head.fst.name.table.names.value;
+                Pair<MethodSymbol, Attribute> res = getElemPair(valueName);
+                    return res == null ? null : res.snd.getPosition();
+            }
+            return null;
+        }
+
         public Map<MethodSymbol, Attribute> getElementValues() {
             Map<MethodSymbol, Attribute> valmap =
                 new LinkedHashMap<MethodSymbol, Attribute>();
@@ -219,6 +236,7 @@
 
     public static class TypeCompound extends Compound {
         public TypeAnnotationPosition position;
+
         public TypeCompound(Compound compound,
                 TypeAnnotationPosition position) {
             this(compound.type, compound.values, position);
@@ -230,8 +248,16 @@
             this.position = position;
         }
 
+        @Override
+        public TypeAnnotationPosition getPosition() {
+            if (hasUnknownPosition()) {
+                position = super.getPosition();
+            }
+            return position;
+        }
+
         public boolean hasUnknownPosition() {
-            return position == null || position.type == TargetType.UNKNOWN;
+            return position.type == TargetType.UNKNOWN;
         }
 
         public boolean isContainerTypeCompound() {
@@ -302,6 +328,14 @@
         public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
             return v.visitArray(getValue(), p);
         }
+
+        @Override
+        public TypeAnnotationPosition getPosition() {
+            if (values.length != 0)
+                return values[0].getPosition();
+            else
+                return null;
+        }
     }
 
     /** The value for an annotation element of an enum type.
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java
index d466315..0301992 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java
@@ -260,24 +260,23 @@
 
     @Override
     public String visitAnnotatedType(AnnotatedType t, Locale locale) {
-        if (t.typeAnnotations != null &&
-                t.typeAnnotations.nonEmpty()) {
-            if (t.underlyingType.hasTag(TypeTag.ARRAY)) {
+        if (t.getAnnotationMirrors().nonEmpty()) {
+            if (t.unannotatedType().hasTag(TypeTag.ARRAY)) {
                 StringBuilder res = new StringBuilder();
                 printBaseElementType(t, res, locale);
                 printBrackets(t, res, locale);
                 return res.toString();
-            } else if (t.underlyingType.hasTag(TypeTag.CLASS) &&
-                    t.underlyingType.getEnclosingType() != Type.noType) {
-                return visit(t.underlyingType.getEnclosingType(), locale) +
+            } else if (t.unannotatedType().hasTag(TypeTag.CLASS) &&
+                    t.unannotatedType().getEnclosingType() != Type.noType) {
+                return visit(t.unannotatedType().getEnclosingType(), locale) +
                         ". " +
-                        t.typeAnnotations +
-                        " " + className((ClassType)t.underlyingType, false, locale);
+                        t.getAnnotationMirrors() +
+                        " " + className((ClassType)t.unannotatedType(), false, locale);
             } else {
-                return t.typeAnnotations + " " + visit(t.underlyingType, locale);
+                return t.getAnnotationMirrors() + " " + visit(t.unannotatedType(), locale);
             }
         } else {
-            return visit(t.underlyingType, locale);
+            return visit(t.unannotatedType(), locale);
         }
     }
 
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
index 6d9eea7..5efd2b6 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
@@ -25,6 +25,8 @@
 
 package com.sun.tools.javac.code;
 
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Inherited;
 import java.util.Set;
 import java.util.concurrent.Callable;
 
@@ -37,8 +39,6 @@
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.model.*;
-import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.Name;
 import static com.sun.tools.javac.code.Flags.*;
@@ -58,8 +58,7 @@
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-public abstract class Symbol implements Element {
-    // public Throwable debug = new Throwable();
+public abstract class Symbol extends AnnoConstruct implements Element {
 
     /** The kind of this symbol.
      *  @see Kinds
@@ -103,6 +102,7 @@
      */
     protected SymbolMetadata annotations;
 
+
     /** An accessor method for the attributes of this symbol.
      *  Attributes of class symbols should be accessed through the accessor
      *  method to make sure that the class symbol is loaded.
@@ -596,18 +596,6 @@
         return getRawAttributes();
     }
 
-    /**
-     * @deprecated this method should never be used by javac internally.
-     */
-    @Deprecated
-    public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) {
-        return JavacAnnoConstructs.getAnnotation(this, annoType);
-    }
-
-    // This method is part of the javax.lang.model API, do not use this in javac code.
-    public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(Class<A> annoType) {
-        return JavacAnnoConstructs.getAnnotationsByType(this, annoType);
-    }
 
     // TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList
     public java.util.List<Symbol> getEnclosedElements() {
@@ -793,6 +781,28 @@
             return res = res.reverse();
         }
 
+
+
+        // Helper to getAnnotation[s]
+        @Override
+        public <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) {
+
+            String name = annoType.getName();
+
+            // Declaration annotations on type variables are stored in type attributes
+            // on the owner of the TypeVariableSymbol
+            List<Attribute.TypeCompound> candidates = owner.getRawTypeAttributes();
+            for (Attribute.TypeCompound anno : candidates)
+                if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER ||
+                        anno.position.type == TargetType.METHOD_TYPE_PARAMETER)
+                    if (name.contentEquals(anno.type.tsym.flatName()))
+                        return anno;
+
+            return null;
+        }
+
+
+
         @Override
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             return v.visitTypeParameter(this, p);
@@ -1049,6 +1059,31 @@
             }
         }
 
+        /**
+         * Returns the next class to search for inherited annotations or {@code null}
+         * if the next class can't be found.
+         */
+        private ClassSymbol getSuperClassToSearchForAnnotations() {
+
+            Type sup = getSuperclass();
+
+            if (!sup.hasTag(CLASS) || sup.isErroneous())
+                return null;
+
+            return (ClassSymbol) sup.tsym;
+        }
+
+
+        @Override
+        protected <A extends Annotation> A[] getInheritedAnnotations(Class<A> annoType) {
+
+            ClassSymbol sup = getSuperClassToSearchForAnnotations();
+
+            return sup == null ? super.getInheritedAnnotations(annoType)
+                               : sup.getAnnotationsByType(annoType);
+        }
+
+
         public ElementKind getKind() {
             long flags = flags();
             if ((flags & ANNOTATION) != 0)
@@ -1079,15 +1114,25 @@
                 return NestingKind.MEMBER;
         }
 
-        /**
-         * Since this method works in terms of the runtime representation
-         * of annotations, it should never be used by javac internally.
-         */
+
         @Override
-        public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) {
-            return JavacAnnoConstructs.getAnnotation(this, annoType);
+        protected <A extends Annotation> Attribute.Compound getAttribute(final Class<A> annoType) {
+
+            Attribute.Compound attrib = super.getAttribute(annoType);
+
+            boolean inherited = annoType.isAnnotationPresent(Inherited.class);
+            if (attrib != null || !inherited)
+                return attrib;
+
+            // Search supertypes
+            ClassSymbol superType = getSuperClassToSearchForAnnotations();
+            return superType == null ? null
+                                     : superType.getAttribute(annoType);
         }
 
+
+
+
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
             return v.visitType(this, p);
         }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java b/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java
index 42564f6..303dacd 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java
@@ -205,14 +205,14 @@
 
             // Queue a pass that will replace Attribute.Placeholders
             // with Attribute.Compound (made from synthesized containers).
-            ctx.annotateRepeated(new Annotate.Annotator() {
+            ctx.annotateRepeated(new Annotate.Worker() {
                 @Override
                 public String toString() {
                     return "repeated annotation pass of: " + sym + " in: " + sym.owner;
                 }
 
                 @Override
-                public void enterAnnotation() {
+                public void run() {
                     complete(ctx);
                 }
             });
@@ -429,7 +429,7 @@
             super(on.type, List.<Pair<Symbol.MethodSymbol, Attribute>>nil(),
                     ctx.isTypeCompound ?
                             ((Attribute.TypeCompound)placeholderFor.head).position :
-                                null);
+                                new TypeAnnotationPosition());
             this.ctx = ctx;
             this.placeholderFor = placeholderFor;
             this.on = on;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
index 56e4d41..58bb0f1 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java
@@ -35,7 +35,6 @@
 import javax.lang.model.type.*;
 
 import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.model.JavacAnnoConstructs;
 import com.sun.tools.javac.util.*;
 import static com.sun.tools.javac.code.BoundKind.*;
 import static com.sun.tools.javac.code.Flags.*;
@@ -70,7 +69,7 @@
  *
  *  @see TypeTag
  */
-public abstract class Type implements TypeMirror {
+public abstract class Type extends AnnoConstruct implements TypeMirror {
 
     /** Constant type: no type at all. */
     public static final JCNoType noType = new JCNoType();
@@ -166,6 +165,12 @@
         return lb.toList();
     }
 
+    /**For ErrorType, returns the original type, otherwise returns the type itself.
+     */
+    public Type getOriginalType() {
+        return this;
+    }
+
     public <R,S> R accept(Type.Visitor<R,S> v, S s) { return v.visitType(this, s); }
 
     /** Define a type given its tag and type symbol
@@ -220,6 +225,10 @@
         return this;
     }
 
+    public Type annotatedType(List<Attribute.TypeCompound> annos) {
+        return new AnnotatedType(annos, this);
+    }
+
     public boolean isAnnotated() {
         return false;
     }
@@ -233,15 +242,17 @@
     }
 
     @Override
-    public List<? extends Attribute.TypeCompound> getAnnotationMirrors() {
+    public List<Attribute.TypeCompound> getAnnotationMirrors() {
         return List.nil();
     }
 
+
     @Override
     public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
         return null;
     }
 
+
     @Override
     public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
         @SuppressWarnings("unchecked")
@@ -1811,25 +1822,19 @@
                 javax.lang.model.type.WildcardType {
         /** The type annotations on this type.
          */
-        public List<Attribute.TypeCompound> typeAnnotations;
+        private List<Attribute.TypeCompound> typeAnnotations;
 
         /** The underlying type that is annotated.
          */
-        public Type underlyingType;
+        private Type underlyingType;
 
-        public AnnotatedType(Type underlyingType) {
-            super(underlyingType.tsym);
-            this.typeAnnotations = List.nil();
-            this.underlyingType = underlyingType;
-            Assert.check(!underlyingType.isAnnotated(),
-                    "Can't annotate already annotated type: " + underlyingType);
-        }
-
-        public AnnotatedType(List<Attribute.TypeCompound> typeAnnotations,
+        protected AnnotatedType(List<Attribute.TypeCompound> typeAnnotations,
                 Type underlyingType) {
             super(underlyingType.tsym);
             this.typeAnnotations = typeAnnotations;
             this.underlyingType = underlyingType;
+            Assert.check(typeAnnotations != null && typeAnnotations.nonEmpty(),
+                    "Can't create AnnotatedType without annotations: " + underlyingType);
             Assert.check(!underlyingType.isAnnotated(),
                     "Can't annotate already annotated type: " + underlyingType +
                     "; adding: " + typeAnnotations);
@@ -1846,19 +1851,10 @@
         }
 
         @Override
-        public List<? extends Attribute.TypeCompound> getAnnotationMirrors() {
+        public List<Attribute.TypeCompound> getAnnotationMirrors() {
             return typeAnnotations;
         }
 
-        @Override
-        public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
-            return JavacAnnoConstructs.getAnnotation(this, annotationType);
-        }
-
-        @Override
-        public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
-            return JavacAnnoConstructs.getAnnotationsByType(this, annotationType);
-        }
 
         @Override
         public TypeKind getKind() {
@@ -1979,10 +1975,8 @@
         public TypeMirror getComponentType()     { return ((ArrayType)underlyingType).getComponentType(); }
 
         // The result is an ArrayType, but only in the model sense, not the Type sense.
-        public AnnotatedType makeVarargs() {
-            AnnotatedType atype = new AnnotatedType(((ArrayType)underlyingType).makeVarargs());
-            atype.typeAnnotations = this.typeAnnotations;
-            return atype;
+        public Type makeVarargs() {
+            return ((ArrayType) underlyingType).makeVarargs().annotatedType(typeAnnotations);
         }
 
         @Override
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
index 677319f..36da3077 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
@@ -49,7 +49,8 @@
 import com.sun.tools.javac.code.Symbol.VarSymbol;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
 import com.sun.tools.javac.comp.Annotate;
-import com.sun.tools.javac.comp.Annotate.Annotator;
+import com.sun.tools.javac.comp.Annotate.Worker;
+import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.tree.JCTree;
@@ -71,6 +72,7 @@
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.Options;
 
 /**
  * Contains operations specific to processing type annotations.
@@ -94,6 +96,7 @@
     final Names names;
     final Symtab syms;
     final Annotate annotate;
+    final Attr attr;
 
     protected TypeAnnotations(Context context) {
         context.put(typeAnnosKey, this);
@@ -101,6 +104,8 @@
         log = Log.instance(context);
         syms = Symtab.instance(context);
         annotate = Annotate.instance(context);
+        attr = Attr.instance(context);
+        Options options = Options.instance(context);
     }
 
     /**
@@ -109,13 +114,13 @@
      * This version only visits types in signatures and should be
      * called from MemberEnter.
      * The method takes the Annotate object as parameter and
-     * adds an Annotator to the correct Annotate queue for
+     * adds an Annotate.Worker to the correct Annotate queue for
      * later processing.
      */
     public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
-        annotate.afterRepeated( new Annotator() {
+        annotate.afterRepeated( new Worker() {
             @Override
-            public void enterAnnotation() {
+            public void run() {
                 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
 
                 try {
@@ -127,6 +132,21 @@
         } );
     }
 
+    public void validateTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
+        annotate.validate(new Worker() { //validate annotations
+            @Override
+            public void run() {
+                JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
+
+                try {
+                    attr.validateTypeAnnotations(tree, true);
+                } finally {
+                    log.useSource(oldSource);
+                }
+            }
+        } );
+    }
+
     /**
      * This version only visits types in bodies, that is, field initializers,
      * top-level blocks, and method bodies, and should be called from Attr.
@@ -265,13 +285,10 @@
          */
         private void separateAnnotationsKinds(JCTree typetree, Type type, Symbol sym,
                 TypeAnnotationPosition pos) {
-            /*
-            System.out.printf("separateAnnotationsKinds(typetree: %s, type: %s, symbol: %s, pos: %s%n",
-                    typetree, type, sym, pos);
-            */
             List<Attribute.Compound> annotations = sym.getRawAttributes();
             ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<Attribute.Compound>();
             ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<Attribute.TypeCompound>();
+            ListBuffer<Attribute.TypeCompound> onlyTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
 
             for (Attribute.Compound a : annotations) {
                 switch (annotationType(a, sym)) {
@@ -287,6 +304,8 @@
                 case TYPE: {
                     Attribute.TypeCompound ta = toTypeCompound(a, pos);
                     typeAnnos.append(ta);
+                    // Also keep track which annotations are only type annotations
+                    onlyTypeAnnos.append(ta);
                     break;
                 }
                 }
@@ -310,7 +329,7 @@
             }
 
             // type is non-null and annotations are added to that type
-            type = typeWithAnnotations(typetree, type, typeAnnotations);
+            type = typeWithAnnotations(typetree, type, typeAnnotations, onlyTypeAnnos.toList());
 
             if (sym.getKind() == ElementKind.METHOD) {
                 sym.type.asMethodType().restype = type;
@@ -362,32 +381,23 @@
         // As a side effect the method sets the type annotation position of "annotations".
         // Note that it is assumed that all annotations share the same position.
         private Type typeWithAnnotations(final JCTree typetree, final Type type,
-                final List<Attribute.TypeCompound> annotations) {
-            // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s)%n",
-            //         typetree, type, annotations);
+                final List<Attribute.TypeCompound> annotations,
+                final List<Attribute.TypeCompound> onlyTypeAnnotations) {
+            // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s, onlyTypeAnnotations: %s)%n",
+            //         typetree, type, annotations, onlyTypeAnnotations);
             if (annotations.isEmpty()) {
                 return type;
             }
             if (type.hasTag(TypeTag.ARRAY)) {
+                Type.ArrayType arType = (Type.ArrayType) type.unannotatedType();
+                Type.ArrayType tomodify = new Type.ArrayType(null, arType.tsym);
                 Type toreturn;
-                Type.ArrayType tomodify;
-                Type.ArrayType arType;
-                {
-                    Type touse = type;
-                    if (type.isAnnotated()) {
-                        Type.AnnotatedType atype = (Type.AnnotatedType)type;
-                        toreturn = new Type.AnnotatedType(atype.underlyingType);
-                        ((Type.AnnotatedType)toreturn).typeAnnotations = atype.typeAnnotations;
-                        touse = atype.underlyingType;
-                        arType = (Type.ArrayType) touse;
-                        tomodify = new Type.ArrayType(null, arType.tsym);
-                        ((Type.AnnotatedType)toreturn).underlyingType = tomodify;
-                    } else {
-                        arType = (Type.ArrayType) touse;
-                        tomodify = new Type.ArrayType(null, arType.tsym);
-                        toreturn = tomodify;
-                    }
+                if (type.isAnnotated()) {
+                    toreturn = tomodify.annotatedType(type.getAnnotationMirrors());
+                } else {
+                    toreturn = tomodify;
                 }
+
                 JCArrayTypeTree arTree = arrayTypeTree(typetree);
 
                 ListBuffer<TypePathEntry> depth = new ListBuffer<>();
@@ -395,12 +405,10 @@
                 while (arType.elemtype.hasTag(TypeTag.ARRAY)) {
                     if (arType.elemtype.isAnnotated()) {
                         Type.AnnotatedType aelemtype = (Type.AnnotatedType) arType.elemtype;
-                        Type.AnnotatedType newAT = new Type.AnnotatedType(aelemtype.underlyingType);
-                        tomodify.elemtype = newAT;
-                        newAT.typeAnnotations = aelemtype.typeAnnotations;
-                        arType = (Type.ArrayType) aelemtype.underlyingType;
+                        arType = (Type.ArrayType) aelemtype.unannotatedType();
+                        ArrayType prevToMod = tomodify;
                         tomodify = new Type.ArrayType(null, arType.tsym);
-                        newAT.underlyingType = tomodify;
+                        prevToMod.elemtype = (Type.AnnotatedType) tomodify.annotatedType(arType.elemtype.getAnnotationMirrors());
                     } else {
                         arType = (Type.ArrayType) arType.elemtype;
                         tomodify.elemtype = new Type.ArrayType(null, arType.tsym);
@@ -409,7 +417,7 @@
                     arTree = arrayTypeTree(arTree.elemtype);
                     depth = depth.append(TypePathEntry.ARRAY);
                 }
-                Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations);
+                Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations, onlyTypeAnnotations);
                 tomodify.elemtype = arelemType;
                 {
                     // All annotations share the same position; modify the first one.
@@ -426,7 +434,7 @@
                 // There is a TypeKind, but no TypeTag.
                 JCTypeUnion tutree = (JCTypeUnion) typetree;
                 JCExpression fst = tutree.alternatives.get(0);
-                Type res = typeWithAnnotations(fst, fst.type, annotations);
+                Type res = typeWithAnnotations(fst, fst.type, annotations, onlyTypeAnnotations);
                 fst.type = res;
                 // TODO: do we want to set res as first element in uct.alternatives?
                 // UnionClassType uct = (com.sun.tools.javac.code.Type.UnionClassType)type;
@@ -465,14 +473,23 @@
                  * but nothing more exists.
                  */
                 if (enclTy != null &&
-                        enclTy.getKind() == TypeKind.NONE &&
-                        (enclTr.getKind() == JCTree.Kind.IDENTIFIER ||
-                         enclTr.getKind() == JCTree.Kind.MEMBER_SELECT ||
-                         enclTr.getKind() == JCTree.Kind.PARAMETERIZED_TYPE ||
-                         enclTr.getKind() == JCTree.Kind.ANNOTATED_TYPE)) {
-                    // TODO: also if it's "java. @A lang.Object", that is,
-                    // if it's on a package?
-                    log.error(enclTr.pos(), "cant.annotate.nested.type", enclTr.toString());
+                        enclTy.hasTag(TypeTag.NONE)) {
+                    switch (onlyTypeAnnotations.size()) {
+                    case 0:
+                        // Don't issue an error if all type annotations are
+                        // also declaration annotations.
+                        // If the annotations are also declaration annotations, they are
+                        // illegal as type annotations but might be legal as declaration annotations.
+                        // The normal declaration annotation checks make sure that the use is valid.
+                        break;
+                    case 1:
+                        log.error(typetree.pos(), "cant.type.annotate.scoping.1",
+                                onlyTypeAnnotations);
+                        break;
+                    default:
+                        log.error(typetree.pos(), "cant.type.annotate.scoping",
+                                onlyTypeAnnotations);
+                    }
                     return type;
                 }
 
@@ -551,7 +568,7 @@
                     // assert that t.constValue() == null?
                     if (t == stopAt ||
                         t.getEnclosingType() == Type.noType) {
-                        return new AnnotatedType(s, t);
+                        return t.annotatedType(s);
                     } else {
                         ClassType ret = new ClassType(t.getEnclosingType().accept(this, s),
                                 t.typarams_field, t.tsym);
@@ -566,12 +583,12 @@
 
                 @Override
                 public Type visitAnnotatedType(AnnotatedType t, List<TypeCompound> s) {
-                    return new AnnotatedType(t.typeAnnotations, t.underlyingType.accept(this, s));
+                    return t.unannotatedType().accept(this, s).annotatedType(t.getAnnotationMirrors());
                 }
 
                 @Override
                 public Type visitWildcardType(WildcardType t, List<TypeCompound> s) {
-                    return new AnnotatedType(s, t);
+                    return t.annotatedType(s);
                 }
 
                 @Override
@@ -594,12 +611,12 @@
 
                 @Override
                 public Type visitTypeVar(TypeVar t, List<TypeCompound> s) {
-                    return new AnnotatedType(s, t);
+                    return t.annotatedType(s);
                 }
 
                 @Override
                 public Type visitCapturedType(CapturedType t, List<TypeCompound> s) {
-                    return new AnnotatedType(s, t);
+                    return t.annotatedType(s);
                 }
 
                 @Override
@@ -616,12 +633,12 @@
 
                 @Override
                 public Type visitErrorType(ErrorType t, List<TypeCompound> s) {
-                    return new AnnotatedType(s, t);
+                    return t.annotatedType(s);
                 }
 
                 @Override
                 public Type visitType(Type t, List<TypeCompound> s) {
-                    return new AnnotatedType(s, t);
+                    return t.annotatedType(s);
                 }
             };
 
@@ -1023,9 +1040,7 @@
         @Override
         public void visitMethodDef(final JCMethodDecl tree) {
             if (tree.sym == null) {
-                // Something most be wrong, e.g. a class not found.
-                // Quietly ignore. (See test FailOver15.java)
-                return;
+                Assert.error("Visiting tree node before memberEnter");
             }
             if (sigOnly) {
                 if (!tree.mods.annotations.isEmpty()) {
@@ -1129,7 +1144,7 @@
                 // Nothing to do for separateAnnotationsKinds if
                 // there are no annotations of either kind.
             } else if (tree.sym == null) {
-                // Something is wrong already. Quietly ignore.
+                Assert.error("Visiting tree node before memberEnter");
             } else if (tree.sym.getKind() == ElementKind.PARAMETER) {
                 // Parameters are handled in visitMethodDef or visitLambda.
             } else if (tree.sym.getKind() == ElementKind.FIELD) {
@@ -1282,9 +1297,9 @@
         private void findPosition(JCTree tree, JCTree frame, List<JCAnnotation> annotations) {
             if (!annotations.isEmpty()) {
                 /*
-                System.out.println("Finding pos for: " + annotations);
-                System.out.println("    tree: " + tree + " kind: " + tree.getKind());
-                System.out.println("    frame: " + frame + " kind: " + frame.getKind());
+                System.err.println("Finding pos for: " + annotations);
+                System.err.println("    tree: " + tree + " kind: " + tree.getKind());
+                System.err.println("    frame: " + frame + " kind: " + frame.getKind());
                 */
                 TypeAnnotationPosition p = new TypeAnnotationPosition();
                 p.onLambda = currentLambda;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
index b5c512e..c214bf1 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java
@@ -1273,7 +1273,7 @@
                     return false;
                 if (!s.getAnnotationMirrors().containsAll(t.getAnnotationMirrors()))
                     return false;
-                return visit(t.underlyingType, s);
+                return visit(t.unannotatedType(), s);
             }
         };
     // </editor-fold>
@@ -2217,15 +2217,15 @@
 
             @Override
             public Type visitAnnotatedType(AnnotatedType t, Boolean recurse) {
-                Type erased = erasure(t.underlyingType, recurse);
+                Type erased = erasure(t.unannotatedType(), recurse);
                 if (erased.isAnnotated()) {
                     // This can only happen when the underlying type is a
                     // type variable and the upper bound of it is annotated.
                     // The annotation on the type variable overrides the one
                     // on the bound.
-                    erased = ((AnnotatedType)erased).underlyingType;
+                    erased = ((AnnotatedType)erased).unannotatedType();
                 }
-                return new AnnotatedType(t.typeAnnotations, erased);
+                return erased.annotatedType(t.getAnnotationMirrors());
             }
         };
 
@@ -4419,7 +4419,7 @@
         public R visitUndetVar(UndetVar t, S s)         { return visitType(t, s); }
         public R visitErrorType(ErrorType t, S s)       { return visitType(t, s); }
         // Pretend annotations don't exist
-        public R visitAnnotatedType(AnnotatedType t, S s) { return visit(t.underlyingType, s); }
+        public R visitAnnotatedType(AnnotatedType t, S s) { return visit(t.unannotatedType(), s); }
     }
 
     /**
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
index 709d818..bc0903f 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java
@@ -37,6 +37,7 @@
 import static com.sun.tools.javac.code.TypeTag.ARRAY;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
+import javax.lang.model.type.ErrorType;
 
 /** Enter annotations on symbols.  Annotations accumulate in a queue,
  *  which is processed at the top level of any set of recursive calls
@@ -87,31 +88,36 @@
 
     private int enterCount = 0;
 
-    ListBuffer<Annotator> q = new ListBuffer<Annotator>();
-    ListBuffer<Annotator> typesQ = new ListBuffer<Annotator>();
-    ListBuffer<Annotator> repeatedQ = new ListBuffer<Annotator>();
-    ListBuffer<Annotator> afterRepeatedQ = new ListBuffer<Annotator>();
+    ListBuffer<Worker> q = new ListBuffer<Worker>();
+    ListBuffer<Worker> typesQ = new ListBuffer<Worker>();
+    ListBuffer<Worker> repeatedQ = new ListBuffer<Worker>();
+    ListBuffer<Worker> afterRepeatedQ = new ListBuffer<Worker>();
+    ListBuffer<Worker> validateQ = new ListBuffer<Worker>();
 
-    public void earlier(Annotator a) {
+    public void earlier(Worker a) {
         q.prepend(a);
     }
 
-    public void normal(Annotator a) {
+    public void normal(Worker a) {
         q.append(a);
     }
 
-    public void typeAnnotation(Annotator a) {
+    public void typeAnnotation(Worker a) {
         typesQ.append(a);
     }
 
-    public void repeated(Annotator a) {
+    public void repeated(Worker a) {
         repeatedQ.append(a);
     }
 
-    public void afterRepeated(Annotator a) {
+    public void afterRepeated(Worker a) {
         afterRepeatedQ.append(a);
     }
 
+    public void validate(Worker a) {
+        validateQ.append(a);
+    }
+
     /** Called when the Enter phase starts. */
     public void enterStart() {
         enterCount++;
@@ -123,34 +129,45 @@
         flush();
     }
 
+    /** Variant which allows for a delayed flush of annotations.
+     * Needed by ClassReader */
+    public void enterDoneWithoutFlush() {
+        enterCount--;
+    }
+
     public void flush() {
         if (enterCount != 0) return;
         enterCount++;
         try {
             while (q.nonEmpty()) {
-                q.next().enterAnnotation();
+                q.next().run();
             }
             while (typesQ.nonEmpty()) {
-                typesQ.next().enterAnnotation();
+                typesQ.next().run();
             }
             while (repeatedQ.nonEmpty()) {
-                repeatedQ.next().enterAnnotation();
+                repeatedQ.next().run();
             }
             while (afterRepeatedQ.nonEmpty()) {
-                afterRepeatedQ.next().enterAnnotation();
+                afterRepeatedQ.next().run();
+            }
+            while (validateQ.nonEmpty()) {
+                validateQ.next().run();
             }
         } finally {
             enterCount--;
         }
     }
 
-    /** A client that has annotations to add registers an annotator,
-     *  the method it will use to add the annotation.  There are no
-     *  parameters; any needed data should be captured by the
-     *  Annotator.
+    /** A client that needs to run during {@link #flush()} registers an worker
+     *  into one of the queues defined in this class. The queues are: {@link #earlier(Worker)},
+     *  {@link #normal(Worker)}, {@link #typeAnnotation(Worker)}, {@link #repeated(Worker)},
+     *  {@link #afterRepeated(Worker)}, {@link #validate(Worker)}.
+     *  The {@link Worker#run()} method will called inside the {@link #flush()}
+     *  call. Queues are empties in the abovementioned order.
      */
-    public interface Annotator {
-        void enterAnnotation();
+    public interface Worker {
+        void run();
         String toString();
     }
 
@@ -195,12 +212,12 @@
         }
 
         /**
-         * Queue the Annotator a on the repeating annotations queue of the
+         * Queue the Worker a on the repeating annotations queue of the
          * Annotate instance this context belongs to.
          *
-         * @param a the Annotator to enqueue for repeating annotation annotating
+         * @param a the Worker to enqueue for repeating annotation annotating
          */
-        public void annotateRepeated(Annotator a) {
+        public void annotateRepeated(Worker a) {
             Annotate.this.repeated(a);
         }
     }
@@ -239,7 +256,8 @@
         a.type = chk.checkType(a.annotationType.pos(), at, expected);
         if (a.type.isErroneous()) {
             if (typeAnnotation) {
-                return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(), null);
+                return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(),
+                        new TypeAnnotationPosition());
             } else {
                 return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil());
             }
@@ -310,7 +328,6 @@
     Attribute enterAttributeValue(Type expected,
                                   JCExpression tree,
                                   Env<AttrContext> env) {
-        Type original = expected;
         //first, try completing the attribution value sym - if a completion
         //error is thrown, we should recover gracefully, and display an
         //ordinary resolution diagnostic.
@@ -351,7 +368,7 @@
                                     l.head,
                                     env);
             }
-            return new Attribute.Error(original);
+            return new Attribute.Error(syms.errType);
         }
         if ((expected.tsym.flags() & Flags.ANNOTATION) != 0) {
             if (tree.hasTag(ANNOTATION)) {
@@ -365,12 +382,12 @@
             if (!expected.isErroneous())
                 log.error(tree.pos(), "annotation.not.valid.for.type", expected);
             enterAnnotation((JCAnnotation)tree, syms.errType, env);
-            return new Attribute.Error(original);
+            return new Attribute.Error(((JCAnnotation)tree).annotationType.type);
         }
         if (expected.isPrimitive() || types.isSameType(expected, syms.stringType)) {
             Type result = attr.attribExpr(tree, env, expected);
             if (result.isErroneous())
-                return new Attribute.Error(expected);
+                return new Attribute.Error(result.getOriginalType());
             if (result.constValue() == null) {
                 log.error(tree.pos(), "attribute.value.must.be.constant");
                 return new Attribute.Error(expected);
@@ -381,14 +398,15 @@
         if (expected.tsym == syms.classType.tsym) {
             Type result = attr.attribExpr(tree, env, expected);
             if (result.isErroneous()) {
-                // Does it look like a class literal?
-                if (TreeInfo.name(tree) == names._class) {
+                // Does it look like an unresolved class literal?
+                if (TreeInfo.name(tree) == names._class &&
+                    ((JCFieldAccess) tree).selected.type.isErroneous()) {
                     Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName();
                     return new Attribute.UnresolvedClass(expected,
                             types.createErrorType(n,
                                     syms.unknownSymbol, syms.classType));
                 } else {
-                    return new Attribute.Error(expected);
+                    return new Attribute.Error(result.getOriginalType());
                 }
             }
 
@@ -396,21 +414,21 @@
             // at the tree level
             if (TreeInfo.name(tree) != names._class) {
                 log.error(tree.pos(), "annotation.value.must.be.class.literal");
-                return new Attribute.Error(expected);
+                return new Attribute.Error(syms.errType);
             }
             return new Attribute.Class(types,
                                        (((JCFieldAccess) tree).selected).type);
         }
         if (expected.hasTag(CLASS) &&
             (expected.tsym.flags() & Flags.ENUM) != 0) {
-            attr.attribExpr(tree, env, expected);
+            Type result = attr.attribExpr(tree, env, expected);
             Symbol sym = TreeInfo.symbol(tree);
             if (sym == null ||
                 TreeInfo.nonstaticSelect(tree) ||
                 sym.kind != Kinds.VAR ||
                 (sym.flags() & Flags.ENUM) == 0) {
                 log.error(tree.pos(), "enum.annotation.must.be.enum.constant");
-                return new Attribute.Error(expected);
+                return new Attribute.Error(result.getOriginalType());
             }
             VarSymbol enumerator = (VarSymbol) sym;
             return new Attribute.Enum(expected, enumerator);
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
index 3b84040..458c16c 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -792,17 +792,19 @@
         Type t = tree.type != null ?
             tree.type :
             attribType(tree, env);
-        return checkBase(t, tree, env, classExpected, interfaceExpected, checkExtensible);
+        return checkBase(t, tree, env, classExpected, interfaceExpected, false, checkExtensible);
     }
     Type checkBase(Type t,
                    JCTree tree,
                    Env<AttrContext> env,
                    boolean classExpected,
-                   boolean interfaceOrArrayExpected,
+                   boolean interfacesOnlyExpected,
+                   boolean interfacesOrArraysExpected,
                    boolean checkExtensible) {
         if (t.isErroneous())
             return t;
-        if (t.hasTag(TYPEVAR) && !classExpected && !interfaceOrArrayExpected) {
+        if (t.hasTag(TYPEVAR) && !classExpected &&
+            !interfacesOrArraysExpected && !interfacesOnlyExpected) {
             // check that type variable is already visible
             if (t.getUpperBound() == null) {
                 log.error(tree.pos(), "illegal.forward.ref");
@@ -814,12 +816,17 @@
             t = chk.checkClassOrArrayType(tree.pos(), t,
                                           checkExtensible|!allowGenerics);
         }
-        if (interfaceOrArrayExpected &&
-            !(t.tsym.isInterface() || t.getTag() == ARRAY)) {
+        if (interfacesOnlyExpected && !t.tsym.isInterface()) {
             log.error(tree.pos(), "intf.expected.here");
             // return errType is necessary since otherwise there might
             // be undetected cycles which cause attribution to loop
             return types.createErrorType(t);
+        } else if (interfacesOrArraysExpected &&
+            !(t.tsym.isInterface() || t.getTag() == ARRAY)) {
+            log.error(tree.pos(), "intf.or.array.expected.here");
+            // return errType is necessary since otherwise there might
+            // be undetected cycles which cause attribution to loop
+            return types.createErrorType(t);
         } else if (checkExtensible &&
                    classExpected &&
                    t.tsym.isInterface()) {
@@ -958,12 +965,6 @@
                 chk.validateAnnotationType(tree.restype);
                 // ensure that annotation method does not clash with members of Object/Annotation
                 chk.validateAnnotationMethod(tree.pos(), m);
-
-                if (tree.defaultValue != null) {
-                    // if default value is an annotation, check it is a well-formed
-                    // annotation value (e.g. no duplicate values, no missing values, etc.)
-                    chk.validateAnnotationTree(tree.defaultValue);
-                }
             }
 
             for (List<JCExpression> l = tree.thrown; l.nonEmpty(); l = l.tail)
@@ -1025,7 +1026,6 @@
 
             localEnv.info.scope.leave();
             result = tree.type = m.type;
-            chk.validateAnnotations(tree.mods.annotations, m);
         }
         finally {
             chk.setLint(prevLint);
@@ -1083,7 +1083,6 @@
                 }
             }
             result = tree.type = v.type;
-            chk.validateAnnotations(tree.mods.annotations, v);
         }
         finally {
             chk.setLint(prevLint);
@@ -3535,15 +3534,6 @@
                         Type normOuter = site;
                         if (normOuter.hasTag(CLASS)) {
                             normOuter = types.asEnclosingSuper(site, ownOuter.tsym);
-                            if (site.isAnnotated()) {
-                                // Propagate any type annotations.
-                                // TODO: should asEnclosingSuper do this?
-                                // Note that the type annotations in site will be updated
-                                // by annotateType. Therefore, modify site instead
-                                // of creating a new AnnotatedType.
-                                ((AnnotatedType)site).underlyingType = normOuter;
-                                normOuter = site;
-                            }
                         }
                         if (normOuter == null) // perhaps from an import
                             normOuter = types.erasure(ownOuter);
@@ -3902,12 +3892,6 @@
                     }
                 }
                 owntype = new ClassType(clazzOuter, actuals, clazztype.tsym);
-                if (clazztype.isAnnotated()) {
-                    // Use the same AnnotatedType, because it will have
-                    // its annotations set later.
-                    ((AnnotatedType)clazztype).underlyingType = owntype;
-                    owntype = clazztype;
-                }
             } else {
                 if (formals.length() != 0) {
                     log.error(tree.pos(), "wrong.number.type.args",
@@ -3973,9 +3957,7 @@
         TypeVar typeVar = (TypeVar) tree.type;
 
         if (tree.annotations != null && tree.annotations.nonEmpty()) {
-            AnnotatedType antype = new AnnotatedType(typeVar);
-            annotateType(antype, tree.annotations);
-            tree.type = antype;
+            annotateType(tree, tree.annotations);
         }
 
         if (!typeVar.bound.isErroneous()) {
@@ -3988,7 +3970,7 @@
         Set<Type> boundSet = new HashSet<Type>();
         if (bounds.nonEmpty()) {
             // accept class or interface or typevar as first bound.
-            bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false);
+            bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false, false);
             boundSet.add(types.erasure(bounds.head.type));
             if (bounds.head.type.isErroneous()) {
                 return bounds.head.type;
@@ -4004,7 +3986,7 @@
                 // if first bound was a class or interface, accept only interfaces
                 // as further bounds.
                 for (JCExpression bound : bounds.tail) {
-                    bound.type = checkBase(bound.type, bound, env, false, true, false);
+                    bound.type = checkBase(bound.type, bound, env, false, false, true, false);
                     if (bound.type.isErroneous()) {
                         bounds = List.of(bound);
                     }
@@ -4075,26 +4057,28 @@
     public void visitAnnotatedType(JCAnnotatedType tree) {
         Type underlyingType = attribType(tree.getUnderlyingType(), env);
         this.attribAnnotationTypes(tree.annotations, env);
-        AnnotatedType antype = new AnnotatedType(underlyingType);
-        annotateType(antype, tree.annotations);
-        result = tree.type = antype;
+        annotateType(tree, tree.annotations);
+        result = tree.type = underlyingType;
     }
 
     /**
      * Apply the annotations to the particular type.
      */
-    public void annotateType(final AnnotatedType type, final List<JCAnnotation> annotations) {
-        if (annotations.isEmpty())
-            return;
-        annotate.typeAnnotation(new Annotate.Annotator() {
+    public void annotateType(final JCTree tree, final List<JCAnnotation> annotations) {
+        // Callers ensure this.
+        // Assert.check(annotations != null && annotations.nonEmpty());
+        annotate.typeAnnotation(new Annotate.Worker() {
             @Override
             public String toString() {
-                return "annotate " + annotations + " onto " + type;
+                return "annotate " + annotations + " onto " + tree;
             }
             @Override
-            public void enterAnnotation() {
+            public void run() {
                 List<Attribute.TypeCompound> compounds = fromAnnotations(annotations);
-                type.typeAnnotations = compounds;
+                if (annotations.size() == compounds.size()) {
+                    // All annotations were successfully converted into compounds
+                    tree.type = tree.type.unannotatedType().annotatedType(compounds);
+                }
             }
         });
     }
@@ -4148,7 +4132,6 @@
         JCCompilationUnit toplevel = env.toplevel;
         try {
             annotate.flush();
-            chk.validateAnnotations(toplevel.packageAnnotations, toplevel.packge);
         } catch (CompletionFailure ex) {
             chk.completionError(toplevel.pos(), ex);
         }
@@ -4233,6 +4216,7 @@
 
                 chk.checkDeprecatedAnnotation(env.tree.pos(), c);
                 chk.checkClassOverrideEqualsAndHashIfNeeded(env.tree.pos(), c);
+                chk.checkFunctionalInterface((JCClassDecl) env.tree, c);
             } finally {
                 env.info.returnResult = prevReturnRes;
                 log.useSource(prev);
@@ -4251,9 +4235,6 @@
         JCClassDecl tree = (JCClassDecl)env.tree;
         Assert.check(c == tree.sym);
 
-        // Validate annotations
-        chk.validateAnnotations(tree.mods.annotations, c);
-
         // Validate type parameters, supertype and interfaces.
         attribStats(tree.typarams, env);
         if (!c.isAnonymous()) {
@@ -4354,7 +4335,7 @@
             typeAnnotations.organizeTypeAnnotationsBodies(tree);
 
             // Check type annotations applicability rules
-            validateTypeAnnotations(tree);
+            validateTypeAnnotations(tree, false);
         }
     }
         // where
@@ -4429,20 +4410,26 @@
         return types.capture(type);
     }
 
-    private void validateTypeAnnotations(JCTree tree) {
-        tree.accept(typeAnnotationsValidator);
+    public void validateTypeAnnotations(JCTree tree, boolean sigOnly) {
+        tree.accept(new TypeAnnotationsValidator(sigOnly));
     }
     //where
-    private final JCTree.Visitor typeAnnotationsValidator = new TreeScanner() {
+    private final class TypeAnnotationsValidator extends TreeScanner {
 
-        private boolean checkAllAnnotations = false;
+        private final boolean sigOnly;
+        public TypeAnnotationsValidator(boolean sigOnly) {
+            this.sigOnly = sigOnly;
+        }
 
         public void visitAnnotation(JCAnnotation tree) {
-            if (tree.hasTag(TYPE_ANNOTATION) || checkAllAnnotations) {
-                chk.validateTypeAnnotation(tree, false);
-            }
+            chk.validateTypeAnnotation(tree, false);
             super.visitAnnotation(tree);
         }
+        public void visitAnnotatedType(JCAnnotatedType tree) {
+            if (!tree.underlyingType.type.isErroneous()) {
+                super.visitAnnotatedType(tree);
+            }
+        }
         public void visitTypeParameter(JCTypeParameter tree) {
             chk.validateTypeAnnotations(tree.annotations, true);
             scan(tree.bounds);
@@ -4460,12 +4447,26 @@
             if (tree.restype != null && tree.restype.type != null) {
                 validateAnnotatedType(tree.restype, tree.restype.type);
             }
-            super.visitMethodDef(tree);
+            if (sigOnly) {
+                scan(tree.mods);
+                scan(tree.restype);
+                scan(tree.typarams);
+                scan(tree.recvparam);
+                scan(tree.params);
+                scan(tree.thrown);
+            } else {
+                scan(tree.defaultValue);
+                scan(tree.body);
+            }
         }
         public void visitVarDef(final JCVariableDecl tree) {
             if (tree.sym != null && tree.sym.type != null)
-                validateAnnotatedType(tree, tree.sym.type);
-            super.visitVarDef(tree);
+                validateAnnotatedType(tree.vartype, tree.sym.type);
+            scan(tree.mods);
+            scan(tree.vartype);
+            if (!sigOnly) {
+                scan(tree.init);
+            }
         }
         public void visitTypeCast(JCTypeCast tree) {
             if (tree.clazz != null && tree.clazz.type != null)
@@ -4478,30 +4479,39 @@
             super.visitTypeTest(tree);
         }
         public void visitNewClass(JCNewClass tree) {
-            if (tree.clazz.hasTag(ANNOTATED_TYPE)) {
-                boolean prevCheck = this.checkAllAnnotations;
-                try {
-                    this.checkAllAnnotations = true;
-                    scan(((JCAnnotatedType)tree.clazz).annotations);
-                } finally {
-                    this.checkAllAnnotations = prevCheck;
-                }
-            }
+            if (tree.clazz.type != null)
+                validateAnnotatedType(tree.clazz, tree.clazz.type);
             super.visitNewClass(tree);
         }
         public void visitNewArray(JCNewArray tree) {
-            if (tree.elemtype != null && tree.elemtype.hasTag(ANNOTATED_TYPE)) {
-                boolean prevCheck = this.checkAllAnnotations;
-                try {
-                    this.checkAllAnnotations = true;
-                    scan(((JCAnnotatedType)tree.elemtype).annotations);
-                } finally {
-                    this.checkAllAnnotations = prevCheck;
-                }
-            }
+            if (tree.elemtype != null && tree.elemtype.type != null)
+                validateAnnotatedType(tree.elemtype, tree.elemtype.type);
             super.visitNewArray(tree);
         }
 
+        @Override
+        public void visitClassDef(JCClassDecl tree) {
+            if (sigOnly) {
+                scan(tree.mods);
+                scan(tree.typarams);
+                scan(tree.extending);
+                scan(tree.implementing);
+            }
+            for (JCTree member : tree.defs) {
+                if (member.hasTag(Tag.CLASSDEF)) {
+                    continue;
+                }
+                scan(member);
+            }
+        }
+
+        @Override
+        public void visitBlock(JCBlock tree) {
+            if (!sigOnly) {
+                scan(tree.stats);
+            }
+        }
+
         /* I would want to model this after
          * com.sun.tools.javac.comp.Check.Validator.visitSelectInternal(JCFieldAccess)
          * and override visitSelect and visitTypeApply.
@@ -4511,21 +4521,95 @@
          * can occur.
          */
         private void validateAnnotatedType(final JCTree errtree, final Type type) {
-            if (type.getEnclosingType() != null &&
-                    type != type.getEnclosingType()) {
-                validateEnclosingAnnotatedType(errtree, type.getEnclosingType());
+            // System.out.println("Attr.validateAnnotatedType: " + errtree + " type: " + type);
+
+            if (type.isPrimitiveOrVoid()) {
+                return;
             }
-            for (Type targ : type.getTypeArguments()) {
-                validateAnnotatedType(errtree, targ);
-            }
-        }
-        private void validateEnclosingAnnotatedType(final JCTree errtree, final Type type) {
-            validateAnnotatedType(errtree, type);
-            if (type.tsym != null &&
-                    type.tsym.isStatic() &&
-                    type.getAnnotationMirrors().nonEmpty()) {
-                    // Enclosing static classes cannot have type annotations.
-                log.error(errtree.pos(), "cant.annotate.static.class");
+
+            JCTree enclTr = errtree;
+            Type enclTy = type;
+
+            boolean repeat = true;
+            while (repeat) {
+                if (enclTr.hasTag(TYPEAPPLY)) {
+                    List<Type> tyargs = enclTy.getTypeArguments();
+                    List<JCExpression> trargs = ((JCTypeApply)enclTr).getTypeArguments();
+                    if (trargs.length() > 0) {
+                        // Nothing to do for diamonds
+                        if (tyargs.length() == trargs.length()) {
+                            for (int i = 0; i < tyargs.length(); ++i) {
+                                validateAnnotatedType(trargs.get(i), tyargs.get(i));
+                            }
+                        }
+                        // If the lengths don't match, it's either a diamond
+                        // or some nested type that redundantly provides
+                        // type arguments in the tree.
+                    }
+
+                    // Look at the clazz part of a generic type
+                    enclTr = ((JCTree.JCTypeApply)enclTr).clazz;
+                }
+
+                if (enclTr.hasTag(SELECT)) {
+                    enclTr = ((JCTree.JCFieldAccess)enclTr).getExpression();
+                    if (enclTy != null &&
+                            !enclTy.hasTag(NONE)) {
+                        enclTy = enclTy.getEnclosingType();
+                    }
+                } else if (enclTr.hasTag(ANNOTATED_TYPE)) {
+                    JCAnnotatedType at = (JCTree.JCAnnotatedType) enclTr;
+                    if (enclTy == null ||
+                            enclTy.hasTag(NONE)) {
+                        if (at.getAnnotations().size() == 1) {
+                            log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute);
+                        } else {
+                            ListBuffer<Attribute.Compound> comps = new ListBuffer<Attribute.Compound>();
+                            for (JCAnnotation an : at.getAnnotations()) {
+                                comps.add(an.attribute);
+                            }
+                            log.error(at.underlyingType.pos(), "cant.type.annotate.scoping", comps.toList());
+                        }
+                        repeat = false;
+                    }
+                    enclTr = at.underlyingType;
+                    // enclTy doesn't need to be changed
+                } else if (enclTr.hasTag(IDENT)) {
+                    repeat = false;
+                } else if (enclTr.hasTag(JCTree.Tag.WILDCARD)) {
+                    JCWildcard wc = (JCWildcard) enclTr;
+                    if (wc.getKind() == JCTree.Kind.EXTENDS_WILDCARD) {
+                        validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getExtendsBound());
+                    } else if (wc.getKind() == JCTree.Kind.SUPER_WILDCARD) {
+                        validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getSuperBound());
+                    } else {
+                        // Nothing to do for UNBOUND
+                    }
+                    repeat = false;
+                } else if (enclTr.hasTag(TYPEARRAY)) {
+                    JCArrayTypeTree art = (JCArrayTypeTree) enclTr;
+                    validateAnnotatedType(art.getType(), ((ArrayType)enclTy.unannotatedType()).getComponentType());
+                    repeat = false;
+                } else if (enclTr.hasTag(TYPEUNION)) {
+                    JCTypeUnion ut = (JCTypeUnion) enclTr;
+                    for (JCTree t : ut.getTypeAlternatives()) {
+                        validateAnnotatedType(t, t.type);
+                    }
+                    repeat = false;
+                } else if (enclTr.hasTag(TYPEINTERSECTION)) {
+                    JCTypeIntersection it = (JCTypeIntersection) enclTr;
+                    for (JCTree t : it.getBounds()) {
+                        validateAnnotatedType(t, t.type);
+                    }
+                    repeat = false;
+                } else if (enclTr.getKind() == JCTree.Kind.PRIMITIVE_TYPE) {
+                    // This happens in test TargetTypeTest52.java
+                    // Is there anything to do?
+                    repeat = false;
+                } else {
+                    Assert.error("Unexpected tree: " + enclTr + " with kind: " + enclTr.getKind() +
+                            " within: "+ errtree + " with kind: " + errtree.getKind());
+                }
             }
         }
     };
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
index 720b150..073bbbc 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
@@ -30,6 +30,7 @@
 import javax.tools.JavaFileManager;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Attribute.Compound;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
@@ -1951,7 +1952,7 @@
      *                      for errors.
      *  @param m            The overriding method.
      */
-    void checkOverride(JCTree tree, MethodSymbol m) {
+    void checkOverride(JCMethodDecl tree, MethodSymbol m) {
         ClassSymbol origin = (ClassSymbol)m.owner;
         if ((origin.flags() & ENUM) != 0 && names.finalize.equals(m.name))
             if (m.overrides(syms.enumFinalFinalize, origin, types, false)) {
@@ -1967,6 +1968,17 @@
                 checkOverride(tree, t2, origin, m);
             }
         }
+
+        if (m.attribute(syms.overrideType.tsym) != null && !isOverrider(m)) {
+            DiagnosticPosition pos = tree.pos();
+            for (JCAnnotation a : tree.getModifiers().annotations) {
+                if (a.annotationType.type.tsym == syms.overrideType.tsym) {
+                    pos = a.pos();
+                    break;
+                }
+            }
+            log.error(pos, "method.does.not.override.superclass");
+        }
     }
 
     void checkOverride(JCTree tree, Type site, ClassSymbol origin, MethodSymbol m) {
@@ -2387,13 +2399,28 @@
          ClashFilter cf = new ClashFilter(site);
         //for each method m1 that is overridden (directly or indirectly)
         //by method 'sym' in 'site'...
+
+        List<MethodSymbol> potentiallyAmbiguousList = List.nil();
+        boolean overridesAny = false;
         for (Symbol m1 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
-             if (!sym.overrides(m1, site.tsym, types, false)) {
-                 checkPotentiallyAmbiguousOverloads(pos, site, sym, (MethodSymbol)m1);
-                 continue;
-             }
-             //...check each method m2 that is a member of 'site'
-             for (Symbol m2 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
+            if (!sym.overrides(m1, site.tsym, types, false)) {
+                if (m1 == sym) {
+                    continue;
+                }
+
+                if (!overridesAny) {
+                    potentiallyAmbiguousList = potentiallyAmbiguousList.prepend((MethodSymbol)m1);
+                }
+                continue;
+            }
+
+            if (m1 != sym) {
+                overridesAny = true;
+                potentiallyAmbiguousList = List.nil();
+            }
+
+            //...check each method m2 that is a member of 'site'
+            for (Symbol m2 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
                 if (m2 == m1) continue;
                 //if (i) the signature of 'sym' is not a subsignature of m1 (seen as
                 //a member of 'site') and (ii) m1 has the same erasure as m2, issue an error
@@ -2412,10 +2439,14 @@
                 }
             }
         }
+
+        if (!overridesAny) {
+            for (MethodSymbol m: potentiallyAmbiguousList) {
+                checkPotentiallyAmbiguousOverloads(pos, site, sym, m);
+            }
+        }
     }
 
-
-
     /** Check that all static methods accessible from 'site' are
      *  mutually compatible (JLS 8.4.8).
      *
@@ -2725,20 +2756,11 @@
         if (!annotationApplicable(a, s))
             log.error(a.pos(), "annotation.type.not.applicable");
 
-        if (a.annotationType.type.tsym == syms.overrideType.tsym) {
-            if (!isOverrider(s))
-                log.error(a.pos(), "method.does.not.override.superclass");
-        }
-
         if (a.annotationType.type.tsym == syms.functionalInterfaceType.tsym) {
             if (s.kind != TYP) {
                 log.error(a.pos(), "bad.functional.intf.anno");
-            } else {
-                try {
-                    types.findDescriptorSymbol((TypeSymbol)s);
-                } catch (Types.FunctionDescriptorLookupError ex) {
-                    log.error(a.pos(), "bad.functional.intf.anno.1", ex.getDiagnostic());
-                }
+            } else if (!s.isInterface() || (s.flags() & ANNOTATION) != 0) {
+                log.error(a.pos(), "bad.functional.intf.anno.1", diags.fragment("not.a.functional.intf", s));
             }
         }
     }
@@ -2747,8 +2769,11 @@
         Assert.checkNonNull(a.type, "annotation tree hasn't been attributed yet: " + a);
         validateAnnotationTree(a);
 
-        if (!isTypeAnnotation(a, isTypeParameter))
+        if (a.hasTag(TYPE_ANNOTATION) &&
+                !a.annotationType.type.isErroneous() &&
+                !isTypeAnnotation(a, isTypeParameter)) {
             log.error(a.pos(), "annotation.type.not.applicable");
+        }
     }
 
     /**
@@ -2953,7 +2978,7 @@
         return false;
     }
 
-    /** Is the annotation applicable to type annotations? */
+    /** Is the annotation applicable to types? */
     protected boolean isTypeAnnotation(JCAnnotation a, boolean isTypeParameter) {
         Attribute.Compound atTarget =
             a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym);
@@ -3420,15 +3445,14 @@
                 sym.name != names.error &&
                 (!staticImport || !e.isStaticallyImported())) {
                 if (!e.sym.type.isErroneous()) {
-                    String what = e.sym.toString();
                     if (!isClassDecl) {
                         if (staticImport)
-                            log.error(pos, "already.defined.static.single.import", what);
+                            log.error(pos, "already.defined.static.single.import", e.sym);
                         else
-                        log.error(pos, "already.defined.single.import", what);
+                        log.error(pos, "already.defined.single.import", e.sym);
                     }
                     else if (sym != e.sym)
-                        log.error(pos, "already.defined.this.unit", what);
+                        log.error(pos, "already.defined.this.unit", e.sym);
                 }
                 return false;
             }
@@ -3508,4 +3532,23 @@
     public Warner convertWarner(DiagnosticPosition pos, Type found, Type expected) {
         return new ConversionWarner(pos, "unchecked.assign", found, expected);
     }
+
+    public void checkFunctionalInterface(JCClassDecl tree, ClassSymbol cs) {
+        Compound functionalType = cs.attribute(syms.functionalInterfaceType.tsym);
+
+        if (functionalType != null) {
+            try {
+                types.findDescriptorSymbol((TypeSymbol)cs);
+            } catch (Types.FunctionDescriptorLookupError ex) {
+                DiagnosticPosition pos = tree.pos();
+                for (JCAnnotation a : tree.getModifiers().annotations) {
+                    if (a.annotationType.type.tsym == syms.functionalInterfaceType.tsym) {
+                        pos = a.pos();
+                        break;
+                    }
+                }
+                log.error(pos, "bad.functional.intf.anno.1", ex.getDiagnostic());
+            }
+        }
+    }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
index eb15ef6..e56aa53 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
@@ -128,10 +128,9 @@
         private KlassInfo(Symbol kSym) {
             appendedMethodList = new ListBuffer<>();
             deserializeCases = new HashMap<String, ListBuffer<JCStatement>>();
-            long flags = PRIVATE | STATIC | SYNTHETIC;
             MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType,
                     List.<Type>nil(), syms.methodClass);
-            deserMethodSym = makeSyntheticMethod(flags, names.deserializeLambda, type, kSym);
+            deserMethodSym = makePrivateSyntheticMethod(STATIC, names.deserializeLambda, type, kSym);
             deserParamSym = new VarSymbol(FINAL, names.fromString("lambda"),
                     syms.serializedLambdaType, deserMethodSym);
         }
@@ -671,8 +670,8 @@
     /**
      * Create new synthetic method with given flags, name, type, owner
      */
-    private MethodSymbol makeSyntheticMethod(long flags, Name name, Type type, Symbol owner) {
-        return new MethodSymbol(flags | SYNTHETIC, name, type, owner);
+    private MethodSymbol makePrivateSyntheticMethod(long flags, Name name, Type type, Symbol owner) {
+        return new MethodSymbol(flags | SYNTHETIC | PRIVATE, name, type, owner);
     }
 
     /**
@@ -1067,12 +1066,12 @@
         } else {
             if (refSym.isStatic()) {
                 return ClassFile.REF_invokeStatic;
+            } else if ((refSym.flags() & PRIVATE) != 0) {
+                return ClassFile.REF_invokeSpecial;
             } else if (refSym.enclClass().isInterface()) {
                 return ClassFile.REF_invokeInterface;
             } else {
-                return (refSym.flags() & PRIVATE) != 0 ?
-                        ClassFile.REF_invokeSpecial :
-                        ClassFile.REF_invokeVirtual;
+                return ClassFile.REF_invokeVirtual;
             }
         }
     }
@@ -1480,7 +1479,7 @@
                 //static clinits are generated in Gen - so we need to fake them
                 Symbol clinit = clinits.get(csym);
                 if (clinit == null) {
-                    clinit = makeSyntheticMethod(STATIC,
+                    clinit = makePrivateSyntheticMethod(STATIC,
                             names.clinit,
                             new MethodType(List.<Type>nil(), syms.voidType, List.<Type>nil(), syms.methodClass),
                             csym);
@@ -1729,7 +1728,7 @@
                     self = ((JCVariableDecl)frame.tree).sym;
                 }
                 Name name = isSerializable() ? serializedLambdaName(owner) : lambdaName();
-                this.translatedSym = makeSyntheticMethod(0, name, null, owner.enclClass());
+                this.translatedSym = makePrivateSyntheticMethod(0, name, null, owner.enclClass());
                 if (dumpLambdaToMethodStats) {
                     log.note(tree, "lambda.stat", needsAltMetafactory(), translatedSym);
                 }
@@ -1845,9 +1844,9 @@
 
                 // If instance access isn't needed, make it static.
                 // Interface instance methods must be default methods.
-                // Awaiting VM channges, default methods are public
+                // Lambda methods are private synthetic.
                 translatedSym.flags_field = SYNTHETIC |
-                        ((inInterface && thisReferenced)? PUBLIC : PRIVATE) |
+                        PRIVATE |
                         (thisReferenced? (inInterface? DEFAULT : 0) : STATIC);
 
                 //compute synthetic params
@@ -1890,7 +1889,7 @@
                 super(tree);
                 this.isSuper = tree.hasKind(ReferenceKind.SUPER);
                 this.bridgeSym = needsBridge()
-                        ? makeSyntheticMethod(isSuper ? 0 : STATIC,
+                        ? makePrivateSyntheticMethod(isSuper ? 0 : STATIC,
                                               lambdaName().append(names.fromString("$bridge")), null,
                                               owner.enclClass())
                         : null;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
index 5158825..3731f0d 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
@@ -2172,6 +2172,18 @@
  * Code for enabling/disabling assertions.
  *************************************************************************/
 
+    private ClassSymbol assertionsDisabledClassCache;
+
+    /**Used to create an auxiliary class to hold $assertionsDisabled for interfaces.
+     */
+    private ClassSymbol assertionsDisabledClass() {
+        if (assertionsDisabledClassCache != null) return assertionsDisabledClassCache;
+
+        assertionsDisabledClassCache = makeEmptyClass(STATIC | SYNTHETIC, outermostClassDef.sym).sym;
+
+        return assertionsDisabledClassCache;
+    }
+
     // This code is not particularly robust if the user has
     // previously declared a member named '$assertionsDisabled'.
     // The same faulty idiom also appears in the translation of
@@ -2182,8 +2194,9 @@
         // Outermost class may be either true class or an interface.
         ClassSymbol outermostClass = outermostClassDef.sym;
 
-        // note that this is a class, as an interface can't contain a statement.
-        ClassSymbol container = currentClass;
+        //only classes can hold a non-public field, look for a usable one:
+        ClassSymbol container = !currentClass.isInterface() ? currentClass :
+                assertionsDisabledClass();
 
         VarSymbol assertDisabledSym =
             (VarSymbol)lookupSynthetic(dollarAssertionsDisabled,
@@ -2208,6 +2221,16 @@
             JCVariableDecl assertDisabledDef = make.VarDef(assertDisabledSym,
                                                    notStatus);
             containerDef.defs = containerDef.defs.prepend(assertDisabledDef);
+
+            if (currentClass.isInterface()) {
+                //need to load the assertions enabled/disabled state while
+                //initializing the interface:
+                JCClassDecl currentClassDef = classDef(currentClass);
+                make_at(currentClassDef.pos());
+                JCStatement dummy = make.If(make.QualIdent(assertDisabledSym), make.Skip(), null);
+                JCBlock clinit = make.Block(STATIC, List.<JCStatement>of(dummy));
+                currentClassDef.defs = currentClassDef.defs.prepend(clinit);
+            }
         }
         make_at(pos);
         return makeUnary(NOT, make.Ident(assertDisabledSym));
@@ -2811,20 +2834,9 @@
         tree.underlyingType = translate(tree.underlyingType);
         // but maintain type annotations in the type.
         if (tree.type.isAnnotated()) {
-            if (tree.underlyingType.type.isAnnotated()) {
-                // The erasure of a type variable might be annotated.
-                // Merge all annotations.
-                AnnotatedType newat = (AnnotatedType) tree.underlyingType.type;
-                AnnotatedType at = (AnnotatedType) tree.type;
-                at.underlyingType = newat.underlyingType;
-                newat.typeAnnotations = at.typeAnnotations.appendList(newat.typeAnnotations);
-                tree.type = newat;
-            } else {
-                // Create a new AnnotatedType to have the correct tag.
-                AnnotatedType oldat = (AnnotatedType) tree.type;
-                tree.type = new AnnotatedType(tree.underlyingType.type);
-                ((AnnotatedType) tree.type).typeAnnotations = oldat.typeAnnotations;
-            }
+            tree.type = tree.underlyingType.type.unannotatedType().annotatedType(tree.type.getAnnotationMirrors());
+        } else if (tree.underlyingType.type.isAnnotated()) {
+            tree.type = tree.underlyingType.type;
         }
         result = tree;
     }
@@ -3929,6 +3941,7 @@
             accessConstrTags = null;
             accessed = null;
             enumSwitchMap.clear();
+            assertionsDisabledClassCache = null;
         }
         return translated.toList();
     }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
index fbb8c32..ce86533 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java
@@ -114,12 +114,15 @@
         deferredLintHandler = DeferredLintHandler.instance(context);
         lint = Lint.instance(context);
         allowTypeAnnos = source.allowTypeAnnotations();
+        allowRepeatedAnnos = source.allowRepeatedAnnotations();
     }
 
     /** Switch: support type annotations.
      */
     boolean allowTypeAnnos;
 
+    boolean allowRepeatedAnnos;
+
     /** A queue for classes whose members still need to be entered into the
      *  symbol table.
      */
@@ -199,7 +202,7 @@
         }.importFrom(tsym);
 
         // enter non-types before annotations that might use them
-        annotate.earlier(new Annotate.Annotator() {
+        annotate.earlier(new Annotate.Worker() {
             Set<Symbol> processed = new HashSet<Symbol>();
 
             public String toString() {
@@ -225,7 +228,7 @@
                     }
                 }
             }
-            public void enterAnnotation() {
+            public void run() {
                 importFrom(tsym);
             }
         });
@@ -293,7 +296,7 @@
         }.importFrom(tsym);
 
         // enter non-types before annotations that might use them
-        annotate.earlier(new Annotate.Annotator() {
+        annotate.earlier(new Annotate.Worker() {
             Set<Symbol> processed = new HashSet<Symbol>();
             boolean found = false;
 
@@ -323,7 +326,7 @@
                     }
                 }
             }
-            public void enterAnnotation() {
+            public void run() {
                 JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
                 try {
                     importFrom(tsym);
@@ -640,9 +643,6 @@
             if (TreeInfo.isEnumInit(tree)) {
                 attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype);
             } else {
-                // Make sure type annotations are processed.
-                // But we don't have a symbol to attach them to yet - use null.
-                typeAnnotate(tree.vartype, env, null, tree.pos());
                 attr.attribType(tree.vartype, localEnv);
                 if (tree.nameexpr != null) {
                     attr.attribExpr(tree.nameexpr, localEnv);
@@ -693,7 +693,6 @@
         }
         annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
         typeAnnotate(tree.vartype, env, v, tree.pos());
-        annotate.flush();
         v.pos = tree.pos;
     }
     // where
@@ -842,14 +841,14 @@
         if (s.kind != PCK) {
             s.resetAnnotations(); // mark Annotations as incomplete for now
         }
-        annotate.normal(new Annotate.Annotator() {
+        annotate.normal(new Annotate.Worker() {
                 @Override
                 public String toString() {
                     return "annotate " + annotations + " onto " + s + " in " + s.owner;
                 }
 
                 @Override
-                public void enterAnnotation() {
+                public void run() {
                     Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
                     JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
                     DiagnosticPosition prevLintPos =
@@ -872,6 +871,18 @@
                     }
                 }
             });
+
+        annotate.validate(new Annotate.Worker() { //validate annotations
+            @Override
+            public void run() {
+                JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
+                try {
+                    chk.validateAnnotations(annotations, s);
+                } finally {
+                    log.useSource(prev);
+                }
+            }
+        });
     }
 
     /**
@@ -906,14 +917,14 @@
             }
 
             if (annotated.containsKey(a.type.tsym)) {
-                if (source.allowRepeatedAnnotations()) {
-                    ListBuffer<Attribute.Compound> l = annotated.get(a.type.tsym);
-                    l = l.append(c);
-                    annotated.put(a.type.tsym, l);
-                    pos.put(c, a.pos());
-                } else {
-                    log.error(a.pos(), "duplicate.annotation");
+                if (!allowRepeatedAnnos) {
+                    log.error(a.pos(), "repeatable.annotations.not.supported.in.source");
+                    allowRepeatedAnnos = true;
                 }
+                ListBuffer<Attribute.Compound> l = annotated.get(a.type.tsym);
+                l = l.append(c);
+                annotated.put(a.type.tsym, l);
+                pos.put(c, a.pos());
             } else {
                 annotated.put(a.type.tsym, ListBuffer.of(c));
                 pos.put(c, a.pos());
@@ -935,7 +946,7 @@
     void annotateDefaultValueLater(final JCExpression defaultValue,
                                    final Env<AttrContext> localEnv,
                                    final MethodSymbol m) {
-        annotate.normal(new Annotate.Annotator() {
+        annotate.normal(new Annotate.Worker() {
                 @Override
                 public String toString() {
                     return "annotate " + m.owner + "." +
@@ -943,7 +954,7 @@
                 }
 
                 @Override
-                public void enterAnnotation() {
+                public void run() {
                     JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
                     try {
                         enterDefaultValue(defaultValue, localEnv, m);
@@ -952,6 +963,19 @@
                     }
                 }
             });
+        annotate.validate(new Annotate.Worker() { //validate annotations
+            @Override
+            public void run() {
+                JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
+                try {
+                    // if default value is an annotation, check it is a well-formed
+                    // annotation value (e.g. no duplicate values, no missing values, etc.)
+                    chk.validateAnnotationTree(defaultValue);
+                } finally {
+                    log.useSource(prev);
+                }
+            }
+        });
     }
 
     /** Enter a default value for an attribute method. */
@@ -1081,7 +1105,6 @@
             // Do this here, where we have the symbol.
             for (JCTypeParameter tp : tree.typarams)
                 typeAnnotate(tp, baseEnv, sym, tree.pos());
-            annotate.flush();
 
             // Add default constructor if needed.
             if ((c.flags() & INTERFACE) == 0 &&
@@ -1159,15 +1182,17 @@
         if (wasFirst) {
             try {
                 while (halfcompleted.nonEmpty()) {
-                    finish(halfcompleted.next());
+                    Env<AttrContext> toFinish = halfcompleted.next();
+                    finish(toFinish);
+                    if (allowTypeAnnos) {
+                        typeAnnotations.organizeTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
+                        typeAnnotations.validateTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
+                    }
                 }
             } finally {
                 isFirst = true;
             }
         }
-        if (allowTypeAnnos) {
-            typeAnnotations.organizeTypeAnnotationsSignatures(env, tree);
-        }
     }
 
     /*
@@ -1197,7 +1222,7 @@
                     annotated.put(a.type.tsym, l);
                     pos.put(tc, a.pos());
                 } else {
-                    log.error(a.pos(), "duplicate.annotation");
+                    log.error(a.pos(), "repeatable.annotations.not.supported.in.source");
                 }
             } else {
                 annotated.put(a.type.tsym, ListBuffer.of(tc));
@@ -1239,13 +1264,13 @@
 
             final DiagnosticPosition deferPos = this.deferPos;
 
-            annotate.normal(new Annotate.Annotator() {
+            annotate.normal(new Annotate.Worker() {
                 @Override
                 public String toString() {
                     return "type annotate " + annotations + " onto " + sym + " in " + sym.owner;
                 }
                 @Override
-                public void enterAnnotation() {
+                public void run() {
                     JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
                     DiagnosticPosition prevLintPos = null;
 
@@ -1381,7 +1406,7 @@
         if (!t.hasTag(ERROR))
             return t;
 
-        return new ErrorType(((ErrorType) t).getOriginalType(), t.tsym) {
+        return new ErrorType(t.getOriginalType(), t.tsym) {
             private Type modelType;
 
             @Override
diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
index 87eb366..b5c0cfe 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
@@ -424,13 +424,14 @@
          */
         private
         boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) {
+            Type newSite = site.hasTag(TYPEVAR) ? site.getUpperBound() : site;
             while (c != null &&
                    !(c.isSubClass(sym.owner, types) &&
                      (c.flags() & INTERFACE) == 0 &&
                      // In JLS 2e 6.6.2.1, the subclass restriction applies
                      // only to instance fields and methods -- types are excluded
                      // regardless of whether they are declared 'static' or not.
-                     ((sym.flags() & STATIC) != 0 || sym.kind == TYP || site.tsym.isSubClass(c, types))))
+                     ((sym.flags() & STATIC) != 0 || sym.kind == TYP || newSite.tsym.isSubClass(c, types))))
                 c = c.owner.enclClass();
             return c != null;
         }
@@ -2710,11 +2711,6 @@
                                   InferenceContext inferenceContext) {
         MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC;
 
-        if (site.hasTag(TYPEVAR)) {
-            return resolveMemberReference(pos, env, referenceTree, site.getUpperBound(),
-                    name, argtypes, typeargtypes, boxingAllowed, methodCheck, inferenceContext);
-        }
-
         site = types.capture(site);
 
         ReferenceLookupHelper boundLookupHelper;
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
index 3970695..8dcf059 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
@@ -1877,7 +1877,7 @@
         }
     }
 
-    class AnnotationDefaultCompleter extends AnnotationDeproxy implements Annotate.Annotator {
+    class AnnotationDefaultCompleter extends AnnotationDeproxy implements Annotate.Worker {
         final MethodSymbol sym;
         final Attribute value;
         final JavaFileObject classFile = currentClassFile;
@@ -1889,8 +1889,8 @@
             this.sym = sym;
             this.value = value;
         }
-        // implement Annotate.Annotator.enterAnnotation()
-        public void enterAnnotation() {
+        // implement Annotate.Worker.run()
+        public void run() {
             JavaFileObject previousClassFile = currentClassFile;
             try {
                 // Reset the interim value set earlier in
@@ -1904,7 +1904,7 @@
         }
     }
 
-    class AnnotationCompleter extends AnnotationDeproxy implements Annotate.Annotator {
+    class AnnotationCompleter extends AnnotationDeproxy implements Annotate.Worker {
         final Symbol sym;
         final List<CompoundAnnotationProxy> l;
         final JavaFileObject classFile;
@@ -1917,8 +1917,8 @@
             this.l = l;
             this.classFile = currentClassFile;
         }
-        // implement Annotate.Annotator.enterAnnotation()
-        public void enterAnnotation() {
+        // implement Annotate.Worker.run()
+        public void run() {
             JavaFileObject previousClassFile = currentClassFile;
             try {
                 currentClassFile = classFile;
@@ -1955,7 +1955,7 @@
         }
 
         @Override
-        public void enterAnnotation() {
+        public void run() {
             JavaFileObject previousClassFile = currentClassFile;
             try {
                 currentClassFile = classFile;
@@ -1993,11 +1993,15 @@
                 (flags & ABSTRACT) == 0 && !name.equals(names.clinit)) {
             if (majorVersion > Target.JDK1_8.majorVersion ||
                     (majorVersion == Target.JDK1_8.majorVersion && minorVersion >= Target.JDK1_8.minorVersion)) {
-                currentOwner.flags_field |= DEFAULT;
-                flags |= DEFAULT | ABSTRACT;
+                if ((flags & STATIC) == 0) {
+                    currentOwner.flags_field |= DEFAULT;
+                    flags |= DEFAULT | ABSTRACT;
+                }
             } else {
                 //protect against ill-formed classfiles
-                throw new CompletionFailure(currentOwner, "default method found in pre JDK 8 classfile");
+                throw badClassFile((flags & STATIC) == 0 ? "invalid.default.interface" : "invalid.static.interface",
+                                   Integer.toString(majorVersion),
+                                   Integer.toString(minorVersion));
             }
         }
         if (name == names.init && currentOwner.hasOuterInstance()) {
@@ -2401,8 +2405,6 @@
             return c;
     }
 
-    private boolean suppressFlush = false;
-
     /** Completion for classes to be loaded. Before a class is loaded
      *  we make sure its enclosing class (if any) is loaded.
      */
@@ -2410,13 +2412,14 @@
         if (sym.kind == TYP) {
             ClassSymbol c = (ClassSymbol)sym;
             c.members_field = new Scope.ErrorScope(c); // make sure it's always defined
-            boolean saveSuppressFlush = suppressFlush;
-            suppressFlush = true;
+            annotate.enterStart();
             try {
                 completeOwners(c.owner);
                 completeEnclosing(c);
             } finally {
-                suppressFlush = saveSuppressFlush;
+                // The flush needs to happen only after annotations
+                // are filled in.
+                annotate.enterDoneWithoutFlush();
             }
             fillIn(c);
         } else if (sym.kind == PCK) {
@@ -2427,7 +2430,7 @@
                 throw new CompletionFailure(sym, ex.getLocalizedMessage()).initCause(ex);
             }
         }
-        if (!filling && !suppressFlush)
+        if (!filling)
             annotate.flush(); // finish attaching annotations
     }
 
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
index 7e727f2..b48b727 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java
@@ -104,6 +104,8 @@
      */
     private LVTRanges lvtRanges;
 
+    private final boolean typeAnnoAsserts;
+
     protected Gen(Context context) {
         context.put(genKey, this);
 
@@ -140,6 +142,7 @@
         debugCode = options.isSet("debugcode");
         allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
         pool = new Pool(types);
+        typeAnnoAsserts = options.isSet("TypeAnnotationAsserts");
 
         generateIproxies =
             target.requiresIproxy() ||
@@ -562,9 +565,13 @@
         ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>();
         ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>();
         for (TypeCompound ta : tas) {
-            if (ta.position.type == TargetType.FIELD) {
+            if (ta.getPosition().type == TargetType.FIELD) {
                 fieldTAs.add(ta);
             } else {
+                if (typeAnnoAsserts) {
+                    Assert.error("Type annotation does not have a valid positior");
+                }
+
                 nonfieldTAs.add(ta);
             }
         }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java
index 1437135..4389d08 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java
@@ -296,7 +296,10 @@
                     interfaceOwner = true;
                     staticOk = true;
                 case ClassFile.REF_invokeVirtual:
+                    expectedKind = Kinds.MTH;
+                    break;
                 case ClassFile.REF_invokeSpecial:
+                    interfaceOwner = true;
                     expectedKind = Kinds.MTH;
                     break;
             }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java b/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java
deleted file mode 100644
index c05662c..0000000
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.javac.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Inherited;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.TypeVariableSymbol;
-import com.sun.tools.javac.code.TargetType;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.AnnotatedType;
-import com.sun.tools.javac.util.ListBuffer;
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-import com.sun.tools.javac.util.List;
-
-/**
- * Utility methods for operating on annotated constructs.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk.  This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public class JavacAnnoConstructs {
-
-    // <editor-fold defaultstate="collapsed" desc="Symbols">
-
-    /**
-     * An internal-use utility that creates a runtime view of an
-     * annotation. This is the implementation of
-     * Element.getAnnotation(Class).
-     */
-    public static <A extends Annotation> A getAnnotation(Symbol annotated,
-                                                         Class<A> annoType) {
-        if (!annoType.isAnnotation())
-            throw new IllegalArgumentException("Not an annotation type: "
-                                               + annoType);
-        Attribute.Compound c;
-        if (annotated.kind == Kinds.TYP &&
-                annotated instanceof ClassSymbol) {
-            c = getAttributeOnClass((ClassSymbol)annotated, annoType);
-        } else if (annotated.kind == Kinds.TYP &&
-                   annotated instanceof TypeVariableSymbol) {
-            c = getAttributeOnTypeVariable((TypeVariableSymbol)annotated, annoType);
-        } else {
-            c = getAttribute(annotated, annoType);
-        }
-        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
-    }
-
-    // Helper to getAnnotation[s]
-    private static <A extends Annotation> Attribute.Compound getAttribute(Symbol annotated,
-                                                                          Class<A> annoType) {
-        String name = annoType.getName();
-
-        for (Attribute.Compound anno : annotated.getRawAttributes()) {
-            if (name.equals(anno.type.tsym.flatName().toString()))
-                return anno;
-        }
-
-        return null;
-    }
-
-    // Helper to getAnnotation[s]
-    private static <A extends Annotation> Attribute.Compound
-            getAttributeOnTypeVariable(TypeVariableSymbol annotated, Class<A> annoType) {
-        String name = annoType.getName();
-
-        // Declaration annotations on type variables are stored in type attributes
-        // on the owner of the TypeVariableSymbol
-        List<Attribute.Compound> res = List.nil();
-        List<Attribute.TypeCompound> candidates = annotated.owner.getRawTypeAttributes();
-        for (Attribute.TypeCompound anno : candidates)
-            if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER ||
-                    anno.position.type == TargetType.METHOD_TYPE_PARAMETER)
-                if (name.equals(anno.type.tsym.flatName().toString()))
-                    return anno;
-
-        return null;
-    }
-
-    // Helper to getAnnotation[s]
-    private static <A extends Annotation> Attribute.Compound getAttributeOnClass(
-            ClassSymbol annotated,
-            final Class<A> annoType)
-    {
-        boolean inherited = annoType.isAnnotationPresent(Inherited.class);
-        Attribute.Compound result = null;
-
-        result = getAttribute(annotated, annoType);
-        if (result != null || !inherited)
-            return result;
-
-        while ((annotated = nextSupertypeToSearch(annotated)) != null) {
-            result = getAttribute(annotated, annoType);
-            if (result != null)
-                return result;
-        }
-        return null; // no more supertypes to search
-    }
-
-    /**
-     * Returns the next type to search for inherited annotations or {@code null}
-     * if the next type can't be found.
-     */
-    private static ClassSymbol nextSupertypeToSearch(ClassSymbol annotated) {
-        if (annotated.name == annotated.name.table.names.java_lang_Object)
-            return null;
-
-        Type sup = annotated.getSuperclass();
-        if (!sup.hasTag(CLASS) || sup.isErroneous())
-            return null;
-
-        return (ClassSymbol) sup.tsym;
-    }
-
-    /**
-     * An internal-use utility that creates a runtime view of
-     * annotations. This is the implementation of
-     * Element.getAnnotations(Class).
-     */
-    public static <A extends Annotation> A[] getAnnotationsByType(Symbol annotated,
-            Class<A> annoType)
-    {
-        if (!annoType.isAnnotation())
-            throw new IllegalArgumentException("Not an annotation type: "
-                                               + annoType);
-        // If annoType does not declare a container this is equivalent to wrapping
-        // getAnnotation(...) in an array.
-        Class <? extends Annotation> containerType = getContainer(annoType);
-        if (containerType == null) {
-            A res = getAnnotation(annotated, annoType);
-            int size;
-            if (res == null) {
-                size = 0;
-            } else {
-                size = 1;
-            }
-            @SuppressWarnings("unchecked") // annoType is the Class for A
-            A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
-            if (res != null)
-                arr[0] = res;
-            return arr;
-        }
-
-        // So we have a containing type
-        String annoTypeName = annoType.getName();
-        String containerTypeName = containerType.getName();
-        int directIndex = -1, containerIndex = -1;
-        Attribute.Compound direct = null, container = null;
-        // Find directly (explicit or implicit) present annotations
-        int index = -1;
-        for (List<Attribute.Compound> list = annotated.getAnnotationMirrors();
-                !list.isEmpty();
-                list = list.tail) {
-            Attribute.Compound attribute = list.head;
-            index++;
-            if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
-                directIndex = index;
-                direct = attribute;
-            } else if(containerTypeName != null &&
-                      attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
-                containerIndex = index;
-                container = attribute;
-            }
-        }
-
-        // Deal with inherited annotations
-        if (direct == null && container == null) {
-            if (annotated.kind == Kinds.TYP &&
-                    (annotated instanceof ClassSymbol)) {
-                ClassSymbol s = nextSupertypeToSearch((ClassSymbol)annotated);
-                if (s != null)
-                    return getAnnotationsByType(s, annoType);
-            }
-        }
-
-        // Pack them in an array
-        Attribute[] contained0 = null;
-        if (container != null)
-            contained0 = unpackAttributes(container);
-        ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
-        if (contained0 != null) {
-            for (Attribute a : contained0)
-                if (a instanceof Attribute.Compound)
-                    compounds = compounds.append((Attribute.Compound)a);
-        }
-        Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
-
-        int size = (direct == null ? 0 : 1) + contained.length;
-        @SuppressWarnings("unchecked") // annoType is the Class for A
-        A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
-
-        // if direct && container, which is first?
-        int insert = -1;
-        int length = arr.length;
-        if (directIndex >= 0 && containerIndex >= 0) {
-            if (directIndex < containerIndex) {
-                arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
-                insert = 1;
-            } else {
-                arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
-                insert = 0;
-                length--;
-            }
-        } else if (directIndex >= 0) {
-            arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
-            return arr;
-        } else {
-            // Only container
-            insert = 0;
-        }
-
-        for (int i = 0; i + insert < length; i++)
-            arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
-
-        return arr;
-    }
-
-    // </editor-fold>
-
-    // <editor-fold defaultstate="collapsed" desc="Types">
-
-    /**
-     * An internal-use utility that creates a runtime view of an
-     * annotation. This is the implementation of
-     * TypeMirror.getAnnotation(Class).
-     */
-    public static <A extends Annotation> A getAnnotation(AnnotatedType annotated, Class<A> annoType) {
-        if (!annoType.isAnnotation())
-            throw new IllegalArgumentException("Not an annotation type: "
-                                               + annoType);
-        Attribute.Compound c = getAttribute(annotated, annoType);
-        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
-    }
-
-    // Helper to getAnnotation[s]
-    private static <A extends Annotation> Attribute.Compound getAttribute(Type annotated,
-                                                                          Class<A> annoType) {
-        String name = annoType.getName();
-
-        for (Attribute.Compound anno : annotated.getAnnotationMirrors()) {
-            if (name.equals(anno.type.tsym.flatName().toString()))
-                return anno;
-        }
-
-        return null;
-    }
-
-    /**
-     * An internal-use utility that creates a runtime view of
-     * annotations. This is the implementation of
-     * TypeMirror.getAnnotationsByType(Class).
-     */
-    public static <A extends Annotation> A[] getAnnotationsByType(AnnotatedType annotated, Class<A> annoType) {
-        if (!annoType.isAnnotation())
-            throw new IllegalArgumentException("Not an annotation type: "
-                                               + annoType);
-        // If annoType does not declare a container this is equivalent to wrapping
-        // getAnnotation(...) in an array.
-        Class <? extends Annotation> containerType = getContainer(annoType);
-        if (containerType == null) {
-            A res = getAnnotation(annotated, annoType);
-            int size;
-            if (res == null) {
-                size = 0;
-            } else {
-                size = 1;
-            }
-            @SuppressWarnings("unchecked") // annoType is the Class for A
-            A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
-            if (res != null)
-                arr[0] = res;
-            return arr;
-        }
-
-        // So we have a containing type
-        String annoTypeName = annoType.getName();
-        String containerTypeName = containerType.getName();
-        int directIndex = -1, containerIndex = -1;
-        Attribute.Compound direct = null, container = null;
-        // Find directly (explicit or implicit) present annotations
-        int index = -1;
-        for (List<? extends Attribute.Compound> list = annotated.getAnnotationMirrors();
-                !list.isEmpty();
-                list = list.tail) {
-            Attribute.Compound attribute = list.head;
-            index++;
-            if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
-                directIndex = index;
-                direct = attribute;
-            } else if(containerTypeName != null &&
-                      attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
-                containerIndex = index;
-                container = attribute;
-            }
-        }
-
-        // Pack them in an array
-        Attribute[] contained0 = null;
-        if (container != null)
-            contained0 = unpackAttributes(container);
-        ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
-        if (contained0 != null) {
-            for (Attribute a : contained0)
-                if (a instanceof Attribute.Compound)
-                    compounds = compounds.append((Attribute.Compound)a);
-        }
-        Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
-
-        int size = (direct == null ? 0 : 1) + contained.length;
-        @SuppressWarnings("unchecked") // annoType is the Class for A
-        A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
-
-        // if direct && container, which is first?
-        int insert = -1;
-        int length = arr.length;
-        if (directIndex >= 0 && containerIndex >= 0) {
-            if (directIndex < containerIndex) {
-                arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
-                insert = 1;
-            } else {
-                arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
-                insert = 0;
-                length--;
-            }
-        } else if (directIndex >= 0) {
-            arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
-            return arr;
-        } else {
-            // Only container
-            insert = 0;
-        }
-
-        for (int i = 0; i + insert < length; i++)
-            arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
-
-        return arr;
-    }
-
-    // </editor-fold>
-
-    // <editor-fold defaultstate="collapsed" desc="Container support">
-
-    // Needed to unpack the runtime view of containing annotations
-    private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable();
-    private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
-
-    private static Class<? extends Annotation> initRepeatable() {
-        try {
-            // Repeatable will not be available when bootstrapping on
-            // JDK 7 so use a reflective lookup instead of a class
-            // literal for Repeatable.class.
-            return Class.forName("java.lang.annotation.Repeatable").asSubclass(Annotation.class);
-        } catch (ClassNotFoundException e) {
-            return null;
-        } catch (SecurityException e) {
-            return null;
-        }
-    }
-
-    private static Method initValueElementMethod() {
-        if (REPEATABLE_CLASS == null)
-            return null;
-
-        Method m = null;
-        try {
-            m = REPEATABLE_CLASS.getMethod("value");
-            if (m != null)
-                m.setAccessible(true);
-            return m;
-        } catch (NoSuchMethodException e) {
-            return null;
-        }
-    }
-
-    // Helper to getAnnotations
-    private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
-        // Since we can not refer to java.lang.annotation.Repeatable until we are
-        // bootstrapping with java 8 we need to get the Repeatable annotation using
-        // reflective invocations instead of just using its type and element method.
-        if (REPEATABLE_CLASS != null &&
-            VALUE_ELEMENT_METHOD != null) {
-            // Get the Repeatable instance on the annotations declaration
-            Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS);
-            if (repeatable != null) {
-                try {
-                    // Get the value element, it should be a class
-                    // indicating the containing annotation type
-                    @SuppressWarnings("unchecked")
-                    Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable);
-                    if (containerType == null)
-                        return null;
-
-                    return containerType;
-                } catch (ClassCastException e) {
-                    return null;
-                } catch (IllegalAccessException e) {
-                    return null;
-                } catch (InvocationTargetException e ) {
-                    return null;
-                }
-            }
-        }
-        return null;
-    }
-
-    // Helper to getAnnotations
-    private static Attribute[] unpackAttributes(Attribute.Compound container) {
-        // We now have an instance of the container,
-        // unpack it returning an instance of the
-        // contained type or null
-        return ((Attribute.Array)container.member(container.type.tsym.name.table.names.value)).values;
-    }
-
-    // </editor-fold>
-}
diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
index f8174d4..8874ec1 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
@@ -78,26 +78,26 @@
 
 # 0: string
 compiler.err.already.defined.single.import=\
-    {0} is already defined in a single-type import
+    a type with the same simple name is already defined by the single-type-import of {0}
 
 # 0: string
 compiler.err.already.defined.static.single.import=\
-    {0} is already defined in a static single-type import
+    a type with the same simple name is already defined by the static single-type-import of {0}
 
 compiler.err.already.defined.this.unit=\
     {0} is already defined in this compilation unit
 
 # 0: type, 1: list of name
 compiler.err.annotation.missing.default.value=\
-    annotation {0} is missing value for the attribute {1}
+    annotation @{0} is missing a default value for the element ''{1}''
 
 # 0: type, 1: list of name
 compiler.err.annotation.missing.default.value.1=\
-    annotation {0} is missing values for attributes {1}
+    annotation @{0} is missing default values for elements {1}
 
 # 0: type
 compiler.err.annotation.not.valid.for.type=\
-    annotation not valid for a value of type {0}
+    annotation not valid for an element of type {0}
 
 compiler.err.annotation.type.not.applicable=\
     annotation type not applicable to this kind of declaration
@@ -135,7 +135,7 @@
     array required, but {0} found
 
 compiler.err.attribute.value.must.be.constant=\
-    attribute value must be constant
+    element value must be a constant expression
 
 # 0: statement type
 compiler.err.bad.initializer=\
@@ -298,8 +298,9 @@
 compiler.err.cyclic.inheritance=\
     cyclic inheritance involving {0}
 
+# 0: symbol
 compiler.err.cyclic.annotation.element=\
-    cyclic annotation element type
+    type of element {0} is cyclic
 
 # 0: unused
 compiler.err.call.to.super.not.allowed.in.enum.ctor=\
@@ -307,73 +308,70 @@
 
 # 0: type
 compiler.err.no.superclass=\
-    {0} has no superclass
+    {0} has no superclass.
 
 # 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
 compiler.err.concrete.inheritance.conflict=\
     methods {0} from {1} and {2} from {3} are inherited with the same signature
 
 compiler.err.default.allowed.in.intf.annotation.member=\
-    default value only allowed in an @interface member
+    default value only allowed in an annotation type declaration
 
 # 0: symbol
 compiler.err.doesnt.exist=\
     package {0} does not exist
 
-compiler.err.duplicate.annotation=\
-    duplicate annotation
-
 # 0: type
 compiler.err.duplicate.annotation.invalid.repeated=\
-    annotation {0} cannot be repeated\nIt does not define a valid containing annotation.
+    annotation {0} is not a valid repeatable annotation
 
 # 0: name, 1: type
 compiler.err.duplicate.annotation.member.value=\
-    duplicate annotation member value {0} in {1}
+    duplicate element ''{0}'' in annotation @{1}.
 
-# 0: type, 1: type
+# 0: name, 1: unused
 compiler.err.duplicate.annotation.missing.container=\
-    duplicate annotation: the declaration of {0} does not have a valid {1} annotation
+    {0} is not a repeatable annotation type
 
-# 0: type
+# 0: type, 1: unused
 compiler.err.invalid.repeatable.annotation=\
-    duplicate annotation: {0} is annotated with an invalid Repeatable annotation
+    duplicate annotation: {0} is annotated with an invalid @Repeatable annotation
 
 # 0: symbol or type
 compiler.err.invalid.repeatable.annotation.no.value=\
-    duplicate annotation: {0} is not a valid Repeatable, no value element method declared
+    {0} is not a valid @Repeatable, no value element method declared
 
 # 0: type, 1: number
 compiler.err.invalid.repeatable.annotation.multiple.values=\
-    duplicate annotation: {0} is not a valid Repeatable, {1} value element methods declared
+    {0} is not a valid @Repeatable, {1} element methods named ''value'' declared
 
 # 0: type
 compiler.err.invalid.repeatable.annotation.invalid.value=\
-    duplicate annotation: {0} is not a valid Repeatable: invalid value element
+    {0} is not a valid @Repeatable: invalid value element
 
-# 0: symbol type, 1: type, 2: type
+# 0: symbol type, 1: unused, 2: type
 compiler.err.invalid.repeatable.annotation.value.return=\
-    duplicate annotation: value element of containing annotation {0} should have type {2}, found {1}
+    containing annotation type ({0}) must declare an element named ''value'' of type {2}
 
 # 0: symbol or type, 1: symbol
 compiler.err.invalid.repeatable.annotation.elem.nondefault=\
-    containing annotation {0} does not have a default value for element {1}
+    containing annotation type ({0}) does not have a default value for element {1}
 
-# 0: symbol, 1: type, 2: symbol, 3: type
+# 0: symbol, 1: unused, 2: symbol, 3: unused
 compiler.err.invalid.repeatable.annotation.retention=\
-    containing annotation {0} has shorter retention ({1}) than the contained annotation {2} with retention {3}
+    retention of containing annotation type ({0}) is shorter than the retention of repeatable annotation type ({2})
 
 # 0: symbol, 1: symbol
 compiler.err.invalid.repeatable.annotation.not.documented=\
-    containing annotation type, {0}, is not @Documented while repeated annotation type, {1}, is
+    repeatable annotation type ({1}) is @Documented while containing annotation type ({0}) is not
 
 # 0: symbol, 1: symbol
 compiler.err.invalid.repeatable.annotation.not.inherited=\
-    containing annotation type, {0}, is not @Inherited while repeated annotation type, {1}, is
+    repeatable annotation type ({1}) is @Inherited while containing annotation type ({0}) is not
 
 # 0: symbol, 1: symbol
 compiler.err.invalid.repeatable.annotation.incompatible.target=\
-    target of container annotation {0} is not a subset of target of repeated annotation {1}
+    containing annotation type ({0}) is applicable to more targets than repeatable annotation type ({1})
 
 # 0: symbol
 compiler.err.invalid.repeatable.annotation.repeated.and.container.present=\
@@ -561,26 +559,31 @@
     integer number too large: {0}
 
 compiler.err.intf.annotation.members.cant.have.params=\
-    @interface members may not have parameters
+    elements in annotation type declarations cannot declare formal parameters
 
+# 0: symbol
 compiler.err.intf.annotation.cant.have.type.params=\
-    @interface may not have type parameters
+    annotation type {0} cannot be generic
 
 compiler.err.intf.annotation.members.cant.have.type.params=\
-    @interface members may not have type parameters
+    elements in annotation type declarations cannot be generic methods
 
 # 0: symbol, 1: type
 compiler.err.intf.annotation.member.clash=\
-    @interface member clashes with method ''{0}'' in {1}
+    annotation type {1} declares an element with the same name as method {0}
 
 compiler.err.intf.expected.here=\
     interface expected here
 
+compiler.err.intf.or.array.expected.here=\
+    interface or array type expected here
+
 compiler.err.intf.meth.cant.have.body=\
     interface abstract methods cannot have body
 
+# 0: symbol
 compiler.err.invalid.annotation.member.type=\
-    invalid type for annotation member
+    invalid type for element {0} of annotation type
 
 compiler.err.invalid.binary.number=\
     binary numbers must contain at least one binary digit
@@ -1699,6 +1702,7 @@
     cannot access {0}\n\
     {1}
 
+# 0: file name, 1: message segment
 compiler.misc.bad.class.file.header=\
     bad class file: {0}\n\
     {1}\n\
@@ -1744,6 +1748,14 @@
 compiler.misc.class.file.not.found=\
     class file for {0} not found
 
+# 0: classfile major version, 1: classfile minor version
+compiler.misc.invalid.default.interface=\
+    default method found in version {0}.{1} classfile
+
+# 0: classfile major version, 1: classfile minor version
+compiler.misc.invalid.static.interface=\
+    static method found in version {0}.{1} classfile
+
 # 0: name
 compiler.misc.file.doesnt.contain.class=\
     file does not contain class {0}
@@ -2245,13 +2257,14 @@
     receiver parameter not applicable for constructor of top-level class
 
 # TODO 308: make a better error message
-compiler.err.cant.annotate.static.class=\
-    enclosing static nested class cannot be annotated
+# 0: symbol
+compiler.err.cant.type.annotate.scoping.1=\
+    scoping construct cannot be annotated with type-use annotation: {0}
 
 # TODO 308: make a better error message
-# 0: unused
-compiler.err.cant.annotate.nested.type=\
-    scoping construct for static nested type cannot be annotated
+# 0: list of symbol
+compiler.err.cant.type.annotate.scoping=\
+    scoping construct cannot be annotated with type-use annotations: {0}
 
 # 0: type, 1: type
 compiler.err.incorrect.receiver.name=\
@@ -2301,8 +2314,13 @@
 (use -source 8 or higher to enable type annotations)
 
 # 0: string
+compiler.err.repeatable.annotations.not.supported.in.source=\
+    repeated annotations are not supported in -source {0}\n\
+(use -source 8 or higher to enable repeated annotations)
+
+# 0: string
 compiler.err.foreach.not.supported.in.source=\
-    for-each loops are not supported in -source {0}\n\
+    enhanced for loops are not supported in -source {0}\n\
     (use -source 5 or higher to enable for-each loops)
 
 # 0: string
diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
index d1d7108..9bec1cc 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
@@ -2359,6 +2359,7 @@
         public JCExpression underlyingType;
 
         protected JCAnnotatedType(List<JCAnnotation> annotations, JCExpression underlyingType) {
+            Assert.check(annotations != null && annotations.nonEmpty());
             this.annotations = annotations;
             this.underlyingType = underlyingType;
         }
diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java
index 653d9e5..9076ce4 100644
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java
@@ -782,9 +782,9 @@
     public void visitConditional(JCConditional tree) {
         try {
             open(prec, TreeInfo.condPrec);
-            printExpr(tree.cond, TreeInfo.condPrec);
+            printExpr(tree.cond, TreeInfo.condPrec + 1);
             print(" ? ");
-            printExpr(tree.truepart, TreeInfo.condPrec);
+            printExpr(tree.truepart);
             print(" : ");
             printExpr(tree.falsepart, TreeInfo.condPrec);
             close(prec, TreeInfo.condPrec);
diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
index 160ccbc..9ea169d 100644
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
@@ -619,8 +619,10 @@
         Names names = tsym.name.table.names;
         List<MethodDocImpl> methods = List.nil();
         for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
-            if (e.sym != null &&
-                e.sym.kind == Kinds.MTH && e.sym.name != names.init) {
+            if (e.sym != null
+                && e.sym.kind == Kinds.MTH
+                && e.sym.name != names.init
+                && e.sym.name != names.clinit) {
                 MethodSymbol s = (MethodSymbol)e.sym;
                 if (!filter || env.shouldDocument(s)) {
                     methods = methods.prepend(env.getMethodDoc(s));
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/src/share/classes/com/sun/tools/javap/package-info.java
similarity index 61%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/src/share/classes/com/sun/tools/javap/package-info.java
index 1301f4e..aa2de00 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/package-info.java
@@ -1,10 +1,12 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, 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.
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -21,12 +23,13 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+/**
+    Classes to dump class files in text format.
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+    <p><b>This is NOT part of any supported API.
+    If you write code that depends on this, you do so at your own risk.
+    This code and its internal interfaces are subject to change or
+    deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.javap;
diff --git a/langtools/src/share/classes/com/sun/tools/javap/package.html b/langtools/src/share/classes/com/sun/tools/javap/package.html
deleted file mode 100644
index 60374f2..0000000
--- a/langtools/src/share/classes/com/sun/tools/javap/package.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <title></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-  </head>
-  <body>
-  Classes to dump class files in text format.
-  </body>
-</html>
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java b/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java
index ca086e3..0dadafb 100644
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java
@@ -25,9 +25,8 @@
 package com.sun.tools.jdeps;
 
 import com.sun.tools.classfile.Dependency.Location;
-import java.util.ArrayList;
+import com.sun.tools.jdeps.PlatformClassPath.JDKArchive;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -52,8 +51,8 @@
     };
 
     private final Type type;
-    private final List<ArchiveDeps> results = new ArrayList<ArchiveDeps>();
-    private final Map<String, Archive> map = new HashMap<String, Archive>();
+    private final Map<Archive, ArchiveDeps> results = new HashMap<>();
+    private final Map<String, Archive> map = new HashMap<>();
     private final Archive NOT_FOUND
         = new Archive(JdepsTask.getMessage("artifact.not.found"));
 
@@ -78,27 +77,27 @@
                 deps = new PackageVisitor(archive);
             }
             archive.visit(deps);
-            results.add(deps);
+            results.put(archive, deps);
         }
 
         // set the required dependencies
-        for (ArchiveDeps result: results) {
+        for (ArchiveDeps result: results.values()) {
             for (Set<String> set : result.deps.values()) {
                 for (String target : set) {
                     Archive source = getArchive(target);
                     if (result.archive != source) {
-                        if (!result.requiredArchives.contains(source)) {
-                            result.requiredArchives.add(source);
+                        String profile = "";
+                        if (source instanceof JDKArchive) {
+                            profile = result.profile != null ? result.profile.toString() : "";
+                            if (result.getTargetProfile(target) == null) {
+                                profile += ", JDK internal API";
+                                // override the value if it accesses any JDK internal
+                                result.requireArchives.put(source, profile);
+                                continue;
+                            }
                         }
-                        // either a profile name or the archive name
-                        String tname = result.getTargetProfile(target);
-                        if (tname.isEmpty()) {
-                            tname = PlatformClassPath.contains(source)
-                                        ? "JDK internal API (" + source.getFileName() + ")"
-                                        : source.toString();
-                        }
-                        if (!result.targetNames.contains(tname)) {
-                            result.targetNames.add(tname);
+                        if (!result.requireArchives.containsKey(source)) {
+                            result.requireArchives.put(source, profile);
                         }
                     }
                 }
@@ -106,42 +105,46 @@
         }
     }
 
+    public boolean hasDependences(Archive archive) {
+        if (results.containsKey(archive)) {
+            return results.get(archive).deps.size() > 0;
+        }
+        return false;
+    }
+
     public interface Visitor {
         /**
+         * Visits the source archive to its destination archive of
+         * a recorded dependency.
+         */
+        void visitArchiveDependence(Archive origin, Archive target, String profile);
+        /**
          * Visits a recorded dependency from origin to target which can be
          * a fully-qualified classname, a package name, a profile or
          * archive name depending on the Analyzer's type.
          */
-        void visit(String origin, String target, String profile);
-        /**
-         * Visits the source archive to its destination archive of
-         * a recorded dependency.
-         */
-        void visit(Archive source, Archive dest);
+        void visitDependence(String origin, Archive source, String target, Archive archive, String profile);
     }
 
-    public void visitSummary(Visitor v) {
-        for (ArchiveDeps r : results) {
-            for (Archive a : r.requiredArchives) {
-                v.visit(r.archive, a);
-            }
-            for (String name : r.targetNames) {
-                v.visit(r.archive.getFileName(), name, name);
-            }
+    public void visitArchiveDependences(Archive source, Visitor v) {
+        ArchiveDeps r = results.get(source);
+        for (Map.Entry<Archive,String> e : r.requireArchives.entrySet()) {
+            v.visitArchiveDependence(r.archive, e.getKey(), e.getValue());
         }
     }
 
-    public void visit(Visitor v) {
-        for (ArchiveDeps r: results) {
-            for (Archive a : r.requiredArchives) {
-                v.visit(r.archive, a);
-            }
-            for (String origin : r.deps.keySet()) {
-                for (String target : r.deps.get(origin)) {
-                    // filter intra-dependency unless in verbose mode
-                    if (type == Type.VERBOSE || getArchive(origin) != getArchive(target)) {
-                        v.visit(origin, target, r.getTargetProfile(target));
-                    }
+    public void visitDependences(Archive source, Visitor v) {
+        ArchiveDeps r = results.get(source);
+        for (String origin : r.deps.keySet()) {
+            for (String target : r.deps.get(origin)) {
+                Archive archive = getArchive(target);
+                assert source == getArchive(origin);
+                Profile profile = r.getTargetProfile(target);
+
+                // filter intra-dependency unless in verbose mode
+                if (type == Type.VERBOSE || archive != source) {
+                    v.visitDependence(origin, source, target, archive,
+                                      profile != null ? profile.toString() : "");
                 }
             }
         }
@@ -151,29 +154,15 @@
         return map.containsKey(name) ? map.get(name) : NOT_FOUND;
     }
 
-    /**
-     * Returns the file name of the archive for non-JRE class or
-     * internal JRE classes.  It returns empty string for SE API.
-     */
-    public String getArchiveName(String target, String profile) {
-        Archive source = getArchive(target);
-        String name = source.getFileName();
-        if (PlatformClassPath.contains(source))
-            return profile.isEmpty() ? "JDK internal API (" + name + ")" : "";
-        return name;
-    }
-
     private abstract class ArchiveDeps implements Archive.Visitor {
         final Archive archive;
-        final Set<Archive> requiredArchives;
-        final SortedSet<String> targetNames;
+        final Map<Archive,String> requireArchives;
         final SortedMap<String, SortedSet<String>> deps;
-
+        Profile profile = null;
         ArchiveDeps(Archive archive) {
             this.archive = archive;
-            this.requiredArchives = new HashSet<Archive>();
-            this.targetNames = new TreeSet<String>();
-            this.deps = new TreeMap<String, SortedSet<String>>();
+            this.requireArchives = new HashMap<>();
+            this.deps = new TreeMap<>();
         }
 
         void add(String loc) {
@@ -188,17 +177,19 @@
         void add(String origin, String target) {
             SortedSet<String> set = deps.get(origin);
             if (set == null) {
-                set = new TreeSet<String>();
-                deps.put(origin, set);
+                deps.put(origin, set = new TreeSet<>());
             }
             if (!set.contains(target)) {
                 set.add(target);
+                // find the corresponding profile
+                Profile p = getTargetProfile(target);
+                if (profile == null || (p != null && profile.profile < p.profile)) {
+                     profile = p;
+                }
             }
         }
-
         public abstract void visit(Location o, Location t);
-        public abstract String getTargetProfile(String target);
-
+        public abstract Profile getTargetProfile(String target);
     }
 
     private class ClassVisitor extends ArchiveDeps {
@@ -211,9 +202,9 @@
         public void visit(Location o, Location t) {
             add(o.getClassName(), t.getClassName());
         }
-        public String getTargetProfile(String target) {
+        public Profile getTargetProfile(String target) {
             int i = target.lastIndexOf('.');
-            return (i > 0) ? Profiles.getProfileName(target.substring(0, i)) : "";
+            return (i > 0) ? Profile.getProfile(target.substring(0, i)) : null;
         }
     }
 
@@ -231,8 +222,8 @@
             String pkg = loc.getPackageName();
             return pkg.isEmpty() ? "<unnamed>" : pkg;
         }
-        public String getTargetProfile(String target) {
-            return Profiles.getProfileName(target);
+        public Profile getTargetProfile(String target) {
+            return Profile.getProfile(target);
         }
     }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/Archive.java b/langtools/src/share/classes/com/sun/tools/jdeps/Archive.java
index 46cd07e..826c766 100644
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Archive.java
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Archive.java
@@ -25,7 +25,7 @@
 package com.sun.tools.jdeps;
 
 import com.sun.tools.classfile.Dependency.Location;
-import java.io.File;
+import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -35,21 +35,20 @@
  * Represents the source of the class files.
  */
 public class Archive {
-    private final File file;
+    private final Path path;
     private final String filename;
     private final ClassFileReader reader;
-    private final Map<Location, Set<Location>> deps
-        = new HashMap<Location, Set<Location>>();
+    private final Map<Location, Set<Location>> deps = new HashMap<>();
 
     public Archive(String name) {
-        this.file = null;
+        this.path = null;
         this.filename = name;
         this.reader = null;
     }
 
-    public Archive(File f, ClassFileReader reader) {
-        this.file = f;
-        this.filename = f.getName();
+    public Archive(Path p, ClassFileReader reader) {
+        this.path = p;
+        this.filename = path.getFileName().toString();
         this.reader = reader;
     }
 
@@ -64,14 +63,14 @@
     public void addClass(Location origin) {
         Set<Location> set = deps.get(origin);
         if (set == null) {
-            set = new HashSet<Location>();
+            set = new HashSet<>();
             deps.put(origin, set);
         }
     }
     public void addClass(Location origin, Location target) {
         Set<Location> set = deps.get(origin);
         if (set == null) {
-            set = new HashSet<Location>();
+            set = new HashSet<>();
             deps.put(origin, set);
         }
         set.add(target);
@@ -87,7 +86,7 @@
     }
 
     public String toString() {
-        return file != null ? file.getPath() : filename;
+        return path != null ? path.toString() : filename;
     }
 
     interface Visitor {
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java b/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java
index 8c947e3..62219b8 100644
--- a/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java
@@ -45,17 +45,17 @@
     /**
      * Returns a ClassFileReader instance of a given path.
      */
-    public static ClassFileReader newInstance(File path) throws IOException {
-        if (!path.exists()) {
-            throw new FileNotFoundException(path.getAbsolutePath());
+    public static ClassFileReader newInstance(Path path) throws IOException {
+        if (!Files.exists(path)) {
+            throw new FileNotFoundException(path.toString());
         }
 
-        if (path.isDirectory()) {
-            return new DirectoryReader(path.toPath());
-        } else if (path.getName().endsWith(".jar")) {
-            return new JarFileReader(path.toPath());
+        if (Files.isDirectory(path)) {
+            return new DirectoryReader(path);
+        } else if (path.getFileName().toString().endsWith(".jar")) {
+            return new JarFileReader(path);
         } else {
-            return new ClassFileReader(path.toPath());
+            return new ClassFileReader(path);
         }
     }
 
@@ -163,16 +163,16 @@
                 int i = name.lastIndexOf('.');
                 String pathname = name.replace('.', File.separatorChar) + ".class";
                 Path p = path.resolve(pathname);
-                if (!p.toFile().exists()) {
+                if (!Files.exists(p)) {
                     p = path.resolve(pathname.substring(0, i) + "$" +
                                      pathname.substring(i+1, pathname.length()));
                 }
-                if (p.toFile().exists()) {
+                if (Files.exists(p)) {
                     return readClassFile(p);
                 }
             } else {
                 Path p = path.resolve(name + ".class");
-                if (p.toFile().exists()) {
+                if (Files.exists(p)) {
                     return readClassFile(p);
                 }
             }
@@ -193,7 +193,7 @@
             Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
                         throws IOException {
-                    if (file.toFile().getName().endsWith(".class")) {
+                    if (file.getFileName().toString().endsWith(".class")) {
                         files.add(file);
                     }
                     return FileVisitResult.CONTINUE;
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java b/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java
index c606d96..66cd5a4 100644
--- a/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java
@@ -24,12 +24,18 @@
  */
 package com.sun.tools.jdeps;
 
+import com.sun.tools.classfile.AccessFlags;
 import com.sun.tools.classfile.ClassFile;
 import com.sun.tools.classfile.ConstantPoolException;
 import com.sun.tools.classfile.Dependencies;
 import com.sun.tools.classfile.Dependencies.ClassFileError;
 import com.sun.tools.classfile.Dependency;
+import com.sun.tools.jdeps.PlatformClassPath.JDKArchive;
 import java.io.*;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.text.MessageFormat;
 import java.util.*;
 import java.util.regex.Pattern;
@@ -67,11 +73,10 @@
 
         boolean matches(String opt) {
             for (String a : aliases) {
-                if (a.equals(opt)) {
+                if (a.equals(opt))
                     return true;
-                } else if (opt.startsWith("--") && hasArg && opt.startsWith(a + "=")) {
+                if (hasArg && opt.startsWith(a + "="))
                     return true;
-                }
             }
             return false;
         }
@@ -96,62 +101,96 @@
     }
 
     static Option[] recognizedOptions = {
-        new Option(false, "-h", "-?", "--help") {
+        new Option(false, "-h", "-?", "-help") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.help = true;
             }
         },
-        new Option(false, "-s", "--summary") {
+        new Option(true, "-dotoutput") {
+            void process(JdepsTask task, String opt, String arg) throws BadArgs {
+                Path p = Paths.get(arg);
+                if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) {
+                    throw new BadArgs("err.dot.output.path", arg);
+                }
+                task.options.dotOutputDir = arg;
+            }
+        },
+        new Option(false, "-s", "-summary") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.showSummary = true;
                 task.options.verbose = Analyzer.Type.SUMMARY;
             }
         },
-        new Option(false, "-v", "--verbose") {
-            void process(JdepsTask task, String opt, String arg) {
-                task.options.verbose = Analyzer.Type.VERBOSE;
-            }
-        },
-        new Option(true, "-V", "--verbose-level") {
+        new Option(false, "-v", "-verbose",
+                          "-verbose:package",
+                          "-verbose:class")
+        {
             void process(JdepsTask task, String opt, String arg) throws BadArgs {
-                if ("package".equals(arg)) {
-                    task.options.verbose = Analyzer.Type.PACKAGE;
-                } else if ("class".equals(arg)) {
-                    task.options.verbose = Analyzer.Type.CLASS;
-                } else {
-                    throw new BadArgs("err.invalid.arg.for.option", opt);
+                switch (opt) {
+                    case "-v":
+                    case "-verbose":
+                        task.options.verbose = Analyzer.Type.VERBOSE;
+                        break;
+                    case "-verbose:package":
+                            task.options.verbose = Analyzer.Type.PACKAGE;
+                            break;
+                    case "-verbose:class":
+                            task.options.verbose = Analyzer.Type.CLASS;
+                            break;
+                    default:
+                        throw new BadArgs("err.invalid.arg.for.option", opt);
                 }
             }
         },
-        new Option(true, "-c", "--classpath") {
+        new Option(true, "-cp", "-classpath") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.classpath = arg;
             }
         },
-        new Option(true, "-p", "--package") {
+        new Option(true, "-p", "-package") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.packageNames.add(arg);
             }
         },
-        new Option(true, "-e", "--regex") {
+        new Option(true, "-e", "-regex") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.regex = arg;
             }
         },
-        new Option(false, "-P", "--profile") {
+        new Option(true, "-include") {
+            void process(JdepsTask task, String opt, String arg) throws BadArgs {
+                task.options.includePattern = Pattern.compile(arg);
+            }
+        },
+        new Option(false, "-P", "-profile") {
             void process(JdepsTask task, String opt, String arg) throws BadArgs {
                 task.options.showProfile = true;
-                if (Profiles.getProfileCount() == 0) {
+                if (Profile.getProfileCount() == 0) {
                     throw new BadArgs("err.option.unsupported", opt, getMessage("err.profiles.msg"));
                 }
             }
         },
-        new Option(false, "-R", "--recursive") {
+        new Option(false, "-apionly") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.apiOnly = true;
+            }
+        },
+        new Option(false, "-R", "-recursive") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.depth = 0;
             }
         },
-        new HiddenOption(true, "-d", "--depth") {
+        new Option(false, "-version") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.version = true;
+            }
+        },
+        new HiddenOption(false, "-fullversion") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.fullVersion = true;
+            }
+        },
+        new HiddenOption(true, "-depth") {
             void process(JdepsTask task, String opt, String arg) throws BadArgs {
                 try {
                     task.options.depth = Integer.parseInt(arg);
@@ -160,16 +199,6 @@
                 }
             }
         },
-        new Option(false, "--version") {
-            void process(JdepsTask task, String opt, String arg) {
-                task.options.version = true;
-            }
-        },
-        new HiddenOption(false, "--fullversion") {
-            void process(JdepsTask task, String opt, String arg) {
-                task.options.fullVersion = true;
-            }
-        },
     };
 
     private static final String PROGNAME = "jdeps";
@@ -202,7 +231,7 @@
             if (options.version || options.fullVersion) {
                 showVersion(options.fullVersion);
             }
-            if (classes.isEmpty() && !options.wildcard) {
+            if (classes.isEmpty() && options.includePattern == null) {
                 if (options.help || options.version || options.fullVersion) {
                     return EXIT_OK;
                 } else {
@@ -233,19 +262,51 @@
         }
     }
 
-    private final List<Archive> sourceLocations = new ArrayList<Archive>();
+    private final List<Archive> sourceLocations = new ArrayList<>();
     private boolean run() throws IOException {
         findDependencies();
         Analyzer analyzer = new Analyzer(options.verbose);
         analyzer.run(sourceLocations);
-        if (options.verbose == Analyzer.Type.SUMMARY) {
-            printSummary(log, analyzer);
+        if (options.dotOutputDir != null) {
+            Path dir = Paths.get(options.dotOutputDir);
+            Files.createDirectories(dir);
+            generateDotFiles(dir, analyzer);
         } else {
-            printDependencies(log, analyzer);
+            printRawOutput(log, analyzer);
         }
         return true;
     }
 
+    private void generateDotFiles(Path dir, Analyzer analyzer) throws IOException {
+        Path summary = dir.resolve("summary.dot");
+        try (PrintWriter sw = new PrintWriter(Files.newOutputStream(summary));
+             DotFileFormatter formatter = new DotFileFormatter(sw, "summary")) {
+            for (Archive archive : sourceLocations) {
+                 analyzer.visitArchiveDependences(archive, formatter);
+            }
+        }
+        if (options.verbose != Analyzer.Type.SUMMARY) {
+            for (Archive archive : sourceLocations) {
+                if (analyzer.hasDependences(archive)) {
+                    Path dotfile = dir.resolve(archive.getFileName() + ".dot");
+                    try (PrintWriter pw = new PrintWriter(Files.newOutputStream(dotfile));
+                         DotFileFormatter formatter = new DotFileFormatter(pw, archive)) {
+                        analyzer.visitDependences(archive, formatter);
+                    }
+                }
+            }
+        }
+    }
+
+    private void printRawOutput(PrintWriter writer, Analyzer analyzer) {
+        for (Archive archive : sourceLocations) {
+            RawOutputFormatter formatter = new RawOutputFormatter(writer);
+            analyzer.visitArchiveDependences(archive, formatter);
+            if (options.verbose != Analyzer.Type.SUMMARY) {
+                analyzer.visitDependences(archive, formatter);
+            }
+        }
+    }
     private boolean isValidClassName(String name) {
         if (!Character.isJavaIdentifierStart(name.charAt(0))) {
             return false;
@@ -259,27 +320,43 @@
         return true;
     }
 
-    private void findDependencies() throws IOException {
-        Dependency.Finder finder = Dependencies.getClassDependencyFinder();
-        Dependency.Filter filter;
-        if (options.regex != null) {
-            filter = Dependencies.getRegexFilter(Pattern.compile(options.regex));
+    private Dependency.Filter getDependencyFilter() {
+         if (options.regex != null) {
+            return Dependencies.getRegexFilter(Pattern.compile(options.regex));
         } else if (options.packageNames.size() > 0) {
-            filter = Dependencies.getPackageFilter(options.packageNames, false);
+            return Dependencies.getPackageFilter(options.packageNames, false);
         } else {
-            filter = new Dependency.Filter() {
+            return new Dependency.Filter() {
+                @Override
                 public boolean accepts(Dependency dependency) {
                     return !dependency.getOrigin().equals(dependency.getTarget());
                 }
             };
         }
+    }
 
-        List<Archive> archives = new ArrayList<Archive>();
-        Deque<String> roots = new LinkedList<String>();
+    private boolean matches(String classname, AccessFlags flags) {
+        if (options.apiOnly && !flags.is(AccessFlags.ACC_PUBLIC)) {
+            return false;
+        } else if (options.includePattern != null) {
+            return options.includePattern.matcher(classname.replace('/', '.')).matches();
+        } else {
+            return true;
+        }
+    }
+
+    private void findDependencies() throws IOException {
+        Dependency.Finder finder =
+            options.apiOnly ? Dependencies.getAPIFinder(AccessFlags.ACC_PROTECTED)
+                            : Dependencies.getClassDependencyFinder();
+        Dependency.Filter filter = getDependencyFilter();
+
+        List<Archive> archives = new ArrayList<>();
+        Deque<String> roots = new LinkedList<>();
         for (String s : classes) {
-            File f = new File(s);
-            if (f.exists()) {
-                archives.add(new Archive(f, ClassFileReader.newInstance(f)));
+            Path p = Paths.get(s);
+            if (Files.exists(p)) {
+                archives.add(new Archive(p, ClassFileReader.newInstance(p)));
             } else {
                 if (isValidClassName(s)) {
                     roots.add(s);
@@ -289,9 +366,8 @@
             }
         }
 
-        List<Archive> classpaths = new ArrayList<Archive>(); // for class file lookup
-        if (options.wildcard) {
-            // include all archives from classpath to the initial list
+        List<Archive> classpaths = new ArrayList<>(); // for class file lookup
+        if (options.includePattern != null) {
             archives.addAll(getClassPathArchives(options.classpath));
         } else {
             classpaths.addAll(getClassPathArchives(options.classpath));
@@ -305,8 +381,8 @@
         // Work queue of names of classfiles to be searched.
         // Entries will be unique, and for classes that do not yet have
         // dependencies in the results map.
-        Deque<String> deque = new LinkedList<String>();
-        Set<String> doneClasses = new HashSet<String>();
+        Deque<String> deque = new LinkedList<>();
+        Set<String> doneClasses = new HashSet<>();
 
         // get the immediate dependencies of the input files
         for (Archive a : archives) {
@@ -318,16 +394,18 @@
                     throw new ClassFileError(e);
                 }
 
-                if (!doneClasses.contains(classFileName)) {
-                    doneClasses.add(classFileName);
-                }
-                for (Dependency d : finder.findDependencies(cf)) {
-                    if (filter.accepts(d)) {
-                        String cn = d.getTarget().getName();
-                        if (!doneClasses.contains(cn) && !deque.contains(cn)) {
-                            deque.add(cn);
+                if (matches(classFileName, cf.access_flags)) {
+                    if (!doneClasses.contains(classFileName)) {
+                        doneClasses.add(classFileName);
+                    }
+                    for (Dependency d : finder.findDependencies(cf)) {
+                        if (filter.accepts(d)) {
+                            String cn = d.getTarget().getName();
+                            if (!doneClasses.contains(cn) && !deque.contains(cn)) {
+                                deque.add(cn);
+                            }
+                            a.addClass(d.getOrigin(), d.getTarget());
                         }
-                        a.addClass(d.getOrigin(), d.getTarget());
                     }
                 }
             }
@@ -379,46 +457,10 @@
                 }
             }
             unresolved = deque;
-            deque = new LinkedList<String>();
+            deque = new LinkedList<>();
         } while (!unresolved.isEmpty() && depth-- > 0);
     }
 
-    private void printSummary(final PrintWriter out, final Analyzer analyzer) {
-        Analyzer.Visitor visitor = new Analyzer.Visitor() {
-            public void visit(String origin, String target, String profile) {
-                if (options.showProfile) {
-                    out.format("%-30s -> %s%n", origin, target);
-                }
-            }
-            public void visit(Archive origin, Archive target) {
-                if (!options.showProfile) {
-                    out.format("%-30s -> %s%n", origin, target);
-                }
-            }
-        };
-        analyzer.visitSummary(visitor);
-    }
-
-    private void printDependencies(final PrintWriter out, final Analyzer analyzer) {
-        Analyzer.Visitor visitor = new Analyzer.Visitor() {
-            private String pkg = "";
-            public void visit(String origin, String target, String profile) {
-                if (!origin.equals(pkg)) {
-                    pkg = origin;
-                    out.format("   %s (%s)%n", origin, analyzer.getArchive(origin).getFileName());
-                }
-                out.format("      -> %-50s %s%n", target,
-                           (options.showProfile && !profile.isEmpty())
-                               ? profile
-                               : analyzer.getArchiveName(target, profile));
-            }
-            public void visit(Archive origin, Archive target) {
-                out.format("%s -> %s%n", origin, target);
-            }
-        };
-        analyzer.visit(visitor);
-    }
-
     public void handleOptions(String[] args) throws BadArgs {
         // process options
         for (int i=0; i < args.length; i++) {
@@ -427,7 +469,7 @@
                 Option option = getOption(name);
                 String param = null;
                 if (option.hasArg) {
-                    if (name.startsWith("--") && name.indexOf('=') > 0) {
+                    if (name.startsWith("-") && name.indexOf('=') > 0) {
                         param = name.substring(name.indexOf('=') + 1, name.length());
                     } else if (i + 1 < args.length) {
                         param = args[++i];
@@ -447,11 +489,7 @@
                     if (name.charAt(0) == '-') {
                         throw new BadArgs("err.option.after.class", name).showUsage(true);
                     }
-                    if (name.equals("*") || name.equals("\"*\"")) {
-                        options.wildcard = true;
-                    } else {
-                        classes.add(name);
-                    }
+                    classes.add(name);
                 }
             }
         }
@@ -518,13 +556,15 @@
         boolean showProfile;
         boolean showSummary;
         boolean wildcard;
-        String regex;
+        boolean apiOnly;
+        String dotOutputDir;
         String classpath = "";
         int depth = 1;
         Analyzer.Type verbose = Analyzer.Type.PACKAGE;
-        Set<String> packageNames = new HashSet<String>();
+        Set<String> packageNames = new HashSet<>();
+        String regex;             // apply to the dependences
+        Pattern includePattern;   // apply to classes
     }
-
     private static class ResourceBundleHelper {
         static final ResourceBundle versionRB;
         static final ResourceBundle bundle;
@@ -547,9 +587,9 @@
     private List<Archive> getArchives(List<String> filenames) throws IOException {
         List<Archive> result = new ArrayList<Archive>();
         for (String s : filenames) {
-            File f = new File(s);
-            if (f.exists()) {
-                result.add(new Archive(f, ClassFileReader.newInstance(f)));
+            Path p = Paths.get(s);
+            if (Files.exists(p)) {
+                result.add(new Archive(p, ClassFileReader.newInstance(p)));
             } else {
                 warning("warn.file.not.exist", s);
             }
@@ -558,18 +598,131 @@
     }
 
     private List<Archive> getClassPathArchives(String paths) throws IOException {
-        List<Archive> result = new ArrayList<Archive>();
+        List<Archive> result = new ArrayList<>();
         if (paths.isEmpty()) {
             return result;
         }
         for (String p : paths.split(File.pathSeparator)) {
             if (p.length() > 0) {
-                File f = new File(p);
-                if (f.exists()) {
-                    result.add(new Archive(f, ClassFileReader.newInstance(f)));
+                List<Path> files = new ArrayList<>();
+                // wildcard to parse all JAR files e.g. -classpath dir/*
+                int i = p.lastIndexOf(".*");
+                if (i > 0) {
+                    Path dir = Paths.get(p.substring(0, i));
+                    try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "*.jar")) {
+                        for (Path entry : stream) {
+                            files.add(entry);
+                        }
+                    }
+                } else {
+                    files.add(Paths.get(p));
+                }
+                for (Path f : files) {
+                    if (Files.exists(f)) {
+                        result.add(new Archive(f, ClassFileReader.newInstance(f)));
+                    }
                 }
             }
         }
         return result;
     }
+
+
+    /**
+     * Returns the file name of the archive for non-JRE class or
+     * internal JRE classes.  It returns empty string for SE API.
+     */
+    private static String getArchiveName(Archive source, String profile) {
+        String name = source.getFileName();
+        if (source instanceof JDKArchive)
+            return profile.isEmpty() ? "JDK internal API (" + name + ")" : "";
+        return name;
+    }
+
+    class RawOutputFormatter implements Analyzer.Visitor {
+        private final PrintWriter writer;
+        RawOutputFormatter(PrintWriter writer) {
+            this.writer = writer;
+        }
+
+        private String pkg = "";
+        @Override
+        public void visitDependence(String origin, Archive source,
+                                    String target, Archive archive, String profile) {
+            if (!origin.equals(pkg)) {
+                pkg = origin;
+                writer.format("   %s (%s)%n", origin, source.getFileName());
+            }
+            String name = (options.showProfile && !profile.isEmpty())
+                                ? profile
+                                : getArchiveName(archive, profile);
+            writer.format("      -> %-50s %s%n", target, name);
+        }
+
+        @Override
+        public void visitArchiveDependence(Archive origin, Archive target, String profile) {
+            writer.format("%s -> %s", origin, target);
+            if (options.showProfile && !profile.isEmpty()) {
+                writer.format(" (%s)%n", profile);
+            } else {
+                writer.format("%n");
+            }
+        }
+    }
+
+    class DotFileFormatter implements Analyzer.Visitor, AutoCloseable {
+        private final PrintWriter writer;
+        private final String name;
+        DotFileFormatter(PrintWriter writer, String name) {
+            this.writer = writer;
+            this.name = name;
+            writer.format("digraph \"%s\" {%n", name);
+        }
+        DotFileFormatter(PrintWriter writer, Archive archive) {
+            this.writer = writer;
+            this.name = archive.getFileName();
+            writer.format("digraph \"%s\" {%n", name);
+            writer.format("    // Path: %s%n", archive.toString());
+        }
+
+        @Override
+        public void close() {
+            writer.println("}");
+        }
+
+        private final Set<String> edges = new HashSet<>();
+        private String node = "";
+        @Override
+        public void visitDependence(String origin, Archive source,
+                                    String target, Archive archive, String profile) {
+            if (!node.equals(origin)) {
+                edges.clear();
+                node = origin;
+            }
+            // if -P option is specified, package name -> profile will
+            // be shown and filter out multiple same edges.
+            if (!edges.contains(target)) {
+                StringBuilder sb = new StringBuilder();
+                String name = options.showProfile && !profile.isEmpty()
+                                  ? profile
+                                  : getArchiveName(archive, profile);
+                writer.format("   %-50s -> %s;%n",
+                                 String.format("\"%s\"", origin),
+                                 name.isEmpty() ? String.format("\"%s\"", target)
+                                                :  String.format("\"%s (%s)\"", target, name));
+                edges.add(target);
+            }
+        }
+
+        @Override
+        public void visitArchiveDependence(Archive origin, Archive target, String profile) {
+             String name = options.showProfile && !profile.isEmpty()
+                                ? profile : "";
+             writer.format("   %-30s -> \"%s\";%n",
+                           String.format("\"%s\"", origin.getFileName()),
+                           name.isEmpty()
+                               ? target.getFileName()
+                               : String.format("%s (%s)", target.getFileName(), name));
+        }
+    }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java b/langtools/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java
index 14e2583..3c1950a 100644
--- a/langtools/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java
@@ -24,11 +24,11 @@
  */
 package com.sun.tools.jdeps;
 
-import java.io.File;
 import java.io.IOException;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.*;
@@ -38,45 +38,38 @@
  */
 class PlatformClassPath {
     private final static List<Archive> javaHomeArchives = init();
+
     static List<Archive> getArchives() {
         return javaHomeArchives;
     }
 
-    static boolean contains(Archive archive) {
-        return javaHomeArchives.contains(archive);
-    }
-
     private static List<Archive> init() {
-        List<Archive> result = new ArrayList<Archive>();
-        String javaHome = System.getProperty("java.home");
-        File jre = new File(javaHome, "jre");
-        File lib = new File(javaHome, "lib");
-
+        List<Archive> result = new ArrayList<>();
+        Path home = Paths.get(System.getProperty("java.home"));
         try {
-            if (jre.exists() && jre.isDirectory()) {
-                result.addAll(addJarFiles(new File(jre, "lib")));
-                result.addAll(addJarFiles(lib));
-            } else if (lib.exists() && lib.isDirectory()) {
+            if (home.endsWith("jre")) {
+                // jar files in <javahome>/jre/lib
+                result.addAll(addJarFiles(home.resolve("lib")));
+            } else if (Files.exists(home.resolve("lib"))) {
                 // either a JRE or a jdk build image
-                File classes = new File(javaHome, "classes");
-                if (classes.exists() && classes.isDirectory()) {
+                Path classes = home.resolve("classes");
+                if (Files.isDirectory(classes)) {
                     // jdk build outputdir
-                    result.add(new Archive(classes, ClassFileReader.newInstance(classes)));
+                    result.add(new JDKArchive(classes, ClassFileReader.newInstance(classes)));
                 }
                 // add other JAR files
-                result.addAll(addJarFiles(lib));
+                result.addAll(addJarFiles(home.resolve("lib")));
             } else {
-                throw new RuntimeException("\"" + javaHome + "\" not a JDK home");
+                throw new RuntimeException("\"" + home + "\" not a JDK home");
             }
+            return result;
         } catch (IOException e) {
-            throw new RuntimeException(e);
+            throw new Error(e);
         }
-        return result;
     }
 
-    private static List<Archive> addJarFiles(File f) throws IOException {
-        final List<Archive> result = new ArrayList<Archive>();
-        final Path root = f.toPath();
+    private static List<Archive> addJarFiles(final Path root) throws IOException {
+        final List<Archive> result = new ArrayList<>();
         final Path ext = root.resolve("ext");
         Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
             @Override
@@ -91,17 +84,30 @@
                 }
             }
             @Override
-            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
+            public FileVisitResult visitFile(Path p, BasicFileAttributes attrs)
                 throws IOException
             {
-                File f = file.toFile();
-                String fn = f.getName();
-                if (fn.endsWith(".jar") && !fn.equals("alt-rt.jar")) {
-                    result.add(new Archive(f, ClassFileReader.newInstance(f)));
+                String fn = p.getFileName().toString();
+                if (fn.endsWith(".jar")) {
+                    // JDK may cobundle with JavaFX that doesn't belong to any profile
+                    // Treat jfxrt.jar as regular Archive
+                    result.add(fn.equals("jfxrt.jar")
+                        ? new Archive(p, ClassFileReader.newInstance(p))
+                        : new JDKArchive(p, ClassFileReader.newInstance(p)));
                 }
                 return FileVisitResult.CONTINUE;
             }
         });
         return result;
     }
+
+    /**
+     * A JDK archive is part of the JDK containing the Java SE API
+     * or implementation classes (i.e. JDK internal API)
+     */
+    static class JDKArchive extends Archive {
+        JDKArchive(Path p, ClassFileReader reader) {
+            super(p, reader);
+        }
+    }
 }
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/Profile.java b/langtools/src/share/classes/com/sun/tools/jdeps/Profile.java
new file mode 100644
index 0000000..47af4b2
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Profile.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.jdeps;
+
+import com.sun.tools.classfile.Annotation;
+import com.sun.tools.classfile.Annotation.*;
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPool.*;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.RuntimeAnnotations_attribute;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.jar.JarFile;
+
+/**
+ * Build the profile information from ct.sym if exists.
+ */
+enum Profile {
+
+    COMPACT1("compact1", 1),
+    COMPACT2("compact2", 2),
+    COMPACT3("compact3", 3),
+    FULL_JRE("Full JRE", 4);
+
+    final String name;
+    final int profile;
+    final Set<String> packages;
+    final Set<String> proprietaryPkgs;
+
+    Profile(String name, int profile) {
+        this.name = name;
+        this.profile = profile;
+        this.packages = new HashSet<>();
+        this.proprietaryPkgs = new HashSet<>();
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    public static int getProfileCount() {
+        return PackageToProfile.map.values().size();
+    }
+
+    /**
+     * Returns the Profile for the given package name. It returns an empty
+     * string if the given package is not in any profile.
+     */
+    public static Profile getProfile(String pn) {
+        Profile profile = PackageToProfile.map.get(pn);
+        return (profile != null && profile.packages.contains(pn))
+                ? profile : null;
+    }
+
+    static class PackageToProfile {
+        static Map<String, Profile> map = initProfiles();
+
+        private static Map<String, Profile> initProfiles() {
+            try {
+                String profilesProps = System.getProperty("jdeps.profiles");
+                if (profilesProps != null) {
+                    // for testing for JDK development build where ct.sym doesn't exist
+                    initProfilesFromProperties(profilesProps);
+                } else {
+                    Path home = Paths.get(System.getProperty("java.home"));
+                    if (home.endsWith("jre")) {
+                        home = home.getParent();
+                    }
+                    Path ctsym = home.resolve("lib").resolve("ct.sym");
+                    if (Files.exists(ctsym)) {
+                        // parse ct.sym and load information about profiles
+                        try (JarFile jf = new JarFile(ctsym.toFile())) {
+                            ClassFileReader reader = ClassFileReader.newInstance(ctsym, jf);
+                            for (ClassFile cf : reader.getClassFiles()) {
+                                findProfile(cf);
+                            }
+                        }
+                    }
+                }
+            } catch (IOException | ConstantPoolException e) {
+                throw new Error(e);
+            }
+            HashMap<String,Profile> map = new HashMap<>();
+            for (Profile profile : Profile.values()) {
+                for (String pn : profile.packages) {
+                    if (!map.containsKey(pn)) {
+                        // split packages in the JRE: use the smaller compact
+                        map.put(pn, profile);
+                    }
+                }
+                for (String pn : profile.proprietaryPkgs) {
+                    if (!map.containsKey(pn)) {
+                        map.put(pn, profile);
+                    }
+                }
+            }
+            return map;
+        }
+        private static final String PROFILE_ANNOTATION = "Ljdk/Profile+Annotation;";
+        private static final String PROPRIETARY_ANNOTATION = "Lsun/Proprietary+Annotation;";
+        private static Profile findProfile(ClassFile cf) throws ConstantPoolException {
+            RuntimeAnnotations_attribute attr = (RuntimeAnnotations_attribute)
+                cf.attributes.get(Attribute.RuntimeInvisibleAnnotations);
+            int index = 0;
+            boolean proprietary = false;
+            if (attr != null) {
+                for (int i = 0; i < attr.annotations.length; i++) {
+                    Annotation ann = attr.annotations[i];
+                    String annType = cf.constant_pool.getUTF8Value(ann.type_index);
+                    if (PROFILE_ANNOTATION.equals(annType)) {
+                        for (int j = 0; j < ann.num_element_value_pairs; j++) {
+                            Annotation.element_value_pair pair = ann.element_value_pairs[j];
+                            Primitive_element_value ev = (Primitive_element_value) pair.value;
+                            CONSTANT_Integer_info info = (CONSTANT_Integer_info)
+                                cf.constant_pool.get(ev.const_value_index);
+                            index = info.value;
+                            break;
+                        }
+                    } else if (PROPRIETARY_ANNOTATION.equals(annType)) {
+                        proprietary = true;
+                    }
+                }
+            }
+
+            Profile p = null;  // default
+            switch (index) {
+                case 1:
+                    p = Profile.COMPACT1; break;
+                case 2:
+                    p = Profile.COMPACT2; break;
+                case 3:
+                    p = Profile.COMPACT3; break;
+                case 4:
+                    p = Profile.FULL_JRE; break;
+                default:
+                    // skip classes with profile=0
+                    // Inner classes are not annotated with the profile annotation
+                    return null;
+            }
+
+            String name = cf.getName();
+            int i = name.lastIndexOf('/');
+            name = (i > 0) ? name.substring(0, i).replace('/', '.') : "";
+            if (proprietary) {
+                p.proprietaryPkgs.add(name);
+            } else {
+                p.packages.add(name);
+            }
+            return p;
+        }
+
+        private static void initProfilesFromProperties(String path) throws IOException {
+            Properties props = new Properties();
+            try (FileReader reader = new FileReader(path)) {
+                props.load(reader);
+            }
+            for (Profile prof : Profile.values()) {
+                int i = prof.profile;
+                String key = props.getProperty("profile." + i + ".name");
+                if (key == null) {
+                    throw new RuntimeException(key + " missing in " + path);
+                }
+                String n = props.getProperty("profile." + i + ".packages");
+                String[] pkgs = n.split("\\s+");
+                for (String p : pkgs) {
+                    if (p.isEmpty()) continue;
+                    prof.packages.add(p);
+                }
+            }
+        }
+    }
+
+    // for debugging
+    public static void main(String[] args) {
+        if (args.length == 0) {
+            if (Profile.getProfileCount() == 0) {
+                System.err.println("No profile is present in this JDK");
+            }
+            for (Profile p : Profile.values()) {
+                String profileName = p.name;
+                SortedSet<String> set = new TreeSet<>(p.packages);
+                for (String s : set) {
+                    // filter out the inner classes that are not annotated with
+                    // the profile annotation
+                    if (PackageToProfile.map.get(s) == p) {
+                        System.out.format("%2d: %-10s  %s%n", p.profile, profileName, s);
+                        profileName = "";
+                    } else {
+                        System.err.format("Split package: %s in %s and %s %n",
+                            s, PackageToProfile.map.get(s).name, p.name);
+                    }
+                }
+            }
+        }
+        for (String pn : args) {
+            System.out.format("%s in %s%n", pn, getProfile(pn));
+        }
+    }
+}
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/Profiles.java b/langtools/src/share/classes/com/sun/tools/jdeps/Profiles.java
deleted file mode 100644
index 0c7b4cc..0000000
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Profiles.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2013, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.jdeps;
-
-import com.sun.tools.classfile.Annotation;
-import com.sun.tools.classfile.Annotation.*;
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPool.*;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.RuntimeAnnotations_attribute;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.*;
-import java.util.jar.JarFile;
-
-/**
- * Build the profile information from ct.sym if exists.
- */
-class Profiles {
-    private static final Map<String,Profile> map = initProfiles();
-    /**
-     * Returns the name of the profile for the given package name.
-     * It returns an empty string if the given package is not in any profile.
-     */
-    public static String getProfileName(String pn) {
-        Profile profile = map.get(pn);
-        return (profile != null && profile.packages.contains(pn))
-                    ? profile.name : "";
-    }
-
-    public static int getProfileCount() {
-        return new HashSet<Profile>(map.values()).size();
-    }
-
-    private static Map<String,Profile> initProfiles() {
-        List<Profile> profiles = new ArrayList<Profile>();
-        try {
-            String profilesProps = System.getProperty("jdeps.profiles");
-            if (profilesProps != null) {
-                // for testing for JDK development build where ct.sym doesn't exist
-                initProfilesFromProperties(profiles, profilesProps);
-            } else {
-                Path home = Paths.get(System.getProperty("java.home"));
-                if (home.endsWith("jre")) {
-                    home = home.getParent();
-                }
-                Path ctsym = home.resolve("lib").resolve("ct.sym");
-                if (ctsym.toFile().exists()) {
-                    // add a default Full JRE
-                    profiles.add(0, new Profile("Full JRE", 0));
-                    // parse ct.sym and load information about profiles
-                    try (JarFile jf = new JarFile(ctsym.toFile())) {
-                        ClassFileReader reader = ClassFileReader.newInstance(ctsym, jf);
-                        for (ClassFile cf : reader.getClassFiles()) {
-                            findProfile(profiles, cf);
-                        }
-                    }
-
-                    // merge the last Profile with the "Full JRE"
-                    if (profiles.size() > 1) {
-                        Profile fullJRE = profiles.get(0);
-                        Profile p = profiles.remove(profiles.size() - 1);
-                        for (String pn : fullJRE.packages) {
-                            // The last profile contains the packages determined from ct.sym.
-                            // Move classes annotated profile==0 or no attribute that are
-                            // added in the fullJRE profile to either supported or proprietary
-                            // packages appropriately
-                            if (p.proprietaryPkgs.contains(pn)) {
-                                p.proprietaryPkgs.add(pn);
-                            } else {
-                                p.packages.add(pn);
-                            }
-                        }
-                        fullJRE.packages.clear();
-                        fullJRE.proprietaryPkgs.clear();
-                        fullJRE.packages.addAll(p.packages);
-                        fullJRE.proprietaryPkgs.addAll(p.proprietaryPkgs);
-                    }
-                }
-            }
-        } catch (IOException | ConstantPoolException e) {
-            throw new Error(e);
-        }
-        HashMap<String,Profile> map = new HashMap<String,Profile>();
-        for (Profile profile : profiles) {
-            // Inner classes are not annotated with the profile annotation
-            // packages may be in one profile but also appear in the Full JRE
-            // Full JRE is always the first element in profiles list and
-            // so the map will contain the appropriate Profile
-            for (String pn : profile.packages) {
-                map.put(pn, profile);
-            }
-            for (String pn : profile.proprietaryPkgs) {
-                map.put(pn, profile);
-            }
-        }
-        return map;
-    }
-
-    private static final String PROFILE_ANNOTATION = "Ljdk/Profile+Annotation;";
-    private static final String PROPRIETARY_ANNOTATION = "Lsun/Proprietary+Annotation;";
-    private static Profile findProfile(List<Profile> profiles, ClassFile cf)
-            throws ConstantPoolException
-    {
-        RuntimeAnnotations_attribute attr = (RuntimeAnnotations_attribute)
-            cf.attributes.get(Attribute.RuntimeInvisibleAnnotations);
-        int index = 0;
-        boolean proprietary = false;
-        if (attr != null) {
-            for (int i = 0; i < attr.annotations.length; i++) {
-                Annotation ann = attr.annotations[i];
-                String annType = cf.constant_pool.getUTF8Value(ann.type_index);
-                if (PROFILE_ANNOTATION.equals(annType)) {
-                    for (int j = 0; j < ann.num_element_value_pairs; j++) {
-                        Annotation.element_value_pair pair = ann.element_value_pairs[j];
-                        Primitive_element_value ev = (Primitive_element_value)pair.value;
-                        CONSTANT_Integer_info info = (CONSTANT_Integer_info)
-                             cf.constant_pool.get(ev.const_value_index);
-                        index = info.value;
-                        break;
-                    }
-                } else if (PROPRIETARY_ANNOTATION.equals(annType)) {
-                    proprietary = true;
-                }
-            }
-            if (index >= profiles.size()) {
-                Profile p = null;
-                for (int i = profiles.size(); i <= index; i++) {
-                    p = new Profile(i);
-                    profiles.add(p);
-                }
-            }
-        }
-
-        Profile p = profiles.get(index);
-        String name = cf.getName();
-        int i = name.lastIndexOf('/');
-        name = (i > 0) ? name.substring(0, i).replace('/','.') : "";
-        if (proprietary) {
-            p.proprietaryPkgs.add(name);
-        } else {
-            p.packages.add(name);
-        }
-        return p;
-    }
-
-    private static void initProfilesFromProperties(List<Profile> profiles, String path)
-            throws IOException
-    {
-        Properties props = new Properties();
-        try (FileReader reader = new FileReader(path)) {
-            props.load(reader);
-        }
-        int i=1;
-        String key;
-        while (props.containsKey((key = "profile." + i + ".name"))) {
-            Profile profile = new Profile(props.getProperty(key), i);
-            profiles.add(profile);
-            String n = props.getProperty("profile." + i + ".packages");
-            String[] pkgs = n.split("\\s+");
-            for (String p : pkgs) {
-                if (p.isEmpty()) continue;
-                profile.packages.add(p);
-            }
-            i++;
-        }
-    }
-
-    private static class Profile {
-        final String name;
-        final int profile;
-        final Set<String> packages;
-        final Set<String> proprietaryPkgs;
-        Profile(int profile) {
-            this("compact" + profile, profile);
-        }
-        Profile(String name, int profile) {
-            this.name = name;
-            this.profile = profile;
-            this.packages = new HashSet<String>();
-            this.proprietaryPkgs = new HashSet<String>();
-        }
-        public String toString() {
-            return name;
-        }
-    }
-
-    // for debugging
-    public static void main(String[] args) {
-        if (args.length == 0) {
-            Profile[] profiles = new Profile[getProfileCount()];
-            for (Profile p : map.values()) {
-                // move the zeroth profile to the last
-                int index = p.profile == 0 ? profiles.length-1 : p.profile-1;
-                profiles[index] = p;
-            }
-            for (Profile p : profiles) {
-                String profileName = p.name;
-                SortedSet<String> set = new TreeSet<String>(p.packages);
-                for (String s : set) {
-                    // filter out the inner classes that are not annotated with
-                    // the profile annotation
-                    if (map.get(s) == p) {
-                        System.out.format("%-10s  %s%n", profileName, s);
-                        profileName = "";
-                    }
-                }
-            }
-        }
-        for (String pn : args) {
-            System.out.format("%s in %s%n", pn, getProfileName(pn));
-        }
-    }
-}
diff --git a/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties b/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties
index 7a01d8f..4b86bd6 100644
--- a/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties
@@ -5,46 +5,63 @@
 main.usage=\
 Usage: {0} <options> <classes...>\n\
 where <classes> can be a pathname to a .class file, a directory, a JAR file,\n\
-or a fully-qualified classname or wildcard "*".  Possible options include:
+or a fully-qualified class name.  Possible options include:
 
 error.prefix=Error:
 warn.prefix=Warning:
 
 main.opt.h=\
-\  -h -?      --help                    Print this usage message
+\  -h -?        -help                 Print this usage message
 
 main.opt.version=\
-\             --version                 Version information
-
-main.opt.V=\
-\  -V <level> --verbose-level=<level>   Print package-level or class-level dependencies\n\
-\                                       Valid levels are: "package" and "class"
+\  -version                           Version information
 
 main.opt.v=\
-\  -v         --verbose                 Print additional information
+\  -v           -verbose              Print all class level dependencies\n\
+\  -verbose:package                   Print package-level dependencies excluding\n\
+\                                     dependencies within the same archive\n\
+\  -verbose:class                     Print class-level dependencies excluding\n\
+\                                     dependencies within the same archive
 
 main.opt.s=\
-\  -s         --summary                 Print dependency summary only
+\  -s           -summary              Print dependency summary only
 
 main.opt.p=\
-\  -p <pkg name> --package=<pkg name>   Restrict analysis to classes in this package\n\
-\                                       (may be given multiple times)
+\  -p <pkgname> -package <pkgname>    Finds dependences in the given package\n\
+\                                     (may be given multiple times)
 
 main.opt.e=\
-\  -e <regex> --regex=<regex>           Restrict analysis to packages matching pattern\n\
-\                                       (-p and -e are exclusive)
+\  -e <regex>   -regex <regex>        Finds dependences in packages matching pattern\n\
+\                                     (-p and -e are exclusive)
+
+main.opt.include=\
+\  -include <regex>                   Restrict analysis to classes matching pattern\n\
+\                                     This option filters the list of classes to\n\
+\                                     be analyzed.  It can be used together with\n\
+\                                     -p and -e which apply pattern to the dependences
 
 main.opt.P=\
-\  -P         --profile                 Show profile or the file containing a package
+\  -P           -profile              Show profile or the file containing a package
 
-main.opt.c=\
-\  -c <path>  --classpath=<path>        Specify where to find class files
+main.opt.cp=\
+\  -cp <path>   -classpath <path>     Specify where to find class files
 
 main.opt.R=\
-\  -R         --recursive               Recursively traverse all dependencies
+\  -R           -recursive            Recursively traverse all dependencies
 
-main.opt.d=\
-\  -d <depth> --depth=<depth>           Specify the depth of the transitive dependency analysis
+main.opt.apionly=\
+\  -apionly                           Restrict analysis to APIs i.e. dependences\n\
+\                                     from the signature of public and protected\n\
+\                                     members of public classes including field\n\
+\                                     type, method parameter types, returned type,\n\
+\                                     checked exception types etc
+
+main.opt.dotoutput=\
+\  -dotoutput <dir>                   Destination directory for DOT file output
+
+main.opt.depth=\
+\  -depth=<depth>                     Specify the depth of the transitive\n\
+\                                     dependency analysis
 
 err.unknown.option=unknown option: {0}
 err.missing.arg=no value given for {0}
@@ -53,6 +70,7 @@
 err.option.after.class=option must be specified before classes: {0}
 err.option.unsupported={0} not supported: {1}
 err.profiles.msg=No profile information
+err.dot.output.path=invalid path: {0}
 warn.invalid.arg=Invalid classname or pathname not exist: {0}
 warn.split.package=package {0} defined in {1} {2}
 
diff --git a/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java b/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java
index f02f5cd..a80a6ea 100644
--- a/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java
+++ b/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java
@@ -221,8 +221,8 @@
      *         type if present on this construct, else an empty array
      *
      * @see #getAnnotationMirrors()
-     * @see #getAnnotation(java.lang.Class)
-     * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType
+     * @see #getAnnotation(Class)
+     * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType(Class)
      * @see EnumConstantNotPresentException
      * @see AnnotationTypeMismatchException
      * @see IncompleteAnnotationException
diff --git a/langtools/src/share/classes/javax/lang/model/overview.html b/langtools/src/share/classes/javax/lang/model/overview.html
index c0e9833..9eabdcf 100644
--- a/langtools/src/share/classes/javax/lang/model/overview.html
+++ b/langtools/src/share/classes/javax/lang/model/overview.html
@@ -1,8 +1,6 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
 <!--
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2005, 2013, 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
@@ -25,7 +23,9 @@
 or visit www.oracle.com if you need additional information or have any
 questions.
 -->
-
+<html>
+<head>
+<title>javax.lang.model</title>
 </head>
 
 <body bgcolor="white">
diff --git a/langtools/src/share/classes/javax/tools/overview.html b/langtools/src/share/classes/javax/tools/overview.html
index 1c831df..883b8d4 100644
--- a/langtools/src/share/classes/javax/tools/overview.html
+++ b/langtools/src/share/classes/javax/tools/overview.html
@@ -1,3 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!--
+Copyright (c) 2005, 2013, 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.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+
+<html>
+<head>
+<title>javax.tools</title>
+</head>
 <body>
 
 <p>
@@ -21,3 +51,4 @@
 </ul>
 
 </body>
+</html>
diff --git a/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java b/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java
index 6ad89fe..0c05190 100644
--- a/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java
+++ b/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4638136 7198273
+ * @bug 4638136 7198273 8025633
  * @summary  Add ability to skip over nav bar for accessibility
  * @author dkramer
  * @run main AccessSkipNav
@@ -86,20 +86,20 @@
             // Testing only for the presence of the <a href> and <a name>
 
             // Top navbar <a href>
-            { "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a>",
+            { "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
                      TMPDEST_DIR1 + "p1" + FS + "C1.html" },
 
             // Top navbar <a name>
-            { "<a name=\"skip-navbar_top\">" + LS +
+            { "<a name=\"skip.navbar.top\">" + LS +
                       "<!--   -->" + LS + "</a>",
                      TMPDEST_DIR1 + "p1" + FS + "C1.html" },
 
             // Bottom navbar <a href>
-            { "<a href=\"#skip-navbar_bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
+            { "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
                      TMPDEST_DIR1 + "p1" + FS + "C1.html" },
 
             // Bottom navbar <a name>
-            { "<a name=\"skip-navbar_bottom\">" + LS +
+            { "<a name=\"skip.navbar.bottom\">" + LS +
                       "<!--   -->" + LS + "</a>",
                      TMPDEST_DIR1 + "p1" + FS + "C1.html" }
         };
diff --git a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
new file mode 100644
index 0000000..c5cb751
--- /dev/null
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2013, 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 8025633
+ * @summary Test for valid name attribute in HTML anchors.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestAnchorNames
+ * @run main TestAnchorNames
+ */
+
+public class TestAnchorNames extends JavadocTester {
+
+    private static final String BUG_ID = "8025633";
+
+    //Input for string search tests.
+    private static final String[][] TEST = {
+
+        //Test some section markers and links to these markers
+
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"skip.navbar.top\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"nested.class.summary\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"#nested.class.summary\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"method.summary\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"#method.summary\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"field.detail\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"#field.detail\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"constructor.detail\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"#constructor.detail\">"
+        },
+
+        //Test some members and link to these members
+
+        //The marker for this appears in the serialized-form.html which we will
+        //test below
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../serialized-form.html#pkg1.RegClass\">"
+        },
+        //Test some fields
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"Z:Z_\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#Z:Z_\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"Z:Z_:D\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"Z:Z:D_\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"Z:Z:Dfield\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"fieldInCla:D:D\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"S_:D:D:D:D:DINT\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"method:D:D\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#method:D:D\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+            "<a name=\"Z:Z_field_In_Class\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+            "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
+        },
+        //Test constructor
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"RegClass-java.lang.String-int-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">"
+        },
+        //Test some methods
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"Z:Z_methodInClass-java.lang.String-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"method--\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#method--\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"foo-java.util.Map-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"methodInCla:Ds-java.lang.String:A-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"methodD-pkg1.RegClass.:DA-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a name=\"methodD-pkg1.RegClass.D:A-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+            "<a name=\"Z:Z:Dmethod_In_Class--\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+            "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
+        },
+
+        //Test enum
+
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html",
+            "<a name=\"Z:Z:DFLD2\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html",
+            "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">"
+        },
+
+        //Test nested class
+
+        {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
+            "<a name=\"RegClass._NestedClas:D--\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
+            "<a href=\"../pkg1/RegClass._NestedClas$.html#RegClass._NestedClas:D--\">"
+        },
+
+        //Test class use page
+
+        {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "DeprMemClass.html",
+            "<a href=\"../../pkg1/RegClass.html#d____mc\">"
+        },
+
+        //Test deprecated list page
+
+        {BUG_ID + FS + "deprecated-list.html",
+            "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
+        },
+        {BUG_ID + FS + "deprecated-list.html",
+            "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
+        },
+
+        //Test constant values page
+
+        {BUG_ID + FS + "constant-values.html",
+            "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
+        },
+
+        //Test serialized form page
+
+        //This is the marker for the link that appears in the pkg1.RegClass.html page
+        {BUG_ID + FS + "serialized-form.html",
+            "<a name=\"pkg1.RegClass\">"
+        },
+
+        //Test member name index page
+
+        {BUG_ID + FS + "index-all.html",
+            "<a name=\"I:Z:Z:D\">"
+        },
+        {BUG_ID + FS + "index-all.html",
+            "<a href=\"#I:Z:Z:D\">$"
+        },
+        {BUG_ID + FS + "index-all.html",
+            "<a href=\"#I:Z:Z_\">_"
+        }
+    };
+
+    private static final String[][] NEGATED_TEST = {
+        //The marker name conversion should only affect HTML anchors. It should not
+        //affect the lables.
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            " Z:Z_"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            " Z:Z:Dfield"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            " Z:Z_field_In_Class"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+            " S_:D:D:D:D:DINT"
+        },
+    };
+
+    private static final String[] ARGS = new String[] {
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1"
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) throws Exception {
+        TestAnchorNames tester = new TestAnchorNames();
+        run(tester, ARGS, TEST, NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/DeprMemClass.java
similarity index 69%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/com/sun/javadoc/testAnchorNames/pkg1/DeprMemClass.java
index 1301f4e..7d24076 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/DeprMemClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,25 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package pkg1;
 
-@interface Anno { }
+public class DeprMemClass
+{
+    /**
+     * Field in the class.
+     * @deprecated Do not use this field.
+     */
+    public int _field_In_Class;
 
-@Anno
-@Anno
-class DuplicateAnnotation { }
+    public int _fld;
+
+    /**
+     * Method in the class.
+     * @deprecated Do not use this method.
+     */
+    public void $method_In_Class() {
+    }
+
+    public void regularMethod() {
+    }
+}
diff --git a/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java
new file mode 100644
index 0000000..60aae77
--- /dev/null
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2013, 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 pkg1;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @serial This is the serial tag's comment.
+ */
+public class RegClass implements Serializable {
+
+    /**
+     * Normal field in class.
+     */
+    public String field;
+
+    /**
+     * Normal field in class.
+     */
+    public String method$$;
+
+    /**
+     * Filed staring with $.
+     */
+    public String $field;
+
+    /**
+     * Filed staring with underscore.
+     */
+    public String _field;
+
+    /**
+     * Serial field
+     * @serial
+     */
+    public boolean t_e$t;
+
+    /**
+     * Field in class with a $ in the name.
+     */
+    public String fieldInCla$$;
+
+    /**
+     * Field name as just an underscore.
+     */
+    public int _;
+
+    /**
+     * Field name as just a $.
+     */
+    public int $;
+
+    /**
+     * Field name with underscore and $.
+     */
+    public int _$;
+
+    /**
+     * Field name with $ and underscore.
+     */
+    public int $_;
+
+    /**
+     * An array.
+     */
+    public int arr[];
+
+    /**
+     * Another array.
+     */
+    public int[] arr1;
+
+    /**
+     * A constant field.
+     */
+    public static final int S_$$$$$INT = 0;
+
+    /**
+     * Another field.
+     */
+    public DeprMemClass d____mc;
+
+    /**
+     * An enum.
+     */
+    public static enum Te$t_Enum {
+        FLD_1,
+        $FLD2
+    };
+
+    /**
+     * A constructor.
+     */
+    public RegClass(String p, int i) {
+    }
+
+    /**
+     * Method in Class.
+     * @param p a string
+     */
+    public void _methodInClass(String p) {
+    }
+
+    /**
+     * Method in Class.
+     * @param p a string
+     * @param i an int
+     */
+    public void _methodInClas$(String p, int i) {
+    }
+
+    /**
+     * Method with $ in the name.
+     * @param p a string array
+     */
+    public void methodInCla$s(String[] p) {
+    }
+
+    /**
+     * Method with D[] as a parameter.
+     * @param p an array of D
+     */
+    public void methodD(D[] p) {
+    }
+
+    /**
+     * Method with $A as a parameter.
+     * @param p an object of $A
+     */
+    public void methodD($A p) {
+    }
+
+    /**
+     * Serial test.
+     * @serialData This is a serial data comment.
+     * @return null
+     */
+    protected Object $readResolve(){return null;}
+
+    /**
+     * Simple method.
+     */
+    public void method() {}
+
+    /**
+     * Generics.
+     */
+    public static <A> void foo(Map<A, Map<A, A>> map) {}
+
+    /**
+     * A nested class.
+     */
+    public class _NestedClas$ {}
+
+    /**
+     * Nested class D.
+     */
+    class D {}
+
+    /**
+     * Nested class $A.
+     */
+    class $A {}
+}
diff --git a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java
index b85f300..b0ff91f 100644
--- a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java
+++ b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, 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
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @summary  Make sure that annotations types with optional elements has
+ * @bug 8025633
+ * @summary  Make sure that annotations types with optional elements have
  *           element headers
  * @author   Mahmood Ali
  * @library  ../lib/
@@ -45,7 +46,7 @@
     //Input for string search tests.
     private static final String[][] TEST = {
         {BUG_ID + FS + "pkg" + FS + "AnnotationOptional.html",
-            "<a name=\"annotation_type_element_detail\">"
+            "<a name=\"annotation.type.element.detail\">"
         }
     };
 
diff --git a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java b/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java
index 5ffdbab..02286c3 100644
--- a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java
+++ b/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4973609 8015249
+ * @bug      4973609 8015249 8025633
  * @summary  Make sure that annotation types with 0 members does not have
  *           extra HR tags.
  * @author   jamieh
@@ -45,11 +45,11 @@
     //Input for string search tests.
     private static final String[][] TEST = {
         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
-            "<li>Summary:&nbsp;</li>" + NL + "<li><a href=\"#annotation_type_" +
-            "field_summary\">Field</a>&nbsp;|&nbsp;</li>"},
+            "<li>Summary:&nbsp;</li>" + NL + "<li><a href=\"#annotation.type." +
+            "field.summary\">Field</a>&nbsp;|&nbsp;</li>"},
         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
-            "<li>Detail:&nbsp;</li>" + NL + "<li><a href=\"#annotation_type_" +
-            "field_detail\">Field</a>&nbsp;|&nbsp;</li>"},
+            "<li>Detail:&nbsp;</li>" + NL + "<li><a href=\"#annotation.type." +
+            "field.detail\">Field</a>&nbsp;|&nbsp;</li>"},
         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
             "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->"},
         {BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
diff --git a/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java b/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
index 048f218..8b8d3c9 100644
--- a/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
+++ b/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4652655 4857717
+ * @bug 4652655 4857717 8025633
  * @summary This test verifies that class cross references work properly.
  * @author jamieh
  * @library ../lib/
@@ -45,7 +45,7 @@
             "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " +
                 "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>"},
         {BUG_ID + FS + "C.html",
-            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " +
+            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" " +
                 "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"},
         {BUG_ID + FS + "C.html",
             "<dl>" + NL + "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
diff --git a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java b/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
index 78921d4..4798cee 100644
--- a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
+++ b/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
@@ -23,14 +23,13 @@
 
 /*
  * @test
- * @bug 4857717
+ * @bug 4857717 8025633
  * @summary Test to make sure that externally overriden and implemented methods
  * are documented properly.  The method should still include "implements" or
  * "overrides" documentation even though the method is external.
  * @author jamieh
  * @library ../lib/
- * @build JavadocTester
- * @build TestExternalOverridenMethod
+ * @build JavadocTester TestExternalOverridenMethod
  * @run main TestExternalOverridenMethod
  */
 
@@ -40,13 +39,13 @@
     private static final String[][] TEST = {
         {BUG_ID + FS + "pkg" + FS + "XReader.html",
             "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
-            "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read()\" " +
+            "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read--\" " +
             "title=\"class or interface in java.io\">read</a></code>&nbsp;in class&nbsp;<code>" +
             "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\" " +
             "title=\"class or interface in java.io\">FilterReader</a></code></dd>"},
         {BUG_ID + FS + "pkg" + FS + "XReader.html",
             "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
-            "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt()\" " +
+            "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt--\" " +
             "title=\"class or interface in java.io\">readInt</a></code>&nbsp;in interface&nbsp;<code>" +
             "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\" " +
             "title=\"class or interface in java.io\">DataInput</a></code></dd>"}};
diff --git a/langtools/test/com/sun/javadoc/testHref/TestHref.java b/langtools/test/com/sun/javadoc/testHref/TestHref.java
index b8c4a24..8bf6f6e 100644
--- a/langtools/test/com/sun/javadoc/testHref/TestHref.java
+++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4663254 8016328
+ * @bug      4663254 8016328 8025633
  * @summary  Verify that spaces do not appear in hrefs and anchors.
  * @author   jamieh
  * @library  ../lib/
@@ -46,31 +46,31 @@
     private static final String[][] TEST = {
         //External link.
         {BUG_ID + FS + "pkg" + FS + "C1.html",
-            "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)\""
+            "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\""
         },
         //Member summary table link.
         {BUG_ID + FS + "pkg" + FS + "C1.html",
-            "href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\""
+            "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\""
         },
         //Anchor test.
         {BUG_ID + FS + "pkg" + FS + "C1.html",
-            "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
+            "<a name=\"method-int-int-java.util.ArrayList-\">" + NL +
             "<!--   -->" + NL +
             "</a>"
         },
         //Backward compatibility anchor test.
         {BUG_ID + FS + "pkg" + FS + "C1.html",
-            "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
+            "<a name=\"method-int-int-java.util.ArrayList-\">" + NL +
             "<!--   -->" + NL +
             "</a>"
         },
         //{@link} test.
         {BUG_ID + FS + "pkg" + FS + "C2.html",
-            "Link: <a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">"
+            "Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
         },
         //@see test.
         {BUG_ID + FS + "pkg" + FS + "C2.html",
-            "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">"
+            "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
         },
 
         //Header does not link to the page itself.
diff --git a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
index 755e724..7d4b28d 100644
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
@@ -25,7 +25,7 @@
 
 /*
  * @test
- * @bug 6786690 6820360
+ * @bug 6786690 6820360 8025633
  * @summary This test verifies the nesting of definition list tags.
  * @author Bhavesh Patel
  * @library ../lib/
@@ -64,7 +64,7 @@
         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
                  "<dd>1.4</dd>" + NL +
                  "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" +
-                 "<a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+                 "<a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>"+ NL + "<dt><span class=\"strong\">Parameters:</span></dt>" + NL + "<dd><code>title" +
                  "</code> - the title</dd>" + NL + "<dd><code>test</code> - boolean value" +
@@ -79,11 +79,11 @@
                  "if decorations are to be enabled.</dd>" + NL + "<dt><span class=\"strong\">Since:" +
                  "</span></dt>" + NL + "<dd>1.4</dd>" + NL +
                  "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" +
-                 "<a href=\"../pkg1/C1.html#readObject()\"><code>readObject()" +
+                 "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" +
                  "</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL +
                  "<dd><code>java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:" +
-                 "</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+                 "</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl>" + NL + "<dt><span class=\"strong\">Parameters:" +
                  "</span></dt>" + NL + "<dd><code>set</code> - boolean</dd>" + NL + "<dt><span class=\"strong\">" +
@@ -91,20 +91,20 @@
         {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
                  "</dt>" + NL + "<dd><code>" +
                  "java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
-                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
                  "&nbsp;<span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
                  "<div class=\"block\">This field indicates whether the C1 is " +
                  "undecorated.</div>" + NL + "&nbsp;" + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
                  "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
-                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
                  "&nbsp;<span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
                  "<div class=\"block\">Reads the object stream.</div>" + NL +
                  "<dl>" + NL + "<dt><span class=\"strong\">Throws:" +
@@ -141,29 +141,29 @@
                  " if no decorations are" + NL + "         to be enabled;" + NL +
                  "         <code>false</code> if decorations are to be enabled." +
                  "</dd>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL +
-                 "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject()\">" +
+                 "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject--\">" +
                  "<code>readObject()</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
                  "</dt>" + NL + "<dd><code>java.io.IOException</code></dd>" + NL + "<dt>" +
-                 "<span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+                 "<span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
                  "</dt>" + NL + "<dd><code>" +
                  "java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
-                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
                  "&nbsp;<span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
                  "<div class=\"block\">This field indicates whether the C1 is " +
                  "undecorated.</div>" + NL + "&nbsp;" + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
                  "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
-                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
                  "&nbsp;<span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
                  "<div class=\"block\">Reads the object stream.</div>" + NL +
                  "<dl>" + NL + "<dt><span class=\"strong\">Throws:" +
@@ -188,12 +188,12 @@
         {BUG_ID + FS + "serialized-form.html", "<pre>boolean " +
                  "undecorated</pre>" + NL + "<div class=\"block\"><span class=\"strong\">" +
                  "Deprecated.</span>&nbsp;<span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
                  "setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"},
         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
                  "Deprecated.</span>&nbsp;<span class=\"italic\">As of JDK version" +
                  " 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}};
 
     // Test for valid HTML generation which should not comprise of empty
diff --git a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java
index cfaff52..39f8e21 100644
--- a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java
+++ b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4682448 4947464 5029946
+ * @bug      4682448 4947464 5029946 8025633
  * @summary  Verify that the public modifier does not show up in the
  *           documentation for public methods, as recommended by the JLS.
  *           If A implements I and B extends A, B should be in the list of
@@ -84,7 +84,7 @@
         //Make sure "Specified By" has substituted type parameters.
         {BUG_ID + FS + "pkg" + FS + "Child.html",
             "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
-            "<dd><code><a href=\"../pkg/Interface.html#method()\">method</a>" +
+            "<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>" +
             "</code>&nbsp;in interface&nbsp;<code>" +
             "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
             "Interface</a>&lt;<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" +
@@ -93,7 +93,7 @@
         //Make sure "Overrides" has substituted type parameters.
         {BUG_ID + FS + "pkg" + FS + "Child.html",
             "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
-            "<dd><code><a href=\"../pkg/Parent.html#method()\">method</a>" +
+            "<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>" +
             "</code>&nbsp;in class&nbsp;<code><a href=\"../pkg/Parent.html\" " +
             "title=\"class in pkg\">Parent</a>&lt;<a href=\"../pkg/Child.html\" " +
             "title=\"type parameter in Child\">T</a>&gt;</code></dd>"
diff --git a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java
index b937435..e2c4a5b 100644
--- a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java
+++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7112427 8012295
+ * @bug 7112427 8012295 8025633
  * @summary Test of the JavaFX doclet features.
  * @author jvalenta
  * @library ../lib/
@@ -38,8 +38,8 @@
     private static final String[][] TEST =
         new String[][] {
             {"./" + BUG_ID + "/C.html",
-                "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate()\"><code>getRate()</code></a>, " + NL +
-                "<a href=\"C.html#setRate(double)\"><code>setRate(double)</code></a></dd>"},
+                "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, " + NL +
+                "<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>"},
             {"./" + BUG_ID + "/C.html",
                 "<pre>public final&nbsp;void&nbsp;setRate(double&nbsp;value)</pre>" + NL +
                 "<div class=\"block\">Sets the value of the property rate.</div>" + NL +
@@ -63,7 +63,7 @@
             {"./" + BUG_ID + "/C.html",
                 "<span class=\"strong\">Property description:</span>"},
             {"./" + BUG_ID + "/C.html",
-                "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#setTestMethodProperty()\">setTestMethodProperty</a></span>()</code>&nbsp;</td>" },
+                "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code>&nbsp;</td>" },
             {"./" + BUG_ID + "/C.html",
                 "<h4>isPaused</h4>" + NL +
                 "<pre>public final&nbsp;double&nbsp;isPaused()</pre>" + NL +
diff --git a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
index ef9dd2b..49ce35d 100644
--- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
+++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4732864 6280605 7064544 8014636 8016328
+ * @bug      4732864 6280605 7064544 8014636 8016328 8025633
  * @summary  Make sure that you can link from one member to another using
  *           non-qualified name, furthermore, ensure the right one is linked.
  * @author   jamieh
@@ -49,9 +49,9 @@
             "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
             " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
             " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
-            " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL +
-            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
-            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
+            " Qualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL +
+            " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
+            " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
         },
         {BUG_ID + FS + "pkg" + FS + "C.InnerC.html",
             "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>" + NL +
diff --git a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
index 4d90d87..62b9235 100644
--- a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
+++ b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4638588 4635809 6256068 6270645
+ * @bug 4638588 4635809 6256068 6270645 8025633
  * @summary Test to make sure that members are inherited properly in the Javadoc.
  *          Verify that inheritence labels are correct.
  * @author jamieh
@@ -44,7 +44,7 @@
 
         //Public method should be inherited
         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
-         "<a href=\"../pkg/BaseClass.html#pubMethod()\">"},
+         "<a href=\"../pkg/BaseClass.html#pubMethod--\">"},
 
         //Public inner class should be inherited.
         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
@@ -56,7 +56,7 @@
 
         //Protected method should be inherited
         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
-         "<a href=\"../pkg/BaseClass.html#proMethod()\">"},
+         "<a href=\"../pkg/BaseClass.html#proMethod--\">"},
 
         //Protected inner class should be inherited.
         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
@@ -73,14 +73,14 @@
          // Test overriding/implementing methods with generic parameters.
                  {BUG_ID + FS + "pkg" + FS + "BaseClass.html",
          "<dl>" + NL + "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
-                          "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">" +
+                          "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation-java.lang.Class-\">" +
                           "getAnnotation</a></code>&nbsp;in interface&nbsp;<code>" +
                           "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
                           "BaseInterface</a></code></dd>" + NL + "</dl>"},
 
          // Test diamond inheritence member summary (6256068)
                  {BUG_ID + FS + "diamond" + FS + "Z.html",
-                 "<code><a href=\"../diamond/A.html#aMethod()\">aMethod</a></code>"},
+                 "<code><a href=\"../diamond/A.html#aMethod--\">aMethod</a></code>"},
 
          // Test that doc is inherited from closed parent (6270645)
                  {BUG_ID + FS + "inheritDist" + FS + "C.html",
@@ -90,7 +90,7 @@
 
     private static final String[][] NEGATED_TEST = {
         {BUG_ID + FS + "pkg" + FS + "SubClass.html",
-        "<a href=\"../pkg/BaseClass.html#staticMethod()\">staticMethod</a></code>"},
+        "<a href=\"../pkg/BaseClass.html#staticMethod--\">staticMethod</a></code>"},
     };
     private static final String[] ARGS =
         new String[] {
diff --git a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
index fdbb664..eff1de4 100644
--- a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
+++ b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4951228 6290760
+ * @bug      4951228 6290760 8025633
  * @summary  Test the case where the overriden method returns a different
  *           type than the method in the child class.  Make sure the
  *           documentation is inherited but the return type isn't.
@@ -49,7 +49,7 @@
         // Check return type in member summary.
         {BUG_ID + FS + "pkg" + FS + "PublicChild.html",
             "<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>" + NL +
-            "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../pkg/PublicChild.html#returnTypeTest()\">" +
+            "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">" +
             "returnTypeTest</a></span>()</code>"
         },
         // Check return type in member detail.
@@ -60,9 +60,9 @@
 
          // Legacy anchor dimensions (6290760)
         {BUG_ID + FS + "pkg2" + FS + "A.html",
-            "<a name=\"f(java.lang.Object[])\">" + NL +
+            "<a name=\"f-java.lang.Object:A-\">" + NL +
             "<!--   -->" + NL +
-            "</a><a name=\"f(T[])\">" + NL +
+            "</a><a name=\"f-T:A-\">" + NL +
             "<!--   -->" + NL +
             "</a>"
         },
diff --git a/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java b/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java
index 4466eb8..d818714 100644
--- a/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java
+++ b/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4131628 4664607 7025314 8023700 7198273
+ * @bug      4131628 4664607 7025314 8023700 7198273 8025633
  * @summary  Make sure the Next/Prev Class links iterate through all types.
  *           Make sure the navagation is 2 columns, not 3.
  * @author   jamieh
@@ -60,7 +60,7 @@
         {BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next&nbsp;Class</li>"},
         // Test for 4664607
         {BUG_ID + FS + "pkg" + FS + "I.html",
-            "<div class=\"skipNav\"><a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a></div>" + NL + "<a name=\"navbar_top_firstrow\">" + NL +
+            "<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>" + NL + "<a name=\"navbar.top.firstrow\">" + NL +
             "<!--   -->" + NL + "</a>"}
     };
     private static final String[][] NEGATED_TEST = NO_TEST;
diff --git a/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java b/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java
index 6d44bd6..37c403e 100644
--- a/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java
+++ b/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      6758050
+ * @bug      6758050 8025633
  * @summary  Test HTML output for nested generic types.
  * @author   bpatel
  * @library  ../lib/
@@ -46,7 +46,7 @@
     private static final String[][] TEST = {
         {BUG_ID + FS + "pkg" + FS + "NestedGenerics.html",
             "<div class=\"block\">Contains <a " +
-            "href=\"../pkg/NestedGenerics.html#foo(java.util.Map)\"><code>foo" +
+            "href=\"../pkg/NestedGenerics.html#foo-java.util.Map-\"><code>foo" +
             "(java.util.Map&lt;A, java.util.Map&lt;A, A&gt;&gt;)</code></a></div>"
         }
     };
diff --git a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
index ad0e024..6501312 100644
--- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
+++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344
+ * @bug      4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633
  * @summary  Run Javadoc on a set of source files that demonstrate new
  *           language features.  Check the output to ensure that the new
  *           language features are properly documented.
@@ -145,7 +145,7 @@
             //=================================
             {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int...&nbsp;i)"},
             {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[][]...&nbsp;i)"},
-            {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[]...)"},
+            {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "-int:A...-"},
             {BUG_ID + FS + "pkg" + FS + "VarArgs.html",
                 "<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
                 "TypeParameters</a>...&nbsp;t"},
@@ -156,13 +156,13 @@
             //Make sure the summary links are correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
                 "<li>Summary:&nbsp;</li>" + NL + "<li>Field&nbsp;|&nbsp;</li>" + NL +
-                "<li><a href=\"#annotation_type_required_element_summary\">" +
+                "<li><a href=\"#annotation.type.required.element.summary\">" +
                 "Required</a>&nbsp;|&nbsp;</li>" + NL + "<li>" +
-                "<a href=\"#annotation_type_optional_element_summary\">Optional</a></li>"},
+                "<a href=\"#annotation.type.optional.element.summary\">Optional</a></li>"},
             //Make sure the detail links are correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
                 "<li>Detail:&nbsp;</li>" + NL + "<li>Field&nbsp;|&nbsp;</li>" + NL +
-                "<li><a href=\"#annotation_type_element_detail\">Element</a></li>"},
+                "<li><a href=\"#annotation.type.element.detail\">Element</a></li>"},
             //Make sure the heading is correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
                 "Annotation Type AnnotationType</h2>"},
@@ -188,16 +188,16 @@
 
             //PACKAGE
             {BUG_ID + FS + "pkg" + FS + "package-summary.html",
-                "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"Package Annotation\"," + NL +
-                "                <a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)"},
+                "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"Package Annotation\"," + NL +
+                "                <a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)"},
 
             //CLASS
             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
                 "<pre><a href=\"../pkg/AnnotationType.html\" " +
                 "title=\"annotation in pkg\">@AnnotationType</a>(" +
-                "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+                "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
                 "=\"Class Annotation\"," + NL +
-                "                <a href=\"../pkg/AnnotationType.html#required()\">" +
+                "                <a href=\"../pkg/AnnotationType.html#required--\">" +
                 "required</a>=1994)" + NL + "public class <span class=\"strong\">" +
                 "AnnotationTypeUsage</span>" + NL + "extends java.lang.Object</pre>"},
 
@@ -205,36 +205,36 @@
             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
                 "<pre><a href=\"../pkg/AnnotationType.html\" " +
                 "title=\"annotation in pkg\">@AnnotationType</a>(" +
-                "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+                "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
                 "=\"Field Annotation\"," + NL +
-                "                <a href=\"../pkg/AnnotationType.html#required()\">" +
+                "                <a href=\"../pkg/AnnotationType.html#required--\">" +
                 "required</a>=1994)" + NL + "public&nbsp;int field</pre>"},
 
             //CONSTRUCTOR
             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
                 "<pre><a href=\"../pkg/AnnotationType.html\" " +
                 "title=\"annotation in pkg\">@AnnotationType</a>(" +
-                "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+                "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
                 "=\"Constructor Annotation\"," + NL +
-                "                <a href=\"../pkg/AnnotationType.html#required()\">" +
+                "                <a href=\"../pkg/AnnotationType.html#required--\">" +
                 "required</a>=1994)" + NL + "public&nbsp;AnnotationTypeUsage()</pre>"},
 
             //METHOD
             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
                 "<pre><a href=\"../pkg/AnnotationType.html\" " +
                 "title=\"annotation in pkg\">@AnnotationType</a>(" +
-                "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+                "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
                 "=\"Method Annotation\"," + NL +
-                "                <a href=\"../pkg/AnnotationType.html#required()\">" +
+                "                <a href=\"../pkg/AnnotationType.html#required--\">" +
                 "required</a>=1994)" + NL + "public&nbsp;void&nbsp;method()</pre>"},
 
             //METHOD PARAMS
             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
                 "<pre>public&nbsp;void&nbsp;methodWithParams(" +
                 "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
-                "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
+                "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" +
                 "optional</a>=\"Parameter Annotation\",<a " +
-                "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
+                "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)" + NL +
                 "                             int&nbsp;documented," + NL +
                 "                             int&nbsp;undocmented)</pre>"},
 
@@ -242,9 +242,9 @@
             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
                 "<pre>public&nbsp;AnnotationTypeUsage(<a " +
                 "href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
-                "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
+                "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" +
                 "optional</a>=\"Constructor Param Annotation\",<a " +
-                "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
+                "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)" + NL +
                 "                           int&nbsp;documented," + NL +
                 "                           int&nbsp;undocmented)</pre>"},
 
@@ -254,43 +254,43 @@
 
             //Integer
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"},
+                "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"},
 
             //Double
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"},
+                "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"},
 
             //Boolean
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#b()\">b</a>=true,"},
+                "<a href=\"../pkg1/A.html#b--\">b</a>=true,"},
 
             //String
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#s()\">s</a>=\"sigh\","},
+                "<a href=\"../pkg1/A.html#s--\">s</a>=\"sigh\","},
 
             //Class
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#c()\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"},
+                "<a href=\"../pkg1/A.html#c--\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"},
 
             //Bounded Class
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#w()\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"},
+                "<a href=\"../pkg1/A.html#w--\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"},
 
             //Enum
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#e()\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"},
+                "<a href=\"../pkg1/A.html#e--\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"},
 
             //Annotation Type
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#a()\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994),"},
+                "<a href=\"../pkg1/A.html#a--\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994),"},
 
             //String Array
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#sa()\">sa</a>={\"up\",\"down\"},"},
+                "<a href=\"../pkg1/A.html#sa--\">sa</a>={\"up\",\"down\"},"},
 
             //Primitive
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "<a href=\"../pkg1/A.html#primitiveClassTest()\">primitiveClassTest</a>=boolean.class,"},
+                "<a href=\"../pkg1/A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,"},
 
             //XXX:  Add array test case after this if fixed:
             //5020899: Incorrect internal representation of class-valued annotation elements
@@ -335,7 +335,7 @@
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
                      "<td class=\"colLast\"><span class=\"strong\">ClassUseTest1." +
                      "</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
-                     "ClassUseTest1.html#method(T)\">method</a></span>" +
+                     "ClassUseTest1.html#method-T-\">method</a></span>" +
                      "(T&nbsp;t)</code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
@@ -388,7 +388,7 @@
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
                      "<td class=\"colLast\"><span class=\"strong\">" +
                      "ClassUseTest1.</span><code><span class=\"strong\"><a href=\"../../" +
-                     "pkg2/ClassUseTest1.html#method(T)\">method</a></span>" +
+                     "pkg2/ClassUseTest1.html#method-T-\">method</a></span>" +
                      "(T&nbsp;t)</code>&nbsp;</td>"
             },
 
@@ -417,7 +417,7 @@
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
                      "<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
                      "</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
-                     "ClassUseTest2.html#method(T)\">method</a></span>" +
+                     "ClassUseTest2.html#method-T-\">method</a></span>" +
                      "(T&nbsp;t)</code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
@@ -472,7 +472,7 @@
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
                      "<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
                      "</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
-                     "ClassUseTest2.html#method(T)\">method</a></span>" +
+                     "ClassUseTest2.html#method-T-\">method</a></span>" +
                      "(T&nbsp;t)</code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
@@ -517,7 +517,7 @@
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
                      "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3" +
                      ".</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
-                     "html#method(T)\">method</a></span>(T&nbsp;t)</code>&nbsp;</td>"
+                     "html#method-T-\">method</a></span>(T&nbsp;t)</code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
                      "<td class=\"colFirst\"><code>&lt;T extends <a href=\"../" +
@@ -554,7 +554,7 @@
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
                      "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
                      "</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
-                     "html#method(T)\">method</a></span>(T&nbsp;t)</code>" +
+                     "html#method-T-\">method</a></span>(T&nbsp;t)</code>" +
                      "&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
@@ -588,7 +588,7 @@
                      "<td class=\"colFirst\"><code>void</code></td>" + NL +
                      "<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
                      "</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
-                     "html#method(java.util.Set)\">method</a></span>(java." +
+                     "html#method-java.util.Set-\">method</a></span>(java." +
                      "util.Set&lt;<a href=\"../../pkg2/Foo4.html\" title=\"" +
                      "class in pkg2\">Foo4</a>&gt;&nbsp;p)</code>&nbsp;</td>" + NL +
                      "</tr>" + NL + "</tbody>"
@@ -663,14 +663,14 @@
             // TYPE PARAMETER IN INDEX
             //=================================
             {BUG_ID + FS + "index-all.html",
-                "<span class=\"strong\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">" +
+                "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
                 "method(Vector&lt;Object&gt;)</a></span>"
             },
             //=================================
             // TYPE PARAMETER IN INDEX
             //=================================
             {BUG_ID + FS + "index-all.html",
-                "<span class=\"strong\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">" +
+                "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
                 "method(Vector&lt;Object&gt;)</a></span>"
             },
         };
diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
index 6899948..506fde1 100644
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4368820
+ * @bug      4368820 8025633
  * @summary  Inherited comment should link directly to member, not just
  *           class
  * @author   jamieh
@@ -47,7 +47,7 @@
     private static final String[][] TEST = {
         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
             "<span class=\"strong\">Description copied from class:&nbsp;<code>" +
-            "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy()\">" +
+            "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy--\">" +
             "BaseClass</a></code></span>"
         }
     };
diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
index 702c54c..018f04a 100644
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4634891
+ * @bug 4634891 8025633
  * @summary Determine if overriden methods are properly documented when
  * -protected (default) visibility flag is used.
  * @author jamieh
@@ -41,14 +41,14 @@
         //The public method should be overriden
         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
          "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
-                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" +
+                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
                  "publicMethod</a></code>&nbsp;in class&nbsp;<code>" +
                  "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
 
         //The public method in different package should be overriden
         {BUG_ID + FS + "pkg2" + FS + "SubClass.html",
          "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
-                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" +
+                 "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
                  "publicMethod</a></code>&nbsp;in class&nbsp;<code>" +
                  "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
 
@@ -56,7 +56,7 @@
         //package.
         {BUG_ID + FS + "pkg1" + FS + "SubClass.html",
          "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
-                 "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">" +
+                 "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">" +
                  "packagePrivateMethod</a></code>&nbsp;in class&nbsp;<code>" +
                  "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"}
     };
diff --git a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
index b7a9bc7..6da9e9c 100644
--- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
+++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4780441 4874845 4978816 8014017 8016328
+ * @bug      4780441 4874845 4978816 8014017 8016328 8025633
  * @summary  Make sure that when the -private flag is not used, members
  *           inherited from package private class are documented in the child.
  *
@@ -66,7 +66,7 @@
 
         // Method inheritence from non-public superclass.
         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
-            "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent(int)\">" +
+            "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent-int-\">" +
                 "methodInheritedFromParent</a>"
         },
 
@@ -78,7 +78,7 @@
 
         // Method inheritence from non-public superinterface.
         {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
-            "<a href=\"../pkg/PublicInterface.html#methodInterface(int)\">" +
+            "<a href=\"../pkg/PublicInterface.html#methodInterface-int-\">" +
                 "methodInterface</a>"
         },
 
@@ -139,7 +139,7 @@
         //Do not inherit private interface method with generic parameters.
         //This method has been implemented.
         {BUG_ID + "-1" + FS + "pkg2" + FS + "C.html",
-            "<span class=\"strong\"><a href=\"../pkg2/I.html#hello(T)\">hello</a></span>"},
+            "<span class=\"strong\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>"},
     };
 
     // Test output when -private flag is used.
@@ -171,20 +171,20 @@
             "PrivateParent</a>"
         },
         {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
-            "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent(int)\">" +
+            "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent-int-\">" +
                 "methodInheritedFromParent</a>"
         },
         // Should document that a method overrides method from private class.
        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
             "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
-            "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[],%20int,%20T,%20V,%20java.util.List)\">" +
+            "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">" +
             "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>" +
             "<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
             "PrivateParent</a></code></dd>"},
        // Should document that a method is specified by private interface.
        {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
             "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
-            "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+            "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
             "methodInterface</a></code>&nbsp;in interface&nbsp;<code>" +
             "<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
             "PrivateInterface</a></code></dd>"},
@@ -195,7 +195,7 @@
             "PrivateInterface</a>"
         },
         {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateInterface.html",
-            "<a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+            "<a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
                 "methodInterface</a>"
         },
       // Should mention that any documentation was copied.
@@ -228,11 +228,11 @@
       //with generic parameters has been implemented.
       {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
             "<span class=\"strong\">Description copied from interface:&nbsp;<code>" +
-            "<a href=\"../pkg2/I.html#hello(T)\">I</a></code></span>"},
+            "<a href=\"../pkg2/I.html#hello-T-\">I</a></code></span>"},
 
       {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
             "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
-            "<dd><code><a href=\"../pkg2/I.html#hello(T)\">hello</a></code>" +
+            "<dd><code><a href=\"../pkg2/I.html#hello-T-\">hello</a></code>" +
             "&nbsp;in interface&nbsp;<code>" +
             "<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" +
             "&lt;java.lang.String&gt;</code></dd>"},
diff --git a/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java b/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java
index 709b2ef..fd49134 100644
--- a/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java
+++ b/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -56,7 +56,7 @@
         {BUG_ID + FS + "pkg" + FS + "C.html",
             "<a href=\"../pkg/RegContainerDoc.html\" " +
             "title=\"annotation in pkg\">@RegContainerDoc</a>" +
-            "(<a href=\"../pkg/RegContainerDoc.html#value()\">value</a>={" +
+            "(<a href=\"../pkg/RegContainerDoc.html#value--\">value</a>={" +
             "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
             "title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
             "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
@@ -71,7 +71,7 @@
         {BUG_ID + FS + "pkg" + FS + "C.html",
             "<a href=\"../pkg/ContainerSynthDoc.html\" " +
             "title=\"annotation in pkg\">@ContainerSynthDoc</a>(" +
-            "<a href=\"../pkg/ContainerSynthDoc.html#value()\">value</a>=" +
+            "<a href=\"../pkg/ContainerSynthDoc.html#value--\">value</a>=" +
             "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
             "title=\"annotation in pkg\">@ContaineeSynthDoc</a>)"},
         {BUG_ID + FS + "pkg" + FS + "C.html",
@@ -82,37 +82,37 @@
 
         {BUG_ID + FS + "pkg" + FS + "D.html",
             "<a href=\"../pkg/RegDoc.html\" title=\"annotation in pkg\">@RegDoc</a>" +
-            "(<a href=\"../pkg/RegDoc.html#x()\">x</a>=1)"},
+            "(<a href=\"../pkg/RegDoc.html#x--\">x</a>=1)"},
         {BUG_ID + FS + "pkg" + FS + "D.html",
             "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" +
-            "(<a href=\"../pkg/RegArryDoc.html#y()\">y</a>=1)"},
+            "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>=1)"},
         {BUG_ID + FS + "pkg" + FS + "D.html",
             "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" +
-            "(<a href=\"../pkg/RegArryDoc.html#y()\">y</a>={1,2})"},
+            "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>={1,2})"},
         {BUG_ID + FS + "pkg" + FS + "D.html",
             "<a href=\"../pkg/NonSynthDocContainer.html\" " +
             "title=\"annotation in pkg\">@NonSynthDocContainer</a>" +
-            "(<a href=\"../pkg/NonSynthDocContainer.html#value()\">value</a>=" +
+            "(<a href=\"../pkg/NonSynthDocContainer.html#value--\">value</a>=" +
             "<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>)"},
 
         {BUG_ID + FS + "pkg1" + FS + "C.html",
             "<a href=\"../pkg1/RegContainerValDoc.html\" " +
             "title=\"annotation in pkg1\">@RegContainerValDoc</a>" +
-            "(<a href=\"../pkg1/RegContainerValDoc.html#value()\">value</a>={" +
+            "(<a href=\"../pkg1/RegContainerValDoc.html#value--\">value</a>={" +
             "<a href=\"../pkg1/RegContaineeNotDoc.html\" " +
             "title=\"annotation in pkg1\">@RegContaineeNotDoc</a>," +
             "<a href=\"../pkg1/RegContaineeNotDoc.html\" " +
             "title=\"annotation in pkg1\">@RegContaineeNotDoc</a>}," +
-            "<a href=\"../pkg1/RegContainerValDoc.html#y()\">y</a>=3)"},
+            "<a href=\"../pkg1/RegContainerValDoc.html#y--\">y</a>=3)"},
         {BUG_ID + FS + "pkg1" + FS + "C.html",
             "<a href=\"../pkg1/ContainerValDoc.html\" " +
             "title=\"annotation in pkg1\">@ContainerValDoc</a>" +
-            "(<a href=\"../pkg1/ContainerValDoc.html#value()\">value</a>={" +
+            "(<a href=\"../pkg1/ContainerValDoc.html#value--\">value</a>={" +
             "<a href=\"../pkg1/ContaineeNotDoc.html\" " +
             "title=\"annotation in pkg1\">@ContaineeNotDoc</a>," +
             "<a href=\"../pkg1/ContaineeNotDoc.html\" " +
             "title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," +
-            "<a href=\"../pkg1/ContainerValDoc.html#x()\">x</a>=1)"}
+            "<a href=\"../pkg1/ContainerValDoc.html#x--\">x</a>=1)"}
     };
 
     private static final String[][] NEGATED_TEST = {
@@ -124,7 +124,7 @@
         {BUG_ID + FS + "pkg" + FS + "C.html",
             "<a href=\"../pkg/RegContainerNotDoc.html\" " +
             "title=\"annotation in pkg\">@RegContainerNotDoc</a>" +
-            "(<a href=\"../pkg/RegContainerNotDoc.html#value()\">value</a>={" +
+            "(<a href=\"../pkg/RegContainerNotDoc.html#value--\">value</a>={" +
             "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
             "title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
             "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
@@ -138,25 +138,25 @@
         {BUG_ID + FS + "pkg1" + FS + "C.html",
             "<a href=\"../pkg1/RegContainerValNotDoc.html\" " +
             "title=\"annotation in pkg1\">@RegContainerValNotDoc</a>" +
-            "(<a href=\"../pkg1/RegContainerValNotDoc.html#value()\">value</a>={" +
+            "(<a href=\"../pkg1/RegContainerValNotDoc.html#value--\">value</a>={" +
             "<a href=\"../pkg1/RegContaineeDoc.html\" " +
             "title=\"annotation in pkg1\">@RegContaineeDoc</a>," +
             "<a href=\"../pkg1/RegContaineeDoc.html\" " +
             "title=\"annotation in pkg1\">@RegContaineeDoc</a>}," +
-            "<a href=\"../pkg1/RegContainerValNotDoc.html#y()\">y</a>=4)"},
+            "<a href=\"../pkg1/RegContainerValNotDoc.html#y--\">y</a>=4)"},
         {BUG_ID + FS + "pkg1" + FS + "C.html",
             "<a href=\"../pkg1/ContainerValNotDoc.html\" " +
             "title=\"annotation in pkg1\">@ContainerValNotDoc</a>" +
-            "(<a href=\"../pkg1/ContainerValNotDoc.html#value()\">value</a>={" +
+            "(<a href=\"../pkg1/ContainerValNotDoc.html#value--\">value</a>={" +
             "<a href=\"../pkg1/ContaineeNotDoc.html\" " +
             "title=\"annotation in pkg1\">@ContaineeNotDoc</a>," +
             "<a href=\"../pkg1/ContaineeNotDoc.html\" " +
             "title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," +
-            "<a href=\"../pkg1/ContainerValNotDoc.html#x()\">x</a>=2)"},
+            "<a href=\"../pkg1/ContainerValNotDoc.html#x--\">x</a>=2)"},
         {BUG_ID + FS + "pkg1" + FS + "C.html",
             "<a href=\"../pkg1/ContainerSynthNotDoc.html\" " +
             "title=\"annotation in pkg1\">@ContainerSynthNotDoc</a>(" +
-            "<a href=\"../pkg1/ContainerSynthNotDoc.html#value()\">value</a>=" +
+            "<a href=\"../pkg1/ContainerSynthNotDoc.html#value--\">value</a>=" +
             "<a href=\"../pkg1/ContaineeSynthDoc.html\" " +
             "title=\"annotation in pkg1\">@ContaineeSynthDoc</a>)"}
     };
diff --git a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
index 760d24a..06217b9 100644
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
+++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
@@ -25,7 +25,7 @@
 
 /*
  * @test
- * @bug 6802694
+ * @bug 6802694 8025633
  * @summary This test verifies deprecation info in serialized-form.html.
  * @author Bhavesh Patel
  * @library ../lib/
@@ -44,21 +44,21 @@
         {BUG_ID + FS + "serialized-form.html", "<dl>" + NL +
                  "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code>" +
                  "java.io.IOException</code></dd>"+ NL + "<dt><span class=\"strong\">See Also:</span>" +
-                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
                  "&nbsp;<span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
                  "<div class=\"block\">This field indicates whether the C1 " +
                  "is undecorated.</div>" + NL + "&nbsp;" + NL +
                  "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
                  "<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
-                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
                  "&nbsp;<span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
                  "<div class=\"block\">Reads the object stream.</div>" + NL +
                  "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code><code>" +
@@ -75,12 +75,12 @@
         {BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL +
                  "<div class=\"block\"><span class=\"strong\">Deprecated.</span>&nbsp;<span class=\"italic\">" +
                  "As of JDK version 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
                  "setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"},
         {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
                  "Deprecated.</span>&nbsp;<span class=\"italic\">As of JDK version" +
                  " 1.5, replaced by" + NL +
-                 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                  "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}};
 
     // Test with -nodeprecated option. The serialized-form.html should
diff --git a/langtools/test/com/sun/javadoc/testTagOutput/TestTagOutput.java b/langtools/test/com/sun/javadoc/testTagOutput/TestTagOutput.java
new file mode 100644
index 0000000..c7d5f7a
--- /dev/null
+++ b/langtools/test/com/sun/javadoc/testTagOutput/TestTagOutput.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact 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 8026370
+ * @summary This test checks the generated tag output.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestTagOutput
+ * @run main TestTagOutput
+ */
+
+public class TestTagOutput extends JavadocTester {
+
+    private static final String BUG_ID = "8026370";
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html",
+            "<div class=\"block\"><span class=\"strong\">Deprecated.</span>&nbsp;</div>"},
+        {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html",
+            "<div class=\"block\"><span class=\"strong\">Deprecated.</span>&nbsp;" +
+            "<span class=\"italic\">Do not use this.</span></div>"}};
+
+    private static final String[][] NEGATED_TEST = {
+        {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html",
+            "<div class=\"block\"><span class=\"strong\">Deprecated." +
+            "</span>&nbsp;<span class=\"italic\"></span></div>"}};
+
+    private static final String[] ARGS =
+        new String[] {
+            "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestTagOutput tester = new TestTagOutput();
+        run(tester, ARGS, TEST, NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/com/sun/javadoc/testTagOutput/pkg1/DeprecatedTag.java
similarity index 71%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/com/sun/javadoc/testTagOutput/pkg1/DeprecatedTag.java
index 1301f4e..cfb6d23 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/com/sun/javadoc/testTagOutput/pkg1/DeprecatedTag.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,24 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package pkg1;
 
-@interface Anno { }
+public class DeprecatedTag {
 
-@Anno
-@Anno
-class DuplicateAnnotation { }
+    /**
+     * This method is deprecated.
+     *
+     * @deprecated
+     */
+    public void deprecatedMethod() {
+    }
+
+    /**
+     * This method is also deprecated.
+     *
+     * @deprecated Do not use this.
+     */
+    public void deprecatedMethodWithDesc() {
+    }
+}
+
diff --git a/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java b/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java
index 5346139..e49e857 100644
--- a/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java
+++ b/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4654308 4767038
+ * @bug      4654308 4767038 8025633
  * @summary  Use a Taglet and include some inline tags such as {@link}.  The
  *           inline tags should be interpreted properly.
  *           Run Javadoc on some sample source that uses {@inheritDoc}.  Make
@@ -56,7 +56,7 @@
     //Input for string search tests.
     private static final String[][] TEST_4654308 = new String[][] {
         {"4654308" + FS + "C.html", "<span class=\"strong\">Foo:</span></dt>" +
-                 "<dd>my only method is <a href=\"C.html#method()\"><code>here" +
+                 "<dd>my only method is <a href=\"C.html#method--\"><code>here" +
                  "</code></a></dd></dl>"}
     };
     private static final String[][] NEGATED_TEST_4654308 = NO_TEST;
diff --git a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java b/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java
index 61d5758..0627c07 100644
--- a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java
+++ b/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java
@@ -23,10 +23,11 @@
 
 /*
  * @test
- * @bug      8005091 8009686
+ * @bug      8005091 8009686 8025633
  * @summary  Make sure that type annotations are displayed correctly
  * @author   Bhavesh Patel
  * @library  ../lib/
+ * @ignore
  * @build    JavadocTester TestTypeAnnotations
  * @run main TestTypeAnnotations
  */
@@ -272,13 +273,13 @@
             "<pre>void&nbsp;oneException()" + NL +
             "           throws <a href=\"../typeannos/ThrB.html\" title=\"" +
             "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
-            "ThrB.html#value()\">value</a>=\"m\") java.lang.Exception</pre>"
+            "ThrB.html#value--\">value</a>=\"m\") java.lang.Exception</pre>"
         },
         {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html",
             "<pre>void&nbsp;twoExceptions()" + NL +
             "            throws <a href=\"../typeannos/ThrB.html\" title=\"" +
             "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
-            "ThrB.html#value()\">value</a>=\"m\") java.lang.RuntimeException," + NL +
+            "ThrB.html#value--\">value</a>=\"m\") java.lang.RuntimeException," + NL +
             "                   <a href=\"../typeannos/ThrA.html\" title=\"" +
             "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
         },
@@ -307,14 +308,14 @@
             "<pre>void&nbsp;wcSuper(<a href=\"../typeannos/MyList.html\" title=\"" +
             "class in typeannos\">MyList</a>&lt;? super <a href=\"../typeannos/" +
             "WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"" +
-            "../typeannos/WldB.html#value()\">value</a>=\"m\") java.lang." +
+            "../typeannos/WldB.html#value--\">value</a>=\"m\") java.lang." +
             "String&gt;&nbsp;l)</pre>"
         },
         {BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html",
             "<pre><a href=\"../typeannos/MyList.html\" title=\"class in " +
             "typeannos\">MyList</a>&lt;? extends <a href=\"../typeannos/WldB." +
             "html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../" +
-            "typeannos/WldB.html#value()\">value</a>=\"m\") java.lang.String" +
+            "typeannos/WldB.html#value--\">value</a>=\"m\") java.lang.String" +
             "&gt;&nbsp;returnWcExtends()</pre>"
         },
 
@@ -329,7 +330,7 @@
             "<pre>java.lang.String&nbsp;nonVoid(<a href=\"../typeannos/RcvrA." +
             "html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../" +
             "typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB" +
-            "</a>(<a href=\"../typeannos/RcvrB.html#value()\">value</a>=\"m\")" +
+            "</a>(<a href=\"../typeannos/RcvrB.html#value--\">value</a>=\"m\")" +
             "&nbsp;DefaultUnmodified&nbsp;this)</pre>"
         },
         {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html",
@@ -354,7 +355,7 @@
         {BUG_ID + FS + "typeannos" + FS + "WithValue.html",
             "<pre>&lt;T extends java.lang.Runnable&gt;&nbsp;void&nbsp;accept(" +
             "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in " +
-            "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value()\">" +
+            "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value--\">" +
             "value</a>=\"m\")&nbsp;WithValue&nbsp;this," + NL +
             "                                           T&nbsp;r)" + NL +
             "                                    throws java.lang.Exception</pre>"
@@ -362,7 +363,7 @@
         {BUG_ID + FS + "typeannos" + FS + "WithFinal.html",
             "<pre>java.lang.String&nbsp;nonVoid(<a href=\"../typeannos/RcvrB." +
             "html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../" +
-            "typeannos/RcvrB.html#value()\">value</a>=\"m\")&nbsp;WithFinal" +
+            "typeannos/RcvrB.html#value--\">value</a>=\"m\")&nbsp;WithFinal" +
             "&nbsp;this)</pre>"
         },
         {BUG_ID + FS + "typeannos" + FS + "WithBody.html",
diff --git a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
index ee352a1..14e7ba4 100644
--- a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
+++ b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4927167 4974929 7010344
+ * @bug      4927167 4974929 7010344 8025633
  * @summary  When the type parameters are more than 10 characters in length,
  *           make sure there is a line break between type params and return type
  *           in member summary. Also, test for type parameter links in package-summary and
@@ -71,7 +71,7 @@
         },
         //Nested type parameters
         {BUG_ID + FS + "pkg" + FS + "C.html",
-            "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL +
+            "<a name=\"formatDetails-java.util.Collection-java.util.Collection-\">" + NL +
             "<!--   -->" + NL +
             "</a>"
         },
diff --git a/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java b/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java
index d5f697a..7152cce 100644
--- a/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java
+++ b/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4515705 4804296 4702454 4697036
+ * @bug      4515705 4804296 4702454 4697036 8025633
  * @summary  Make sure that first sentence warning only appears once.
  *           Make sure that only warnings/errors are printed when quiet is used.
  *           Make sure that links to private/unincluded methods do not cause
@@ -65,8 +65,8 @@
     };
 
     private static final String[][] TEST2 = {
-        {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m()\"><code>m()</code></a><br/>"},
-        {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X()\"><code>X()</code></a><br/>"},
+        {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>"},
+        {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>"},
         {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>"},
     };
 
diff --git a/langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java b/langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java
new file mode 100644
index 0000000..ca4c96a
--- /dev/null
+++ b/langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, 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 8016675
+ * @summary Test for window title.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestWindowTitle
+ * @run main TestWindowTitle
+ */
+
+public class TestWindowTitle extends JavadocTester {
+
+    private static final String BUG_ID = "8016675";
+    private static final String WIN_TITLE =
+            "Testing \"Window 'Title'\" with a \\ backslash and a / " +
+            "forward slash and a \u00e8 unicode char also a    tab and also a " +
+            "\t special character another \u0002 unicode)";
+    private static final String[][] TEST = {
+        {BUG_ID + FS  + "overview-summary.html",
+            "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " +
+            "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " +
+            "also a    tab and also a \\t special character another \\u0002 unicode))\";"
+        },
+    };
+    private static final String[][] NEG_TEST = {
+        {BUG_ID + FS + "overview-summary.html",
+            "parent.document.title=\"Overview (Testing \"Window \'Title\'\" " +
+            "with a \\ backslash and a / forward slash and a \u00E8 unicode char " +
+            "also a    tab and also a \t special character another \u0002 unicode))\";"
+        },
+    };
+    private static final String[] ARGS = new String[]{
+        "-d", BUG_ID, "-windowtitle", WIN_TITLE, "-sourcepath", SRC_DIR, "p1", "p2"
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestWindowTitle tester = new TestWindowTitle();
+        run(tester, ARGS, TEST, NEG_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/com/sun/javadoc/testWindowTitle/p1/C1.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/com/sun/javadoc/testWindowTitle/p1/C1.java
index 1301f4e..239d7a6 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/com/sun/javadoc/testWindowTitle/p1/C1.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,7 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package p1;
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+public class C1 {
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/com/sun/javadoc/testWindowTitle/p2/C2.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/com/sun/javadoc/testWindowTitle/p2/C2.java
index 1301f4e..7d075a6 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/com/sun/javadoc/testWindowTitle/p2/C2.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,7 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package p2;
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+public class C2 {
+}
diff --git a/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java b/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java
index f90c196..b2021bb 100644
--- a/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java
+++ b/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java
@@ -28,6 +28,7 @@
  *
  * @author   Mahmood Ali <mali>
  * @library  ../../lib/
+ * @ignore
  * @build    JavadocTester
  * @build    TestSmoke
  * @run main TestSmoke
diff --git a/langtools/test/tools/doclint/HtmlAttrsTest.java b/langtools/test/tools/doclint/HtmlAttrsTest.java
index 66d644541..fc6e390 100644
--- a/langtools/test/tools/doclint/HtmlAttrsTest.java
+++ b/langtools/test/tools/doclint/HtmlAttrsTest.java
@@ -10,7 +10,7 @@
 /** */
 public class HtmlAttrsTest {
     /**
-     * <p xyz>
+     * <p xyz> text </p>
      */
     public void unknown() { }
 
diff --git a/langtools/test/tools/doclint/HtmlAttrsTest.out b/langtools/test/tools/doclint/HtmlAttrsTest.out
index ec735e2..9cc90ce 100644
--- a/langtools/test/tools/doclint/HtmlAttrsTest.out
+++ b/langtools/test/tools/doclint/HtmlAttrsTest.out
@@ -1,5 +1,5 @@
 HtmlAttrsTest.java:13: error: unknown attribute: xyz
-     * <p xyz>
+     * <p xyz> text </p>
           ^
 HtmlAttrsTest.java:18: warning: attribute obsolete: name
      * <img name="x" alt="alt">
diff --git a/langtools/test/tools/doclint/tidy/BadEnd.out b/langtools/test/tools/doclint/tidy/BadEnd.out
index 1be1068..991479c 100644
--- a/langtools/test/tools/doclint/tidy/BadEnd.out
+++ b/langtools/test/tools/doclint/tidy/BadEnd.out
@@ -1,6 +1,9 @@
 BadEnd.java:14: warning: nested tag not allowed: <code>
  * <code> text <code>
                ^
+BadEnd.java:14: warning: empty <code> tag
+ * <code> text <code>
+               ^
 BadEnd.java:14: error: element not closed: code
  * <code> text <code>
                ^
@@ -14,4 +17,4 @@
  * <a name="here"> text <a>
    ^
 4 errors
-1 warning
+2 warnings
diff --git a/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.java b/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.java
index e795d62..29a2069 100644
--- a/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.java
+++ b/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.java
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8026368
  * @summary Add new doclint package
  * @library ..
  * @build DocLintTester
@@ -26,4 +26,9 @@
  * <ul></ul>
  * <ul><li></li></ul>
  */
-public class TrimmingEmptyTag { }
+public class TrimmingEmptyTag {
+    /** <p> */
+    public void implicitParaEnd_endOfComment() { }
+    /** <p> <ul><li>text</ul> */
+    public void implicitParaEnd_nextBlockTag() { }
+}
diff --git a/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.out b/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.out
index 68ca290..f352a25 100644
--- a/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.out
+++ b/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.out
@@ -43,4 +43,10 @@
 TrimmingEmptyTag.java:26: warning: empty <ul> tag
  * <ul></ul>
        ^
-15 warnings
+TrimmingEmptyTag.java:30: warning: empty <p> tag
+    /** <p> */
+        ^
+TrimmingEmptyTag.java:32: warning: empty <p> tag
+    /** <p> <ul><li>text</ul> */
+        ^
+17 warnings
diff --git a/langtools/test/tools/javac/MethodParameters/AnnotationTest.java b/langtools/test/tools/javac/MethodParameters/AnnotationTest.java
index ca8cd52..96eaaed 100644
--- a/langtools/test/tools/javac/MethodParameters/AnnotationTest.java
+++ b/langtools/test/tools/javac/MethodParameters/AnnotationTest.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters AnnotationTest.java
- * @run main Tester AnnotationTest
+ * @run main Tester AnnotationTest AnnotationTest.out
  */
 
 import java.lang.annotation.*;
diff --git a/langtools/test/tools/javac/MethodParameters/AnnotationTest.out b/langtools/test/tools/javac/MethodParameters/AnnotationTest.out
new file mode 100644
index 0000000..168cb16
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/AnnotationTest.out
@@ -0,0 +1,10 @@
+static interface AnnotationTest$Annos -- inner
+AnnotationTest$Annos.foo()
+AnnotationTest$Annos.value()
+class AnnotationTest -- 
+AnnotationTest.<init>(i, ji)
+AnnotationTest.foo(i, ji)
+static interface AnnotationTest$I -- inner
+AnnotationTest$I.m(i, ji)
+static interface AnnotationTest$Anno -- inner
+AnnotationTest$Anno.f()
\ No newline at end of file
diff --git a/langtools/test/tools/javac/MethodParameters/AnonymousClass.java b/langtools/test/tools/javac/MethodParameters/AnonymousClass.java
index ee87a20..7cae487 100644
--- a/langtools/test/tools/javac/MethodParameters/AnonymousClass.java
+++ b/langtools/test/tools/javac/MethodParameters/AnonymousClass.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters AnonymousClass.java
- * @run main Tester AnonymousClass
+ * @run main Tester AnonymousClass AnonymousClass.out
  */
 
 class AnonymousClass {
diff --git a/langtools/test/tools/javac/MethodParameters/AnonymousClass.out b/langtools/test/tools/javac/MethodParameters/AnonymousClass.out
new file mode 100644
index 0000000..b2f482b
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/AnonymousClass.out
@@ -0,0 +1,80 @@
+static public class AnonymousClass$Sinner -- inner
+AnonymousClass$Sinner.<init>()
+AnonymousClass$Sinner.<init>(arg, barg)
+AnonymousClass$Sinner.m(s/*synthetic*/, ts/*synthetic*/)/*synthetic*/
+AnonymousClass$Sinner.m()/*synthetic*/
+AnonymousClass$Sinner.m(s, ts)
+AnonymousClass$Sinner.m()
+class AnonymousClass$9 -- anon
+AnonymousClass$9.<init>(final this$0/*implicit*/)
+AnonymousClass$9.m()/*synthetic*/
+AnonymousClass$9.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$9.m(i, ji)
+AnonymousClass$9.m()
+class AnonymousClass$Inner -- inner
+AnonymousClass$Inner.<init>(final this$0/*synthetic*/)
+AnonymousClass$Inner.<init>(final this$0/*synthetic*/, arg, barg)
+AnonymousClass$Inner.m(s/*synthetic*/, ts/*synthetic*/)/*synthetic*/
+AnonymousClass$Inner.m()/*synthetic*/
+AnonymousClass$Inner.m(s, ts)
+AnonymousClass$Inner.m()
+class AnonymousClass$3 -- anon
+AnonymousClass$3.<init>(final this$0/*implicit*/, arg, barg)
+AnonymousClass$3.m()/*synthetic*/
+AnonymousClass$3.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$3.m(i, ji)
+AnonymousClass$3.m()
+class AnonymousClass$2 -- anon
+AnonymousClass$2.<init>(final this$0/*implicit*/)
+AnonymousClass$2.m()/*synthetic*/
+AnonymousClass$2.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$2.m(i, ji)
+AnonymousClass$2.m()
+class AnonymousClass -- 
+AnonymousClass.<init>(final a, ba)
+AnonymousClass.foo(final a, ba)
+class AnonymousClass$5 -- anon
+AnonymousClass$5.<init>(final this$0/*implicit*/, arg, barg)
+AnonymousClass$5.m()/*synthetic*/
+AnonymousClass$5.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$5.m(i, ji)
+AnonymousClass$5.m()
+static interface AnonymousClass$I -- inner
+AnonymousClass$I.m()
+AnonymousClass$I.m(x, yx)
+class AnonymousClass$10 -- anon
+AnonymousClass$10.<init>(final this$0/*implicit*/, arg, barg)
+AnonymousClass$10.m()/*synthetic*/
+AnonymousClass$10.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$10.m(i, ji)
+AnonymousClass$10.m()
+class AnonymousClass$8 -- anon
+AnonymousClass$8.<init>(final this$0/*implicit*/, arg, barg)
+AnonymousClass$8.m()/*synthetic*/
+AnonymousClass$8.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$8.m(i, ji)
+AnonymousClass$8.m()
+class AnonymousClass$6 -- anon
+AnonymousClass$6.<init>(final this$0/*implicit*/)
+AnonymousClass$6.m()/*synthetic*/
+AnonymousClass$6.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$6.m(i, ji)
+AnonymousClass$6.m()
+class AnonymousClass$7 -- anon
+AnonymousClass$7.<init>(final this$0/*implicit*/)
+AnonymousClass$7.m()/*synthetic*/
+AnonymousClass$7.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$7.m(i, ji)
+AnonymousClass$7.m()
+class AnonymousClass$4 -- anon
+AnonymousClass$4.<init>(final this$0/*implicit*/)
+AnonymousClass$4.m()/*synthetic*/
+AnonymousClass$4.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$4.m(i, ji)
+AnonymousClass$4.m()
+class AnonymousClass$1 -- anon
+AnonymousClass$1.<init>(final this$0/*implicit*/)
+AnonymousClass$1.m()/*synthetic*/
+AnonymousClass$1.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$1.m(i, ji)
+AnonymousClass$1.m()
\ No newline at end of file
diff --git a/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java b/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java
index 777a552..616d7f4 100644
--- a/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java
+++ b/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java
@@ -82,15 +82,14 @@
      * Read the class and determine some key characteristics, like if it's
      * an enum, or inner class, etc.
      */
-    void visitClass(final String cname, final File cfile, final StringBuilder sb)
-        throws Exception {
+    void visitClass(final String cname, final File cfile, final StringBuilder sb) throws Exception {
         this.cname = cname;
         classFile = ClassFile.read(cfile);
         isEnum = classFile.access_flags.is(AccessFlags.ACC_ENUM);
         isInterface = classFile.access_flags.is(AccessFlags.ACC_INTERFACE);
         isPublic = classFile.access_flags.is(AccessFlags.ACC_PUBLIC);
         isInner = false;
-        isStatic = true;
+        isStatic = false;
         isAnon = false;
 
         Attribute attr = classFile.getAttribute("InnerClasses");
@@ -100,10 +99,11 @@
         sb.append(isStatic ? "static " : "")
             .append(isPublic ? "public " : "")
             .append(isEnum ? "enum " : isInterface ? "interface " : "class ")
-            .append(cname).append(" -- ")
-            .append(isInner? "inner " : "" )
-            .append(isAnon ?  "anon" : "")
-            .append("\n");;
+            .append(cname).append(" -- ");
+        if (isInner) {
+            sb.append(isAnon ? "anon" : "inner");
+        }
+        sb.append("\n");
 
         for (Method method : classFile.methods) {
             new MethodVisitor().visitMethod(method, sb);
@@ -148,7 +148,9 @@
         public int mNumParams;
         public boolean mSynthetic;
         public boolean mIsConstructor;
+        public boolean mIsClinit;
         public boolean mIsBridge;
+        public boolean isFinal;
         public String prefix;
 
         void visitMethod(Method method, StringBuilder sb) throws Exception {
@@ -160,9 +162,13 @@
             mNumParams = -1; // no MethodParameters attribute found
             mSynthetic = method.access_flags.is(AccessFlags.ACC_SYNTHETIC);
             mIsConstructor = mName.equals("<init>");
+            mIsClinit = mName.equals("<clinit>");
             prefix = cname + "." + mName + "() - ";
             mIsBridge = method.access_flags.is(AccessFlags.ACC_BRIDGE);
 
+            if (mIsClinit) {
+                sb = new StringBuilder(); // Discard output
+            }
             sb.append(cname).append(".").append(mName).append("(");
 
             for (Attribute a : method.attributes) {
@@ -170,9 +176,18 @@
             }
             if (mNumParams == -1) {
                 if (mSynthetic) {
-                    sb.append("<none>)!!");
+                    // We don't generate MethodParameters attribute for synthetic
+                    // methods, so we are creating a parameter pattern to match
+                    // ReflectionVisitor API output.
+                    for (int i = 0; i < mParams; i++) {
+                        if (i == 0)
+                            sb.append("arg").append(i);
+                        else
+                            sb.append(", arg").append(i);
+                    }
+                    sb.append(")/*synthetic*/");
                 } else {
-                    sb.append("<none>)");
+                    sb.append(")");
                 }
             }
             sb.append("\n");
@@ -217,7 +232,7 @@
             String sep = "";
             String userParam = null;
             for (int x = 0; x <  mNumParams; x++) {
-
+                isFinal = (mp.method_parameter_table[x].flags & AccessFlags.ACC_FINAL) != 0;
                 // IMPL: Assume all parameters are named, something.
                 int cpi = mp.method_parameter_table[x].name_index;
                 if (cpi == 0) {
@@ -229,6 +244,8 @@
                 String param = null;
                 try {
                     param = classFile.constant_pool.getUTF8Value(cpi);
+                    if (isFinal)
+                        param = "final " + param;
                     sb.append(sep).append(param);
                     sep = ", ";
                 } catch(ConstantPoolException e) {
@@ -239,7 +256,7 @@
 
 
                 // Check availability, flags and special names
-                int check = checkParam(mp, param, x, sb);
+                int check = checkParam(mp, param, x, sb, isFinal);
                 if (check < 0) {
                     return null;
                 }
@@ -253,9 +270,15 @@
                     char c = userParam.charAt(0);
                     expect =  (++c) + userParam;
                 }
+                if(isFinal && expect != null)
+                    expect = "final " + expect;
                 if (check > 0) {
+                    if(isFinal) {
+                        userParam = param.substring(6);
+                    } else {
                     userParam = param;
                 }
+                }
                 if (expect != null && !param.equals(expect)) {
                     error(prefix + "param[" + x + "]='"
                           + param + "' expected '" + expect + "'");
@@ -263,7 +286,7 @@
                 }
             }
             if (mSynthetic) {
-                sb.append(")!!");
+                sb.append(")/*synthetic*/");
             } else {
                 sb.append(")");
             }
@@ -278,7 +301,7 @@
          * explicitly declared parameter.
          */
         int checkParam(MethodParameters_attribute mp, String param, int index,
-                       StringBuilder sb) {
+                       StringBuilder sb, boolean isFinal) {
 
             boolean synthetic = (mp.method_parameter_table[index].flags
                                  & AccessFlags.ACC_SYNTHETIC) != 0;
@@ -304,9 +327,13 @@
                     }
                 } else if (index == 0) {
                     if (isAnon) {
+                        expect = "this\\$[0-9]+";
                         allowMandated = true;
-                        expect = "this\\$[0-n]*";
+                        if (isFinal) {
+                            expect = "final this\\$[0-9]+";
+                        }
                     } else if (isInner && !isStatic) {
+                        expect = "this\\$[0-9]+";
                         allowMandated = true;
                         if (!isPublic) {
                             // some but not all non-public inner classes
@@ -314,7 +341,9 @@
                             // the test a bit of slack and allow either.
                             allowSynthetic = true;
                         }
-                        expect = "this\\$[0-n]*";
+                        if (isFinal) {
+                            expect = "final this\\$[0-9]+";
+                        }
                     }
                 }
             } else if (isEnum && mNumParams == 1 && index == 0 && mName.equals("valueOf")) {
@@ -327,8 +356,8 @@
                  */
                 expect = null;
             }
-            if (mandated) sb.append("!");
-            if (synthetic) sb.append("!!");
+            if (mandated) sb.append("/*implicit*/");
+            if (synthetic) sb.append("/*synthetic*/");
 
             // IMPL: our rules a somewhat fuzzy, sometimes allowing both mandated
             // and synthetic. However, a parameters cannot be both.
diff --git a/langtools/test/tools/javac/MethodParameters/Constructors.java b/langtools/test/tools/javac/MethodParameters/Constructors.java
index a4428d4..5fc71ee 100644
--- a/langtools/test/tools/javac/MethodParameters/Constructors.java
+++ b/langtools/test/tools/javac/MethodParameters/Constructors.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters Constructors.java
- * @run main Tester Constructors
+ * @run main Tester Constructors Constructors.out
  */
 
 public class Constructors {
diff --git a/langtools/test/tools/javac/MethodParameters/Constructors.out b/langtools/test/tools/javac/MethodParameters/Constructors.out
new file mode 100644
index 0000000..7f781c3
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/Constructors.out
@@ -0,0 +1,5 @@
+public class Constructors -- 
+Constructors.<init>()
+Constructors.<init>(final a, final ba)
+Constructors.<init>(a, final ba, final cba)
+Constructors.<init>(a, ba, final cba, final dcba)
\ No newline at end of file
diff --git a/langtools/test/tools/javac/MethodParameters/EnumTest.java b/langtools/test/tools/javac/MethodParameters/EnumTest.java
index 2f6cde3..f4aa5f4 100644
--- a/langtools/test/tools/javac/MethodParameters/EnumTest.java
+++ b/langtools/test/tools/javac/MethodParameters/EnumTest.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters EnumTest.java
- * @run main Tester EnumTest
+ * @run main Tester EnumTest EnumTest.out
  */
 
 /** Test that parameter names are recorded for enum methods */
diff --git a/langtools/test/tools/javac/MethodParameters/EnumTest.out b/langtools/test/tools/javac/MethodParameters/EnumTest.out
new file mode 100644
index 0000000..f3e4d04
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/EnumTest.out
@@ -0,0 +1,7 @@
+enum EnumTest -- 
+EnumTest.<init>($enum$name/*synthetic*/, $enum$ordinal/*synthetic*/)
+EnumTest.<init>($enum$name/*synthetic*/, $enum$ordinal/*synthetic*/, a, ba)
+EnumTest.ok(c, dc)
+EnumTest.values()
+EnumTest.valueOf(A, BA)
+EnumTest.valueOf(name/*implicit*/)
\ No newline at end of file
diff --git a/langtools/test/tools/javac/MethodParameters/InstanceMethods.java b/langtools/test/tools/javac/MethodParameters/InstanceMethods.java
index d3c87b55..373b59e 100644
--- a/langtools/test/tools/javac/MethodParameters/InstanceMethods.java
+++ b/langtools/test/tools/javac/MethodParameters/InstanceMethods.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters InstanceMethods.java
- * @run main Tester InstanceMethods
+ * @run main Tester InstanceMethods InstanceMethods.out
  */
 
 public class InstanceMethods {
diff --git a/langtools/test/tools/javac/MethodParameters/InstanceMethods.out b/langtools/test/tools/javac/MethodParameters/InstanceMethods.out
new file mode 100644
index 0000000..3a7c3ee
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/InstanceMethods.out
@@ -0,0 +1,11 @@
+public class InstanceMethods -- 
+InstanceMethods.<init>()
+InstanceMethods.empty()
+InstanceMethods.def(a, final ba, final cba)
+InstanceMethods.pub(d, final ed, final fed)
+InstanceMethods.prot(g, final hg, final ihg)
+InstanceMethods.priv(j, final kj, final lkj)
+InstanceMethods.def(A, BA, final CBA, final DCBA)
+InstanceMethods.pub(B, CB, final DCB, final EDCB)
+InstanceMethods.prot(C, DC, final EDC, final FEDC)
+InstanceMethods.priv(D, ED, final FED, final GFED)
\ No newline at end of file
diff --git a/langtools/test/tools/javac/MethodParameters/LambdaTest.java b/langtools/test/tools/javac/MethodParameters/LambdaTest.java
index 931b151..d715682 100644
--- a/langtools/test/tools/javac/MethodParameters/LambdaTest.java
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters LambdaTest.java
- * @run main Tester LambdaTest
+ * @run main Tester LambdaTest LambdaTest.out
  */
 
 /**
diff --git a/langtools/test/tools/javac/MethodParameters/LambdaTest.out b/langtools/test/tools/javac/MethodParameters/LambdaTest.out
new file mode 100644
index 0000000..7cfdfe9
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.out
@@ -0,0 +1,7 @@
+class LambdaTest -- 
+LambdaTest.<init>()
+LambdaTest.foo(i)
+LambdaTest.lambda$1(arg0, arg1)/*synthetic*/
+LambdaTest.lambda$0(arg0)/*synthetic*/
+static interface LambdaTest$I -- inner
+LambdaTest$I.m(x)
\ No newline at end of file
diff --git a/langtools/test/tools/javac/MethodParameters/LocalClassTest.java b/langtools/test/tools/javac/MethodParameters/LocalClassTest.java
index 101b276..250d421 100644
--- a/langtools/test/tools/javac/MethodParameters/LocalClassTest.java
+++ b/langtools/test/tools/javac/MethodParameters/LocalClassTest.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters LocalClassTest.java
- * @run main Tester LocalClassTest
+ * @run main Tester LocalClassTest LocalClassTest.out
  */
 
 class LocalClassTest {
diff --git a/langtools/test/tools/javac/MethodParameters/LocalClassTest.out b/langtools/test/tools/javac/MethodParameters/LocalClassTest.out
new file mode 100644
index 0000000..24eda91
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/LocalClassTest.out
@@ -0,0 +1,12 @@
+class LocalClassTest$1Local_has_constructor -- inner
+LocalClassTest$1Local_has_constructor.<init>(final this$0/*implicit*/, a, ba)
+LocalClassTest$1Local_has_constructor.<init>(final this$0/*implicit*/)
+LocalClassTest$1Local_has_constructor.foo(m, nm)
+LocalClassTest$1Local_has_constructor.foo()
+class LocalClassTest$1Local_default_constructor -- inner
+LocalClassTest$1Local_default_constructor.<init>(final this$0/*implicit*/)
+LocalClassTest$1Local_default_constructor.foo()
+LocalClassTest$1Local_default_constructor.foo(m, nm)
+class LocalClassTest -- 
+LocalClassTest.<init>()
+LocalClassTest.foo()
\ No newline at end of file
diff --git a/langtools/test/tools/javac/MethodParameters/MemberClassTest.java b/langtools/test/tools/javac/MethodParameters/MemberClassTest.java
index 69482d7..83cd883 100644
--- a/langtools/test/tools/javac/MethodParameters/MemberClassTest.java
+++ b/langtools/test/tools/javac/MethodParameters/MemberClassTest.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters MemberClassTest.java
- * @run main Tester MemberClassTest
+ * @run main Tester MemberClassTest MemberClassTest.out
  */
 
 class MemberClassTest {
diff --git a/langtools/test/tools/javac/MethodParameters/MemberClassTest.out b/langtools/test/tools/javac/MethodParameters/MemberClassTest.out
new file mode 100644
index 0000000..a5b368f
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/MemberClassTest.out
@@ -0,0 +1,33 @@
+static class MemberClassTest$Static_Member -- inner
+MemberClassTest$Static_Member.<init>()
+MemberClassTest$Static_Member.<init>(arg, barg)
+MemberClassTest$Static_Member.m(s, ts)
+MemberClassTest$Static_Member.m()
+public class MemberClassTest$Member -- inner
+MemberClassTest$Member.<init>(final this$0/*implicit*/)
+MemberClassTest$Member.<init>(final this$0/*implicit*/, a, ba)
+MemberClassTest$Member.m(s, ts)
+MemberClassTest$Member.m()
+public class MemberClassTest$Member$Member_Member -- inner
+MemberClassTest$Member$Member_Member.<init>(final this$1/*implicit*/)
+MemberClassTest$Member$Member_Member.<init>(final this$1/*implicit*/, x, yx)
+class MemberClassTest$1 -- anon
+MemberClassTest$1.<init>(final this$0/*implicit*/)
+MemberClassTest$1.m()
+MemberClassTest$1.m(s, ts)
+static public class MemberClassTest$Static_Member$Static_Member_Static_Member -- inner
+MemberClassTest$Static_Member$Static_Member_Static_Member.<init>()
+MemberClassTest$Static_Member$Static_Member_Static_Member.<init>(x, yx)
+public class MemberClassTest$Static_Member$Static_Member_Member -- inner
+MemberClassTest$Static_Member$Static_Member_Member.<init>(final this$0/*implicit*/)
+MemberClassTest$Static_Member$Static_Member_Member.<init>(final this$0/*implicit*/, x, yx)
+class MemberClassTest -- 
+MemberClassTest.<init>(final a, ba)
+MemberClassTest.<init>()
+MemberClassTest.foo()
+static interface MemberClassTest$I -- inner
+MemberClassTest$I.m()
+MemberClassTest$I.m(x, yx)
+class MemberClassTest$1$Anonymous_Member -- inner
+MemberClassTest$1$Anonymous_Member.<init>(final this$1/*implicit*/)
+MemberClassTest$1$Anonymous_Member.<init>(final this$1/*implicit*/, x, yx)
\ No newline at end of file
diff --git a/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java b/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java
index 841e70c..8102854 100644
--- a/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java
+++ b/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java
@@ -48,6 +48,7 @@
     boolean isMember;
     boolean isStatic;
     boolean isPublic;
+    boolean isFinal;
     Class clazz;
     StringBuilder sb;
 
@@ -72,8 +73,8 @@
             .append(isPublic ? "public " : "")
             .append(isEnum ? "enum " : isInterface ? "interface " : "class ")
             .append(cl).append(" -- ")
-            .append(isMember? "member " : "" )
-            .append(isLocal? "local " : "" )
+            .append(isMember? "inner" : "" )
+            .append(isLocal? "inner" : "" )
             .append(isAnon ?  "anon" : "")
             .append("\n");
 
@@ -82,7 +83,6 @@
         }
 
         for (Method m :clazz.getDeclaredMethods()) {
-
             testMethod(m);
         }
     }
@@ -116,9 +116,15 @@
         for (Parameter p : c.getParameters()) {
             i++;
             String pname = p.getName();
+            int pmodifier = p.getModifiers();
+            isFinal = false;
+            if (Modifier.isFinal(pmodifier)) {
+                isFinal = true;
+                pname = "final " + pname;
+            }
             sb.append(sep).append(pname);
-            if (p.isImplicit()) sb.append("!");
-            if (p.isSynthetic()) sb.append("!!");
+            if (p.isImplicit()) sb.append("/*implicit*/");
+            if (p.isSynthetic()) sb.append("/*synthetic*/");
             sep = ", ";
 
             // Set expectations
@@ -135,11 +141,17 @@
                 }
             } else if (i == 0) {
                 if (isAnon) {
+                    expect = "this\\$[0-9]+";
                     allowImplicit = true;
+                    if (isFinal)
+                        expect = "final this\\$[0-9]+";
                 } else if (isLocal) {
+                    expect = "this\\$[0-9]+";
                     allowImplicit = true;
-                    expect = "this\\$[0-n]*";
+                    if (isFinal)
+                        expect = "final this\\$[0-9]+";
                 } else if ((isMember && !isStatic)) {
+                    expect = "this\\$[0-9]+";
                     allowImplicit = true;
                     if (!isPublic) {
                         // some but not all non-public inner classes
@@ -147,7 +159,8 @@
                         // the test a bit of slack and allow either.
                         allowSynthetic = true;
                     }
-                    expect = "this\\$[0-n]*";
+                    if (isFinal)
+                        expect = "final this\\$[0-9]+";
                 }
             }
 
@@ -201,11 +214,16 @@
                 char ch = param.charAt(0);
                 expect =  (++ch) + param;
             }
-
+            if (isFinal && expect != null) {
+                expect = "final " + expect;
+            }
             if (pname != null && fidelity) {
+                if (isFinal) {
+                    param = pname.substring(6);
+                } else {
                 param = pname;
             }
-
+            }
             if (expect != null && !expect.equals(pname)) {
                 error(prefix + "param[" + i + "]='" + pname +
                       "' expected '" + expect + "'");
@@ -213,7 +231,7 @@
             }
         }
         if  (c.isSynthetic()) {
-            sb.append(")!!\n");
+            sb.append(")/*synthetic*/\n");
         } else {
             sb.append(")\n");
         }
@@ -240,13 +258,24 @@
         // the test-case design pattern, except synthetic methods.
         for (Parameter p : m.getParameters()) {
             i++;
+            isFinal = false;
+            int pmodifier = p.getModifiers();
             if (param == null) {
                 param = p.getName();
+                if (Modifier.isFinal(pmodifier)) {
+                    isFinal = true;
+                    param = "final " + param;
+                }
                 sb.append(sep).append(param);
             } else  {
                 char c = param.charAt(0);
                 String expect =  m.isSynthetic() ? ("arg" + i) : ((++c) + param);
                 param = p.getName();
+                if (Modifier.isFinal(pmodifier)) {
+                    isFinal = true;
+                    expect = "final " + expect;
+                    param = "final " + param;
+                }
                 sb.append(sep).append(param);
                 if (!m.isBridge() && !expect.equals(param)) {
                     error(prefix + "param[" + i + "]='"
@@ -254,10 +283,18 @@
                     break;
                 }
             }
+            if(isFinal)
+                param = param.substring(6);
+            if (p.isImplicit()) {
+                sb.append("/*implicit*/");
+            }
+            if (p.isSynthetic()) {
+                sb.append("/*synthetic*/");
+            }
             sep = ", ";
         }
         if  (m.isSynthetic()) {
-            sb.append(")!!\n");
+            sb.append(")/*synthetic*/\n");
         } else {
             sb.append(")\n");
         }
diff --git a/langtools/test/tools/javac/MethodParameters/StaticMethods.java b/langtools/test/tools/javac/MethodParameters/StaticMethods.java
index 5e1ade4..12e4225 100644
--- a/langtools/test/tools/javac/MethodParameters/StaticMethods.java
+++ b/langtools/test/tools/javac/MethodParameters/StaticMethods.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters StaticMethods.java
- * @run main Tester StaticMethods
+ * @run main Tester StaticMethods StaticMethods.out
  */
 
 public class StaticMethods {
diff --git a/langtools/test/tools/javac/MethodParameters/StaticMethods.out b/langtools/test/tools/javac/MethodParameters/StaticMethods.out
new file mode 100644
index 0000000..9ff4b007
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/StaticMethods.out
@@ -0,0 +1,11 @@
+public class StaticMethods -- 
+StaticMethods.<init>()
+StaticMethods.def(a, ba, final cba, final dcba)
+StaticMethods.def(a, final ba, final cba)
+StaticMethods.pub(d, final ed, final fed)
+StaticMethods.pub(a, ba, final cba, final dcba)
+StaticMethods.prot(g, final hg, final ihg)
+StaticMethods.prot(aa, baa, final cbaa, final dcbaa)
+StaticMethods.priv(j, final kj, final lkj)
+StaticMethods.priv(abc, babc, final cbabc, final dcbabc)
+StaticMethods.empty()
\ No newline at end of file
diff --git a/langtools/test/tools/javac/MethodParameters/Tester.java b/langtools/test/tools/javac/MethodParameters/Tester.java
index 84b2ddd..4b3bb04 100644
--- a/langtools/test/tools/javac/MethodParameters/Tester.java
+++ b/langtools/test/tools/javac/MethodParameters/Tester.java
@@ -23,6 +23,12 @@
 
 import java.io.*;
 import java.lang.reflect.Constructor;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * Test driver for MethodParameters testing.
@@ -44,6 +50,13 @@
 
     final static File classesdir = new File(System.getProperty("test.classes", "."));
 
+    private String classname;
+    private File[] files;
+    private File refFile;
+    private int errors;
+    private int warnings;
+    private int diffGolden;
+
     /**
      * The visitor classes that does the actual checking are referenced
      * statically, to force compilations, without having to reference
@@ -62,32 +75,38 @@
      * Test-driver expect a single classname as argument.
      */
     public static void main(String... args) throws Exception {
-        if (args.length != 1) {
-            throw new Error("A single class name is expected as argument");
+        if (args.length != 2) {
+            throw new Error("A single class name and a golden file are expected as argument");
         }
-        final String pattern = args[0] + ".*\\.class";
-        File files[] = classesdir.listFiles(new FileFilter() {
+        String testSrc = System.getProperty("test.src");
+        String testName = args[0];
+        String testGoldenFile = args[1];
+        final String pattern = testName + ".*\\.class";
+        File refFile = new File(testSrc, testGoldenFile);
+        File[] files = classesdir.listFiles(new FileFilter() {
                 public boolean accept(File f) {
                     return f.getName().matches(pattern);
                 }
             });
         if (files.length == 0) {
-            File file = new File(classesdir, args[0] + ".class");
+            File file = new File(classesdir, testName + ".class");
             throw new Error(file.getPath() + " not found");
         }
 
-        new Tester(args[0], files).run();
+        new Tester(testName, files, refFile).run();
     }
 
-    public Tester(String name, File files[]) {
+    public Tester(String name, File[] files, File refFile) {
         this.classname = name;
         this.files = files;
+        this.refFile = refFile;
     }
 
     void run() throws Exception {
 
         // Test with each visitor
         for (Class<Visitor> vclass : visitors) {
+            boolean compResult = false;
             try {
                 String vname = vclass.getName();
                 Constructor c = vclass.getConstructor(Tester.class);
@@ -105,12 +124,21 @@
                         e.printStackTrace();
                     }
                 }
-                info(sb.toString());
+                String output = sb.toString();
+                info(output);
+                compResult = compareOutput(refFile, output);
             } catch(ReflectiveOperationException e) {
                 warn("Class " + vclass.getName() + " ignored, not a Visitor");
                 continue;
             }
+            if (!compResult) {
+                diffGolden++;
+                error("The output from " + vclass.getName() + " did not match golden file.");
         }
+        }
+
+        if (0 != diffGolden)
+            throw new Exception("Test output is not equal with golden file.");
 
         if(0 != warnings)
                 System.err.println("Test generated " + warnings + " warnings");
@@ -119,6 +147,25 @@
             throw new Exception("Tester test failed with " +
                                 errors + " errors");
     }
+    // Check if test output matches the golden file.
+    boolean compareOutput(File refFile, String sb)
+            throws FileNotFoundException, IOException {
+
+        List<String> refFileList = Files.readAllLines(refFile.toPath(), StandardCharsets.UTF_8);
+        List<String> sbList = Arrays.asList(sb.split(System.getProperty("line.separator")));
+        // Check if test output contains unexpected lines or is missing expected lines.
+        List<String> sbOnly = new ArrayList<String>(sbList);
+        sbOnly.removeAll(refFileList);
+        for (String line: sbOnly)
+            error("unexpected line found: " + line);
+
+        List<String> refOnly = new ArrayList<String>(refFileList);
+        refOnly.removeAll(sbList);
+        for (String line: refOnly)
+            error("expected line not found: " + line);
+
+        return sbOnly.isEmpty() && refOnly.isEmpty();
+    }
 
     abstract static  class Visitor {
         Tester tester;
@@ -153,9 +200,4 @@
     void info(String msg) {
         System.out.println(msg);
     }
-
-    int errors;
-    int warnings;
-    String classname;
-    File files[];
 }
diff --git a/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java
index 62534d6..5915600 100644
--- a/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java
+++ b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java
@@ -27,7 +27,7 @@
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters UncommonParamNames.java
- * @run main Tester UncommonParamNames
+ * @run main Tester UncommonParamNames UncommonParamNames.out
  */
 
 /** Test uncommon parameter names */
diff --git a/langtools/test/tools/javac/MethodParameters/UncommonParamNames.out b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.out
new file mode 100644
index 0000000..e1eff44
--- /dev/null
+++ b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.out
@@ -0,0 +1,17 @@
+class UncommonParamNames -- 
+UncommonParamNames.<init>(zerozero)
+UncommonParamNames.<init>(a)
+UncommonParamNames.<init>($1)
+UncommonParamNames.<init>(_x)
+UncommonParamNames.<init>(a, ba, cba, dcba, edcba, fedcba, gfedcba, hgfedcba, ihgfedcba, jihgfedcba, kjihgfedcba, lkjihgfedcba, mlkjihgfedcba, nmlkjihgfedcba, onmlkjihgfedcba, ponmlkjihgfedcba, qponmlkjihgfedcba, rqponmlkjihgfedcba, srqponmlkjihgfedcba, tsrqponmlkjihgfedcba, utsrqponmlkjihgfedcba, vutsrqponmlkjihgfedcba, wvutsrqponmlkjihgfedcba, xwvutsrqponmlkjihgfedcba, yxwvutsrqponmlkjihgfedcba, zyxwvutsrqponmlkjihgfedcba)
+UncommonParamNames.<init>(aLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName, baLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName, cbaLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName)
+UncommonParamNames.<init>(zerozeroeight)
+UncommonParamNames.<init>(zerozeroseven)
+UncommonParamNames.foo(zerozero)
+UncommonParamNames.foo(a)
+UncommonParamNames.foo($1)
+UncommonParamNames.foo(a, ba, cba, dcba, edcba, fedcba, gfedcba, hgfedcba, ihgfedcba, jihgfedcba, kjihgfedcba, lkjihgfedcba, mlkjihgfedcba, nmlkjihgfedcba, onmlkjihgfedcba, ponmlkjihgfedcba, qponmlkjihgfedcba, rqponmlkjihgfedcba, srqponmlkjihgfedcba, tsrqponmlkjihgfedcba, utsrqponmlkjihgfedcba, vutsrqponmlkjihgfedcba, wvutsrqponmlkjihgfedcba, xwvutsrqponmlkjihgfedcba, yxwvutsrqponmlkjihgfedcba, zyxwvutsrqponmlkjihgfedcba)
+UncommonParamNames.foo(zerozeroseven)
+UncommonParamNames.foo(zerozeroeight)
+UncommonParamNames.foo(aLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName, baLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName, cbaLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName)
+UncommonParamNames.foo(_x)
\ No newline at end of file
diff --git a/langtools/test/tools/javac/T7042623.java b/langtools/test/tools/javac/T7042623.java
index 70811d4..0c4fc5b 100644
--- a/langtools/test/tools/javac/T7042623.java
+++ b/langtools/test/tools/javac/T7042623.java
@@ -2,6 +2,7 @@
  * @test /nodynamiccopyright/
  * @bug 7042623
  * @summary Regression: javac silently crash when attributing non-existent annotation
+ * @ignore
  * @compile/fail/ref=T7042623.out -XDrawDiagnostics -XDdev T7042623.java
  */
 
diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java
index 0aee99c..97bfdb3 100644
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java
@@ -54,10 +54,10 @@
         IMPORTEXPECTED("import expectedFiles.*;\n"),
         REPEATABLE("\n@Repeatable(FooContainer.class)\n"),
         CONTAINER("@interface FooContainer {\n" + "  Foo[] value();\n}\n"),
-        BASE("@interface Foo {}\n"),
-        BASEANNO("@Foo"),
-        LEGACYCONTAINER("@FooContainer(value = {@Foo, @Foo})\n"),
-        REPEATABLEANNO("\n@Foo() @Foo()"),
+        BASE("@interface Foo {int value() default Integer.MAX_VALUE;}\n"),
+        BASEANNO("@Foo(0)"),
+        LEGACYCONTAINER("@FooContainer(value = {@Foo(1), @Foo(2)})\n"),
+        REPEATABLEANNO("\n@Foo(1) @Foo(2)"),
         DEPRECATED("\n@Deprecated"),
         DOCUMENTED("\n@Documented"),
         INHERITED("\n@Inherited"),
diff --git a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java
index 419af33..f0dbe37 100644
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java
@@ -45,6 +45,8 @@
 
 import expectedFiles.ExpectedBase;
 import expectedFiles.ExpectedContainer;
+import java.util.Iterator;
+import java.util.regex.Pattern;
 
 /*
  * Objective:
@@ -99,6 +101,7 @@
      *  Set it to true to get more debug information
      */
     static final boolean DEBUG = false;
+    static boolean CHECKORDERING;
 
     public static void main(String args[]) throws Exception {
         ReflectionTest test = new ReflectionTest();
@@ -145,6 +148,23 @@
                 if (c != null) {
                     // For the loaded class object, compare expected and actual annotation values
                     // for each of the methods under test from java.lang.reflect.AnnotatedElement
+
+
+                    // Ignoring following test cases since for now they are
+                    // failing with ordering issues.
+                    // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+                    // fail with ordering issues
+                    List<String> orderingTestFailures = Arrays.asList(
+                            "SingleOnSuperContainerOnSub_Inherited_Legacy",
+                            "SingleOnSuperContainerAndSingleOnSub_Inherited_Legacy",
+                            "ContainerAndSingleOnSuperSingleOnSub_Inherited_Legacy",
+                            "SingleAnnoWithContainer",
+                            "SingleOnSuperContainerAndSingleOnSub_Inherited");
+                    if (orderingTestFailures.contains(testCase.toString())) {
+                        CHECKORDERING = false;
+                    } else
+                        CHECKORDERING = true;
+
                     checkAnnoValues(srcType, c);
                 } else {
                     error("Could not load className = " + c);
@@ -167,12 +187,12 @@
     enum TestCase {
         BasicNonRepeatable_Legacy(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
-                + "getDeclAnnoVal = \"Foo\", "
-                + "getAnnosArgs = {\"Foo\"}, "
-                + "getDeclAnnosArgs = {\"Foo\"}) ",
+                + "getAnnotationVal = \"@Foo(value=0)\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}, "
+                + "getDeclAnnoVal = \"@Foo(value=0)\", "
+                + "getAnnosArgs = {\"@Foo(value=0)\"}, "
+                + "getDeclAnnosArgs = {\"@Foo(value=0)\"}) ",
         "@ExpectedContainer") {
 
             @Override
@@ -202,11 +222,11 @@
                         Sample package-info.java
                         @ExpectedBase
                         @ExpectedContainer
-                        @Foo
+                        @Foo(0)
                         package testpkg;
 
                         @Retention(RetentionPolicy.RUNTIME)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         Sample testSrc:
                         package testpkg;
@@ -229,11 +249,11 @@
                     /*
                         Sample testSrc for class
                         @Retention(RetentionPolicy.RUNTIME)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @ExpectedBase
                         @ExpectedContainer
-                        @Foo
+                        @Foo(0)
                         class A {}
                          */
                         replaceVal = expectedVals + anno;
@@ -248,11 +268,11 @@
         },
         SingleAnnoInherited_Legacy(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
-                + "getAnnotationsVals = {\"Foo\", \"ExpectedBase\", \"ExpectedContainer\"}, "
+                + "getAnnotationVal = \"@Foo(value=0)\", "
+                + "getAnnotationsVals = {\"@Foo(value=0)\", \"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnoVal = \"NULL\", "
-                + "getAnnosArgs = {\"Foo\"}, "
+                + "getAnnosArgs = {\"@Foo(value=0)\"}, "
                 + "getDeclAnnosArgs = {})",
         "@ExpectedContainer") {
 
@@ -273,9 +293,9 @@
                 Sample testSrc:
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
-                @Foo
+                @Foo(0)
                 class SuperClass { }
 
                 @ExpectedBase
@@ -337,9 +357,9 @@
                 Sample test src:
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
-                @Foo
+                @Foo(0)
                 interface TestInterface { }
 
                 @ExpectedBase
@@ -375,18 +395,18 @@
         },
         AnnoOnSuperAndSubClass_Inherited_Legacy(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + "getAnnotationVal = \"@Foo(value=2)\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, "
                 + // override every annotation on superClass
-                "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, "
                 + // ignores inherited annotations
-                "getDeclAnnoVal = \"Foo\", " // ignores inherited
-                + "getAnnosArgs = {\"Foo\"}, "
-                + "getDeclAnnosArgs = { \"Foo\" })", // ignores inherited
+                "getDeclAnnoVal = \"@Foo(value=2)\", " // ignores inherited
+                + "getAnnosArgs = {\"@Foo(value=2)\"}, "
+                + "getDeclAnnosArgs = { \"@Foo(value=2)\" })", // ignores inherited
         "@ExpectedContainer(value=FooContainer.class, "
                 + "getAnnotationVal = \"NULL\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, "
                 + // ignores inherited annotations
                 "getDeclAnnoVal = \"NULL\", " + // ignores inherited
                 "getAnnosArgs = {}, " + "getDeclAnnosArgs = {})") { // ignores inherited
@@ -408,19 +428,19 @@
                 Sample test src
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Inherited
                 @interface FooContainer {
                 Foo[] value();
                 }
 
-                @Foo
+                @Foo(1)
                 class SuperClass { }
 
                 @ExpectedBase
                 @ExpectedContainer
-                @Foo
+                @Foo(2)
                 class SubClass extends SuperClass {}
                  */
                 // @Inherited only works for classes, no switch cases for
@@ -435,12 +455,13 @@
 
                 if (srcType == SrcType.CLASS) {
                     // Contents for SuperClass
-                    anno = Helper.ContentVars.BASEANNO.getVal();
+                    anno = "@Foo(1)";
                     replaceVal = commonStmts + "\n" + anno;
                     String superClassContents = srcType.getTemplate()
                             .replace("#CN", SUPERCLASS).replace("#REPLACE", replaceVal);
 
                     // Contents for SubClass that extends SuperClass
+                    anno = "@Foo(2)";
                     replaceVal = expectedVals + "\n" + anno;
                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
                             .replace("#CN", className).replace("#SN", SUPERCLASS)
@@ -456,17 +477,17 @@
         BasicContainer_Legacy(
         "@ExpectedBase(value = Foo.class, "
                 + "getAnnotationVal = \"NULL\","
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnoVal = \"NULL\", " + "getAnnosArgs = {}, "
                 + "getDeclAnnosArgs = {} )",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
-                + "getDeclAnnoVal = \"FooContainer\", "
-                + "getAnnosArgs = {\"FooContainer\"}, "
-                + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -498,11 +519,11 @@
                         Sample package-info.java
                         @ExpectedBase
                         @ExpectedContainer
-                        @FooContainer(value = {@Foo, @Foo})
+                        @FooContainer(value = {@Foo(1), @Foo(2)})
                         package testpkg;
 
                         @Retention(RetentionPolicy.RUNTIME)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @interface FooContainer {
@@ -529,7 +550,7 @@
                         Sample testSrc for class:
                         @Retention(RetentionPolicy.RUNTIME)
                         @Inherited
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @Inherited
@@ -539,7 +560,7 @@
 
                         @ExpectedBase
                         @ExpectedContainer
-                        @FooContainer(value = {@Foo, @Foo})
+                        @FooContainer(value = {@Foo(1), @Foo(2)})
                         class A {}
                          */
                         replaceVal = expectedVals + anno;
@@ -554,23 +575,23 @@
         },
         SingleAndContainerOnSuper_Legacy(
         "@ExpectedBase(value = Foo.class, "
-                + "getAnnotationVal = \"Foo\","
+                + "getAnnotationVal = \"@Foo(value=0)\","
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
-                + "getDeclAnnoVal = \"Foo\", "
-                + "getAnnosArgs = {\"Foo\"}, "
-                + "getDeclAnnosArgs = {\"Foo\"} )",
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnoVal = \"@Foo(value=0)\", "
+                + "getAnnosArgs = {\"@Foo(value=0)\"}, "
+                + "getDeclAnnosArgs = {\"@Foo(value=0)\"} )",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
-                + "getDeclAnnoVal = \"FooContainer\", "
-                + "getAnnosArgs = {\"FooContainer\"}, "
-                + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -589,8 +610,8 @@
                         + getExpectedContainer() + "\n";
                 StringBuilder commonStmts = new StringBuilder();
 
-                anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
-                        + Helper.ContentVars.BASEANNO.getVal();
+                anno = Helper.ContentVars.BASEANNO.getVal() +
+                       Helper.ContentVars.LEGACYCONTAINER.getVal();
                 commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
                         .append(Helper.ContentVars.IMPORTSTMTS.getVal())
                         .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
@@ -603,12 +624,12 @@
                         Sample package-info.java
                         @ExpectedBase
                         @ExpectedContainer
-                        @Foo
-                        @FooContainer(value = {@Foo, @Foo})
+                        @Foo(0)
+                        @FooContainer(value = {@Foo(1), @Foo(2)})
                         package testpkg;
 
                         @Retention(RetentionPolicy.RUNTIME)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @interface FooContainer {
@@ -636,7 +657,7 @@
                         Sample testSrc for class:
                         @Retention(RetentionPolicy.RUNTIME)
                         @Inherited
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @Inherited
@@ -646,8 +667,8 @@
 
                         @ExpectedBase
                         @ExpectedContainer
-                        @Foo
-                        @FooContainer(value = {@Foo, @Foo})
+                        @Foo(0)
+                        @FooContainer(value = {@Foo(1), @Foo(2)})
                         class A {}
                          */
                         replaceVal = expectedVals + anno;
@@ -664,17 +685,17 @@
         BasicContainer_Inherited_Legacy(
         "@ExpectedBase(value = Foo.class, "
                 + "getAnnotationVal = \"NULL\","
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnoVal = \"NULL\", "
                 + "getAnnosArgs = {}, "
                 + "getDeclAnnosArgs = {} )",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnoVal = \"NULL\", "
-                + "getAnnosArgs = {\"FooContainer\"}, "
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosArgs = {} )") {
 
             @Override
@@ -694,7 +715,7 @@
                 Sample testSrc:
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
@@ -702,7 +723,7 @@
                 Foo[] value();
                 }
 
-                @FooContainer(value = {@Foo, @Foo})
+                @FooContainer(value = {@Foo(1), @Foo(2)})
                 class SuperClass { }
 
                 @ExpectedBase
@@ -736,20 +757,20 @@
         },
         ContainerOnSuperSingleOnSub_Inherited_Legacy(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
-                + "getDeclAnnoVal = \"Foo\","
-                + "getAnnosArgs = {\"Foo\"},"
-                + "getDeclAnnosArgs = {\"Foo\"})",
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+                + "getDeclAnnoVal = \"@Foo(value=0)\","
+                + "getAnnosArgs = {\"@Foo(value=0)\"},"
+                + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"NULL\","
-                + "getAnnosArgs = {\"FooContainer\"},"
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
                 + "getDeclAnnosArgs = {})") {
 
             @Override
@@ -769,7 +790,7 @@
                 Sample testSrc:
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
@@ -777,12 +798,12 @@
                 Foo[] value();
                 }
 
-                @FooContainer(value = {@Foo, @Foo})
+                @FooContainer(value = {@Foo(1), @Foo(2)})
                 class SuperClass { }
 
                 @ExpectedBase
                 @ExpectedContainer
-                @Foo
+                @Foo(0)
                 class SubClass extends SuperClass {}
                  */
                 // @Inherited only works for classes, no switch cases for
@@ -811,22 +832,24 @@
                 return files;
             }
         },
+        // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+        // fail with ordering issues
         ContainerAndSingleOnSuperSingleOnSub_Inherited_Legacy(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
-                + "getDeclAnnoVal = \"Foo\","
-                + "getAnnosArgs = {\"Foo\"},"
-                + "getDeclAnnosArgs = {\"Foo\"})",
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+                + "getDeclAnnoVal = \"@Foo(value=0)\","
+                + "getAnnosArgs = {\"@Foo(value=0)\"},"
+                + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
                 + "getDeclAnnoVal = \"NULL\","
-                + "getAnnosArgs = {\"FooContainer\"},"
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
                 + "getDeclAnnosArgs = {})") {
 
             @Override
@@ -846,7 +869,7 @@
                 Sample testSrc:
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
@@ -854,12 +877,12 @@
                 Foo[] value();
                 }
 
-                @FooContainer(value = {@Foo, @Foo}) @Foo
+                @FooContainer(value = {@Foo(1), @Foo(2)}) @Foo(3)
                 class SuperClass { }
 
                 @ExpectedBase
                 @ExpectedContainer
-                @Foo
+                @Foo(0)
                 class SubClass extends SuperClass {}
                  */
                 // @Inherited only works for classes, no switch cases for
@@ -868,7 +891,7 @@
                 if (srcType == SrcType.CLASS) {
                     // Contents for SuperClass
                     anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
-                            + Helper.ContentVars.BASEANNO.getVal();
+                            + "@Foo(3)";
                     replaceVal = commonStmts + "\n" + anno;
                     String superClassContents = srcType.getTemplate()
                             .replace("#CN", SUPERCLASS)
@@ -888,23 +911,25 @@
                 return files;
             }
         },
+        // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+        // fail with ordering issues
         SingleOnSuperContainerOnSub_Inherited_Legacy(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
                 + "getDeclAnnoVal = \"NULL\","
-                + "getAnnosArgs = {\"Foo\"},"
+                + "getAnnosArgs = {\"@Foo(value=0)\"},"
                 + "getDeclAnnosArgs = {})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
-                + "getDeclAnnoVal = \"FooContainer\","
-                + "getAnnosArgs = {\"FooContainer\"},"
-                + "getDeclAnnosArgs = {\"FooContainer\"})") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -924,7 +949,7 @@
                 Sample testSrc:
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
@@ -932,12 +957,12 @@
                 Foo[] value();
                 }
 
-                @Foo
+                @Foo(0)
                 class SuperClass { }
 
                 @ExpectedBase
                 @ExpectedContainer
-                @FooContainer(value = {@Foo, @Foo})
+                @FooContainer(value = {@Foo(1), @Foo(2)})
                 class SubClass extends SuperClass {}
                  */
 
@@ -963,25 +988,27 @@
                 return files;
             }
         },
+        // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+        // fail with ordering issues
         SingleOnSuperContainerAndSingleOnSub_Inherited_Legacy(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationVal = \"@Foo(value=3)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
-                + "getDeclAnnoVal = \"Foo\","
-                + "getAnnosArgs = {\"Foo\"},"
-                + "getDeclAnnosArgs = {\"Foo\"})",
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+                + "getDeclAnnoVal = \"@Foo(value=3)\","
+                + "getAnnosArgs = {\"@Foo(value=3)\"},"
+                + "getDeclAnnosArgs = {\"@Foo(value=3)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
-                + "getDeclAnnoVal = \"FooContainer\","
-                + "getAnnosArgs = {\"FooContainer\"},"
-                + "getDeclAnnosArgs = {\"FooContainer\"})") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1001,7 +1028,7 @@
                 Sample testSrc:
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
@@ -1009,12 +1036,12 @@
                 Foo[] value();
                 }
 
-                @Foo
+                @Foo(0)
                 class SuperClass { }
 
                 @ExpectedBase
                 @ExpectedContainer
-                @FooContainer(value = {@Foo, @Foo}) @Foo
+                @FooContainer(value = {@Foo(1), @Foo(2)}) @Foo(3)
                 class SubClass extends SuperClass {}
                  */
 
@@ -1028,7 +1055,7 @@
 
                     //Contents for SubClass that extends SuperClass
                     anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
-                            + Helper.ContentVars.BASEANNO.getVal();
+                            + "@Foo(3)";
                     replaceVal = expectedVals + "\n" + anno;
                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
                             .replace("#CN", className).replace("#SN", SUPERCLASS)
@@ -1044,18 +1071,18 @@
         BasicRepeatable(
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"NULL\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\" }, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\" }, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
                 + "getDeclAnnoVal = \"NULL\","
-                + "getAnnosArgs = {\"Foo\", \"Foo\"},"
-                + "getDeclAnnosArgs = {\"Foo\", \"Foo\"})",
+                + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
+                + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\","
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
-                + "getDeclAnnoVal = \"FooContainer\","
-                + "getAnnosArgs = {\"FooContainer\"},"
-                + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1088,12 +1115,12 @@
                         Sample package-info.java
                         @ExpectedBase
                         @ExpectedContainer
-                        @Foo() @Foo()
+                        @Foo(1) @Foo(2)
                         package testpkg;
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @Repeatable(FooContainer.class)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @interface FooContainer {
@@ -1120,7 +1147,7 @@
                         Sample testSrc for class:
                         @Retention(RetentionPolicy.RUNTIME)
                         @Repeatable(FooContainer.class)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @interface FooContainer {
@@ -1129,7 +1156,7 @@
 
                         @ExpectedBase
                         @ExpectedContainer
-                        @Foo @Foo
+                        @Foo(1) @Foo(2)
                         class A { }
                          */
                         replaceVal = expectedVals + anno;
@@ -1146,21 +1173,21 @@
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"NULL\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
                 + "getDeclAnnoVal = \"NULL\","
-                + "getAnnosArgs = {\"Foo\", \"Foo\"},"
-                + "getDeclAnnosArgs = {\"Foo\", \"Foo\"})",
+                + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
+                + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\","
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
-                + "getDeclAnnoVal = \"FooContainer\","
-                + "getAnnosArgs = {\"FooContainer\"},"
-                + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1193,12 +1220,12 @@
                         Sample package-info.java
                         @ExpectedBase
                         @ExpectedContainer
-                        @FooContainer(value = {@Foo, @Foo})
+                        @FooContainer(value = {@Foo(1), @Foo(2)})
                         package testpkg;
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @Repeatable(FooContainer.class)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @interface FooContainer {
@@ -1225,7 +1252,7 @@
                         Sample testSrc for class:
                         @Retention(RetentionPolicy.RUNTIME)
                         @Repeatable(FooContainer.class)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @interface FooContainer {
@@ -1234,7 +1261,7 @@
 
                         @ExpectedBase
                         @ExpectedContainer
-                        @FooContainer(value = {@Foo, @Foo})
+                        @FooContainer(value = {@Foo(1), @Foo(2)})
                         class A { }
                          */
                         replaceVal = expectedVals + anno;
@@ -1250,17 +1277,17 @@
         BasicContainerRepeatable_Inherited(
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"NULL\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnoVal = \"NULL\", "
-                + "getAnnosArgs = {\"Foo\", \"Foo\"}, "
+                + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
                 + "getDeclAnnosArgs = {})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
                 + "getDeclAnnoVal = \"NULL\", "
-                + "getAnnosArgs = {\"FooContainer\"}, "
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosArgs = {})") {
 
             @Override
@@ -1280,7 +1307,7 @@
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
                 @Repeatable(FooContainer.class)
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
@@ -1288,7 +1315,7 @@
                 Foo[] value();
                 }
 
-                @FooContainer(value = {@Foo, @Foo})
+                @FooContainer(value = {@Foo(1), @Foo(2)})
                 class SuperClass { }
 
                 @ExpectedBase
@@ -1323,21 +1350,21 @@
         RepeatableAnnoInherited(
         "@ExpectedBase(value=Foo.class, "
                 + "getAnnotationVal = \"NULL\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
                 + // ignores inherited annotations
                 "getDeclAnnoVal = \"NULL\", "
                 + // ignores inherited
-                "getAnnosArgs = {\"Foo\", \"Foo\"}, "
+                "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
                 + "getDeclAnnosArgs = {})", // ignores inherited
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
                 + // ignores inherited annotations
                 "getDeclAnnoVal = \"NULL\", "
                 + // ignores inherited
-                "getAnnosArgs = {\"FooContainer\"}, "
+                "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
                 + "getDeclAnnosArgs = {})") { // ignores inherited
 
             @Override
@@ -1357,7 +1384,7 @@
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
                 @Repeatable(FooContainer.class)
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
@@ -1365,7 +1392,7 @@
                 Foo[] value();
                 }
 
-                @Foo() @Foo()
+                @Foo(1) @Foo(2)
                 class SuperClass { }
 
                 @ExpectedBase
@@ -1397,25 +1424,27 @@
                 return files;
             }
         },
+        // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+        // fail with ordering issues
         SingleAnnoWithContainer(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationVal = \"@Foo(value=0)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
-                + "getDeclAnnoVal = \"Foo\","
-                + "getAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"},"
-                + "getDeclAnnosArgs = {\"Foo\", \"Foo\",\"Foo\"})",
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getDeclAnnoVal = \"@Foo(value=0)\","
+                + "getAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\", \"@Foo(value=2)\"},"
+                + "getDeclAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\",\"@Foo(value=2)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
-                + "getDeclAnnoVal = \"FooContainer\","
-                + "getDeclAnnosArgs = {\"FooContainer\"},"
-                + "getAnnosArgs = {\"FooContainer\"})") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1449,12 +1478,12 @@
                         Sample package-info.java
                         @ExpectedBase
                         @ExpectedContainer
-                        @Foo @FooContainer(value = {@Foo, @Foo})
+                        @Foo(0) @FooContainer(value = {@Foo(1), @Foo(2)})
                         package testpkg;
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @Repeatable(FooContainer.class)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @interface FooContainer {
@@ -1482,7 +1511,7 @@
                         @Retention(RetentionPolicy.RUNTIME)
                         @Inherited
                         @Repeatable(FooContainer.class)
-                        @interface Foo {}
+                        @interface Foo {int value() default Integer.MAX_VALUE;}
 
                         @Retention(RetentionPolicy.RUNTIME)
                         @Inherited
@@ -1492,7 +1521,7 @@
 
                         @ExpectedBase
                         @ExpectedContainer
-                        @Foo @FooContainer(value = {@Foo, @Foo})
+                        @Foo(0) @FooContainer(value = {@Foo(1), @Foo(2)})
                         class A { }
                          */
                         replaceVal = expectedVals + anno;
@@ -1508,18 +1537,18 @@
         },
         AnnoOnSuperAndSubClass_Inherited(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\" }, "
+                + "getAnnotationVal = \"@Foo(value=1)\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\" }, "
                 + // override every annotation on superClass
-                "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\"}, "
                 + // ignores inherited annotations
-                "getDeclAnnoVal = \"Foo\", " // ignores inherited
-                + "getAnnosArgs = {\"Foo\"}, "
-                + "getDeclAnnosArgs = { \"Foo\" })", // ignores inherited
+                "getDeclAnnoVal = \"@Foo(value=1)\", " // ignores inherited
+                + "getAnnosArgs = {\"@Foo(value=1)\"}, "
+                + "getDeclAnnosArgs = { \"@Foo(value=1)\" })", // ignores inherited
         "@ExpectedContainer(value=FooContainer.class, "
                 + "getAnnotationVal = \"NULL\", "
-                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\" }, "
-                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\" }, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\"}, "
                 + // ignores inherited annotations
                 "getDeclAnnoVal = \"NULL\", " + // ignores inherited
                 "getAnnosArgs = {}, " + "getDeclAnnosArgs = {})") {
@@ -1542,7 +1571,7 @@
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
                 @Repeatable(FooContainer.class)
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
@@ -1550,12 +1579,12 @@
                 Foo[] value();
                 }
 
-                @Foo()
+                @Foo(0)
                 class SuperClass { }
 
                 @ExpectedBase
                 @ExpectedContainer
-                @Foo
+                @Foo(1)
                 class SubClass extends SuperClass { }
                  */
                 // @Inherited only works for classes, no switch cases for
@@ -1570,7 +1599,7 @@
                             .replace("#REPLACE", replaceVal);
 
                     // Contents for SubClass that extends SuperClass
-                    replaceVal = expectedVals + "\n" + anno;
+                    replaceVal = expectedVals + "\n" + "@Foo(1)";
                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
                             .replace("#CN", className)
                             .replace("#SN", SUPERCLASS)
@@ -1623,7 +1652,7 @@
 //                 @Retention(RetentionPolicy.RUNTIME)
 //                 @Inherited
 //                 @Repeatable(FooContainer.class)
-//                 @interface Foo {}
+//                 @interface Foo {int value() default Integer.MAX_VALUE;}
 
 //                 @Retention(RetentionPolicy.RUNTIME)
 //                 @Inherited
@@ -1650,7 +1679,7 @@
 //                             .replace("#REPLACE", replaceVal);
 
 //                     //Contents for SubClass that extends SuperClass
-//                     anno = Helper.ContentVars.BASEANNO.getVal();
+//                     anno = "@Foo(0)";
 //                     replaceVal = expectedVals + "\n" + anno;
 //                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
 //                             .replace("#CN", className)
@@ -1703,7 +1732,7 @@
 //                 @Retention(RetentionPolicy.RUNTIME)
 //                 @Inherited
 //                 @Repeatable(FooContainer.class)
-//                 @interface Foo {}
+//                 @interface Foo {int value() default Integer.MAX_VALUE;}
 
 //                 @Retention(RetentionPolicy.RUNTIME)
 //                 @Inherited
@@ -1723,7 +1752,7 @@
 //                 //@Inherited only works for classes, no switch cases for method, field, package
 //                 if (srcType == SrcType.CLASS) {
 //                     //Contents for SuperClass
-//                     anno = Helper.ContentVars.BASEANNO.getVal();
+//                     anno = "@Foo(0)";
 //                     replaceVal = commonStmts + "\n" + anno;
 //                     String superClassContents = srcType.getTemplate()
 //                             .replace("#CN", SUPERCLASS)
@@ -1781,7 +1810,7 @@
 //                 @Retention(RetentionPolicy.RUNTIME)
 //                 @Inherited
 //                 @Repeatable(FooContainer.class)
-//                 @interface Foo {}
+//                 @interface Foo {int value() default Integer.MAX_VALUE;}
 
 //                 @Retention(RetentionPolicy.RUNTIME)
 //                 @Inherited
@@ -1808,7 +1837,7 @@
 //                             .replace("#REPLACE", replaceVal);
 
 //                     //Contents for SubClass that extends SuperClass
-//                     anno = Helper.ContentVars.BASEANNO.getVal();
+//                     anno = "@Foo(0)";
 //                     replaceVal = expectedVals + "\n" + anno;
 //                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
 //                             .replace("#CN", className)
@@ -1859,7 +1888,7 @@
 //                 @Retention(RetentionPolicy.RUNTIME)
 //                 @Inherited
 //                 @Repeatable(FooContainer.class)
-//                 @interface Foo {}
+//                 @interface Foo {int value() default Integer.MAX_VALUE;}
 
 //                 @Retention(RetentionPolicy.RUNTIME)
 //                 @Inherited
@@ -1879,7 +1908,7 @@
 //                 //@Inherited only works for classes, no switch cases for method, field, package
 //                 if (srcType == SrcType.CLASS) {
 //                     //Contents for SuperClass
-//                     anno = Helper.ContentVars.BASEANNO.getVal();
+//                     anno = "@Foo(0)";
 //                     replaceVal = commonStmts + "\n" + anno;
 //                     String superClassContents = srcType.getTemplate()
 //                             .replace("#CN", SUPERCLASS)
@@ -1900,25 +1929,27 @@
 //                 return files;
 //             }
 //         },
+        // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+        // fail with ordering issues
         SingleOnSuperContainerAndSingleOnSub_Inherited(
         "@ExpectedBase(value=Foo.class, "
-                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationVal = \"@Foo(value=3)\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
-                + "getDeclAnnoVal = \"Foo\","
-                + "getAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"},"
-                + "getDeclAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"})",
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+                + "getDeclAnnoVal = \"@Foo(value=3)\","
+                + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"},"
+                + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"})",
         "@ExpectedContainer(value=FooContainer.class, "
-                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
                 + "getAnnotationsVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
                 + "getDeclAnnosVals = {"
-                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
-                + "getDeclAnnoVal = \"FooContainer\","
-                + "getAnnosArgs = {\"FooContainer\"},"
-                + "getDeclAnnosArgs = {\"FooContainer\"})") {
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+                + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+                + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+                + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
 
             @Override
             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1936,7 +1967,7 @@
                 Sample testSrc:
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
-                @interface Foo {}
+                @interface Foo {int value() default Integer.MAX_VALUE;}
 
                 @Retention(RetentionPolicy.RUNTIME)
                 @Inherited
@@ -1945,12 +1976,12 @@
                 Foo[] value();
                 }
 
-                @Foo
+                @Foo(0)
                 class SuperClass { }
 
                 @ExpectedBase
                 @ExpectedContainer
-                @FooContainer(value = {@Foo, @Foo}) @Foo
+                @FooContainer(value = {@Foo(1), @Foo(2)}) @Foo(3)
                 class SubClass extends SuperClass {}
                  */
 
@@ -1964,7 +1995,7 @@
 
                     //Contents for SubClass that extends SuperClass
                     anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
-                            + Helper.ContentVars.BASEANNO.getVal();
+                            + "@Foo(3)";
                     replaceVal = expectedVals + "\n" + anno;
                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
                             .replace("#CN", className)
@@ -2015,7 +2046,7 @@
 //                  @Retention(RetentionPolicy.RUNTIME)
 //                  @Inherited
 //                  @Repeatable(FooContainer.class)
-//                  @interface Foo {}
+//                  @interface Foo {int value() default Integer.MAX_VALUE;}
 
 //                  @Retention(RetentionPolicy.RUNTIME)
 //                  @Inherited
@@ -2044,7 +2075,7 @@
 //                              .replace("#REPLACE", replaceVal);
 
 //                      //Contents for SubClass that extends SuperClass
-//                      anno = Helper.ContentVars.BASEANNO.getVal();
+//                      anno = "@Foo(0)";
 //                      replaceVal = expectedVals + "\n" + anno;
 //                      String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
 //                              .replace("#CN", className)
@@ -2800,6 +2831,8 @@
     // should be present in actualAnno[].
     private static boolean compareAnnotations(Annotation[] actualAnnos,
             String[] expectedAnnos) {
+        boolean compOrder = false;
+
         // Length is different
         if (actualAnnos.length != expectedAnnos.length) {
             error("Length not same, Actual length = " + actualAnnos.length
@@ -2830,12 +2863,16 @@
             // Lengths are same, compare array contents
             String[] actualArr = new String[actualAnnos.length];
             for (Annotation a : actualAnnos) {
+                if (a.annotationType().getSimpleName().contains("Expected"))
                 actualArr[i++] = a.annotationType().getSimpleName();
+                 else if (a.annotationType().getName().contains(TESTPKG)) {
+                    String replaced = a.toString().replaceAll(Pattern.quote("testpkg."),"");
+                    actualArr[i++] = replaced;
+                } else
+                    actualArr[i++] = a.toString();
             }
-
-            List<String> actualList = Arrays.asList(actualArr);
-            List<String> expectedList = Arrays.asList(expectedAnnos);
-
+            List<String> actualList = new ArrayList<String>(Arrays.asList(actualArr));
+            List<String> expectedList = new ArrayList<String>(Arrays.asList(expectedAnnos));
             if (!actualList.containsAll(expectedList)) {
                 error("Array values are not same");
                 printArrContents(actualAnnos);
@@ -2843,10 +2880,63 @@
                 return false;
             } else {
                 debugPrint("Arr values are same as expected");
+                if (CHECKORDERING) {
+                    debugPrint("Checking if annotation ordering is as expected..");
+                    compOrder = compareOrdering(actualList, expectedList);
+                    if (compOrder)
+                        debugPrint("Arr values ordering is as expected");
+                    else
+                        error("Arr values ordering is not as expected! actual values: "
+                            + actualList + " expected values: " + expectedList);
+                } else
+                    compOrder = true;
             }
         }
+        return compOrder;
+    }
+
+    // Annotation ordering comparison
+    private static boolean compareOrdering(List<String> actualList, List<String> expectedList) {
+        boolean order = true;
+        // Discarding Expected* annotations before comparison of ordering
+        actualList = iterateList(actualList);
+        expectedList = iterateList(expectedList);
+        // Length is different
+        if (actualList.size() != expectedList.size()) {
+            error("Length not same, Actual list length = " + actualList.size()
+                    + " Expected list length = " + expectedList.size());
+            return false;
+        } else {
+            if (actualList.isEmpty() && expectedList.isEmpty()) {
         return true;
     }
+            boolean tmp = true;
+            for (int i = 0; i < actualList.size(); i++) {
+                // Checking ordering
+                if (order) {
+                    if (!actualList.get(i).equals(expectedList.get(i))) {
+                        tmp = false;
+                        debugPrint("Odering is false");
+                        debugPrint("actualList values: " + actualList
+                                + " expectedList values: " + expectedList);
+                    }
+                }
+            }
+            order = tmp;
+        }
+        return order;
+    }
+
+    private static List<String> iterateList(List<String> list) {
+        Iterator<String> iter = list.iterator();
+        while (iter.hasNext()) {
+            String anno = iter.next();
+            if (anno.contains("Expected")) {
+                iter.remove();
+            }
+        }
+        return list;
+    }
 
     private static void printArrContents(Annotation[] actualAnnos) {
         System.out.print("Actual Arr Values: ");
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/TestAnonInnerInstance1.java b/langtools/test/tools/javac/annotations/typeAnnotations/TestAnonInnerInstance1.java
new file mode 100644
index 0000000..190f8b1
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/TestAnonInnerInstance1.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, 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 8026286
+ * @summary This test previously forced an assertion to fail, due to
+ *          TypeAnnotationPosition visiting a tree node prior to
+ *          memberEnter.
+ * @compile TestAnonInnerInstance1.java
+ */
+
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+import java.util.List;
+
+class TestAnonInnerInstance1<T> {
+    Object mtest(TestAnonInnerInstance1<T> t){ return null; }
+    Object mmtest(TestAnonInnerInstance1<T> t){ return null; }
+
+    public void test() {
+
+        mtest(new TestAnonInnerInstance1<T>() {
+                  class InnerAnon<U> { // Test1$1$InnerAnon.class
+                      @A @B @C @D String ia_m1(){ return null; };
+                  }
+    //If this is commented out, annotations are attributed correctly
+                  InnerAnon<String> IA = new InnerAnon< String>();
+              });
+   }
+}
+
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @interface A { }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @interface B { }
+@Retention(CLASS) @Target({TYPE_USE,FIELD}) @interface C { }
+@Retention(CLASS) @Target({TYPE_USE,METHOD}) @interface D { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java
index 952b73c..22280b4 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java
@@ -36,7 +36,8 @@
 
     //Makes debugging much easier. Set to 'false' for less output.
     public Boolean verbose = true;
-    void println(String msg) { if(verbose) System.out.println(msg); }
+    void println(String msg) { if (verbose) System.out.println(msg); }
+    void print(String msg) { if (verbose) System.out.print(msg); }
 
     File writeTestFile(String fname, String source) throws IOException {
       File f = new File(fname);
@@ -183,6 +184,13 @@
                         (RuntimeTypeAnnotations_attribute)attr;
                 println(testtype + ": " + name + ", " + annName + ": " +
                         tAttr.annotations.length );
+                if (tAttr.annotations.length > 0) {
+                    for (int i = 0; i < tAttr.annotations.length; i++) {
+                        println("  types:" + tAttr.annotations[i].position.type);
+                    }
+                } else {
+                    println("");
+                }
                 allt += tAttr.annotations.length;
                 if (visible)
                     tvisibles += tAttr.annotations.length;
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/Scopes.java b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/Scopes.java
new file mode 100644
index 0000000..0c03691
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/Scopes.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2009, 2013, 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.
+ */
+
+import java.lang.annotation.*;
+import java.io.*;
+import java.net.URL;
+import java.util.List;
+
+import com.sun.tools.classfile.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary Qualified inner type annotation accessible to the class.
+ */
+
+@Scopes.UniqueInner
+public class Scopes<T extends @Scopes.UniqueInner Object> extends ClassfileTestHelper{
+    public static void main(String[] args) throws Exception {
+        new Scopes().run();
+    }
+
+    public void run() throws Exception {
+        expected_tinvisibles = 1;
+        expected_invisibles = 1;
+
+        ClassFile cf = getClassFile("Scopes.class");
+        test(cf);
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    @Target({ElementType.TYPE_USE})
+    @interface UniqueInner { };
+}
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java
index 046fc0a..4b37b05 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java
@@ -24,7 +24,6 @@
 /*
  * @test
  * @bug 8008762
- * @ignore 8013409: test failures for type annotations
  * @summary Type annotation on inner class in anonymous class
  *          shows up as regular annotation
  */
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java
new file mode 100644
index 0000000..0ce59a8
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2013 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 8005085 8008762 8008751 8013065 8015323 8015257
+ * @summary Type annotations on anonymous and inner class.
+ *  Six TYPE_USE annotations are repeated(or not); Four combinations create
+ *  four test files, and each results in the test class and 2 anonymous classes.
+ *  Each element of these three classes is checked for expected number of the
+ *  four annotation Attributes. Expected annotation counts depend on type of
+ *  annotation place on type of element (a FIELD&TYPE_USE element on a field
+ *  results in 2). Elements with no annotations expect 0.
+ *  Source template is read in from testanoninner.template
+ *
+ */
+import java.lang.annotation.*;
+import java.io.*;
+import java.util.List;
+import java.util.LinkedList;
+import com.sun.tools.classfile.*;
+import java.nio.file.Files;
+import java.nio.charset.*;
+import java.io.File;
+import java.io.IOException;
+
+
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+
+/*
+ * A source template is read in and testname and annotations are inserted
+ * via replace().
+ */
+public class TestAnonInnerClasses extends ClassfileTestHelper {
+    // tally errors and test cases
+    int errors = 0;
+    int checks = 0;
+    //Note expected test count in case of skips due to bugs.
+    int tc = 0, xtc = 180; // 45 x 4 variations of repeated annotations.
+    File testSrc = new File(System.getProperty("test.src"));
+
+    String[] AnnoAttributes = {
+        Attribute.RuntimeVisibleTypeAnnotations,
+        Attribute.RuntimeInvisibleTypeAnnotations,
+        Attribute.RuntimeVisibleAnnotations,
+        Attribute.RuntimeInvisibleAnnotations
+    };
+
+    // template for source files
+    String srcTemplate = "testanoninner.template";
+
+    // Four test files generated based on combinations of repeating annotations.
+    Boolean As= false, Bs=true, Cs=false, Ds=false, TAs=false,TBs=false;
+    Boolean[][] bRepeat = new Boolean[][]{
+                 /* no repeats    */ {false, false, false, false, false, false},
+                 /* repeat A,C,TA */ {true,  false, true,  false, true,  false},
+                 /* repeat B,D,TB */ {false, true,  false, true,  false, true},
+                 /* repeat all    */ {true,  true,  true,  true,  true,  true}
+    };
+    // Save descriptions of failed test case; does not terminate upon a failure.
+    List<String> failed = new LinkedList<>();
+
+    public static void main(String[] args) throws Exception {
+        new TestAnonInnerClasses().run();
+    }
+
+    // Check annotation counts and make reports sufficiently descriptive to
+    // easily diagnose.
+    void check(String testcase, int vtaX, int itaX, int vaX, int iaX,
+                                int vtaA, int itaA, int vaA, int iaA) {
+
+        String descr = " checking " + testcase+" _TYPE_, expected: " +
+            vtaX + ", " + itaX + ", " + vaX + ", " + iaX + "; actual: " +
+            vtaA + ", " + itaA + ", " + vaA + ", " + iaA;
+        String description;
+        description=descr.replace("_TYPE_","RuntimeVisibleTypeAnnotations");
+        if (vtaX != vtaA) {
+            errors++;
+            failed.add(++checks + " " + testcase + ": (vtaX) " + vtaX +
+                       " != " + vtaA + " (vtaA)");
+            println(checks + " FAIL: " + description);
+        } else {
+            println(++checks + " PASS: " + description);
+        }
+        description=descr.replace("_TYPE_","RuntimeInvisibleTypeAnnotations");
+        if (itaX != itaA) {
+            errors++;
+            failed.add(++checks + " " + testcase + ": (itaX) " + itaX + " != " +
+                       itaA + " (itaA)");
+            println(checks + " FAIL: " + description);
+        } else {
+            println(++checks + " PASS: " + description);
+        }
+        description=descr.replace("_TYPE_","RuntimeVisibleAnnotations");
+        if (vaX != vaA) {
+            errors++;
+            failed.add(++checks + " " + testcase + ": (vaX) " + vaX + " != " +
+                       vaA + " (vaA)");
+            println(checks + " FAIL: " + description);
+        } else {
+            println(++checks + " PASS: " + description);
+        }
+        description=descr.replace("_TYPE_","RuntimeInvisibleAnnotations");
+        if (iaX != iaA) {
+            errors++;
+            failed.add(++checks + " " + testcase + ": (iaX) " + iaX + " != " +
+                       iaA + " (iaA)");
+            println(checks + " FAIL: " + description);
+        } else {
+            println(++checks + " PASS: " + description);
+        }
+        println("");
+    }
+
+    // Print failed cases (if any) and throw exception for fail.
+    void report() {
+        if (errors!=0) {
+            System.err.println("Failed tests: " + errors +
+                               "\nfailed test cases:\n");
+            for (String t: failed) System.err.println("  " + t);
+            throw new RuntimeException("FAIL: There were test failures.");
+        } else
+            System.out.println("PASSED all tests.");
+    }
+
+    void test(String ttype, ClassFile cf, Method m, Field f, boolean visible) {
+        int vtaActual = 0,
+            itaActual = 0,
+            vaActual = 0,
+            iaActual = 0,
+            vtaExp = 0,
+            itaExp = 0,
+            vaExp = 0,
+            iaExp = 0,
+            index = 0,
+            index2 = 0;
+        String memberName = null,
+            testcase = "undefined",
+            testClassName = null;
+        Attribute attr = null,
+            cattr = null;
+        Code_attribute CAttr = null;
+        // Get counts of 4 annotation Attributes on element being checked.
+        for (String AnnoType : AnnoAttributes) {
+            try {
+                switch (ttype) {
+                    case "METHOD":
+                        index = m.attributes.getIndex(cf.constant_pool,
+                                                      AnnoType);
+                        memberName = m.getName(cf.constant_pool);
+                        if (index != -1)
+                            attr = m.attributes.get(index);
+                        //fetch index annotations from code attribute.
+                        index2 = m.attributes.getIndex(cf.constant_pool,
+                                                       Attribute.Code);
+                        if (index2 != -1) {
+                            cattr = m.attributes.get(index2);
+                            assert cattr instanceof Code_attribute;
+                            CAttr = (Code_attribute)cattr;
+                            index2 = CAttr.attributes.getIndex(cf.constant_pool,
+                                                               AnnoType);
+                            if (index2 != -1)
+                                cattr = CAttr.attributes.get(index2);
+                        }
+                        break;
+                    case "FIELD":
+                        index = f.attributes.getIndex(cf.constant_pool,
+                                                      AnnoType);
+                        memberName = f.getName(cf.constant_pool);
+                        if (index != -1)
+                            attr = f.attributes.get(index);
+                        //fetch index annotations from code attribute.
+                        index2 = cf.attributes.getIndex(cf.constant_pool,
+                                                        Attribute.Code);
+                        if (index2!= -1) {
+                            cattr = cf.attributes.get(index2);
+                            assert cattr instanceof Code_attribute;
+                            CAttr = (Code_attribute)cattr;
+                            index2 = CAttr.attributes.getIndex(cf.constant_pool,
+                                                               AnnoType);
+                            if (index2!= -1)
+                                cattr = CAttr.attributes.get(index2);
+                        }
+                        break;
+
+                    default:
+                        memberName = cf.getName();
+                        index = cf.attributes.getIndex(cf.constant_pool,
+                                                       AnnoType);
+                        if (index!= -1) attr = cf.attributes.get(index);
+                        break;
+                }
+            }
+            catch (ConstantPoolException cpe) { cpe.printStackTrace(); }
+            try {
+                testClassName=cf.getName();
+                testcase = ttype + ": " + testClassName + ": " +
+                           memberName + ", ";
+            }
+            catch (ConstantPoolException cpe) { cpe.printStackTrace(); }
+            if (index != -1) {
+                switch (AnnoType) {
+                    case Attribute.RuntimeVisibleTypeAnnotations:
+                        //count RuntimeVisibleTypeAnnotations
+                        RuntimeVisibleTypeAnnotations_attribute RVTAa =
+                                (RuntimeVisibleTypeAnnotations_attribute)attr;
+                        vtaActual += RVTAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeVisibleAnnotations:
+                        //count RuntimeVisibleAnnotations
+                        RuntimeVisibleAnnotations_attribute RVAa =
+                                (RuntimeVisibleAnnotations_attribute)attr;
+                        vaActual += RVAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeInvisibleTypeAnnotations:
+                        //count RuntimeInvisibleTypeAnnotations
+                        RuntimeInvisibleTypeAnnotations_attribute RITAa =
+                                (RuntimeInvisibleTypeAnnotations_attribute)attr;
+                        itaActual += RITAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeInvisibleAnnotations:
+                        //count RuntimeInvisibleAnnotations
+                        RuntimeInvisibleAnnotations_attribute RIAa =
+                                (RuntimeInvisibleAnnotations_attribute)attr;
+                        iaActual += RIAa.annotations.length;
+                        break;
+                }
+            }
+            // annotations from code attribute.
+            if (index2 != -1) {
+                switch (AnnoType) {
+                    case Attribute.RuntimeVisibleTypeAnnotations:
+                        //count RuntimeVisibleTypeAnnotations
+                        RuntimeVisibleTypeAnnotations_attribute RVTAa =
+                                (RuntimeVisibleTypeAnnotations_attribute)cattr;
+                        vtaActual += RVTAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeVisibleAnnotations:
+                        //count RuntimeVisibleAnnotations
+                        RuntimeVisibleAnnotations_attribute RVAa =
+                                (RuntimeVisibleAnnotations_attribute)cattr;
+                        vaActual += RVAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeInvisibleTypeAnnotations:
+                        //count RuntimeInvisibleTypeAnnotations
+                        RuntimeInvisibleTypeAnnotations_attribute RITAa =
+                                (RuntimeInvisibleTypeAnnotations_attribute)cattr;
+                        itaActual += RITAa.annotations.length;
+                        break;
+                    case Attribute.RuntimeInvisibleAnnotations:
+                        //count RuntimeInvisibleAnnotations
+                        RuntimeInvisibleAnnotations_attribute RIAa =
+                                (RuntimeInvisibleAnnotations_attribute)cattr;
+                        iaActual += RIAa.annotations.length;
+                        break;
+                }
+            }
+        }
+
+        switch (memberName) {
+            //METHODs
+            case "test" : vtaExp=4;  itaExp=4;  vaExp=0; iaExp=0; tc++; break;
+            case "mtest": vtaExp=4;  itaExp=4;  vaExp=1; iaExp=1; tc++; break;
+            case "m1":    vtaExp=2;  itaExp=2;  vaExp=1; iaExp=1; tc++; break;
+            case "m2":    vtaExp=4;  itaExp=4;  vaExp=1; iaExp=1; tc++; break;
+            case "m3":    vtaExp=10; itaExp=10; vaExp=1; iaExp=1; tc++; break;
+            case "tm":    vtaExp=6;  itaExp=6;  vaExp=1; iaExp=1; tc++; break;
+            //inner class
+            case "i_m1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "i_m2":  vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            case "i_um":  vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //local class
+            case "l_m1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "l_m2":  vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            case "l_um":  vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //anon class
+            case "mm_m1": vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "mm_m2": vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            case "mm_m3": vtaExp=10; itaExp=10;vaExp=1; iaExp=1; tc++; break;
+            case "mm_tm": vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //InnerAnon class
+            case "ia_m1": vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "ia_m2": vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            case "ia_um": vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //FIELDs
+            case "data":   vtaExp = 2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "odata1": vtaExp = 2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "pdata1": vtaExp = 2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "tdata":  vtaExp = 2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "sa1":    vtaExp = 6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            //inner class
+            case "i_odata1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "i_pdata1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "i_udata":   vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "i_sa1":     vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            case "i_tdata":   vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            //local class
+            case "l_odata1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "l_pdata1":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "l_udata":   vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "l_sa1":     vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            case "l_tdata":   vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            //anon class
+            case "mm_odata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "mm_pdata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "mm_sa1":    vtaExp = 6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            case "mm_tdata":  vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            // InnerAnon class
+            case "ia_odata1": vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "ia_pdata1": vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "ia_udata":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "ia_sa1":    vtaExp=6;  itaExp=6; vaExp=1; iaExp=1; tc++; break;
+            case "ia_tdata":  vtaExp=2;  itaExp=2; vaExp=1; iaExp=1; tc++; break;
+            case "IA":        vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            case "IN":        vtaExp=4;  itaExp=4; vaExp=1; iaExp=1; tc++; break;
+            // default cases are <init>, this$0, this$1, mmtest, atest
+            default:          vtaExp = 0;  itaExp=0; vaExp=0; iaExp=0;    break;
+        }
+        check(testcase,vtaExp,   itaExp,   vaExp,   iaExp,
+                       vtaActual,itaActual,vaActual,iaActual);
+    }
+
+    public void run() {
+        ClassFile cf   = null;
+        InputStream in = null;
+        int testcount  = 1;
+        File testFile  = null;
+        // Generate source, check methods and fields for each combination.
+        for (Boolean[] bCombo : bRepeat) {
+            As=bCombo[0]; Bs=bCombo[1]; Cs=bCombo[2];
+            Ds=bCombo[3]; TAs=bCombo[4]; TBs=bCombo[5];
+            String testname = "Test" + testcount++;
+            println("Combinations: " + As + ", " + Bs + ", " + Cs + ", " + Ds +
+                    ", " + TAs + ", " + TBs +
+                    "; see " + testname + ".java");
+            String[] classes = {testname + ".class",
+                                testname + "$Inner.class",
+                                testname + "$1Local1.class",
+                                testname + "$1.class",
+                                testname + "$1$1.class",
+                                testname + "$1$InnerAnon.class"
+            };
+            // Create test source, create and compile File.
+            String sourceString = getSource(srcTemplate, testname,
+                                            As, Bs, Cs, Ds, TAs, TBs);
+            System.out.println(sourceString);
+            try {
+                testFile = writeTestFile(testname+".java", sourceString);
+            }
+            catch (IOException ioe) { ioe.printStackTrace(); }
+            // Compile test source and read classfile.
+            File classFile = null;
+            try {
+                classFile = compile(testFile);
+            }
+            catch (Error err) {
+                System.err.println("FAILED compile. Source:\n" + sourceString);
+                throw err;
+            }
+            String testloc = classFile.getAbsolutePath().substring(
+                   0,classFile.getAbsolutePath().indexOf(classFile.getPath()));
+            for (String clazz : classes) {
+                try {
+                    cf = ClassFile.read(new File(testloc+clazz));
+                }
+                catch (Exception e) { e.printStackTrace();  }
+                // Test for all methods and fields
+                for (Method m: cf.methods) {
+                    test("METHOD", cf, m, null, true);
+                }
+                for (Field f: cf.fields) {
+                    test("FIELD", cf, null, f, true);
+                }
+            }
+        }
+        report();
+        if (tc!=xtc) System.out.println("Test Count: " + tc + " != " +
+                                       "expected: " + xtc);
+    }
+
+
+    String getSrcTemplate(String sTemplate) {
+        List<String> tmpl = null;
+        String sTmpl = "";
+        try {
+            tmpl = Files.readAllLines(new File(testSrc,sTemplate).toPath(),
+                                      Charset.defaultCharset());
+        }
+        catch (IOException ioe) {
+            String error = "FAILED: Test failed to read template" + sTemplate;
+            ioe.printStackTrace();
+            throw new RuntimeException(error);
+        }
+        for (String l : tmpl)
+            sTmpl=sTmpl.concat(l).concat("\n");
+        return sTmpl;
+    }
+
+    // test class template
+    String getSource(String templateName, String testname,
+                     Boolean Arepeats,  Boolean Brepeats,
+                     Boolean Crepeats,  Boolean Drepeats,
+                     Boolean TArepeats, Boolean TBrepeats) {
+        String As  = Arepeats  ? "@A @A":"@A",
+               Bs  = Brepeats  ? "@B @B":"@B",
+               Cs  = Crepeats  ? "@C @C":"@C",
+               Ds  = Drepeats  ? "@D @D":"@D",
+               TAs = TArepeats ? "@TA @TA":"@TA",
+               TBs = TBrepeats ? "@TB @TB":"@TB";
+
+        // split up replace() lines for readability
+        String testsource = getSrcTemplate(templateName).replace("testname",testname);
+        testsource = testsource.replace("_As",As).replace("_Bs",Bs).replace("_Cs",Cs);
+        testsource = testsource.replace("_Ds",Ds).replace("_TAs",TAs).replace("_TBs",TBs);
+        return testsource;
+    }
+}
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/testanoninner.template b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/testanoninner.template
new file mode 100644
index 0000000..ee384bf
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/testanoninner.template
@@ -0,0 +1,108 @@
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+import java.util.List;
+
+class testname <T> {                 // TestN.class
+    _As _Bs _Cs _Ds String data = "test";
+    _As _Bs _Cs _Ds Object mtest( _As _Bs _Cs _Ds testname <T> t){ return null;  }
+    Object mmtest( testname<T> t){ return null;  }
+
+    class Inner<U> {        // TestN$1$Inner.class
+         _As _Bs _Cs _Ds String i_odata1 = "test";
+         _As _Bs _Cs _Ds int    i_pdata1 = 0;
+         _As _Bs _Cs _Ds U      i_udata = null;
+//8015257
+         _As _Bs _Cs _Ds Object  _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds [] i_sa1 = null;
+         _As _Bs _Cs _Ds  T    i_tdata = null;
+         _As _Bs _Cs _Ds String i_m1(){ return null; };
+         _As _Bs _Cs _Ds int    i_m2( _As _Bs _Cs _Ds Object o){return 0;}
+         _As _Bs _Cs _Ds
+        <_TAs _TBs _Cs _Ds U> Object i_um( _As _Bs _Cs _Ds  U u) { return null; }
+    }
+//8015323
+    _As _Bs _Cs _Ds Inner< _As _Bs _Cs _Ds String> IN = new  Inner< String>();
+
+    public void test() {
+ 
+        class Local1<U> {                   // TestN$Local1.class
+            _As _Bs _Cs _Ds  String l_odata1 = "test";
+            _As _Bs _Cs _Ds  int    l_pdata1 = 0;
+            _As _Bs _Cs _Ds  U      l_udata = null;
+//8015257
+            _As _Bs _Cs _Ds  Object _As _Bs _Cs _Ds  []_As _Bs _Cs _Ds  [] l_sa1 = null;
+            _TAs _TBs _Cs _Ds  T    l_tdata = null;
+            _As _Bs _Cs _Ds  String l_m1(){ return null; };
+            _As _Bs _Cs _Ds  int    l_m2(_As _Bs _Cs _Ds  Object o){return 0;}
+            _As _Bs _Cs _Ds 
+            <_TAs _TBs _Cs _Ds  U> Object l_um(_As _Bs _Cs _Ds   U u) { return null; }
+        }
+        // The below, as a local variable, will show up on test()
+       _As _Bs _Cs _Ds  Local1<_As _Bs _Cs _Ds  String> LC = new Local1<String>();
+ 
+        mtest( new testname<T>() {  // TestN$1
+                class InnerAnon<U> {        // TestN$1$InnerAnon.class
+                    _As _Bs _Cs _Ds  String ia_odata1 = "test";
+                    _As _Bs _Cs _Ds  int    ia_pdata1 = 0;
+                    _As _Bs _Cs _Ds  U      ia_udata = null;
+//8015257
+                    _As _Bs _Cs _Ds  Object _As _Bs _Cs _Ds  []_As _Bs _Cs _Ds  [] ia_sa1 = null;
+                    _TAs _TBs _Cs _Ds  T    ia_tdata = null;
+                    _As _Bs _Cs _Ds  String ia_m1(){ return null; };
+                    _As _Bs _Cs _Ds  int    ia_m2(_As _Bs _Cs _Ds  Object o){return 0;}
+                    _As _Bs _Cs _Ds 
+                    <_TAs _TBs _Cs _Ds  U> Object ia_um(_As _Bs _Cs _Ds   U u) { return null; }
+                }
+//8015257
+                _As _Bs _Cs _Ds  InnerAnon<_As _Bs _Cs _Ds  String> IA = new InnerAnon< String>();
+
+                _As _Bs _Cs _Ds String odata1 = "test";
+                _As _Bs _Cs _Ds int    pdata1 = 0;
+//8015257
+                _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa1 = null;
+                _As _Bs _Cs _Ds T tdata = null;
+
+                _As _Bs _Cs _Ds String m1(){ return null; };
+                _As _Bs _Cs _Ds int    m2(_As _Bs _Cs _Ds Object o){return 0;}
+
+                _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds []
+                m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; }
+
+                _As _Bs _Cs _Ds
+                <_TAs _TBs _Cs _Ds T> Object tm(_As _Bs _Cs _Ds  T t) { return null; }
+
+                public void atest( testname<T> t){
+                    t.mmtest( new testname<T>() {   // TestN$1$1.class 
+                        _As _Bs _Cs _Ds String mm_odata1 = "test";
+                        _As _Bs _Cs _Ds int    mm_pdata1 = 0;
+//8015257
+                        _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] mm_sa1 = null;
+                        _TAs _TBs _Cs _Ds T mm_tdata = null;
+
+                        _As _Bs _Cs _Ds String mm_m1(){ return null; };
+                        _As _Bs _Cs _Ds int    mm_m2(_As _Bs _Cs _Ds Object o){return 0;}
+
+                        _As _Bs _Cs _Ds String _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds []
+                        mm_m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; }
+
+                        _As _Bs _Cs _Ds
+                        <_TAs _TBs _Cs _Ds T> Object mm_tm(_As _Bs _Cs _Ds  T t) { return null; }
+                    });
+                }
+           });
+   }
+}
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD})  @Repeatable( AC.class ) @interface A { }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @Repeatable( BC.class ) @interface B { }
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD})  @interface AC { A[] value(); }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @interface BC { B[] value(); }
+
+@Retention(CLASS)   @Target({TYPE_USE,FIELD})  @Repeatable( CC.class ) @interface C { }
+@Retention(CLASS)   @Target({TYPE_USE,METHOD}) @Repeatable( DC.class ) @interface D { }
+@Retention(CLASS)   @Target({TYPE_USE,FIELD})  @interface CC { C[] value(); }
+@Retention(CLASS)   @Target({TYPE_USE,METHOD}) @interface DC { D[] value(); }
+
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD})  @Repeatable( TAC.class ) @interface TA { }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @Repeatable( TBC.class ) @interface TB { }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD})  @interface TAC { TA[] value(); }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @interface TBC { TB[] value(); }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java
index db14aef..c7b38cc 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java
@@ -3,13 +3,16 @@
  * @bug 8006775
  * @summary Import clauses cannot use annotations.
  * @author Werner Dietl
+ * @ignore
  * @compile/fail/ref=AnnotatedImport.out -XDrawDiagnostics AnnotatedImport.java
  */
 
+import java.lang.annotation.*;
 import java.@A util.List;
 import @A java.util.Map;
 import java.util.@A HashMap;
 
 class AnnotatedImport { }
 
+@Target(ElementType.TYPE_USE)
 @interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java
index 6b8b64a..4122fa1 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java
@@ -3,11 +3,15 @@
  * @bug 8006775
  * @summary Package declarations cannot use annotations.
  * @author Werner Dietl
+ * @ignore
  * @compile/fail/ref=AnnotatedPackage1.out -XDrawDiagnostics AnnotatedPackage1.java
  */
 
 package name.@A p1.p2;
 
+import java.lang.annotation.*;
+
 class AnnotatedPackage1 { }
 
+@Target(ElementType.TYPE_USE)
 @interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out
index 66ae60f..648af19 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out
@@ -1,3 +1,3 @@
 AnnotatedPackage1.java:9:14: compiler.err.expected: token.identifier
-AnnotatedPackage1.java:9:15: compiler.err.expected3: class, interface, enum
+AnnotatedPackage1.java:9:16: compiler.err.expected3: class, interface, enum
 2 errors
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.java
index 53eb5b1..493261e 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.java
@@ -8,6 +8,9 @@
 
 package @A p1.p2;
 
+import java.lang.annotation.*;
+
 class AnnotatedPackage2 { }
 
+@Target(ElementType.TYPE_USE)
 @interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java
index 9f80b2e..c9cc7d4 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java
@@ -3,11 +3,13 @@
  * @bug 6843077 8006775
  * @summary test that only Java 8 allows type annotations
  * @author Mahmood Ali
+ * @compile AnnotationVersion.java
  * @compile/fail/ref=AnnotationVersion.out -XDrawDiagnostics -Xlint:-options -source 1.6 AnnotationVersion.java
  * @compile/fail/ref=AnnotationVersion7.out -XDrawDiagnostics -Xlint:-options -source 1.7 AnnotationVersion.java
  */
-class AnnotationVersion {
-  public void method(@A AnnotationVersion this) { }
-}
+import java.lang.annotation.*;
 
+class myNumber<T extends @A Number> { }
+
+@Target(ElementType.TYPE_USE)
 @interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out
index d836ff3..25196ba 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out
@@ -1,2 +1,2 @@
-AnnotationVersion.java:10:43: compiler.err.type.annotations.not.supported.in.source: 1.6
+AnnotationVersion.java:12:27: compiler.err.type.annotations.not.supported.in.source: 1.6
 1 error
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out
index cb2fca3..b6687df 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out
@@ -1,2 +1,2 @@
-AnnotationVersion.java:10:43: compiler.err.type.annotations.not.supported.in.source: 1.7
+AnnotationVersion.java:12:27: compiler.err.type.annotations.not.supported.in.source: 1.7
 1 error
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java
index a24c323..c178fbc 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java
@@ -5,10 +5,13 @@
  * @author Werner Dietl
  * @compile/fail/ref=BadCast.out -XDrawDiagnostics BadCast.java
  */
+import java.lang.annotation.*;
+
 class BadCast {
   static void main() {
     Object o = (@A) "";
   }
 }
 
+@Target(ElementType.TYPE_USE)
 @interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.out
index f1b8bf0..7e3cc5e 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.out
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.out
@@ -1,2 +1,2 @@
-BadCast.java:10:19: compiler.err.illegal.start.of.type
-1 error
\ No newline at end of file
+BadCast.java:12:19: compiler.err.illegal.start.of.type
+1 error
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java
new file mode 100644
index 0000000..ece6662
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java
@@ -0,0 +1,27 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 1234567
+ * @summary The parts of a fully-qualified type can't be annotated.
+ * @author Werner Dietl
+ * @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java
+ */
+
+import java.lang.annotation.*;
+import java.util.List;
+
+class CantAnnotatePackages {
+    // Before a package component:
+    @TA java.lang.Object of1;
+
+    // These result in a different error.
+    // TODO: should this be unified?
+
+    List<@TA java.lang.Object> of2;
+    java. @TA lang.Object of3;
+    List<java. @TA lang.Object> of4;
+
+    // TODO: also note the order of error messages.
+}
+
+@Target(ElementType.TYPE_USE)
+@interface TA { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.out
new file mode 100644
index 0000000..574ceb6
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.out
@@ -0,0 +1,5 @@
+CantAnnotatePackages.java:19:14: compiler.err.cant.resolve.location: kindname.class, java, , , (compiler.misc.location: kindname.class, CantAnnotatePackages, null)
+CantAnnotatePackages.java:20:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotatePackages.java:21:14: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotatePackages.java:14:18: compiler.err.cant.type.annotate.scoping.1: @TA
+4 errors
\ No newline at end of file
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.java
new file mode 100644
index 0000000..f0ca413
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.java
@@ -0,0 +1,71 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006733 8006775
+ * @summary Ensure behavior for nested types is correct.
+ * @author Werner Dietl
+ * @compile/fail/ref=CantAnnotateScoping.out -XDrawDiagnostics CantAnnotateScoping.java
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE_USE})
+@interface TA {}
+@Target({ElementType.TYPE_USE})
+@interface TA2 {}
+
+@Target({ElementType.FIELD})
+@interface DA {}
+@Target({ElementType.FIELD})
+@interface DA2 {}
+
+@Target({ElementType.TYPE_USE, ElementType.FIELD})
+@interface DTA {}
+@Target({ElementType.TYPE_USE, ElementType.FIELD})
+@interface DTA2 {}
+
+class Test {
+    static class Outer {
+        static class SInner {}
+    }
+
+    // Legal
+    List<Outer. @TA SInner> li;
+
+    // Illegal
+    @TA Outer.SInner osi;
+    // Illegal
+    List<@TA Outer.SInner> aloi;
+    // Illegal
+    Object o1 = new @TA @DA @TA2 Outer.SInner();
+    // Illegal
+    Object o = new ArrayList<@TA @DA Outer.SInner>();
+
+    // Illegal: @TA is only a type-use annotation
+    @TA java.lang.Object f1;
+
+    // Legal: @DA is only a declaration annotation
+    @DA java.lang.Object f2;
+
+    // Legal: @DTA is both a type-use and declaration annotation
+    @DTA java.lang.Object f3;
+
+    // Illegal: @TA and @TA2 are only type-use annotations
+    @DTA @DA @TA @DA2 @TA2 java.lang.Object f4;
+
+    // Illegal: Do we want one or two messages?
+    // 1: @DA in invalid location
+    // 2: Not finding class "lang"
+    java. @DA lang.Object f5;
+
+    // Illegal: Do we want one or two messages?
+    // 1: @DA in invalid location
+    // 2: Not finding class "XXX"
+    java. @DA XXX.Object f6;
+
+    // Illegal: Can't find class "lang".
+    // Would a different error message be desirable?
+    java. @TA lang.Object f7;
+}
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.out
new file mode 100644
index 0000000..d2144ab
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.out
@@ -0,0 +1,11 @@
+CantAnnotateScoping.java:61:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotateScoping.java:66:9: compiler.err.cant.resolve.location: kindname.class, XXX, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotateScoping.java:70:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotateScoping.java:38:14: compiler.err.cant.type.annotate.scoping.1: @TA
+CantAnnotateScoping.java:47:18: compiler.err.cant.type.annotate.scoping.1: @TA
+CantAnnotateScoping.java:56:37: compiler.err.cant.type.annotate.scoping: @TA,@TA2
+CantAnnotateScoping.java:40:14: compiler.err.cant.type.annotate.scoping.1: @TA
+CantAnnotateScoping.java:42:34: compiler.err.cant.type.annotate.scoping: @TA,@DA,@TA2
+CantAnnotateScoping.java:44:38: compiler.err.cant.type.annotate.scoping: @TA,@DA
+CantAnnotateScoping.java:44:34: compiler.err.annotation.type.not.applicable
+10 errors
\ No newline at end of file
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java
index 70bc051..cf019b1 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java
@@ -1,41 +1,96 @@
 /*
  * @test /nodynamiccopyright/
  * @bug 8006733 8006775
- * @ignore 8013409: test failures for type annotations
- * @summary A static outer class cannot be annotated.
+ * @summary Ensure behavior for nested types is correct.
  * @author Werner Dietl
- * @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java
+ * @compile CantAnnotateStaticClass.java
  */
 
 import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.lang.annotation.*;
 
-class CantAnnotateStaticClass {
+class Top {
     @Target(ElementType.TYPE_USE)
-    @interface A {}
+    @interface TA {}
 
-    static class Outer {
-        class Inner {}
+    @Target(ElementType.TYPE_USE)
+    @interface TB {}
+
+    @Target(ElementType.TYPE_USE)
+    @interface TC {}
+
+    class Outer {
+        class Inner {
+            Object o1 = Top.this;
+            Object o2 = Outer.this;
+            Object o3 = this;
+        }
+        // Illegal
+        // static class SInner {}
+        // interface IInner {}
     }
 
-    // 8 errors:
-    @A Outer.Inner f1;
-    @A Outer.Inner f1r() { return null; }
-    void f1p(@A Outer.Inner p) { }
-    void f1c(Object o) {
-        Object l = (@A Outer.Inner) o;
+    // All combinations are OK
+
+    Top.@TB Outer f1;
+    @TB Outer.Inner f1a;
+    Outer. @TC Inner f1b;
+    @TB Outer. @TC Inner f1c;
+
+    @TA Top. @TB Outer f2;
+    @TA Top. @TB Outer.Inner f2a;
+    @TA Top. Outer. @TC Inner f2b;
+    @TA Top. @TB Outer. @TC Inner f2c;
+
+    @TB Outer f1r() { return null; }
+    @TB Outer.Inner f1ra() { return null; }
+    Outer. @TC Inner f1rb() { return null; }
+    @TB Outer. @TC Inner f1rc() { return null; }
+
+    void f1param(@TB Outer p,
+            @TB Outer.Inner p1,
+            Outer. @TC Inner p2,
+            @TB Outer. @TC Inner p3) { }
+
+    void f1cast(Object o) {
+        Object l;
+        l = (@TB Outer) o;
+        l = (@TB Outer.Inner) o;
+        l = (Outer. @TC Inner) o;
+        l = (@TB Outer. @TC Inner) o;
     }
 
-    List<@A Outer.Inner> f2;
-    List<@A Outer.Inner> f2r() { return null; }
-    void f2p(List<@A Outer.Inner> p) { }
-    void f2c(Object o) {
-        Object l = (List<@A Outer.Inner>) o;
-    }
+    List<@TB Outer> g1;
+    List<@TB Outer.Inner> g1a;
+    List<Outer. @TC Inner> g1b;
+    List<@TB Outer. @TC Inner> g1c;
 
-    // OK:
-    @A Outer g1;
-    List<@A Outer> g2;
-    Outer. @A Inner g3;
-    List<Outer. @A Inner> g4;
+    List<@TA Top. @TB Outer> g2;
+    List<@TA Top. @TB Outer.Inner> g2a;
+    List<@TA Top. Outer. @TC Inner> g2b;
+    List<@TA Top. @TB Outer. @TC Inner> g2c;
+
+    List<@TB Outer> g1r() { return null; }
+    List<@TB Outer.Inner> g1ra() { return null; }
+    List<Outer. @TC Inner> g1rb() { return null; }
+    List<@TB Outer. @TC Inner> g1rc() { return null; }
+
+    void g1param(List<@TB Outer> p,
+            List<@TB Outer.Inner> p1,
+            List<Outer. @TC Inner> p2,
+            List<@TB Outer. @TC Inner> p3) { }
+
+    void g1new(Object o) {
+        Object l;
+        l = new @TB ArrayList<@TB Outer>();
+        l = new @TB ArrayList<@TB Outer.Inner>();
+        l = new @TB HashMap<String, Outer. @TC Inner>();
+        l = new @TB HashMap<String, @TB Outer. Inner>();
+        l = new @TB HashMap<String, @TB Outer. @TC Inner>();
+        l = new @TB HashMap<String, @TA Top. Outer. @TC Inner>();
+        l = new @TB HashMap<String, @TA Top. @TB Outer. Inner>();
+        l = new @TB HashMap<String, @TA Top. @TB Outer. @TC Inner>();
+    }
 }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out
deleted file mode 100644
index 2995a4d..0000000
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out
+++ /dev/null
@@ -1 +0,0 @@
-dummy
\ No newline at end of file
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java
new file mode 100644
index 0000000..f53340f
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java
@@ -0,0 +1,207 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006733 8006775
+ * @summary Ensure behavior for nested types is correct.
+ * @author Werner Dietl
+ * @ignore
+ * @compile/fail/ref=CantAnnotateStaticClass2.out -XDrawDiagnostics CantAnnotateStaticClass2.java
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.lang.annotation.*;
+
+class Top {
+    @Target(ElementType.TYPE_USE)
+    @interface TA {}
+
+    @Target(ElementType.TYPE_USE)
+    @interface TB {}
+
+    @Target(ElementType.TYPE_USE)
+    @interface TC {}
+
+    static class Outer {
+        class Inner {
+            // Object o1 = Top.this;
+            Object o2 = Outer.this;
+            Object o3 = this;
+        }
+        static class SInner {
+            // Object o1 = Top.this;
+            // Object o2 = Outer.this;
+            Object o3 = this;
+        }
+        interface IInner {
+            // Object o1 = Top.this;
+            // Object o2 = Outer.this;
+            // Object o3 = this;
+        }
+    }
+
+    @TB Outer f1;
+    @TB Outer.Inner f1a;
+    @TB Outer.SInner f2a; // err
+    @TB Outer.IInner f3a; // err
+
+    Outer. @TC Inner f1b;
+    Outer. @TC SInner f2b;
+    Outer. @TC IInner f3b;
+
+    @TB Outer. @TC Inner f1c;
+    @TB Outer. @TC SInner f2c; // err
+    @TB Outer. @TC IInner f3c; // err
+
+    @TA Top. @TB Outer g1; // err
+    @TA Top. @TB Outer.Inner g1a; // err
+    @TA Top. @TB Outer.SInner g2a; // err
+    @TA Top. @TB Outer.IInner g3a; // err
+
+    @TA Top. Outer. @TC Inner g1b; // err
+    @TA Top. Outer. @TC SInner g2b; // err
+    @TA Top. Outer. @TC IInner g3b; // err
+
+    @TA Top. @TB Outer. @TC Inner g1c; // err
+    @TA Top. @TB Outer. @TC SInner g2c; // err
+    @TA Top. @TB Outer. @TC IInner g3c; // err
+
+    @TB Outer f1r() { return null; }
+
+    @TB Outer.Inner f1ra() { return null; }
+    @TB Outer.SInner f2ra() { return null; } // err
+    @TB Outer.IInner f3ra() { return null; } // err
+
+    Outer. @TC Inner f1rb() { return null; }
+    Outer. @TC SInner f2rb() { return null; }
+    Outer. @TC IInner f3rb() { return null; }
+
+    @TB Outer. @TC Inner f1rc() { return null; }
+    @TB Outer. @TC SInner f2rc() { return null; } // err
+    @TB Outer. @TC IInner f3rc() { return null; } // err
+
+    void f1param(@TB Outer p,
+            @TB Outer.Inner p1,
+            Outer. @TC Inner p2,
+            @TB Outer. @TC Inner p3) { }
+    void f2param(@TB Outer p,
+            @TB Outer.SInner p1, // err
+            Outer. @TC SInner p2,
+            @TB Outer. @TC SInner p3) { } // err
+    void f3param(@TB Outer p,
+            @TB Outer.IInner p1, // err
+            Outer. @TC IInner p2,
+            @TB Outer. @TC IInner p3) { } // err
+
+    void f1cast(Object o) {
+        Object l;
+        l = (@TB Outer) o;
+        l = (@TB Outer.Inner) o;
+        l = (Outer. @TC Inner) o;
+        l = (@TB Outer. @TC Inner) o;
+    }
+    void f2cast(Object o) {
+        Object l;
+        l = (@TB Outer) o;
+        l = (@TB Outer.SInner) o; // err
+        l = (Outer. @TC SInner) o;
+        l = (@TB Outer. @TC SInner) o; // err
+    }
+    void f3cast(Object o) {
+        Object l;
+        l = (@TB Outer) o;
+        l = (@TB Outer.IInner) o; // err
+        l = (Outer. @TC IInner) o;
+        l = (@TB Outer. @TC IInner) o; // err
+    }
+
+    List<@TB Outer> h1;
+
+    List<@TB Outer.Inner> h1a;
+    List<@TB Outer.SInner> h2a; // err
+    List<@TB Outer.IInner> h3a; // err
+
+    List<Outer. @TC Inner> h1b;
+    List<Outer. @TC SInner> h2b;
+    List<Outer. @TC IInner> h3b;
+
+    List<@TB Outer. @TC Inner> h1c;
+    List<@TB Outer. @TC SInner> h2c; // err
+    List<@TB Outer. @TC IInner> h3c; // err
+
+    List<@TA Top. @TB Outer> k1; // err
+
+    List<@TA Top. @TB Outer.Inner> k1a; // err
+    List<@TA Top. @TB Outer.SInner> k2a; // err
+    List<@TA Top. @TB Outer.IInner> k3a; // err
+
+    List<@TA Top. Outer. @TC Inner> k1b; // err
+    List<@TA Top. Outer. @TC SInner> k2b; // err
+    List<@TA Top. Outer. @TC IInner> k3b; // err
+
+    List<@TA Top. @TB Outer. @TC Inner> k1c; // err
+    List<@TA Top. @TB Outer. @TC SInner> k2c; // err
+    List<@TA Top. @TB Outer. @TC IInner> k3c; // err
+
+
+    List<@TB Outer> g1r() { return null; }
+
+    List<@TB Outer.Inner> g1ra() { return null; }
+    List<@TB Outer.SInner> g2ra() { return null; } // err
+    List<@TB Outer.IInner> g3ra() { return null; } // err
+
+    List<Outer. @TC Inner> g1rb() { return null; }
+    List<Outer. @TC SInner> g2rb() { return null; }
+    List<Outer. @TC IInner> g3rb() { return null; }
+
+    List<@TB Outer. @TC Inner> g1rc() { return null; }
+    List<@TB Outer. @TC SInner> g2rc() { return null; } // err
+    List<@TB Outer. @TC IInner> g3rc() { return null; } // err
+
+    void g1param(List<@TB Outer> p,
+            List<@TB Outer.Inner> p1,
+            List<Outer. @TC Inner> p2,
+            List<@TB Outer. @TC Inner> p3) { }
+    void g2param(List<@TB Outer> p,
+            List<@TB Outer.SInner> p1, // err
+            List<Outer. @TC SInner> p2,
+            List<@TB Outer. @TC SInner> p3) { } // err
+    void g3param(List<@TB Outer> p,
+            List<@TB Outer.IInner> p1, // err
+            List<Outer. @TC IInner> p2,
+            List<@TB Outer. @TC IInner> p3) { } // err
+
+    void g1new(Object o) {
+        Object l;
+        l = new @TB ArrayList<@TB Outer>();
+        l = new @TB ArrayList<@TB Outer.Inner>();
+        l = new @TB HashMap<String, Outer. @TC Inner>();
+        l = new @TB HashMap<String, @TB Outer. Inner>();
+        l = new @TB HashMap<String, @TB Outer. @TC Inner>();
+    }
+    void g2new(Object o) {
+        Object l;
+        l = new @TB ArrayList<@TB Outer>();
+        l = new @TB ArrayList<@TB Outer.SInner>(); // err
+        l = new @TB HashMap<String, Outer. @TC SInner>();
+        l = new @TB HashMap<String, @TB Outer. SInner>(); // err
+        l = new @TB HashMap<String, @TB Outer. @TC SInner>(); // err
+    }
+    void g3new(Object o) {
+        Object l;
+        l = new @TB ArrayList<@TB Outer>();
+        l = new @TB ArrayList<@TB Outer.IInner>(); // err
+        l = new @TB HashMap<String, Outer. @TC IInner>();
+        l = new @TB HashMap<String, @TB Outer. IInner>(); // err
+        l = new @TB HashMap<String, @TB Outer. @TC IInner>(); // err
+    }
+    void g4new(Object o) {
+        Object l;
+        l = new @TB ArrayList<@TA Top. @TB Outer>(); // err
+        l = new @TB ArrayList<@TA Top. @TB Outer.IInner>(); // err
+        l = new @TB HashMap<String, @TA Top. Outer. @TC IInner>(); // err
+        l = new @TB HashMap<String, @TA Top. @TB Outer. IInner>(); // err
+        l = new @TB HashMap<String, @TA Top. @TB Outer. @TC IInner>(); // err
+        l = new @TB HashMap<String, @TA @TB @TC Top. Outer. IInner>(); // err
+    }
+}
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.out
new file mode 100644
index 0000000..977dd69
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.out
@@ -0,0 +1,65 @@
+CantAnnotateStaticClass2.java:44:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:45:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:52:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:53:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:55:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:56:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:57:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:58:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:60:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:61:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:62:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:64:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:65:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:66:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:71:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:72:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:79:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:80:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:87:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:89:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:91:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:93:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:57:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:58:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:65:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:66:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:105:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:107:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:112:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:114:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:120:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:121:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:128:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:129:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:131:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:133:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:134:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:135:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:137:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:138:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:139:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:141:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:142:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:143:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:149:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:150:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:157:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:158:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:165:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:167:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:169:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:171:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:184:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:186:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:187:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:192:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:194:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:195:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:199:35: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:200:38: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:201:41: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:202:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:203:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:204:49: compiler.err.cant.type.annotate.scoping: @Top.TA,@Top.TB,@Top.TC
+64 errors
\ No newline at end of file
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.java
new file mode 100644
index 0000000..f9d123e
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.java
@@ -0,0 +1,207 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006733 8006775
+ * @summary Ensure behavior for nested types is correct.
+ * @author Werner Dietl
+ * @ignore
+ * @compile/fail/ref=CantAnnotateStaticClass3.out -XDrawDiagnostics CantAnnotateStaticClass3.java
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.lang.annotation.*;
+
+class Top {
+    @Target(ElementType.TYPE_USE)
+    @interface TA {}
+
+    @Target(ElementType.TYPE_USE)
+    @interface TB {}
+
+    @Target(ElementType.TYPE_USE)
+    @interface TC {}
+
+    interface Outer {
+        class Inner {
+            // Object o1 = Top.this;
+            // Object o2 = Outer.this;
+            Object o3 = this;
+        }
+        static class SInner {
+            // Object o1 = Top.this;
+            // Object o2 = Outer.this;
+            Object o3 = this;
+        }
+        interface IInner {
+            // Object o1 = Top.this;
+            // Object o2 = Outer.this;
+            // Object o3 = this;
+        }
+    }
+
+
+    @TB Outer f1;
+    @TB Outer.Inner f1a; // err
+    @TB Outer.SInner f2a; // err
+    @TB Outer.IInner f3a; // err
+
+    Outer. @TC Inner f1b;
+    Outer. @TC SInner f2b;
+    Outer. @TC IInner f3b;
+
+    @TB Outer. @TC Inner f1c; // err
+    @TB Outer. @TC SInner f2c; // err
+    @TB Outer. @TC IInner f3c; // err
+
+    @TA Top. @TB Outer g1; // err
+    @TA Top. @TB Outer.Inner g1a; // err
+    @TA Top. @TB Outer.SInner g2a; // err
+    @TA Top. @TB Outer.IInner g3a; // err
+
+    @TA Top. Outer. @TC Inner g1b; // err
+    @TA Top. Outer. @TC SInner g2b; // err
+    @TA Top. Outer. @TC IInner g3b; // err
+
+    @TA Top. @TB Outer. @TC Inner g1c; // err
+    @TA Top. @TB Outer. @TC SInner g2c; // err
+    @TA Top. @TB Outer. @TC IInner g3c; // err
+
+    @TB Outer f1r() { return null; }
+
+    @TB Outer.Inner f1ra() { return null; } // err
+    @TB Outer.SInner f2ra() { return null; } // err
+    @TB Outer.IInner f3ra() { return null; } // err
+
+    Outer. @TC Inner f1rb() { return null; }
+    Outer. @TC SInner f2rb() { return null; }
+    Outer. @TC IInner f3rb() { return null; }
+
+    @TB Outer. @TC Inner f1rc() { return null; } // err
+    @TB Outer. @TC SInner f2rc() { return null; } // err
+    @TB Outer. @TC IInner f3rc() { return null; } // err
+
+    void f1param(@TB Outer p,
+            @TB Outer.Inner p1, // err
+            Outer. @TC Inner p2,
+            @TB Outer. @TC Inner p3) { } // err
+    void f2param(@TB Outer p,
+            @TB Outer.SInner p1, // err
+            Outer. @TC SInner p2,
+            @TB Outer. @TC SInner p3) { } // err
+    void f3param(@TB Outer p,
+            @TB Outer.IInner p1, // err
+            Outer. @TC IInner p2,
+            @TB Outer. @TC IInner p3) { } // err
+
+    void f1cast(Object o) {
+        Object l;
+        l = (@TB Outer) o;
+        l = (@TB Outer.Inner) o; // err
+        l = (Outer. @TC Inner) o;
+        l = (@TB Outer. @TC Inner) o; // err
+    }
+    void f2cast(Object o) {
+        Object l;
+        l = (@TB Outer) o;
+        l = (@TB Outer.SInner) o; // err
+        l = (Outer. @TC SInner) o;
+        l = (@TB Outer. @TC SInner) o; // err
+    }
+    void f3cast(Object o) {
+        Object l;
+        l = (@TB Outer) o;
+        l = (@TB Outer.IInner) o; // err
+        l = (Outer. @TC IInner) o;
+        l = (@TB Outer. @TC IInner) o; // err
+    }
+
+    List<@TB Outer> h1;
+
+    List<@TB Outer.Inner> h1a; // err
+    List<@TB Outer.SInner> h2a; // err
+    List<@TB Outer.IInner> h3a; // err
+
+    List<Outer. @TC Inner> h1b;
+    List<Outer. @TC SInner> h2b;
+    List<Outer. @TC IInner> h3b;
+
+    List<@TB Outer. @TC Inner> h1c; // err
+    List<@TB Outer. @TC SInner> h2c; // err
+    List<@TB Outer. @TC IInner> h3c; // err
+
+    List<@TA Top. @TB Outer> k1; // err
+
+    List<@TA Top. @TB Outer.Inner> k1a; // err
+    List<@TA Top. @TB Outer.SInner> k2a; // err
+    List<@TA Top. @TB Outer.IInner> k3a; // err
+
+    List<@TA Top. Outer. @TC Inner> k1b; // err
+    List<@TA Top. Outer. @TC SInner> k2b; // err
+    List<@TA Top. Outer. @TC IInner> k3b; // err
+
+    List<@TA Top. @TB Outer. @TC Inner> k1c; // err
+    List<@TA Top. @TB Outer. @TC SInner> k2c; // err
+    List<@TA Top. @TB Outer. @TC IInner> k3c; // err
+
+
+    List<@TB Outer> g1r() { return null; }
+
+    List<@TB Outer.Inner> g1ra() { return null; } // err
+    List<@TB Outer.SInner> g2ra() { return null; } // err
+    List<@TB Outer.IInner> g3ra() { return null; } // err
+
+    List<Outer. @TC Inner> g1rb() { return null; }
+    List<Outer. @TC SInner> g2rb() { return null; }
+    List<Outer. @TC IInner> g3rb() { return null; }
+
+    List<@TB Outer. @TC Inner> g1rc() { return null; } // err
+    List<@TB Outer. @TC SInner> g2rc() { return null; } // err
+    List<@TB Outer. @TC IInner> g3rc() { return null; } // err
+
+    void g1param(List<@TB Outer> p,
+            List<@TB Outer.Inner> p1, // err
+            List<Outer. @TC Inner> p2,
+            List<@TB Outer. @TC Inner> p3) { } // err
+    void g2param(List<@TB Outer> p,
+            List<@TB Outer.SInner> p1, // err
+            List<Outer. @TC SInner> p2,
+            List<@TB Outer. @TC SInner> p3) { } // err
+    void g3param(List<@TB Outer> p,
+            List<@TB Outer.IInner> p1, // err
+            List<Outer. @TC IInner> p2,
+            List<@TB Outer. @TC IInner> p3) { } // err
+
+    void g1new(Object o) {
+        Object l;
+        l = new @TB ArrayList<@TB Outer>();
+        l = new @TB ArrayList<@TB Outer.Inner>(); // err
+        l = new @TB HashMap<String, Outer. @TC Inner>();
+        l = new @TB HashMap<String, @TB Outer. Inner>(); // err
+        l = new @TB HashMap<String, @TB Outer. @TC Inner>(); // err
+    }
+    void g2new(Object o) {
+        Object l;
+        l = new @TB ArrayList<@TB Outer>();
+        l = new @TB ArrayList<@TB Outer.SInner>(); // err
+        l = new @TB HashMap<String, Outer. @TC SInner>();
+        l = new @TB HashMap<String, @TB Outer. SInner>(); // err
+        l = new @TB HashMap<String, @TB Outer. @TC SInner>(); // err
+    }
+    void g3new(Object o) {
+        Object l;
+        l = new @TB ArrayList<@TB Outer>();
+        l = new @TB ArrayList<@TB Outer.IInner>(); // err
+        l = new @TB HashMap<String, Outer. @TC IInner>();
+        l = new @TB HashMap<String, @TB Outer. IInner>(); // err
+        l = new @TB HashMap<String, @TB Outer. @TC IInner>(); // err
+    }
+    void g4new(Object o) {
+        Object l;
+        l = new @TB ArrayList<@TA Top. @TB Outer>(); // err
+        l = new @TB ArrayList<@TA Top. @TB Outer.IInner>(); // err
+        l = new @TB HashMap<String, @TA Top. Outer. @TC IInner>(); // err
+        l = new @TB HashMap<String, @TA Top. @TB Outer. IInner>(); // err
+        l = new @TB HashMap<String, @TA Top. @TB Outer. @TC IInner>(); // err
+    }
+}
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.out
new file mode 100644
index 0000000..1d3cba0
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.out
@@ -0,0 +1,83 @@
+CantAnnotateStaticClass3.java:44:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:45:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:46:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:52:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:53:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:54:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:56:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:57:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:58:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:59:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:61:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:62:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:63:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:65:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:66:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:67:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:71:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:72:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:73:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:79:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:80:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:81:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:84:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:86:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:88:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:90:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:92:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:94:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:57:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:58:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:59:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:65:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:66:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:67:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:99:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:101:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:106:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:108:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:113:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:115:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:120:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:121:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:122:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:128:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:129:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:130:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:132:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:134:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:135:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:136:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:138:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:139:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:140:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:142:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:143:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:144:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:149:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:150:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:151:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:157:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:158:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:159:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:162:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:164:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:166:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:168:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:170:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:172:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:177:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:179:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:180:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:185:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:187:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:188:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:193:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:195:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:196:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:200:35: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:201:38: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:202:41: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:203:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:204:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+82 errors
\ No newline at end of file
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java
index c414a5f..9eaaffe 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java
@@ -5,8 +5,11 @@
  * @author Mahmood Ali
  * @compile/fail/ref=IncompleteArray.out -XDrawDiagnostics IncompleteArray.java
  */
+import java.lang.annotation.*;
+
 class IncompleteArray {
   int @A [] @A var;
 }
 
+@Target(ElementType.TYPE_USE)
 @interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.out
index a03a092..3223329 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.out
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.out
@@ -1,2 +1,2 @@
-IncompleteArray.java:9:13: compiler.err.illegal.start.of.type
+IncompleteArray.java:11:13: compiler.err.illegal.start.of.type
 1 error
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.java
deleted file mode 100644
index 1bb05a4..0000000
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.java
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 6843077 8006775
- * @summary test incomplete vararg declaration
- * @author Mahmood Ali
- * @compile/fail/ref=IncompleteVararg.out -XDrawDiagnostics IncompleteVararg.java
- */
-class IncompleteArray {
-  // the last variable may be vararg
-  void method(int @A test) { }
-}
-
-@interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.out
deleted file mode 100644
index 7cec6c9..0000000
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.out
+++ /dev/null
@@ -1,2 +0,0 @@
-IncompleteVararg.java:10:19: compiler.err.illegal.start.of.type
-1 error
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java
index 7098b93..691bf93 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java
@@ -5,9 +5,12 @@
  * @author Mahmood Ali
  * @compile/fail/ref=IndexArray.out -XDrawDiagnostics IndexArray.java
  */
+import java.lang.annotation.*;
+
 class IndexArray {
   int[] var;
   int a = var @A [1];
 }
 
+@Target(ElementType.TYPE_USE)
 @interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.out
index 762f38b..c0ae4f8 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.out
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.out
@@ -1,2 +1,2 @@
-IndexArray.java:10:15: compiler.err.illegal.start.of.expr
+IndexArray.java:12:15: compiler.err.illegal.start.of.expr
 1 error
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/LintCast.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/LintCast.out
index cb65dba..54f3bc3 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/LintCast.out
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/LintCast.out
@@ -1,11 +1,11 @@
 LintCast.java:15:21: compiler.warn.redundant.cast: java.lang.String
 LintCast.java:21:27: compiler.warn.redundant.cast: java.util.List<java.lang.String>
-LintCast.java:27:20: compiler.warn.redundant.cast: int @A []
+LintCast.java:27:20: compiler.warn.redundant.cast: int[]
 LintCast.java:39:24: compiler.warn.redundant.cast: java.lang.String
 LintCast.java:40:26: compiler.warn.redundant.cast: java.lang.String
-LintCast.java:45:23: compiler.warn.redundant.cast: java.lang.Object @A []
+LintCast.java:45:23: compiler.warn.redundant.cast: java.lang.Object[]
 LintCast.java:49:27: compiler.warn.redundant.cast: java.util.List<java.lang.String>
-LintCast.java:53:27: compiler.warn.redundant.cast: java.util.List<@A java.lang.String>
+LintCast.java:53:27: compiler.warn.redundant.cast: java.util.List<java.lang.String>
 LintCast.java:57:21: compiler.warn.redundant.cast: java.lang.Object
 LintCast.java:61:27: compiler.warn.redundant.cast: LintCast.Outer.Inner
 10 warnings
\ No newline at end of file
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java
index 4ed4e87..e226762 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java
@@ -1,35 +1,16 @@
 /*
- * Copyright (c) 2008, 2013, 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 /nodynamiccopyright/
  * @test
  * @bug 6843077 8006775
  * @summary test old array syntax
  * @author Mahmood Ali
- * @compile/fail -XDrawDiagnostics OldArray.java
+ * @compile/fail/ref=OldArray.out -XDrawDiagnostics OldArray.java
  */
+import java.lang.annotation.*;
+
 class OldArray {
   String [@A]  s() { return null; }
 }
 
+@Target(ElementType.TYPE_USE)
 @interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.out
new file mode 100644
index 0000000..6ae37b9
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.out
@@ -0,0 +1,10 @@
+OldArray.java:12:11: compiler.err.expected: ']'
+OldArray.java:12:13: compiler.err.expected: token.identifier
+OldArray.java:12:14: compiler.err.expected: ';'
+OldArray.java:12:17: compiler.err.illegal.start.of.type
+OldArray.java:12:18: compiler.err.expected: token.identifier
+OldArray.java:12:19: compiler.err.expected: ';'
+OldArray.java:12:22: compiler.err.illegal.start.of.type
+OldArray.java:12:28: compiler.err.expected: token.identifier
+OldArray.java:13:1: compiler.err.expected3: class, interface, enum
+9 errors
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java
index aab3c55..9257786 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java
@@ -1,17 +1,16 @@
 /*
  * @test /nodynamiccopyright/
  * @bug 6843077 8006775
- * @summary check that A is accessible in the class type parameters
+ * @summary Unqualified inner type annotation not in scope.
  * @author Mahmood Ali
  * @compile/fail/ref=Scopes.out -XDrawDiagnostics Scopes.java
  */
-class Scopes<T extends @UniqueInner Object> {
-  // UniqueInner is not visible in the type parameters.
-  // One has to use Scopes.UniqueInner.
-  // Annotations with the default @Target are not allowed there,
-  // so we also get the second error about the invalid location.
-  // Adding the target here doesn't matter, as we don't resolve
-  // the annotation type.
-  // @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
-  @interface UniqueInner { };
+import java.lang.annotation.*;
+
+@InnerTA
+class Scopes<@InnerTA T extends @InnerTA Object> {
+    // The simple name TA is not in scope on header of class.
+    // One has to use @Scopes.TA.
+    @Target(ElementType.TYPE_USE)
+    @interface InnerTA { };
 }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.out
index cf7eece..e4837b0 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.out
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.out
@@ -1,3 +1,4 @@
-Scopes.java:8:25: compiler.err.cant.resolve: kindname.class, UniqueInner, , 
-Scopes.java:8:24: compiler.err.annotation.type.not.applicable
-2 errors
+Scopes.java:10:2: compiler.err.cant.resolve: kindname.class, InnerTA, , 
+Scopes.java:11:34: compiler.err.cant.resolve: kindname.class, InnerTA, , 
+Scopes.java:11:15: compiler.err.cant.resolve: kindname.class, InnerTA, , 
+3 errors
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java
index f75583f..a76ea3a 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java
@@ -5,9 +5,23 @@
  * @author Mahmood Ali
  * @compile/fail/ref=StaticFields.out -XDrawDiagnostics StaticFields.java
  */
+import java.lang.annotation.*;
+
 class C {
-  int f;
+  static int f;
+  // static block
+  static {
+    @A C.f = 1;
+  }
+  // static ref
   int a = @A C.f;
+  // static method
+  static int f() { return @A C.f; }
+  // main
+  public static void main(String... args) {
+    int a = @A C.f;
+  }
 }
 
+@Target(ElementType.TYPE_USE)
 @interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.out
index 3364c66..bfe4f19 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.out
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.out
@@ -1,2 +1,5 @@
-StaticFields.java:10:17: compiler.err.illegal.start.of.expr
-1 error
+StaticFields.java:14:11: compiler.err.expected: token.identifier
+StaticFields.java:17:17: compiler.err.illegal.start.of.expr
+StaticFields.java:19:33: compiler.err.illegal.start.of.expr
+StaticFields.java:22:19: compiler.err.illegal.start.of.expr
+4 errors
\ No newline at end of file
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.java
deleted file mode 100644
index 55fdfa3..0000000
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 6843077 8006775
- * @summary static methods don't have receivers
- * @author Mahmood Ali
- * @compile/fail/ref=StaticMethods.out -XDrawDiagnostics StaticMethods.java
- */
-class StaticMethods {
-  static void main(StaticMethods this) { }
-}
-
-@interface A { }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.out
deleted file mode 100644
index 2e0923a..0000000
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.out
+++ /dev/null
@@ -1,2 +0,0 @@
-StaticMethods.java:9:34: compiler.err.non-static.cant.be.ref: kindname.variable, this
-1 error
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java
index 5485e53..3282114 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java
@@ -35,10 +35,12 @@
 
 class TypeVariableCycleTest<CTV> {
     <MTV extends  @TA CTV> MTV cast(CTV p) {
-        return (@TA MTV) p;
+        return (@TB MTV) p;
     }
 }
 
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@Target(ElementType.TYPE_USE)
 @interface TA {}
 
+@Target(ElementType.TYPE_USE)
+@interface TB {}
diff --git a/langtools/test/tools/javac/diags/examples/CantAnnotateStaticClass.java b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.java
similarity index 62%
rename from langtools/test/tools/javac/diags/examples/CantAnnotateStaticClass.java
rename to langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.java
index d3505bb..07aeb95 100644
--- a/langtools/test/tools/javac/diags/examples/CantAnnotateStaticClass.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,21 +21,19 @@
  * questions.
  */
 
-// key: compiler.err.cant.annotate.static.class
+/*
+ * @test
+ * @bug 1234567
+ * @summary A missing annotation type in a type variable bound
+ *     should result in the same errors with and without an
+ *     annotation processor.
+ * @author Werner Dietl
+ *
+ * @compile DummyProcessor.java
+ * @compile/fail/ref=TypeVariableMissingTA.out -XDrawDiagnostics TypeVariableMissingTA.java
+ * @compile/fail/ref=TypeVariableMissingTA.out -XDrawDiagnostics -cp . -processor DummyProcessor TypeVariableMissingTA.java
+ */
 
 import java.lang.annotation.*;
 
-class CantAnnotateStaticClass {
-    @Target(ElementType.TYPE_USE)
-    @interface A {}
-
-    static class Outer {
-        class Inner {}
-    }
-
-    // Error:
-    @A Outer.Inner f;
-
-    // OK:
-    @A Outer g;
-}
+class TypeVariableMissingTA<T extends @MISSING Object> {}
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.out b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.out
new file mode 100644
index 0000000..c48faf1
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.out
@@ -0,0 +1,2 @@
+TypeVariableMissingTA.java:39:40: compiler.err.cant.resolve: kindname.class, MISSING, , 
+1 error
\ No newline at end of file
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java
index 8a1545d..59b02d7 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @ignore 8008762 Type annotations failures
  * @bug 8006775
  * @summary new type annotation location: multicatch
  * @author Werner Dietl
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java
index 7c16a0d..aaa2faa 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @ignore 8008762 Type annotation failures
  * @bug 8006732 8006775
  * @summary Test population of reference info for multicatch exception parameters
  * @author Werner Dietl
diff --git a/langtools/test/tools/javac/defaultMethods/Assertions.java b/langtools/test/tools/javac/defaultMethods/Assertions.java
new file mode 100644
index 0000000..61882ba
--- /dev/null
+++ b/langtools/test/tools/javac/defaultMethods/Assertions.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2013, 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 test;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/*
+ * @test
+ * @bug 8025141
+ * @summary Interfaces must not contain non-public fields, ensure $assertionsDisabled
+ *          is not generated into an interface
+ * @compile Assertions.java
+ * @run main/othervm -da test.Assertions
+ * @run main/othervm -ea:test.Assertions test.Assertions Inner
+ * @run main/othervm -ea:test.Outer test.Assertions Outer
+ * @run main/othervm -ea:test.Another test.Assertions Another.Inner
+ * @run main/othervm -ea:test... test.Assertions Inner Outer Another.Inner
+ */
+
+public class Assertions {
+    interface Inner {
+        default void testInner() {
+            assert false;
+        }
+    }
+
+    static class InnerImpl implements Inner {}
+
+    static class OuterImpl implements Outer {}
+
+    static class AnotherInnerImpl implements Another.Inner {}
+
+    public static void main(String... args) {
+        Set<String> shouldThrowAssert = new HashSet<String>(Arrays.asList(args));
+        try {
+            new InnerImpl().testInner();
+            if (shouldThrowAssert.contains("Inner")) {
+                throw new IllegalStateException("AssertionError expected, but not thrown.");
+            }
+        } catch (AssertionError e) {
+            if (!shouldThrowAssert.contains("Inner")) {
+                throw new IllegalStateException("AssertionError not expected, but thrown.");
+            }
+        }
+        try {
+            new OuterImpl().testOuter();
+            if (shouldThrowAssert.contains("Outer")) {
+                throw new IllegalStateException("AssertionError expected, but not thrown.");
+            }
+        } catch (AssertionError e) {
+            if (!shouldThrowAssert.contains("Outer")) {
+                throw new IllegalStateException("AssertionError not expected, but thrown.");
+            }
+        }
+        try {
+            new AnotherInnerImpl().testAnotherInner();
+            if (shouldThrowAssert.contains("Another.Inner")) {
+                throw new IllegalStateException("AssertionError expected, but not thrown.");
+            }
+        } catch (AssertionError e) {
+            if (!shouldThrowAssert.contains("Another.Inner")) {
+                throw new IllegalStateException("AssertionError not expected, but thrown.");
+            }
+        }
+    }
+}
+
+interface Outer {
+    default void testOuter() {
+        assert false;
+    }
+}
+
+@interface Another {
+    interface Inner {
+        default void testAnotherInner() {
+            assert false;
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/defaultMethods/BadClassfile.java b/langtools/test/tools/javac/defaultMethods/BadClassfile.java
new file mode 100644
index 0000000..424d3ac
--- /dev/null
+++ b/langtools/test/tools/javac/defaultMethods/BadClassfile.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2013, 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 8025087
+ * @summary Verify that pre-JDK8 classfiles with default and/or static methods
+ *          are refused correctly.
+ * @build BadClassfile
+ * @run main BadClassfile
+ */
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.jvm.ClassReader.BadClassFile;
+import com.sun.tools.javac.jvm.Target;
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.JCDiagnostic;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+public class BadClassfile {
+    public static void main(String... args) throws Exception {
+        test("BadClassfile$DefaultMethodTest", "compiler.misc.invalid.default.interface");
+        test("BadClassfile$StaticMethodTest", "compiler.misc.invalid.static.interface");
+    }
+
+    private static void test(String classname, String expected) throws Exception {
+        File classfile = new File(System.getProperty("test.classes", "."), classname + ".class");
+        ClassFile cf = ClassFile.read(classfile);
+
+        cf = new ClassFile(cf.magic, Target.JDK1_7.minorVersion,
+                 Target.JDK1_7.majorVersion, cf.constant_pool, cf.access_flags,
+                cf.this_class, cf.super_class, cf.interfaces, cf.fields,
+                cf.methods, cf.attributes);
+
+        new ClassWriter().write(cf, classfile);
+
+        JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+        JavacTaskImpl task = (JavacTaskImpl) c.getTask(null, null, null, Arrays.asList("-classpath", System.getProperty("test.classes", ".")), null, null);
+
+        try {
+            Symbol clazz = com.sun.tools.javac.main.JavaCompiler.instance(task.getContext()).resolveIdent(classname);
+
+            clazz.complete();
+        } catch (BadClassFile f) {
+            JCDiagnostic embeddedDiag = (JCDiagnostic) f.diag.getArgs()[1];
+            assertEquals(expected, embeddedDiag.getCode());
+            assertEquals(Integer.toString(Target.JDK1_7.majorVersion), embeddedDiag.getArgs()[0]);
+            assertEquals(Integer.toString(Target.JDK1_7.minorVersion), embeddedDiag.getArgs()[1]);
+        }
+    }
+
+    private static void assertEquals(Object expected, Object actual) {
+        Assert.check(Objects.equals(expected, actual),
+                     "expected: " + expected + ", but was: " + actual);
+    }
+
+    interface DefaultMethodTest {
+        default void test() { }
+    }
+    interface StaticMethodTest {
+        static void test() { }
+    }
+}
diff --git a/langtools/test/tools/javac/defaultMethods/CannotChangeAssertionsStateAfterInitialized.java b/langtools/test/tools/javac/defaultMethods/CannotChangeAssertionsStateAfterInitialized.java
new file mode 100644
index 0000000..b6dbdb9
--- /dev/null
+++ b/langtools/test/tools/javac/defaultMethods/CannotChangeAssertionsStateAfterInitialized.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, 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 8025141
+ * @summary Ensure the assertion status cannot be changed once the class is initialized
+ * @compile CannotChangeAssertionsStateAfterInitialized.java
+ * @run main/othervm -da CannotChangeAssertionsStateAfterInitialized
+ */
+
+public interface CannotChangeAssertionsStateAfterInitialized {
+    default void m() {
+        assert false;
+    }
+
+    public static void main(String[] args) {
+        ClassLoader cl = CannotChangeAssertionsStateAfterInitialized.class.getClassLoader();
+        cl.setClassAssertionStatus(CannotChangeAssertionsStateAfterInitialized.class.getName(), true);
+        new CannotChangeAssertionsStateAfterInitialized() {}.m();
+    }
+
+}
diff --git a/langtools/test/tools/javac/diags/examples.not-yet.txt b/langtools/test/tools/javac/diags/examples.not-yet.txt
index 2e442f3..2676b71 100644
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt
@@ -40,7 +40,6 @@
 compiler.err.type.var.more.than.once.in.result          # UNUSED
 compiler.err.unexpected.type
 compiler.err.unsupported.cross.fp.lit                   # Scanner: host system dependent
-compiler.misc.bad.class.file.header                     # bad class file
 compiler.misc.bad.class.signature                       # bad class file
 compiler.misc.bad.const.pool.tag                        # bad class file
 compiler.misc.bad.const.pool.tag.at                     # bad class file
diff --git a/langtools/test/tools/javac/diags/examples/CantAnnotateNestedType.java b/langtools/test/tools/javac/diags/examples/CantAnnotateScoping.java
similarity index 85%
copy from langtools/test/tools/javac/diags/examples/CantAnnotateNestedType.java
copy to langtools/test/tools/javac/diags/examples/CantAnnotateScoping.java
index 30d4572..b7de10bc 100644
--- a/langtools/test/tools/javac/diags/examples/CantAnnotateNestedType.java
+++ b/langtools/test/tools/javac/diags/examples/CantAnnotateScoping.java
@@ -21,21 +21,23 @@
  * questions.
  */
 
-// key: compiler.err.cant.annotate.nested.type
+// key: compiler.err.cant.type.annotate.scoping
 
 import java.lang.annotation.*;
 
-class CantAnnotateStaticClass {
+class CantAnnotateScoping {
     @Target(ElementType.TYPE_USE)
-    @interface A {}
+    @interface TA {}
+    @Target(ElementType.TYPE_USE)
+    @interface TB {}
 
     interface Outer {
         interface Inner {}
     }
 
     // Error:
-    @A Outer.Inner f;
+    @TA @TB Outer.Inner f;
 
     // OK:
-    @A Outer g;
+    @TA @TB Outer g;
 }
diff --git a/langtools/test/tools/javac/diags/examples/CantAnnotateNestedType.java b/langtools/test/tools/javac/diags/examples/CantAnnotateScoping1.java
similarity index 89%
rename from langtools/test/tools/javac/diags/examples/CantAnnotateNestedType.java
rename to langtools/test/tools/javac/diags/examples/CantAnnotateScoping1.java
index 30d4572..72b1c07 100644
--- a/langtools/test/tools/javac/diags/examples/CantAnnotateNestedType.java
+++ b/langtools/test/tools/javac/diags/examples/CantAnnotateScoping1.java
@@ -21,21 +21,21 @@
  * questions.
  */
 
-// key: compiler.err.cant.annotate.nested.type
+// key: compiler.err.cant.type.annotate.scoping.1
 
 import java.lang.annotation.*;
 
-class CantAnnotateStaticClass {
+class CantAnnotateNestedType {
     @Target(ElementType.TYPE_USE)
-    @interface A {}
+    @interface TA {}
 
     interface Outer {
         interface Inner {}
     }
 
     // Error:
-    @A Outer.Inner f;
+    @TA Outer.Inner f;
 
     // OK:
-    @A Outer g;
+    @TA Outer g;
 }
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/diags/examples/InterfaceOrArrayExpected.java
similarity index 79%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/javac/diags/examples/InterfaceOrArrayExpected.java
index 1301f4e..4c57562 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/diags/examples/InterfaceOrArrayExpected.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,8 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+// key: compiler.err.intf.or.array.expected.here
 
-@interface Anno { }
+import java.util.List;
 
-@Anno
-@Anno
-class DuplicateAnnotation { }
+class InterfaceExpected<T extends List & String> { }
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java
similarity index 67%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java
index 1301f4e..a8b1d44 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,13 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+// key: compiler.misc.invalid.default.interface
+// key: compiler.misc.bad.class.file.header
+// key: compiler.err.cant.access
+// options: -processor CreateBadClassFile
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+/* The annotation processor will create an invalid classfile with version 51.0
+ * and a non-abstract method in an interface. Loading the classfile will produce
+ * the diagnostic.
+ */
+class InvalidDefaultInterface { }
diff --git a/langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/processors/CreateBadClassFile.java b/langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/processors/CreateBadClassFile.java
new file mode 100644
index 0000000..1f37bfa
--- /dev/null
+++ b/langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/processors/CreateBadClassFile.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info;
+import com.sun.tools.classfile.ConstantPool.CPInfo;
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+/* Create an invalid classfile with version 51.0 and a non-abstract method in an interface.*/
+@SupportedAnnotationTypes("*")
+public class CreateBadClassFile extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (++round == 1) {
+            ConstantPool cp = new ConstantPool(new CPInfo[] {
+                new CONSTANT_Utf8_info(""),                     //0
+                new CONSTANT_Utf8_info("Test"),                 //1
+                new CONSTANT_Class_info(null, 1),               //2
+                new CONSTANT_Utf8_info("java/lang/Object"),     //3
+                new CONSTANT_Class_info(null, 3),               //4
+                new CONSTANT_Utf8_info("test"),                 //5
+                new CONSTANT_Utf8_info("()V"),                  //6
+            });
+            ClassFile cf = new ClassFile(0xCAFEBABE,
+                          0,
+                          51,
+                          cp,
+                          new AccessFlags(AccessFlags.ACC_ABSTRACT |
+                                          AccessFlags.ACC_INTERFACE |
+                                          AccessFlags.ACC_PUBLIC),
+                          2,
+                          4,
+                          new int[0],
+                          new Field[0],
+                          new Method[] {
+                              //creating non-abstract method in 51.0 classfile:
+                              new Method(new AccessFlags(AccessFlags.ACC_PUBLIC),
+                                         5,
+                                         new Descriptor(6),
+                                         new Attributes(cp, new Attribute[0]))
+                          },
+                          new Attributes(cp, new Attribute[0]));
+            try {
+                JavaFileObject clazz = processingEnv.getFiler().createClassFile("Test");
+                try (OutputStream out = clazz.openOutputStream()) {
+                    new ClassWriter().write(cf, out);
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return false;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round = 0;
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java
similarity index 68%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java
index 1301f4e..3d5ff00 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,13 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+// key: compiler.misc.invalid.static.interface
+// key: compiler.misc.bad.class.file.header
+// key: compiler.err.cant.access
+// options: -processor CreateBadClassFile
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+/* The annotation processor will create an invalid classfile with version 51.0
+ * and a static method in an interface. Loading the classfile will produce
+ * the diagnostic.
+ */
+class InvalidDefaultInterface { }
diff --git a/langtools/test/tools/javac/diags/examples/InvalidStaticInterface/processors/CreateBadClassFile.java b/langtools/test/tools/javac/diags/examples/InvalidStaticInterface/processors/CreateBadClassFile.java
new file mode 100644
index 0000000..acd362c
--- /dev/null
+++ b/langtools/test/tools/javac/diags/examples/InvalidStaticInterface/processors/CreateBadClassFile.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info;
+import com.sun.tools.classfile.ConstantPool.CPInfo;
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+/* Create an invalid classfile with version 51.0 and a static method in an interface.*/
+@SupportedAnnotationTypes("*")
+public class CreateBadClassFile extends AbstractProcessor {
+    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+        if (++round == 1) {
+            ConstantPool cp = new ConstantPool(new CPInfo[] {
+                new CONSTANT_Utf8_info(""),                     //0
+                new CONSTANT_Utf8_info("Test"),                 //1
+                new CONSTANT_Class_info(null, 1),               //2
+                new CONSTANT_Utf8_info("java/lang/Object"),     //3
+                new CONSTANT_Class_info(null, 3),               //4
+                new CONSTANT_Utf8_info("test"),                 //5
+                new CONSTANT_Utf8_info("()V"),                  //6
+            });
+            ClassFile cf = new ClassFile(0xCAFEBABE,
+                          0,
+                          51,
+                          cp,
+                          new AccessFlags(AccessFlags.ACC_ABSTRACT |
+                                          AccessFlags.ACC_INTERFACE |
+                                          AccessFlags.ACC_PUBLIC),
+                          2,
+                          4,
+                          new int[0],
+                          new Field[0],
+                          new Method[] {
+                              //creating static method in 51.0 classfile:
+                              new Method(new AccessFlags(AccessFlags.ACC_PUBLIC |
+                                                         AccessFlags.ACC_STATIC),
+                                         5,
+                                         new Descriptor(6),
+                                         new Attributes(cp, new Attribute[0]))
+                          },
+                          new Attributes(cp, new Attribute[0]));
+            try {
+                JavaFileObject clazz = processingEnv.getFiler().createClassFile("Test");
+                try (OutputStream out = clazz.openOutputStream()) {
+                    new ClassWriter().write(cf, out);
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return false;
+    }
+
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    int round = 0;
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/diags/examples/RepeatableAnnotationsNotSupported.java
similarity index 90%
rename from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
rename to langtools/test/tools/javac/diags/examples/RepeatableAnnotationsNotSupported.java
index 1301f4e..2d84ed0 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/diags/examples/RepeatableAnnotationsNotSupported.java
@@ -21,7 +21,7 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
+// key: compiler.err.repeatable.annotations.not.supported.in.source
 // key: compiler.warn.source.no.bootclasspath
 // options: -source 7
 
@@ -29,4 +29,4 @@
 
 @Anno
 @Anno
-class DuplicateAnnotation { }
+class RepeatableAnnotationsNotSupported { }
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/lambda/8012557/A.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/javac/lambda/8012557/A.java
index 1301f4e..4dd16a8 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/lambda/8012557/A.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,10 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
-
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+interface A {
+   default String u() { return "A"; }
+   default String name() {
+      SAM s = ()->u()+"A";
+      return s.m();
+   }
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/lambda/8012557/B.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/javac/lambda/8012557/B.java
index 1301f4e..b195af1 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/lambda/8012557/B.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,10 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
-
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+interface B {
+   default String u() { return "B"; }
+   default String name() {
+      SAM s = ()->u()+"B";
+      return s.m();
+   }
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/lambda/8012557/C.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/javac/lambda/8012557/C.java
index 1301f4e..a6839e9 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/lambda/8012557/C.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,10 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
-
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+interface C {
+   default String u() { return "C"; }
+   default String name() {
+      SAM s = ()->u()+"C";
+      return s.m();
+   }
+}
diff --git a/langtools/test/tools/javac/lambda/8012557/PrivateLambdas.java b/langtools/test/tools/javac/lambda/8012557/PrivateLambdas.java
new file mode 100644
index 0000000..d77dda6
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/8012557/PrivateLambdas.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2013, 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 8012557
+ * @summary Check that 8012557 is fixed, that interface lambda
+ *          methods are private
+ * @author  Robert Field
+ * @compile SAM.java
+ * @compile A.java
+ * @compile B.java
+ * @compile C.java
+ * @run main PrivateLambdas
+ *
+ * Unless the lambda methods are private, this will fail with:
+ *  AbstractMethodError:
+ *        Conflicting default methods: A.lambda$0 B.lambda$0 C.lambda$0
+ */
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+interface X extends A, B, C {
+   default String u() { return " "; }
+   default String name() {
+      return A.super.name() + B.super.name() + C.super.name();
+   }
+}
+
+public class PrivateLambdas implements X {
+   public static void main(String[] args) throws Exception {
+
+      // Check that all the lambda methods are private instance synthetic
+      for (Class<?> k : new Class<?>[] { A.class, B.class, C.class }) {
+         Method[] methods = k.getDeclaredMethods();
+         int lambdaCount = 0;
+         for(Method m : methods) {
+            if (m.getName().startsWith("lambda$")) {
+               ++lambdaCount;
+               int mod = m.getModifiers();
+               if ((mod & Modifier.PRIVATE) == 0) {
+                  throw new Exception("Expected " + m + " to be private");
+               }
+               if (!m.isSynthetic()) {
+                  throw new Exception("Expected " + m + " to be synthetic");
+               }
+               if ((mod & Modifier.STATIC) != 0) {
+                  throw new Exception("Expected " + m + " to be instance method");
+               }
+            }
+         }
+         if (lambdaCount == 0) {
+            throw new Exception("Expected at least one lambda method");
+         }
+      }
+
+      /*
+       * Unless the lambda methods are private, this will fail with:
+       *  AbstractMethodError:
+       *        Conflicting default methods: A.lambda$0 B.lambda$0 C.lambda$0
+       */
+      X x = new PrivateLambdas();
+      if (!x.name().equals(" A B C")) {
+         throw new Exception("Expected ' A B C' got: " + x.name());
+      }
+   }
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/lambda/8012557/SAM.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/javac/lambda/8012557/SAM.java
index 1301f4e..25bbae9 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/lambda/8012557/SAM.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,6 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
-
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+interface SAM {
+   String m();
+}
diff --git a/langtools/test/tools/javac/lambda/8016320/IllegalBridgeModifier.java b/langtools/test/tools/javac/lambda/8016320/IllegalBridgeModifier.java
new file mode 100644
index 0000000..3578bbc
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/8016320/IllegalBridgeModifier.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013, 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 8016320
+ * @summary Check that 8016320 is fixed,
+ *          that bridges have valid modifier bits
+ * @author  Robert Field
+ * @run main IllegalBridgeModifier
+ */
+
+interface SAM {
+    int m();
+}
+
+interface SuperI {
+    public default int foo() { return 1234; }
+}
+
+interface I extends SuperI {
+}
+
+interface T extends I {
+    public default SAM boo() { return I.super::foo; }
+}
+
+public class IllegalBridgeModifier {
+    public static void main(String argv[])throws Exception {
+        T t = new T(){};
+        if (t.boo().m() != 1234) {
+            throw new Exception("Failed test");
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.java b/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.java
new file mode 100644
index 0000000..9c878b8
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2013, 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 8024947
+ * @summary javac should issue the potentially ambiguous overload warning only
+ * where the problem appears
+ * @compile/fail/ref=PotentiallyAmbiguousWarningTest.out -XDrawDiagnostics -Werror -Xlint:overloads PotentiallyAmbiguousWarningTest.java
+ * @compile PotentiallyAmbiguousWarningTest.java
+ */
+
+import java.util.function.*;
+
+public interface PotentiallyAmbiguousWarningTest {
+
+    //a warning should be fired
+    interface I1 {
+        void foo(Consumer<Integer> c);
+        void foo(IntConsumer c);
+    }
+
+    //a warning should be fired
+    class C1 {
+        void foo(Consumer<Integer> c) { }
+        void foo(IntConsumer c) { }
+    }
+
+    interface I2 {
+        void foo(Consumer<Integer> c);
+    }
+
+    //a warning should be fired, J1 is provoking the issue
+    interface J1 extends I2 {
+        void foo(IntConsumer c);
+    }
+
+    //no warning here, the issue is introduced in I1
+    interface I3 extends I1 {}
+
+    //no warning here, the issue is introduced in I1. I4 is just overriding an existing method
+    interface I4 extends I1 {
+        void foo(IntConsumer c);
+    }
+
+    class C2 {
+        void foo(Consumer<Integer> c) { }
+    }
+
+    //a warning should be fired, D1 is provoking the issue
+    class D1 extends C2 {
+        void foo(IntConsumer c) { }
+    }
+
+    //a warning should be fired, C3 is provoking the issue
+    class C3 implements I2 {
+        public void foo(Consumer<Integer> c) { }
+        public void foo(IntConsumer c) { }
+    }
+
+    //no warning here, the issue is introduced in C1
+    class C4 extends C1 {}
+
+    //no warning here, the issue is introduced in C1. C5 is just overriding an existing method
+    class C5 extends C1 {
+        void foo(IntConsumer c) {}
+    }
+
+    interface I5<T> {
+        void foo(T c);
+    }
+
+    //a warning should be fired, J2 is provoking the issue
+    interface J2 extends I5<IntConsumer> {
+        void foo(Consumer<Integer> c);
+    }
+}
diff --git a/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.out b/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.out
new file mode 100644
index 0000000..6011a88
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.out
@@ -0,0 +1,9 @@
+PotentiallyAmbiguousWarningTest.java:39:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.I1, foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.I1
+PotentiallyAmbiguousWarningTest.java:45:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C1, foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.C1
+PotentiallyAmbiguousWarningTest.java:55:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.J1, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.I2
+PotentiallyAmbiguousWarningTest.java:72:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.D1, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C2
+PotentiallyAmbiguousWarningTest.java:78:21: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.C3, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C3
+PotentiallyAmbiguousWarningTest.java:95:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.J2, foo(T), PotentiallyAmbiguousWarningTest.I5
+- compiler.err.warnings.and.werror
+1 error
+6 warnings
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/lambda/T8025816/CrashMethodReferenceWithSiteTypeVarTest.java
similarity index 65%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/javac/lambda/T8025816/CrashMethodReferenceWithSiteTypeVarTest.java
index 1301f4e..ba43479 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/lambda/T8025816/CrashMethodReferenceWithSiteTypeVarTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,20 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+/*
+ * @test
+ * @bug 8025816
+ * @summary Compiler crash when default method call with method reference
+ * @compile CrashMethodReferenceWithSiteTypeVarTest.java
+ */
 
-@interface Anno { }
+import java.util.Collection;
+import java.util.Comparator;
 
-@Anno
-@Anno
-class DuplicateAnnotation { }
+public class CrashMethodReferenceWithSiteTypeVarTest {
+    public <T> void m1(Collection<T> c, Comparator<T> comp) {}
+
+    public <T extends Comparable> void m2(Collection<T> c) {
+        m1(c, T::compareTo);
+    }
+}
diff --git a/langtools/test/tools/javac/lib/DPrinter.java b/langtools/test/tools/javac/lib/DPrinter.java
index 8e67826..72d4fd8 100644
--- a/langtools/test/tools/javac/lib/DPrinter.java
+++ b/langtools/test/tools/javac/lib/DPrinter.java
@@ -946,8 +946,8 @@
      */
     public class TypeVisitor implements Type.Visitor<Void,Void> {
         public Void visitAnnotatedType(AnnotatedType type, Void ignore) {
-            printList("typeAnnotations", type.typeAnnotations);
-            printType("underlyingType", type.underlyingType, Details.FULL);
+            printList("typeAnnotations", type.getAnnotationMirrors());
+            printType("underlyingType", type.unannotatedType(), Details.FULL);
             return visitType(type, null);
         }
 
diff --git a/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Processor.java b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Processor.java
new file mode 100644
index 0000000..a6e87ba
--- /dev/null
+++ b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Processor.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.annotation.*;
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.ElementFilter;
+import javax.tools.*;
+import com.sun.tools.javac.util.Assert;
+
+public class Processor extends JavacTestingAbstractProcessor {
+
+    private boolean seenGenerated;
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        for (Element e : roundEnv.getElementsAnnotatedWith(Gen.class)) {
+            Gen gen = e.getAnnotation(Gen.class);
+            try {
+                JavaFileObject source = processingEnv.getFiler().createSourceFile(gen.fileName());
+
+                try (Writer out = source.openWriter()) {
+                    out.write(gen.content());
+                }
+            } catch (IOException ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
+
+        TypeElement generated = processingEnv.getElementUtils().getTypeElement("Generated");
+
+        if (generated != null) {
+            Check check = ElementFilter.methodsIn(generated.getEnclosedElements()).get(0).getAnnotation(Check.class);
+
+            checkCorrectException(check::classValue, "java.lang.Class<java.lang.String>");
+            checkCorrectException(check::intConstValue, "boolean");
+            checkCorrectException(check::enumValue, "java.lang.String");
+            checkCorrectException(check::incorrectAnnotationValue, "java.lang.Deprecated");
+            checkCorrectException(check::incorrectArrayValue, "<any>");
+            checkCorrectException(check::incorrectClassValue, "<any>");
+
+            seenGenerated = true;
+        }
+
+        if (roundEnv.processingOver() && !seenGenerated) {
+            Assert.error("Did not see the generated class!");
+        }
+
+        return true;
+    }
+
+    private static void checkCorrectException(Runnable runCheck, String expectedType) {
+        try {
+            runCheck.run();
+            Assert.check(false); //Should not reach here
+        } catch (AnnotationTypeMismatchException ex) {
+            Assert.check(expectedType.equals(ex.foundType()), ex.foundType());
+        }
+    }
+
+}
+
+@interface Gen {
+    String fileName();
+    String content();
+}
+
+@interface Check {
+    Class<? extends Number> classValue();
+    int intConstValue();
+    E enumValue();
+    int incorrectAnnotationValue();
+    int incorrectArrayValue();
+    Class<?> incorrectClassValue();
+}
+
+enum E {
+    A;
+}
diff --git a/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.java b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.java
new file mode 100644
index 0000000..faa6721
--- /dev/null
+++ b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.java
@@ -0,0 +1,25 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6278240
+ * @summary Ensure AnnotationTypeMismatchException is thrown when appropriate
+ *          with reasonable foundType filled.
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor Processor
+ * @compile/fail/ref=Source.out -XDrawDiagnostics -processor Processor Source.java
+ */
+
+@Gen(fileName="Generated",
+     content=
+"class Generated {\n" +
+"    @Check(classValue=String.class,\n" +
+"           intConstValue=false,\n" +
+"           enumValue=\"a\",\n" +
+"           incorrectAnnotationValue=@Deprecated,\n" +
+"           incorrectArrayValue={1, \"a\"},\n" +
+"           incorrectClassValue=get())\n" +
+"    public static Class<?> get() {\n" +
+"        return null;\n" +
+"    }\n" +
+"}\n")
+class Source {
+}
diff --git a/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.out b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.out
new file mode 100644
index 0000000..4440550
--- /dev/null
+++ b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.out
@@ -0,0 +1,7 @@
+Generated.java:2:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Class<java.lang.String>, java.lang.Class<? extends java.lang.Number>)
+Generated.java:3:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: boolean, int)
+Generated.java:4:22: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, E)
+Generated.java:5:37: compiler.err.annotation.not.valid.for.type: int
+Generated.java:6:32: compiler.err.annotation.value.not.allowable.type
+Generated.java:7:35: compiler.err.annotation.value.must.be.class.literal
+6 errors
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/GenerateFunctionalInterface.java
similarity index 61%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/GenerateFunctionalInterface.java
index 1301f4e..c88be30 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/GenerateFunctionalInterface.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,18 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+/*
+ * @test
+ * @bug 8014016
+ * @summary Ensure that an annotation processor can generate a super-interface
+ *          which will make the current interface functional
+ * @build GenerateSuperInterfaceProcessor
+ * @compile -processor GenerateSuperInterfaceProcessor GenerateFunctionalInterface.java
+ */
 
-@interface Anno { }
+import java.lang.FunctionalInterface;
 
-@Anno
-@Anno
-class DuplicateAnnotation { }
+@FunctionalInterface
+@Generate(fileName="SuperInterface.java", content="interface SuperInterface { public void run(); }")
+interface GenerateFunctionalInterface extends SuperInterface {
+}
diff --git a/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/GenerateSuperInterfaceProcessor.java b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/GenerateSuperInterfaceProcessor.java
new file mode 100644
index 0000000..994c844
--- /dev/null
+++ b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/GenerateSuperInterfaceProcessor.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import com.sun.tools.javac.util.Assert;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("*")
+public class GenerateSuperInterfaceProcessor extends AbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        for (Element el : roundEnv.getElementsAnnotatedWith(Generate.class)) {
+            Generate g = el.getAnnotation(Generate.class);
+
+            Assert.checkNonNull(g);
+
+            try (OutputStream out =
+                    processingEnv.getFiler().createSourceFile(g.fileName()).openOutputStream()) {
+                out.write(g.content().getBytes());
+            } catch (IOException ex) {
+                throw new IllegalStateException(ex);
+            }
+        }
+
+        return false;
+    }
+
+}
+
+@interface Generate {
+    String fileName();
+    String content();
+}
\ No newline at end of file
diff --git a/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Processor.java b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Processor.java
new file mode 100644
index 0000000..be90d98
--- /dev/null
+++ b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Processor.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import com.sun.source.tree.AnnotationTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreeScanner;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.Assert;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.FileObject;
+import javax.tools.ForwardingJavaFileManager;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
+@SupportedAnnotationTypes("*")
+public class Processor extends AbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        throw new IllegalStateException("Should not be invoked.");
+    }
+
+    public static void main(String... args) throws IOException, URISyntaxException {
+        if (args.length != 1) throw new IllegalStateException("Must provide class name!");
+        String testContent = null;
+        List<File> sourcePath = new ArrayList<>();
+        for (String sourcePaths : System.getProperty("test.src.path").split(":")) {
+            sourcePath.add(new File(sourcePaths));
+        }
+        JavacFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+        for (File sp : sourcePath) {
+            File inp = new File(sp, args[0]);
+
+            if (inp.canRead()) {
+                testContent = fm.getRegularFile(inp).getCharContent(true).toString();
+            }
+        }
+        if (testContent == null) throw new IllegalStateException();
+        DiagnosticListener<JavaFileObject> devNull = new DiagnosticListener<JavaFileObject>() {
+            @Override public void report(Diagnostic<? extends JavaFileObject> diagnostic) { }
+        };
+        JavaFileObject testFile = new TestFO(new URI("mem://" + args[0]), testContent);
+        JavacTask task = JavacTool.create().getTask(null,
+                                                    new TestFM(fm),
+                                                    devNull,
+                                                    Arrays.asList("-Xjcov"),
+                                                    null,
+                                                    Arrays.asList(testFile));
+        final Trees trees = Trees.instance(task);
+        final CompilationUnitTree cut = task.parse().iterator().next();
+        task.analyze();
+
+        final List<int[]> annotations = new ArrayList<>();
+
+        new TreeScanner<Void, Void>() {
+            @Override
+            public Void visitAnnotation(AnnotationTree node, Void p) {
+                int endPos = (int) trees.getSourcePositions().getEndPosition(cut, node);
+
+                Assert.check(endPos >= 0);
+
+                annotations.add(new int[] {(int) trees.getSourcePositions().getStartPosition(cut, node), endPos});
+                return super.visitAnnotation(node, p);
+            }
+        }.scan(cut.getTypeDecls().get(0), null);
+
+        Collections.sort(annotations, new Comparator<int[]>() {
+            @Override public int compare(int[] o1, int[] o2) {
+                return o2[0] - o1[0];
+            }
+        });
+
+        for (final int[] annotation : annotations) {
+            StringBuilder updatedContent = new StringBuilder();
+            int last = testContent.length();
+
+            for (int[] toRemove : annotations) {
+                if (toRemove == annotation) continue;
+                updatedContent.insert(0, testContent.substring(toRemove[1], last));
+                last = toRemove[0];
+            }
+
+            updatedContent.insert(0, testContent.substring(0, last));
+
+            JavaFileObject updatedFile = new TestFO(new URI("mem://" + args[0]), updatedContent.toString());
+            JavacTask testTask = JavacTool.create().getTask(null,
+                                                            new TestFM(fm),
+                                                            devNull,
+                                                            Arrays.asList("-processor", "Processor"),
+                                                            null,
+                                                            Arrays.asList(updatedFile));
+
+            try {
+                testTask.analyze();
+            } catch (Throwable e) {
+                System.out.println("error while processing:");
+                System.out.println(updatedContent);
+                throw e;
+            }
+        }
+    }
+
+    private static final class TestFO extends SimpleJavaFileObject {
+        private final String content;
+        public TestFO(URI uri, String content) {
+            super(uri, Kind.SOURCE);
+            this.content = content;
+        }
+
+        @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+            return content;
+        }
+
+        @Override public boolean isNameCompatible(String simpleName, Kind kind) {
+            return true;
+        }
+    }
+
+    private static final class TestFM extends ForwardingJavaFileManager<JavaFileManager> {
+
+        public TestFM(JavaFileManager fileManager) {
+            super(fileManager);
+        }
+
+        @Override
+        public boolean isSameFile(FileObject a, FileObject b) {
+            return a.equals(b);
+        }
+
+    }
+}
\ No newline at end of file
diff --git a/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Source.java b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Source.java
new file mode 100644
index 0000000..4b86712
--- /dev/null
+++ b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Source.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2013, 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 8014016
+ * @summary Verify that annotation processors do not get invalid annotations
+ * @build Processor
+ * @run main Processor Source.java
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@OnMethod
+@OnField
+class Class<@OnType @OnMethod @OnField T extends @OnType @OnMethod @OnField CharSequence & @OnType @OnMethod @OnField Runnable> extends @OnType @OnMethod @OnField Object {
+
+    @OnType
+    @OnTypeUse
+    @OnField
+    private void testMethod(@OnType @OnField @OnMethod int i) { }
+
+    @OnType
+    @OnMethod
+    private java.lang.@OnType @OnMethod @OnField String testField;
+}
+
+@Target(ElementType.TYPE)
+@interface OnType {}
+
+@Target(ElementType.METHOD)
+@interface OnMethod {}
+
+@Target(ElementType.TYPE_USE)
+@interface OnTypeUse {}
+
+@Target(ElementType.FIELD)
+@interface OnField {}
diff --git a/langtools/test/tools/javac/processing/model/element/TestExecutableElement.java b/langtools/test/tools/javac/processing/model/element/TestExecutableElement.java
index 35aae46..d40b143 100644
--- a/langtools/test/tools/javac/processing/model/element/TestExecutableElement.java
+++ b/langtools/test/tools/javac/processing/model/element/TestExecutableElement.java
@@ -23,54 +23,57 @@
 
 /*
  * @test
- * @bug 8005046 8011052
- * @summary Test basic properties of javax.lang.element.Element
+ * @bug 8005046 8011052 8025087
+ * @summary Test basic properties of javax.lang.element.ExecutableElement
  * @author  Joseph D. Darcy
  * @library /tools/javac/lib
  * @build   JavacTestingAbstractProcessor TestExecutableElement
- * @compile -processor TestExecutableElement -proc:only TestExecutableElement.java
+ * @compile -processor TestExecutableElement -proc:only -AexpectedMethodCount=7 TestExecutableElement.java
+ * @compile/process -processor TestExecutableElement -proc:only -AexpectedMethodCount=3 ProviderOfDefault
  */
 
 import java.lang.annotation.*;
 import java.util.Formatter;
 import java.util.Set;
-import java.util.Objects;
 import java.util.regex.*;
 import javax.annotation.processing.*;
-import javax.lang.model.SourceVersion;
-import static javax.lang.model.SourceVersion.*;
 import javax.lang.model.element.*;
-import javax.lang.model.util.*;
 import static javax.lang.model.util.ElementFilter.*;
 import static javax.tools.Diagnostic.Kind.*;
-import static javax.tools.StandardLocation.*;
 
 /**
  * Test some basic workings of javax.lang.element.ExecutableElement
  */
+@SupportedOptions("expectedMethodCount")
 public class TestExecutableElement extends JavacTestingAbstractProcessor implements ProviderOfDefault {
+    private int seenMethods = 0;
     @IsDefault(false)
     public boolean process(Set<? extends TypeElement> annotations,
                            RoundEnvironment roundEnv) {
-        int errors = 0;
         if (!roundEnv.processingOver()) {
-            boolean hasRun = false;
             for (Element element : roundEnv.getRootElements()) {
                 for (ExecutableElement method : methodsIn(element.getEnclosedElements())) {
-                    hasRun = true;
-                    errors += checkIsDefault(method);
+                    checkIsDefault(method);
+                    seenMethods++;
                 }
             }
+        } else {
+            String expectedMethodCountStr = processingEnv.getOptions().get("expectedMethodCount");
+            if (expectedMethodCountStr == null) {
+                messager.printMessage(ERROR, "No expected method count specified.");
+            } else {
+                int expectedMethodCount = Integer.parseInt(expectedMethodCountStr);
 
-            if (!hasRun) {
-                messager.printMessage(ERROR, "No test cases run; test fails.");
+                if (seenMethods != expectedMethodCount) {
+                    messager.printMessage(ERROR, "Wrong number of seen methods: " + seenMethods);
+                }
             }
         }
         return true;
     }
 
     @IsDefault(false)
-    int checkIsDefault(ExecutableElement method) {
+    void checkIsDefault(ExecutableElement method) {
         System.out.println("Testing " + method);
         IsDefault expectedIsDefault = method.getAnnotation(IsDefault.class);
 
@@ -116,9 +119,7 @@
                                                          expectedDefault,
                                                          methodIsDefault).toString(),
                                   method);
-            return 1;
         }
-        return 0;
     }
 }
 
@@ -142,4 +143,6 @@
 
     @IsDefault(value=true, expectedTextRegex="\\s*@IsDefault\\(.*\\)\\s*default strictfp void quux\\(\\);\\s*$")
     default strictfp void quux() {};
+    @IsDefault(false)
+    static void statik() {}
 }
diff --git a/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java b/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java
index 0b0bd8e..2f1df39 100644
--- a/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java
+++ b/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java
@@ -26,6 +26,7 @@
  * @bug     1234567
  * @summary Annotations on types
  * @library /tools/javac/lib
+ * @ignore
  * @build JavacTestingAbstractProcessor DPrinter BasicAnnoTests
  * @compile/process -processor BasicAnnoTests -proc:only BasicAnnoTests.java
  */
diff --git a/langtools/test/tools/javac/tree/NoPrivateTypesExported.java b/langtools/test/tools/javac/tree/NoPrivateTypesExported.java
new file mode 100644
index 0000000..c16340e
--- /dev/null
+++ b/langtools/test/tools/javac/tree/NoPrivateTypesExported.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2013, 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 8026180
+ * @summary Ensuring javax.lang.model.**, javax.tools.**, javax.annotation.processing.**
+ *          and com.sun.source.** don't export inappropriate types.
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor NoPrivateTypesExported
+ * @compile -processor NoPrivateTypesExported NoPrivateTypesExported.java
+ */
+import java.lang.annotation.Documented;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.TypeParameterElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.ArrayType;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.IntersectionType;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.TypeVariable;
+import javax.lang.model.type.WildcardType;
+import javax.lang.model.util.ElementScanner8;
+import javax.lang.model.util.SimpleAnnotationValueVisitor8;
+import javax.tools.Diagnostic.Kind;
+
+public class NoPrivateTypesExported extends JavacTestingAbstractProcessor {
+
+    private static final String[] javaxLangModelPackages = new String[] {
+        "javax.lang.model",
+        "javax.lang.model.element",
+        "javax.lang.model.type",
+        "javax.lang.model.util",
+    };
+
+    private static final Set<String> javaxLangModelAcceptable;
+
+    private static final String[] javaxToolsProcessingPackages = new String[] {
+        "javax.annotation.processing",
+        "javax.tools",
+    };
+
+    private static final Set<String> javaxToolsProcessingAcceptable;
+
+    private static final String[] comSunSourcePackages = new String[] {
+        "com.sun.source.doctree",
+        "com.sun.source.tree",
+        "com.sun.source.util"
+    };
+
+    private static final Set<String> comSunSourceAcceptable;
+
+    static {
+        javaxLangModelAcceptable = new HashSet<>(Arrays.asList(
+            "java.io.",
+            "java.lang.",
+            "java.net.",
+            "java.nio.",
+            "java.util.",
+            "javax.lang.model.",
+            "javax.annotation.processing.SupportedSourceVersion",
+            "jdk.Exported"
+        ));
+        Set<String> javaxToolsProcessingAcceptableTemp = new HashSet<>();
+        javaxToolsProcessingAcceptableTemp.addAll(javaxLangModelAcceptable);
+        javaxToolsProcessingAcceptableTemp.addAll(Arrays.asList(
+                "javax.annotation.processing.",
+                "javax.tools."
+        ));
+        javaxToolsProcessingAcceptable = javaxToolsProcessingAcceptableTemp;
+        Set<String> comSunSourceAcceptableTemp = new HashSet<>();
+        comSunSourceAcceptableTemp.addAll(javaxToolsProcessingAcceptable);
+        comSunSourceAcceptableTemp.addAll(Arrays.asList(
+                "com.sun.source.doctree.",
+                "com.sun.source.tree.",
+                "com.sun.source.util."
+        ));
+        comSunSourceAcceptable = comSunSourceAcceptableTemp;
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        if (roundEnv.processingOver()) {
+            verifyPackage(javaxLangModelPackages, javaxLangModelAcceptable);
+            verifyPackage(javaxToolsProcessingPackages, javaxToolsProcessingAcceptable);
+            verifyPackage(comSunSourcePackages, comSunSourceAcceptable);
+        }
+        return true;
+    }
+
+    private void verifyPackage(String[] packagesToTest, Set<String> acceptable) {
+        for (String packageToTest : packagesToTest) {
+            PackageElement packageElement = processingEnv.getElementUtils()
+                    .getPackageElement(packageToTest);
+
+            verifyReferredTypesAcceptable(packageElement, acceptable);
+        }
+    }
+
+    private void verifyReferredTypesAcceptable(Element rootElement,
+                                               final Set<String> acceptable) {
+        new ElementScanner8<Void, Void>() {
+            @Override public Void visitType(TypeElement e, Void p) {
+                verifyTypeAcceptable(e.getSuperclass(), acceptable);
+                verifyTypesAcceptable(e.getInterfaces(), acceptable);
+                scan(e.getTypeParameters(), p);
+                scan(e.getEnclosedElements(), p);
+                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+                return null;
+            }
+            @Override public Void visitTypeParameter(TypeParameterElement e, Void p) {
+                verifyTypesAcceptable(e.getBounds(), acceptable);
+                scan(e.getEnclosedElements(), p);
+                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+                return null;
+            }
+            @Override public Void visitPackage(PackageElement e, Void p) {
+                scan(e.getEnclosedElements(), p);
+                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+                return null;
+            }
+            @Override public Void visitVariable(VariableElement e, Void p) {
+                verifyTypeAcceptable(e.asType(), acceptable);
+                scan(e.getEnclosedElements(), p);
+                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+                return null;
+            }
+            @Override
+            public Void visitExecutable(ExecutableElement e, Void p) {
+                scan(e.getTypeParameters(), p);
+                verifyTypeAcceptable(e.getReturnType(), acceptable);
+                scan(e.getParameters(), p);
+                verifyTypesAcceptable(e.getThrownTypes(), acceptable);
+                scan(e.getEnclosedElements(), p);
+                verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+                return null;
+            }
+        }.scan(rootElement, null);
+    }
+
+    private void verifyAnnotations(Iterable<? extends AnnotationMirror> annotations,
+                                   Set<String> acceptable) {
+        for (AnnotationMirror mirror : annotations) {
+            Element annotationElement = mirror.getAnnotationType().asElement();
+
+            if (annotationElement.getAnnotation(Documented.class) == null) {
+                note("Ignoring undocumented annotation: " + mirror.getAnnotationType());
+            }
+
+            verifyTypeAcceptable(mirror.getAnnotationType(), acceptable);
+
+            for (AnnotationValue value : mirror.getElementValues().values()) {
+                verifyAnnotationValue(value, acceptable);
+            }
+        }
+    }
+
+    private void verifyAnnotationValue(AnnotationValue value,
+                                       final Set<String> acceptable) {
+        value.accept(new SimpleAnnotationValueVisitor8<Void, Void>() {
+            @Override public Void visitType(TypeMirror t, Void p) {
+                verifyTypeAcceptable(t, acceptable);
+                return null;
+            }
+            @Override
+            public Void visitEnumConstant(VariableElement c, Void p) {
+                verifyReferredTypesAcceptable(c, acceptable);
+                return null;
+            }
+            @Override public Void visitArray(List<? extends AnnotationValue> vals,
+                                             Void p) {
+                for (AnnotationValue val : vals) {
+                    val.accept(this, p);
+                }
+                return null;
+            }
+            @Override protected Void defaultAction(Object o, Void p) {
+                error("Unexpected AnnotationValue: " + o.toString());
+                return super.defaultAction(o, p);
+            }
+        }, null);
+    }
+
+    private void verifyTypesAcceptable(Iterable<? extends TypeMirror> types,
+                                       Set<String> acceptable) {
+        if (types == null) return ;
+
+        for (TypeMirror type : types) {
+            verifyTypeAcceptable(type, acceptable);
+        }
+    }
+
+    private void verifyTypeAcceptable(TypeMirror type, Set<String> acceptable) {
+        if (type == null) return ;
+
+        verifyAnnotations(type.getAnnotationMirrors(), acceptable);
+
+        switch (type.getKind()) {
+            case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT:
+            case INT: case LONG: case SHORT: case VOID: case NONE: case NULL:
+                return ;
+            case DECLARED:
+                DeclaredType dt = (DeclaredType) type;
+                TypeElement outermostTypeElement = outermostTypeElement(dt.asElement());
+                String outermostType = outermostTypeElement.getQualifiedName().toString();
+                boolean isAcceptable = false;
+                for (String acceptablePackage : acceptable) {
+                    if (outermostType.startsWith(acceptablePackage)) {
+                        isAcceptable = true;
+                        break;
+                    }
+                }
+                if (!isAcceptable) {
+                    error("Type not acceptable for this API: " + dt.toString());
+                }
+
+                for (TypeMirror bound : dt.getTypeArguments()) {
+                    verifyTypeAcceptable(bound, acceptable);
+                }
+                break;
+            case ARRAY:
+                verifyTypeAcceptable(((ArrayType) type).getComponentType(), acceptable);
+                break;
+            case INTERSECTION:
+                for (TypeMirror element : ((IntersectionType) type).getBounds()) {
+                    verifyTypeAcceptable(element, acceptable);
+                }
+                break;
+            case TYPEVAR:
+                verifyTypeAcceptable(((TypeVariable) type).getLowerBound(), acceptable);
+                verifyTypeAcceptable(((TypeVariable) type).getUpperBound(), acceptable);
+                break;
+            case WILDCARD:
+                verifyTypeAcceptable(((WildcardType) type).getExtendsBound(), acceptable);
+                verifyTypeAcceptable(((WildcardType) type).getSuperBound(), acceptable);
+                break;
+            default:
+                error("Type not acceptable for this API: " + type.toString());
+                break;
+
+        }
+    }
+
+    private TypeElement outermostTypeElement(Element el) {
+        while (el.getEnclosingElement().getKind() != ElementKind.PACKAGE) {
+            el = el.getEnclosingElement();
+        }
+
+        return (TypeElement) el;
+    }
+
+    private void error(String text) {
+        processingEnv.getMessager().printMessage(Kind.ERROR, text);
+    }
+
+    private void note(String text) {
+        processingEnv.getMessager().printMessage(Kind.NOTE, text);
+    }
+}
diff --git a/langtools/test/tools/javac/tree/T8024415.java b/langtools/test/tools/javac/tree/T8024415.java
new file mode 100644
index 0000000..badd64f
--- /dev/null
+++ b/langtools/test/tools/javac/tree/T8024415.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, 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 8024415
+ * @summary Pretty printing of JCConditional does not follow the precedence and
+ *          associativity rules of JCConditional
+ * @run testng T8024415
+ */
+
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import org.testng.annotations.Test;
+
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.Pretty;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Names;
+
+
+/*
+ * Test verifies that the precedence rules of conditional expressions
+ * (JCConditional) are correct.
+ */
+@Test
+public class T8024415 {
+
+    TreeMaker maker;
+    JCExpression x;
+
+
+    public T8024415() {
+        Context ctx = new Context();
+        JavacFileManager.preRegister(ctx);
+        maker = TreeMaker.instance(ctx);
+        Names names = Names.instance(ctx);
+        x = maker.Ident(names.fromString("x"));
+    }
+
+
+    // JLS 15.25: The conditional operator is syntactically right-associative
+    // (it groups right-to-left). Thus, a?b:c?d:e?f:g means the same as
+    // a?b:(c?d:(e?f:g)).
+    public void testAssociativity() throws IOException {
+
+        JCTree left   = maker.Conditional(maker.Conditional(x, x, x), x, x);
+        JCTree right  = maker.Conditional(x, x, maker.Conditional(x, x, x));
+
+        String prettyLeft   = prettyPrint(left);
+        String prettyRight  = prettyPrint(right);
+
+        assertEquals(prettyLeft.replaceAll("\\s", ""),  "(x?x:x)?x:x");
+        assertEquals(prettyRight.replaceAll("\\s", ""), "x?x:x?x:x");
+
+    }
+
+
+    // The true-part of of a conditional expression is surrounded by ? and :
+    // and can thus always be parsed unambiguously without surrounding
+    // parentheses.
+    public void testPrecedence() throws IOException {
+
+        JCTree left   = maker.Conditional(maker.Assign(x, x), x, x);
+        JCTree middle = maker.Conditional(x, maker.Assign(x, x), x);
+        JCTree right  = maker.Conditional(x, x, maker.Assign(x, x));
+
+        String prettyLeft   = prettyPrint(left);
+        String prettyMiddle = prettyPrint(middle);
+        String prettyRight  = prettyPrint(right);
+
+        assertEquals(prettyLeft.replaceAll("\\s", ""),   "(x=x)?x:x");
+        assertEquals(prettyMiddle.replaceAll("\\s", ""), "x?x=x:x");
+        assertEquals(prettyRight.replaceAll("\\s", ""),  "x?x:(x=x)");
+
+    }
+
+
+    // Helper method
+    private static String prettyPrint(JCTree tree) throws IOException {
+        StringWriter sw = new StringWriter();
+        new Pretty(sw, true).printExpr(tree);
+        return sw.toString();
+    }
+
+}
diff --git a/langtools/test/tools/javadoc/8025693/Test.java b/langtools/test/tools/javadoc/8025693/Test.java
new file mode 100644
index 0000000..7dc6095
--- /dev/null
+++ b/langtools/test/tools/javadoc/8025693/Test.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013, 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 8025693
+ * @summary javadoc should ignore <clinit> methods found in classes on classpath
+ */
+
+import java.io.*;
+
+public class Test {
+    public static void main(String[] args) throws Exception {
+        new Test().run();
+    }
+
+    final File baseFile = new File("src/Base.java");
+    final String baseText =
+        "package p;\n" +
+        "public class Base { static { } }\n";
+
+    final File srcFile = new File("src/C.java");
+    final String srcText =
+        "package p;\n" +
+        "/** comment */\n" +
+        "public abstract class C extends Base { }\n";
+
+    void run() throws Exception {
+        File classesDir = new File("classes");
+        classesDir.mkdirs();
+        writeFile(baseFile, baseText);
+        String[] javacArgs = {
+            "-d", classesDir.getPath(),
+            baseFile.getPath()
+        };
+        com.sun.tools.javac.Main.compile(javacArgs);
+
+        writeFile(srcFile, srcText);
+        String[] args = {
+            "-d", "api",
+            "-classpath", classesDir.getPath(),
+            "-package", "p",
+            srcFile.getPath()
+        };
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        PrintStream ps = new PrintStream(baos);
+        PrintStream prev = System.err;
+        System.setErr(ps);
+        try {
+            int rc = com.sun.tools.javadoc.Main.execute(args);
+        } finally {
+            System.err.flush();
+            System.setErr(prev);
+        }
+        String out = baos.toString();
+        System.out.println(out);
+
+        String errorMessage = "java.lang.IllegalArgumentException: <clinit>";
+        if (out.contains(errorMessage))
+            throw new Exception("error message found: " + errorMessage);
+    }
+
+    void writeFile(File file, String body) throws IOException {
+        file.getParentFile().mkdirs();
+        try (FileWriter out = new FileWriter(file)) {
+            out.write(body);
+        }
+    }
+}
+
diff --git a/langtools/test/tools/jdeps/APIDeps.java b/langtools/test/tools/jdeps/APIDeps.java
new file mode 100644
index 0000000..530e1d3
--- /dev/null
+++ b/langtools/test/tools/jdeps/APIDeps.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2012, 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 8015912
+ * @summary find API dependencies
+ * @build m.Bar m.Foo m.Gee b.B c.C c.I d.D e.E f.F g.G
+ * @run main APIDeps
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.regex.*;
+
+public class APIDeps {
+    private static boolean symbolFileExist = initProfiles();
+    private static boolean initProfiles() {
+        // check if ct.sym exists; if not use the profiles.properties file
+        Path home = Paths.get(System.getProperty("java.home"));
+        if (home.endsWith("jre")) {
+            home = home.getParent();
+        }
+        Path ctsym = home.resolve("lib").resolve("ct.sym");
+        boolean symbolExists = ctsym.toFile().exists();
+        if (!symbolExists) {
+            Path testSrcProfiles =
+                Paths.get(System.getProperty("test.src", "."), "profiles.properties");
+            if (!testSrcProfiles.toFile().exists())
+                throw new Error(testSrcProfiles + " does not exist");
+            System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
+                ctsym, testSrcProfiles);
+            System.setProperty("jdeps.profiles", testSrcProfiles.toString());
+        }
+        return symbolExists;
+    }
+
+    public static void main(String... args) throws Exception {
+        int errors = 0;
+        errors += new APIDeps().run();
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    int run() throws IOException {
+        File testDir = new File(System.getProperty("test.classes", "."));
+        String testDirBasename = testDir.toPath().getFileName().toString();
+        File mDir = new File(testDir, "m");
+        // all dependencies
+        test(new File(mDir, "Bar.class"),
+             new String[] {"java.lang.Object", "java.lang.String",
+                           "java.util.Set", "java.util.HashSet",
+                           "java.lang.management.ManagementFactory",
+                           "java.lang.management.RuntimeMXBean",
+                           "b.B", "c.C", "d.D", "f.F", "g.G"},
+             new String[] {"compact1", "compact3", testDirBasename},
+             new String[] {"-classpath", testDir.getPath(), "-verbose", "-P"});
+        test(new File(mDir, "Foo.class"),
+             new String[] {"c.I", "e.E", "f.F", "m.Bar"},
+             new String[] {testDirBasename},
+             new String[] {"-classpath", testDir.getPath(), "-verbose", "-P"});
+        test(new File(mDir, "Gee.class"),
+             new String[] {"g.G", "sun.misc.Lock"},
+             new String[] {testDirBasename, "JDK internal API"},
+             new String[] {"-classpath", testDir.getPath(), "-verbose"});
+        // parse only APIs
+        test(mDir,
+             new String[] {"java.lang.Object", "java.lang.String",
+                           "java.util.Set",
+                           "c.C", "d.D", "c.I", "e.E", "m.Bar"},
+             new String[] {"compact1", testDirBasename, mDir.getName()},
+             new String[] {"-classpath", testDir.getPath(), "-verbose", "-P", "-apionly"});
+        return errors;
+    }
+
+    void test(File file, String[] expect, String[] profiles) {
+        test(file, expect, profiles, new String[0]);
+    }
+
+    void test(File file, String[] expect, String[] profiles, String[] options) {
+        List<String> args = new ArrayList<>(Arrays.asList(options));
+        if (file != null) {
+            args.add(file.getPath());
+        }
+        checkResult("api-dependencies", expect, profiles,
+                    jdeps(args.toArray(new String[0])));
+    }
+
+    Map<String,String> jdeps(String... args) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        System.err.println("jdeps " + Arrays.toString(args));
+        int rc = com.sun.tools.jdeps.Main.run(args, pw);
+        pw.close();
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out);
+        if (rc != 0)
+            throw new Error("jdeps failed: rc=" + rc);
+        return findDeps(out);
+    }
+
+    // Pattern used to parse lines
+    private static Pattern linePattern = Pattern.compile(".*\r?\n");
+    private static Pattern pattern = Pattern.compile("\\s+ -> (\\S+) +(.*)");
+
+    // Use the linePattern to break the given String into lines, applying
+    // the pattern to each line to see if we have a match
+    private static Map<String,String> findDeps(String out) {
+        Map<String,String> result = new HashMap<>();
+        Matcher lm = linePattern.matcher(out);  // Line matcher
+        Matcher pm = null;                      // Pattern matcher
+        int lines = 0;
+        while (lm.find()) {
+            lines++;
+            CharSequence cs = lm.group();       // The current line
+            if (pm == null)
+                pm = pattern.matcher(cs);
+            else
+                pm.reset(cs);
+            if (pm.find())
+                result.put(pm.group(1), pm.group(2).trim());
+            if (lm.end() == out.length())
+                break;
+        }
+        return result;
+    }
+
+    void checkResult(String label, String[] expect, Collection<String> found) {
+        List<String> list = Arrays.asList(expect);
+        if (!isEqual(list, found))
+            error("Unexpected " + label + " found: '" + found + "', expected: '" + list + "'");
+    }
+
+    void checkResult(String label, String[] expect, String[] profiles, Map<String,String> result) {
+        // check the dependencies
+        checkResult(label, expect, result.keySet());
+        // check profile information
+        Set<String> values = new TreeSet<>();
+        String internal = "JDK internal API";
+        for (String s: result.values()) {
+            if (s.startsWith(internal)){
+                values.add(internal);
+            } else {
+                values.add(s);
+            }
+        }
+        checkResult(label, profiles, values);
+    }
+
+    boolean isEqual(List<String> expected, Collection<String> found) {
+        if (expected.size() != found.size())
+            return false;
+
+        List<String> list = new ArrayList<>(found);
+        list.removeAll(expected);
+        return list.isEmpty();
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
diff --git a/langtools/test/tools/jdeps/Basic.java b/langtools/test/tools/jdeps/Basic.java
index e68875b..fd5242a 100644
--- a/langtools/test/tools/jdeps/Basic.java
+++ b/langtools/test/tools/jdeps/Basic.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8003562 8005428
+ * @bug 8003562 8005428 8015912
  * @summary Basic tests for jdeps tool
  * @build Test p.Foo
  * @run main Basic
@@ -79,40 +79,33 @@
              new String[] {"compact1", "compact1", "compact3"});
         // test class-level dependency output
         test(new File(testDir, "Test.class"),
-             new String[] {"java.lang.Object", "p.Foo"},
-             new String[] {"compact1", "not found"},
-             new String[] {"-V", "class"});
+             new String[] {"java.lang.Object", "java.lang.String", "p.Foo"},
+             new String[] {"compact1", "compact1", "not found"},
+             new String[] {"-verbose:class"});
         // test -p option
         test(new File(testDir, "Test.class"),
              new String[] {"p.Foo"},
              new String[] {"not found"},
-             new String[] {"--verbose-level=class", "-p", "p"});
+             new String[] {"-verbose:class", "-p", "p"});
         // test -e option
         test(new File(testDir, "Test.class"),
              new String[] {"p.Foo"},
              new String[] {"not found"},
-             new String[] {"-V", "class", "-e", "p\\..*"});
+             new String[] {"-verbose:class", "-e", "p\\..*"});
         test(new File(testDir, "Test.class"),
              new String[] {"java.lang"},
              new String[] {"compact1"},
-             new String[] {"-V", "package", "-e", "java\\.lang\\..*"});
-        // test -classpath and wildcard options
+             new String[] {"-verbose:package", "-e", "java\\.lang\\..*"});
+        // test -classpath and -include options
         test(null,
-             new String[] {"com.sun.tools.jdeps", "java.lang", "java.util",
-                           "java.util.regex", "java.io", "java.nio.file",
+             new String[] {"java.lang", "java.util",
                            "java.lang.management"},
-             new String[] {(symbolFileExist? "not found" : "JDK internal API (classes)"),
-                           "compact1", "compact1", "compact1",
-                           "compact1", "compact1", "compact3"},
-             new String[] {"--classpath", testDir.getPath(), "*"});
-        /* Temporary disable this test case.  Test.class has a dependency
-         * on java.lang.String on certain windows machine (8008479).
-         // -v shows intra-dependency
-         test(new File(testDir, "Test.class"),
-              new String[] {"java.lang.Object", "p.Foo"},
-              new String[] {"compact1", testDir.getName()},
-              new String[] {"-v", "--classpath", testDir.getPath(), "Test.class"});
-        */
+             new String[] {"compact1", "compact1", "compact3"},
+             new String[] {"-classpath", testDir.getPath(), "-include", "p.+|Test.class"});
+        test(new File(testDir, "Test.class"),
+             new String[] {"java.lang.Object", "java.lang.String", "p.Foo"},
+             new String[] {"compact1", "compact1", testDir.getName()},
+             new String[] {"-v", "-classpath", testDir.getPath(), "Test.class"});
         return errors;
     }
 
diff --git a/langtools/test/tools/jdeps/Test.java b/langtools/test/tools/jdeps/Test.java
index 8adc7b4..1a7a96a 100644
--- a/langtools/test/tools/jdeps/Test.java
+++ b/langtools/test/tools/jdeps/Test.java
@@ -25,4 +25,7 @@
     public void test() {
         p.Foo f = new p.Foo();
     }
+    private String name() {
+        return "this test";
+    }
 }
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/b/B.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/b/B.java
index 1301f4e..e3f2af8 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/b/B.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,12 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package b;
 
-@interface Anno { }
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
 
-@Anno
-@Anno
-class DuplicateAnnotation { }
+@Retention(RetentionPolicy.RUNTIME)
+@Target({TYPE, METHOD, FIELD})
+public @interface B {
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/c/C.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/c/C.java
index 1301f4e..60d85ff 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/c/C.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,7 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package c;
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+public class C {
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/c/I.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/c/I.java
index 1301f4e..12af75a 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/c/I.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,8 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package c;
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+public interface I {
+    void run();
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/d/D.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/d/D.java
index 1301f4e..96b183c 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/d/D.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,7 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package d;
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+public class D {
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/e/E.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/e/E.java
index 1301f4e..bab738b 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/e/E.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,8 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package e;
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+// use compact2
+public class E extends java.rmi.RemoteException {
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/f/F.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/f/F.java
index 1301f4e..dc43c9c 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/f/F.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,11 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package f;
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+public class F {
+    public F() {
+        // jdk internal API
+        sun.misc.Unsafe.getUnsafe();
+    }
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/g/G.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/g/G.java
index 1301f4e..c3f9fd6 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/g/G.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,9 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package g;
 
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
+public class G {
+    // Full JRE
+    private static final boolean gui = java.beans.Beans.isGuiAvailable();
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/m/Bar.java
similarity index 65%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/m/Bar.java
index 1301f4e..3988274 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/m/Bar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,30 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package m;
 
-@interface Anno { }
+import java.util.*;
 
-@Anno
-@Anno
-class DuplicateAnnotation { }
+@b.B
+public class Bar {
+    public final Set<String> set = new HashSet<>();
+    protected d.D d;
+    private f.F f;
+
+    public Bar() {
+        // compact3
+        java.lang.management.ManagementFactory.getRuntimeMXBean();
+    }
+
+    protected c.C c() {
+        return new c.C();
+    }
+
+    /* package private */ void setF(f.F o) {
+        f = o;
+    }
+
+    private g.G g() {
+        return new g.G();
+    }
+}
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/m/Foo.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/m/Foo.java
index 1301f4e..67b7578 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/m/Foo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,13 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package m;
 
-@interface Anno { }
+public class Foo extends Bar implements c.I {
+   public void foo() throws e.E {
+   }
+   public void run() {
+      setF(new f.F());
+   }
+}
 
-@Anno
-@Anno
-class DuplicateAnnotation { }
diff --git a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java b/langtools/test/tools/jdeps/m/Gee.java
similarity index 78%
copy from langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
copy to langtools/test/tools/jdeps/m/Gee.java
index 1301f4e..749847e 100644
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java
+++ b/langtools/test/tools/jdeps/m/Gee.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,10 @@
  * questions.
  */
 
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
+package m;
 
-@interface Anno { }
 
-@Anno
-@Anno
-class DuplicateAnnotation { }
+class Gee extends g.G {
+    public sun.misc.Lock lock;
+}
+