changeset 1663:90a26666a077 aarch64-20130813

Merge
author adinn
date Tue, 02 Jul 2013 10:13:00 +0100
parents 1da72a6b4830 (current diff) 4a48f3173534 (diff)
children 410cc10bc125
files .hgtags src/share/classes/com/sun/tools/javac/Server.java test/tools/apt/Basics/NullAPF.java test/tools/apt/Basics/apt.sh test/tools/apt/verifyVariables.sh test/tools/javac/4846262/Test.java test/tools/javac/4846262/Test.out test/tools/javac/4846262/Test.sh test/tools/javac/6302184/T6302184.sh test/tools/javac/ClassPathTest/ClassPathTest.sh test/tools/javac/ClassPathTest/ClassPathTest1.java test/tools/javac/ClassPathTest/ClassPathTest2.java test/tools/javac/ClassPathTest/ClassPathTest3.java test/tools/javac/ClassPathTest/bar/pkg/ClassPathTestAux2.java test/tools/javac/ClassPathTest/foo/pkg/ClassPathTestAux1.java test/tools/javac/ClassPathTest/pkg/ClassPathTestAux3.java test/tools/javac/ExtDirs/ExtDirTest_1.java test/tools/javac/ExtDirs/ExtDirTest_2.java test/tools/javac/ExtDirs/ExtDirTest_3.java test/tools/javac/ExtDirs/ExtDirs.sh test/tools/javac/MissingInclude.java test/tools/javac/MissingInclude.sh test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java test/tools/javac/ProtectedInnerClass/p1/ProtectedInnerClass1.java test/tools/javac/ProtectedInnerClass/p2/ProtectedInnerClass2.java test/tools/javac/ProtectedInnerClass/p2/ProtectedInnerClass3.java test/tools/javac/T5090006/T5090006.java test/tools/javac/T5090006/compiler.sh test/tools/javac/annotations/repeatingAnnotations/MissingContainedBy.java test/tools/javac/annotations/repeatingAnnotations/MissingContainerFor.java test/tools/javac/annotations/repeatingAnnotations/UseWrongContainedBy.java test/tools/javac/annotations/repeatingAnnotations/UseWrongContainerFor.java test/tools/javac/annotations/repeatingAnnotations/WrongContainedBy.java test/tools/javac/annotations/repeatingAnnotations/WrongContainerFor.java test/tools/javac/constDebug/ConstDebug.java test/tools/javac/constDebug/ConstDebug.sh test/tools/javac/diags/examples/ContainedByDocumentedMismatch.java test/tools/javac/diags/examples/ContainedByInheritedMismatch.java test/tools/javac/diags/examples/ContainedByNoValue.java test/tools/javac/diags/examples/ContainedByNonDefault.java test/tools/javac/diags/examples/ContainedByRetentionMismatch.java test/tools/javac/diags/examples/ContainedByTargetMismatch.java test/tools/javac/diags/examples/ContainedByWrongValueType.java test/tools/javac/diags/examples/InferredDoNotConformToLower.java test/tools/javac/diags/examples/NoUniqueMaximalInstance.java test/tools/javac/diags/examples/WrongContainedBy.java test/tools/javac/diags/examples/WrongContainerFor.java test/tools/javac/fatalErrors/NoJavaLang.java test/tools/javac/fatalErrors/NoJavaLang.out test/tools/javac/fatalErrors/NoJavaLang.sh test/tools/javac/generics/diamond/T6939780.java test/tools/javac/generics/diamond/T6939780.out test/tools/javac/innerClassFile/Driver.sh test/tools/javac/innerClassFile/x/B.java test/tools/javac/innerClassFile/x/C.java test/tools/javac/innerClassFile/y/Main.java test/tools/javac/innerClassFile/y/R1.java test/tools/javac/innerClassFile/y/R2.java test/tools/javac/innerClassFile/y/R3.java test/tools/javac/javazip/A.java test/tools/javac/javazip/Test.sh test/tools/javac/javazip/bad/B.java test/tools/javac/javazip/good/B.java test/tools/javac/lambda/MethodReference26.out test/tools/javac/lambda/TargetType06.out test/tools/javac/lambda/TargetType11.out test/tools/javac/lambda/TargetType20.out test/tools/javac/lambda/TargetType45.out test/tools/javac/lambda/TargetType50.out test/tools/javac/lambda/VoidCompatibility.out test/tools/javac/links/T.java test/tools/javac/links/b/B.java test/tools/javac/links/links.sh test/tools/javac/newlines/Newlines.sh test/tools/javac/stackmap/T4955930.java test/tools/javac/stackmap/T4955930.sh test/tools/javac/typeAnnotations/newlocations/BasicTest.java test/tools/javac/typeAnnotations/newlocations/BasicTest.out test/tools/javac/unicode/SupplementaryJavaID6.sh test/tools/javah/6257087/foo.java test/tools/javah/6257087/foo.sh test/tools/javah/6257087/foo_bar.h test/tools/javah/ConstMacroTest.sh test/tools/javah/MissingParamClassException.java test/tools/javah/MissingParamClassTest.sh test/tools/javah/ParamClassTest.java test/tools/javah/SubClassConsts.java test/tools/javah/SubClassConsts.out test/tools/javah/SubClassConsts.win test/tools/javah/SuperClassConsts.java test/tools/javap/NotPackagePrivateInterface.java test/tools/javap/PublicInterfaceTest.sh test/tools/javap/pathsep.sh test/tools/javap/stackmap/T6271292.java test/tools/javap/stackmap/T6271292.out test/tools/javap/stackmap/T6271292.sh
diffstat 1189 files changed, 66403 insertions(+), 9547 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Jun 28 14:26:58 2013 +0100
+++ b/.hgtags	Tue Jul 02 10:13:00 2013 +0100
@@ -194,3 +194,16 @@
 47f71d7c124f24c2fe2dfc49865b332345b458ed jdk8-b70
 467e4d9281bcf119eaec42af1423c96bd401871c jdk8-b71
 6f0986ed9b7e11d6eb06618f27e20b18f19fb797 initial_upload
+6f0986ed9b7e11d6eb06618f27e20b18f19fb797 jdk8-b72
+8d0baee36c7184d55c80354b45704c37d6b7ac79 jdk8-b73
+56c97aff46bb577b8668874154c24115a7e8a3e8 jdk8-b74
+c2e11e2ec4a3682513e566849e5562f31ded8c65 jdk8-b75
+e81839b3233792415daaab051698edc6067f1a16 jdk8-b76
+89c66415168925dffe492356ff893ff248bb5603 jdk8-b77
+af8417e590f4e76e0dfed09e71239fb102ef0d43 jdk8-b78
+56dfafbb9e1ad7548a4415316dc003296fb498cb jdk8-b79
+a8227c61768499dac847ea718af6719027c949f2 jdk8-b80
+ed69d087fdfd394491657a28ba9bc58e7849b7db jdk8-b81
+825da6847791994a8f405ee397df9e7fa638a458 jdk8-b82
+22ba3f92d4ae43bbc19793e854171cae2586f644 jdk8-b83
+cfb65ca92082b2412aed66c8422c2466bde544ef jdk8-b84
--- a/make/Makefile-classic	Fri Jun 28 14:26:58 2013 +0100
+++ b/make/Makefile-classic	Tue Jul 02 10:13:00 2013 +0100
@@ -241,6 +241,7 @@
 	javax/annotation/processing \
 	javax/lang/model \
 	javax/tools \
+        jdk/ \
 	com/sun/source \
 	com/sun/tools/javac 
 
--- a/make/build.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/make/build.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -29,18 +29,18 @@
 # Override this path as needed, either on the command line or in
 # one of the standard user build.properties files (see build.xml)
 
-# boot.java.home = /opt/jdk/1.6.0
+# boot.java.home = /opt/jdk/1.7.0
 boot.java = ${boot.java.home}/bin/java
 boot.javac = ${boot.java.home}/bin/javac
-boot.javac.source = 6
-boot.javac.target = 6
+boot.javac.source = 7
+boot.javac.target = 7
 
 # This is the JDK used to run the product version of the tools,
 # for example, for testing. If you're building a complete JDK, specify that.
 # Override this path as needed, either on the command line or in
 # one of the standard user build.properties files (see build.xml)
 
-# target.java.home = /opt/jdk/1.7.0
+# target.java.home = /opt/jdk/1.8.0
 target.java = ${target.java.home}/bin/java
 
 # Version info -- override as needed
@@ -116,6 +116,7 @@
         javax/annotation/processing/ \
         javax/lang/model/ \
         javax/tools/ \
+        jdk/ \
         com/sun/source/ \
         com/sun/tools/javac/ \
         com/sun/tools/doclint/
@@ -153,6 +154,7 @@
 javap.includes = \
         com/sun/tools/classfile/ \
         com/sun/tools/javap/ \
+        com/sun/tools/jdeps/ \
         sun/tools/javap/
 
 javap.tests = \
@@ -160,6 +162,14 @@
 
 #
 
+sjavac.includes = \
+        com/sun/tools/sjavac/ 
+
+sjavac.tests = \
+        tools/sjavac
+        
+#
+
 # The following files require the latest JDK to be available.
 # The API can be provided by using a suitable boot.java.home
 # or by setting import.jdk
--- a/make/build.xml	Fri Jun 28 14:26:58 2013 +0100
+++ b/make/build.xml	Tue Jul 02 10:13:00 2013 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- Copyright (c) 2007, 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
@@ -241,15 +241,15 @@
     </target>
 
     <target name="build-bootstrap-tools"
-        depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah"
+        depends="build-bootstrap-javac,build-bootstrap-javadoc,build-bootstrap-doclets,build-bootstrap-javah,build-bootstrap-sjavac"
     />
 
     <target name="build-all-tools"
-        depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap"
+        depends="build-javac,build-javadoc,build-doclets,build-javah,build-javap,build-sjavac"
     />
 
     <target name="build-all-classes" depends="build-bootstrap-javac,-create-import-jdk-stubs">
-        <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes}"/>
+        <build-classes includes="${javac.includes} ${javadoc.includes} ${doclets.includes} ${javah.includes} ${javap.includes} ${sjavac.includes}"/>
     </target>
 
     <!-- clean -->
@@ -432,6 +432,31 @@
         </zip>
     </target>
 
+    <target name="doclint-api" depends="build-all-classes">
+        <delete dir="${build.dir}/doclint/classes"/>
+        <mkdir dir="${build.dir}/doclint/classes"/>
+        <javac fork="true"
+               executable="${boot.javac}"
+               srcdir="${src.classes.dir}:${build.gensrc.dir}"
+               destdir="${build.dir}/doclint/classes"
+               includes="javax/lang/model/** com/sun/javadoc/** com/sun/source/**"
+               excludes=""
+               sourcepath="${javac.sourcepath}"
+               classpath="${javac.classpath}"
+               includeAntRuntime="no"
+               source="${javac.source}"
+               target="${javac.target}"
+               debug="${javac.debug}"
+               debuglevel="${javac.debuglevel}">
+            <compilerarg value="-implicit:none"/>
+            <compilerarg value="-Xprefer:source"/>
+            <compilerarg value="-J-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
+            <compilerarg line="${javac.no.jdk.warnings}"/>
+            <compilerarg line="${javac.version.opt}"/>
+            <compilerarg line="-Xdoclint:all/protected,-missing"/>
+        </javac>
+    </target>
+
     <!--
     **** Debugging/diagnostic targets.
     -->
@@ -656,6 +681,40 @@
 
     <target name="javap" depends="build-javap,jtreg-javap,findbugs-javap"/>
 
+    <!--
+    **** sjavac targets.
+    -->
+
+    <target name="build-bootstrap-sjavac"
+            depends="-def-build-bootstrap-classes,-def-build-bootstrap-jar,-def-build-bootstrap-tool">
+        <build-bootstrap-classes includes="${sjavac.includes}"/>
+        <build-bootstrap-jar     name="sjavac" includes="${sjavac.includes}"
+                                 jarmainclass="com.sun.tools.sjavac.Main"/>
+        <build-bootstrap-tool    name="sjavac"/>
+    </target>
+
+    <target name="build-classes-sjavac" depends="build-classes-javac">
+        <build-classes includes="${sjavac.includes}"/>
+    </target>
+
+    <target name="build-sjavac" depends="build-classes-sjavac">
+        <build-jar  name="sjavac" includes="${sjavac.includes}"
+                    jarmainclass="com.sun.tools.sjavac.Main"
+                    jarclasspath="sjavac.jar"/>
+        <build-tool name="sjavac"/>
+    </target>
+
+    <!-- (no javadoc for javap) -->
+
+    <target name="jtreg-sjavac" depends="build-sjavac,-def-jtreg">
+        <jtreg-tool name="sjavac" tests="${sjavac.tests}"/>
+    </target>
+
+    <target name="findbugs-sjavac" depends="build-sjavac,-def-findbugs">
+        <findbugs-tool name="sjavac"/>
+    </target>
+
+    <target name="sjavac" depends="build-sjavac,jtreg-sjavac,findbugs-sjavac"/>
 
     <!--
     **** Create import JDK stubs.
--- a/make/netbeans/langtools/nbproject/project.xml	Fri Jun 28 14:26:58 2013 +0100
+++ b/make/netbeans/langtools/nbproject/project.xml	Tue Jul 02 10:13:00 2013 +0100
@@ -29,15 +29,13 @@
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 -->
-
-<!DOCTYPE project [
-    <!ENTITY standard-ide-actions SYSTEM "standard-ide-actions.ent">
-    <!ENTITY standard-context-menu-items SYSTEM "standard-context-menu-items.ent">
-]>
 <project xmlns="http://www.netbeans.org/ns/project/1">
     <type>org.netbeans.modules.ant.freeform</type>
     <configuration>
         <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+            <name>langtools</name>
+        </general-data>
+        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
             <!-- Do not use Project Properties customizer when editing this file manually. -->
             <name>langtools</name>
             <properties>
@@ -49,11 +47,6 @@
                     <location>${root}</location>
                 </source-folder>
                 <source-folder>
-                    <label>Source files</label>
-                    <type>java</type>
-                    <location>${root}/src/share/classes</location>
-                </source-folder>
-                <source-folder>
                     <label>Test files</label>
                     <type>tests</type>
                     <location>${root}/test</location>
@@ -63,9 +56,169 @@
                     <type>build</type>
                     <location>${root}/make</location>
                 </source-folder>
+                <source-folder>
+                    <label>Source files</label>
+                    <type>java</type>
+                    <location>${root}/src/share/classes</location>
+                </source-folder>
+                <build-file>
+                    <location>${root}/build/classes</location>
+                </build-file>
             </folders>
             <ide-actions>
-                &standard-ide-actions;
+                <!--
+ Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+   - Neither the name of Oracle nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+                <!-- 
+ This file defines the standard actions accepted by langtools projects.
+ It is normally included as an entity into a project's project.xml file.
+
+ For information on these actions, see
+   - NetBeans: Setting Up Projects
+     at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html
+   - NetBeans: Advanced Freeform Project Configuration
+     at http://www.netbeans.org/kb/41/freeform-config.html 
+-->
+                <action name="build">
+                    <target>build</target>
+                </action>
+                <action name="clean">
+                    <target>clean</target>
+                </action>
+                <action name="rebuild">
+                    <target>clean</target>
+                    <target>build</target>
+                </action>
+                <action name="compile.single">
+                    <target>compile-single</target>
+                    <property name="srcdir">${root}/src/share/classes</property>
+                    <context>
+                        <property>includes</property>
+                        <folder>${root}/src/share/classes</folder>
+                        <pattern>\.java$</pattern>
+                        <format>relative-path</format>
+                        <arity>
+                            <separated-files>,</separated-files>
+                        </arity>
+                    </context>
+                </action>
+                <action name="run">
+                    <target>run</target>
+                </action>
+                <action name="run.single">
+                    <target>run-single</target>
+                    <context>
+                        <property>run.classname</property>
+                        <folder>${root}/src/share/classes</folder>
+                        <pattern>\.java$</pattern>
+                        <format>java-name</format>
+                        <arity>
+                            <one-file-only/>
+                        </arity>
+                    </context>
+                </action>
+                <!-- 
+ Note: NetBeans does not appear to support context menu items
+ on shell scripts :-(
+-->
+                <action name="run.single">
+                    <target>jtreg</target>
+                    <context>
+                        <property>jtreg.tests</property>
+                        <folder>${root}/test</folder>
+                        <pattern>\.(java|sh)$</pattern>
+                        <format>relative-path</format>
+                        <arity>
+                            <separated-files>,</separated-files>
+                        </arity>
+                    </context>
+                </action>
+                <action name="test">
+                    <target>jtreg</target>
+                </action>
+                <action name="debug">
+                    <target>debug</target>
+                </action>
+                <action name="debug.single">
+                    <target>debug-single</target>
+                    <context>
+                        <property>debug.classname</property>
+                        <folder>${root}/src/share/classes</folder>
+                        <pattern>\.java$</pattern>
+                        <format>java-name</format>
+                        <arity>
+                            <one-file-only/>
+                        </arity>
+                    </context>
+                </action>
+                <!-- 
+ Note: NetBeans does not appear to support context menu items
+ on shell scripts :-(
+-->
+                <action name="debug.single">
+                    <target>debug-jtreg</target>
+                    <context>
+                        <property>jtreg.tests</property>
+                        <folder>${root}/test</folder>
+                        <pattern>\.(java|sh)$</pattern>
+                        <format>relative-path</format>
+                        <arity>
+                            <one-file-only/>
+                        </arity>
+                    </context>
+                </action>
+                <action name="debug.fix">
+                    <target>debug-fix</target>
+                    <property name="srcdir">${root}/src/share/classes</property>
+                    <context>
+                        <property>class</property>
+                        <folder>${root}/src/share/classes</folder>
+                        <pattern>\.java$</pattern>
+                        <format>relative-path-noext</format>
+                        <arity>
+                            <one-file-only/>
+                        </arity>
+                    </context>
+                </action>
+                <action name="javadoc">
+                    <target>javadoc</target>
+                </action>
+                <action name="select-tool">
+                    <target>select-tool</target>
+                </action>
+                <action name="test-select-tool-1">
+                    <target>test-select-tool-1</target>
+                </action>
+                <action name="test-select-tool-2">
+                    <target>test-select-tool-2</target>
+                </action>
             </ide-actions>
             <export>
                 <type>folder</type>
@@ -86,13 +239,68 @@
                         <label>Build files</label>
                         <location>${root}/make</location>
                     </source-folder>
+                    <source-folder style="packages">
+                        <label>Source files</label>
+                        <location>${root}/src/share/classes</location>
+                    </source-folder>
                     <source-file>
                         <label>README</label>
                         <location>README</location>
                     </source-file>
                 </items>
                 <context-menu>
-                    &standard-context-menu-items;
+                    <!--
+ Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+   - Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+   - Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+   - Neither the name of Oracle nor the names of its
+     contributors may be used to endorse or promote products derived
+     from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+                    <!-- 
+ This file defines the actions that will appear on the project's context
+ menu, in the Projects viewer.
+ It is normally included as an entity into a project's project.xml file.
+
+ For information on these actions, see
+   - NetBeans: Setting Up Projects
+     at http://www.netbeans.org/kb/55/using-netbeans/project_setup.html
+   - NetBeans: Advanced Freeform Project Configuration
+     at http://www.netbeans.org/kb/41/freeform-config.html 
+-->
+                    <ide-action name="select-tool"/>
+                    <separator/>
+                    <ide-action name="build"/>
+                    <ide-action name="rebuild"/>
+                    <ide-action name="clean"/>
+                    <ide-action name="javadoc"/>
+                    <separator/>
+                    <ide-action name="run"/>
+                    <ide-action name="debug"/>
+                    <separator/>
+                    <ide-action name="test"/>
                 </context-menu>
             </view>
             <subprojects/>
@@ -101,7 +309,7 @@
             <compilation-unit>
                 <package-root>${root}/src/share/classes</package-root>
                 <built-to>${root}/build/classes</built-to>
-                <source-level>1.5</source-level>  <!-- FIXME -->
+                <source-level>1.5</source-level>
             </compilation-unit>
         </java-data>
     </configuration>
--- a/makefiles/BuildLangtools.gmk	Fri Jun 28 14:26:58 2013 +0100
+++ b/makefiles/BuildLangtools.gmk	Tue Jul 02 10:13:00 2013 +0100
@@ -75,6 +75,7 @@
 	printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties
 	printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties
 	printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties
+	printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties
 	echo Compiling $(words $(PROPSOURCES) v1 v2 v3) properties into resource bundles
 	$(TOOL_COMPILEPROPS_CMD) $(PROPCMDLINE) \
 		-compile 	$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties \
@@ -85,6 +86,9 @@
 				java.util.ListResourceBundle \
 		-compile	$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties \
 				$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.java \
+				java.util.ListResourceBundle \
+		-compile	$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties \
+				$(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.java \
 				java.util.ListResourceBundle
 	echo PROPS_ARE_CREATED=yes > $@
 
@@ -108,23 +112,7 @@
         $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVAC,$(BUILD_BOOTSTRAP_LANGTOOLS),\
 		SRCS:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap,\
 		JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar,\
-		JARMAIN:=com.sun.tools.javac.Main))
-
-        $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVAH,$(BUILD_BOOTSTRAP_LANGTOOLS),\
-		SRCS:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap,\
-		JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javah.jar,\
-		JARMAIN:=com.sun.tools.javah.Main))
-
-        $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVAP,$(BUILD_BOOTSTRAP_LANGTOOLS),\
-		SRCS:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap,\
-		JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javap.jar,\
-		JARMAIN:=com.sun.tools.javap.Main))
-
-        $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVADOC,$(BUILD_BOOTSTRAP_LANGTOOLS),\
-		SRCS:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap,\
-		JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javadoc.jar,\
-		SUFFIXES:=.class $(RESOURCE_SUFFIXES),\
-		JARMAIN:=com.sun.tools.javadoc.Main))
+		SUFFIXES:=.class $(RESOURCE_SUFFIXES)))
 
         # GenStubs is used to bootstrap any dependencies from javac to the new JDK that is not 
         # yet built. It is currently not needed but might be again in the future. The following
@@ -172,7 +160,8 @@
                 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE,\
                   JVM:=$(JAVA),\
                   JAVAC:="-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \
-			 -jar $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar,\
+			 -cp $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
+			 com.sun.tools.javac.Main,\
                   FLAGS:=-XDignore.symbol.file=true -Xlint:all$(COMMA)-deprecation -Werror,\
                   SERVER_DIR:=$(SJAVAC_SERVER_DIR),\
                   SERVER_JVM:=$(SJAVAC_SERVER_JAVA)))
@@ -197,11 +186,7 @@
 
                 all: 		$(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar \
 				$(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip \
-	                 	$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
-				$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javah.jar \
-				$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javap.jar \
-				$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javadoc.jar
-
+	                 	$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar
 
         endif
 endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/javadoc/AnnotatedType.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package com.sun.javadoc;
+
+
+/**
+ * Represents an annotated type.
+ * For example:
+ * <pre>
+ *      {@code @NonNull String}
+ *      {@code @Positive int}
+ * </pre>
+ *
+ * @author Mahmood Ali
+ * @since 1.8
+ */
+public interface AnnotatedType extends Type {
+
+    AnnotationDesc[] annotations();
+
+    Type underlyingType();
+}
--- a/src/share/classes/com/sun/javadoc/AnnotationDesc.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/javadoc/AnnotationDesc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -52,6 +52,12 @@
      */
     ElementValuePair[] elementValues();
 
+    /**
+     * Check for the synthesized bit on the annotation.
+     *
+     * @return true if the annotation is synthesized.
+     */
+    boolean isSynthesized();
 
     /**
      * Represents an association between an annotation type element
--- a/src/share/classes/com/sun/javadoc/ExecutableMemberDoc.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/javadoc/ExecutableMemberDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -88,6 +88,15 @@
     Parameter[] parameters();
 
     /**
+     * Get the receiver annotations of this executable element.
+     * Return an empty array if there are none.
+     *
+     * @return the receiver annotations of this executable element.
+     * @since 1.8
+     */
+    AnnotationDesc[] receiverAnnotations();
+
+    /**
      * Return the throws tags in this method.
      *
      * @return an array of ThrowTag containing all <code>&#64;exception</code>
--- a/src/share/classes/com/sun/javadoc/Type.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/javadoc/Type.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -142,6 +142,16 @@
     WildcardType asWildcardType();
 
     /**
+     * Returns this type as a <code>AnnotatedType</code> if it represents
+     * an annotated type.
+     *
+     * @return a <code>AnnotatedType</code> if the type if an annotated type,
+     *         or null if it is not
+     * @since 1.8
+     */
+    AnnotatedType asAnnotatedType();
+
+    /**
      * Return this type as an <code>AnnotationTypeDoc</code> if it represents
      * an annotation type.  Array dimensions are ignored.
      *
--- a/src/share/classes/com/sun/javadoc/TypeVariable.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/javadoc/TypeVariable.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 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
@@ -55,4 +55,11 @@
      *         which this type variable is declared.
      */
     ProgramElementDoc owner();
+
+    /**
+     * Get the annotations of this program element.
+     * Return an empty array if there are none.
+     */
+    public AnnotationDesc[] annotations();
+
 }
--- a/src/share/classes/com/sun/source/doctree/AttributeTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/AttributeTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -33,7 +33,9 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface AttributeTree extends DocTree {
+    @jdk.Supported
     enum ValueKind { EMPTY, UNQUOTED, SINGLE, DOUBLE };
 
     Name getName();
--- a/src/share/classes/com/sun/source/doctree/AuthorTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/AuthorTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface AuthorTree extends BlockTagTree {
     List<? extends DocTree> getName();
 }
--- a/src/share/classes/com/sun/source/doctree/BlockTagTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/BlockTagTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -31,6 +31,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface BlockTagTree extends DocTree {
     String getTagName();
 }
--- a/src/share/classes/com/sun/source/doctree/CommentTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/CommentTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -33,6 +33,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface CommentTree extends DocTree {
     String getBody();
 }
--- a/src/share/classes/com/sun/source/doctree/DeprecatedTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/DeprecatedTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface DeprecatedTree extends BlockTagTree {
     List<? extends DocTree> getBody();
 }
--- a/src/share/classes/com/sun/source/doctree/DocCommentTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/DocCommentTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface DocCommentTree extends DocTree {
     List<? extends DocTree> getFirstSentence();
     List<? extends DocTree> getBody();
--- a/src/share/classes/com/sun/source/doctree/DocRootTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/DocRootTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -33,4 +33,5 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface DocRootTree extends InlineTagTree { }
--- a/src/share/classes/com/sun/source/doctree/DocTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/DocTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -30,7 +30,9 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface DocTree {
+    @jdk.Supported
     enum Kind {
         /**
          * Used for instances of {@link AttributeTree}
--- a/src/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/DocTreeVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -54,6 +54,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface DocTreeVisitor<R,P> {
     R visitAttribute(AttributeTree node, P p);
     R visitAuthor(AuthorTree node, P p);
--- a/src/share/classes/com/sun/source/doctree/EndElementTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/EndElementTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface EndElementTree extends DocTree {
     Name getName();
 }
--- a/src/share/classes/com/sun/source/doctree/EntityTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/EntityTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -36,6 +36,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface EntityTree extends DocTree {
     Name getName();
 }
--- a/src/share/classes/com/sun/source/doctree/ErroneousTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/ErroneousTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -32,6 +32,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface ErroneousTree extends TextTree {
     /**
      * Gets a diagnostic object giving details about
--- a/src/share/classes/com/sun/source/doctree/IdentifierTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/IdentifierTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface IdentifierTree extends DocTree {
     Name getName();
 }
--- a/src/share/classes/com/sun/source/doctree/InheritDocTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/InheritDocTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -34,4 +34,5 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface InheritDocTree extends InlineTagTree { }
--- a/src/share/classes/com/sun/source/doctree/InlineTagTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/InlineTagTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -31,6 +31,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface InlineTagTree extends DocTree {
     String getTagName();
 }
--- a/src/share/classes/com/sun/source/doctree/LinkTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/LinkTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -36,6 +36,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface LinkTree extends InlineTagTree {
     ReferenceTree getReference();
     List<? extends DocTree> getLabel();
--- a/src/share/classes/com/sun/source/doctree/LiteralTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/LiteralTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -34,6 +34,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface LiteralTree extends InlineTagTree {
     TextTree getBody();
 }
--- a/src/share/classes/com/sun/source/doctree/ParamTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/ParamTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface ParamTree extends BlockTagTree {
     boolean isTypeParameter();
     IdentifierTree getName();
--- a/src/share/classes/com/sun/source/doctree/ReferenceTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/ReferenceTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -33,6 +33,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface ReferenceTree extends DocTree {
     String getSignature();
 }
--- a/src/share/classes/com/sun/source/doctree/ReturnTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/ReturnTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface ReturnTree extends BlockTagTree {
     List<? extends DocTree> getDescription();
 }
--- a/src/share/classes/com/sun/source/doctree/SeeTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/SeeTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -38,6 +38,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface SeeTree extends BlockTagTree {
     List<? extends DocTree> getReference();
 }
--- a/src/share/classes/com/sun/source/doctree/SerialDataTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/SerialDataTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface SerialDataTree extends BlockTagTree {
     List<? extends DocTree> getDescription();
 }
--- a/src/share/classes/com/sun/source/doctree/SerialFieldTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/SerialFieldTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface SerialFieldTree extends BlockTagTree {
     IdentifierTree getName();
     ReferenceTree getType();
--- a/src/share/classes/com/sun/source/doctree/SerialTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/SerialTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface SerialTree extends BlockTagTree {
     List<? extends DocTree> getDescription();
 }
--- a/src/share/classes/com/sun/source/doctree/SinceTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/SinceTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface SinceTree extends BlockTagTree {
     List<? extends DocTree> getBody();
 }
--- a/src/share/classes/com/sun/source/doctree/StartElementTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/StartElementTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -36,6 +36,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface StartElementTree extends DocTree {
     Name getName();
     List<? extends DocTree> getAttributes();
--- a/src/share/classes/com/sun/source/doctree/TextTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/TextTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -30,6 +30,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface TextTree extends DocTree {
     String getBody();
 }
--- a/src/share/classes/com/sun/source/doctree/ThrowsTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/ThrowsTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -38,6 +38,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface ThrowsTree extends BlockTagTree {
     ReferenceTree getExceptionName();
     List<? extends DocTree> getDescription();
--- a/src/share/classes/com/sun/source/doctree/UnknownBlockTagTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/UnknownBlockTagTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  * @since 1.8
  *
  */
+@jdk.Supported
 public interface UnknownBlockTagTree extends BlockTagTree {
     List<? extends DocTree> getContent();
 }
--- a/src/share/classes/com/sun/source/doctree/UnknownInlineTagTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/UnknownInlineTagTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -35,6 +35,7 @@
  * @since 1.8
  *
  */
+@jdk.Supported
 public interface UnknownInlineTagTree extends InlineTagTree {
     List<? extends DocTree> getContent();
 }
--- a/src/share/classes/com/sun/source/doctree/ValueTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/ValueTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -33,6 +33,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface ValueTree extends InlineTagTree {
     ReferenceTree getReference();
 }
--- a/src/share/classes/com/sun/source/doctree/VersionTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/VersionTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -36,6 +36,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface VersionTree extends BlockTagTree {
     List<? extends DocTree> getBody();
 }
--- a/src/share/classes/com/sun/source/doctree/package-info.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/doctree/package-info.java	Tue Jul 02 10:13:00 2013 +0100
@@ -31,4 +31,5 @@
  * @since 1.8
  * @see <a href="http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#javadoctags">http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#javadoctags</a>
  */
+@jdk.Supported
 package com.sun.source.doctree;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/source/tree/AnnotatedTypeTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,48 @@
+/*
+ * 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.  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.source.tree;
+
+import java.util.List;
+
+/**
+ * A tree node for an annotated type
+ *
+ * For example:
+ * <pre>
+ *    {@code @}<em>annotationType String</em>
+ *    {@code @}<em>annotationType</em> ( <em>arguments</em> ) <em>Date</em>
+ * </pre>
+ *
+ * @see "JSR 308: Annotations on Java Types"
+ *
+ * @author Mahmood Ali
+ * @since 1.8
+ */
+@jdk.Supported
+public interface AnnotatedTypeTree extends ExpressionTree {
+    List<? extends AnnotationTree> getAnnotations();
+    ExpressionTree getUnderlyingType();
+}
--- a/src/share/classes/com/sun/source/tree/AnnotationTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/AnnotationTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -42,6 +42,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface AnnotationTree extends ExpressionTree {
     Tree getAnnotationType();
     List<? extends ExpressionTree> getArguments();
--- a/src/share/classes/com/sun/source/tree/ArrayAccessTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ArrayAccessTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -39,6 +39,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ArrayAccessTree extends ExpressionTree {
     ExpressionTree getExpression();
     ExpressionTree getIndex();
--- a/src/share/classes/com/sun/source/tree/ArrayTypeTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ArrayTypeTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -39,6 +39,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ArrayTypeTree extends Tree {
     Tree getType();
 }
--- a/src/share/classes/com/sun/source/tree/AssertTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/AssertTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface AssertTree extends StatementTree {
     ExpressionTree getCondition();
     ExpressionTree getDetail();
--- a/src/share/classes/com/sun/source/tree/AssignmentTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/AssignmentTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -39,6 +39,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface AssignmentTree extends ExpressionTree {
     ExpressionTree getVariable();
     ExpressionTree getExpression();
--- a/src/share/classes/com/sun/source/tree/BinaryTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/BinaryTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -40,6 +40,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface BinaryTree extends ExpressionTree {
     ExpressionTree getLeftOperand();
     ExpressionTree getRightOperand();
--- a/src/share/classes/com/sun/source/tree/BlockTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/BlockTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -45,6 +45,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface BlockTree extends StatementTree {
     boolean isStatic();
     List<? extends StatementTree> getStatements();
--- a/src/share/classes/com/sun/source/tree/BreakTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/BreakTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -43,6 +43,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface BreakTree extends StatementTree {
     Name getLabel();
 }
--- a/src/share/classes/com/sun/source/tree/CaseTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/CaseTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -45,6 +45,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface CaseTree extends Tree {
     /**
      * @return null if and only if this Case is {@code default:}
--- a/src/share/classes/com/sun/source/tree/CatchTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/CatchTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -40,6 +40,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface CatchTree extends Tree {
     VariableTree getParameter();
     BlockTree getBlock();
--- a/src/share/classes/com/sun/source/tree/ClassTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ClassTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -48,6 +48,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ClassTree extends StatementTree {
     ModifiersTree getModifiers();
     Name getSimpleName();
--- a/src/share/classes/com/sun/source/tree/CompilationUnitTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/CompilationUnitTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -37,6 +37,7 @@
  * @author Peter von der Ah&eacute;
  * @since 1.6
  */
+@jdk.Supported
 public interface CompilationUnitTree extends Tree {
     List<? extends AnnotationTree> getPackageAnnotations();
     ExpressionTree getPackageName();
--- a/src/share/classes/com/sun/source/tree/CompoundAssignmentTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/CompoundAssignmentTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -40,6 +40,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface CompoundAssignmentTree extends ExpressionTree {
     ExpressionTree getVariable();
     ExpressionTree getExpression();
--- a/src/share/classes/com/sun/source/tree/ConditionalExpressionTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ConditionalExpressionTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -39,6 +39,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ConditionalExpressionTree extends ExpressionTree {
     ExpressionTree getCondition();
     ExpressionTree getTrueExpression();
--- a/src/share/classes/com/sun/source/tree/ContinueTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ContinueTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -42,6 +42,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ContinueTree extends StatementTree {
     Name getLabel();
 }
--- a/src/share/classes/com/sun/source/tree/DoWhileLoopTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/DoWhileLoopTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface DoWhileLoopTree extends StatementTree {
     ExpressionTree getCondition();
     StatementTree getStatement();
--- a/src/share/classes/com/sun/source/tree/EmptyStatementTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/EmptyStatementTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -39,4 +39,5 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface EmptyStatementTree extends StatementTree {}
--- a/src/share/classes/com/sun/source/tree/EnhancedForLoopTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/EnhancedForLoopTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -40,6 +40,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface EnhancedForLoopTree extends StatementTree {
     VariableTree getVariable();
     ExpressionTree getExpression();
--- a/src/share/classes/com/sun/source/tree/ErroneousTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ErroneousTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -34,6 +34,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ErroneousTree extends ExpressionTree {
     List<? extends Tree> getErrorTrees();
 }
--- a/src/share/classes/com/sun/source/tree/ExpressionStatementTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ExpressionStatementTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -39,6 +39,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ExpressionStatementTree extends StatementTree {
     ExpressionTree getExpression();
 }
--- a/src/share/classes/com/sun/source/tree/ExpressionTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ExpressionTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -35,4 +35,5 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ExpressionTree extends Tree {}
--- a/src/share/classes/com/sun/source/tree/ForLoopTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ForLoopTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -42,6 +42,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ForLoopTree extends StatementTree {
     List<? extends StatementTree> getInitializer();
     ExpressionTree getCondition();
--- a/src/share/classes/com/sun/source/tree/IdentifierTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/IdentifierTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface IdentifierTree extends ExpressionTree {
     Name getName();
 }
--- a/src/share/classes/com/sun/source/tree/IfTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/IfTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -45,6 +45,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface IfTree extends StatementTree {
     ExpressionTree getCondition();
     StatementTree getThenStatement();
--- a/src/share/classes/com/sun/source/tree/ImportTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ImportTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ImportTree extends Tree {
     boolean isStatic();
     /**
--- a/src/share/classes/com/sun/source/tree/InstanceOfTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/InstanceOfTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -39,6 +39,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface InstanceOfTree extends ExpressionTree {
     ExpressionTree getExpression();
     Tree getType();
--- a/src/share/classes/com/sun/source/tree/IntersectionTypeTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/IntersectionTypeTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -34,6 +34,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface IntersectionTypeTree extends Tree {
     List<? extends Tree> getBounds();
 }
--- a/src/share/classes/com/sun/source/tree/LabeledStatementTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/LabeledStatementTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface LabeledStatementTree extends StatementTree {
     Name getLabel();
     StatementTree getStatement();
--- a/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -37,12 +37,14 @@
  *   (x,y)-> { return x + y; }
  * }</pre>
  */
+@jdk.Supported
 public interface LambdaExpressionTree extends ExpressionTree {
 
     /**
      * Lambda expressions come in two forms: (i) expression lambdas, whose body
      * is an expression, and (ii) statement lambdas, whose body is a block
      */
+    @jdk.Supported
     public enum BodyKind {
         /** enum constant for expression lambdas */
         EXPRESSION,
--- a/src/share/classes/com/sun/source/tree/LineMap.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/LineMap.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -31,6 +31,7 @@
  *
  * @since 1.6
  */
+@jdk.Supported
 public interface LineMap {
     /**
      * Find the start position of a line.
--- a/src/share/classes/com/sun/source/tree/LiteralTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/LiteralTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -40,6 +40,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface LiteralTree extends ExpressionTree {
     Object getValue();
 }
--- a/src/share/classes/com/sun/source/tree/MemberReferenceTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/MemberReferenceTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -39,12 +39,14 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface MemberReferenceTree extends ExpressionTree {
 
     /**
      * There are two kinds of member references: (i) method references and
      * (ii) constructor references
      */
+    @jdk.Supported
     public enum ReferenceMode {
         /** enum constant for method references */
         INVOKE,
--- a/src/share/classes/com/sun/source/tree/MemberSelectTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/MemberSelectTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface MemberSelectTree extends ExpressionTree {
     ExpressionTree getExpression();
     Name getIdentifier();
--- a/src/share/classes/com/sun/source/tree/MethodInvocationTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/MethodInvocationTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -43,6 +43,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface MethodInvocationTree extends ExpressionTree {
     List<? extends Tree> getTypeArguments();
     ExpressionTree getMethodSelect();
--- a/src/share/classes/com/sun/source/tree/MethodTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/MethodTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -46,12 +46,14 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface MethodTree extends Tree {
     ModifiersTree getModifiers();
     Name getName();
     Tree getReturnType();
     List<? extends TypeParameterTree> getTypeParameters();
     List<? extends VariableTree> getParameters();
+    VariableTree getReceiverParameter();
     List<? extends ExpressionTree> getThrows();
     BlockTree getBody();
     Tree getDefaultValue(); // for annotation types
--- a/src/share/classes/com/sun/source/tree/ModifiersTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ModifiersTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -45,6 +45,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ModifiersTree extends Tree {
     Set<Modifier> getFlags();
     List<? extends AnnotationTree> getAnnotations();
--- a/src/share/classes/com/sun/source/tree/NewArrayTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/NewArrayTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -43,6 +43,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface NewArrayTree extends ExpressionTree {
     Tree getType();
     List<? extends ExpressionTree> getDimensions();
--- a/src/share/classes/com/sun/source/tree/NewClassTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/NewClassTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -48,6 +48,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface NewClassTree extends ExpressionTree {
     ExpressionTree getEnclosingExpression();
     List<? extends Tree> getTypeArguments();
--- a/src/share/classes/com/sun/source/tree/ParameterizedTypeTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ParameterizedTypeTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ParameterizedTypeTree extends Tree {
     Tree getType();
     List<? extends Tree> getTypeArguments();
--- a/src/share/classes/com/sun/source/tree/ParenthesizedTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ParenthesizedTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -40,6 +40,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ParenthesizedTree extends ExpressionTree {
     ExpressionTree getExpression();
 }
--- a/src/share/classes/com/sun/source/tree/PrimitiveTypeTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/PrimitiveTypeTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface PrimitiveTypeTree extends Tree {
     TypeKind getPrimitiveTypeKind();
 }
--- a/src/share/classes/com/sun/source/tree/ReturnTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ReturnTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -40,6 +40,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ReturnTree extends StatementTree {
     ExpressionTree getExpression();
 }
--- a/src/share/classes/com/sun/source/tree/Scope.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/Scope.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -48,6 +48,7 @@
  *
  * @since 1.6
  */
+@jdk.Supported
 public interface Scope {
     /**
      * Returns the enclosing scope.
--- a/src/share/classes/com/sun/source/tree/StatementTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/StatementTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -35,4 +35,5 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface StatementTree extends Tree {}
--- a/src/share/classes/com/sun/source/tree/SwitchTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/SwitchTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -43,6 +43,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface SwitchTree extends StatementTree {
     ExpressionTree getExpression();
     List<? extends CaseTree> getCases();
--- a/src/share/classes/com/sun/source/tree/SynchronizedTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/SynchronizedTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -40,6 +40,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface SynchronizedTree extends StatementTree {
     ExpressionTree getExpression();
     BlockTree getBlock();
--- a/src/share/classes/com/sun/source/tree/ThrowTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/ThrowTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -39,6 +39,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface ThrowTree extends StatementTree {
     ExpressionTree getExpression();
 }
--- a/src/share/classes/com/sun/source/tree/Tree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/Tree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -39,19 +39,30 @@
  *
  * @since 1.6
  */
+@jdk.Supported
 public interface Tree {
 
     /**
      * Enumerates all kinds of trees.
      */
+    @jdk.Supported
     public enum Kind {
 
+        ANNOTATED_TYPE(AnnotatedTypeTree.class),
+
         /**
-         * Used for instances of {@link AnnotationTree}.
+         * Used for instances of {@link AnnotationTree}
+         * representing declaration annotations.
          */
         ANNOTATION(AnnotationTree.class),
 
         /**
+         * Used for instances of {@link AnnotationTree}
+         * representing type annotations.
+         */
+        TYPE_ANNOTATION(AnnotationTree.class),
+
+        /**
          * Used for instances of {@link ArrayAccessTree}.
          */
         ARRAY_ACCESS(ArrayAccessTree.class),
--- a/src/share/classes/com/sun/source/tree/TreeVisitor.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/TreeVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -56,7 +56,9 @@
  *
  * @since 1.6
  */
+@jdk.Supported
 public interface TreeVisitor<R,P> {
+    R visitAnnotatedType(AnnotatedTypeTree node, P p);
     R visitAnnotation(AnnotationTree node, P p);
     R visitMethodInvocation(MethodInvocationTree node, P p);
     R visitAssert(AssertTree node, P p);
--- a/src/share/classes/com/sun/source/tree/TryTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/TryTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
@@ -45,6 +45,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface TryTree extends StatementTree {
     BlockTree getBlock();
     List<? extends CatchTree> getCatches();
--- a/src/share/classes/com/sun/source/tree/TypeCastTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/TypeCastTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -39,6 +39,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface TypeCastTree extends ExpressionTree {
     Tree getType();
     ExpressionTree getExpression();
--- a/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -44,7 +44,9 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface TypeParameterTree extends Tree {
     Name getName();
     List<? extends Tree> getBounds();
+    List<? extends AnnotationTree> getAnnotations();
 }
--- a/src/share/classes/com/sun/source/tree/UnaryTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/UnaryTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -42,6 +42,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface UnaryTree extends ExpressionTree {
     ExpressionTree getExpression();
 }
--- a/src/share/classes/com/sun/source/tree/UnionTypeTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/UnionTypeTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -34,6 +34,7 @@
  *
  * @since 1.7
  */
+@jdk.Supported
 public interface UnionTypeTree extends Tree {
     List<? extends Tree> getTypeAlternatives();
 }
--- a/src/share/classes/com/sun/source/tree/VariableTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/VariableTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface VariableTree extends StatementTree {
     ModifiersTree getModifiers();
     Name getName();
--- a/src/share/classes/com/sun/source/tree/WhileLoopTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/WhileLoopTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -41,6 +41,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface WhileLoopTree extends StatementTree {
     ExpressionTree getCondition();
     StatementTree getStatement();
--- a/src/share/classes/com/sun/source/tree/WildcardTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/WildcardTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -44,6 +44,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface WildcardTree extends Tree {
     Tree getBound();
 }
--- a/src/share/classes/com/sun/source/tree/package-info.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/tree/package-info.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -31,4 +31,5 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 package com.sun.source.tree;
--- a/src/share/classes/com/sun/source/util/DocTreeScanner.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/DocTreeScanner.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -53,7 +53,7 @@
  *
  * <p>Here is an example to count the number of erroneous nodes in a tree:
  * <pre>
- *   class CountErrors extends DocTreeScanner<Integer,Void> {
+ *   class CountErrors extends DocTreeScanner&lt;Integer,Void&gt; {
  *      {@literal @}Override
  *      public Integer visitErroneous(ErroneousTree node, Void p) {
  *          return 1;
@@ -67,6 +67,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public class DocTreeScanner<R,P> implements DocTreeVisitor<R,P> {
 
     /**
--- a/src/share/classes/com/sun/source/util/DocTrees.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/DocTrees.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -38,6 +38,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public abstract class DocTrees extends Trees {
     /**
      * Gets a DocTrees object for a given CompilationTask.
--- a/src/share/classes/com/sun/source/util/JavacTask.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/JavacTask.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -48,6 +48,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public abstract class JavacTask implements CompilationTask {
 
     /**
@@ -55,7 +56,7 @@
      * If the compiler is being invoked using a
      * {@link javax.tools.JavaCompiler.CompilationTask CompilationTask},
      * then that task will be returned.
-     * @param processingEnvironment
+     * @param processingEnvironment the processing environment
      * @return the {@code JavacTask} for a {@code ProcessingEnvironment}
      * @since 1.8
      */
--- a/src/share/classes/com/sun/source/util/Plugin.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/Plugin.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -38,7 +38,7 @@
  *
  * <p>Plug-ins are located via a {@link ServiceLoader},
  * using the same class path as annotation processors (i.e.
- * {@link StandardLocation#PROCESSOR_PATH PROCESSOR_PATH} or
+ * {@link StandardLocation#ANNOTATION_PROCESSOR_PATH ANNOTATION_PROCESSOR_PATH} or
  * {@code -processorpath}).
  *
  * <p>It is expected that a typical plug-in will simply register a
@@ -48,6 +48,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public interface Plugin {
     /**
      * Get the user-friendly name of this plug-in.
--- a/src/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -32,6 +32,7 @@
  *
  * @since 1.8
  */
+@jdk.Supported
 public class SimpleDocTreeVisitor<R,P> implements DocTreeVisitor<R, P> {
     protected final R DEFAULT_VALUE;
 
--- a/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -33,6 +33,7 @@
  * @author Peter von der Ah&eacute;
  * @since 1.6
  */
+@jdk.Supported
 public class SimpleTreeVisitor <R,P> implements TreeVisitor<R,P> {
     protected final R DEFAULT_VALUE;
 
@@ -260,6 +261,10 @@
         return defaultAction(node, p);
     }
 
+    public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
+        return defaultAction(node, p);
+    }
+
     public R visitErroneous(ErroneousTree node, P p) {
         return defaultAction(node, p);
     }
--- a/src/share/classes/com/sun/source/util/SourcePositions.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/SourcePositions.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -35,6 +35,7 @@
  * @author Peter von der Ah&eacute;
  * @since 1.6
  */
+@jdk.Supported
 public interface SourcePositions {
 
     /**
--- a/src/share/classes/com/sun/source/util/TaskEvent.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/TaskEvent.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -36,12 +36,14 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public final class TaskEvent
 {
     /**
      * Kind of task event.
      * @since 1.6
      */
+    @jdk.Supported
     public enum Kind {
         /**
          * For events related to the parsing of a file.
@@ -60,7 +62,7 @@
          **/
         GENERATE,
         /**
-         * For events relating to overall annotaion processing.
+         * For events relating to overall annotation processing.
          **/
         ANNOTATION_PROCESSING,
         /**
--- a/src/share/classes/com/sun/source/util/TaskListener.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/TaskListener.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -32,6 +32,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public interface TaskListener
 {
     public void started(TaskEvent e);
--- a/src/share/classes/com/sun/source/util/TreePath.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/TreePath.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -36,6 +36,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public class TreePath implements Iterable<Tree> {
     /**
      * Gets a tree path for a tree node within a compilation unit.
--- a/src/share/classes/com/sun/source/util/TreePathScanner.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/TreePathScanner.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -38,6 +38,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public class TreePathScanner<R, P> extends TreeScanner<R, P> {
 
     /**
--- a/src/share/classes/com/sun/source/util/TreeScanner.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/TreeScanner.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -68,6 +68,7 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 public class TreeScanner<R,P> implements TreeVisitor<R,P> {
 
     /** Scan a single node.
@@ -138,6 +139,7 @@
         r = scanAndReduce(node.getReturnType(), p, r);
         r = scanAndReduce(node.getTypeParameters(), p, r);
         r = scanAndReduce(node.getParameters(), p, r);
+        r = scanAndReduce(node.getReceiverParameter(), p, r);
         r = scanAndReduce(node.getThrows(), p, r);
         r = scanAndReduce(node.getBody(), p, r);
         r = scanAndReduce(node.getDefaultValue(), p, r);
@@ -376,7 +378,8 @@
     }
 
     public R visitTypeParameter(TypeParameterTree node, P p) {
-        R r = scan(node.getBounds(), p);
+        R r = scan(node.getAnnotations(), p);
+        r = scanAndReduce(node.getBounds(), p, r);
         return r;
     }
 
@@ -394,6 +397,12 @@
         return r;
     }
 
+   public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
+       R r = scan(node.getAnnotations(), p);
+       r = scanAndReduce(node.getUnderlyingType(), p, r);
+       return r;
+   }
+
     public R visitOther(Tree node, P p) {
         return null;
     }
--- a/src/share/classes/com/sun/source/util/Trees.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/Trees.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -51,6 +51,7 @@
  *
  * @author Peter von der Ah&eacute;
  */
+@jdk.Supported
 public abstract class Trees {
     /**
      * Gets a Trees object for a given CompilationTask.
--- a/src/share/classes/com/sun/source/util/package-info.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/source/util/package-info.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -30,4 +30,5 @@
  * @author Jonathan Gibbons
  * @since 1.6
  */
+@jdk.Supported
 package com.sun.source.util;
--- a/src/share/classes/com/sun/tools/classfile/AccessFlags.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/classfile/AccessFlags.java	Tue Jul 02 10:13:00 2013 +0100
@@ -56,7 +56,7 @@
     public static final int ACC_SYNTHETIC     = 0x1000; // class, inner, field, method
     public static final int ACC_ANNOTATION    = 0x2000; // class, inner
     public static final int ACC_ENUM          = 0x4000; // class, inner, field
-    public static final int ACC_MODULE        = 0x8000; // class, inner, field, method
+    public static final int ACC_MANDATED      = 0x8000; // class, inner, field, method
 
     public static enum Kind { Class, InnerClass, Field, Method};
 
@@ -81,12 +81,12 @@
     }
 
     private static final int[] classModifiers = {
-        ACC_PUBLIC, ACC_FINAL, ACC_ABSTRACT, ACC_MODULE
+        ACC_PUBLIC, ACC_FINAL, ACC_ABSTRACT
     };
 
     private static final int[] classFlags = {
         ACC_PUBLIC, ACC_FINAL, ACC_SUPER, ACC_INTERFACE, ACC_ABSTRACT,
-        ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM, ACC_MODULE
+        ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
     };
 
     public Set<String> getClassModifiers() {
@@ -100,12 +100,12 @@
 
     private static final int[] innerClassModifiers = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
-        ACC_ABSTRACT, ACC_MODULE
+        ACC_ABSTRACT
     };
 
     private static final int[] innerClassFlags = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_SUPER,
-        ACC_INTERFACE, ACC_ABSTRACT, ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM, ACC_MODULE
+        ACC_INTERFACE, ACC_ABSTRACT, ACC_SYNTHETIC, ACC_ANNOTATION, ACC_ENUM
     };
 
     public Set<String> getInnerClassModifiers() {
@@ -119,12 +119,12 @@
 
     private static final int[] fieldModifiers = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
-        ACC_VOLATILE, ACC_TRANSIENT, ACC_MODULE
+        ACC_VOLATILE, ACC_TRANSIENT
     };
 
     private static final int[] fieldFlags = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
-        ACC_VOLATILE, ACC_TRANSIENT, ACC_SYNTHETIC, ACC_ENUM, ACC_MODULE
+        ACC_VOLATILE, ACC_TRANSIENT, ACC_SYNTHETIC, ACC_ENUM
     };
 
     public Set<String> getFieldModifiers() {
@@ -137,13 +137,13 @@
 
     private static final int[] methodModifiers = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
-        ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT, ACC_STRICT, ACC_MODULE
+        ACC_SYNCHRONIZED, ACC_NATIVE, ACC_ABSTRACT, ACC_STRICT
     };
 
     private static final int[] methodFlags = {
         ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL,
         ACC_SYNCHRONIZED, ACC_BRIDGE, ACC_VARARGS, ACC_NATIVE, ACC_ABSTRACT,
-        ACC_STRICT, ACC_SYNTHETIC, ACC_MODULE
+        ACC_STRICT, ACC_SYNTHETIC
     };
 
     public Set<String> getMethodModifiers() {
@@ -208,8 +208,8 @@
                 return "abstract";
             case ACC_STRICT:
                 return "strictfp";
-            case ACC_MODULE:
-                return "module";
+            case ACC_MANDATED:
+                return "mandated";
             default:
                 return null;
         }
@@ -247,8 +247,8 @@
             return "ACC_ANNOTATION";
         case ACC_ENUM:
             return "ACC_ENUM";
-        case ACC_MODULE:
-            return "ACC_MODULE";
+        case ACC_MANDATED:
+            return "ACC_MANDATED";
         default:
             return null;
         }
--- a/src/share/classes/com/sun/tools/classfile/Attribute.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/classfile/Attribute.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, 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
@@ -51,10 +51,13 @@
     public static final String LineNumberTable          = "LineNumberTable";
     public static final String LocalVariableTable       = "LocalVariableTable";
     public static final String LocalVariableTypeTable   = "LocalVariableTypeTable";
+    public static final String MethodParameters         = "MethodParameters";
     public static final String RuntimeVisibleAnnotations = "RuntimeVisibleAnnotations";
     public static final String RuntimeInvisibleAnnotations = "RuntimeInvisibleAnnotations";
     public static final String RuntimeVisibleParameterAnnotations = "RuntimeVisibleParameterAnnotations";
     public static final String RuntimeInvisibleParameterAnnotations = "RuntimeInvisibleParameterAnnotations";
+    public static final String RuntimeVisibleTypeAnnotations = "RuntimeVisibleTypeAnnotations";
+    public static final String RuntimeInvisibleTypeAnnotations = "RuntimeInvisibleTypeAnnotations";
     public static final String Signature                = "Signature";
     public static final String SourceDebugExtension     = "SourceDebugExtension";
     public static final String SourceFile               = "SourceFile";
@@ -113,11 +116,14 @@
             standardAttributes.put(LocalVariableTypeTable, LocalVariableTypeTable_attribute.class);
 
             if (!compat) { // old javap does not recognize recent attributes
+                standardAttributes.put(MethodParameters, MethodParameters_attribute.class);
                 standardAttributes.put(CompilationID, CompilationID_attribute.class);
                 standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
                 standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
                 standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
                 standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
+                standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
+                standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
                 standardAttributes.put(Signature,     Signature_attribute.class);
                 standardAttributes.put(SourceID, SourceID_attribute.class);
             }
@@ -171,10 +177,13 @@
         R visitLineNumberTable(LineNumberTable_attribute attr, P p);
         R visitLocalVariableTable(LocalVariableTable_attribute attr, P p);
         R visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, P p);
+        R visitMethodParameters(MethodParameters_attribute attr, P p);
         R visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, P p);
         R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p);
         R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p);
         R visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, P p);
+        R visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, P p);
+        R visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, P p);
         R visitSignature(Signature_attribute attr, P p);
         R visitSourceDebugExtension(SourceDebugExtension_attribute attr, P p);
         R visitSourceFile(SourceFile_attribute attr, P p);
--- a/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -479,6 +479,15 @@
             out.writeShort(entry.index);
         }
 
+        public Void visitMethodParameters(MethodParameters_attribute attr, ClassOutputStream out) {
+            out.writeByte(attr.method_parameter_table.length);
+            for (MethodParameters_attribute.Entry e : attr.method_parameter_table) {
+                out.writeShort(e.name_index);
+                out.writeShort(e.flags);
+            }
+            return null;
+        }
+
         public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, ClassOutputStream out) {
             annotationWriter.write(attr.annotations, out);
             return null;
@@ -489,6 +498,16 @@
             return null;
         }
 
+        public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
+            annotationWriter.write(attr.annotations, out);
+            return null;
+        }
+
+        public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, ClassOutputStream out) {
+            annotationWriter.write(attr.annotations, out);
+            return null;
+        }
+
         public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, ClassOutputStream out) {
             out.writeByte(attr.parameter_annotations.length);
             for (Annotation[] annos: attr.parameter_annotations)
@@ -648,6 +667,12 @@
                 write(anno, out);
         }
 
+        public void write(TypeAnnotation[] annos, ClassOutputStream out) {
+            out.writeShort(annos.length);
+            for (TypeAnnotation anno: annos)
+                write(anno, out);
+        }
+
         public void write(Annotation anno, ClassOutputStream out) {
             out.writeShort(anno.type_index);
             out.writeShort(anno.element_value_pairs.length);
@@ -655,6 +680,11 @@
                 write(p, out);
         }
 
+        public void write(TypeAnnotation anno, ClassOutputStream out) {
+            write(anno.position, out);
+            write(anno.annotation, out);
+        }
+
         public void write(element_value_pair pair, ClassOutputStream out) {
             out.writeShort(pair.element_name_index);
             write(pair.value, out);
@@ -693,5 +723,89 @@
             return null;
         }
 
+        // TODO: Move this to TypeAnnotation to be closer with similar logic?
+        private void write(TypeAnnotation.Position p, ClassOutputStream out) {
+            out.writeByte(p.type.targetTypeValue());
+            switch (p.type) {
+            // instanceof
+            case INSTANCEOF:
+            // new expression
+            case NEW:
+            // constructor/method reference receiver
+            case CONSTRUCTOR_REFERENCE:
+            case METHOD_REFERENCE:
+                out.writeShort(p.offset);
+                break;
+            // local variable
+            case LOCAL_VARIABLE:
+            // resource variable
+            case RESOURCE_VARIABLE:
+                int table_length = p.lvarOffset.length;
+                out.writeShort(table_length);
+                for (int i = 0; i < table_length; ++i) {
+                    out.writeShort(1);  // for table length
+                    out.writeShort(p.lvarOffset[i]);
+                    out.writeShort(p.lvarLength[i]);
+                    out.writeShort(p.lvarIndex[i]);
+                }
+                break;
+            // exception parameter
+            case EXCEPTION_PARAMETER:
+                out.writeByte(p.exception_index);
+                break;
+            // method receiver
+            case METHOD_RECEIVER:
+                // Do nothing
+                break;
+            // type parameters
+            case CLASS_TYPE_PARAMETER:
+            case METHOD_TYPE_PARAMETER:
+                out.writeByte(p.parameter_index);
+                break;
+            // type parameters bounds
+            case CLASS_TYPE_PARAMETER_BOUND:
+            case METHOD_TYPE_PARAMETER_BOUND:
+                out.writeByte(p.parameter_index);
+                out.writeByte(p.bound_index);
+                break;
+            // class extends or implements clause
+            case CLASS_EXTENDS:
+                out.writeByte(p.type_index);
+                break;
+            // throws
+            case THROWS:
+                out.writeByte(p.type_index);
+                break;
+            // method parameter
+            case METHOD_FORMAL_PARAMETER:
+                out.writeByte(p.parameter_index);
+                break;
+            // type cast
+            case CAST:
+            // method/constructor/reference type argument
+            case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+            case METHOD_INVOCATION_TYPE_ARGUMENT:
+            case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+            case METHOD_REFERENCE_TYPE_ARGUMENT:
+                out.writeShort(p.offset);
+                out.writeByte(p.type_index);
+                break;
+            // We don't need to worry about these
+            case METHOD_RETURN:
+            case FIELD:
+                break;
+            case UNKNOWN:
+                throw new AssertionError("ClassWriter: UNKNOWN target type should never occur!");
+            default:
+                throw new AssertionError("ClassWriter: Unknown target type for position: " + p);
+            }
+
+            { // Append location data for generics/arrays.
+                // TODO: check for overrun?
+                out.writeByte((byte)p.location.size());
+                for (int i : TypeAnnotation.Position.getBinaryFromTypePath(p.location))
+                    out.writeByte((byte)i);
+            }
+        }
     }
 }
--- a/src/share/classes/com/sun/tools/classfile/Code_attribute.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/classfile/Code_attribute.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2009, 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
@@ -38,7 +38,7 @@
  *  deletion without notice.</b>
  */
 public class Code_attribute extends Attribute {
-    public class InvalidIndex extends AttributeException {
+    public static class InvalidIndex extends AttributeException {
         private static final long serialVersionUID = -8904527774589382802L;
         InvalidIndex(int index) {
             this.index = index;
@@ -143,7 +143,7 @@
     public final Exception_data[] exception_table;
     public final Attributes attributes;
 
-    public class Exception_data {
+    public static class Exception_data {
         Exception_data(ClassReader cr) throws IOException {
             start_pc = cr.readUnsignedShort();
             end_pc = cr.readUnsignedShort();
--- a/src/share/classes/com/sun/tools/classfile/Dependencies.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/classfile/Dependencies.java	Tue Jul 02 10:13:00 2013 +0100
@@ -142,6 +142,15 @@
     }
 
     /**
+     * Get a finder to do class dependency analysis.
+     *
+     * @return a Class dependency finder
+     */
+    public static Finder getClassDependencyFinder() {
+        return new ClassDependencyFinder();
+    }
+
+    /**
      * Get the finder used to locate the dependencies for a class.
      * @return the finder
      */
@@ -246,8 +255,6 @@
         return results;
     }
 
-
-
     /**
      * Find the dependencies of a class, using the current
      * {@link Dependencies#getFinder finder} and
@@ -306,38 +313,44 @@
      * A location identifying a class.
      */
     static class SimpleLocation implements Location {
-        public SimpleLocation(String className) {
-            this.className = className;
+        public SimpleLocation(String name) {
+            this.name = name;
+            this.className = name.replace('/', '.').replace('$', '.');
         }
 
-        /**
-         * Get the name of the class being depended on. This name will be used to
-         * locate the class file for transitive dependency analysis.
-         * @return the name of the class being depended on
-         */
+        public String getName() {
+            return name;
+        }
+
         public String getClassName() {
             return className;
         }
 
+        public String getPackageName() {
+            int i = name.lastIndexOf('/');
+            return (i > 0) ? name.substring(0, i).replace('/', '.') : "";
+        }
+
         @Override
         public boolean equals(Object other) {
             if (this == other)
                 return true;
             if (!(other instanceof SimpleLocation))
                 return false;
-            return (className.equals(((SimpleLocation) other).className));
+            return (name.equals(((SimpleLocation) other).name));
         }
 
         @Override
         public int hashCode() {
-            return className.hashCode();
+            return name.hashCode();
         }
 
         @Override
         public String toString() {
-            return className;
+            return name;
         }
 
+        private String name;
         private String className;
     }
 
@@ -431,9 +444,7 @@
         }
 
         public boolean accepts(Dependency dependency) {
-            String cn = dependency.getTarget().getClassName();
-            int lastSep = cn.lastIndexOf("/");
-            String pn = (lastSep == -1 ? "" : cn.substring(0, lastSep));
+            String pn = dependency.getTarget().getPackageName();
             if (packageNames.contains(pn))
                 return true;
 
@@ -451,8 +462,6 @@
         private final boolean matchSubpackages;
     }
 
-
-
     /**
      * This class identifies class names directly or indirectly in the constant pool.
      */
@@ -462,6 +471,26 @@
             for (CPInfo cpInfo: classfile.constant_pool.entries()) {
                 v.scan(cpInfo);
             }
+            try {
+                v.addClass(classfile.super_class);
+                v.addClasses(classfile.interfaces);
+                v.scan(classfile.attributes);
+
+                for (Field f : classfile.fields) {
+                    v.scan(f.descriptor, f.attributes);
+                }
+                for (Method m : classfile.methods) {
+                    v.scan(m.descriptor, m.attributes);
+                    Exceptions_attribute e =
+                        (Exceptions_attribute)m.attributes.get(Attribute.Exceptions);
+                    if (e != null) {
+                        v.addClasses(e.exception_index_table);
+                    }
+                }
+            } catch (ConstantPoolException e) {
+                throw new ClassFileError(e);
+            }
+
             return v.deps;
         }
     }
@@ -558,9 +587,7 @@
             void scan(Descriptor d, Attributes attrs) {
                 try {
                     scan(new Signature(d.index).getType(constant_pool));
-                    Signature_attribute sa = (Signature_attribute) attrs.get(Attribute.Signature);
-                    if (sa != null)
-                        scan(new Signature(sa.signature_index).getType(constant_pool));
+                    scan(attrs);
                 } catch (ConstantPoolException e) {
                     throw new ClassFileError(e);
                 }
@@ -574,6 +601,43 @@
                 t.accept(this, null);
             }
 
+            void scan(Attributes attrs) {
+                try {
+                    Signature_attribute sa = (Signature_attribute)attrs.get(Attribute.Signature);
+                    if (sa != null)
+                        scan(sa.getParsedSignature().getType(constant_pool));
+
+                    scan((RuntimeVisibleAnnotations_attribute)
+                            attrs.get(Attribute.RuntimeVisibleAnnotations));
+                    scan((RuntimeVisibleParameterAnnotations_attribute)
+                            attrs.get(Attribute.RuntimeVisibleParameterAnnotations));
+                } catch (ConstantPoolException e) {
+                    throw new ClassFileError(e);
+                }
+            }
+
+            private void scan(RuntimeAnnotations_attribute attr) throws ConstantPoolException {
+                if (attr == null) {
+                    return;
+                }
+                for (int i = 0; i < attr.annotations.length; i++) {
+                    int index = attr.annotations[i].type_index;
+                    scan(new Signature(index).getType(constant_pool));
+                }
+            }
+
+            private void scan(RuntimeParameterAnnotations_attribute attr) throws ConstantPoolException {
+                if (attr == null) {
+                    return;
+                }
+                for (int param = 0; param < attr.parameter_annotations.length; param++) {
+                    for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
+                        int index = attr.parameter_annotations[param][i].type_index;
+                        scan(new Signature(index).getType(constant_pool));
+                    }
+                }
+            }
+
             void addClass(int index) throws ConstantPoolException {
                 if (index != 0) {
                     String name = constant_pool.getClassInfo(index).getBaseName();
@@ -698,6 +762,7 @@
                 findDependencies(type.paramTypes);
                 findDependencies(type.returnType);
                 findDependencies(type.throwsTypes);
+                findDependencies(type.typeParamTypes);
                 return null;
             }
 
@@ -709,7 +774,7 @@
 
             public Void visitClassType(ClassType type, Void p) {
                 findDependencies(type.outerType);
-                addDependency(type.name);
+                addDependency(type.getBinaryName());
                 findDependencies(type.typeArgs);
                 return null;
             }
--- a/src/share/classes/com/sun/tools/classfile/Dependency.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/classfile/Dependency.java	Tue Jul 02 10:13:00 2013 +0100
@@ -71,7 +71,19 @@
          * dependency analysis.
          * @return the name of the class containing the location.
          */
+        String getName();
+
+        /**
+         * Get the fully-qualified name of the class containing the location.
+         * @return the fully-qualified name of the class containing the location.
+         */
         String getClassName();
+
+        /**
+         * Get the package name of the class containing the location.
+         * @return the package name of the class containing the location.
+         */
+        String getPackageName();
     }
 
 
--- a/src/share/classes/com/sun/tools/classfile/Descriptor.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/classfile/Descriptor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -37,7 +37,7 @@
  *  deletion without notice.</b>
  */
 public class Descriptor {
-    public class InvalidDescriptor extends DescriptorException {
+    public static class InvalidDescriptor extends DescriptorException {
         private static final long serialVersionUID = 1L;
         InvalidDescriptor(String desc) {
             this.desc = desc;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/classfile/MethodParameters_attribute.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,87 @@
+/*
+ * 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.  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.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JVMS, section 4.8.13.
+ *
+ *  <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>
+ */
+public class MethodParameters_attribute extends Attribute {
+
+    public final int method_parameter_table_length;
+    public final Entry[] method_parameter_table;
+
+    MethodParameters_attribute(ClassReader cr,
+                              int name_index,
+                              int length)
+        throws IOException {
+        super(name_index, length);
+
+        method_parameter_table_length = cr.readUnsignedByte();
+        method_parameter_table = new Entry[method_parameter_table_length];
+        for (int i = 0; i < method_parameter_table_length; i++)
+            method_parameter_table[i] = new Entry(cr);
+    }
+
+    public MethodParameters_attribute(ConstantPool constant_pool,
+                                      Entry[] method_parameter_table)
+        throws ConstantPoolException {
+        this(constant_pool.getUTF8Index(Attribute.MethodParameters),
+             method_parameter_table);
+    }
+
+    public MethodParameters_attribute(int name_index,
+                                      Entry[] method_parameter_table) {
+        super(name_index, 1 + method_parameter_table.length * Entry.length());
+        this.method_parameter_table_length = method_parameter_table.length;
+        this.method_parameter_table = method_parameter_table;
+    }
+
+    public <R, D> R accept(Visitor<R, D> visitor, D data) {
+        return visitor.visitMethodParameters(this, data);
+    }
+
+    public static class Entry {
+        Entry(ClassReader cr) throws IOException {
+            name_index = cr.readUnsignedShort();
+            flags = cr.readUnsignedShort();
+        }
+
+        public static int length() {
+            return 6;
+        }
+
+        public final int name_index;
+        public final int flags;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/classfile/RuntimeInvisibleTypeAnnotations_attribute.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JSR 308 specification, Section 3.
+ *
+ *  <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>
+ */
+public class RuntimeInvisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
+    RuntimeInvisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
+            throws IOException, Annotation.InvalidAnnotation {
+        super(cr, name_index, length);
+    }
+
+    public RuntimeInvisibleTypeAnnotations_attribute(ConstantPool cp, TypeAnnotation[] annotations)
+            throws ConstantPoolException {
+        this(cp.getUTF8Index(Attribute.RuntimeInvisibleTypeAnnotations), annotations);
+    }
+
+    public RuntimeInvisibleTypeAnnotations_attribute(int name_index, TypeAnnotation[] annotations) {
+        super(name_index, annotations);
+    }
+
+    public <R, P> R accept(Visitor<R, P> visitor, P p) {
+        return visitor.visitRuntimeInvisibleTypeAnnotations(this, p);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/classfile/RuntimeTypeAnnotations_attribute.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JSR 308 specification, Section 3.
+ *
+ *  <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>
+ */
+public abstract class RuntimeTypeAnnotations_attribute extends Attribute {
+    protected RuntimeTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
+            throws IOException, Annotation.InvalidAnnotation {
+        super(name_index, length);
+        int num_annotations = cr.readUnsignedShort();
+        annotations = new TypeAnnotation[num_annotations];
+        for (int i = 0; i < annotations.length; i++)
+            annotations[i] = new TypeAnnotation(cr);
+    }
+
+    protected RuntimeTypeAnnotations_attribute(int name_index, TypeAnnotation[] annotations) {
+        super(name_index, length(annotations));
+        this.annotations = annotations;
+    }
+
+    private static int length(TypeAnnotation[] annos) {
+        int n = 2;
+        for (TypeAnnotation anno: annos)
+            n += anno.length();
+        return n;
+    }
+
+    public final TypeAnnotation[] annotations;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/classfile/RuntimeVisibleTypeAnnotations_attribute.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.classfile;
+
+import java.io.IOException;
+
+/**
+ * See JSR 308 specification, Section 3.
+ *
+ *  <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>
+ */
+public class RuntimeVisibleTypeAnnotations_attribute extends RuntimeTypeAnnotations_attribute {
+    RuntimeVisibleTypeAnnotations_attribute(ClassReader cr, int name_index, int length)
+            throws IOException, Annotation.InvalidAnnotation {
+        super(cr, name_index, length);
+    }
+
+    public RuntimeVisibleTypeAnnotations_attribute(ConstantPool cp, TypeAnnotation[] annotations)
+            throws ConstantPoolException {
+        this(cp.getUTF8Index(Attribute.RuntimeVisibleTypeAnnotations), annotations);
+    }
+
+    public RuntimeVisibleTypeAnnotations_attribute(int name_index, TypeAnnotation[] annotations) {
+        super(name_index, annotations);
+    }
+
+    public <R, P> R accept(Visitor<R, P> visitor, P p) {
+        return visitor.visitRuntimeVisibleTypeAnnotations(this, p);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/classfile/TypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,657 @@
+/*
+ * 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.  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.classfile;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.sun.tools.classfile.TypeAnnotation.Position.TypePathEntry;
+
+/**
+ * See JSR 308 specification, Section 3.
+ *
+ *  <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>
+ */
+public class TypeAnnotation {
+    TypeAnnotation(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
+        constant_pool = cr.getConstantPool();
+        position = read_position(cr);
+        annotation = new Annotation(cr);
+    }
+
+    public TypeAnnotation(ConstantPool constant_pool,
+            Annotation annotation, Position position) {
+        this.constant_pool = constant_pool;
+        this.position = position;
+        this.annotation = annotation;
+    }
+
+    public int length() {
+        int n = annotation.length();
+        n += position_length(position);
+        return n;
+    }
+
+    @Override
+    public String toString() {
+        try {
+            return "@" + constant_pool.getUTF8Value(annotation.type_index).toString().substring(1) +
+                    " pos: " + position.toString();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return e.toString();
+        }
+    }
+
+    public final ConstantPool constant_pool;
+    public final Position position;
+    public final Annotation annotation;
+
+    private static Position read_position(ClassReader cr) throws IOException, Annotation.InvalidAnnotation {
+        // Copied from ClassReader
+        int tag = cr.readUnsignedByte(); // TargetType tag is a byte
+        if (!TargetType.isValidTargetTypeValue(tag))
+            throw new Annotation.InvalidAnnotation("TypeAnnotation: Invalid type annotation target type value: " + String.format("0x%02X", tag));
+
+        TargetType type = TargetType.fromTargetTypeValue(tag);
+
+        Position position = new Position();
+        position.type = type;
+
+        switch (type) {
+        // instanceof
+        case INSTANCEOF:
+        // new expression
+        case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
+            position.offset = cr.readUnsignedShort();
+            break;
+        // local variable
+        case LOCAL_VARIABLE:
+        // resource variable
+        case RESOURCE_VARIABLE:
+            int table_length = cr.readUnsignedShort();
+            position.lvarOffset = new int[table_length];
+            position.lvarLength = new int[table_length];
+            position.lvarIndex = new int[table_length];
+            for (int i = 0; i < table_length; ++i) {
+                position.lvarOffset[i] = cr.readUnsignedShort();
+                position.lvarLength[i] = cr.readUnsignedShort();
+                position.lvarIndex[i] = cr.readUnsignedShort();
+            }
+            break;
+        // exception parameter
+        case EXCEPTION_PARAMETER:
+            position.exception_index = cr.readUnsignedByte();
+            break;
+        // method receiver
+        case METHOD_RECEIVER:
+            // Do nothing
+            break;
+        // type parameter
+        case CLASS_TYPE_PARAMETER:
+        case METHOD_TYPE_PARAMETER:
+            position.parameter_index = cr.readUnsignedByte();
+            break;
+        // type parameter bound
+        case CLASS_TYPE_PARAMETER_BOUND:
+        case METHOD_TYPE_PARAMETER_BOUND:
+            position.parameter_index = cr.readUnsignedByte();
+            position.bound_index = cr.readUnsignedByte();
+            break;
+        // class extends or implements clause
+        case CLASS_EXTENDS:
+            int in = cr.readUnsignedShort();
+            if (in == 0xFFFF)
+                in = -1;
+            position.type_index = in;
+            break;
+        // throws
+        case THROWS:
+            position.type_index = cr.readUnsignedShort();
+            break;
+        // method parameter
+        case METHOD_FORMAL_PARAMETER:
+            position.parameter_index = cr.readUnsignedByte();
+            break;
+        // type cast
+        case CAST:
+        // method/constructor/reference type argument
+        case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+        case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+        case METHOD_REFERENCE_TYPE_ARGUMENT:
+            position.offset = cr.readUnsignedShort();
+            position.type_index = cr.readUnsignedByte();
+            break;
+        // We don't need to worry about these
+        case METHOD_RETURN:
+        case FIELD:
+            break;
+        case UNKNOWN:
+            throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
+        default:
+            throw new AssertionError("TypeAnnotation: Unknown target type: " + type);
+        }
+
+        { // Write type path
+            int len = cr.readUnsignedByte();
+            List<Integer> loc = new ArrayList<Integer>(len);
+            for (int i = 0; i < len * TypePathEntry.bytesPerEntry; ++i)
+                loc.add(cr.readUnsignedByte());
+            position.location = Position.getTypePathFromBinary(loc);
+        }
+        return position;
+    }
+
+    private static int position_length(Position pos) {
+        int n = 0;
+        n += 1; // TargetType tag is a byte
+        switch (pos.type) {
+        // instanceof
+        case INSTANCEOF:
+        // new expression
+        case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
+            n += 2; // offset
+            break;
+        // local variable
+        case LOCAL_VARIABLE:
+        // resource variable
+        case RESOURCE_VARIABLE:
+            n += 2; // table_length;
+            int table_length = pos.lvarOffset.length;
+            n += 2 * table_length; // offset
+            n += 2 * table_length; // length
+            n += 2 * table_length; // index
+            break;
+        // exception parameter
+        case EXCEPTION_PARAMETER:
+            n += 1; // exception_index
+            break;
+        // method receiver
+        case METHOD_RECEIVER:
+            // Do nothing
+            break;
+        // type parameter
+        case CLASS_TYPE_PARAMETER:
+        case METHOD_TYPE_PARAMETER:
+            n += 1; // parameter_index
+            break;
+        // type parameter bound
+        case CLASS_TYPE_PARAMETER_BOUND:
+        case METHOD_TYPE_PARAMETER_BOUND:
+            n += 1; // parameter_index
+            n += 1; // bound_index
+            break;
+        // class extends or implements clause
+        case CLASS_EXTENDS:
+            n += 2; // type_index
+            break;
+        // throws
+        case THROWS:
+            n += 2; // type_index
+            break;
+        // method parameter
+        case METHOD_FORMAL_PARAMETER:
+            n += 1; // parameter_index
+            break;
+        // type cast
+        case CAST:
+        // method/constructor/reference type argument
+        case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+        case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+        case METHOD_REFERENCE_TYPE_ARGUMENT:
+            n += 2; // offset
+            n += 1; // type index
+            break;
+        // We don't need to worry about these
+        case METHOD_RETURN:
+        case FIELD:
+            break;
+        case UNKNOWN:
+            throw new AssertionError("TypeAnnotation: UNKNOWN target type should never occur!");
+        default:
+            throw new AssertionError("TypeAnnotation: Unknown target type: " + pos.type);
+        }
+
+        {
+            n += 1; // length
+            n += TypePathEntry.bytesPerEntry * pos.location.size(); // bytes for actual array
+        }
+
+        return n;
+    }
+
+    // Code duplicated from com.sun.tools.javac.code.TypeAnnotationPosition
+    public static class Position {
+        public enum TypePathEntryKind {
+            ARRAY(0),
+            INNER_TYPE(1),
+            WILDCARD(2),
+            TYPE_ARGUMENT(3);
+
+            public final int tag;
+
+            private TypePathEntryKind(int tag) {
+                this.tag = tag;
+            }
+        }
+
+        public static class TypePathEntry {
+            /** The fixed number of bytes per TypePathEntry. */
+            public static final int bytesPerEntry = 2;
+
+            public final TypePathEntryKind tag;
+            public final int arg;
+
+            public static final TypePathEntry ARRAY = new TypePathEntry(TypePathEntryKind.ARRAY);
+            public static final TypePathEntry INNER_TYPE = new TypePathEntry(TypePathEntryKind.INNER_TYPE);
+            public static final TypePathEntry WILDCARD = new TypePathEntry(TypePathEntryKind.WILDCARD);
+
+            private TypePathEntry(TypePathEntryKind tag) {
+                if (!(tag == TypePathEntryKind.ARRAY ||
+                        tag == TypePathEntryKind.INNER_TYPE ||
+                        tag == TypePathEntryKind.WILDCARD)) {
+                    throw new AssertionError("Invalid TypePathEntryKind: " + tag);
+                }
+                this.tag = tag;
+                this.arg = 0;
+            }
+
+            public TypePathEntry(TypePathEntryKind tag, int arg) {
+                if (tag != TypePathEntryKind.TYPE_ARGUMENT) {
+                    throw new AssertionError("Invalid TypePathEntryKind: " + tag);
+                }
+                this.tag = tag;
+                this.arg = arg;
+            }
+
+            public static TypePathEntry fromBinary(int tag, int arg) {
+                if (arg != 0 && tag != TypePathEntryKind.TYPE_ARGUMENT.tag) {
+                    throw new AssertionError("Invalid TypePathEntry tag/arg: " + tag + "/" + arg);
+                }
+                switch (tag) {
+                case 0:
+                    return ARRAY;
+                case 1:
+                    return INNER_TYPE;
+                case 2:
+                    return WILDCARD;
+                case 3:
+                    return new TypePathEntry(TypePathEntryKind.TYPE_ARGUMENT, arg);
+                default:
+                    throw new AssertionError("Invalid TypePathEntryKind tag: " + tag);
+                }
+            }
+
+            @Override
+            public String toString() {
+                return tag.toString() +
+                        (tag == TypePathEntryKind.TYPE_ARGUMENT ? ("(" + arg + ")") : "");
+            }
+
+            @Override
+            public boolean equals(Object other) {
+                if (! (other instanceof TypePathEntry)) {
+                    return false;
+                }
+                TypePathEntry tpe = (TypePathEntry) other;
+                return this.tag == tpe.tag && this.arg == tpe.arg;
+            }
+
+            @Override
+            public int hashCode() {
+                return this.tag.hashCode() * 17 + this.arg;
+            }
+        }
+
+        public TargetType type = TargetType.UNKNOWN;
+
+        // For generic/array types.
+        // TODO: or should we use null? Noone will use this object.
+        public List<TypePathEntry> location = new ArrayList<TypePathEntry>(0);
+
+        // Tree position.
+        public int pos = -1;
+
+        // For typecasts, type tests, new (and locals, as start_pc).
+        public boolean isValidOffset = false;
+        public int offset = -1;
+
+        // For locals. arrays same length
+        public int[] lvarOffset = null;
+        public int[] lvarLength = null;
+        public int[] lvarIndex = null;
+
+        // For type parameter bound
+        public int bound_index = Integer.MIN_VALUE;
+
+        // For type parameter and method parameter
+        public int parameter_index = Integer.MIN_VALUE;
+
+        // For class extends, implements, and throws clauses
+        public int type_index = Integer.MIN_VALUE;
+
+        // For exception parameters, index into exception table
+        public int exception_index = Integer.MIN_VALUE;
+
+        public Position() {}
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder();
+            sb.append('[');
+            sb.append(type);
+
+            switch (type) {
+            // instanceof
+            case INSTANCEOF:
+            // new expression
+            case NEW:
+            // constructor/method reference receiver
+            case CONSTRUCTOR_REFERENCE:
+            case METHOD_REFERENCE:
+                sb.append(", offset = ");
+                sb.append(offset);
+                break;
+            // local variable
+            case LOCAL_VARIABLE:
+            // resource variable
+            case RESOURCE_VARIABLE:
+                if (lvarOffset == null) {
+                    sb.append(", lvarOffset is null!");
+                    break;
+                }
+                sb.append(", {");
+                for (int i = 0; i < lvarOffset.length; ++i) {
+                    if (i != 0) sb.append("; ");
+                    sb.append("start_pc = ");
+                    sb.append(lvarOffset[i]);
+                    sb.append(", length = ");
+                    sb.append(lvarLength[i]);
+                    sb.append(", index = ");
+                    sb.append(lvarIndex[i]);
+                }
+                sb.append("}");
+                break;
+            // method receiver
+            case METHOD_RECEIVER:
+                // Do nothing
+                break;
+            // type parameter
+            case CLASS_TYPE_PARAMETER:
+            case METHOD_TYPE_PARAMETER:
+                sb.append(", param_index = ");
+                sb.append(parameter_index);
+                break;
+            // type parameter bound
+            case CLASS_TYPE_PARAMETER_BOUND:
+            case METHOD_TYPE_PARAMETER_BOUND:
+                sb.append(", param_index = ");
+                sb.append(parameter_index);
+                sb.append(", bound_index = ");
+                sb.append(bound_index);
+                break;
+            // class extends or implements clause
+            case CLASS_EXTENDS:
+                sb.append(", type_index = ");
+                sb.append(type_index);
+                break;
+            // throws
+            case THROWS:
+                sb.append(", type_index = ");
+                sb.append(type_index);
+                break;
+            // exception parameter
+            case EXCEPTION_PARAMETER:
+                sb.append(", exception_index = ");
+                sb.append(exception_index);
+                break;
+            // method parameter
+            case METHOD_FORMAL_PARAMETER:
+                sb.append(", param_index = ");
+                sb.append(parameter_index);
+                break;
+            // type cast
+            case CAST:
+            // method/constructor/reference type argument
+            case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+            case METHOD_INVOCATION_TYPE_ARGUMENT:
+            case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+            case METHOD_REFERENCE_TYPE_ARGUMENT:
+                sb.append(", offset = ");
+                sb.append(offset);
+                sb.append(", type_index = ");
+                sb.append(type_index);
+                break;
+            // We don't need to worry about these
+            case METHOD_RETURN:
+            case FIELD:
+                break;
+            case UNKNOWN:
+                sb.append(", position UNKNOWN!");
+                break;
+            default:
+                throw new AssertionError("Unknown target type: " + type);
+            }
+
+            // Append location data for generics/arrays.
+            if (!location.isEmpty()) {
+                sb.append(", location = (");
+                sb.append(location);
+                sb.append(")");
+            }
+
+            sb.append(", pos = ");
+            sb.append(pos);
+
+            sb.append(']');
+            return sb.toString();
+        }
+
+        /**
+         * Indicates whether the target tree of the annotation has been optimized
+         * away from classfile or not.
+         * @return true if the target has not been optimized away
+         */
+        public boolean emitToClassfile() {
+            return !type.isLocal() || isValidOffset;
+        }
+
+        /**
+         * Decode the binary representation for a type path and set
+         * the {@code location} field.
+         *
+         * @param list The bytecode representation of the type path.
+         */
+        public static List<TypePathEntry> getTypePathFromBinary(List<Integer> list) {
+            List<TypePathEntry> loc = new ArrayList<TypePathEntry>(list.size() / TypePathEntry.bytesPerEntry);
+            int idx = 0;
+            while (idx < list.size()) {
+                if (idx + 1 == list.size()) {
+                    throw new AssertionError("Could not decode type path: " + list);
+                }
+                loc.add(TypePathEntry.fromBinary(list.get(idx), list.get(idx + 1)));
+                idx += 2;
+            }
+            return loc;
+        }
+
+        public static List<Integer> getBinaryFromTypePath(List<TypePathEntry> locs) {
+            List<Integer> loc = new ArrayList<Integer>(locs.size() * TypePathEntry.bytesPerEntry);
+            for (TypePathEntry tpe : locs) {
+                loc.add(tpe.tag.tag);
+                loc.add(tpe.arg);
+            }
+            return loc;
+        }
+    }
+
+    // Code duplicated from com.sun.tools.javac.code.TargetType
+    // The IsLocal flag could be removed here.
+    public enum TargetType {
+        /** For annotations on a class type parameter declaration. */
+        CLASS_TYPE_PARAMETER(0x00),
+
+        /** For annotations on a method type parameter declaration. */
+        METHOD_TYPE_PARAMETER(0x01),
+
+        /** For annotations on the type of an "extends" or "implements" clause. */
+        CLASS_EXTENDS(0x10),
+
+        /** For annotations on a bound of a type parameter of a class. */
+        CLASS_TYPE_PARAMETER_BOUND(0x11),
+
+        /** For annotations on a bound of a type parameter of a method. */
+        METHOD_TYPE_PARAMETER_BOUND(0x12),
+
+        /** For annotations on a field. */
+        FIELD(0x13),
+
+        /** For annotations on a method return type. */
+        METHOD_RETURN(0x14),
+
+        /** For annotations on the method receiver. */
+        METHOD_RECEIVER(0x15),
+
+        /** For annotations on a method parameter. */
+        METHOD_FORMAL_PARAMETER(0x16),
+
+        /** For annotations on a throws clause in a method declaration. */
+        THROWS(0x17),
+
+        /** For annotations on a local variable. */
+        LOCAL_VARIABLE(0x40, true),
+
+        /** For annotations on a resource variable. */
+        RESOURCE_VARIABLE(0x41, true),
+
+        /** For annotations on an exception parameter. */
+        EXCEPTION_PARAMETER(0x42, true),
+
+        /** For annotations on a type test. */
+        INSTANCEOF(0x43, true),
+
+        /** For annotations on an object creation expression. */
+        NEW(0x44, true),
+
+        /** For annotations on a constructor reference receiver. */
+        CONSTRUCTOR_REFERENCE(0x45, true),
+
+        /** For annotations on a method reference receiver. */
+        METHOD_REFERENCE(0x46, true),
+
+        /** For annotations on a typecast. */
+        CAST(0x47, true),
+
+        /** For annotations on a type argument of an object creation expression. */
+        CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x48, true),
+
+        /** For annotations on a type argument of a method call. */
+        METHOD_INVOCATION_TYPE_ARGUMENT(0x49, true),
+
+        /** For annotations on a type argument of a constructor reference. */
+        CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(0x4A, true),
+
+        /** For annotations on a type argument of a method reference. */
+        METHOD_REFERENCE_TYPE_ARGUMENT(0x4B, true),
+
+        /** For annotations with an unknown target. */
+        UNKNOWN(0xFF);
+
+        private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x4B;
+
+        private final int targetTypeValue;
+        private final boolean isLocal;
+
+        private TargetType(int targetTypeValue) {
+            this(targetTypeValue, false);
+        }
+
+        private TargetType(int targetTypeValue, boolean isLocal) {
+            if (targetTypeValue < 0
+                    || targetTypeValue > 255)
+                    throw new AssertionError("Attribute type value needs to be an unsigned byte: " + String.format("0x%02X", targetTypeValue));
+            this.targetTypeValue = targetTypeValue;
+            this.isLocal = isLocal;
+        }
+
+        /**
+         * Returns whether or not this TargetType represents an annotation whose
+         * target is exclusively a tree in a method body
+         *
+         * Note: wildcard bound targets could target a local tree and a class
+         * member declaration signature tree
+         */
+        public boolean isLocal() {
+            return isLocal;
+        }
+
+        public int targetTypeValue() {
+            return this.targetTypeValue;
+        }
+
+        private static final TargetType[] targets;
+
+        static {
+            targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
+            TargetType[] alltargets = values();
+            for (TargetType target : alltargets) {
+                if (target.targetTypeValue != UNKNOWN.targetTypeValue)
+                    targets[target.targetTypeValue] = target;
+            }
+            for (int i = 0; i <= MAXIMUM_TARGET_TYPE_VALUE; ++i) {
+                if (targets[i] == null)
+                    targets[i] = UNKNOWN;
+            }
+        }
+
+        public static boolean isValidTargetTypeValue(int tag) {
+            if (tag == UNKNOWN.targetTypeValue)
+                return true;
+            return (tag >= 0 && tag < targets.length);
+        }
+
+        public static TargetType fromTargetTypeValue(int tag) {
+            if (tag == UNKNOWN.targetTypeValue)
+                return UNKNOWN;
+
+            if (tag < 0 || tag >= targets.length)
+                throw new AssertionError("Unknown TargetType: " + tag);
+            return targets[tag];
+        }
+    }
+}
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -139,6 +139,15 @@
         }
     }
 
+    protected void addReceiverAnnotations(ExecutableMemberDoc member,
+            Content tree) {
+        if (member.receiverAnnotations().length > 0) {
+            tree.addContent(writer.getSpace());
+            writer.addReceiverAnnotationInfo(member, tree);
+        }
+    }
+
+
     /**
      * Add all the parameters for the executable member.
      *
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -321,7 +321,8 @@
             code.addContent(" ");
         }
         if (member.isMethod()) {
-            if (((MethodDoc)member).isAbstract()) {
+            if (!(member.containingClass().isInterface()) &&
+                    ((MethodDoc)member).isAbstract()) {
                 code.addContent("abstract ");
             }
             // This check for isDefault() and the default modifier needs to be
@@ -329,7 +330,7 @@
             // method summary section. Once the default modifier is added
             // to the Modifier list on DocEnv and once it is updated to use the
             // javax.lang.model.element.Modifier, we will need to remove this.
-            else if (((MethodDoc)member).isDefault()) {
+            if (((MethodDoc)member).isDefault()) {
                 code.addContent("default ");
             }
         }
@@ -561,11 +562,14 @@
         if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) {
             int methodType = (member.isStatic()) ? MethodTypes.STATIC.value() :
                     MethodTypes.INSTANCE.value();
-            methodType = (classdoc.isInterface() || ((MethodDoc)member).isAbstract()) ?
-                    methodType | MethodTypes.ABSTRACT.value() :
-                    methodType | MethodTypes.CONCRETE.value();
-            if (((MethodDoc)member).isDefault()) {
-                methodType = methodType | MethodTypes.DEFAULT.value();
+            if (member.containingClass().isInterface()) {
+                methodType = (((MethodDoc) member).isAbstract())
+                        ? methodType | MethodTypes.ABSTRACT.value()
+                        : methodType | MethodTypes.DEFAULT.value();
+            } else {
+                methodType = (((MethodDoc) member).isAbstract())
+                        ? methodType | MethodTypes.ABSTRACT.value()
+                        : methodType | MethodTypes.CONCRETE.value();
             }
             if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) {
                 methodType = methodType | MethodTypes.DEPRECATED.value();
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -150,7 +150,20 @@
             String tableSummary, Content body) {
         if (packages.length > 0) {
             Arrays.sort(packages);
-            addAllClassesLink(body);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexHeader);
+            addAllClassesLink(div);
+            if (configuration.showProfiles) {
+                addAllProfilesLink(div);
+            }
+            body.addContent(div);
+            if (configuration.showProfiles) {
+                String profileSummary = configuration.getText("doclet.Profiles");
+                String profilesTableSummary = configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Profile_Summary"),
+                configuration.getText("doclet.profiles"));
+                addProfilesList(profileSummary, profilesTableSummary, body);
+            }
             addPackagesList(packages, text, tableSummary, body);
         }
     }
@@ -182,10 +195,29 @@
     }
 
     /**
-     * Do nothing. This will be overridden in PackageIndexFrameWriter.
+     * Do nothing. This will be overridden.
+     *
+     * @param div the document tree to which the all classes link will be added
+     */
+    protected void addAllClassesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden.
      *
-     * @param body the document tree to which the all classes link will be added
+     * @param div the document tree to which the all profiles link will be added
      */
-    protected void addAllClassesLink(Content body) {
+    protected void addAllProfilesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden.
+     *
+     * @param profileSummary the profile summary heading
+     * @param profilesTableSummary the profiles table summary information
+     * @param body the content tree to which the profiles list will be added
+     */
+    protected void addProfilesList(String profileSummary, String profilesTableSummary,
+            Content body) {
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,276 @@
+/*
+ * 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;
+
+import java.io.*;
+
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.DocPath;
+
+/**
+ * Abstract class to generate the profile overview files in
+ * Frame and Non-Frame format. This will be sub-classed to
+ * generate profile-overview-frame.html as well as profile-overview-summary.html.
+ *
+ *  <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 abstract class AbstractProfileIndexWriter extends HtmlDocletWriter {
+
+    /**
+     * Profiles to be documented.
+     */
+    protected Profiles profiles;
+
+    /**
+     * Constructor. Also initializes the profiles variable.
+     *
+     * @param configuration  The current configuration
+     * @param filename Name of the profile index file to be generated.
+     */
+    public AbstractProfileIndexWriter(ConfigurationImpl configuration,
+                                      DocPath filename) throws IOException {
+        super(configuration, filename);
+        profiles = configuration.profiles;
+    }
+
+    /**
+     * Adds the navigation bar header to the documentation tree.
+     *
+     * @param body the document tree to which the navigation bar header will be added
+     */
+    protected abstract void addNavigationBarHeader(Content body);
+
+    /**
+     * Adds the navigation bar footer to the documentation tree.
+     *
+     * @param body the document tree to which the navigation bar footer will be added
+     */
+    protected abstract void addNavigationBarFooter(Content body);
+
+    /**
+     * Adds the overview header to the documentation tree.
+     *
+     * @param body the document tree to which the overview header will be added
+     */
+    protected abstract void addOverviewHeader(Content body);
+
+    /**
+     * Adds the profiles list to the documentation tree.
+     *
+     * @param profiles profiles object
+     * @param text caption for the table
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the profiles list will be added
+     */
+    protected abstract void addProfilesList(Profiles profiles, String text,
+            String tableSummary, Content body);
+
+    /**
+     * Adds the profile packages list to the documentation tree.
+     *
+     * @param profiles profiles object
+     * @param text caption for the table
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the profiles list will be added
+     * @param profileName the name for the profile being documented
+     */
+    protected abstract void addProfilePackagesList(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName);
+
+    /**
+     * Generate and prints the contents in the profile index file. Call appropriate
+     * methods from the sub-class in order to generate Frame or Non
+     * Frame format.
+     *
+     * @param title the title of the window.
+     * @param includeScript boolean set true if windowtitle script is to be included
+     */
+    protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException {
+        String windowOverview = configuration.getText(title);
+        Content body = getBody(includeScript, getWindowTitle(windowOverview));
+        addNavigationBarHeader(body);
+        addOverviewHeader(body);
+        addIndex(body);
+        addOverview(body);
+        addNavigationBarFooter(body);
+        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
+                configuration.doctitle), includeScript, body);
+    }
+
+    /**
+     * Generate and prints the contents in the profile packages index file. Call appropriate
+     * methods from the sub-class in order to generate Frame or Non
+     * Frame format.
+     *
+     * @param title the title of the window.
+     * @param includeScript boolean set true if windowtitle script is to be included
+     * @param profileName the name of the profile being documented
+     */
+    protected void buildProfilePackagesIndexFile(String title,
+            boolean includeScript, String profileName) throws IOException {
+        String windowOverview = configuration.getText(title);
+        Content body = getBody(includeScript, getWindowTitle(windowOverview));
+        addNavigationBarHeader(body);
+        addOverviewHeader(body);
+        addProfilePackagesIndex(body, profileName);
+        addOverview(body);
+        addNavigationBarFooter(body);
+        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
+                configuration.doctitle), includeScript, body);
+    }
+
+    /**
+     * Default to no overview, override to add overview.
+     *
+     * @param body the document tree to which the overview will be added
+     */
+    protected void addOverview(Content body) throws IOException {
+    }
+
+    /**
+     * Adds the frame or non-frame profile index to the documentation tree.
+     *
+     * @param body the document tree to which the index will be added
+     */
+    protected void addIndex(Content body) {
+        addIndexContents(profiles, "doclet.Profile_Summary",
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Profile_Summary"),
+                configuration.getText("doclet.profiles")), body);
+    }
+
+    /**
+     * Adds the frame or non-frame profile packages index to the documentation tree.
+     *
+     * @param body the document tree to which the index will be added
+     * @param profileName  the name of the profile being documented
+     */
+    protected void addProfilePackagesIndex(Content body, String profileName) {
+        addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary",
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Profile_Summary"),
+                configuration.getText("doclet.profiles")), body, profileName);
+    }
+
+    /**
+     * Adds profile index contents. Call appropriate methods from
+     * the sub-classes. Adds it to the body HtmlTree
+     *
+     * @param profiles profiles to be documented
+     * @param text string which will be used as the heading
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the index contents will be added
+     */
+    protected void addIndexContents(Profiles profiles, String text,
+            String tableSummary, Content body) {
+        if (profiles.getProfileCount() > 0) {
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexHeader);
+            addAllClassesLink(div);
+            addAllPackagesLink(div);
+            body.addContent(div);
+            addProfilesList(profiles, text, tableSummary, body);
+        }
+    }
+
+    /**
+     * Adds profile packages index contents. Call appropriate methods from
+     * the sub-classes. Adds it to the body HtmlTree
+     *
+     * @param profiles profiles to be documented
+     * @param text string which will be used as the heading
+     * @param tableSummary summary for the table
+     * @param body the document tree to which the index contents will be added
+     * @param profileName the name of the profile being documented
+     */
+    protected void addProfilePackagesIndexContents(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName) {
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.indexHeader);
+        addAllClassesLink(div);
+        addAllPackagesLink(div);
+        addAllProfilesLink(div);
+        body.addContent(div);
+        addProfilePackagesList(profiles, text, tableSummary, body, profileName);
+    }
+
+    /**
+     * Adds the doctitle to the documentation tree, if it is specified on the command line.
+     *
+     * @param body the document tree to which the title will be added
+     */
+    protected void addConfigurationTitle(Content body) {
+        if (configuration.doctitle.length() > 0) {
+            Content title = new RawHtml(configuration.doctitle);
+            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
+                    HtmlStyle.title, title);
+            Content div = HtmlTree.DIV(HtmlStyle.header, heading);
+            body.addContent(div);
+        }
+    }
+
+    /**
+     * Returns highlighted "Overview", in the navigation bar as this is the
+     * overview page.
+     *
+     * @return a Content object to be added to the documentation tree
+     */
+    protected Content getNavLinkContents() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
+        return li;
+    }
+
+    /**
+     * Do nothing. This will be overridden in ProfileIndexFrameWriter.
+     *
+     * @param div the document tree to which the all classes link will be added
+     */
+    protected void addAllClassesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden in ProfileIndexFrameWriter.
+     *
+     * @param div the document tree to which the all packages link will be added
+     */
+    protected void addAllPackagesLink(Content div) {
+    }
+
+    /**
+     * Do nothing. This will be overridden in ProfilePackageIndexFrameWriter.
+     *
+     * @param div the document tree to which the all profiles link will be added
+     */
+    protected void addAllProfilesLink(Content div) {
+    }
+}
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,10 +25,10 @@
 
 package com.sun.tools.doclets.formats.html;
 
-import java.io.IOException;
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.formats.html.markup.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
@@ -165,6 +165,20 @@
         bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
+        if (configuration.showProfiles) {
+            String sep = "";
+            int profile = configuration.profiles.getProfile(getTypeNameForProfile(classDoc));
+            if (profile > 0) {
+                Content profNameContent = new StringContent();
+                for (int i = profile; i < configuration.profiles.getProfileCount(); i++) {
+                    profNameContent.addContent(sep);
+                    profNameContent.addContent(Profile.lookup(i).name);
+                    sep = ", ";
+                }
+                Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profNameContent);
+                div.addContent(profileNameDiv);
+            }
+        }
         if (pkgname.length() > 0) {
             Content pkgNameContent = new StringContent(pkgname);
             Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,8 +33,10 @@
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.doclint.DocLint;
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javadoc.RootDocImpl;
 
 /**
  * Configure the output based on the command line options.
@@ -172,6 +174,11 @@
     public boolean createoverview = false;
 
     /**
+     * Collected set of doclint options
+     */
+    public Set<String> doclintOpts = new LinkedHashSet<String>();
+
+    /**
      * Unique Resource Handler for this package.
      */
     public final MessageRetriever standardmessage;
@@ -255,6 +262,10 @@
                 nooverview = true;
             } else if (opt.equals("-overview")) {
                 overview = true;
+            } else if (opt.equals("-xdoclint")) {
+                doclintOpts.add(null);
+            } else if (opt.startsWith("-xdoclint:")) {
+                doclintOpts.add(opt.substring(opt.indexOf(":") + 1));
             }
         }
         if (root.specifiedClasses().length > 0) {
@@ -270,6 +281,10 @@
         }
         setCreateOverview();
         setTopFile(root);
+
+        if (root instanceof RootDocImpl) {
+            ((RootDocImpl) root).initDocLint(doclintOpts);
+        }
     }
 
     /**
@@ -303,7 +318,9 @@
             option.equals("-serialwarn") ||
             option.equals("-use") ||
             option.equals("-nonavbar") ||
-            option.equals("-nooverview")) {
+            option.equals("-nooverview") ||
+            option.equals("-xdoclint") ||
+            option.startsWith("-xdoclint:")) {
             return 1;
         } else if (option.equals("-help")) {
             System.out.println(getText("doclet.usage"));
@@ -410,6 +427,16 @@
                     return false;
                 }
                 noindex = true;
+            } else if (opt.startsWith("-xdoclint:")) {
+                if (opt.contains("/")) {
+                    reporter.printError(getText("doclet.Option_doclint_no_qualifiers"));
+                    return false;
+                }
+                if (!DocLint.isValidOption(
+                        opt.replace("-xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX))) {
+                    reporter.printError(getText("doclet.Option_doclint_invalid_arg"));
+                    return false;
+                }
             }
         }
         return true;
@@ -506,8 +533,8 @@
      */
     @Override
     public Locale getLocale() {
-        if (root instanceof com.sun.tools.javadoc.RootDocImpl)
-            return ((com.sun.tools.javadoc.RootDocImpl)root).getLocale();
+        if (root instanceof RootDocImpl)
+            return ((RootDocImpl)root).getLocale();
         else
             return Locale.getDefault();
     }
@@ -518,8 +545,8 @@
     @Override
     public JavaFileManager getFileManager() {
         if (fileManager == null) {
-            if (root instanceof com.sun.tools.javadoc.RootDocImpl)
-                fileManager = ((com.sun.tools.javadoc.RootDocImpl)root).getFileManager();
+            if (root instanceof RootDocImpl)
+                fileManager = ((RootDocImpl) root).getFileManager();
             else
                 fileManager = new JavacFileManager(new Context(), false, null);
         }
@@ -527,4 +554,12 @@
     }
 
     private JavaFileManager fileManager;
+
+    @Override
+    public boolean showMessage(SourcePosition pos, String key) {
+        if (root instanceof RootDocImpl) {
+            return pos == null || ((RootDocImpl) root).showTagMessages();
+        }
+        return true;
+    }
 }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -60,7 +60,7 @@
             ClassDoc classDoc) {
         super(writer, classDoc);
         VisibleMemberMap visibleMemberMap = new VisibleMemberMap(classDoc,
-            VisibleMemberMap.CONSTRUCTORS, configuration.nodeprecated);
+            VisibleMemberMap.CONSTRUCTORS, configuration);
         List<ProgramElementDoc> constructors = new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
         for (int i = 0; i < constructors.size(); i++) {
             if ((constructors.get(i)).isProtected() ||
@@ -137,6 +137,7 @@
             addName(constructor.name(), pre);
         }
         addParameters(constructor, pre);
+        writer.addReceiverAnnotationInfo(constructor, pre);
         addExceptions(constructor, pre);
         return pre;
     }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -65,7 +65,7 @@
     public FrameOutputWriter(ConfigurationImpl configuration,
                              DocPath filename) throws IOException {
         super(configuration, filename);
-    noOfPackages = configuration.packages.length;
+        noOfPackages = configuration.packages.length;
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,6 +28,8 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -202,6 +204,44 @@
     /**
      * {@inheritDoc}
      */
+    protected void generateProfileFiles() throws Exception {
+        if (configuration.showProfiles) {
+            ProfileIndexFrameWriter.generate(configuration);
+            Profile prevProfile = null, nextProfile;
+            for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
+                ProfilePackageIndexFrameWriter.generate(configuration, Profile.lookup(i).name);
+                PackageDoc[] packages = configuration.profilePackages.get(
+                        Profile.lookup(i).name);
+                PackageDoc prev = null, next;
+                for (int j = 0; j < packages.length; j++) {
+                    // if -nodeprecated option is set and the package is marked as
+                    // deprecated, do not generate the profilename-package-summary.html
+                    // and profilename-package-frame.html pages for that package.
+                    if (!(configuration.nodeprecated && Util.isDeprecated(packages[j]))) {
+                        ProfilePackageFrameWriter.generate(configuration, packages[j], i);
+                        next = (j + 1 < packages.length
+                                && packages[j + 1].name().length() > 0) ? packages[j + 1] : null;
+                        AbstractBuilder profilePackageSummaryBuilder =
+                                configuration.getBuilderFactory().getProfilePackageSummaryBuilder(
+                                packages[j], prev, next, Profile.lookup(i));
+                        profilePackageSummaryBuilder.build();
+                        prev = packages[j];
+                    }
+                }
+                nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ?
+                        Profile.lookup(i + 1) : null;
+                AbstractBuilder profileSummaryBuilder =
+                        configuration.getBuilderFactory().getProfileSummaryBuilder(
+                        Profile.lookup(i), prevProfile, nextProfile);
+                profileSummaryBuilder.build();
+                prevProfile = Profile.lookup(i);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     protected void generatePackageFiles(ClassTree classtree) throws Exception {
         PackageDoc[] packages = configuration.packages;
         if (packages.length > 1) {
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -90,6 +90,16 @@
     protected boolean printedAnnotationHeading = false;
 
     /**
+     * To check whether the repeated annotations is documented or not.
+     */
+    private boolean isAnnotationDocumented = false;
+
+    /**
+     * To check whether the container annotations is documented or not.
+     */
+    private boolean isContainerDocumented = false;
+
+    /**
      * Constructor to construct the HtmlStandardWriter object.
      *
      * @param path File to be generated.
@@ -291,6 +301,107 @@
     }
 
     /**
+     * Get Profile Package link, with target frame.
+     *
+     * @param pd the packageDoc object
+     * @param target name of the target frame
+     * @param label tag for the link
+     * @param profileName the name of the profile being documented
+     * @return a content for the target profile packages link
+     */
+    public Content getTargetProfilePackageLink(PackageDoc pd, String target,
+            Content label, String profileName) {
+        return getHyperLink(pathString(pd, DocPaths.profilePackageSummary(profileName)),
+                label, "", target);
+    }
+
+    /**
+     * Get Profile link, with target frame.
+     *
+     * @param target name of the target frame
+     * @param label tag for the link
+     * @param profileName the name of the profile being documented
+     * @return a content for the target profile link
+     */
+    public Content getTargetProfileLink(String target, Content label,
+            String profileName) {
+        return getHyperLink(pathToRoot.resolve(
+                DocPaths.profileSummary(profileName)), label, "", target);
+    }
+
+    /**
+     * Get the type name for profile search.
+     *
+     * @param cd the classDoc object for which the type name conversion is needed
+     * @return a type name string for the type
+     */
+    public String getTypeNameForProfile(ClassDoc cd) {
+        StringBuilder typeName =
+                new StringBuilder((cd.containingPackage()).name().replace(".", "/"));
+        typeName.append("/")
+                .append(cd.name().replace(".", "$"));
+        return typeName.toString();
+    }
+
+    /**
+     * Check if a type belongs to a profile.
+     *
+     * @param cd the classDoc object that needs to be checked
+     * @param profileValue the profile in which the type needs to be checked
+     * @return true if the type is in the profile
+     */
+    public boolean isTypeInProfile(ClassDoc cd, int profileValue) {
+        return (configuration.profiles.getProfile(getTypeNameForProfile(cd)) <= profileValue);
+    }
+
+    public void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content summaryContentTree,
+            int profileValue) {
+        if(classes.length > 0) {
+            Arrays.sort(classes);
+            Content caption = getTableCaption(label);
+            Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
+                    tableSummary, caption);
+            table.addContent(getSummaryTableHeader(tableHeader, "col"));
+            Content tbody = new HtmlTree(HtmlTag.TBODY);
+            for (int i = 0; i < classes.length; i++) {
+                if (!isTypeInProfile(classes[i], profileValue)) {
+                    continue;
+                }
+                if (!Util.isCoreClass(classes[i]) ||
+                    !configuration.isGeneratedDoc(classes[i])) {
+                    continue;
+                }
+                Content classContent = new RawHtml(getLink(new LinkInfoImpl(
+                        configuration, LinkInfoImpl.CONTEXT_PACKAGE, classes[i],
+                        false)));
+                Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
+                HtmlTree tr = HtmlTree.TR(tdClass);
+                if (i%2 == 0)
+                    tr.addStyle(HtmlStyle.altColor);
+                else
+                    tr.addStyle(HtmlStyle.rowColor);
+                HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
+                tdClassDescription.addStyle(HtmlStyle.colLast);
+                if (Util.isDeprecated(classes[i])) {
+                    tdClassDescription.addContent(deprecatedLabel);
+                    if (classes[i].tags("deprecated").length > 0) {
+                        addSummaryDeprecatedComment(classes[i],
+                            classes[i].tags("deprecated")[0], tdClassDescription);
+                    }
+                }
+                else
+                    addSummaryComment(classes[i], tdClassDescription);
+                tr.addContent(tdClassDescription);
+                tbody.addContent(tr);
+            }
+            table.addContent(tbody);
+            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
+            summaryContentTree.addContent(li);
+        }
+    }
+
+    /**
      * Generates the HTML document tree and prints it out.
      *
      * @param metakeywords Array of String keywords for META tag. Each element
@@ -432,7 +543,8 @@
             }
             HtmlTree navList = new HtmlTree(HtmlTag.UL);
             navList.addStyle(HtmlStyle.navList);
-            navList.addAttr(HtmlAttr.TITLE, "Navigation");
+            navList.addAttr(HtmlAttr.TITLE,
+                            configuration.getText("doclet.Navigation"));
             if (configuration.createoverview) {
                 navList.addContent(getNavLinkContents());
             }
@@ -1188,13 +1300,31 @@
      */
     public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
         String label, boolean strong) {
+        return getDocLink(context, classDoc, doc, label, strong, false);
+    }
+
+   /**
+     * Return the link for the given member.
+     *
+     * @param context the id of the context where the link will be printed.
+     * @param classDoc the classDoc that we should link to.  This is not
+     *                 necessarily equal to doc.containingClass().  We may be
+     *                 inheriting comments.
+     * @param doc the member being linked to.
+     * @param label the label for the link.
+     * @param strong true if the link should be strong.
+     * @param isProperty true if the doc parameter is a JavaFX property.
+     * @return the link for the given member.
+     */
+    public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
+        String label, boolean strong, boolean isProperty) {
         if (! (doc.isIncluded() ||
             Util.isLinkable(classDoc, configuration))) {
             return label;
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
             return getLink(new LinkInfoImpl(configuration, context, classDoc,
-                getAnchor(emd), label, strong));
+                getAnchor(emd, isProperty), label, strong));
         } else if (doc instanceof MemberDoc) {
             return getLink(new LinkInfoImpl(configuration, context, classDoc,
                 doc.name(), label, strong));
@@ -1232,6 +1362,13 @@
     }
 
     public String getAnchor(ExecutableMemberDoc emd) {
+        return getAnchor(emd, false);
+    }
+
+    public String getAnchor(ExecutableMemberDoc emd, boolean isProperty) {
+        if (isProperty) {
+            return emd.name();
+        }
         StringBuilder signature = new StringBuilder(emd.signature());
         StringBuilder signatureParsed = new StringBuilder();
         int counter = 0;
@@ -1720,6 +1857,17 @@
     }
 
     /**
+     * Add the annotation types of the executable receiver.
+     *
+     * @param method the executable to write the receiver annotations for.
+     * @param htmltree the documentation tree to which the annotation info will be
+     *        added
+     */
+    public void addReceiverAnnotationInfo(ExecutableMemberDoc method, Content htmltree) {
+        addAnnotationInfo(method, method.receiverAnnotations(), htmltree);
+    }
+
+    /**
      * Adds the annotatation types for the given doc.
      *
      * @param doc the package to write annotations for
@@ -1789,54 +1937,95 @@
      *         documented.
      */
     private List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
+        return getAnnotations(indent, descList, linkBreak, true);
+    }
+
+    /**
+     * Return the string representations of the annotation types for
+     * the given doc.
+     *
+     * A {@code null} {@code elementType} indicates that all the
+     * annotations should be returned without any filtering.
+     *
+     * @param indent the number of extra spaces to indent the annotations.
+     * @param descList the array of {@link AnnotationDesc}.
+     * @param linkBreak if true, add new line between each member value.
+     * @param elementType the type of targeted element (used for filtering
+     *        type annotations from declaration annotations)
+     * @return an array of strings representing the annotations being
+     *         documented.
+     */
+    public List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak,
+            boolean isJava5DeclarationLocation) {
         List<String> results = new ArrayList<String>();
         StringBuilder annotation;
         for (int i = 0; i < descList.length; i++) {
             AnnotationTypeDoc annotationDoc = descList[i].annotationType();
-            if (! Util.isDocumentedAnnotation(annotationDoc)){
+            // If an annotation is not documented, do not add it to the list. If
+            // the annotation is of a repeatable type, and if it is not documented
+            // and also if its container annotation is not documented, do not add it
+            // to the list. If an annotation of a repeatable type is not documented
+            // but its container is documented, it will be added to the list.
+            if (! Util.isDocumentedAnnotation(annotationDoc) &&
+                    (!isAnnotationDocumented && !isContainerDocumented)) {
                 continue;
             }
+            /* TODO: check logic here to correctly handle declaration
+             * and type annotations.
+            if  (Util.isDeclarationAnnotation(annotationDoc, isJava5DeclarationLocation)) {
+                continue;
+            }*/
             annotation = new StringBuilder();
+            isAnnotationDocumented = false;
             LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
                 LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc);
-            linkInfo.label = "@" + annotationDoc.name();
-            annotation.append(getLink(linkInfo));
             AnnotationDesc.ElementValuePair[] pairs = descList[i].elementValues();
-            if (pairs.length > 0) {
-                annotation.append('(');
+            // If the annotation is synthesized, do not print the container.
+            if (descList[i].isSynthesized()) {
                 for (int j = 0; j < pairs.length; j++) {
-                    if (j > 0) {
-                        annotation.append(",");
-                        if (linkBreak) {
-                            annotation.append(DocletConstants.NL);
-                            int spaces = annotationDoc.name().length() + 2;
-                            for (int k = 0; k < (spaces + indent); k++) {
-                                annotation.append(' ');
-                            }
-                        }
-                    }
-                    annotation.append(getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION,
-                        pairs[j].element(), pairs[j].element().name(), false));
-                    annotation.append('=');
                     AnnotationValue annotationValue = pairs[j].value();
                     List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
                     if (annotationValue.value() instanceof AnnotationValue[]) {
                         AnnotationValue[] annotationArray =
-                            (AnnotationValue[]) annotationValue.value();
-                        for (int k = 0; k < annotationArray.length; k++) {
-                            annotationTypeValues.add(annotationArray[k]);
-                        }
+                                (AnnotationValue[]) annotationValue.value();
+                        annotationTypeValues.addAll(Arrays.asList(annotationArray));
                     } else {
                         annotationTypeValues.add(annotationValue);
                     }
-                    annotation.append(annotationTypeValues.size() == 1 ? "" : "{");
-                    for (Iterator<AnnotationValue> iter = annotationTypeValues.iterator(); iter.hasNext(); ) {
-                        annotation.append(annotationValueToString(iter.next()));
-                        annotation.append(iter.hasNext() ? "," : "");
+                    String sep = "";
+                    for (AnnotationValue av : annotationTypeValues) {
+                        annotation.append(sep);
+                        annotation.append(annotationValueToString(av));
+                        sep = " ";
                     }
-                    annotation.append(annotationTypeValues.size() == 1 ? "" : "}");
                 }
-                annotation.append(")");
+            }
+            else if (isAnnotationArray(pairs)) {
+                // If the container has 1 or more value defined and if the
+                // repeatable type annotation is not documented, do not print
+                // the container.
+                if (pairs.length == 1 && isAnnotationDocumented) {
+                    AnnotationValue[] annotationArray =
+                            (AnnotationValue[]) (pairs[0].value()).value();
+                    List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
+                    annotationTypeValues.addAll(Arrays.asList(annotationArray));
+                    String sep = "";
+                    for (AnnotationValue av : annotationTypeValues) {
+                        annotation.append(sep);
+                        annotation.append(annotationValueToString(av));
+                        sep = " ";
+                    }
+                }
+                // If the container has 1 or more value defined and if the
+                // repeatable type annotation is not documented, print the container.
+                else {
+                    addAnnotations(annotationDoc, linkInfo, annotation, pairs,
+                        indent, false);
+                }
+            }
+            else {
+                addAnnotations(annotationDoc, linkInfo, annotation, pairs,
+                        indent, linkBreak);
             }
             annotation.append(linkBreak ? DocletConstants.NL : "");
             results.add(annotation.toString());
@@ -1844,6 +2033,91 @@
         return results;
     }
 
+    /**
+     * Add annotation to the annotation string.
+     *
+     * @param annotationDoc the annotation being documented
+     * @param linkInfo the information about the link
+     * @param annotation the annotation string to which the annotation will be added
+     * @param pairs annotation type element and value pairs
+     * @param indent the number of extra spaces to indent the annotations.
+     * @param linkBreak if true, add new line between each member value
+     */
+    private void addAnnotations(AnnotationTypeDoc annotationDoc, LinkInfoImpl linkInfo,
+            StringBuilder annotation, AnnotationDesc.ElementValuePair[] pairs,
+            int indent, boolean linkBreak) {
+        linkInfo.label = "@" + annotationDoc.name();
+        annotation.append(getLink(linkInfo));
+        if (pairs.length > 0) {
+            annotation.append('(');
+            for (int j = 0; j < pairs.length; j++) {
+                if (j > 0) {
+                    annotation.append(",");
+                    if (linkBreak) {
+                        annotation.append(DocletConstants.NL);
+                        int spaces = annotationDoc.name().length() + 2;
+                        for (int k = 0; k < (spaces + indent); k++) {
+                            annotation.append(' ');
+                        }
+                    }
+                }
+                annotation.append(getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION,
+                        pairs[j].element(), pairs[j].element().name(), false));
+                annotation.append('=');
+                AnnotationValue annotationValue = pairs[j].value();
+                List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
+                if (annotationValue.value() instanceof AnnotationValue[]) {
+                    AnnotationValue[] annotationArray =
+                            (AnnotationValue[]) annotationValue.value();
+                    annotationTypeValues.addAll(Arrays.asList(annotationArray));
+                } else {
+                    annotationTypeValues.add(annotationValue);
+                }
+                annotation.append(annotationTypeValues.size() == 1 ? "" : "{");
+                String sep = "";
+                for (AnnotationValue av : annotationTypeValues) {
+                    annotation.append(sep);
+                    annotation.append(annotationValueToString(av));
+                    sep = ",";
+                }
+                annotation.append(annotationTypeValues.size() == 1 ? "" : "}");
+                isContainerDocumented = false;
+            }
+            annotation.append(")");
+        }
+    }
+
+    /**
+     * Check if the annotation contains an array of annotation as a value. This
+     * check is to verify if a repeatable type annotation is present or not.
+     *
+     * @param pairs annotation type element and value pairs
+     *
+     * @return true if the annotation contains an array of annotation as a value.
+     */
+    private boolean isAnnotationArray(AnnotationDesc.ElementValuePair[] pairs) {
+        AnnotationValue annotationValue;
+        for (int j = 0; j < pairs.length; j++) {
+            annotationValue = pairs[j].value();
+            if (annotationValue.value() instanceof AnnotationValue[]) {
+                AnnotationValue[] annotationArray =
+                        (AnnotationValue[]) annotationValue.value();
+                if (annotationArray.length > 1) {
+                    if (annotationArray[0].value() instanceof AnnotationDesc) {
+                        AnnotationTypeDoc annotationDoc =
+                                ((AnnotationDesc) annotationArray[0].value()).annotationType();
+                        isContainerDocumented = true;
+                        if (Util.isDocumentedAnnotation(annotationDoc)) {
+                            isAnnotationDocumented = true;
+                        }
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
     private String annotationValueToString(AnnotationValue annotationValue) {
         if (annotationValue.value() instanceof Type) {
             Type type = (Type) annotationValue.value();
--- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -25,6 +25,8 @@
 
 package com.sun.tools.doclets.formats.html;
 
+import java.util.List;
+
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -123,11 +125,50 @@
         typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds;
         typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks;
         typeLinkInfo.linkToSelf = linkInfo.linkToSelf;
+        typeLinkInfo.isJava5DeclarationLocation = false;
         LinkOutput output = getLinkOutput(typeLinkInfo);
         ((LinkInfoImpl) linkInfo).displayLength += typeLinkInfo.displayLength;
         return output;
     }
 
+    protected LinkOutput getTypeAnnotationLink(LinkInfo linkInfo,
+            AnnotationDesc annotation) {
+        throw new RuntimeException("Not implemented yet!");
+    }
+
+    public LinkOutput getTypeAnnotationLinks(LinkInfo linkInfo) {
+        LinkOutput output = getOutputInstance();
+        AnnotationDesc[] annotations;
+        if (linkInfo.type instanceof AnnotatedType) {
+            annotations = linkInfo.type.asAnnotatedType().annotations();
+        } else if (linkInfo.type instanceof TypeVariable) {
+            annotations = linkInfo.type.asTypeVariable().annotations();
+        } else {
+            return output;
+        }
+
+        if (annotations.length == 0)
+            return output;
+
+        List<String> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation);
+
+        boolean isFirst = true;
+        for (String anno : annos) {
+            if (!isFirst) {
+                linkInfo.displayLength += 1;
+                output.append(" ");
+                isFirst = false;
+            }
+            output.append(anno);
+        }
+        if (!annos.isEmpty()) {
+            linkInfo.displayLength += 1;
+            output.append(" ");
+        }
+
+        return output;
+    }
+
     /**
      * Given a class, return the appropriate tool tip.
      *
--- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -198,6 +198,11 @@
      */
     public static final int CONTEXT_CLASS_USE_HEADER = 33;
 
+    /**
+     * The header for property documentation copied from parent.
+     */
+    public static final int CONTEXT_PROPERTY_DOC_COPY = 34;
+
     public final ConfigurationImpl configuration;
 
     /**
@@ -422,6 +427,7 @@
             case CONTEXT_SUBCLASSES:
             case CONTEXT_METHOD_DOC_COPY:
             case CONTEXT_FIELD_DOC_COPY:
+            case CONTEXT_PROPERTY_DOC_COPY:
             case CONTEXT_CLASS_USE_HEADER:
                 includeTypeInClassLinkLabel = false;
                 break;
@@ -459,6 +465,8 @@
 
             case CONTEXT_RETURN_TYPE:
             case CONTEXT_SUMMARY_RETURN_TYPE:
+                excludeTypeBounds = true;
+                break;
             case CONTEXT_EXECUTABLE_MEMBER_PARAM:
                 excludeTypeBounds = true;
                 break;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -130,6 +130,7 @@
             addName(method.name(), pre);
         }
         addParameters(method, pre);
+        addReceiverAnnotations(method, pre);
         addExceptions(method, pre);
         return pre;
     }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -161,6 +161,7 @@
      */
     protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
             Content contentTree) {
+        arr = Util.filterOutPrivateClasses(arr, configuration.javafx);
         if(arr.length > 0) {
             Arrays.sort(arr);
             boolean printedHeader = false;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -145,13 +145,26 @@
      * Adds "All Classes" link for the top of the left-hand frame page to the
      * documentation tree.
      *
-     * @param body the Content object to which the all classes link should be added
+     * @param div the Content object to which the all classes link should be added
      */
-    protected void addAllClassesLink(Content body) {
+    protected void addAllClassesLink(Content div) {
         Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
                 allclassesLabel, "", "packageFrame");
-        Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent);
-        body.addContent(div);
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Profiles" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all profiles link should be added
+     */
+    protected void addAllProfilesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
+                allprofilesLabel, "", "packageListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -29,6 +29,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.formats.html.markup.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -122,6 +123,21 @@
     /**
      * {@inheritDoc}
      */
+    protected void addProfilesList(String profileSummary, String profilesTableSummary,
+            Content body) {
+        Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary,
+                getTableCaption(profileSummary));
+        table.addContent(getSummaryTableHeader(profileTableHeader, "col"));
+        Content tbody = new HtmlTree(HtmlTag.TBODY);
+        addProfilesList(tbody);
+        table.addContent(tbody);
+        Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
+        body.addContent(div);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     protected void addPackagesList(PackageDoc[] packages, String text,
             String tableSummary, Content body) {
         Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
@@ -135,6 +151,31 @@
     }
 
     /**
+     * Adds list of profiles in the index table. Generate link to each profile.
+     *
+     * @param tbody the documentation tree to which the list will be added
+     */
+    protected void addProfilesList(Content tbody) {
+        for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
+            String profileName = Profile.lookup(i).name;
+            Content profileLinkContent = getTargetProfileLink("classFrame",
+                    new StringContent(profileName), profileName);
+            Content tdProfile = HtmlTree.TD(HtmlStyle.colFirst, profileLinkContent);
+            HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+            tdSummary.addStyle(HtmlStyle.colLast);
+            tdSummary.addContent(getSpace());
+            HtmlTree tr = HtmlTree.TR(tdProfile);
+            tr.addContent(tdSummary);
+            if (i % 2 == 0) {
+                tr.addStyle(HtmlStyle.altColor);
+            } else {
+                tr.addStyle(HtmlStyle.rowColor);
+            }
+            tbody.addContent(tr);
+        }
+    }
+
+    /**
      * Adds list of packages in the index table. Generate link to each package.
      *
      * @param packages Packages to which link is to be generated
@@ -196,10 +237,7 @@
     protected void addOverviewComment(Content htmltree) {
         if (root.inlineTags().length > 0) {
             htmltree.addContent(getMarkerAnchor("overview_description"));
-            HtmlTree div = new HtmlTree(HtmlTag.DIV);
-            div.addStyle(HtmlStyle.subTitle);
-            addInlineComment(root, div);
-            htmltree.addContent(div);
+            addInlineComment(root, htmltree);
         }
     }
 
@@ -211,7 +249,7 @@
      */
     protected void addOverview(Content body) throws IOException {
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
-        div.addStyle(HtmlStyle.footer);
+        div.addStyle(HtmlStyle.contentContainer);
         addOverviewComment(div);
         addTagsInfo(root, div);
         body.addContent(div);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,173 @@
+/*
+ * 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;
+
+import java.io.*;
+
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.javac.jvm.Profile;
+
+/**
+ * Generate the profile index for the left-hand frame in the generated output.
+ * A click on the profile name in this frame will update the page in the top
+ * left hand frame with the listing of packages of the clicked profile.
+ *
+ *  <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 class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
+
+    /**
+     * Construct the ProfileIndexFrameWriter object.
+     *
+     * @param configuration the configuration object
+     * @param filename Name of the profile index file to be generated.
+     */
+    public ProfileIndexFrameWriter(ConfigurationImpl configuration,
+                                   DocPath filename) throws IOException {
+        super(configuration, filename);
+    }
+
+    /**
+     * Generate the profile index file named "profile-overview-frame.html".
+     * @throws DocletAbortException
+     * @param configuration the configuration object
+     */
+    public static void generate(ConfigurationImpl configuration) {
+        ProfileIndexFrameWriter profilegen;
+        DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME;
+        try {
+            profilegen = new ProfileIndexFrameWriter(configuration, filename);
+            profilegen.buildProfileIndexFile("doclet.Window_Overview", false);
+            profilegen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                        "doclet.exception_encountered",
+                        exc.toString(), filename);
+            throw new DocletAbortException();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addProfilesList(Profiles profiles, String text,
+            String tableSummary, Content body) {
+        Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
+                profilesLabel);
+        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        ul.addAttr(HtmlAttr.TITLE, profilesLabel.toString());
+        for (int i = 1; i < profiles.getProfileCount(); i++) {
+            ul.addContent(getProfile(i));
+        }
+        div.addContent(ul);
+        body.addContent(div);
+    }
+
+    /**
+     * Gets each profile name as a separate link.
+     *
+     * @param profile the profile being documented
+     * @return content for the profile link
+     */
+    protected Content getProfile(int profile) {
+        Content profileLinkContent;
+        Content profileLabel;
+        String profileName = (Profile.lookup(profile)).name;
+        profileLabel = new StringContent(profileName);
+        profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "",
+                    "packageListFrame");
+        Content li = HtmlTree.LI(profileLinkContent);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarHeader(Content body) {
+        Content headerContent;
+        if (configuration.packagesheader.length() > 0) {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
+        } else {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.header));
+        }
+        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.bar, headerContent);
+        body.addContent(heading);
+    }
+
+    /**
+     * Do nothing as there is no overview information in this page.
+     */
+    protected void addOverviewHeader(Content body) {
+    }
+
+    /**
+     * Adds "All Classes" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all classes link should be added
+     */
+    protected void addAllClassesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
+                allclassesLabel, "", "packageFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Packages" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all packages link should be added
+     */
+    protected void addAllPackagesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
+                allpackagesLabel, "", "packageListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarFooter(Content body) {
+        Content p = HtmlTree.P(getSpace());
+        body.addContent(p);
+    }
+
+    protected void addProfilePackagesList(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.  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;
+
+import java.io.*;
+import java.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class to generate file for each package contents of a profile in the left-hand bottom
+ * frame. This will list all the Class Kinds in the package for a profile. A click on any
+ * class-kind will update the right-hand frame with the clicked class-kind page.
+ *
+ *  <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 class ProfilePackageFrameWriter extends HtmlDocletWriter {
+
+    /**
+     * The package being documented.
+     */
+    private PackageDoc packageDoc;
+
+    /**
+     * Constructor to construct ProfilePackageFrameWriter object and to generate
+     * "profilename-package-frame.html" file in the respective package directory.
+     * For example for profile compact1 and package "java.lang" this will generate file
+     * "compact1-package-frame.html" file in the "java/lang" directory. It will also
+     * create "java/lang" directory in the current or the destination directory
+     * if it doesn't exist.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param packageDoc PackageDoc under consideration.
+     * @param profileName the name of the profile being documented
+     */
+    public ProfilePackageFrameWriter(ConfigurationImpl configuration,
+            PackageDoc packageDoc, String profileName)
+            throws IOException {
+        super(configuration, DocPath.forPackage(packageDoc).resolve(
+                DocPaths.profilePackageFrame(profileName)));
+        this.packageDoc = packageDoc;
+    }
+
+    /**
+     * Generate a profile package summary page for the left-hand bottom frame. Construct
+     * the ProfilePackageFrameWriter object and then uses it generate the file.
+     *
+     * @param configuration the current configuration of the doclet.
+     * @param packageDoc The package for which "profilename-package-frame.html" is to be generated.
+     * @param profileValue the value of the profile being documented
+     */
+    public static void generate(ConfigurationImpl configuration,
+            PackageDoc packageDoc, int profileValue) {
+        ProfilePackageFrameWriter profpackgen;
+        try {
+            String profileName = Profile.lookup(profileValue).name;
+            profpackgen = new ProfilePackageFrameWriter(configuration, packageDoc,
+                    profileName);
+            StringBuilder winTitle = new StringBuilder(profileName);
+            String sep = " - ";
+            winTitle.append(sep);
+            String pkgName = Util.getPackageName(packageDoc);
+            winTitle.append(pkgName);
+            Content body = profpackgen.getBody(false,
+                    profpackgen.getWindowTitle(winTitle.toString()));
+            Content profName = new StringContent(profileName);
+            Content sepContent = new StringContent(sep);
+            Content pkgNameContent = new RawHtml(pkgName);
+            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
+                    profpackgen.getTargetProfileLink("classFrame", profName, profileName));
+            heading.addContent(sepContent);
+            heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc,
+                    "classFrame", pkgNameContent, profileName));
+            body.addContent(heading);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.indexContainer);
+            profpackgen.addClassListing(div, profileValue);
+            body.addContent(div);
+            profpackgen.printHtmlDocument(
+                    configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
+            profpackgen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                    "doclet.exception_encountered",
+                    exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
+            throw new DocletAbortException();
+        }
+    }
+
+    /**
+     * Add class listing for all the classes in this package. Divide class
+     * listing as per the class kind and generate separate listing for
+     * Classes, Interfaces, Exceptions and Errors.
+     *
+     * @param contentTree the content tree to which the listing will be added
+     * @param profileValue the value of the profile being documented
+     */
+    protected void addClassListing(Content contentTree, int profileValue) {
+        if (packageDoc.isIncluded()) {
+            addClassKindListing(packageDoc.interfaces(),
+                getResource("doclet.Interfaces"), contentTree, profileValue);
+            addClassKindListing(packageDoc.ordinaryClasses(),
+                getResource("doclet.Classes"), contentTree, profileValue);
+            addClassKindListing(packageDoc.enums(),
+                getResource("doclet.Enums"), contentTree, profileValue);
+            addClassKindListing(packageDoc.exceptions(),
+                getResource("doclet.Exceptions"), contentTree, profileValue);
+            addClassKindListing(packageDoc.errors(),
+                getResource("doclet.Errors"), contentTree, profileValue);
+            addClassKindListing(packageDoc.annotationTypes(),
+                getResource("doclet.AnnotationTypes"), contentTree, profileValue);
+        }
+    }
+
+    /**
+     * Add specific class kind listing. Also add label to the listing.
+     *
+     * @param arr Array of specific class kinds, namely Class or Interface or Exception or Error
+     * @param labelContent content tree of the label to be added
+     * @param contentTree the content tree to which the class kind listing will be added
+     * @param profileValue the value of the profile being documented
+     */
+    protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
+            Content contentTree, int profileValue) {
+        if(arr.length > 0) {
+            Arrays.sort(arr);
+            boolean printedHeader = false;
+            HtmlTree ul = new HtmlTree(HtmlTag.UL);
+            ul.addAttr(HtmlAttr.TITLE, labelContent.toString());
+            for (int i = 0; i < arr.length; i++) {
+                if (!isTypeInProfile(arr[i], profileValue)) {
+                    continue;
+                }
+                if (!Util.isCoreClass(arr[i]) || !
+                        configuration.isGeneratedDoc(arr[i])) {
+                    continue;
+                }
+                if (!printedHeader) {
+                    Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
+                            true, labelContent);
+                    contentTree.addContent(heading);
+                    printedHeader = true;
+                }
+                Content link = new RawHtml (getLink(new LinkInfoImpl(configuration,
+                        LinkInfoImpl.PACKAGE_FRAME, arr[i],
+                        (arr[i].isInterface() ? italicsText(arr[i].name()) :
+                            arr[i].name()),"classFrame")));
+                Content li = HtmlTree.LI(link);
+                ul.addContent(li);
+            }
+            contentTree.addContent(ul);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,200 @@
+/*
+ * 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;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Generate the profile package index for the left-hand frame in the generated output.
+ * A click on the package name in this frame will update the page in the bottom
+ * left hand frame with the listing of contents of the clicked profile package.
+ *
+ *  <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 class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
+
+    /**
+     * Construct the ProfilePackageIndexFrameWriter object.
+     *
+     * @param configuration the configuration object
+     * @param filename Name of the package index file to be generated.
+     */
+    public ProfilePackageIndexFrameWriter(ConfigurationImpl configuration,
+                                   DocPath filename) throws IOException {
+        super(configuration, filename);
+    }
+
+    /**
+     * Generate the profile package index file.
+     * @throws DocletAbortException
+     * @param configuration the configuration object
+     * @param profileName the name of the profile being documented
+     */
+    public static void generate(ConfigurationImpl configuration, String profileName) {
+        ProfilePackageIndexFrameWriter profpackgen;
+        DocPath filename = DocPaths.profileFrame(profileName);
+        try {
+            profpackgen = new ProfilePackageIndexFrameWriter(configuration, filename);
+            profpackgen.buildProfilePackagesIndexFile("doclet.Window_Overview", false, profileName);
+            profpackgen.close();
+        } catch (IOException exc) {
+            configuration.standardmessage.error(
+                        "doclet.exception_encountered",
+                        exc.toString(), filename);
+            throw new DocletAbortException();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addProfilePackagesList(Profiles profiles, String text,
+            String tableSummary, Content body, String profileName) {
+        Content profNameContent = new StringContent(profileName);
+        Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
+                getTargetProfileLink("classFrame", profNameContent, profileName));
+        heading.addContent(getSpace());
+        heading.addContent(packagesLabel);
+        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
+        PackageDoc[] packages = configuration.profilePackages.get(profileName);
+        for (int i = 0; i < packages.length; i++) {
+            if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
+                ul.addContent(getPackage(packages[i], profileName));
+            }
+        }
+        div.addContent(ul);
+        body.addContent(div);
+    }
+
+    /**
+     * Gets each package name as a separate link.
+     *
+     * @param pd PackageDoc
+     * @param profileName the name of the profile being documented
+     * @return content for the package link
+     */
+    protected Content getPackage(PackageDoc pd, String profileName) {
+        Content packageLinkContent;
+        Content pkgLabel;
+        if (pd.name().length() > 0) {
+            pkgLabel = getPackageLabel(pd.name());
+            packageLinkContent = getHyperLink(pathString(pd,
+                     DocPaths.profilePackageFrame(profileName)), pkgLabel, "",
+                    "packageFrame");
+        } else {
+            pkgLabel = new RawHtml("&lt;unnamed package&gt;");
+            packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
+                    pkgLabel, "", "packageFrame");
+        }
+        Content li = HtmlTree.LI(packageLinkContent);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarHeader(Content body) {
+        Content headerContent;
+        if (configuration.packagesheader.length() > 0) {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
+        } else {
+            headerContent = new RawHtml(replaceDocRootDir(configuration.header));
+        }
+        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.bar, headerContent);
+        body.addContent(heading);
+    }
+
+    /**
+     * Do nothing as there is no overview information in this page.
+     */
+    protected void addOverviewHeader(Content body) {
+    }
+
+    protected void addProfilesList(Profiles profiles, String text,
+            String tableSummary, Content body) {
+    }
+
+    /**
+     * Adds "All Classes" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all classes link should be added
+     */
+    protected void addAllClassesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
+                allclassesLabel, "", "packageFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Packages" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all packages link should be added
+     */
+    protected void addAllPackagesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
+                allpackagesLabel, "", "packageListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * Adds "All Profiles" link for the top of the left-hand frame page to the
+     * documentation tree.
+     *
+     * @param div the Content object to which the all profiles link should be added
+     */
+    protected void addAllProfilesLink(Content div) {
+        Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
+                allprofilesLabel, "", "packageListFrame");
+        Content span = HtmlTree.SPAN(linkContent);
+        div.addContent(span);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavigationBarFooter(Content body) {
+        Content p = HtmlTree.P(getSpace());
+        body.addContent(p);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,296 @@
+/*
+ * 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;
+
+import java.io.*;
+import java.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class to generate file for each profile package contents in the right-hand
+ * frame. This will list all the Class Kinds in the package. A click on any
+ * class-kind will update the frame with the clicked class-kind page.
+ *
+ *  <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 class ProfilePackageWriterImpl extends HtmlDocletWriter
+    implements ProfilePackageSummaryWriter {
+
+    /**
+     * The prev package name in the alpha-order list.
+     */
+    protected PackageDoc prev;
+
+    /**
+     * The next package name in the alpha-order list.
+     */
+    protected PackageDoc next;
+
+    /**
+     * The profile package being documented.
+     */
+    protected PackageDoc packageDoc;
+
+    /**
+     * The name of the profile being documented.
+     */
+    protected String profileName;
+
+    /**
+     * The value of the profile being documented.
+     */
+    protected int profileValue;
+
+    /**
+     * Constructor to construct ProfilePackageWriter object and to generate
+     * "profilename-package-summary.html" file in the respective package directory.
+     * For example for profile compact1 and package "java.lang" this will generate file
+     * "compact1-package-summary.html" file in the "java/lang" directory. It will also
+     * create "java/lang" directory in the current or the destination directory
+     * if it doesn't exist.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param packageDoc    PackageDoc under consideration.
+     * @param prev          Previous package in the sorted array.
+     * @param next          Next package in the sorted array.
+     * @param profile       The profile being documented.
+     */
+    public ProfilePackageWriterImpl(ConfigurationImpl configuration,
+            PackageDoc packageDoc, PackageDoc prev, PackageDoc next,
+            Profile profile) throws IOException {
+        super(configuration, DocPath.forPackage(packageDoc).resolve(
+                DocPaths.profilePackageSummary(profile.name)));
+        this.prev = prev;
+        this.next = next;
+        this.packageDoc = packageDoc;
+        this.profileName = profile.name;
+        this.profileValue = profile.value;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPackageHeader(String heading) {
+        String pkgName = packageDoc.name();
+        Content bodyTree = getBody(true, getWindowTitle(pkgName));
+        addTop(bodyTree);
+        addNavLinks(true, bodyTree);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.header);
+        Content profileContent = new StringContent(profileName);
+        Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profileContent);
+        div.addContent(profileNameDiv);
+        Content annotationContent = new HtmlTree(HtmlTag.P);
+        addAnnotationInfo(packageDoc, annotationContent);
+        div.addContent(annotationContent);
+        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.title, packageLabel);
+        tHeading.addContent(getSpace());
+        Content packageHead = new RawHtml(heading);
+        tHeading.addContent(packageHead);
+        div.addContent(tHeading);
+        addDeprecationInfo(div);
+        if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
+            HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
+            docSummaryDiv.addStyle(HtmlStyle.docSummary);
+            addSummaryComment(packageDoc, docSummaryDiv);
+            div.addContent(docSummaryDiv);
+            Content space = getSpace();
+            Content descLink = getHyperLink(DocLink.fragment("package_description"),
+                    descriptionLabel, "", "");
+            Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
+            div.addContent(descPara);
+        }
+        bodyTree.addContent(div);
+        return bodyTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getContentHeader() {
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.contentContainer);
+        return div;
+    }
+
+    /**
+     * Add the package deprecation information to the documentation tree.
+     *
+     * @param div the content tree to which the deprecation information will be added
+     */
+    public void addDeprecationInfo(Content div) {
+        Tag[] deprs = packageDoc.tags("deprecated");
+        if (Util.isDeprecated(packageDoc)) {
+            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
+            deprDiv.addStyle(HtmlStyle.deprecatedContent);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase);
+            deprDiv.addContent(deprPhrase);
+            if (deprs.length > 0) {
+                Tag[] commentTags = deprs[0].inlineTags();
+                if (commentTags.length > 0) {
+                    addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv);
+                }
+            }
+            div.addContent(deprDiv);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
+        addClassesSummary(classes, label, tableSummary, tableHeader,
+                packageSummaryContentTree, profileValue);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSummaryHeader() {
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        ul.addStyle(HtmlStyle.blockList);
+        return ul;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPackageDescription(Content packageContentTree) {
+        if (packageDoc.inlineTags().length > 0) {
+            packageContentTree.addContent(getMarkerAnchor("package_description"));
+            Content h2Content = new StringContent(
+                    configuration.getText("doclet.Package_Description",
+                    packageDoc.name()));
+            packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
+                    true, h2Content));
+            addInlineComment(packageDoc, packageContentTree);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPackageTags(Content packageContentTree) {
+        addTagsInfo(packageDoc, packageContentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPackageFooter(Content contentTree) {
+        addNavLinks(false, contentTree);
+        addBottom(contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void printDocument(Content contentTree) throws IOException {
+        printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
+                true, contentTree);
+    }
+
+    /**
+     * Get "Use" link for this package in the navigation bar.
+     *
+     * @return a content tree for the class use link
+     */
+    protected Content getNavLinkClassUse() {
+        Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
+                useLabel, "", "");
+        Content li = HtmlTree.LI(useLink);
+        return li;
+    }
+
+    /**
+     * Get "PREV PACKAGE" link in the navigation bar.
+     *
+     * @return a content tree for the previous link
+     */
+    public Content getNavLinkPrevious() {
+        Content li;
+        if (prev == null) {
+            li = HtmlTree.LI(prevpackageLabel);
+        } else {
+            DocPath path = DocPath.relativePath(packageDoc, prev);
+            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
+                prevpackageLabel, "", ""));
+        }
+        return li;
+    }
+
+    /**
+     * Get "NEXT PACKAGE" link in the navigation bar.
+     *
+     * @return a content tree for the next link
+     */
+    public Content getNavLinkNext() {
+        Content li;
+        if (next == null) {
+            li = HtmlTree.LI(nextpackageLabel);
+        } else {
+            DocPath path = DocPath.relativePath(packageDoc, next);
+            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
+                nextpackageLabel, "", ""));
+        }
+        return li;
+    }
+
+    /**
+     * Get "Tree" link in the navigation bar. This will be link to the package
+     * tree file.
+     *
+     * @return a content tree for the tree link
+     */
+    protected Content getNavLinkTree() {
+        Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
+                treeLabel, "", "");
+        Content li = HtmlTree.LI(useLink);
+        return li;
+    }
+
+    /**
+     * Highlight "Package" in the navigation bar, as this is the package page.
+     *
+     * @return a content tree for the package link
+     */
+    protected Content getNavLinkPackage() {
+        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
+        return li;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,208 @@
+/*
+ * 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;
+
+import java.io.*;
+import java.util.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class to generate file for each profile contents in the right-hand
+ * frame. This will list all the packages and Class Kinds in the profile. A click on any
+ * class-kind will update the frame with the clicked class-kind page. A click on any
+ * package will update the frame with the clicked profile package page.
+ *
+ *  <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 class ProfileWriterImpl extends HtmlDocletWriter
+    implements ProfileSummaryWriter {
+
+    /**
+     * The prev profile name in the alpha-order list.
+     */
+    protected Profile prevProfile;
+
+    /**
+     * The next profile name in the alpha-order list.
+     */
+    protected Profile nextProfile;
+
+    /**
+     * The profile being documented.
+     */
+    protected Profile profile;
+
+    /**
+     * Constructor to construct ProfileWriter object and to generate
+     * "profileName-summary.html" file.
+     *
+     * @param configuration the configuration of the doclet.
+     * @param profile       Profile under consideration.
+     * @param prevProfile   Previous profile in the sorted array.
+     * @param nextProfile   Next profile in the sorted array.
+     */
+    public ProfileWriterImpl(ConfigurationImpl configuration,
+            Profile profile, Profile prevProfile, Profile nextProfile)
+            throws IOException {
+        super(configuration, DocPaths.profileSummary(profile.name));
+        this.prevProfile = prevProfile;
+        this.nextProfile = nextProfile;
+        this.profile = profile;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getProfileHeader(String heading) {
+        String profileName = profile.name;
+        Content bodyTree = getBody(true, getWindowTitle(profileName));
+        addTop(bodyTree);
+        addNavLinks(true, bodyTree);
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.header);
+        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+                HtmlStyle.title, profileLabel);
+        tHeading.addContent(getSpace());
+        Content profileHead = new RawHtml(heading);
+        tHeading.addContent(profileHead);
+        div.addContent(tHeading);
+        bodyTree.addContent(div);
+        return bodyTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getContentHeader() {
+        HtmlTree div = new HtmlTree(HtmlTag.DIV);
+        div.addStyle(HtmlStyle.contentContainer);
+        return div;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSummaryHeader() {
+        HtmlTree li = new HtmlTree(HtmlTag.LI);
+        li.addStyle(HtmlStyle.blockList);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSummaryTree(Content summaryContentTree) {
+        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
+        HtmlTree div = HtmlTree.DIV(HtmlStyle.summary, ul);
+        return div;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPackageSummaryHeader(PackageDoc pkg) {
+        Content pkgName = getTargetProfilePackageLink(pkg,
+                    "classFrame", new StringContent(pkg.name()), profile.name);
+        Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgName);
+        HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, heading);
+        return li;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPackageSummaryTree(Content packageSummaryContentTree) {
+        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, packageSummaryContentTree);
+        return ul;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
+        addClassesSummary(classes, label, tableSummary, tableHeader,
+                packageSummaryContentTree, profile.value);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addProfileFooter(Content contentTree) {
+        addNavLinks(false, contentTree);
+        addBottom(contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void printDocument(Content contentTree) throws IOException {
+        printHtmlDocument(configuration.metakeywords.getMetaKeywords(profile),
+                true, contentTree);
+    }
+
+    /**
+     * Get "PREV PROFILE" link in the navigation bar.
+     *
+     * @return a content tree for the previous link
+     */
+    public Content getNavLinkPrevious() {
+        Content li;
+        if (prevProfile == null) {
+            li = HtmlTree.LI(prevprofileLabel);
+        } else {
+            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
+                    prevProfile.name)), prevprofileLabel, "", ""));
+        }
+        return li;
+    }
+
+    /**
+     * Get "NEXT PROFILE" link in the navigation bar.
+     *
+     * @return a content tree for the next link
+     */
+    public Content getNavLinkNext() {
+        Content li;
+        if (nextProfile == null) {
+            li = HtmlTree.LI(nextprofileLabel);
+        } else {
+            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
+                    nextProfile.name)), nextprofileLabel, "", ""));
+        }
+        return li;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 1997, 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;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Writes property documentation in HTML format.
+ *
+ *  <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 Robert Field
+ * @author Atul M Dambalkar
+ * @author Jamie Ho (rewrite)
+ * @author Bhavesh Patel (Modified)
+ */
+public class PropertyWriterImpl extends AbstractMemberWriter
+    implements PropertyWriter, MemberSummaryWriter {
+
+    public PropertyWriterImpl(SubWriterHolderWriter writer, ClassDoc classdoc) {
+        super(writer, classdoc);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getMemberSummaryHeader(ClassDoc classDoc,
+            Content memberSummaryTree) {
+        memberSummaryTree.addContent(HtmlConstants.START_OF_PROPERTY_SUMMARY);
+        Content memberTree = writer.getMemberTreeHeader();
+        writer.addSummaryHeader(this, classDoc, memberTree);
+        return memberTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPropertyDetailsTreeHeader(ClassDoc classDoc,
+            Content memberDetailsTree) {
+        memberDetailsTree.addContent(HtmlConstants.START_OF_PROPERTY_DETAILS);
+        Content propertyDetailsTree = writer.getMemberTreeHeader();
+        propertyDetailsTree.addContent(writer.getMarkerAnchor("property_detail"));
+        Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
+                writer.propertyDetailsLabel);
+        propertyDetailsTree.addContent(heading);
+        return propertyDetailsTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPropertyDocTreeHeader(MethodDoc property,
+            Content propertyDetailsTree) {
+        propertyDetailsTree.addContent(
+                writer.getMarkerAnchor(property.name()));
+        Content propertyDocTree = writer.getMemberTreeHeader();
+        Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
+        heading.addContent(property.name().substring(0, property.name().lastIndexOf("Property")));
+        propertyDocTree.addContent(heading);
+        return propertyDocTree;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getSignature(MethodDoc property) {
+        Content pre = new HtmlTree(HtmlTag.PRE);
+        writer.addAnnotationInfo(property, pre);
+        addModifiers(property, pre);
+        Content propertylink = new RawHtml(writer.getLink(new LinkInfoImpl(
+                configuration, LinkInfoImpl.CONTEXT_MEMBER,
+                property.returnType())));
+        pre.addContent(propertylink);
+        pre.addContent(" ");
+        if (configuration.linksource) {
+            Content propertyName = new StringContent(property.name());
+            writer.addSrcLink(property, propertyName, pre);
+        } else {
+            addName(property.name(), pre);
+        }
+        return pre;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addDeprecated(MethodDoc property, Content propertyDocTree) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addComments(MethodDoc property, Content propertyDocTree) {
+        ClassDoc holder = property.containingClass();
+        if (property.inlineTags().length > 0) {
+            if (holder.equals(classdoc) ||
+                    (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
+                writer.addInlineComment(property, propertyDocTree);
+            } else {
+                Content link = new RawHtml(
+                        writer.getDocLink(LinkInfoImpl.CONTEXT_PROPERTY_DOC_COPY,
+                        holder, property,
+                        holder.isIncluded() ?
+                            holder.typeName() : holder.qualifiedTypeName(),
+                            false));
+                Content codeLink = HtmlTree.CODE(link);
+                Content strong = HtmlTree.STRONG(holder.isClass()?
+                   writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
+                strong.addContent(writer.getSpace());
+                strong.addContent(codeLink);
+                propertyDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, strong));
+                writer.addInlineComment(property, propertyDocTree);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addTags(MethodDoc property, Content propertyDocTree) {
+        writer.addTagsInfo(property, propertyDocTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPropertyDetails(Content propertyDetailsTree) {
+        return getMemberTree(propertyDetailsTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Content getPropertyDoc(Content propertyDocTree,
+            boolean isLastContent) {
+        return getMemberTree(propertyDocTree, isLastContent);
+    }
+
+    /**
+     * Close the writer.
+     */
+    public void close() throws IOException {
+        writer.close();
+    }
+
+    public int getMemberKind() {
+        return VisibleMemberMap.PROPERTIES;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryLabel(Content memberTree) {
+        Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
+                writer.getResource("doclet.Property_Summary"));
+        memberTree.addContent(label);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getTableSummary() {
+        return configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Property_Summary"),
+                configuration.getText("doclet.properties"));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCaption() {
+        return configuration.getText("doclet.Properties");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] getSummaryTableHeader(ProgramElementDoc member) {
+        String[] header = new String[] {
+            configuration.getText("doclet.Type"),
+            configuration.getText("doclet.0_and_1",
+                    configuration.getText("doclet.Property"),
+                    configuration.getText("doclet.Description"))
+        };
+        return header;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
+        memberTree.addContent(writer.getMarkerAnchor("property_summary"));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
+        inheritedTree.addContent(writer.getMarkerAnchor(
+                "properties_inherited_from_class_" + configuration.getClassName(cd)));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
+        Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
+                LinkInfoImpl.CONTEXT_MEMBER, cd, false));
+        Content label = new StringContent(cd.isClass() ?
+            configuration.getText("doclet.Properties_Inherited_From_Class") :
+            configuration.getText("doclet.Properties_Inherited_From_Interface"));
+        Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
+                label);
+        labelHeading.addContent(writer.getSpace());
+        labelHeading.addContent(classLink);
+        inheritedTree.addContent(labelHeading);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
+            Content tdSummary) {
+        Content strong = HtmlTree.STRONG(new RawHtml(
+                writer.getDocLink(context,
+                        cd,
+                        (MemberDoc) member,
+                        member.name().substring(0, member.name().lastIndexOf("Property")),
+                        false,
+                        true)));
+
+        Content code = HtmlTree.CODE(strong);
+        tdSummary.addContent(code);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addInheritedSummaryLink(ClassDoc cd,
+            ProgramElementDoc member, Content linksTree) {
+        linksTree.addContent(new RawHtml(
+                writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc)member,
+                ((member.name().lastIndexOf("Property") != -1) && configuration.javafx)
+                        ? member.name().substring(0, member.name().length() - "Property".length())
+                        : member.name(),
+                false, true)));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
+        MethodDoc property = (MethodDoc)member;
+        addModifierAndType(property, property.returnType(), tdSummaryType);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Content getDeprecatedLink(ProgramElementDoc member) {
+        return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER,
+                (MemberDoc) member, ((MethodDoc)member).qualifiedName());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
+        if (link) {
+            return writer.getHyperLink((cd == null)?
+                "property_summary":
+                "properties_inherited_from_class_" +
+                configuration.getClassName(cd),
+                writer.getResource("doclet.navProperty"));
+        } else {
+            return writer.getResource("doclet.navProperty");
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void addNavDetailLink(boolean link, Content liNav) {
+        if (link) {
+            liNav.addContent(writer.getHyperLink("property_detail",
+                    writer.getResource("doclet.navProperty")));
+        } else {
+            liNav.addContent(writer.getResource("doclet.navProperty"));
+        }
+    }
+}
--- a/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -28,6 +28,7 @@
 import java.io.IOException;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -69,6 +70,24 @@
     /**
      * {@inheritDoc}
      */
+    public ProfileSummaryWriter getProfileSummaryWriter(Profile profile,
+        Profile prevProfile, Profile nextProfile) throws Exception {
+        return new ProfileWriterImpl(configuration, profile,
+            prevProfile, nextProfile);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ProfilePackageSummaryWriter getProfilePackageSummaryWriter(PackageDoc packageDoc,
+        PackageDoc prevPkg, PackageDoc nextPkg, Profile profile) throws Exception {
+        return new ProfilePackageWriterImpl(configuration, packageDoc,
+            prevPkg, nextPkg, profile);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
             ClassDoc nextClass, ClassTree classTree) throws IOException {
         return new ClassWriterImpl(configuration, classDoc,
@@ -127,6 +146,15 @@
     /**
      * {@inheritDoc}
      */
+    public PropertyWriterImpl getPropertyWriter(ClassWriter classWriter)
+            throws Exception {
+        return new PropertyWriterImpl((SubWriterHolderWriter) classWriter,
+            classWriter.getClassDoc());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public MethodWriterImpl getMethodWriter(ClassWriter classWriter)
             throws Exception {
         return new MethodWriterImpl((SubWriterHolderWriter) classWriter,
@@ -155,6 +183,8 @@
                 return getEnumConstantWriter(classWriter);
             case VisibleMemberMap.FIELDS:
                 return getFieldWriter(classWriter);
+            case VisibleMemberMap.PROPERTIES:
+                return getPropertyWriter(classWriter);
             case VisibleMemberMap.INNERCLASSES:
                 return new NestedClassWriterImpl((SubWriterHolderWriter)
                     classWriter, classWriter.getClassDoc());
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlConstants.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -112,6 +112,12 @@
             new Comment("=========== FIELD SUMMARY ===========");
 
     /**
+     * Marker to identify start of properties summary.
+     */
+    public static final Content START_OF_PROPERTY_SUMMARY =
+            new Comment("=========== PROPERTY SUMMARY ===========");
+
+    /**
      * Marker to identify start of method summary.
      */
     public static final Content START_OF_METHOD_SUMMARY =
@@ -136,6 +142,12 @@
             new Comment("============ FIELD DETAIL ===========");
 
     /**
+     * Marker to identify start of property details.
+     */
+    public static final Content START_OF_PROPERTY_DETAILS =
+            new Comment("============ PROPERTY DETAIL ===========");
+
+    /**
      * Marker to identify start of constructor details.
      */
     public static final Content START_OF_CONSTRUCTOR_DETAILS =
@@ -168,6 +180,11 @@
     public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
 
     /**
+     * Html tag for the profile name heading.
+     */
+    public static final HtmlTag PROFILE_HEADING = HtmlTag.H2;
+
+    /**
      * Html tag for the member summary heading.
      */
     public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -63,6 +63,11 @@
     protected boolean memberDetailsListPrinted;
 
     /**
+     * Header for table displaying profiles and description..
+     */
+    protected final String[] profileTableHeader;
+
+    /**
      * Header for tables displaying packages and description..
      */
     protected final String[] packageTableHeader;
@@ -83,6 +88,8 @@
 
     public final Content packageLabel;
 
+    public final Content profileLabel;
+
     public final Content useLabel;
 
     public final Content prevLabel;
@@ -111,6 +118,10 @@
 
     public final Content allclassesLabel;
 
+    public final Content allpackagesLabel;
+
+    public final Content allprofilesLabel;
+
     public final Content indexLabel;
 
     public final Content helpLabel;
@@ -123,14 +134,22 @@
 
     public final Content nextpackageLabel;
 
+    public final Content prevprofileLabel;
+
+    public final Content nextprofileLabel;
+
     public final Content packagesLabel;
 
+    public final Content profilesLabel;
+
     public final Content methodDetailsLabel;
 
     public final Content annotationTypeDetailsLabel;
 
     public final Content fieldDetailsLabel;
 
+    public final Content propertyDetailsLabel;
+
     public final Content constructorDetailsLabel;
 
     public final Content enumConstantsDetailsLabel;
@@ -162,6 +181,10 @@
         writer = DocFile.createFileForOutput(configuration, path).openWriter();
         this.configuration = configuration;
         this.memberDetailsListPrinted = false;
+        profileTableHeader = new String[] {
+            configuration.getText("doclet.Profile"),
+            configuration.getText("doclet.Description")
+        };
         packageTableHeader = new String[] {
             configuration.getText("doclet.Package"),
             configuration.getText("doclet.Description")
@@ -175,6 +198,7 @@
         defaultPackageLabel = new RawHtml(
                 DocletConstants.DEFAULT_PACKAGE_NAME);
         packageLabel = getResource("doclet.Package");
+        profileLabel = getResource("doclet.Profile");
         useLabel = getResource("doclet.navClassUse");
         prevLabel = getResource("doclet.Prev");
         nextLabel = getResource("doclet.Next");
@@ -189,16 +213,22 @@
         deprecatedLabel = getResource("doclet.navDeprecated");
         deprecatedPhrase = getResource("doclet.Deprecated");
         allclassesLabel = getResource("doclet.All_Classes");
+        allpackagesLabel = getResource("doclet.All_Packages");
+        allprofilesLabel = getResource("doclet.All_Profiles");
         indexLabel = getResource("doclet.Index");
         helpLabel = getResource("doclet.Help");
         seeLabel = getResource("doclet.See");
         descriptionLabel = getResource("doclet.Description");
         prevpackageLabel = getResource("doclet.Prev_Package");
         nextpackageLabel = getResource("doclet.Next_Package");
+        prevprofileLabel = getResource("doclet.Prev_Profile");
+        nextprofileLabel = getResource("doclet.Next_Profile");
         packagesLabel = getResource("doclet.Packages");
+        profilesLabel = getResource("doclet.Profiles");
         methodDetailsLabel = getResource("doclet.Method_Detail");
         annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
         fieldDetailsLabel = getResource("doclet.Field_Detail");
+        propertyDetailsLabel = getResource("doclet.Property_Detail");
         constructorDetailsLabel = getResource("doclet.Constructor_Detail");
         enumConstantsDetailsLabel = getResource("doclet.Enum_Constant_Detail");
         specifiedByLabel = getResource("doclet.Specified_By");
--- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -4,7 +4,9 @@
 doclet.Window_Overview=Overview List
 doclet.Window_Overview_Summary=Overview
 doclet.Package=Package
+doclet.Profile=Profile
 doclet.All_Packages=All Packages
+doclet.All_Profiles=All Profiles
 doclet.Tree=Tree
 doclet.Class_Hierarchy=Class Hierarchy
 doclet.Window_Class_Hierarchy=Class Hierarchy
@@ -17,6 +19,8 @@
 doclet.Next_Class=Next Class
 doclet.Prev_Package=Prev Package
 doclet.Next_Package=Next Package
+doclet.Prev_Profile=Prev Profile
+doclet.Next_Profile=Next Profile
 doclet.Prev_Letter=Prev Letter
 doclet.Next_Letter=Next Letter
 doclet.Href_Class_Title=class in {0}
@@ -32,6 +36,7 @@
 doclet.navAnnotationTypeRequiredMember=Required
 doclet.navAnnotationTypeMember=Element
 doclet.navField=Field
+doclet.navProperty=Property
 doclet.navEnum=Enum Constants
 doclet.navConstructor=Constr
 doclet.navMethod=Method
@@ -40,6 +45,7 @@
 doclet.Window_Split_Index={0}-Index
 doclet.Help=Help
 doclet.Skip_navigation_links=Skip navigation links
+doclet.Navigation=Navigation
 doclet.New_Page=NewPage
 doclet.navDeprecated=Deprecated
 doclet.Window_Deprecated_List=Deprecated List
@@ -91,7 +97,7 @@
 doclet.Subinterfaces=All Known Subinterfaces:
 doclet.Implementing_Classes=All Known Implementing Classes:
 doclet.Functional_Interface=Functional Interface:
-doclet.Functional_Interface_Message=This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference. 
+doclet.Functional_Interface_Message=This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
 doclet.also=also
 doclet.Frames=Frames
 doclet.No_Frames=No Frames
--- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_ja.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -32,7 +32,7 @@
 doclet.navAnnotationTypeRequiredMember=\u5FC5\u9808
 doclet.navAnnotationTypeMember=\u8981\u7D20
 doclet.navField=\u30D5\u30A3\u30FC\u30EB\u30C9
-doclet.navEnum=\u5217\u6319\u5B9A\u6570
+doclet.navEnum=\u5217\u6319\u578B\u5B9A\u6570
 doclet.navConstructor=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF
 doclet.navMethod=\u30E1\u30BD\u30C3\u30C9
 doclet.Index=\u7D22\u5F15
@@ -41,59 +41,47 @@
 doclet.Help=\u30D8\u30EB\u30D7
 doclet.Skip_navigation_links=\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30EA\u30F3\u30AF\u3092\u30B9\u30AD\u30C3\u30D7
 doclet.New_Page=NewPage
-doclet.None=\u306A\u3057
-doclet.Factory_Method_Detail=static\u30D5\u30A1\u30AF\u30C8\u30EA\u30FB\u30E1\u30BD\u30C3\u30C9\u306E\u8A73\u7D30
 doclet.navDeprecated=\u975E\u63A8\u5968
-doclet.Deprecated_List=\u975E\u63A8\u5968API\u306E\u30EA\u30B9\u30C8
-doclet.Window_Deprecated_List=\u975E\u63A8\u5968API\u306E\u30EA\u30B9\u30C8
-doclet.Note_0_is_deprecated=\u6CE8\u610F: {0}\u306F\u63A8\u5968\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+doclet.Window_Deprecated_List=\u975E\u63A8\u5968\u306E\u30EA\u30B9\u30C8
 doclet.Overrides=\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9:
 doclet.in_class=\u30AF\u30E9\u30B9\u5185
-doclet.0_Fields_and_Methods=&quot;{0}&quot;\u30D5\u30A3\u30FC\u30EB\u30C9\u3068\u30E1\u30BD\u30C3\u30C9
-doclet.Index_of_Fields_and_Methods=\u30D5\u30A3\u30FC\u30EB\u30C9\u3068\u30E1\u30BD\u30C3\u30C9\u306E\u7D22\u5F15
 doclet.Static_variable_in={0}\u306Estatic\u5909\u6570
 doclet.Variable_in={0}\u306E\u5909\u6570
 doclet.Constructor_for={0}\u306E\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF
 doclet.Static_method_in={0}\u306Estatic\u30E1\u30BD\u30C3\u30C9
 doclet.Method_in={0}\u306E\u30E1\u30BD\u30C3\u30C9
-doclet.throws=\u30B9\u30ED\u30FC
 doclet.package=\u30D1\u30C3\u30B1\u30FC\u30B8
 doclet.MalformedURL=\u4E0D\u6B63\u306AURL: {0}
 doclet.File_error=\u30D5\u30A1\u30A4\u30EB\u8AAD\u8FBC\u307F\u30A8\u30E9\u30FC: {0}
 doclet.URL_error=URL\u53D6\u51FA\u3057\u30A8\u30E9\u30FC: {0}
-doclet.No_Package_Comment_File=\u30D1\u30C3\u30B1\u30FC\u30B8{0}\u306EPackage.Comment\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
-doclet.No_Source_For_Class=\u30AF\u30E9\u30B9{0}\u306E\u30BD\u30FC\u30B9\u60C5\u5831\u304C\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
 doclet.see.class_or_package_not_found=\u30BF\u30B0{0}: \u53C2\u7167\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {1}
 doclet.see.class_or_package_not_accessible=\u30BF\u30B0{0}: \u53C2\u7167\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093: {1}
-doclet.see.malformed_tag={0}\u30BF\u30B0: \u4E0D\u6B63\u306A{1}\u30BF\u30B0
-doclet.Inherited_API_Summary=\u7D99\u627F\u3055\u308C\u305FAPI\u306E\u6982\u8981
-doclet.Deprecated_API=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044API
-doclet.Deprecated_Classes=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30AF\u30E9\u30B9
-doclet.Deprecated_Enums=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u5217\u6319\u578B
-doclet.Deprecated_Interfaces=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
-doclet.Deprecated_Exceptions=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u4F8B\u5916
-doclet.Deprecated_Annotation_Types=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u6CE8\u91C8\u578B
-doclet.Deprecated_Errors=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30A8\u30E9\u30FC
-doclet.Deprecated_Fields=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30D5\u30A3\u30FC\u30EB\u30C9
-doclet.Deprecated_Constructors=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF
-doclet.Deprecated_Methods=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30E1\u30BD\u30C3\u30C9
-doclet.Deprecated_Enum_Constants=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u5217\u6319\u578B\u5B9A\u6570
-doclet.Deprecated_Annotation_Type_Members=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u6CE8\u91C8\u578B\u306E\u8981\u7D20
-doclet.deprecated_classes=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30AF\u30E9\u30B9
-doclet.deprecated_enums=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u5217\u6319\u578B
-doclet.deprecated_interfaces=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
-doclet.deprecated_exceptions=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u4F8B\u5916
-doclet.deprecated_annotation_types=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u6CE8\u91C8\u578B
-doclet.deprecated_errors=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30A8\u30E9\u30FC
-doclet.deprecated_fields=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30D5\u30A3\u30FC\u30EB\u30C9
-doclet.deprecated_constructors=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF
-doclet.deprecated_methods=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u30E1\u30BD\u30C3\u30C9
-doclet.deprecated_enum_constants=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u5217\u6319\u578B\u5B9A\u6570
-doclet.deprecated_annotation_type_members=\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u6CE8\u91C8\u578B\u306E\u8981\u7D20
-doclet.Frame_Output=\u30D5\u30EC\u30FC\u30E0\u51FA\u529B
-doclet.Docs_generated_by_Javadoc=\u3053\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306Fjavadoc\u3067\u751F\u6210\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+doclet.Deprecated_API=\u975E\u63A8\u5968\u306EAPI
+doclet.Deprecated_Packages=\u975E\u63A8\u5968\u306E\u30D1\u30C3\u30B1\u30FC\u30B8
+doclet.Deprecated_Classes=\u975E\u63A8\u5968\u306E\u30AF\u30E9\u30B9
+doclet.Deprecated_Enums=\u975E\u63A8\u5968\u306E\u5217\u6319\u578B
+doclet.Deprecated_Interfaces=\u975E\u63A8\u5968\u306E\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
+doclet.Deprecated_Exceptions=\u975E\u63A8\u5968\u306E\u4F8B\u5916
+doclet.Deprecated_Annotation_Types=\u975E\u63A8\u5968\u306E\u6CE8\u91C8\u578B
+doclet.Deprecated_Errors=\u975E\u63A8\u5968\u306E\u30A8\u30E9\u30FC
+doclet.Deprecated_Fields=\u975E\u63A8\u5968\u306E\u30D5\u30A3\u30FC\u30EB\u30C9
+doclet.Deprecated_Constructors=\u975E\u63A8\u5968\u306E\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF
+doclet.Deprecated_Methods=\u975E\u63A8\u5968\u306E\u30E1\u30BD\u30C3\u30C9
+doclet.Deprecated_Enum_Constants=\u975E\u63A8\u5968\u306E\u5217\u6319\u578B\u5B9A\u6570
+doclet.Deprecated_Annotation_Type_Members=\u975E\u63A8\u5968\u306E\u6CE8\u91C8\u578B\u306E\u8981\u7D20
+doclet.deprecated_packages=\u975E\u63A8\u5968\u306E\u30D1\u30C3\u30B1\u30FC\u30B8
+doclet.deprecated_classes=\u975E\u63A8\u5968\u306E\u30AF\u30E9\u30B9
+doclet.deprecated_enums=\u975E\u63A8\u5968\u306E\u5217\u6319\u578B
+doclet.deprecated_interfaces=\u975E\u63A8\u5968\u306E\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
+doclet.deprecated_exceptions=\u975E\u63A8\u5968\u306E\u4F8B\u5916
+doclet.deprecated_annotation_types=\u975E\u63A8\u5968\u306E\u6CE8\u91C8\u578B
+doclet.deprecated_errors=\u975E\u63A8\u5968\u306E\u30A8\u30E9\u30FC
+doclet.deprecated_fields=\u975E\u63A8\u5968\u306E\u30D5\u30A3\u30FC\u30EB\u30C9
+doclet.deprecated_constructors=\u975E\u63A8\u5968\u306E\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF
+doclet.deprecated_methods=\u975E\u63A8\u5968\u306E\u30E1\u30BD\u30C3\u30C9
+doclet.deprecated_enum_constants=\u975E\u63A8\u5968\u306E\u5217\u6319\u578B\u5B9A\u6570
+doclet.deprecated_annotation_type_members=\u975E\u63A8\u5968\u306E\u6CE8\u91C8\u578B\u306E\u8981\u7D20
 doclet.Generated_Docs_Untitled=\u751F\u6210\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8(\u30BF\u30A4\u30C8\u30EB\u306A\u3057)
-doclet.Blank=\u30D6\u30E9\u30F3\u30AF
 doclet.Other_Packages=\u305D\u306E\u4ED6\u306E\u30D1\u30C3\u30B1\u30FC\u30B8
 doclet.Package_Description=\u30D1\u30C3\u30B1\u30FC\u30B8{0}\u306E\u8AAC\u660E
 doclet.Description=\u8AAC\u660E
@@ -102,33 +90,25 @@
 doclet.Subclasses=\u76F4\u7CFB\u306E\u65E2\u77E5\u306E\u30B5\u30D6\u30AF\u30E9\u30B9:
 doclet.Subinterfaces=\u65E2\u77E5\u306E\u30B5\u30D6\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u30EA\u30B9\u30C8:
 doclet.Implementing_Classes=\u65E2\u77E5\u306E\u5B9F\u88C5\u30AF\u30E9\u30B9\u306E\u30EA\u30B9\u30C8:
+doclet.Functional_Interface=\u6A5F\u80FD\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
+doclet.Functional_Interface_Message=\u3053\u308C\u306F\u6A5F\u80FD\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306A\u306E\u3067\u3001\u30E9\u30E0\u30C0\u5F0F\u307E\u305F\u306F\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u5272\u5F53\u3066\u30BF\u30FC\u30B2\u30C3\u30C8\u3068\u3057\u3066\u4F7F\u7528\u3067\u304D\u307E\u3059\u3002 
 doclet.also=\u540C\u69D8\u306B
-doclet.Option=\u30AA\u30D7\u30B7\u30E7\u30F3
-doclet.Or=\u307E\u305F\u306F
 doclet.Frames=\u30D5\u30EC\u30FC\u30E0
 doclet.No_Frames=\u30D5\u30EC\u30FC\u30E0\u306A\u3057
 doclet.Package_Hierarchies=\u30D1\u30C3\u30B1\u30FC\u30B8\u968E\u5C64:
 doclet.Hierarchy_For_Package=\u30D1\u30C3\u30B1\u30FC\u30B8{0}\u306E\u968E\u5C64
-doclet.Source_Code=\u30BD\u30FC\u30B9\u30FB\u30B3\u30FC\u30C9:
 doclet.Hierarchy_For_All_Packages=\u3059\u3079\u3066\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u968E\u5C64
-doclet.Cannot_handle_no_packages=\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u51E6\u7406\u3067\u304D\u307E\u305B\u3093\u3002
 doclet.Frame_Alert=\u30D5\u30EC\u30FC\u30E0\u95A2\u9023\u306E\u30A2\u30E9\u30FC\u30C8
-doclet.Overview-Member-Frame=\u6982\u8981\u30E1\u30F3\u30D0\u30FC\u30FB\u30D5\u30EC\u30FC\u30E0
 doclet.Frame_Warning_Message=\u3053\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306F\u30D5\u30EC\u30FC\u30E0\u6A5F\u80FD\u3092\u4F7F\u7528\u3057\u3066\u8868\u793A\u3059\u308B\u3088\u3046\u306B\u4F5C\u6210\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30D5\u30EC\u30FC\u30E0\u3092\u8868\u793A\u3067\u304D\u306A\u3044Web\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\u306E\u5834\u5408\u306B\u3053\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002{0}\u306B\u30EA\u30F3\u30AF\u3057\u307E\u3059\u3002
 doclet.No_Script_Message=\u30D6\u30E9\u30A6\u30B6\u306EJavaScript\u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u3002
 doclet.Non_Frame_Version=\u30D5\u30EC\u30FC\u30E0\u306B\u5BFE\u5FDC\u3057\u3066\u3044\u306A\u3044\u30D0\u30FC\u30B8\u30E7\u30F3
-doclet.Frame_Version=\u30D5\u30EC\u30FC\u30E0\u3042\u308A\u306E\u30D0\u30FC\u30B8\u30E7\u30F3
-doclet.Following_From_Class=\u30AF\u30E9\u30B9{0}\u304B\u3089\u30B3\u30D4\u30FC\u3055\u308C\u305F\u30BF\u30B0:
-doclet.Following_From_Interface=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9{0}\u304B\u3089\u30B3\u30D4\u30FC\u3055\u308C\u305F\u30BF\u30B0:
 doclet.Description_From_Interface=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u304B\u3089\u30B3\u30D4\u30FC\u3055\u308C\u305F\u8AAC\u660E:
 doclet.Description_From_Class=\u30AF\u30E9\u30B9\u304B\u3089\u30B3\u30D4\u30FC\u3055\u308C\u305F\u8AAC\u660E:
-doclet.Standard_doclet_invoked=\u6A19\u6E96\u306Edoclet\u304C\u8D77\u52D5\u3055\u308C\u307E\u3057\u305F...
-doclet.No_Non_Deprecated_Classes_To_Document=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5316\u3059\u308B\u975E\u63A8\u5968\u4EE5\u5916\u306E\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+doclet.No_Non_Deprecated_Classes_To_Document=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5316\u3059\u308B\u975E\u63A8\u5968\u3067\u306A\u3044\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
 doclet.Interfaces_Italic=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9(\u30A4\u30BF\u30EA\u30C3\u30AF)
 doclet.Enclosing_Class=\u542B\u307E\u308C\u3066\u3044\u308B\u30AF\u30E9\u30B9:
 doclet.Enclosing_Interface=\u542B\u307E\u308C\u3066\u3044\u308B\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9:
 doclet.Window_Source_title=\u30BD\u30FC\u30B9\u30FB\u30B3\u30FC\u30C9
-doclet.Help_title=API\u30D8\u30EB\u30D7
 doclet.Window_Help_title=API\u30D8\u30EB\u30D7
 doclet.Help_line_1=API\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u69CB\u6210
 doclet.Help_line_2=\u3053\u306EAPI(Application Programming Interface)\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306B\u306F\u3001\u6B21\u306B\u8AAC\u660E\u3059\u308B\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u306B\u3042\u308B\u9805\u76EE\u306B\u5BFE\u5FDC\u3059\u308B\u30DA\u30FC\u30B8\u304C\u542B\u307E\u308C\u307E\u3059\u3002
@@ -149,7 +129,7 @@
 doclet.Help_line_17_with_tree_link=\u3059\u3079\u3066\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u306F{0}\u30DA\u30FC\u30B8\u304C\u3042\u308A\u3001\u3055\u3089\u306B\u5404\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u968E\u5C64\u304C\u3042\u308A\u307E\u3059\u3002\u5404\u968E\u5C64\u30DA\u30FC\u30B8\u306F\u3001\u30AF\u30E9\u30B9\u306E\u30EA\u30B9\u30C8\u3068\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u30EA\u30B9\u30C8\u3092\u542B\u307F\u307E\u3059\u3002\u30AF\u30E9\u30B9\u306F <code>java.lang.Object</code> \u3092\u958B\u59CB\u70B9\u3068\u3059\u308B\u7D99\u627F\u69CB\u9020\u3067\u7DE8\u6210\u3055\u308C\u307E\u3059\u3002\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306F\u3001<code>java.lang.Object</code> \u304B\u3089\u306F\u7D99\u627F\u3057\u307E\u305B\u3093\u3002
 doclet.Help_line_18=\u6982\u8981\u30DA\u30FC\u30B8\u3092\u8868\u793A\u3057\u3066\u3044\u308B\u3068\u304D\u306B\u300C\u968E\u5C64\u30C4\u30EA\u30FC\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u5168\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u968E\u5C64\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002
 doclet.Help_line_19=\u7279\u5B9A\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3092\u8868\u793A\u3057\u3066\u3044\u308B\u3068\u304D\u306B\u300C\u968E\u5C64\u30C4\u30EA\u30FC\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u3001\u8A72\u5F53\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u307F\u306E\u968E\u5C64\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002
-doclet.Help_line_20_with_deprecated_api_link={0}\u30DA\u30FC\u30B8\u306F\u3001\u63A8\u5968\u3055\u308C\u3066\u3044\u306A\u3044\u3059\u3079\u3066\u306EAPI\u306E\u30EA\u30B9\u30C8\u3092\u8868\u793A\u3057\u307E\u3059\u3002\u975E\u63A8\u5968API\u3068\u306F\u3001\u6A5F\u80FD\u6539\u826F\u306A\u3069\u306E\u7406\u7531\u304B\u3089\u4F7F\u7528\u3092\u304A\u85A6\u3081\u3067\u304D\u306A\u304F\u306A\u3063\u305FAPI\u306E\u3053\u3068\u3067\u3001\u901A\u5E38\u306F\u305D\u308C\u306B\u4EE3\u308F\u308BAPI\u304C\u63D0\u4F9B\u3055\u308C\u307E\u3059\u3002\u975E\u63A8\u5968API\u306F\u4ECA\u5F8C\u306E\u5B9F\u88C5\u3067\u524A\u9664\u3055\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002
+doclet.Help_line_20_with_deprecated_api_link={0}\u30DA\u30FC\u30B8\u306F\u3001\u975E\u63A8\u5968\u306EAPI\u3092\u3059\u3079\u3066\u30EA\u30B9\u30C8\u3057\u307E\u3059\u3002\u975E\u63A8\u5968\u306EAPI\u3068\u306F\u3001\u6A5F\u80FD\u6539\u826F\u306A\u3069\u306E\u7406\u7531\u304B\u3089\u4F7F\u7528\u3092\u304A\u85A6\u3081\u3067\u304D\u306A\u304F\u306A\u3063\u305FAPI\u306E\u3053\u3068\u3067\u3001\u901A\u5E38\u306F\u305D\u308C\u306B\u4EE3\u308F\u308BAPI\u304C\u63D0\u4F9B\u3055\u308C\u307E\u3059\u3002\u975E\u63A8\u5968\u306EAPI\u306F\u4ECA\u5F8C\u306E\u5B9F\u88C5\u3067\u524A\u9664\u3055\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002
 doclet.Help_line_21=\u7D22\u5F15
 doclet.Help_line_22={0}\u306B\u306F\u3001\u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u3001\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3001\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u3001\u30E1\u30BD\u30C3\u30C9\u304A\u3088\u3073\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u30A2\u30EB\u30D5\u30A1\u30D9\u30C3\u30C8\u9806\u306E\u30EA\u30B9\u30C8\u304C\u542B\u307E\u308C\u307E\u3059\u3002
 doclet.Help_line_23=\u524D/\u6B21
@@ -158,7 +138,7 @@
 doclet.Help_line_26=\u3053\u308C\u3089\u306E\u30EA\u30F3\u30AF\u306FHTML\u30D5\u30EC\u30FC\u30E0\u306E\u8868\u793A\u3068\u975E\u8868\u793A\u3092\u5207\u308A\u66FF\u3048\u307E\u3059\u3002\u3059\u3079\u3066\u306E\u30DA\u30FC\u30B8\u306F\u30D5\u30EC\u30FC\u30E0\u3042\u308A\u3067\u3082\u3001\u30D5\u30EC\u30FC\u30E0\u306A\u3057\u3067\u3082\u8868\u793A\u3067\u304D\u307E\u3059\u3002
 doclet.Help_line_27={0}\u30EA\u30F3\u30AF\u306B\u306F\u3001\u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9(\u975Estatic\u306E\u30CD\u30B9\u30C8\u3055\u308C\u305F\u578B\u3092\u9664\u304F)\u304C\u8868\u793A\u3055\u308C\u307E\u3059\u3002
 doclet.Help_line_28=\u76F4\u5217\u5316\u53EF\u80FD\u307E\u305F\u306F\u5916\u90E8\u5316\u53EF\u80FD\u306A\u5404\u30AF\u30E9\u30B9\u306F\u3001\u76F4\u5217\u5316\u30D5\u30A3\u30FC\u30EB\u30C9\u3068\u30E1\u30BD\u30C3\u30C9\u306E\u8AAC\u660E\u3092\u542B\u307F\u307E\u3059\u3002\u3053\u306E\u60C5\u5831\u306F\u3001API\u3092\u4F7F\u7528\u3059\u308B\u958B\u767A\u8005\u3067\u306F\u306A\u304F\u3001\u518D\u5B9F\u88C5\u3092\u884C\u3046\u62C5\u5F53\u8005\u306B\u5F79\u7ACB\u3061\u307E\u3059\u3002\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u306B\u30EA\u30F3\u30AF\u304C\u306A\u3044\u5834\u5408\u3001\u76F4\u5217\u5316\u3055\u308C\u305F\u30AF\u30E9\u30B9\u306B\u79FB\u52D5\u3057\u3066\u3001\u30AF\u30E9\u30B9\u8A18\u8FF0\u306E\u300C\u95A2\u9023\u9805\u76EE\u300D\u30BB\u30AF\u30B7\u30E7\u30F3\u306B\u3042\u308B\u300C\u76F4\u5217\u5316\u3055\u308C\u305F\u5F62\u5F0F\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3053\u3068\u306B\u3088\u308A\u3001\u3053\u306E\u60C5\u5831\u3092\u8868\u793A\u3067\u304D\u307E\u3059\u3002
-doclet.Help_line_29=<a href="constant-values.html">\u300C\u5B9A\u6570\u30D5\u30A3\u30FC\u30EB\u30C9\u5024\u300D</a> \u30DA\u30FC\u30B8\u306B\u306F\u3001static final\u30D5\u30A3\u30FC\u30EB\u30C9\u3068\u305D\u306E\u5024\u306E\u30EA\u30B9\u30C8\u304C\u3042\u308A\u307E\u3059\u3002
+doclet.Help_line_29={0}\u30DA\u30FC\u30B8\u306B\u306F\u3001static final\u30D5\u30A3\u30FC\u30EB\u30C9\u3068\u305D\u306E\u5024\u306E\u30EA\u30B9\u30C8\u304C\u3042\u308A\u307E\u3059\u3002
 doclet.Help_line_30=\u3053\u306E\u30D8\u30EB\u30D7\u30FB\u30D5\u30A1\u30A4\u30EB\u306F\u3001\u6A19\u6E96doclet\u3092\u4F7F\u7528\u3057\u3066\u751F\u6210\u3055\u308C\u305FAPI\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306B\u9069\u7528\u3055\u308C\u307E\u3059\u3002
 doclet.Help_enum_line_1=\u5404\u5217\u6319\u578B\u306B\u306F\u3001\u305D\u308C\u81EA\u8EAB\u306E\u500B\u5225\u306E\u30DA\u30FC\u30B8\u3068\u6B21\u306E\u30BB\u30AF\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u3059:
 doclet.Help_enum_line_2=\u5217\u6319\u578B\u306E\u5BA3\u8A00
@@ -166,19 +146,6 @@
 doclet.Help_annotation_type_line_1=\u5404\u6CE8\u91C8\u578B\u306B\u306F\u3001\u305D\u308C\u81EA\u8EAB\u306E\u500B\u5225\u306E\u30DA\u30FC\u30B8\u3068\u6B21\u306E\u30BB\u30AF\u30B7\u30E7\u30F3\u304C\u3042\u308A\u307E\u3059:
 doclet.Help_annotation_type_line_2=\u6CE8\u91C8\u578B\u306E\u5BA3\u8A00
 doclet.Help_annotation_type_line_3=\u6CE8\u91C8\u578B\u306E\u8AAC\u660E
-doclet.Style_line_1=javadoc\u30B9\u30BF\u30A4\u30EB\u30FB\u30B7\u30FC\u30C8
-doclet.Style_line_2=\u8272\u3084\u30D5\u30A9\u30F3\u30C8\u306A\u3069\u306E\u30B9\u30BF\u30A4\u30EB\u5C5E\u6027\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B\u306B\u306F\u3001\u3053\u3053\u3067\u5B9A\u7FA9\u3057\u307E\u3059
-doclet.Style_line_3=\u30DA\u30FC\u30B8\u306E\u30D0\u30C3\u30AF\u30B0\u30E9\u30A6\u30F3\u30C9\u306E\u8272
-doclet.Style_Headings=\u898B\u51FA\u3057
-doclet.Style_line_4=\u8868\u306E\u8272
-doclet.Style_line_5=\u6FC3\u3044\u85E4\u8272
-doclet.Style_line_6=\u8584\u3044\u85E4\u8272
-doclet.Style_line_7=\u767D
-doclet.Style_line_8=\u5DE6\u5074\u306E\u30D5\u30EC\u30FC\u30E0\u306E\u30EA\u30B9\u30C8\u306B\u4F7F\u7528\u3059\u308B\u30D5\u30A9\u30F3\u30C8
-doclet.Style_line_9=\u30D5\u30EC\u30FC\u30E0\u306B\u304A\u3051\u308B\u3001\u3088\u308A\u5C0F\u3055\u3044sans-serif\u30D5\u30A9\u30F3\u30C8\u306E\u4F8B
-doclet.Style_line_10=\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u306E\u30D5\u30A9\u30F3\u30C8\u3068\u8272
-doclet.Style_line_11=\u6FC3\u3044\u9752
-doclet.Style_line_12=\u8868\u306E\u30AD\u30E3\u30D7\u30B7\u30E7\u30F3\u30FB\u30B9\u30BF\u30A4\u30EB
 doclet.ClassUse_Packages.that.use.0={0}\u3092\u4F7F\u7528\u3057\u3066\u3044\u308B\u30D1\u30C3\u30B1\u30FC\u30B8
 doclet.ClassUse_Uses.of.0.in.1={1}\u3067\u306E{0}\u306E\u4F7F\u7528
 doclet.ClassUse_Classes.in.0.used.by.1={1}\u306B\u3088\u308A\u4F7F\u7528\u3055\u308C\u308B{0}\u306E\u30AF\u30E9\u30B9
@@ -208,13 +175,11 @@
 doclet.Window_ClassUse_Header={0} {1}\u306E\u4F7F\u7528
 doclet.ClassUse_Title={0}<br>{1}\u306E\u4F7F\u7528
 doclet.navClassUse=\u4F7F\u7528
-doclet.link_option_twice=\u5916\u90E8URL\u30EA\u30F3\u30AF\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3(link\u307E\u305F\u306Flinkoffline)\u304C2\u56DE\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059\u3002
 doclet.Error_in_packagelist=-group\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u4F7F\u7528\u65B9\u6CD5\u306E\u30A8\u30E9\u30FC: {0} {1}
 doclet.Groupname_already_used=-group\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u304A\u3044\u3066\u3001\u3059\u3067\u306B\u30B0\u30EB\u30FC\u30D7\u540D\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0}
 doclet.Same_package_name_used=\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u5F62\u5F0F\u304C2\u56DE\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0}
-doclet.Serialization.Excluded_Class=\u5E38\u99D0\u30D5\u30A3\u30FC\u30EB\u30C9{1}\u306F\u3001\u9664\u5916\u3055\u308C\u305F\u30AF\u30E9\u30B9{0}\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
-doclet.Serialization.Nonexcluded_Class=\u5E38\u99D0\u30D5\u30A3\u30FC\u30EB\u30C9{1}\u306F\u3001\u975E\u8868\u793A\u306E\u3001\u542B\u307E\u308C\u306A\u3044\u30AF\u30E9\u30B9{0}\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
-doclet.usage=\u6A19\u6E96\u306Edoclet\u306B\u3088\u308A\u63D0\u4F9B\u3055\u308C\u308B\u3082\u306E:\n-d <directory>                    \u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n-use                             \u30AF\u30E9\u30B9\u3068\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u4F7F\u7528\u30DA\u30FC\u30B8\u3092\u4F5C\u6210\u3059\u308B\n-version                          @version\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-author                           @author\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-docfilessubdirs                  doc-file\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u518D\u5E30\u7684\u306B\u30B3\u30D4\u30FC\u3059\u308B\n-splitindex                       1\u5B57\u3054\u3068\u306B1\u30D5\u30A1\u30A4\u30EB\u306B\u7D22\u5F15\u3092\u5206\u5272\u3059\u308B\n-windowtitle <text>               \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u7528\u306E\u30D6\u30E9\u30A6\u30B6\u30FB\u30A6\u30A3\u30F3\u30C9\u30A6\u30FB\u30BF\u30A4\u30C8\u30EB\n-doctitle <html-code>             \u6982\u8981\u30DA\u30FC\u30B8\u306B\u30BF\u30A4\u30C8\u30EB\u3092\u542B\u3081\u308B\n-header <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u30D8\u30C3\u30C0\u30FC\u3092\u542B\u3081\u308B\n-footer <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u30D5\u30C3\u30BF\u30FC\u3092\u542B\u3081\u308B\n-top    <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u4E0A\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-bottom <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u4E0B\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-link <url>                       <url>\u306Bjavadoc\u51FA\u529B\u3078\u306E\u30EA\u30F3\u30AF\u3092\u4F5C\u6210\u3059\u308B\n-linkoffline <url> <url2>         <url2>\u306B\u3042\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u4F7F\u7528\u3057\u3066<url>\u306Edocs\u306B\u30EA\u30F3\u30AF\u3059\u308B\n-excludedocfilessubdir <name1>:.. \u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u306Edoc-files\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u3059\u3079\u3066\u9664\u5916\u3059\u308B\n-group <name> <p1>:<p2>..         \u6307\u5B9A\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6982\u8981\u30DA\u30FC\u30B8\u306B\u304A\u3044\u3066\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B\n-nocomment                        \u8A18\u8FF0\u304A\u3088\u3073\u30BF\u30B0\u3092\u6291\u5236\u3057\u3066\u5BA3\u8A00\u306E\u307F\u3092\u751F\u6210\u3059\u308B\n-nodeprecated                     @deprecated\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-noqualifier <name1>:<name2>:...  \u51FA\u529B\u304B\u3089\u4FEE\u98FE\u5B50\u306E\u30EA\u30B9\u30C8\u3092\u9664\u5916\u3059\u308B\n-nosince                          @since\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-notimestamp                      \u975E\u8868\u793A\u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u3092\u9664\u5916\u3059\u308B\n-nodeprecatedlist                 \u975E\u63A8\u5968\u306E\u30EA\u30B9\u30C8\u3092\u751F\u6210\u3057\u306A\u3044\n-notree                           \u30AF\u30E9\u30B9\u968E\u5C64\u3092\u751F\u6210\u3057\u306A\u3044\n-noindex                          \u7D22\u5F15\u3092\u751F\u6210\u3057\u306A\u3044\n-nohelp                           \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u3092\u751F\u6210\u3057\u306A\u3044\n-nonavbar                         \u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u3092\u751F\u6210\u3057\u306A\u3044\n-serialwarn                       @serial\u30BF\u30B0\u306B\u95A2\u3059\u308B\u8B66\u544A\u3092\u751F\u6210\u3059\u308B\n-tag <name>:<locations>:<header>  \u5358\u4E00\u306E\u5F15\u6570\u3092\u6301\u3064\u30AB\u30B9\u30BF\u30E0\u30FB\u30BF\u30B0\u3092\u6307\u5B9A\u3059\u308B\n-taglet                           \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u5B8C\u5168\u4FEE\u98FE\u540D\u3092\u767B\u9332\u3059\u308B\n-tagletpath                       \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u30D1\u30B9\n-charset <charset>                \u751F\u6210\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30AF\u30ED\u30B9\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u3067\u306E\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\n-helpfile <file>                  \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u306E\u30EA\u30F3\u30AF\u5148\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B\n-linksource                       HTML\u5F62\u5F0F\u3067\u30BD\u30FC\u30B9\u3092\u751F\u6210\u3059\u308B\n-sourcetab <tab length>           \u30BD\u30FC\u30B9\u5185\u306E\u30BF\u30D6\u306E\u7A7A\u767D\u6587\u5B57\u306E\u6570\u3092\u6307\u5B9A\u3059\u308B\n-keywords                         HTML\u306Emeta\u30BF\u30B0\u306B\u3001\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u60C5\u5831\u3092\u542B\u3081\u308B\n-stylesheetfile <path>            \u751F\u6210\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30B9\u30BF\u30A4\u30EB\u5909\u66F4\u7528\u30D5\u30A1\u30A4\u30EB\n-docencoding <name>               \u51FA\u529B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u540D
+doclet.exception_encountered={1}\u306E\u51E6\u7406\u4E2D\u306B\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\n{0}
+doclet.usage=\u6A19\u6E96\u306Edoclet\u306B\u3088\u308A\u63D0\u4F9B\u3055\u308C\u308B\u3082\u306E:\n-d <directory>                    \u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u306E\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n-use                              \u30AF\u30E9\u30B9\u3068\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\u4F7F\u7528\u30DA\u30FC\u30B8\u3092\u4F5C\u6210\u3059\u308B\n-version                          @version\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-author                           @author\u30D1\u30E9\u30B0\u30E9\u30D5\u3092\u542B\u3081\u308B\n-docfilessubdirs                  doc-file\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u518D\u5E30\u7684\u306B\u30B3\u30D4\u30FC\u3059\u308B\n-splitindex                       1\u5B57\u3054\u3068\u306B1\u30D5\u30A1\u30A4\u30EB\u306B\u7D22\u5F15\u3092\u5206\u5272\u3059\u308B\n-windowtitle <text>               \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u7528\u306E\u30D6\u30E9\u30A6\u30B6\u30FB\u30A6\u30A3\u30F3\u30C9\u30A6\u30FB\u30BF\u30A4\u30C8\u30EB\n-doctitle <html-code>             \u6982\u8981\u30DA\u30FC\u30B8\u306B\u30BF\u30A4\u30C8\u30EB\u3092\u542B\u3081\u308B\n-header <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u30D8\u30C3\u30C0\u30FC\u3092\u542B\u3081\u308B\n-footer <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u30D5\u30C3\u30BF\u30FC\u3092\u542B\u3081\u308B\n-top    <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u4E0A\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-bottom <html-code>               \u5404\u30DA\u30FC\u30B8\u306B\u4E0B\u90E8\u30C6\u30AD\u30B9\u30C8\u3092\u542B\u3081\u308B\n-link <url>                       <url>\u306Bjavadoc\u51FA\u529B\u3078\u306E\u30EA\u30F3\u30AF\u3092\u4F5C\u6210\u3059\u308B\n-linkoffline <url> <url2>         <url2>\u306B\u3042\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u30FB\u30EA\u30B9\u30C8\u3092\u4F7F\u7528\u3057\u3066<url>\u306Edocs\u306B\u30EA\u30F3\u30AF\u3059\u308B\n-excludedocfilessubdir <name1>:.. \u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u306Edoc-files\u30B5\u30D6\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u3059\u3079\u3066\u9664\u5916\u3059\u308B\n-group <name> <p1>:<p2>..         \u6307\u5B9A\u3059\u308B\u30D1\u30C3\u30B1\u30FC\u30B8\u3092\u6982\u8981\u30DA\u30FC\u30B8\u306B\u304A\u3044\u3066\u30B0\u30EB\u30FC\u30D7\u5316\u3059\u308B\n-nocomment                        \u8A18\u8FF0\u304A\u3088\u3073\u30BF\u30B0\u3092\u6291\u5236\u3057\u3066\u5BA3\u8A00\u306E\u307F\u3092\u751F\u6210\u3059\u308B\n-nodeprecated                     @deprecated\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-noqualifier <name1>:<name2>:...  \u51FA\u529B\u304B\u3089\u4FEE\u98FE\u5B50\u306E\u30EA\u30B9\u30C8\u3092\u9664\u5916\u3059\u308B\n-nosince                          @since\u60C5\u5831\u3092\u9664\u5916\u3059\u308B\n-notimestamp                      \u975E\u8868\u793A\u306E\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u3092\u9664\u5916\u3059\u308B\n-nodeprecatedlist                 \u975E\u63A8\u5968\u306E\u30EA\u30B9\u30C8\u3092\u751F\u6210\u3057\u306A\u3044\n-notree                           \u30AF\u30E9\u30B9\u968E\u5C64\u3092\u751F\u6210\u3057\u306A\u3044\n-noindex                          \u7D22\u5F15\u3092\u751F\u6210\u3057\u306A\u3044\n-nohelp                           \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u3092\u751F\u6210\u3057\u306A\u3044\n-nonavbar                         \u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u30FB\u30D0\u30FC\u3092\u751F\u6210\u3057\u306A\u3044\n-serialwarn                       @serial\u30BF\u30B0\u306B\u95A2\u3059\u308B\u8B66\u544A\u3092\u751F\u6210\u3059\u308B\n-tag <name>:<locations>:<header>  \u5358\u4E00\u306E\u5F15\u6570\u3092\u6301\u3064\u30AB\u30B9\u30BF\u30E0\u30FB\u30BF\u30B0\u3092\u6307\u5B9A\u3059\u308B\n-taglet                           \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u5B8C\u5168\u4FEE\u98FE\u540D\u3092\u767B\u9332\u3059\u308B\n-tagletpath                       \u30BF\u30B0\u30EC\u30C3\u30C8\u306E\u30D1\u30B9\n-Xdocrootparent <url>             \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30B3\u30E1\u30F3\u30C8\u5185\u306E@docRoot(\u3053\u306E\u5F8C\u306B\u306F/..\u304C\u7D9A\u304F)\u306E\u3059\u3079\u3066\u306E\u51FA\u73FE\u7B87\u6240\u3092<url>\u3067\u7F6E\u63DB\u3059\u308B\n-charset <charset>                \u751F\u6210\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30AF\u30ED\u30B9\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u3067\u306E\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\n-helpfile <file>                  \u30D8\u30EB\u30D7\u30FB\u30EA\u30F3\u30AF\u306E\u30EA\u30F3\u30AF\u5148\u30D5\u30A1\u30A4\u30EB\u3092\u542B\u3081\u308B\n-linksource                       HTML\u5F62\u5F0F\u3067\u30BD\u30FC\u30B9\u3092\u751F\u6210\u3059\u308B\n-sourcetab <tab length>           \u30BD\u30FC\u30B9\u5185\u306E\u30BF\u30D6\u306E\u7A7A\u767D\u6587\u5B57\u306E\u6570\u3092\u6307\u5B9A\u3059\u308B\n-keywords                         HTML\u306Emeta\u30BF\u30B0\u306B\u3001\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30E1\u30F3\u30D0\u30FC\u306E\u60C5\u5831\u3092\u542B\u3081\u308B\n-stylesheetfile <path>            \u751F\u6210\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30B9\u30BF\u30A4\u30EB\u5909\u66F4\u7528\u30D5\u30A1\u30A4\u30EB\n-docencoding <name>               \u51FA\u529B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u540D
 
 
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_zh_CN.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard_zh_CN.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -41,33 +41,23 @@
 doclet.Help=\u5E2E\u52A9
 doclet.Skip_navigation_links=\u8DF3\u8FC7\u5BFC\u822A\u94FE\u63A5
 doclet.New_Page=NewPage
-doclet.None=\u65E0
-doclet.Factory_Method_Detail=\u9759\u6001\u5DE5\u5382\u65B9\u6CD5\u8BE6\u7EC6\u8D44\u6599
 doclet.navDeprecated=\u5DF2\u8FC7\u65F6
-doclet.Deprecated_List=\u5DF2\u8FC7\u65F6\u7684\u5217\u8868
 doclet.Window_Deprecated_List=\u5DF2\u8FC7\u65F6\u7684\u5217\u8868
-doclet.Note_0_is_deprecated=\u6CE8: {0}\u5DF2\u8FC7\u65F6\u3002
 doclet.Overrides=\u8986\u76D6:
 doclet.in_class=\u5728\u7C7B\u4E2D
-doclet.0_Fields_and_Methods=&quot;{0}&quot; \u5B57\u6BB5\u548C\u65B9\u6CD5
-doclet.Index_of_Fields_and_Methods=\u5B57\u6BB5\u548C\u65B9\u6CD5\u7684\u7D22\u5F15
 doclet.Static_variable_in={0}\u4E2D\u7684\u9759\u6001\u53D8\u91CF
 doclet.Variable_in={0}\u4E2D\u7684\u53D8\u91CF
 doclet.Constructor_for={0}\u7684\u6784\u9020\u5668
 doclet.Static_method_in={0}\u4E2D\u7684\u9759\u6001\u65B9\u6CD5
 doclet.Method_in={0}\u4E2D\u7684\u65B9\u6CD5
-doclet.throws=\u629B\u51FA
 doclet.package=\u7A0B\u5E8F\u5305
 doclet.MalformedURL=\u683C\u5F0F\u9519\u8BEF\u7684 URL: {0}
 doclet.File_error=\u8BFB\u53D6\u6587\u4EF6\u65F6\u51FA\u9519: {0}
 doclet.URL_error=\u83B7\u53D6 URL \u65F6\u51FA\u9519: {0}
-doclet.No_Package_Comment_File=\u5BF9\u4E8E\u7A0B\u5E8F\u5305{0}, \u627E\u4E0D\u5230 Package.Comment \u6587\u4EF6
-doclet.No_Source_For_Class=\u7C7B{0}\u7684\u6E90\u4FE1\u606F\u4E0D\u53EF\u7528\u3002
 doclet.see.class_or_package_not_found=\u6807\u8BB0{0}: \u627E\u4E0D\u5230\u5F15\u7528: {1}
 doclet.see.class_or_package_not_accessible=\u6807\u8BB0{0}: \u65E0\u6CD5\u8BBF\u95EE\u5F15\u7528: {1}
-doclet.see.malformed_tag=\u6807\u8BB0{0}: \u683C\u5F0F\u9519\u8BEF: {1}
-doclet.Inherited_API_Summary=\u7EE7\u627F\u7684 API \u6982\u8981
 doclet.Deprecated_API=\u5DF2\u8FC7\u65F6\u7684 API
+doclet.Deprecated_Packages=\u5DF2\u8FC7\u65F6\u7A0B\u5E8F\u5305
 doclet.Deprecated_Classes=\u5DF2\u8FC7\u65F6\u7684\u7C7B
 doclet.Deprecated_Enums=\u5DF2\u8FC7\u65F6\u7684\u679A\u4E3E
 doclet.Deprecated_Interfaces=\u5DF2\u8FC7\u65F6\u7684\u63A5\u53E3
@@ -79,6 +69,7 @@
 doclet.Deprecated_Methods=\u5DF2\u8FC7\u65F6\u7684\u65B9\u6CD5
 doclet.Deprecated_Enum_Constants=\u5DF2\u8FC7\u65F6\u7684\u679A\u4E3E\u5E38\u91CF
 doclet.Deprecated_Annotation_Type_Members=\u5DF2\u8FC7\u65F6\u7684\u6CE8\u91CA\u7C7B\u578B\u5143\u7D20
+doclet.deprecated_packages=\u5DF2\u8FC7\u65F6\u7A0B\u5E8F\u5305
 doclet.deprecated_classes=\u5DF2\u8FC7\u65F6\u7684\u7C7B
 doclet.deprecated_enums=\u5DF2\u8FC7\u65F6\u7684\u679A\u4E3E
 doclet.deprecated_interfaces=\u5DF2\u8FC7\u65F6\u7684\u63A5\u53E3
@@ -90,10 +81,7 @@
 doclet.deprecated_methods=\u5DF2\u8FC7\u65F6\u7684\u65B9\u6CD5
 doclet.deprecated_enum_constants=\u5DF2\u8FC7\u65F6\u7684\u679A\u4E3E\u5E38\u91CF
 doclet.deprecated_annotation_type_members=\u5DF2\u8FC7\u65F6\u7684\u6CE8\u91CA\u7C7B\u578B\u5143\u7D20
-doclet.Frame_Output=\u6846\u67B6\u8F93\u51FA
-doclet.Docs_generated_by_Javadoc=\u7531 Javadoc \u751F\u6210\u7684\u6587\u6863\u3002
 doclet.Generated_Docs_Untitled=\u751F\u6210\u7684\u6587\u6863 (\u65E0\u6807\u9898)
-doclet.Blank=\u7A7A\u767D
 doclet.Other_Packages=\u5176\u4ED6\u7A0B\u5E8F\u5305
 doclet.Package_Description=\u7A0B\u5E8F\u5305{0}\u7684\u8BF4\u660E
 doclet.Description=\u8BF4\u660E
@@ -102,33 +90,25 @@
 doclet.Subclasses=\u76F4\u63A5\u5DF2\u77E5\u5B50\u7C7B:
 doclet.Subinterfaces=\u6240\u6709\u5DF2\u77E5\u5B50\u63A5\u53E3:
 doclet.Implementing_Classes=\u6240\u6709\u5DF2\u77E5\u5B9E\u73B0\u7C7B:
+doclet.Functional_Interface=\u51FD\u6570\u63A5\u53E3:
+doclet.Functional_Interface_Message=\u8FD9\u662F\u4E00\u4E2A\u51FD\u6570\u63A5\u53E3, \u56E0\u6B64\u53EF\u7528\u4F5C lambda \u8868\u8FBE\u5F0F\u6216\u65B9\u6CD5\u5F15\u7528\u7684\u8D4B\u503C\u76EE\u6807\u3002
 doclet.also=\u5E76
-doclet.Option=\u9009\u9879
-doclet.Or=\u6216
 doclet.Frames=\u6846\u67B6
 doclet.No_Frames=\u65E0\u6846\u67B6
 doclet.Package_Hierarchies=\u7A0B\u5E8F\u5305\u5206\u5C42\u7ED3\u6784:
 doclet.Hierarchy_For_Package=\u7A0B\u5E8F\u5305{0}\u7684\u5206\u5C42\u7ED3\u6784
-doclet.Source_Code=\u6E90\u4EE3\u7801:
 doclet.Hierarchy_For_All_Packages=\u6240\u6709\u7A0B\u5E8F\u5305\u7684\u5206\u5C42\u7ED3\u6784
-doclet.Cannot_handle_no_packages=\u65E0\u6CD5\u5904\u7406\u6CA1\u6709\u7A0B\u5E8F\u5305\u7684\u60C5\u51B5\u3002
 doclet.Frame_Alert=\u6846\u67B6\u9884\u8B66
-doclet.Overview-Member-Frame=\u6210\u5458\u6846\u67B6\u6982\u89C8
 doclet.Frame_Warning_Message=\u8BF7\u4F7F\u7528\u6846\u67B6\u529F\u80FD\u67E5\u770B\u6B64\u6587\u6863\u3002\u5982\u679C\u770B\u5230\u6B64\u6D88\u606F, \u5219\u8868\u660E\u60A8\u4F7F\u7528\u7684\u662F\u4E0D\u652F\u6301\u6846\u67B6\u7684 Web \u5BA2\u6237\u673A\u3002\u94FE\u63A5\u5230{0}\u3002
 doclet.No_Script_Message=\u60A8\u7684\u6D4F\u89C8\u5668\u5DF2\u7981\u7528 JavaScript\u3002
 doclet.Non_Frame_Version=\u975E\u6846\u67B6\u7248\u672C
-doclet.Frame_Version=\u6846\u67B6\u7248\u672C
-doclet.Following_From_Class=\u4EE5\u4E0B\u5185\u5BB9\u662F\u4ECE\u7C7B{0}\u590D\u5236\u7684
-doclet.Following_From_Interface=\u4EE5\u4E0B\u5185\u5BB9\u662F\u4ECE\u63A5\u53E3{0}\u590D\u5236\u7684
 doclet.Description_From_Interface=\u4ECE\u63A5\u53E3\u590D\u5236\u7684\u8BF4\u660E:
 doclet.Description_From_Class=\u4ECE\u7C7B\u590D\u5236\u7684\u8BF4\u660E:
-doclet.Standard_doclet_invoked=\u5DF2\u8C03\u7528\u7684\u6807\u51C6 doclet...
 doclet.No_Non_Deprecated_Classes_To_Document=\u627E\u4E0D\u5230\u53EF\u4EE5\u6587\u6863\u5316\u7684\u672A\u8FC7\u65F6\u7684\u7C7B\u3002
 doclet.Interfaces_Italic=\u63A5\u53E3 (\u659C\u4F53)
 doclet.Enclosing_Class=\u5C01\u95ED\u7C7B:
 doclet.Enclosing_Interface=\u5C01\u95ED\u63A5\u53E3:
 doclet.Window_Source_title=\u6E90\u4EE3\u7801
-doclet.Help_title=API \u5E2E\u52A9
 doclet.Window_Help_title=API \u5E2E\u52A9
 doclet.Help_line_1=\u6B64 API \u6587\u6863\u7684\u7EC4\u7EC7\u65B9\u5F0F
 doclet.Help_line_2=\u6B64 API (\u5E94\u7528\u7A0B\u5E8F\u7F16\u7A0B\u63A5\u53E3) \u6587\u6863\u5305\u542B\u5BF9\u5E94\u4E8E\u5BFC\u822A\u680F\u4E2D\u7684\u9879\u76EE\u7684\u9875\u9762, \u5982\u4E0B\u6240\u8FF0\u3002
@@ -158,7 +138,7 @@
 doclet.Help_line_26=\u8FD9\u4E9B\u94FE\u63A5\u7528\u4E8E\u663E\u793A\u548C\u9690\u85CF HTML \u6846\u67B6\u3002\u6240\u6709\u9875\u9762\u5747\u5177\u6709\u6709\u6846\u67B6\u548C\u65E0\u6846\u67B6\u4E24\u79CD\u663E\u793A\u65B9\u5F0F\u3002
 doclet.Help_line_27={0}\u94FE\u63A5\u663E\u793A\u6240\u6709\u7C7B\u548C\u63A5\u53E3 (\u9664\u4E86\u975E\u9759\u6001\u5D4C\u5957\u7C7B\u578B)\u3002
 doclet.Help_line_28=\u6BCF\u4E2A\u53EF\u5E8F\u5217\u5316\u6216\u53EF\u5916\u90E8\u5316\u7684\u7C7B\u90FD\u6709\u5176\u5E8F\u5217\u5316\u5B57\u6BB5\u548C\u65B9\u6CD5\u7684\u8BF4\u660E\u3002\u6B64\u4FE1\u606F\u5BF9\u91CD\u65B0\u5B9E\u73B0\u8005\u6709\u7528, \u800C\u5BF9\u4F7F\u7528 API \u7684\u5F00\u53D1\u8005\u5219\u6CA1\u6709\u4EC0\u4E48\u7528\u5904\u3002\u5C3D\u7BA1\u5BFC\u822A\u680F\u4E2D\u6CA1\u6709\u94FE\u63A5, \u4F46\u60A8\u53EF\u4EE5\u901A\u8FC7\u4E0B\u5217\u65B9\u5F0F\u83B7\u53D6\u6B64\u4FE1\u606F: \u8F6C\u81F3\u4EFB\u4F55\u5E8F\u5217\u5316\u7C7B, \u7136\u540E\u5355\u51FB\u7C7B\u8BF4\u660E\u7684 "\u53E6\u8BF7\u53C2\u9605" \u90E8\u5206\u4E2D\u7684 "\u5E8F\u5217\u5316\u8868\u683C"\u3002
-doclet.Help_line_29=<a href="constant-values.html">\u5E38\u91CF\u5B57\u6BB5\u503C</a>\u9875\u9762\u5217\u51FA\u4E86\u9759\u6001\u6700\u7EC8\u5B57\u6BB5\u53CA\u5176\u503C\u3002
+doclet.Help_line_29={0}\u9875\u9762\u5217\u51FA\u4E86\u9759\u6001\u6700\u7EC8\u5B57\u6BB5\u53CA\u5176\u503C\u3002
 doclet.Help_line_30=\u6B64\u5E2E\u52A9\u6587\u4EF6\u9002\u7528\u4E8E\u4F7F\u7528\u6807\u51C6 doclet \u751F\u6210\u7684 API \u6587\u6863\u3002
 doclet.Help_enum_line_1=\u6BCF\u4E2A\u679A\u4E3E\u90FD\u6709\u5404\u81EA\u7684\u9875\u9762, \u5176\u4E2D\u5305\u542B\u4EE5\u4E0B\u90E8\u5206:
 doclet.Help_enum_line_2=\u679A\u4E3E\u58F0\u660E
@@ -166,19 +146,6 @@
 doclet.Help_annotation_type_line_1=\u6BCF\u4E2A\u6CE8\u91CA\u7C7B\u578B\u90FD\u6709\u5404\u81EA\u7684\u9875\u9762, \u5176\u4E2D\u5305\u542B\u4EE5\u4E0B\u90E8\u5206:
 doclet.Help_annotation_type_line_2=\u6CE8\u91CA\u7C7B\u578B\u58F0\u660E
 doclet.Help_annotation_type_line_3=\u6CE8\u91CA\u7C7B\u578B\u8BF4\u660E
-doclet.Style_line_1=Javadoc \u6837\u5F0F\u8868
-doclet.Style_line_2=\u5728\u6B64\u5904\u5B9A\u4E49\u989C\u8272, \u5B57\u4F53\u548C\u5176\u4ED6\u6837\u5F0F\u5C5E\u6027\u4EE5\u8986\u76D6\u9ED8\u8BA4\u503C
-doclet.Style_line_3=\u9875\u9762\u80CC\u666F\u989C\u8272
-doclet.Style_Headings=\u6807\u9898
-doclet.Style_line_4=\u8868\u683C\u989C\u8272
-doclet.Style_line_5=\u6DF1\u7D2B\u8272
-doclet.Style_line_6=\u6DE1\u7D2B\u8272
-doclet.Style_line_7=\u767D\u8272
-doclet.Style_line_8=\u5DE6\u4FA7\u7684\u6846\u67B6\u5217\u8868\u4E2D\u4F7F\u7528\u7684\u5B57\u4F53
-doclet.Style_line_9=\u6846\u67B6\u4E2D\u5C0F\u53F7 sans-serif \u5B57\u4F53\u7684\u793A\u4F8B
-doclet.Style_line_10=\u5BFC\u822A\u680F\u5B57\u4F53\u548C\u989C\u8272
-doclet.Style_line_11=\u6DF1\u84DD\u8272
-doclet.Style_line_12=\u8868\u6807\u9898\u6837\u5F0F
 doclet.ClassUse_Packages.that.use.0=\u4F7F\u7528{0}\u7684\u7A0B\u5E8F\u5305
 doclet.ClassUse_Uses.of.0.in.1={1}\u4E2D{0}\u7684\u4F7F\u7528
 doclet.ClassUse_Classes.in.0.used.by.1={1}\u4F7F\u7528\u7684{0}\u4E2D\u7684\u7C7B
@@ -208,13 +175,11 @@
 doclet.Window_ClassUse_Header={0} {1}\u7684\u4F7F\u7528
 doclet.ClassUse_Title={0} {1}<br>\u7684\u4F7F\u7528
 doclet.navClassUse=\u4F7F\u7528
-doclet.link_option_twice=\u5916\u90E8 URL \u94FE\u63A5\u9009\u9879 (link \u6216 linkoffline) \u4F7F\u7528\u4E86\u4E24\u6B21\u3002
 doclet.Error_in_packagelist=\u4F7F\u7528 -group \u9009\u9879\u65F6\u51FA\u9519: {0} {1}
 doclet.Groupname_already_used=\u5728 -group \u9009\u9879\u4E2D, groupname \u5DF2\u4F7F\u7528: {0}
 doclet.Same_package_name_used=\u7A0B\u5E8F\u5305\u540D\u79F0\u5F62\u5F0F\u4F7F\u7528\u4E86\u4E24\u6B21: {0}
-doclet.Serialization.Excluded_Class=\u975E\u77AC\u6001\u5B57\u6BB5{1}\u4F7F\u7528\u4E86\u6392\u9664\u7684\u7C7B{0}\u3002
-doclet.Serialization.Nonexcluded_Class=\u975E\u77AC\u6001\u5B57\u6BB5{1}\u4F7F\u7528\u4E86\u9690\u85CF\u7684, \u672A\u5305\u542B\u7684\u7C7B{0}\u3002
-doclet.usage=\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n-d <directory>                    \u8F93\u51FA\u6587\u4EF6\u7684\u76EE\u6807\u76EE\u5F55\n-use                              \u521B\u5EFA\u7C7B\u548C\u7A0B\u5E8F\u5305\u7528\u6CD5\u9875\u9762\n-version                          \u5305\u542B @version \u6BB5\n-author                           \u5305\u542B @author \u6BB5\n-docfilessubdirs                  \u9012\u5F52\u590D\u5236\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\n-splitindex                       \u5C06\u7D22\u5F15\u5206\u4E3A\u6BCF\u4E2A\u5B57\u6BCD\u5BF9\u5E94\u4E00\u4E2A\u6587\u4EF6\n-windowtitle <text>               \u6587\u6863\u7684\u6D4F\u89C8\u5668\u7A97\u53E3\u6807\u9898\n-doctitle <html-code>             \u5305\u542B\u6982\u89C8\u9875\u9762\u7684\u6807\u9898\n-header <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u7709\u6587\u672C\n-footer <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u811A\u6587\u672C\n-top    <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9876\u90E8\u6587\u672C\n-bottom <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u5E95\u90E8\u6587\u672C\n-link <url>                       \u521B\u5EFA\u6307\u5411\u4F4D\u4E8E <url> \u7684 javadoc \u8F93\u51FA\u7684\u94FE\u63A5\n-linkoffline <url> <url2>         \u5229\u7528\u4F4D\u4E8E <url2> \u7684\u7A0B\u5E8F\u5305\u5217\u8868\u94FE\u63A5\u81F3\u4F4D\u4E8E <url> \u7684\u6587\u6863\n-excludedocfilessubdir <name1>:..\u6392\u9664\u5177\u6709\u7ED9\u5B9A\u540D\u79F0\u7684\u6240\u6709\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\u3002\n-group <name> <p1>:<p2>..\u5728\u6982\u89C8\u9875\u9762\u4E2D, \u5C06\u6307\u5B9A\u7684\u7A0B\u5E8F\u5305\u5206\u7EC4\n-nocomment                        \u4E0D\u751F\u6210\u8BF4\u660E\u548C\u6807\u8BB0, \u53EA\u751F\u6210\u58F0\u660E\u3002\n-nodeprecated                     \u4E0D\u5305\u542B @deprecated \u4FE1\u606F\n-noqualifier <name1>:<name2>:...\u8F93\u51FA\u4E2D\u4E0D\u5305\u62EC\u6307\u5B9A\u9650\u5B9A\u7B26\u7684\u5217\u8868\u3002\n-nosince                          \u4E0D\u5305\u542B @since \u4FE1\u606F\n-notimestamp                      \u4E0D\u5305\u542B\u9690\u85CF\u65F6\u95F4\u6233\n-nodeprecatedlist                 \u4E0D\u751F\u6210\u5DF2\u8FC7\u65F6\u7684\u5217\u8868\n-notree                           \u4E0D\u751F\u6210\u7C7B\u5206\u5C42\u7ED3\u6784\n-noindex                          \u4E0D\u751F\u6210\u7D22\u5F15\n-nohelp                           \u4E0D\u751F\u6210\u5E2E\u52A9\u94FE\u63A5\n-nonavbar                         \u4E0D\u751F\u6210\u5BFC\u822A\u680F\n-serialwarn                       \u751F\u6210\u6709\u5173 @serial \u6807\u8BB0\u7684\u8B66\u544A\n-tag <name>:<locations>:<header>  \u6307\u5B9A\u5355\u4E2A\u53C2\u6570\u5B9A\u5236\u6807\u8BB0\n-taglet                           \u8981\u6CE8\u518C\u7684 Taglet \u7684\u5168\u9650\u5B9A\u540D\u79F0\n-tagletpath                       Taglet \u7684\u8DEF\u5F84\n-charset <charset>                \u7528\u4E8E\u8DE8\u5E73\u53F0\u67E5\u770B\u751F\u6210\u7684\u6587\u6863\u7684\u5B57\u7B26\u96C6\u3002\n-helpfile <file>                  \u5305\u542B\u5E2E\u52A9\u94FE\u63A5\u6240\u94FE\u63A5\u5230\u7684\u6587\u4EF6\n-linksource                       \u4EE5 HTML \u683C\u5F0F\u751F\u6210\u6E90\u6587\u4EF6\n-sourcetab <tab length>           \u6307\u5B9A\u6E90\u4E2D\u6BCF\u4E2A\u5236\u8868\u7B26\u5360\u636E\u7684\u7A7A\u683C\u6570\n-keywords                         \u4F7F\u7A0B\u5E8F\u5305, \u7C7B\u548C\u6210\u5458\u4FE1\u606F\u9644\u5E26 HTML \u5143\u6807\u8BB0\n-stylesheetfile <path>            \u7528\u4E8E\u66F4\u6539\u751F\u6210\u6587\u6863\u7684\u6837\u5F0F\u7684\u6587\u4EF6\n-docencoding <name>               \u8F93\u51FA\u7F16\u7801\u540D\u79F0
+doclet.exception_encountered=\u5904\u7406{1}\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\n{0}
+doclet.usage=\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n-d <directory>                    \u8F93\u51FA\u6587\u4EF6\u7684\u76EE\u6807\u76EE\u5F55\n-use                              \u521B\u5EFA\u7C7B\u548C\u7A0B\u5E8F\u5305\u7528\u6CD5\u9875\u9762\n-version                          \u5305\u542B @version \u6BB5\n-author                           \u5305\u542B @author \u6BB5\n-docfilessubdirs                  \u9012\u5F52\u590D\u5236\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\n-splitindex                       \u5C06\u7D22\u5F15\u5206\u4E3A\u6BCF\u4E2A\u5B57\u6BCD\u5BF9\u5E94\u4E00\u4E2A\u6587\u4EF6\n-windowtitle <text>               \u6587\u6863\u7684\u6D4F\u89C8\u5668\u7A97\u53E3\u6807\u9898\n-doctitle <html-code>             \u5305\u542B\u6982\u89C8\u9875\u9762\u7684\u6807\u9898\n-header <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u7709\u6587\u672C\n-footer <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u811A\u6587\u672C\n-top    <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9876\u90E8\u6587\u672C\n-bottom <html-code>               \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u5E95\u90E8\u6587\u672C\n-link <url>                       \u521B\u5EFA\u6307\u5411\u4F4D\u4E8E <url> \u7684 javadoc \u8F93\u51FA\u7684\u94FE\u63A5\n-linkoffline <url> <url2>         \u5229\u7528\u4F4D\u4E8E <url2> \u7684\u7A0B\u5E8F\u5305\u5217\u8868\u94FE\u63A5\u81F3\u4F4D\u4E8E <url> \u7684\u6587\u6863\n-excludedocfilessubdir <name1>:.. \u6392\u9664\u5177\u6709\u7ED9\u5B9A\u540D\u79F0\u7684\u6240\u6709\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\u3002\n-group <name> <p1>:<p2>..         \u5728\u6982\u89C8\u9875\u9762\u4E2D, \u5C06\u6307\u5B9A\u7684\u7A0B\u5E8F\u5305\u5206\u7EC4\n-nocomment                        \u4E0D\u751F\u6210\u8BF4\u660E\u548C\u6807\u8BB0, \u53EA\u751F\u6210\u58F0\u660E\u3002\n-nodeprecated                     \u4E0D\u5305\u542B @deprecated \u4FE1\u606F\n-noqualifier <name1>:<name2>:...  \u8F93\u51FA\u4E2D\u4E0D\u5305\u62EC\u9650\u5B9A\u7B26\u7684\u5217\u8868\u3002\n-nosince                          \u4E0D\u5305\u542B @since \u4FE1\u606F\n-notimestamp                      \u4E0D\u5305\u542B\u9690\u85CF\u65F6\u95F4\u6233\n-nodeprecatedlist                 \u4E0D\u751F\u6210\u5DF2\u8FC7\u65F6\u7684\u5217\u8868\n-notree                           \u4E0D\u751F\u6210\u7C7B\u5206\u5C42\u7ED3\u6784\n-noindex                          \u4E0D\u751F\u6210\u7D22\u5F15\n-nohelp                           \u4E0D\u751F\u6210\u5E2E\u52A9\u94FE\u63A5\n-nonavbar                         \u4E0D\u751F\u6210\u5BFC\u822A\u680F\n-serialwarn                       \u751F\u6210\u6709\u5173 @serial \u6807\u8BB0\u7684\u8B66\u544A\n-tag <name>:<locations>:<header>  \u6307\u5B9A\u5355\u4E2A\u53C2\u6570\u5B9A\u5236\u6807\u8BB0\n-taglet                           \u8981\u6CE8\u518C\u7684 Taglet \u7684\u5168\u9650\u5B9A\u540D\u79F0\n-tagletpath                       Taglet \u7684\u8DEF\u5F84\n-Xdocrootparent <url>             \u5C06\u6587\u6863\u6CE8\u91CA\u4E2D\u51FA\u73B0\u7684\u6240\u6709\u540E\u8DDF /.. \u7684 @docRoot \u66FF\u6362\u4E3A <url>\n-charset <charset>                \u7528\u4E8E\u8DE8\u5E73\u53F0\u67E5\u770B\u751F\u6210\u7684\u6587\u6863\u7684\u5B57\u7B26\u96C6\u3002\n-helpfile <file>                  \u5305\u542B\u5E2E\u52A9\u94FE\u63A5\u6240\u94FE\u63A5\u5230\u7684\u6587\u4EF6\n-linksource                       \u4EE5 HTML \u683C\u5F0F\u751F\u6210\u6E90\u6587\u4EF6\n-sourcetab <tab length>           \u6307\u5B9A\u6E90\u4E2D\u6BCF\u4E2A\u5236\u8868\u7B26\u5360\u636E\u7684\u7A7A\u683C\u6570\n-keywords                         \u4F7F\u7A0B\u5E8F\u5305, \u7C7B\u548C\u6210\u5458\u4FE1\u606F\u9644\u5E26 HTML \u5143\u6807\u8BB0\n-stylesheetfile <path>            \u7528\u4E8E\u66F4\u6539\u751F\u6210\u6587\u6863\u7684\u6837\u5F0F\u7684\u6587\u4EF6\n-docencoding <name>               \u8F93\u51FA\u7F16\u7801\u540D\u79F0
 
 
 
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -28,8 +28,6 @@
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
-import java.io.File;
-import java.util.StringTokenizer;
 
 /**
  * An abstract implementation of a Doclet.
@@ -82,6 +80,9 @@
         }
         try {
             doclet.startGeneration(root);
+        } catch (Configuration.Fault f) {
+            root.printError(f.getMessage());
+            return false;
         } catch (Exception exc) {
             exc.printStackTrace();
             return false;
@@ -112,7 +113,7 @@
      *
      * @see com.sun.javadoc.RootDoc
      */
-    private void startGeneration(RootDoc root) throws Exception {
+    private void startGeneration(RootDoc root) throws Configuration.Fault, Exception {
         if (root.classes().length == 0) {
             configuration.message.
                 error("doclet.No_Public_Classes_To_Document");
@@ -128,6 +129,7 @@
 
         PackageListWriter.generate(configuration);
         generatePackageFiles(classtree);
+        generateProfileFiles();
 
         generateOtherFiles(root, classtree);
         configuration.tagletManager.printReport();
@@ -148,6 +150,12 @@
     }
 
     /**
+     * Generate the profile documentation.
+     *
+     */
+    protected abstract void generateProfileFiles() throws Exception;
+
+    /**
      * Generate the package documentation.
      *
      * @param classtree the data structure representing the class tree.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -29,6 +29,8 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.sym.Profiles;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -52,6 +54,21 @@
 public abstract class Configuration {
 
     /**
+     * Exception used to report a problem during setOptions.
+     */
+    public static class Fault extends Exception {
+        private static final long serialVersionUID = 0;
+
+        Fault(String msg) {
+            super(msg);
+        }
+
+        Fault(String msg, Exception cause) {
+            super(msg, cause);
+        }
+    }
+
+    /**
      * The factory for builders.
      */
     protected BuilderFactory builderFactory;
@@ -174,6 +191,12 @@
     public boolean showauthor = false;
 
     /**
+     * Generate documentation for JavaFX getters and setters automatically
+     * by copying it from the appropriate property definition.
+     */
+    public boolean javafx = false;
+
+    /**
      * Generate version specific information for the all the classes
      * if @version tag is used in the doc comment and if -version option is
      * used. <code>showversion</code> is set to true if -version option is
@@ -188,6 +211,17 @@
     public String sourcepath = "";
 
     /**
+     * Argument for command line option "-Xprofilespath".
+     */
+    public String profilespath = "";
+
+    /**
+     * Generate profiles documentation if profilespath is set and valid profiles
+     * are present.
+     */
+    public boolean showProfiles = false;
+
+    /**
      * Don't generate deprecated API information at all, if -nodeprecated
      * option is used. <code>nodepracted</code> is set to true if
      * -nodeprecated option is used. Default is generate deprected API
@@ -238,7 +272,7 @@
      * @param options The array of option names and values.
      * @throws DocletAbortException
      */
-    public abstract void setSpecificDocletOptions(String[][] options);
+    public abstract void setSpecificDocletOptions(String[][] options) throws Fault;
 
     /**
      * Return the doclet specific {@link MessageRetriever}
@@ -247,6 +281,16 @@
     public abstract MessageRetriever getDocletSpecificMsg();
 
     /**
+     * A profiles object used to access profiles across various pages.
+     */
+    public Profiles profiles;
+
+    /**
+     * An map of the profiles to packages.
+     */
+    public Map<String,PackageDoc[]> profilePackages;
+
+    /**
      * An array of the packages specified on the command-line merged
      * with the array of packages that contain the classes specified on the
      * command-line.  The array is sorted.
@@ -294,6 +338,7 @@
         option = option.toLowerCase();
         if (option.equals("-author") ||
             option.equals("-docfilessubdirs") ||
+            option.equals("-javafx") ||
             option.equals("-keywords") ||
             option.equals("-linksource") ||
             option.equals("-nocomment") ||
@@ -315,7 +360,8 @@
                    option.equals("-sourcepath") ||
                    option.equals("-tag") ||
                    option.equals("-taglet") ||
-                   option.equals("-tagletpath")) {
+                   option.equals("-tagletpath") ||
+                   option.equals("-xprofilespath")) {
             return 2;
         } else if (option.equals("-group") ||
                    option.equals("-linkoffline")) {
@@ -334,6 +380,38 @@
     public abstract boolean validOptions(String options[][],
         DocErrorReporter reporter);
 
+    private void initProfiles() throws IOException {
+        profiles = Profiles.read(new File(profilespath));
+        // Generate profiles documentation only is profilespath is set and if
+        // profiles is not null and profiles count is 1 or more.
+        showProfiles = (!profilespath.isEmpty() && profiles != null &&
+                profiles.getProfileCount() > 0);
+    }
+
+    private void initProfilePackages() throws IOException {
+        profilePackages = new HashMap<String,PackageDoc[]>();
+        ArrayList<PackageDoc> results;
+        Map<String,PackageDoc> packageIndex = new HashMap<String,PackageDoc>();
+        for (int i = 0; i < packages.length; i++) {
+            PackageDoc pkg = packages[i];
+            packageIndex.put(pkg.name(), pkg);
+        }
+        for (int i = 1; i < profiles.getProfileCount(); i++) {
+            Set<String> profPkgs = profiles.getPackages(i);
+            results = new ArrayList<PackageDoc>();
+            for (String packageName : profPkgs) {
+                packageName = packageName.replace("/", ".");
+                PackageDoc profPkg = packageIndex.get(packageName);
+                if (profPkg != null) {
+                    results.add(profPkg);
+                }
+            }
+            Collections.sort(results);
+            PackageDoc[] profilePkgs = results.toArray(new PackageDoc[]{});
+            profilePackages.put(Profile.lookup(i).name, profilePkgs);
+        }
+    }
+
     private void initPackageArray() {
         Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
         ClassDoc[] classes = root.specifiedClasses();
@@ -350,15 +428,26 @@
      *
      * @param options the two dimensional array of options.
      */
-    public void setOptions(String[][] options) {
+    public void setOptions(String[][] options) throws Fault {
         LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<String[]>();
+
+        // Some options, specifically -link and -linkoffline, require that
+        // the output directory has already been created: so do that first.
         for (int oi = 0; oi < options.length; ++oi) {
             String[] os = options[oi];
             String opt = os[0].toLowerCase();
             if (opt.equals("-d")) {
                 destDirName = addTrailingFileSep(os[1]);
                 docFileDestDirName = destDirName;
-            } else if (opt.equals("-docfilessubdirs")) {
+                ensureOutputDirExists();
+                break;
+            }
+        }
+
+        for (int oi = 0; oi < options.length; ++oi) {
+            String[] os = options[oi];
+            String opt = os[0].toLowerCase();
+            if (opt.equals("-docfilessubdirs")) {
                 copydocfilesubdirs = true;
             } else if (opt.equals("-docencoding")) {
                 docencoding = os[1];
@@ -366,6 +455,8 @@
                 encoding = os[1];
             } else if (opt.equals("-author")) {
                 showauthor = true;
+            } else  if (opt.equals("-javafx")) {
+                javafx = true;
             } else if (opt.equals("-nosince")) {
                 nosince = true;
             } else if (opt.equals("-version")) {
@@ -404,6 +495,8 @@
                 customTagStrs.add(os);
             } else if (opt.equals("-tagletpath")) {
                 tagletpath = os[1];
+            }  else if (opt.equals("-xprofilespath")) {
+                profilespath = os[1];
             } else if (opt.equals("-keywords")) {
                 keywords = true;
             } else if (opt.equals("-serialwarn")) {
@@ -436,12 +529,37 @@
      *
      * @throws DocletAbortException
      */
-    public void setOptions() {
+    public void setOptions() throws Fault {
         initPackageArray();
         setOptions(root.options());
+        if (!profilespath.isEmpty()) {
+            try {
+                initProfiles();
+                initProfilePackages();
+            } catch (Exception e) {
+                throw new DocletAbortException();
+            }
+        }
         setSpecificDocletOptions(root.options());
     }
 
+    private void ensureOutputDirExists() throws Fault {
+        DocFile destDir = DocFile.createFileForDirectory(this, destDirName);
+        if (!destDir.exists()) {
+            //Create the output directory (in case it doesn't exist yet)
+            root.printNotice(getText("doclet.dest_dir_create", destDirName));
+            destDir.mkdirs();
+        } else if (!destDir.isDirectory()) {
+            throw new Fault(getText(
+                "doclet.destination_directory_not_directory_0",
+                destDir.getPath()));
+        } else if (!destDir.canWrite()) {
+            throw new Fault(getText(
+                "doclet.destination_directory_not_writable_0",
+                destDir.getPath()));
+        }
+    }
+
 
     /**
      * Initialize the taglet manager.  The strings to initialize the simple custom tags should
@@ -451,7 +569,7 @@
      */
     private void initTagletManager(Set<String[]> customTagStrs) {
         tagletManager = tagletManager == null ?
-            new TagletManager(nosince, showversion, showauthor, message) :
+            new TagletManager(nosince, showversion, showauthor, javafx, message) :
             tagletManager;
         String[] args;
         for (Iterator<String[]> it = customTagStrs.iterator(); it.hasNext(); ) {
@@ -575,26 +693,7 @@
         for (int oi = 0; oi < options.length; oi++) {
             String[] os = options[oi];
             String opt = os[0].toLowerCase();
-            if (opt.equals("-d")) {
-                String destdirname = addTrailingFileSep(os[1]);
-                DocFile destDir = DocFile.createFileForDirectory(this, destdirname);
-                if (!destDir.exists()) {
-                    //Create the output directory (in case it doesn't exist yet)
-                    reporter.printNotice(getText("doclet.dest_dir_create",
-                        destdirname));
-                    destDir.mkdirs();
-                } else if (!destDir.isDirectory()) {
-                    reporter.printError(getText(
-                        "doclet.destination_directory_not_directory_0",
-                        destDir.getPath()));
-                    return false;
-                } else if (!destDir.canWrite()) {
-                    reporter.printError(getText(
-                        "doclet.destination_directory_not_writable_0",
-                        destDir.getPath()));
-                    return false;
-                }
-            } else if (opt.equals("-docencoding")) {
+            if (opt.equals("-docencoding")) {
                 docencodingfound = true;
                 if (!checkOutputFileEncoding(os[1], reporter)) {
                     return false;
@@ -781,4 +880,6 @@
         sourcetab = n;
         tabSpaces = String.format("%" + n + "s", "");
     }
+
+    public abstract boolean showMessage(SourcePosition pos, String key);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfilePackageSummaryWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,116 @@
+/*
+ * 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.internal.toolkit;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+
+/**
+ * The interface for writing profile package summary output.
+ *
+ *  <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 interface ProfilePackageSummaryWriter {
+
+    /**
+     * Get the header for the summary.
+     *
+     * @param heading Package name.
+     * @return the header to be added to the content tree
+     */
+    public abstract Content getPackageHeader(String heading);
+
+    /**
+     * Get the header for the content.
+     *
+     * @return a content tree for the content header
+     */
+    public abstract Content getContentHeader();
+
+    /**
+     * Get the header for the package summary.
+     *
+     * @return a content tree with the package summary header
+     */
+    public abstract Content getSummaryHeader();
+
+    /**
+     * Adds the table of classes to the documentation tree.
+     *
+     * @param classes the array of classes to document.
+     * @param label the label for this table.
+     * @param tableSummary the summary string for the table
+     * @param tableHeader array of table headers
+     * @param summaryContentTree the content tree to which the summaries will be added
+     */
+    public abstract void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content summaryContentTree);
+
+    /**
+     * Adds the package description from the "packages.html" file to the documentation
+     * tree.
+     *
+     * @param packageContentTree the content tree to which the package description
+     *                           will be added
+     */
+    public abstract void addPackageDescription(Content packageContentTree);
+
+    /**
+     * Adds the tag information from the "packages.html" file to the documentation
+     * tree.
+     *
+     * @param packageContentTree the content tree to which the package tags will
+     *                           be added
+     */
+    public abstract void addPackageTags(Content packageContentTree);
+
+    /**
+     * Adds the footer to the documentation tree.
+     *
+     * @param contentTree the tree to which the footer will be added
+     */
+    public abstract void addPackageFooter(Content contentTree);
+
+    /**
+     * Print the package summary document.
+     *
+     * @param contentTree the content tree that will be printed
+     */
+    public abstract void printDocument(Content contentTree) throws IOException;
+
+    /**
+     * Close the writer.
+     */
+    public abstract void close() throws IOException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/ProfileSummaryWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,120 @@
+/*
+ * 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.internal.toolkit;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+
+/**
+ * The interface for writing profile summary output.
+ *
+ *  <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 interface ProfileSummaryWriter {
+
+    /**
+     * Get the header for the summary.
+     *
+     * @param heading profile name.
+     * @return the header to be added to the content tree
+     */
+    public abstract Content getProfileHeader(String heading);
+
+    /**
+     * Get the header for the profile content.
+     *
+     * @return a content tree for the profile content header
+     */
+    public abstract Content getContentHeader();
+
+    /**
+     * Get the header for the summary header.
+     *
+     * @return a content tree with the summary header
+     */
+    public abstract Content getSummaryHeader();
+
+    /**
+     * Get the header for the summary tree.
+     *
+     * @param summaryContentTree the content tree.
+     * @return a content tree with the summary tree
+     */
+    public abstract Content getSummaryTree(Content summaryContentTree);
+
+    /**
+     * Get the header for the package summary header.
+     *
+     * @return a content tree with the package summary header
+     */
+    public abstract Content getPackageSummaryHeader(PackageDoc pkg);
+
+    /**
+     * Get the header for the package summary tree.
+     *
+     * @return a content tree with the package summary
+     */
+    public abstract Content getPackageSummaryTree(Content packageSummaryContentTree);
+
+    /**
+     * Adds the table of classes to the documentation tree.
+     *
+     * @param classes the array of classes to document.
+     * @param label the label for this table.
+     * @param tableSummary the summary string for the table
+     * @param tableHeader array of table headers
+     * @param packageSummaryContentTree the content tree to which the summaries will be added
+     */
+    public abstract void addClassesSummary(ClassDoc[] classes, String label,
+            String tableSummary, String[] tableHeader, Content packageSummaryContentTree);
+
+    /**
+     * Adds the footer to the documentation tree.
+     *
+     * @param contentTree the tree to which the footer will be added
+     */
+    public abstract void addProfileFooter(Content contentTree);
+
+    /**
+     * Print the profile summary document.
+     *
+     * @param contentTree the content tree that will be printed
+     */
+    public abstract void printDocument(Content contentTree) throws IOException;
+
+    /**
+     * Close the writer.
+     */
+    public abstract void close() throws IOException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/PropertyWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.internal.toolkit;
+
+import java.io.*;
+import com.sun.javadoc.*;
+
+/**
+ * The interface for writing property output.
+ *
+ *  <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 Jamie Ho
+ * @author Bhavesh Patel (Modified)
+ * @since 1.7
+ */
+
+public interface PropertyWriter {
+
+    /**
+     * Get the property details tree header.
+     *
+     * @param classDoc the class being documented
+     * @param memberDetailsTree the content tree representing member details
+     * @return content tree for the property details header
+     */
+    public Content getPropertyDetailsTreeHeader(ClassDoc classDoc,
+            Content memberDetailsTree);
+
+    /**
+     * Get the property documentation tree header.
+     *
+     * @param property the property being documented
+     * @param propertyDetailsTree the content tree representing property details
+     * @return content tree for the property documentation header
+     */
+    public Content getPropertyDocTreeHeader(MethodDoc property,
+            Content propertyDetailsTree);
+
+    /**
+     * Get the signature for the given property.
+     *
+     * @param property the property being documented
+     * @return content tree for the property signature
+     */
+    public Content getSignature(MethodDoc property);
+
+    /**
+     * Add the deprecated output for the given property.
+     *
+     * @param property the property being documented
+     * @param propertyDocTree content tree to which the deprecated information will be added
+     */
+    public void addDeprecated(MethodDoc property, Content propertyDocTree);
+
+    /**
+     * Add the comments for the given property.
+     *
+     * @param property the property being documented
+     * @param propertyDocTree the content tree to which the comments will be added
+     */
+    public void addComments(MethodDoc property, Content propertyDocTree);
+
+    /**
+     * Add the tags for the given property.
+     *
+     * @param property the property being documented
+     * @param propertyDocTree the content tree to which the tags will be added
+     */
+    public void addTags(MethodDoc property, Content propertyDocTree);
+
+    /**
+     * Get the property details tree.
+     *
+     * @param memberDetailsTree the content tree representing member details
+     * @return content tree for the property details
+     */
+    public Content getPropertyDetails(Content memberDetailsTree);
+
+    /**
+     * Get the property documentation.
+     *
+     * @param propertyDocTree the content tree representing property documentation
+     * @param isLastContent true if the content to be added is the last content
+     * @return content tree for the property documentation
+     */
+    public Content getPropertyDoc(Content propertyDocTree, boolean isLastContent);
+
+    /**
+     * Close the writer.
+     */
+    public void close() throws IOException;
+}
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/WriterFactory.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -26,6 +26,7 @@
 package com.sun.tools.doclets.internal.toolkit;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
@@ -65,6 +66,33 @@
     throws Exception;
 
     /**
+     * Return the writer for the profile summary.
+     *
+     * @param profile the profile being documented.
+     * @param prevProfile the previous profile that was documented.
+     * @param nextProfile the next profile being documented.
+     * @return the writer for the profile summary.  Return null if this
+     * writer is not supported by the doclet.
+     */
+    public abstract ProfileSummaryWriter getProfileSummaryWriter(Profile
+        profile, Profile prevProfile, Profile nextProfile)
+    throws Exception;
+
+    /**
+     * Return the writer for the profile package summary.
+     *
+     * @param packageDoc the profile package being documented.
+     * @param prevPkg the previous profile package that was documented.
+     * @param nextPkg the next profile package being documented.
+     * @param profile the profile being documented.
+     * @return the writer for the profile package summary.  Return null if this
+     * writer is not supported by the doclet.
+     */
+    public abstract ProfilePackageSummaryWriter getProfilePackageSummaryWriter(
+            PackageDoc packageDoc, PackageDoc prevPkg, PackageDoc nextPkg,
+            Profile profile) throws Exception;
+
+    /**
      * Return the writer for a class.
      *
      * @param classDoc the class being documented.
@@ -147,6 +175,16 @@
             throws Exception;
 
     /**
+     * Return the property writer for a given class.
+     *
+     * @param classWriter the writer for the class being documented.
+     * @return the property writer for the give class.  Return null if this
+     * writer is not supported by the doclet.
+     */
+    public abstract PropertyWriter getPropertyWriter(ClassWriter classWriter)
+            throws Exception;
+
+    /**
      * Return the constructor writer for a given class.
      *
      * @param classWriter the writer for the class being documented.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -116,9 +116,9 @@
       * @param contentTree the content tree to which the documentation will be added
       */
      public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception {
-        contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
+         contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
                 " " + annotationTypeDoc.name());
-        Content annotationContentTree = writer.getAnnotationContentHeader();
+         Content annotationContentTree = writer.getAnnotationContentHeader();
          buildChildren(node, annotationContentTree);
          contentTree.addContent(annotationContentTree);
          writer.addFooter(contentTree);
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -86,7 +86,7 @@
         this.classDoc = classDoc;
         this.writer = writer;
         this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType,
-            configuration.nodeprecated);
+            configuration);
         this.members = new ArrayList<ProgramElementDoc>(
             this.visibleMemberMap.getMembersFor(classDoc));
         if (configuration.getMemberComparator() != null) {
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -29,6 +29,7 @@
 import java.util.Set;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -96,6 +97,36 @@
     }
 
     /**
+     * Return the builder that builds the profile summary.
+     *
+     * @param profile the profile being documented.
+     * @param prevProfile the previous profile being documented.
+     * @param nextProfile the next profile being documented.
+     * @return the builder that builds the profile summary.
+     */
+    public AbstractBuilder getProfileSummaryBuilder(Profile profile, Profile prevProfile,
+            Profile nextProfile) throws Exception {
+        return ProfileSummaryBuilder.getInstance(context, profile,
+            writerFactory.getProfileSummaryWriter(profile, prevProfile, nextProfile));
+    }
+
+    /**
+     * Return the builder that builds the profile package summary.
+     *
+     * @param pkg the profile package being documented.
+     * @param prevPkg the previous profile package being documented.
+     * @param nextPkg the next profile package being documented.
+     * @param profile the profile being documented.
+     * @return the builder that builds the profile package summary.
+     */
+    public AbstractBuilder getProfilePackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
+            PackageDoc nextPkg, Profile profile) throws Exception {
+        return ProfilePackageSummaryBuilder.getInstance(context, pkg,
+            writerFactory.getProfilePackageSummaryWriter(pkg, prevPkg, nextPkg,
+                profile), profile);
+    }
+
+    /**
      * Return the builder for the class.
      *
      * @param classDoc the class being documented.
@@ -197,6 +228,19 @@
     }
 
     /**
+     * Return an instance of the property builder for the given class.
+     *
+     * @return an instance of the field builder for the given class.
+     */
+    public AbstractBuilder getPropertyBuilder(ClassWriter classWriter) throws Exception {
+        final PropertyWriter propertyWriter =
+                writerFactory.getPropertyWriter(classWriter);
+        return PropertyBuilder.getInstance(context,
+                                           classWriter.getClassDoc(),
+                                           propertyWriter);
+    }
+
+    /**
      * Return an instance of the constructor builder for the given class.
      *
      * @return an instance of the constructor builder for the given class.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -381,6 +381,17 @@
     }
 
     /**
+     * Build the property documentation.
+     *
+     * @param elements the XML elements that specify how a field is documented.
+     */
+    public void buildPropertyDetails(XMLNode node,
+            Content memberDetailsTree) throws Exception {
+        configuration.getBuilderFactory().
+                getPropertyBuilder(writer).buildChildren(node, memberDetailsTree);
+    }
+
+    /**
      * Build the constructor documentation.
      *
      * @param node the XML element that specifies which components to document
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -265,7 +265,7 @@
      */
     private boolean hasConstantField (ClassDoc classDoc) {
         VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(classDoc,
-            VisibleMemberMap.FIELDS, configuration.nodeprecated);
+            VisibleMemberMap.FIELDS, configuration);
         List<?> fields = visibleMemberMapFields.getLeafClassMembers(configuration);
         for (Iterator<?> iter = fields.iterator(); iter.hasNext(); ) {
             FieldDoc field = (FieldDoc) iter.next();
@@ -323,9 +323,9 @@
         public ConstantFieldBuilder(ClassDoc classdoc) {
             this.classdoc = classdoc;
             visibleMemberMapFields = new VisibleMemberMap(classdoc,
-                VisibleMemberMap.FIELDS, configuration.nodeprecated);
+                VisibleMemberMap.FIELDS, configuration);
             visibleMemberMapEnumConst = new VisibleMemberMap(classdoc,
-                VisibleMemberMap.ENUM_CONSTANTS, configuration.nodeprecated);
+                VisibleMemberMap.ENUM_CONSTANTS, configuration);
         }
 
         /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -93,7 +93,7 @@
                 new VisibleMemberMap(
                 classDoc,
                 VisibleMemberMap.CONSTRUCTORS,
-                configuration.nodeprecated);
+                configuration);
         constructors =
                 new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
         for (int i = 0; i < constructors.size(); i++) {
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -87,7 +87,7 @@
                 new VisibleMemberMap(
                 classDoc,
                 VisibleMemberMap.ENUM_CONSTANTS,
-                configuration.nodeprecated);
+                configuration);
         enumConstants =
                 new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
         if (configuration.getMemberComparator() != null) {
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -88,7 +88,7 @@
                 new VisibleMemberMap(
                 classDoc,
                 VisibleMemberMap.FIELDS,
-                configuration.nodeprecated);
+                configuration);
         fields =
                 new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
                 configuration));
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -26,6 +26,7 @@
 package com.sun.tools.doclets.internal.toolkit.builders;
 
 import java.util.*;
+import java.text.MessageFormat;
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
@@ -82,7 +83,7 @@
                     new VisibleMemberMap(
                     classDoc,
                     i,
-                    configuration.nodeprecated);
+                    configuration);
         }
     }
 
@@ -254,6 +255,17 @@
     }
 
     /**
+     * Build the summary for the fields.
+     */
+    public void buildPropertiesSummary(XMLNode node, Content memberSummaryTree) {
+        MemberSummaryWriter writer =
+                memberSummaryWriters[VisibleMemberMap.PROPERTIES];
+        VisibleMemberMap visibleMemberMap =
+                visibleMemberMaps[VisibleMemberMap.PROPERTIES];
+        addSummary(writer, visibleMemberMap, true, memberSummaryTree);
+    }
+
+    /**
      * Build the summary for the nested classes.
      *
      * @param node the XML element that specifies which components to document
@@ -311,6 +323,11 @@
             List<Content> tableContents = new LinkedList<Content>();
             for (int i = 0; i < members.size(); i++) {
                 ProgramElementDoc member = members.get(i);
+                final ProgramElementDoc propertyDoc =
+                            visibleMemberMap.getPropertyMemberDoc(member);
+                if (propertyDoc != null) {
+                    processProperty(visibleMemberMap, member, propertyDoc);
+                }
                 Tag[] firstSentenceTags = member.firstSentenceTags();
                 if (member instanceof MethodDoc && firstSentenceTags.length == 0) {
                     //Inherit comments from overriden or implemented method if
@@ -330,6 +347,106 @@
     }
 
     /**
+     * Process the property method, property setter and/or property getter
+     * comment text so that it contains the documentation from
+     * the property field. The method adds the leading sentence,
+     * copied documentation including the defaultValue tag and
+     * the see tags if the appropriate property getter and setter are
+     * available.
+     *
+     * @param visibleMemberMap the members information.
+     * @param member the member which is to be augmented.
+     * @param propertyDoc the original property documentation.
+     */
+    private void processProperty(VisibleMemberMap visibleMemberMap,
+                                 ProgramElementDoc member,
+                                 ProgramElementDoc propertyDoc) {
+        StringBuilder commentTextBuilder = new StringBuilder();
+        final boolean isSetter = isSetter(member);
+        final boolean isGetter = isGetter(member);
+        if (isGetter || isSetter) {
+            //add "[GS]ets the value of the property PROPERTY_NAME."
+            if (isSetter) {
+                commentTextBuilder.append(
+                        MessageFormat.format(
+                                configuration.getText("doclet.PropertySetterWithName"),
+                                Util.propertyNameFromMethodName(member.name())));
+            }
+            if (isGetter) {
+                commentTextBuilder.append(
+                        MessageFormat.format(
+                                configuration.getText("doclet.PropertyGetterWithName"),
+                                Util.propertyNameFromMethodName(member.name())));
+            }
+            if (propertyDoc.commentText() != null
+                        && !propertyDoc.commentText().isEmpty()) {
+                commentTextBuilder.append(" \n @propertyDescription ");
+            }
+        }
+        commentTextBuilder.append(propertyDoc.commentText());
+
+        Tag[] tags = propertyDoc.tags("@defaultValue");
+        if (tags != null) {
+            for (Tag tag: tags) {
+                commentTextBuilder.append("\n")
+                                  .append(tag.name())
+                                  .append(" ")
+                                  .append(tag.text());
+            }
+        }
+
+        //add @see tags
+        if (!isGetter && !isSetter) {
+            MethodDoc getter = (MethodDoc) visibleMemberMap.getGetterForProperty(member);
+            MethodDoc setter = (MethodDoc) visibleMemberMap.getSetterForProperty(member);
+
+            if ((null != getter)
+                    && (commentTextBuilder.indexOf("@see #" + getter.name()) == -1)) {
+                commentTextBuilder.append("\n @see #")
+                                  .append(getter.name())
+                                  .append("() ");
+            }
+
+            if ((null != setter)
+                    && (commentTextBuilder.indexOf("@see #" + setter.name()) == -1)) {
+                String typeName = setter.parameters()[0].typeName();
+                // Removal of type parameters and package information.
+                typeName = typeName.split("<")[0];
+                if (typeName.contains(".")) {
+                    typeName = typeName.substring(typeName.lastIndexOf(".") + 1);
+                }
+                commentTextBuilder.append("\n @see #").append(setter.name());
+
+                if (setter.parameters()[0].type().asTypeVariable() == null) {
+                    commentTextBuilder.append("(").append(typeName).append(")");
+                }
+                commentTextBuilder.append(" \n");
+            }
+        }
+        member.setRawCommentText(commentTextBuilder.toString());
+    }
+    /**
+     * Test whether the method is a getter.
+     * @param ped property method documentation. Needs to be either property
+     * method, property getter, or property setter.
+     * @return true if the given documentation belongs to a getter.
+     */
+    private boolean isGetter(ProgramElementDoc ped) {
+        final String pedName = ped.name();
+        return pedName.startsWith("get") || pedName.startsWith("is");
+    }
+
+    /**
+     * Test whether the method is a setter.
+     * @param ped property method documentation. Needs to be either property
+     * method, property getter, or property setter.
+     * @return true if the given documentation belongs to a setter.
+     */
+    private boolean isSetter(ProgramElementDoc ped) {
+        return ped.name().startsWith("set");
+    }
+
+    /**
      * Build the inherited member summary for the given methods.
      *
      * @param writer the writer for this member summary.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -88,7 +88,7 @@
         visibleMemberMap = new VisibleMemberMap(
                 classDoc,
                 VisibleMemberMap.METHODS,
-                configuration.nodeprecated);
+                configuration);
         methods =
                 new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
                 configuration));
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -176,6 +176,7 @@
                         ? packageDoc.interfaces()
                         : configuration.classDocCatalog.interfaces(
                                 Util.getPackageName(packageDoc));
+        interfaces = Util.filterOutPrivateClasses(interfaces, configuration.javafx);
         if (interfaces.length > 0) {
             packageWriter.addClassesSummary(
                     interfaces,
@@ -205,6 +206,7 @@
                         ? packageDoc.ordinaryClasses()
                         : configuration.classDocCatalog.ordinaryClasses(
                                 Util.getPackageName(packageDoc));
+        classes = Util.filterOutPrivateClasses(classes, configuration.javafx);
         if (classes.length > 0) {
             packageWriter.addClassesSummary(
                     classes,
@@ -234,6 +236,7 @@
                         ? packageDoc.enums()
                         : configuration.classDocCatalog.enums(
                                 Util.getPackageName(packageDoc));
+        enums = Util.filterOutPrivateClasses(enums, configuration.javafx);
         if (enums.length > 0) {
             packageWriter.addClassesSummary(
                     enums,
@@ -263,6 +266,7 @@
                         ? packageDoc.exceptions()
                         : configuration.classDocCatalog.exceptions(
                                 Util.getPackageName(packageDoc));
+        exceptions = Util.filterOutPrivateClasses(exceptions, configuration.javafx);
         if (exceptions.length > 0) {
             packageWriter.addClassesSummary(
                     exceptions,
@@ -292,6 +296,7 @@
                         ? packageDoc.errors()
                         : configuration.classDocCatalog.errors(
                                 Util.getPackageName(packageDoc));
+        errors = Util.filterOutPrivateClasses(errors, configuration.javafx);
         if (errors.length > 0) {
             packageWriter.addClassesSummary(
                     errors,
@@ -321,6 +326,7 @@
                         ? packageDoc.annotationTypes()
                         : configuration.classDocCatalog.annotationTypes(
                                 Util.getPackageName(packageDoc));
+        annotationTypes = Util.filterOutPrivateClasses(annotationTypes, configuration.javafx);
         if (annotationTypes.length > 0) {
             packageWriter.addClassesSummary(
                     annotationTypes,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,374 @@
+/*
+ * 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.internal.toolkit.builders;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Builds the summary for a given profile package.
+ *
+ *  <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 class ProfilePackageSummaryBuilder extends AbstractBuilder {
+    /**
+     * The root element of the profile package summary XML is {@value}.
+     */
+    public static final String ROOT = "PackageDoc";
+
+    /**
+     * The profile package being documented.
+     */
+    private final PackageDoc packageDoc;
+
+    /**
+     * The name of the profile being documented.
+     */
+    private final String profileName;
+
+    /**
+     * The value of the profile being documented.
+     */
+    private final int profileValue;
+
+    /**
+     * The doclet specific writer that will output the result.
+     */
+    private final ProfilePackageSummaryWriter profilePackageWriter;
+
+    /**
+     * The content that will be added to the profile package summary documentation tree.
+     */
+    private Content contentTree;
+
+    /**
+     * Construct a new ProfilePackageSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param pkg the profile package being documented.
+     * @param profilePackageWriter the doclet specific writer that will output the
+     *        result.
+     * @param profile the profile being documented.
+     */
+    private ProfilePackageSummaryBuilder(Context context,
+            PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
+            Profile profile) {
+        super(context);
+        this.packageDoc = pkg;
+        this.profilePackageWriter = profilePackageWriter;
+        this.profileName = profile.name;
+        this.profileValue = profile.value;
+    }
+
+    /**
+     * Construct a new ProfilePackageSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param pkg the profile package being documented.
+     * @param profilePackageWriter the doclet specific writer that will output the
+     *        result.
+     * @param profile the profile being documented.
+     *
+     * @return an instance of a ProfilePackageSummaryBuilder.
+     */
+    public static ProfilePackageSummaryBuilder getInstance(Context context,
+            PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
+            Profile profile) {
+        return new ProfilePackageSummaryBuilder(context, pkg, profilePackageWriter,
+                profile);
+    }
+
+    /**
+     * Build the profile package summary.
+     */
+    public void build() throws IOException {
+        if (profilePackageWriter == null) {
+            //Doclet does not support this output.
+            return;
+        }
+        build(layoutParser.parseXML(ROOT), contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return ROOT;
+    }
+
+    /**
+     * Build the profile package documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the documentation will be added
+     */
+    public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
+        contentTree = profilePackageWriter.getPackageHeader(
+                Util.getPackageName(packageDoc));
+        buildChildren(node, contentTree);
+        profilePackageWriter.addPackageFooter(contentTree);
+        profilePackageWriter.printDocument(contentTree);
+        profilePackageWriter.close();
+        Util.copyDocFiles(configuration, packageDoc);
+    }
+
+    /**
+     * Build the content for the profile package doc.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the package contents
+     *                    will be added
+     */
+    public void buildContent(XMLNode node, Content contentTree) {
+        Content packageContentTree = profilePackageWriter.getContentHeader();
+        buildChildren(node, packageContentTree);
+        contentTree.addContent(packageContentTree);
+    }
+
+    /**
+     * Build the profile package summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageContentTree the package content tree to which the summaries will
+     *                           be added
+     */
+    public void buildSummary(XMLNode node, Content packageContentTree) {
+        Content summaryContentTree = profilePackageWriter.getSummaryHeader();
+        buildChildren(node, summaryContentTree);
+        packageContentTree.addContent(summaryContentTree);
+    }
+
+    /**
+     * Build the summary for the interfaces in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the interface summary
+     *                           will be added
+     */
+    public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
+        String interfaceTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Interface_Summary"),
+                configuration.getText("doclet.interfaces"));
+        String[] interfaceTableHeader = new String[] {
+            configuration.getText("doclet.Interface"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] interfaces =
+                packageDoc.isIncluded()
+                        ? packageDoc.interfaces()
+                        : configuration.classDocCatalog.interfaces(
+                                Util.getPackageName(packageDoc));
+        if (interfaces.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    interfaces,
+                    configuration.getText("doclet.Interface_Summary"),
+                    interfaceTableSummary, interfaceTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the classes in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the class summary will
+     *                           be added
+     */
+    public void buildClassSummary(XMLNode node, Content summaryContentTree) {
+        String classTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Class_Summary"),
+                configuration.getText("doclet.classes"));
+        String[] classTableHeader = new String[] {
+            configuration.getText("doclet.Class"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] classes =
+                packageDoc.isIncluded()
+                        ? packageDoc.ordinaryClasses()
+                        : configuration.classDocCatalog.ordinaryClasses(
+                                Util.getPackageName(packageDoc));
+        if (classes.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    classes,
+                    configuration.getText("doclet.Class_Summary"),
+                    classTableSummary, classTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the enums in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the enum summary will
+     *                           be added
+     */
+    public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
+        String enumTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Enum_Summary"),
+                configuration.getText("doclet.enums"));
+        String[] enumTableHeader = new String[] {
+            configuration.getText("doclet.Enum"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] enums =
+                packageDoc.isIncluded()
+                        ? packageDoc.enums()
+                        : configuration.classDocCatalog.enums(
+                                Util.getPackageName(packageDoc));
+        if (enums.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    enums,
+                    configuration.getText("doclet.Enum_Summary"),
+                    enumTableSummary, enumTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the exceptions in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the exception summary will
+     *                           be added
+     */
+    public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
+        String exceptionTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Exception_Summary"),
+                configuration.getText("doclet.exceptions"));
+        String[] exceptionTableHeader = new String[] {
+            configuration.getText("doclet.Exception"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] exceptions =
+                packageDoc.isIncluded()
+                        ? packageDoc.exceptions()
+                        : configuration.classDocCatalog.exceptions(
+                                Util.getPackageName(packageDoc));
+        if (exceptions.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    exceptions,
+                    configuration.getText("doclet.Exception_Summary"),
+                    exceptionTableSummary, exceptionTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the errors in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the error summary will
+     *                           be added
+     */
+    public void buildErrorSummary(XMLNode node, Content summaryContentTree) {
+        String errorTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Error_Summary"),
+                configuration.getText("doclet.errors"));
+        String[] errorTableHeader = new String[] {
+            configuration.getText("doclet.Error"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] errors =
+                packageDoc.isIncluded()
+                        ? packageDoc.errors()
+                        : configuration.classDocCatalog.errors(
+                                Util.getPackageName(packageDoc));
+        if (errors.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    errors,
+                    configuration.getText("doclet.Error_Summary"),
+                    errorTableSummary, errorTableHeader, summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the annotation type in this package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the summary tree to which the annotation type
+     *                           summary will be added
+     */
+    public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
+        String annotationtypeTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Types_Summary"),
+                configuration.getText("doclet.annotationtypes"));
+        String[] annotationtypeTableHeader = new String[] {
+            configuration.getText("doclet.AnnotationType"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] annotationTypes =
+                packageDoc.isIncluded()
+                        ? packageDoc.annotationTypes()
+                        : configuration.classDocCatalog.annotationTypes(
+                                Util.getPackageName(packageDoc));
+        if (annotationTypes.length > 0) {
+            profilePackageWriter.addClassesSummary(
+                    annotationTypes,
+                    configuration.getText("doclet.Annotation_Types_Summary"),
+                    annotationtypeTableSummary, annotationtypeTableHeader,
+                    summaryContentTree);
+        }
+    }
+
+    /**
+     * Build the description of the summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageContentTree the tree to which the package description will
+     *                           be added
+     */
+    public void buildPackageDescription(XMLNode node, Content packageContentTree) {
+        if (configuration.nocomment) {
+            return;
+        }
+        profilePackageWriter.addPackageDescription(packageContentTree);
+    }
+
+    /**
+     * Build the tags of the summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageContentTree the tree to which the package tags will be added
+     */
+    public void buildPackageTags(XMLNode node, Content packageContentTree) {
+        if (configuration.nocomment) {
+            return;
+        }
+        profilePackageWriter.addPackageTags(packageContentTree);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,328 @@
+/*
+ * 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.internal.toolkit.builders;
+
+import java.io.*;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Builds the summary for a given profile.
+ *
+ *  <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 class ProfileSummaryBuilder extends AbstractBuilder {
+    /**
+     * The root element of the profile summary XML is {@value}.
+     */
+    public static final String ROOT = "ProfileDoc";
+
+    /**
+     * The profile being documented.
+     */
+    private final Profile profile;
+
+    /**
+     * The doclet specific writer that will output the result.
+     */
+    private final ProfileSummaryWriter profileWriter;
+
+    /**
+     * The content that will be added to the profile summary documentation tree.
+     */
+    private Content contentTree;
+
+    /**
+     * The profile package being documented.
+     */
+    private PackageDoc pkg;
+
+    /**
+     * Construct a new ProfileSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param profile the profile being documented.
+     * @param profileWriter the doclet specific writer that will output the
+     *        result.
+     */
+    private ProfileSummaryBuilder(Context context,
+            Profile profile, ProfileSummaryWriter profileWriter) {
+        super(context);
+        this.profile = profile;
+        this.profileWriter = profileWriter;
+    }
+
+    /**
+     * Construct a new ProfileSummaryBuilder.
+     *
+     * @param context  the build context.
+     * @param profile the profile being documented.
+     * @param profileWriter the doclet specific writer that will output the
+     *        result.
+     *
+     * @return an instance of a ProfileSummaryBuilder.
+     */
+    public static ProfileSummaryBuilder getInstance(Context context,
+            Profile profile, ProfileSummaryWriter profileWriter) {
+        return new ProfileSummaryBuilder(context, profile, profileWriter);
+    }
+
+    /**
+     * Build the profile summary.
+     */
+    public void build() throws IOException {
+        if (profileWriter == null) {
+            //Doclet does not support this output.
+            return;
+        }
+        build(layoutParser.parseXML(ROOT), contentTree);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return ROOT;
+    }
+
+    /**
+     * Build the profile documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the documentation will be added
+     */
+    public void buildProfileDoc(XMLNode node, Content contentTree) throws Exception {
+        contentTree = profileWriter.getProfileHeader(profile.name);
+        buildChildren(node, contentTree);
+        profileWriter.addProfileFooter(contentTree);
+        profileWriter.printDocument(contentTree);
+        profileWriter.close();
+        Util.copyDocFiles(configuration, DocPaths.profileSummary(profile.name));
+    }
+
+    /**
+     * Build the content for the profile doc.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param contentTree the content tree to which the profile contents
+     *                    will be added
+     */
+    public void buildContent(XMLNode node, Content contentTree) {
+        Content profileContentTree = profileWriter.getContentHeader();
+        buildChildren(node, profileContentTree);
+        contentTree.addContent(profileContentTree);
+    }
+
+    /**
+     * Build the profile summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param profileContentTree the profile content tree to which the summaries will
+     *                           be added
+     */
+    public void buildSummary(XMLNode node, Content profileContentTree) {
+        Content summaryContentTree = profileWriter.getSummaryHeader();
+        buildChildren(node, summaryContentTree);
+        profileContentTree.addContent(profileWriter.getSummaryTree(summaryContentTree));
+    }
+
+    /**
+     * Build the profile package summary.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param summaryContentTree the content tree to which the summaries will
+     *                           be added
+     */
+    public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
+        PackageDoc[] packages = configuration.profilePackages.get(profile.name);
+        for (int i = 0; i < packages.length; i++) {
+            this.pkg = packages[i];
+            Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
+            buildChildren(node, packageSummaryContentTree);
+            summaryContentTree.addContent(profileWriter.getPackageSummaryTree(
+                    packageSummaryContentTree));
+        }
+    }
+
+    /**
+     * Build the summary for the interfaces in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the interface summary
+     *                           will be added
+     */
+    public void buildInterfaceSummary(XMLNode node, Content packageSummaryContentTree) {
+        String interfaceTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Interface_Summary"),
+                configuration.getText("doclet.interfaces"));
+        String[] interfaceTableHeader = new String[] {
+            configuration.getText("doclet.Interface"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] interfaces = pkg.interfaces();
+        if (interfaces.length > 0) {
+            profileWriter.addClassesSummary(
+                    interfaces,
+                    configuration.getText("doclet.Interface_Summary"),
+                    interfaceTableSummary, interfaceTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the classes in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the class summary will
+     *                           be added
+     */
+    public void buildClassSummary(XMLNode node, Content packageSummaryContentTree) {
+        String classTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Class_Summary"),
+                configuration.getText("doclet.classes"));
+        String[] classTableHeader = new String[] {
+            configuration.getText("doclet.Class"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] classes = pkg.ordinaryClasses();
+        if (classes.length > 0) {
+            profileWriter.addClassesSummary(
+                    classes,
+                    configuration.getText("doclet.Class_Summary"),
+                    classTableSummary, classTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the enums in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the enum summary will
+     *                           be added
+     */
+    public void buildEnumSummary(XMLNode node, Content packageSummaryContentTree) {
+        String enumTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Enum_Summary"),
+                configuration.getText("doclet.enums"));
+        String[] enumTableHeader = new String[] {
+            configuration.getText("doclet.Enum"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] enums = pkg.enums();
+        if (enums.length > 0) {
+            profileWriter.addClassesSummary(
+                    enums,
+                    configuration.getText("doclet.Enum_Summary"),
+                    enumTableSummary, enumTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the exceptions in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the exception summary will
+     *                           be added
+     */
+    public void buildExceptionSummary(XMLNode node, Content packageSummaryContentTree) {
+        String exceptionTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Exception_Summary"),
+                configuration.getText("doclet.exceptions"));
+        String[] exceptionTableHeader = new String[] {
+            configuration.getText("doclet.Exception"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] exceptions = pkg.exceptions();
+        if (exceptions.length > 0) {
+            profileWriter.addClassesSummary(
+                    exceptions,
+                    configuration.getText("doclet.Exception_Summary"),
+                    exceptionTableSummary, exceptionTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the errors in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the error summary will
+     *                           be added
+     */
+    public void buildErrorSummary(XMLNode node, Content packageSummaryContentTree) {
+        String errorTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Error_Summary"),
+                configuration.getText("doclet.errors"));
+        String[] errorTableHeader = new String[] {
+            configuration.getText("doclet.Error"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] errors = pkg.errors();
+        if (errors.length > 0) {
+            profileWriter.addClassesSummary(
+                    errors,
+                    configuration.getText("doclet.Error_Summary"),
+                    errorTableSummary, errorTableHeader, packageSummaryContentTree);
+        }
+    }
+
+    /**
+     * Build the summary for the annotation type in the package.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param packageSummaryContentTree the tree to which the annotation type
+     *                           summary will be added
+     */
+    public void buildAnnotationTypeSummary(XMLNode node, Content packageSummaryContentTree) {
+        String annotationtypeTableSummary =
+                configuration.getText("doclet.Member_Table_Summary",
+                configuration.getText("doclet.Annotation_Types_Summary"),
+                configuration.getText("doclet.annotationtypes"));
+        String[] annotationtypeTableHeader = new String[] {
+            configuration.getText("doclet.AnnotationType"),
+            configuration.getText("doclet.Description")
+        };
+        ClassDoc[] annotationTypes = pkg.annotationTypes();
+        if (annotationTypes.length > 0) {
+            profileWriter.addClassesSummary(
+                    annotationTypes,
+                    configuration.getText("doclet.Annotation_Types_Summary"),
+                    annotationtypeTableSummary, annotationtypeTableHeader,
+                    packageSummaryContentTree);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,228 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.internal.toolkit.builders;
+
+import java.util.*;
+
+import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.javadoc.*;
+
+/**
+ * Builds documentation for a property.
+ *
+ *  <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 Jamie Ho
+ * @author Bhavesh Patel (Modified)
+ * @since 1.7
+ */
+public class PropertyBuilder extends AbstractMemberBuilder {
+
+    /**
+     * The class whose properties are being documented.
+     */
+    private final ClassDoc classDoc;
+
+    /**
+     * The visible properties for the given class.
+     */
+    private final VisibleMemberMap visibleMemberMap;
+
+    /**
+     * The writer to output the property documentation.
+     */
+    private final PropertyWriter writer;
+
+    /**
+     * The list of properties being documented.
+     */
+    private final List<ProgramElementDoc> properties;
+
+    /**
+     * The index of the current property that is being documented at this point
+     * in time.
+     */
+    private int currentPropertyIndex;
+
+    /**
+     * Construct a new PropertyBuilder.
+     *
+     * @param context  the build context.
+     * @param classDoc the class whoses members are being documented.
+     * @param writer the doclet specific writer.
+     */
+    private PropertyBuilder(Context context,
+            ClassDoc classDoc,
+            PropertyWriter writer) {
+        super(context);
+        this.classDoc = classDoc;
+        this.writer = writer;
+        visibleMemberMap =
+                new VisibleMemberMap(
+                classDoc,
+                VisibleMemberMap.PROPERTIES,
+                configuration);
+        properties =
+                new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
+        if (configuration.getMemberComparator() != null) {
+            Collections.sort(properties, configuration.getMemberComparator());
+        }
+    }
+
+    /**
+     * Construct a new PropertyBuilder.
+     *
+     * @param context  the build context.
+     * @param classDoc the class whoses members are being documented.
+     * @param writer the doclet specific writer.
+     */
+    public static PropertyBuilder getInstance(Context context,
+            ClassDoc classDoc,
+            PropertyWriter writer) {
+        return new PropertyBuilder(context, classDoc, writer);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return "PropertyDetails";
+    }
+
+    /**
+     * Returns a list of properties that will be documented for the given class.
+     * This information can be used for doclet specific documentation
+     * generation.
+     *
+     * @param classDoc the {@link ClassDoc} we want to check.
+     * @return a list of properties that will be documented.
+     */
+    public List<ProgramElementDoc> members(ClassDoc classDoc) {
+        return visibleMemberMap.getMembersFor(classDoc);
+    }
+
+    /**
+     * Returns the visible member map for the properties of this class.
+     *
+     * @return the visible member map for the properties of this class.
+     */
+    public VisibleMemberMap getVisibleMemberMap() {
+        return visibleMemberMap;
+    }
+
+    /**
+     * summaryOrder.size()
+     */
+    public boolean hasMembersToDocument() {
+        return properties.size() > 0;
+    }
+
+    /**
+     * Build the property documentation.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param memberDetailsTree the content tree to which the documentation will be added
+     */
+    public void buildPropertyDoc(XMLNode node, Content memberDetailsTree) {
+        if (writer == null) {
+            return;
+        }
+        int size = properties.size();
+        if (size > 0) {
+            Content propertyDetailsTree = writer.getPropertyDetailsTreeHeader(
+                    classDoc, memberDetailsTree);
+            for (currentPropertyIndex = 0; currentPropertyIndex < size;
+                    currentPropertyIndex++) {
+                Content propertyDocTree = writer.getPropertyDocTreeHeader(
+                        (MethodDoc) properties.get(currentPropertyIndex),
+                        propertyDetailsTree);
+                buildChildren(node, propertyDocTree);
+                propertyDetailsTree.addContent(writer.getPropertyDoc(
+                        propertyDocTree, (currentPropertyIndex == size - 1)));
+            }
+            memberDetailsTree.addContent(
+                    writer.getPropertyDetails(propertyDetailsTree));
+        }
+    }
+
+    /**
+     * Build the signature.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param propertyDocTree the content tree to which the documentation will be added
+     */
+    public void buildSignature(XMLNode node, Content propertyDocTree) {
+        propertyDocTree.addContent(
+                writer.getSignature((MethodDoc) properties.get(currentPropertyIndex)));
+    }
+
+    /**
+     * Build the deprecation information.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param propertyDocTree the content tree to which the documentation will be added
+     */
+    public void buildDeprecationInfo(XMLNode node, Content propertyDocTree) {
+        writer.addDeprecated(
+                (MethodDoc) properties.get(currentPropertyIndex), propertyDocTree);
+    }
+
+    /**
+     * Build the comments for the property.  Do nothing if
+     * {@link Configuration#nocomment} is set to true.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param propertyDocTree the content tree to which the documentation will be added
+     */
+    public void buildPropertyComments(XMLNode node, Content propertyDocTree) {
+        if (!configuration.nocomment) {
+            writer.addComments((MethodDoc) properties.get(currentPropertyIndex), propertyDocTree);
+        }
+    }
+
+    /**
+     * Build the tag information.
+     *
+     * @param node the XML element that specifies which components to document
+     * @param propertyDocTree the content tree to which the documentation will be added
+     */
+    public void buildTagInfo(XMLNode node, Content propertyDocTree) {
+        writer.addTags((MethodDoc) properties.get(currentPropertyIndex), propertyDocTree);
+    }
+
+    /**
+     * Return the property writer for this builder.
+     *
+     * @return the property writer for this builder.
+     */
+    public PropertyWriter getWriter() {
+        return writer;
+    }
+}
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclet.xml	Tue Jul 02 10:13:00 2013 +0100
@@ -1,7 +1,7 @@
 <?xml version='1.0' encoding='utf-8'?>
 
 <!--
- 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
@@ -28,6 +28,21 @@
 
 <Doclet>
 
+    <ProfileDoc>
+        <Content>
+            <Summary>
+                <PackageSummary>
+                    <InterfaceSummary/>
+                    <ClassSummary/>
+                    <EnumSummary/>
+                    <ExceptionSummary/>
+                    <ErrorSummary/>
+                    <AnnotationTypeSummary/>
+                </PackageSummary>
+            </Summary>
+        </Content>
+    </ProfileDoc>
+
     <PackageDoc>
         <Content>
             <Summary>
@@ -92,6 +107,7 @@
             <ClassTagInfo/>
         </ClassInfo>
         <MemberSummary>
+            <PropertiesSummary/>
             <NestedClassesSummary/>
             <EnumConstantsSummary/>
             <FieldsSummary/>
@@ -107,6 +123,13 @@
                     <TagInfo/>
                 </EnumConstant>
             </EnumConstantsDetails>
+            <PropertyDetails>
+                <PropertyDoc>
+                    <Signature/>
+                    <PropertyComments/>
+                    <TagInfo/>
+                </PropertyDoc>
+            </PropertyDetails>
             <FieldDetails>
                 <FieldDoc>
                     <Signature/>
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -11,6 +11,8 @@
 doclet.Class_0_extends_implements_serializable=Class {0} extends {1} implements Serializable
 doclet.Option_conflict=Option {0} conflicts with {1}
 doclet.Option_reuse=Option reused: {0}
+doclet.Option_doclint_no_qualifiers=Access qualifiers not permitted for -Xdoclint arguments
+doclet.Option_doclint_invalid_arg=Invalid argument for -Xdoclint option
 doclet.exception_encountered= {0} encountered \n\
 \twhile attempting to create file: {1}
 doclet.perform_copy_exception_encountered= {0} encountered while \n\
@@ -29,6 +31,7 @@
 doclet.Building_Index_For_All_Classes=Building index for all classes...
 doclet.sourcetab_warning=The argument for -sourcetab must be an integer greater than 0.
 doclet.Packages=Packages
+doclet.Profiles=Profiles
 doclet.Other_Packages=Other Packages
 doclet.Notice_taglet_registered=Registered Taglet {0} ...
 doclet.Notice_taglet_unseen=Note: Custom tags that were not seen: {0}
@@ -37,6 +40,12 @@
 doclet.Error_taglet_not_registered=Error - Exception {0} thrown while trying to register Taglet {1}...
 doclet.Error_invalid_custom_tag_argument=Error - {0} is an invalid argument to the -tag option...
 doclet.Author=Author:
+doclet.DefaultValue=Default value:
+doclet.PropertyDescription=Property description:
+doclet.PropertyGetter=Gets the value of the property
+doclet.PropertySetter=Sets the value of the property
+doclet.PropertyGetterWithName=Gets the value of the property {0}.
+doclet.PropertySetterWithName=Sets the value of the property {0}.
 doclet.Default=Default:
 doclet.Parameters=Parameters:
 doclet.TypeParameters=Type Parameters:
@@ -58,7 +67,9 @@
 doclet.noInheritedDoc=@inheritDoc used but {0} does not override or implement any method.
 doclet.malformed_html_link_tag=<a> tag is malformed:\n"{0}"
 doclet.tag_misuse=Tag {0} cannot be used in {1} documentation.  It can only be used in the following types of documentation: {2}.
+doclet.javafx_tag_misuse=Tags @propertyGetter, @propertySetter and @propertyDescription can only be used in JavaFX properties getters and setters.
 doclet.Package_Summary=Package Summary
+doclet.Profile_Summary=Profile Summary
 doclet.Interface_Summary=Interface Summary
 doclet.Annotation_Types_Summary=Annotation Types Summary
 doclet.Enum_Summary=Enum Summary
@@ -69,6 +80,7 @@
 doclet.Annotation_Type_Optional_Member_Summary=Optional Element Summary
 doclet.Annotation_Type_Required_Member_Summary=Required Element Summary
 doclet.Field_Summary=Field Summary
+doclet.Property_Summary=Property Summary
 doclet.Enum_Constant_Summary=Enum Constant Summary
 doclet.Constructor_Summary=Constructor Summary
 doclet.Method_Summary=Method Summary
@@ -80,6 +92,7 @@
 doclet.Classes=Classes
 doclet.Packages=Packages
 doclet.packages=packages
+doclet.profiles=profiles
 doclet.All_Classes=All Classes
 doclet.All_Superinterfaces=All Superinterfaces:
 doclet.All_Implemented_Interfaces=All Implemented Interfaces:
@@ -110,10 +123,13 @@
 doclet.Methods_Inherited_From_Interface=Methods inherited from interface
 doclet.Fields_Inherited_From_Class=Fields inherited from class
 doclet.Fields_Inherited_From_Interface=Fields inherited from interface
+doclet.Properties_Inherited_From_Class=Properties inherited from class
+doclet.Properties_Inherited_From_Interface=Properties inherited from interface
 doclet.Annotation_Type_Member_Detail=Element Detail
 doclet.Enum_Constant_Detail=Enum Constant Detail
 doclet.Constants_Summary=Constant Field Values
 doclet.Field_Detail=Field Detail
+doclet.Property_Detail=Property Detail
 doclet.Method_Detail=Method Detail
 doclet.Constructor_Detail=Constructor Detail
 doclet.Deprecated=Deprecated.
@@ -127,6 +143,8 @@
 doclet.Member_Table_Summary={0} table, listing {1}, and an explanation
 doclet.fields=fields
 doclet.Fields=Fields
+doclet.properties=properties
+doclet.Properties=Properties
 doclet.constructors=constructors
 doclet.Constructors=Constructors
 doclet.methods=methods
@@ -144,6 +162,7 @@
 doclet.Modifier=Modifier
 doclet.Type=Type
 doclet.Field=Field
+doclet.Property=Property
 doclet.Constructor=Constructor
 doclet.Method=Method
 doclet.Annotation_Type_Optional_Member=Optional Element
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_ja.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -11,6 +11,8 @@
 doclet.Class_0_extends_implements_serializable=Class {0} extends {1} implements Serializable
 doclet.Option_conflict=\u30AA\u30D7\u30B7\u30E7\u30F3{0}\u304C{1}\u3068\u77DB\u76FE\u3057\u307E\u3059
 doclet.Option_reuse=\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u518D\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0}
+doclet.Option_doclint_no_qualifiers=\u30A2\u30AF\u30BB\u30B9\u4FEE\u98FE\u5B50\u306F-Xdoclint\u306E\u5F15\u6570\u306B\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
+doclet.Option_doclint_invalid_arg=-Xdoclint\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059
 doclet.exception_encountered= {0}\u3092\u691C\u51FA\n\t\u30D5\u30A1\u30A4\u30EB\u306E\u4F5C\u6210\u4E2D: {1}
 doclet.perform_copy_exception_encountered= \u30B3\u30D4\u30FC\u5B9F\u884C\u4E2D\u306B{0}\u3092\n\u691C\u51FA\u3057\u307E\u3057\u305F\u3002
 doclet.File_not_found=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
@@ -19,10 +21,8 @@
 doclet.Copying_File_0_To_File_1=\u30D5\u30A1\u30A4\u30EB{0}\u3092\u30D5\u30A1\u30A4\u30EB{1}\u306B\u30B3\u30D4\u30FC\u4E2D...
 doclet.No_Public_Classes_To_Document=\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u5316\u3059\u308Bpublic\u307E\u305F\u306Fprotected\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
 doclet.Unable_to_create_directory_0=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA{0}\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093
-doclet.destination_directory_not_found_0=\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
 doclet.destination_directory_not_directory_0=\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA{0}\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3067\u306F\u3042\u308A\u307E\u305B\u3093
 doclet.destination_directory_not_writable_0=\u8EE2\u9001\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA{0}\u306F\u66F8\u8FBC\u307F\u53EF\u80FD\u3067\u306F\u3042\u308A\u307E\u305B\u3093
-doclet.Error_creating_tmp_file=\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u4F7F\u7528\u3057\u3066\u4E00\u6642\u30D5\u30A1\u30A4\u30EB\u3092\u4F5C\u6210\u3057\u3066\u3044\u308B\u3068\u304D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002
 doclet.Encoding_not_supported=\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0{0}\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
 doclet.Building_Tree=\u5168\u30D1\u30C3\u30B1\u30FC\u30B8\u3068\u30AF\u30E9\u30B9\u306E\u968E\u5C64\u30C4\u30EA\u30FC\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
 doclet.Building_Index=\u5168\u30D1\u30C3\u30B1\u30FC\u30B8\u3068\u30AF\u30E9\u30B9\u306E\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u4F5C\u6210\u3057\u3066\u3044\u307E\u3059...
@@ -72,7 +72,6 @@
 doclet.Enum_Constant_Summary=\u5217\u6319\u578B\u5B9A\u6570\u306E\u6982\u8981
 doclet.Constructor_Summary=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u6982\u8981
 doclet.Method_Summary=\u30E1\u30BD\u30C3\u30C9\u306E\u6982\u8981
-doclet.Factory_Method_Summary=static\u30D5\u30A1\u30AF\u30C8\u30EA\u30FB\u30E1\u30BD\u30C3\u30C9\u306E\u6982\u8981
 doclet.Interfaces=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
 doclet.Enums=\u5217\u6319\u578B
 doclet.AnnotationTypes=\u6CE8\u91C8\u578B
@@ -86,15 +85,14 @@
 doclet.All_Implemented_Interfaces=\u3059\u3079\u3066\u306E\u5B9F\u88C5\u3055\u308C\u305F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9:
 doclet.All_classes_and_interfaces=\u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9(\u975Estatic\u306E\u30CD\u30B9\u30C8\u3055\u308C\u305F\u578B\u3092\u9664\u304F)
 doclet.Package_class_and_interface_descriptions=\u30D1\u30C3\u30B1\u30FC\u30B8\u3001\u30AF\u30E9\u30B9\u304A\u3088\u3073\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306E\u8AAC\u660E
-doclet.Members=\u30E1\u30F3\u30D0\u30FC
 doclet.Interface=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
 doclet.Class=\u30AF\u30E9\u30B9
 doclet.AnnotationType=\u6CE8\u91C8\u578B
 doclet.annotationtype=\u6CE8\u91C8\u578B
 doclet.annotationtypes=\u6CE8\u91C8\u578B
 doclet.Enum=\u5217\u6319\u578B
-doclet.enum=\u5217\u6319
-doclet.enums=\u5217\u6319
+doclet.enum=\u5217\u6319\u578B
+doclet.enums=\u5217\u6319\u578B
 doclet.interface=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
 doclet.interfaces=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
 doclet.class=\u30AF\u30E9\u30B9
@@ -105,26 +103,20 @@
 doclet.Exception=\u4F8B\u5916
 doclet.exception=\u4F8B\u5916
 doclet.exceptions=\u4F8B\u5916
-doclet.extended_by=\u4E0A\u4F4D\u3092\u62E1\u5F35
-doclet.extends=extends
 doclet.Package_private=(package private)
-doclet.implements=implementsdoclet.Same_package_name_used=\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u5F62\u5F0F\u304C2\u56DE\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0}
 doclet.Nested_Classes_Interfaces_Inherited_From_Class=\u30AF\u30E9\u30B9\u304B\u3089\u7D99\u627F\u3055\u308C\u305F\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30AF\u30E9\u30B9/\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
 doclet.Nested_Classes_Interface_Inherited_From_Interface=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u304B\u3089\u7D99\u627F\u3055\u308C\u305F\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30AF\u30E9\u30B9/\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
 doclet.Methods_Inherited_From_Class=\u30AF\u30E9\u30B9\u304B\u3089\u7D99\u627F\u3055\u308C\u305F\u30E1\u30BD\u30C3\u30C9
 doclet.Methods_Inherited_From_Interface=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u304B\u3089\u7D99\u627F\u3055\u308C\u305F\u30E1\u30BD\u30C3\u30C9
 doclet.Fields_Inherited_From_Class=\u30AF\u30E9\u30B9\u304B\u3089\u7D99\u627F\u3055\u308C\u305F\u30D5\u30A3\u30FC\u30EB\u30C9
 doclet.Fields_Inherited_From_Interface=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u304B\u3089\u7D99\u627F\u3055\u308C\u305F\u30D5\u30A3\u30FC\u30EB\u30C9
-doclet.Serializable=\u76F4\u5217\u5316\u53EF\u80FD
-doclet.Externalizable=\u5916\u90E8\u5316\u53EF\u80FD
 doclet.Annotation_Type_Member_Detail=\u8981\u7D20\u306E\u8A73\u7D30
 doclet.Enum_Constant_Detail=\u5217\u6319\u578B\u5B9A\u6570\u306E\u8A73\u7D30
 doclet.Constants_Summary=\u5B9A\u6570\u30D5\u30A3\u30FC\u30EB\u30C9\u5024
 doclet.Field_Detail=\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u8A73\u7D30
 doclet.Method_Detail=\u30E1\u30BD\u30C3\u30C9\u306E\u8A73\u7D30
 doclet.Constructor_Detail=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u8A73\u7D30
-doclet.Deprecated=\u63A8\u5968\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
-doclet.Deprecated_class=\u3053\u306E\u30AF\u30E9\u30B9\u306F\u63A8\u5968\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+doclet.Deprecated=\u975E\u63A8\u5968\u3067\u3059\u3002
 doclet.Groupname_already_used=-group\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u304A\u3044\u3066\u3001\u3059\u3067\u306B\u30B0\u30EB\u30FC\u30D7\u540D\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059: {0}
 doclet.value_tag_invalid_reference={0}(@value\u30BF\u30B0\u306B\u3088\u308A\u53C2\u7167\u3055\u308C\u3066\u3044\u308B)\u306F\u4E0D\u660E\u306A\u53C2\u7167\u3067\u3059\u3002
 doclet.value_tag_invalid_constant=@value\u30BF\u30B0({0}\u3092\u53C2\u7167\u3057\u3066\u3044\u308B)\u306F\u5B9A\u6570\u5185\u3067\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059\u3002
@@ -144,7 +136,7 @@
 doclet.annotation_type_required_members=\u5FC5\u9808\u8981\u7D20
 doclet.Annotation_Type_Required_Members=\u5FC5\u9808\u8981\u7D20
 doclet.enum_constants=\u5217\u6319\u578B\u5B9A\u6570
-doclet.Enum_Constants=\u5217\u6319\u5B9A\u6570
+doclet.Enum_Constants=\u5217\u6319\u578B\u5B9A\u6570
 doclet.nested_classes=\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30AF\u30E9\u30B9
 doclet.Nested_Classes=\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30AF\u30E9\u30B9
 doclet.subclasses=\u30B5\u30D6\u30AF\u30E9\u30B9
@@ -167,4 +159,4 @@
 #Documentation for Enums
 doclet.enum_values_doc=\n\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u542B\u3080\u914D\u5217\u3092\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\u8FD4\u3057\u307E\u3059\u3002\n\u3053\u306E\u30E1\u30BD\u30C3\u30C9\u306F\u6B21\u306E\u3088\u3046\u306B\u3057\u3066\u5B9A\u6570\u3092\u53CD\u5FA9\u3059\u308B\u305F\u3081\u306B\n\u4F7F\u7528\u3067\u304D\u307E\u3059:\n<pre>\nfor({0} c: {0}.values())\n&nbsp; System.out.println(c);\n</pre>\n@return\u3053\u306E\u5217\u6319\u578B\u306E\u5B9A\u6570\u3092\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B\u9806\u5E8F\u3067\n\u542B\u3080\u914D\u5217
 
-doclet.enum_valueof_doc=\n\u6307\u5B9A\u3057\u305F\u540D\u524D\u3092\u6301\u3064\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u8FD4\u3057\u307E\u3059\u3002\n\u6587\u5B57\u5217\u306F\u3001\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u5BA3\u8A00\u3059\u308B\u306E\u306B\u4F7F\u7528\u3057\u305F\u8B58\u5225\u5B50\u3068\u53B3\u5BC6\u306B\n\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n(\u4F59\u5206\u306A\u7A7A\u767D\u6587\u5B57\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002)\n\n@param name\u8FD4\u3055\u308C\u308B\u5217\u6319\u578B\u5B9A\u6570\u306E\u540D\u524D\n@return\u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u3092\u6301\u3064\u5217\u6319\u578B\u5B9A\u6570\n@throws IllegalArgumentException\u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u3092\u6301\u3064\u5B9A\u6570\u3092\n\u3053\u306E\u5217\u6319\u578B\u304C\u6301\u3063\u3066\u3044\u306A\u3044\u5834\u5408\n@throws NullPointerException\u5F15\u6570\u304Cnull\u306E\u5834\u5408
+doclet.enum_valueof_doc=\n\u6307\u5B9A\u3057\u305F\u540D\u524D\u3092\u6301\u3064\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u8FD4\u3057\u307E\u3059\u3002\n\u6587\u5B57\u5217\u306F\u3001\u3053\u306E\u578B\u306E\u5217\u6319\u578B\u5B9A\u6570\u3092\u5BA3\u8A00\u3059\u308B\u306E\u306B\u4F7F\u7528\u3057\u305F\u8B58\u5225\u5B50\u3068<i>\u6B63\u78BA\u306B</i>\n\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n(\u4F59\u5206\u306A\u7A7A\u767D\u6587\u5B57\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002)\n\n@param name\u8FD4\u3055\u308C\u308B\u5217\u6319\u578B\u5B9A\u6570\u306E\u540D\u524D\n@return\u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u3092\u6301\u3064\u5217\u6319\u578B\u5B9A\u6570\n@throws IllegalArgumentException\u6307\u5B9A\u3055\u308C\u305F\u540D\u524D\u3092\u6301\u3064\u5B9A\u6570\u3092\n\u3053\u306E\u5217\u6319\u578B\u304C\u6301\u3063\u3066\u3044\u306A\u3044\u5834\u5408\n@throws NullPointerException\u5F15\u6570\u304Cnull\u306E\u5834\u5408
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets_zh_CN.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -11,6 +11,8 @@
 doclet.Class_0_extends_implements_serializable=\u7C7B{0}\u6269\u5C55{1}\u5B9E\u73B0\u53EF\u5E8F\u5217\u5316
 doclet.Option_conflict=\u9009\u9879{0}\u4E0E{1}\u51B2\u7A81
 doclet.Option_reuse=\u91CD\u590D\u4F7F\u7528\u7684\u9009\u9879: {0}
+doclet.Option_doclint_no_qualifiers=-Xdoclint \u53C2\u6570\u4E0D\u5141\u8BB8\u4F7F\u7528\u8BBF\u95EE\u9650\u5B9A\u7B26
+doclet.Option_doclint_invalid_arg=-Xdoclint \u9009\u9879\u7684\u53C2\u6570\u65E0\u6548
 doclet.exception_encountered= \u5C1D\u8BD5\u521B\u5EFA\u6587\u4EF6{1}\u65F6 \n\t\u9047\u5230{0}
 doclet.perform_copy_exception_encountered= \u6267\u884C\u590D\u5236\u65F6 \n\u9047\u5230{0}\u3002
 doclet.File_not_found=\u627E\u4E0D\u5230\u6587\u4EF6: {0}
@@ -19,10 +21,8 @@
 doclet.Copying_File_0_To_File_1=\u6B63\u5728\u5C06\u6587\u4EF6{0}\u590D\u5236\u5230\u6587\u4EF6{1}...
 doclet.No_Public_Classes_To_Document=\u627E\u4E0D\u5230\u53EF\u4EE5\u6587\u6863\u5316\u7684\u516C\u5171\u6216\u53D7\u4FDD\u62A4\u7684\u7C7B\u3002
 doclet.Unable_to_create_directory_0=\u65E0\u6CD5\u521B\u5EFA\u76EE\u5F55 {0}
-doclet.destination_directory_not_found_0=\u627E\u4E0D\u5230\u76EE\u6807\u76EE\u5F55 {0}
 doclet.destination_directory_not_directory_0=\u76EE\u6807\u76EE\u5F55\u4E0D\u662F\u76EE\u5F55 {0}
 doclet.destination_directory_not_writable_0=\u76EE\u6807\u76EE\u5F55\u4E0D\u53EF\u5199\u5165 {0}
-doclet.Error_creating_tmp_file=\u4F7F\u7528\u9ED8\u8BA4\u5E73\u53F0\u7F16\u7801\u521B\u5EFA\u4E34\u65F6\u6587\u4EF6\u65F6\u51FA\u9519\u3002
 doclet.Encoding_not_supported=\u4E0D\u652F\u6301\u7F16\u7801: {0}
 doclet.Building_Tree=\u6B63\u5728\u6784\u5EFA\u6240\u6709\u7A0B\u5E8F\u5305\u548C\u7C7B\u7684\u6811...
 doclet.Building_Index=\u6B63\u5728\u6784\u5EFA\u6240\u6709\u7A0B\u5E8F\u5305\u548C\u7C7B\u7684\u7D22\u5F15...
@@ -72,7 +72,6 @@
 doclet.Enum_Constant_Summary=\u679A\u4E3E\u5E38\u91CF\u6982\u8981
 doclet.Constructor_Summary=\u6784\u9020\u5668\u6982\u8981
 doclet.Method_Summary=\u65B9\u6CD5\u6982\u8981
-doclet.Factory_Method_Summary=\u9759\u6001\u5DE5\u5382\u65B9\u6CD5\u6982\u8981
 doclet.Interfaces=\u63A5\u53E3
 doclet.Enums=\u679A\u4E3E
 doclet.AnnotationTypes=\u6CE8\u91CA\u7C7B\u578B
@@ -86,7 +85,6 @@
 doclet.All_Implemented_Interfaces=\u6240\u6709\u5DF2\u5B9E\u73B0\u7684\u63A5\u53E3:
 doclet.All_classes_and_interfaces=\u6240\u6709\u7C7B\u548C\u63A5\u53E3 (\u9664\u4E86\u975E\u9759\u6001\u5D4C\u5957\u7C7B\u578B)
 doclet.Package_class_and_interface_descriptions=\u7A0B\u5E8F\u5305, \u7C7B\u548C\u63A5\u53E3\u8BF4\u660E
-doclet.Members=\u6210\u5458
 doclet.Interface=\u63A5\u53E3
 doclet.Class=\u7C7B
 doclet.AnnotationType=\u6CE8\u91CA\u7C7B\u578B
@@ -105,18 +103,13 @@
 doclet.Exception=\u5F02\u5E38\u9519\u8BEF
 doclet.exception=\u5F02\u5E38\u9519\u8BEF
 doclet.exceptions=\u5F02\u5E38\u9519\u8BEF
-doclet.extended_by=\u6269\u5C55\u8005
-doclet.extends=\u6269\u5C55
 doclet.Package_private=(\u4E13\u7528\u7A0B\u5E8F\u5305)
-doclet.implements=implementsdoclet.Same_package_name_used=\u7A0B\u5E8F\u5305\u540D\u79F0\u5F62\u5F0F\u4F7F\u7528\u4E86\u4E24\u6B21: {0}
 doclet.Nested_Classes_Interfaces_Inherited_From_Class=\u4ECE\u7C7B\u7EE7\u627F\u7684\u5D4C\u5957\u7C7B/\u63A5\u53E3
 doclet.Nested_Classes_Interface_Inherited_From_Interface=\u4ECE\u63A5\u53E3\u7EE7\u627F\u7684\u5D4C\u5957\u7C7B/\u63A5\u53E3
 doclet.Methods_Inherited_From_Class=\u4ECE\u7C7B\u7EE7\u627F\u7684\u65B9\u6CD5
 doclet.Methods_Inherited_From_Interface=\u4ECE\u63A5\u53E3\u7EE7\u627F\u7684\u65B9\u6CD5
 doclet.Fields_Inherited_From_Class=\u4ECE\u7C7B\u7EE7\u627F\u7684\u5B57\u6BB5
 doclet.Fields_Inherited_From_Interface=\u4ECE\u63A5\u53E3\u7EE7\u627F\u7684\u5B57\u6BB5
-doclet.Serializable=\u53EF\u5E8F\u5217\u5316
-doclet.Externalizable=\u53EF\u5916\u90E8\u5316
 doclet.Annotation_Type_Member_Detail=\u5143\u7D20\u8BE6\u7EC6\u8D44\u6599
 doclet.Enum_Constant_Detail=\u679A\u4E3E\u5E38\u91CF\u8BE6\u7EC6\u8D44\u6599
 doclet.Constants_Summary=\u5E38\u91CF\u5B57\u6BB5\u503C
@@ -124,7 +117,6 @@
 doclet.Method_Detail=\u65B9\u6CD5\u8BE6\u7EC6\u8D44\u6599
 doclet.Constructor_Detail=\u6784\u9020\u5668\u8BE6\u7EC6\u8D44\u6599
 doclet.Deprecated=\u5DF2\u8FC7\u65F6\u3002
-doclet.Deprecated_class=\u8BE5\u7C7B\u5DF2\u8FC7\u65F6\u3002
 doclet.Groupname_already_used=\u5728 -group \u9009\u9879\u4E2D, groupname \u5DF2\u4F7F\u7528: {0}
 doclet.value_tag_invalid_reference={0} (\u7531 @value \u6807\u8BB0\u5F15\u7528) \u4E3A\u672A\u77E5\u5F15\u7528\u3002
 doclet.value_tag_invalid_constant=@value \u6807\u8BB0 (\u5F15\u7528{0}) \u53EA\u80FD\u5728\u5E38\u91CF\u4E2D\u4F7F\u7528\u3002
@@ -167,4 +159,4 @@
 #Documentation for Enums
 doclet.enum_values_doc=\n\u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F, \u8FD4\u56DE\n\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4\u3002\u8BE5\u65B9\u6CD5\u53EF\u7528\u4E8E\u8FED\u4EE3\n\u5E38\u91CF, \u5982\u4E0B\u6240\u793A:\n<pre>\nfor ({0} c : {0}.values())\n&nbsp;   System.out.println(c);\n</pre>\n@\u6309\u7167\u58F0\u660E\u8BE5\u679A\u4E3E\u7C7B\u578B\u7684\u5E38\u91CF\u7684\u987A\u5E8F, \u8FD4\u56DE\n\u5305\u542B\u8FD9\u4E9B\u5E38\u91CF\u7684\u6570\u7EC4
 
-doclet.enum_valueof_doc=\n\u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u3002\n\u5B57\u7B26\u4E32\u5FC5\u987B\u4E0E\u7528\u4E8E\u58F0\u660E\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u7684\n\u6807\u8BC6\u7B26<i>\u5B8C\u5168</i>\u5339\u914D\u3002(\u4E0D\u5141\u8BB8\u6709\u591A\u4F59\n\u7684\u7A7A\u683C\u5B57\u7B26\u3002)\n\n@param name \u8981\u8FD4\u56DE\u7684\u679A\u4E3E\u5E38\u91CF\u7684\u540D\u79F0\u3002\n@return \u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u679A\u4E3E\u5E38\u91CF\n@throws \u5982\u679C\u8BE5\u679A\u4E3E\u7C7B\u578B\u6CA1\u6709\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u5E38\u91CF, \n\u5219\u629B\u51FA IllegalArgumentException\n@throws \u5982\u679C\u53C2\u6570\u4E3A\u7A7A\u503C, \u5219\u629B\u51FA NullPointerException
+doclet.enum_valueof_doc=\n\u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u3002\n\u5B57\u7B26\u4E32\u5FC5\u987B\u4E0E\u7528\u4E8E\u58F0\u660E\u8BE5\u7C7B\u578B\u7684\u679A\u4E3E\u5E38\u91CF\u7684\n\u6807\u8BC6\u7B26<i>\u5B8C\u5168</i>\u5339\u914D\u3002(\u4E0D\u5141\u8BB8\u6709\u591A\u4F59\n\u7684\u7A7A\u683C\u5B57\u7B26\u3002)\n\n@param name \u8981\u8FD4\u56DE\u7684\u679A\u4E3E\u5E38\u91CF\u7684\u540D\u79F0\u3002\n@\u8FD4\u56DE\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u679A\u4E3E\u5E38\u91CF\n@\u5982\u679C\u8BE5\u679A\u4E3E\u7C7B\u578B\u6CA1\u6709\u5E26\u6709\u6307\u5B9A\u540D\u79F0\u7684\u5E38\u91CF, \n\u5219\u629B\u51FA IllegalArgumentException\n@\u5982\u679C\u53C2\u6570\u4E3A\u7A7A\u503C, \u5219\u629B\u51FA NullPointerException
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Tue Jul 02 10:13:00 2013 +0100
@@ -191,6 +191,9 @@
     margin:10px;
     position:relative;
 }
+.indexHeader span{
+    margin-right:15px;
+}
 .indexHeader h1 {
     font-size:1.3em;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/BasePropertyTaglet.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2001, 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.internal.toolkit.taglets;
+
+import com.sun.javadoc.Tag;
+
+/**
+ * An abstract class that implements the {@link Taglet} interface and
+ * serves as a base for JavaFX property getter and setter taglets.
+ *
+ *  <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>
+ *
+ */
+public abstract class BasePropertyTaglet extends BaseTaglet {
+
+    public BasePropertyTaglet() {
+    }
+
+    /**
+     * This method returns the text to be put in the resulting javadoc before
+     * the property name.
+     *
+     * @param tagletWriter the taglet writer for output
+     * @return the string to be put in the resulting javadoc.
+     */
+    abstract String getText(TagletWriter tagletWriter);
+
+    /**
+     * Given the <code>Tag</code> representation of this custom
+     * tag, return its string representation, which is output
+     * to the generated page.
+     * @param tag the <code>Tag</code> representation of this custom tag.
+     * @param tagletWriter the taglet writer for output.
+     * @return the TagletOutput representation of this <code>Tag</code>.
+     */
+    public TagletOutput getTagletOutput(Tag tag, TagletWriter tagletWriter) {
+        TagletOutput tagletOutput = tagletWriter.getOutputInstance();
+        StringBuilder output = new StringBuilder("<P>");
+        output.append(getText(tagletWriter));
+        output.append(" <CODE>");
+        output.append(tag.text());
+        output.append("</CODE>.</P>");
+        tagletOutput.setOutput(output.toString());
+        return tagletOutput;
+    }
+
+    /**
+     * Will return false because this tag may
+     * only appear in Methods.
+     * @return false since this is not a method.
+     */
+    public boolean inConstructor() {
+        return false;
+    }
+
+    /**
+     * Will return false because this tag may
+     * only appear in Methods.
+     * @return false since this is not a method.
+     */
+    public boolean inOverview() {
+        return false;
+    }
+
+    /**
+     * Will return false because this tag may
+     * only appear in Methods.
+     * @return false since this is not a method.
+     */
+    public boolean inPackage() {
+        return false;
+    }
+
+    /**
+     * Will return false because this tag may
+     * only appear in Methods.
+     * @return false since this is not a method.
+     */
+    public boolean inType() {
+        return false;
+    }
+
+    /**
+     * Will return false because this tag is not inline.
+     * @return false since this is not an inline tag.
+     */
+    public boolean isInlineTag() {
+        return false;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ExpertTaglet.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.doclets.internal.toolkit.taglets;
+
+import java.util.Map;
+
+import com.sun.tools.doclets.Taglet;
+import com.sun.javadoc.Tag;
+
+/**
+ * An inline Taglet used to denote information for experts.
+ *
+ *  <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>
+ *
+ */
+public class ExpertTaglet implements Taglet {
+
+    private static final String NAME = "expert";
+    private static final String START_TAG = "<sub id=\"expert\">";
+    private static final String END_TAG = "</sub>";
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean inField() {
+        return true;
+    }
+
+    public boolean inConstructor() {
+        return true;
+    }
+
+    public boolean inMethod() {
+        return true;
+    }
+
+    public boolean inOverview() {
+        return true;
+    }
+
+    public boolean inPackage() {
+        return true;
+    }
+
+    public boolean inType() {
+        return true;
+    }
+
+    public boolean isInlineTag() {
+        return false;
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    public static void register(Map<String, Taglet> map) {
+        map.remove(NAME);
+        map.put(NAME, new ExpertTaglet());
+    }
+
+    public String toString(Tag tag) {
+        return (tag.text() == null || tag.text().length() == 0) ? null :
+            START_TAG + LiteralTaglet.textToString(tag.text()) + END_TAG;
+    }
+
+
+    public String toString(Tag[] tags) {
+        if (tags == null || tags.length == 0) return null;
+
+        StringBuffer sb = new StringBuffer(START_TAG);
+
+        for(Tag t:tags) {
+            sb.append(LiteralTaglet.textToString(t.text()));
+        }
+        sb.append(END_TAG);
+        return sb.toString();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/PropertyGetterTaglet.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2001, 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.internal.toolkit.taglets;
+
+/**
+ * A taglet that adds the initial line of documentation to the JavaFX
+ * property getters.
+ *
+ *  <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>
+ */
+public class PropertyGetterTaglet extends BasePropertyTaglet {
+
+    /**
+     * Construct a new PropertyGetterTaglet.
+     */
+    public PropertyGetterTaglet () {
+        name = "propertyGetter";
+    }
+
+    @Override
+    String getText(TagletWriter tagletWriter) {
+        return tagletWriter.configuration().getText("doclet.PropertyGetter");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/PropertySetterTaglet.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2001, 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.internal.toolkit.taglets;
+
+/**
+ * A taglet that adds the initial line of documentation to the JavaFX
+ * property setters.
+ *
+ *  <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>
+ */
+public class PropertySetterTaglet extends BasePropertyTaglet {
+
+    /**
+     * Construct a new PropertyGetterTaglet.
+     */
+    public PropertySetterTaglet () {
+        name = "propertySetter";
+    }
+
+    @Override
+    String getText(TagletWriter tagletWriter) {
+        return tagletWriter.configuration().getText("doclet.PropertySetter");
+    }
+}
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -157,6 +157,13 @@
     private boolean showauthor;
 
     /**
+     * True if we want to use JavaFX-related tags (@propertyGetter,
+     * @propertySetter, @propertyDescription, @defaultValue, @treatAsPrivate,
+     * @expert).
+     */
+    private boolean javafx;
+
+    /**
      * Construct a new <code>TagletManager</code>.
      * @param nosince true if we do not want to use @since tags.
      * @param showversion true if we want to use @version tags.
@@ -164,7 +171,8 @@
      * @param message the message retriever to print warnings.
      */
     public TagletManager(boolean nosince, boolean showversion,
-                         boolean showauthor, MessageRetriever message) {
+                         boolean showauthor, boolean javafx,
+                         MessageRetriever message) {
         overridenStandardTags = new HashSet<String>();
         potentiallyConflictingTags = new HashSet<String>();
         standardTags = new HashSet<String>();
@@ -174,6 +182,7 @@
         this.nosince = nosince;
         this.showversion = showversion;
         this.showauthor = showauthor;
+        this.javafx = javafx;
         this.message = message;
         initStandardTags();
         initStandardTagsLowercase();
@@ -677,6 +686,33 @@
         standardTags.add("Text");
         standardTags.add("literal");
         standardTags.add("code");
+
+        if (javafx) {
+            initJavaFXTags();
+        }
+    }
+
+    /**
+     * Initialize JavaFX-related tags.
+     */
+    private void initJavaFXTags() {
+        Taglet temp;
+        customTags.put((temp = new PropertyGetterTaglet()).getName(), temp);
+        customTags.put((temp = new PropertySetterTaglet()).getName(), temp);
+        customTags.put((temp = new SimpleTaglet("propertyDescription", message.getText("doclet.PropertyDescription"),
+            SimpleTaglet.FIELD + SimpleTaglet.METHOD)).getName(), temp);
+        customTags.put((temp = new SimpleTaglet("defaultValue", message.getText("doclet.DefaultValue"),
+            SimpleTaglet.FIELD + SimpleTaglet.METHOD)).getName(), temp);
+        customTags.put((temp = new SimpleTaglet("treatAsPrivate", null,
+                SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE)).getName(), temp);
+        customTags.put((temp = new LegacyTaglet(new ExpertTaglet())).getName(), temp);
+
+        standardTags.add("propertyGetter");
+        standardTags.add("propertySetter");
+        standardTags.add("propertyDescription");
+        standardTags.add("defaultValue");
+        standardTags.add("treatAsPrivate");
+        standardTags.add("expert");
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -180,6 +180,7 @@
         tagletManager.checkTags(doc, doc.inlineTags(), true);
         TagletOutput currentOutput = null;
         for (int i = 0; i < taglets.length; i++) {
+            currentOutput = null;
             if (doc instanceof ClassDoc && taglets[i] instanceof ParamTaglet) {
                 //The type parameters are documented in a special section away
                 //from the tag info, so skip here.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -132,6 +132,12 @@
                     Util.isDeprecated(classes[i].containingPackage()))) {
                 continue;
             }
+
+            if (configuration.javafx
+                    && classes[i].tags("treatAsPrivate").length > 0) {
+                continue;
+            }
+
             if (classes[i].isEnum()) {
                 processType(classes[i], configuration, baseEnums, subEnums);
             } else if (classes[i].isClass()) {
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocPaths.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -87,6 +87,26 @@
     /** The name of the file for the package frame. */
     public static final DocPath PACKAGE_FRAME = DocPath.create("package-frame.html");
 
+    /** The name of the file for the profile frame. */
+     public static final DocPath profileFrame(String profileName) {
+        return DocPath.create(profileName + "-frame.html");
+    }
+
+    /** The name of the file for the profile package frame. */
+     public static final DocPath profilePackageFrame(String profileName) {
+        return DocPath.create(profileName + "-package-frame.html");
+    }
+
+    /** The name of the file for the profile package summary. */
+     public static final DocPath profilePackageSummary(String profileName) {
+        return DocPath.create(profileName + "-package-summary.html");
+    }
+
+    /** The name of the file for the profile summary. */
+     public static final DocPath profileSummary(String profileName) {
+        return DocPath.create(profileName + "-summary.html");
+    }
+
     /** The name of the file for the package list. */
     public static final DocPath PACKAGE_LIST = DocPath.create("package-list");
 
@@ -99,6 +119,9 @@
     /** The name of the file for the package usage info. */
     public static final DocPath PACKAGE_USE = DocPath.create("package-use.html");
 
+    /** The name of the file for the overview frame. */
+    public static final DocPath PROFILE_OVERVIEW_FRAME = DocPath.create("profile-overview-frame.html");
+
     /** The name of the directory in which resources are generated.
      *  Also the name of the sub-package from which resources are read.
      */
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -63,6 +63,11 @@
      */
     private boolean classesOnly;
 
+    /**
+     * Indicates javafx mode.
+     */
+    private boolean javafx;
+
     // make ProgramElementDoc[] when new toArray is available
     protected final Object[] elements;
 
@@ -115,6 +120,7 @@
         }
         this.noDeprecated = noDeprecated;
         this.classesOnly = classesOnly;
+        this.javafx = configuration.javafx;
         buildIndexMap(configuration.root);
         Set<Character> set = indexmap.keySet();
         elements =  set.toArray();
@@ -209,6 +215,12 @@
      * Should this doc element be added to the index map?
      */
     protected boolean shouldAddToIndexMap(Doc element) {
+        if (javafx) {
+            if (element.tags("treatAsPrivate").length > 0) {
+                return false;
+            }
+        }
+
         if (element instanceof PackageDoc)
             // Do not add to index map if -nodeprecated option is set and the
             // package is marked as deprecated.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -60,9 +60,9 @@
     private ResourceBundle messageRB;
 
     /**
-     * Initilize the ResourceBundle with the given resource.
+     * Initialize the ResourceBundle with the given resource.
      *
-     * @param rb the esource bundle to read.
+     * @param rb the resource bundle to read.
      */
     public MessageRetriever(ResourceBundle rb) {
         this.configuration = null;
@@ -71,7 +71,7 @@
     }
 
     /**
-     * Initilize the ResourceBundle with the given resource.
+     * Initialize the ResourceBundle with the given resource.
      *
      * @param configuration the configuration
      * @param resourcelocation Resource.
@@ -189,7 +189,8 @@
      * @param args arguments to be replaced in the message.
      */
     public void warning(SourcePosition pos, String key, Object... args) {
-        printWarning(pos, getText(key, args));
+        if (configuration.showMessage(pos, key))
+            printWarning(pos, getText(key, args));
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 
 /**
@@ -105,6 +106,20 @@
     }
 
     /**
+     * Get the profile keywords.
+     *
+     * @param profile the profile being documented
+     */
+    public String[] getMetaKeywords(Profile profile) {
+        if( configuration.keywords ) {
+            String profileName = profile.name;
+            return new String[] { profileName + " " + "profile" };
+        } else {
+            return new String[] {};
+        }
+    }
+
+    /**
      * Get the overview keywords.
      */
     public String[] getOverviewMetaKeywords(String title, String docTitle) {
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,9 +26,11 @@
 package com.sun.tools.doclets.internal.toolkit.util;
 
 import java.io.*;
+import java.lang.annotation.ElementType;
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.javadoc.AnnotationDesc.ElementValuePair;
 import com.sun.tools.doclets.internal.toolkit.*;
 import javax.tools.StandardLocation;
 
@@ -304,9 +306,7 @@
         //Try walking the tree.
         addAllInterfaceTypes(results,
             superType,
-            superType instanceof ClassDoc ?
-                ((ClassDoc) superType).interfaceTypes() :
-                ((ParameterizedType) superType).interfaceTypes(),
+            interfaceTypesOf(superType),
             false, configuration);
         List<Type> resultsList = new ArrayList<Type>(results.values());
         if (sort) {
@@ -315,6 +315,14 @@
         return resultsList;
     }
 
+    private static Type[] interfaceTypesOf(Type type) {
+        if (type instanceof AnnotatedType)
+            type = ((AnnotatedType)type).underlyingType();
+        return type instanceof ClassDoc ?
+                ((ClassDoc)type).interfaceTypes() :
+                ((ParameterizedType)type).interfaceTypes();
+    }
+
     public static List<Type> getAllInterfaces(Type type, Configuration configuration) {
         return getAllInterfaces(type, configuration, true);
     }
@@ -325,9 +333,7 @@
         if (superType == null)
             return;
         addAllInterfaceTypes(results, superType,
-                superType instanceof ClassDoc ?
-                ((ClassDoc) superType).interfaceTypes() :
-                ((ParameterizedType) superType).interfaceTypes(),
+                interfaceTypesOf(superType),
                 raw, configuration);
     }
 
@@ -337,9 +343,7 @@
         if (superType == null)
             return;
         addAllInterfaceTypes(results, superType,
-                superType instanceof ClassDoc ?
-                ((ClassDoc) superType).interfaceTypes() :
-                ((ParameterizedType) superType).interfaceTypes(),
+                interfaceTypesOf(superType),
                 false, configuration);
     }
 
@@ -363,6 +367,9 @@
                 results.put(superInterface.asClassDoc(), superInterface);
             }
         }
+        if (type instanceof AnnotatedType)
+            type = ((AnnotatedType)type).underlyingType();
+
         if (type instanceof ParameterizedType)
             findAllInterfaceTypes(results, (ParameterizedType) type, configuration);
         else if (((ClassDoc) type).typeParameters().length == 0)
@@ -494,6 +501,57 @@
         return false;
     }
 
+    private static boolean isDeclarationTarget(AnnotationDesc targetAnno) {
+        // The error recovery steps here are analogous to TypeAnnotations
+        ElementValuePair[] elems = targetAnno.elementValues();
+        if (elems == null
+            || elems.length != 1
+            || !"value".equals(elems[0].element().name())
+            || !(elems[0].value().value() instanceof AnnotationValue[]))
+            return true;    // error recovery
+
+        AnnotationValue[] values = (AnnotationValue[])elems[0].value().value();
+        for (int i = 0; i < values.length; i++) {
+            Object value = values[i].value();
+            if (!(value instanceof FieldDoc))
+                return true; // error recovery
+
+            FieldDoc eValue = (FieldDoc)value;
+            if (Util.isJava5DeclarationElementType(eValue)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Returns true if the {@code annotationDoc} is to be treated
+     * as a declaration annotation, when targeting the
+     * {@code elemType} element type.
+     *
+     * @param annotationDoc the annotationDoc to check
+     * @param elemType  the targeted elemType
+     * @return true if annotationDoc is a declaration annotation
+     */
+    public static boolean isDeclarationAnnotation(AnnotationTypeDoc annotationDoc,
+            boolean isJava5DeclarationLocation) {
+        if (!isJava5DeclarationLocation)
+            return false;
+        AnnotationDesc[] annotationDescList = annotationDoc.annotations();
+        // Annotations with no target are treated as declaration as well
+        if (annotationDescList.length==0)
+            return true;
+        for (int i = 0; i < annotationDescList.length; i++) {
+            if (annotationDescList[i].annotationType().qualifiedName().equals(
+                    java.lang.annotation.Target.class.getName())) {
+                if (isDeclarationTarget(annotationDescList[i]))
+                    return true;
+            }
+        }
+        return false;
+    }
+
     /**
      * Return true if this class is linkable and false if we can't link to the
      * desired class.
@@ -662,4 +720,75 @@
         }
         return false;
     }
+
+    /**
+     * A convenience method to get property name from the name of the
+     * getter or setter method.
+     * @param name name of the getter or setter method.
+     * @return the name of the property of the given setter of getter.
+     */
+    public static String propertyNameFromMethodName(String name) {
+        String propertyName = null;
+        if (name.startsWith("get") || name.startsWith("set")) {
+            propertyName = name.substring(3);
+        } else if (name.startsWith("is")) {
+            propertyName = name.substring(2);
+        }
+        if ((propertyName == null) || propertyName.isEmpty()){
+            return "";
+        }
+        return propertyName.substring(0, 1).toLowerCase()
+                + propertyName.substring(1);
+    }
+
+    /**
+     * In case of JavaFX mode on, filters out classes that are private,
+     * package private or having the @treatAsPrivate annotation. Those are not
+     * documented in JavaFX mode.
+     *
+     * @param classes array of classes to be filtered.
+     * @param javafx set to true if in JavaFX mode.
+     * @return list of filtered classes.
+     */
+    public static ClassDoc[] filterOutPrivateClasses(final ClassDoc[] classes,
+                                                     boolean javafx) {
+        if (!javafx) {
+            return classes;
+        }
+        final List<ClassDoc> filteredOutClasses =
+                new ArrayList<ClassDoc>(classes.length);
+        for (ClassDoc classDoc : classes) {
+            if (classDoc.isPrivate() || classDoc.isPackagePrivate()) {
+                continue;
+            }
+            Tag[] aspTags = classDoc.tags("treatAsPrivate");
+            if (aspTags != null && aspTags.length > 0) {
+                continue;
+            }
+            filteredOutClasses.add(classDoc);
+        }
+
+        return filteredOutClasses.toArray(new ClassDoc[0]);
+    }
+
+    /**
+     * Test whether the given FieldDoc is one of the declaration annotation ElementTypes
+     * defined in Java 5.
+     * Instead of testing for one of the new enum constants added in Java 8, test for
+     * the old constants. This prevents bootstrapping problems.
+     *
+     * @param elt The FieldDoc to test
+     * @return true, iff the given ElementType is one of the constants defined in Java 5
+     * @since 1.8
+     */
+    public static boolean isJava5DeclarationElementType(FieldDoc elt) {
+        return elt.name().contentEquals(ElementType.ANNOTATION_TYPE.name()) ||
+                elt.name().contentEquals(ElementType.CONSTRUCTOR.name()) ||
+                elt.name().contentEquals(ElementType.FIELD.name()) ||
+                elt.name().contentEquals(ElementType.LOCAL_VARIABLE.name()) ||
+                elt.name().contentEquals(ElementType.METHOD.name()) ||
+                elt.name().contentEquals(ElementType.PACKAGE.name()) ||
+                elt.name().contentEquals(ElementType.PARAMETER.name()) ||
+                elt.name().contentEquals(ElementType.TYPE.name());
+    }
 }
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,6 +26,7 @@
 package com.sun.tools.doclets.internal.toolkit.util;
 
 import java.util.*;
+import java.util.regex.Pattern;
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
@@ -56,11 +57,12 @@
     public static final int METHODS         = 4;
     public static final int ANNOTATION_TYPE_MEMBER_OPTIONAL = 5;
     public static final int ANNOTATION_TYPE_MEMBER_REQUIRED = 6;
+    public static final int PROPERTIES      = 7;
 
     /**
      * The total number of member types is {@value}.
      */
-    public static final int NUM_MEMBER_TYPES = 7;
+    public static final int NUM_MEMBER_TYPES = 8;
 
     public static final String STARTLEVEL = "start";
 
@@ -93,23 +95,34 @@
     private final int kind;
 
     /**
-     * Deprected members should be excluded or not?
+     * The configuration this VisibleMemberMap was created with.
      */
-    private final boolean nodepr;
+    private final Configuration configuration;
+
+    private static final Map<ClassDoc, ProgramElementDoc[]> propertiesCache =
+            new HashMap<ClassDoc, ProgramElementDoc[]>();
+    private static final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap =
+            new HashMap<ProgramElementDoc, ProgramElementDoc>();
+    private static final Map<ProgramElementDoc, GetterSetter> getterSetterMap =
+            new HashMap<ProgramElementDoc, GetterSetter>();
 
     /**
      * Construct a VisibleMemberMap of the given type for the given
-     * class.  If nodepr is true, exclude the deprecated members from
-     * the map.
+     * class.
      *
      * @param classdoc the class whose members are being mapped.
      * @param kind the kind of member that is being mapped.
-     * @param nodepr if true, exclude the deprecated members from the map.
+     * @param configuration the configuration to use to construct this
+     * VisibleMemberMap. If the field configuration.nodeprecated is true the
+     * deprecated members are excluded from the map. If the field
+     * configuration.javafx is true the JavaFX features are used.
      */
-    public VisibleMemberMap(ClassDoc classdoc, int kind, boolean nodepr) {
+    public VisibleMemberMap(ClassDoc classdoc,
+                            int kind,
+                            Configuration configuration) {
         this.classdoc = classdoc;
-        this.nodepr = nodepr;
         this.kind = kind;
+        this.configuration = configuration;
         new ClassMembers(classdoc, STARTLEVEL).build();
     }
 
@@ -124,6 +137,33 @@
     }
 
     /**
+     * Returns the property field documentation belonging to the given member.
+     * @param ped the member for which the property documentation is needed.
+     * @return the property field documentation, null if there is none.
+     */
+    public ProgramElementDoc getPropertyMemberDoc(ProgramElementDoc ped) {
+        return classPropertiesMap.get(ped);
+    }
+
+    /**
+     * Returns the getter documentation belonging to the given property method.
+     * @param propertyMethod the method for which the getter is needed.
+     * @return the getter documentation, null if there is none.
+     */
+    public ProgramElementDoc getGetterForProperty(ProgramElementDoc propertyMethod) {
+        return getterSetterMap.get(propertyMethod).getGetter();
+    }
+
+    /**
+     * Returns the setter documentation belonging to the given property method.
+     * @param propertyMethod the method for which the setter is needed.
+     * @return the setter documentation, null if there is none.
+     */
+    public ProgramElementDoc getSetterForProperty(ProgramElementDoc propertyMethod) {
+        return getterSetterMap.get(propertyMethod).getSetter();
+    }
+
+    /**
      * Return the package private members inherited by the class.  Only return
      * if parent is package private and not documented.
      *
@@ -334,8 +374,9 @@
                 ProgramElementDoc pgmelem = cdmembers.get(i);
                 if (!found(members, pgmelem) &&
                     memberIsVisible(pgmelem) &&
-                    !isOverridden(pgmelem, level)) {
-                    incllist.add(pgmelem);
+                    !isOverridden(pgmelem, level) &&
+                    !isTreatedAsPrivate(pgmelem)) {
+                        incllist.add(pgmelem);
                 }
             }
             if (incllist.size() > 0) {
@@ -345,6 +386,16 @@
             fillMemberLevelMap(getClassMembers(fromClass, false), level);
         }
 
+        private boolean isTreatedAsPrivate(ProgramElementDoc pgmelem) {
+            if (!configuration.javafx) {
+                return false;
+            }
+
+            Tag[] aspTags = pgmelem.tags("@treatAsPrivate");
+            boolean result = (aspTags != null) && (aspTags.length > 0);
+            return result;
+        }
+
         /**
          * Is given doc item visible in given classdoc in terms fo inheritance?
          * The given doc item is visible in the given classdoc if it is public
@@ -406,11 +457,16 @@
                     break;
                 case METHODS:
                     members = cd.methods(filter);
+                    checkOnPropertiesTags((MethodDoc[])members);
+                    break;
+                case PROPERTIES:
+                    members = properties(cd, filter);
                     break;
                 default:
                     members = new ProgramElementDoc[0];
             }
-            if (nodepr) {
+            // Deprected members should be excluded or not?
+            if (configuration.nodeprecated) {
                 return Util.excludeDeprecatedMembersAsList(members);
             }
             return Arrays.asList(members);
@@ -472,6 +528,206 @@
             }
             return false;
         }
+
+        private ProgramElementDoc[] properties(final ClassDoc cd, final boolean filter) {
+            final MethodDoc[] allMethods = cd.methods(filter);
+            final FieldDoc[] allFields = cd.fields(false);
+
+            if (propertiesCache.containsKey(cd)) {
+                return propertiesCache.get(cd);
+            }
+
+            final List<MethodDoc> result = new ArrayList<MethodDoc>();
+
+            for (final MethodDoc propertyMethod : allMethods) {
+
+                if (!isPropertyMethod(propertyMethod)) {
+                    continue;
+                }
+
+                final MethodDoc getter = getterForField(allMethods, propertyMethod);
+                final MethodDoc setter = setterForField(allMethods, propertyMethod);
+                final FieldDoc field = fieldForProperty(allFields, propertyMethod);
+
+                addToPropertiesMap(setter, getter, propertyMethod, field);
+                getterSetterMap.put(propertyMethod, new GetterSetter(getter, setter));
+                result.add(propertyMethod);
+            }
+            final ProgramElementDoc[] resultAray =
+                    result.toArray(new ProgramElementDoc[result.size()]);
+            propertiesCache.put(cd, resultAray);
+            return resultAray;
+        }
+
+        private void addToPropertiesMap(MethodDoc setter,
+                                        MethodDoc getter,
+                                        MethodDoc propertyMethod,
+                                        FieldDoc field) {
+            if ((field == null)
+                    || (field.getRawCommentText() == null)
+                    || field.getRawCommentText().length() == 0) {
+                addToPropertiesMap(setter, propertyMethod);
+                addToPropertiesMap(getter, propertyMethod);
+                addToPropertiesMap(propertyMethod, propertyMethod);
+            } else {
+                addToPropertiesMap(getter, field);
+                addToPropertiesMap(setter, field);
+                addToPropertiesMap(propertyMethod, field);
+            }
+        }
+
+        private void addToPropertiesMap(ProgramElementDoc propertyMethod,
+                                        ProgramElementDoc commentSource) {
+            if (null == propertyMethod || null == commentSource) {
+                return;
+            }
+            final String methodRawCommentText = propertyMethod.getRawCommentText();
+
+            /* The second condition is required for the property buckets. In
+             * this case the comment is at the property method (not at the field)
+             * and it needs to be listed in the map.
+             */
+            if ((null == methodRawCommentText || 0 == methodRawCommentText.length())
+                    || propertyMethod.equals(commentSource)) {
+                classPropertiesMap.put(propertyMethod, commentSource);
+            }
+        }
+
+        private MethodDoc getterForField(MethodDoc[] methods,
+                                         MethodDoc propertyMethod) {
+            final String propertyMethodName = propertyMethod.name();
+            final String fieldName =
+                    propertyMethodName.substring(0,
+                            propertyMethodName.lastIndexOf("Property"));
+            final String fieldNameUppercased =
+                    "" + Character.toUpperCase(fieldName.charAt(0))
+                                            + fieldName.substring(1);
+            final String getterNamePattern;
+            final String fieldTypeName = propertyMethod.returnType().toString();
+            if ("boolean".equals(fieldTypeName)
+                    || fieldTypeName.endsWith("BooleanProperty")) {
+                getterNamePattern = "(is|get)" + fieldNameUppercased;
+            } else {
+                getterNamePattern = "get" + fieldNameUppercased;
+            }
+
+            for (MethodDoc methodDoc : methods) {
+                if (Pattern.matches(getterNamePattern, methodDoc.name())) {
+                    if (0 == methodDoc.parameters().length
+                            && (methodDoc.isPublic() || methodDoc.isProtected())) {
+                        return methodDoc;
+                    }
+                }
+            }
+            return null;
+        }
+
+        private MethodDoc setterForField(MethodDoc[] methods,
+                                         MethodDoc propertyMethod) {
+            final String propertyMethodName = propertyMethod.name();
+            final String fieldName =
+                    propertyMethodName.substring(0,
+                            propertyMethodName.lastIndexOf("Property"));
+            final String fieldNameUppercased =
+                    "" + Character.toUpperCase(fieldName.charAt(0))
+                                             + fieldName.substring(1);
+            final String setter = "set" + fieldNameUppercased;
+
+            for (MethodDoc methodDoc : methods) {
+                if (setter.equals(methodDoc.name())) {
+                    if (1 == methodDoc.parameters().length
+                            && "void".equals(methodDoc.returnType().simpleTypeName())
+                            && (methodDoc.isPublic() || methodDoc.isProtected())) {
+                        return methodDoc;
+                    }
+                }
+            }
+            return null;
+        }
+
+        private FieldDoc fieldForProperty(FieldDoc[] fields, MethodDoc property) {
+
+            for (FieldDoc field : fields) {
+                final String fieldName = field.name();
+                final String propertyName = fieldName + "Property";
+                if (propertyName.equals(property.name())) {
+                    return field;
+                }
+            }
+            return null;
+        }
+
+        // properties aren't named setA* or getA*
+        private final Pattern pattern = Pattern.compile("[sg]et\\p{Upper}.*");
+        private boolean isPropertyMethod(MethodDoc method) {
+            if (!method.name().endsWith("Property")) {
+                return false;
+            }
+
+            if (! memberIsVisible(method)) {
+                return false;
+            }
+
+            if (pattern.matcher(method.name()).matches()) {
+                return false;
+            }
+
+            return 0 == method.parameters().length
+                    && !"void".equals(method.returnType().simpleTypeName());
+        }
+
+        private void checkOnPropertiesTags(MethodDoc[] members) {
+            for (MethodDoc methodDoc: members) {
+                if (methodDoc.isIncluded()) {
+                    for (Tag tag: methodDoc.tags()) {
+                        String tagName = tag.name();
+                        if (tagName.equals("@propertySetter")
+                                || tagName.equals("@propertyGetter")
+                                || tagName.equals("@propertyDescription")) {
+                            if (!isPropertyGetterOrSetter(members, methodDoc)) {
+                                configuration.message.warning(tag.position(),
+                                        "doclet.javafx_tag_misuse");
+                            }
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+
+        private boolean isPropertyGetterOrSetter(MethodDoc[] members,
+                                                 MethodDoc methodDoc) {
+            boolean found = false;
+            String propertyName = Util.propertyNameFromMethodName(methodDoc.name());
+            if (!propertyName.isEmpty()) {
+                String propertyMethodName = propertyName + "Property";
+                for (MethodDoc member: members) {
+                    if (member.name().equals(propertyMethodName)) {
+                        found = true;
+                        break;
+                    }
+                }
+            }
+            return found;
+        }
+    }
+
+    private class GetterSetter {
+        private final ProgramElementDoc getter;
+        private final ProgramElementDoc setter;
+
+        public GetterSetter(ProgramElementDoc getter, ProgramElementDoc setter) {
+            this.getter = getter;
+            this.setter = setter;
+        }
+
+        public ProgramElementDoc getGetter() {
+            return getter;
+        }
+
+        public ProgramElementDoc getSetter() {
+            return setter;
+        }
     }
 
     /**
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -61,6 +61,11 @@
                 //Just a primitive.
                 linkInfo.displayLength += type.typeName().length();
                 linkOutput.append(type.typeName());
+            } else if (type.asAnnotatedType() != null) {
+                linkOutput.append(getTypeAnnotationLinks(linkInfo));
+                linkInfo.type = type.asAnnotatedType().underlyingType();
+                linkOutput.append(getLinkOutput(linkInfo));
+                return linkOutput;
             } else if (type.asWildcardType() != null) {
                 //Wildcard type.
                 linkInfo.isTypeBound = true;
@@ -82,6 +87,7 @@
                     linkOutput.append(getLinkOutput(linkInfo));
                 }
             } else if (type.asTypeVariable()!= null) {
+                linkOutput.append(getTypeAnnotationLinks(linkInfo));
                 linkInfo.isTypeBound = true;
                 //A type variable.
                 Doc owner = type.asTypeVariable().owner();
@@ -175,6 +181,9 @@
     protected abstract LinkOutput getTypeParameterLink(LinkInfo linkInfo,
         Type typeParam);
 
+    protected abstract LinkOutput getTypeAnnotationLink(LinkInfo linkInfo,
+            AnnotationDesc annotation);
+
     /**
      * Return the links to the type parameters.
      *
@@ -226,6 +235,24 @@
         return output;
     }
 
+    public LinkOutput getTypeAnnotationLinks(LinkInfo linkInfo) {
+        LinkOutput output = getOutputInstance();
+        if (linkInfo.type.asAnnotatedType() == null)
+            return output;
+        AnnotationDesc[] annotations = linkInfo.type.asAnnotatedType().annotations();
+        for (int i = 0; i < annotations.length; i++) {
+            if (i > 0) {
+                linkInfo.displayLength += 1;
+                output.append(" ");
+            }
+            output.append(getTypeAnnotationLink(linkInfo, annotations[i]));
+        }
+
+        linkInfo.displayLength += 1;
+        output.append(" ");
+        return output;
+    }
+
     /**
      * Return &amp;lt;, which is used in type parameters.  Override this
      * if your doclet uses something different.
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -69,6 +69,12 @@
     public boolean isTypeBound = false;
 
     /**
+     * Whether the document element is in a Java 5 declaration
+     * location or not.
+     */
+    public boolean isJava5DeclarationLocation = true;
+
+    /**
      * The label for the link.
      */
     public String label;
--- a/src/share/classes/com/sun/tools/doclint/Checker.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclint/Checker.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -25,19 +25,18 @@
 
 package com.sun.tools.doclint;
 
-import java.util.regex.Matcher;
-import com.sun.source.doctree.LinkTree;
+import java.io.IOException;
+import java.io.StringWriter;
 import java.net.URI;
-import java.util.regex.Pattern;
-import java.io.IOException;
-import com.sun.tools.javac.tree.DocPretty;
-import java.io.StringWriter;
+import java.net.URISyntaxException;
 import java.util.Deque;
 import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ElementKind;
@@ -51,12 +50,15 @@
 import com.sun.source.doctree.AttributeTree;
 import com.sun.source.doctree.AuthorTree;
 import com.sun.source.doctree.DocCommentTree;
+import com.sun.source.doctree.DocRootTree;
 import com.sun.source.doctree.DocTree;
 import com.sun.source.doctree.EndElementTree;
 import com.sun.source.doctree.EntityTree;
 import com.sun.source.doctree.ErroneousTree;
 import com.sun.source.doctree.IdentifierTree;
 import com.sun.source.doctree.InheritDocTree;
+import com.sun.source.doctree.LinkTree;
+import com.sun.source.doctree.LiteralTree;
 import com.sun.source.doctree.ParamTree;
 import com.sun.source.doctree.ReferenceTree;
 import com.sun.source.doctree.ReturnTree;
@@ -66,11 +68,12 @@
 import com.sun.source.doctree.StartElementTree;
 import com.sun.source.doctree.TextTree;
 import com.sun.source.doctree.ThrowsTree;
+import com.sun.source.doctree.ValueTree;
 import com.sun.source.doctree.VersionTree;
 import com.sun.source.util.DocTreeScanner;
 import com.sun.source.util.TreePath;
 import com.sun.tools.doclint.HtmlTag.AttrKind;
-import java.net.URISyntaxException;
+import com.sun.tools.javac.tree.DocPretty;
 import static com.sun.tools.doclint.Messages.Group.*;
 
 
@@ -91,10 +94,12 @@
     boolean foundInheritDoc = false;
     boolean foundReturn = false;
 
-    enum Flag {
+    public enum Flag {
         TABLE_HAS_CAPTION,
         HAS_ELEMENT,
-        HAS_TEXT
+        HAS_INLINE_TAG,
+        HAS_TEXT,
+        REPORTED_BAD_INLINE
     }
 
     static class TagStackItem {
@@ -194,7 +199,8 @@
 
     @Override
     public Void visitText(TextTree tree, Void ignore) {
-        if (!tree.getBody().trim().isEmpty()) {
+        if (hasNonWhitespace(tree)) {
+            checkAllowsText(tree);
             markEnclosingTag(Flag.HAS_TEXT);
         }
         return null;
@@ -202,6 +208,7 @@
 
     @Override
     public Void visitEntity(EntityTree tree, Void ignore) {
+        checkAllowsText(tree);
         markEnclosingTag(Flag.HAS_TEXT);
         String name = tree.getName().toString();
         if (name.startsWith("#")) {
@@ -217,6 +224,18 @@
         return null;
     }
 
+    void checkAllowsText(DocTree tree) {
+        TagStackItem top = tagStack.peek();
+        if (top != null
+                && top.tree.getKind() == DocTree.Kind.START_ELEMENT
+                && !top.tag.acceptsText()) {
+            if (top.flags.add(Flag.REPORTED_BAD_INLINE)) {
+                env.messages.error(HTML, tree, "dc.text.not.allowed",
+                        ((StartElementTree) top.tree).getName());
+            }
+        }
+    }
+
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="HTML elements">
@@ -229,53 +248,29 @@
         if (t == null) {
             env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
         } else {
+            boolean done = false;
+            for (TagStackItem tsi: tagStack) {
+                if (tsi.tag.accepts(t)) {
+                    while (tagStack.peek() != tsi) tagStack.pop();
+                    done = true;
+                    break;
+                } else if (tsi.tag.endKind != HtmlTag.EndKind.OPTIONAL) {
+                    done = true;
+                    break;
+                }
+            }
+            if (!done && HtmlTag.BODY.accepts(t)) {
+                tagStack.clear();
+            }
+
+            checkStructure(tree, t);
+
             // tag specific checks
             switch (t) {
                 // check for out of sequence headers, such as <h1>...</h1>  <h3>...</h3>
                 case H1: case H2: case H3: case H4: case H5: case H6:
                     checkHeader(tree, t);
                     break;
-                // <p> inside <pre>
-                case P:
-                    TagStackItem top = tagStack.peek();
-                    if (top != null && top.tag == HtmlTag.PRE)
-                        env.messages.warning(HTML, tree, "dc.tag.p.in.pre");
-                    break;
-            }
-
-            // check that only block tags and inline tags are used,
-            // and that blocks tags are not used within inline tags
-            switch (t.blockType) {
-                case INLINE:
-                    break;
-                case BLOCK:
-                    TagStackItem top = tagStack.peek();
-                    if (top != null && top.tag != null && top.tag.blockType == HtmlTag.BlockType.INLINE) {
-                        switch (top.tree.getKind()) {
-                            case START_ELEMENT: {
-                                Name name = ((StartElementTree) top.tree).getName();
-                                env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.element",
-                                        treeName, name);
-                                break;
-                            }
-                            case LINK:
-                            case LINK_PLAIN: {
-                                String name = top.tree.getKind().tagName;
-                                env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.tag",
-                                        treeName, name);
-                                break;
-                            }
-                            default:
-                                env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.other",
-                                        treeName);
-                        }
-                    }
-                    break;
-                case OTHER:
-                    env.messages.error(HTML, tree, "dc.tag.not.allowed", treeName);
-                    break;
-                default:
-                    throw new AssertionError();
             }
 
             if (t.flags.contains(HtmlTag.Flag.NO_NEST)) {
@@ -323,6 +318,58 @@
         }
     }
 
+    private void checkStructure(StartElementTree tree, HtmlTag t) {
+        Name treeName = tree.getName();
+        TagStackItem top = tagStack.peek();
+        switch (t.blockType) {
+            case BLOCK:
+                if (top == null || top.tag.accepts(t))
+                    return;
+
+                switch (top.tree.getKind()) {
+                    case START_ELEMENT: {
+                        if (top.tag.blockType == HtmlTag.BlockType.INLINE) {
+                            Name name = ((StartElementTree) top.tree).getName();
+                            env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.element",
+                                    treeName, name);
+                            return;
+                        }
+                    }
+                    break;
+
+                    case LINK:
+                    case LINK_PLAIN: {
+                        String name = top.tree.getKind().tagName;
+                        env.messages.error(HTML, tree, "dc.tag.not.allowed.inline.tag",
+                                treeName, name);
+                        return;
+                    }
+                }
+                break;
+
+            case INLINE:
+                if (top == null || top.tag.accepts(t))
+                    return;
+                break;
+
+            case LIST_ITEM:
+            case TABLE_ITEM:
+                if (top != null) {
+                    // reset this flag so subsequent bad inline content gets reported
+                    top.flags.remove(Flag.REPORTED_BAD_INLINE);
+                    if (top.tag.accepts(t))
+                        return;
+                }
+                break;
+
+            case OTHER:
+                env.messages.error(HTML, tree, "dc.tag.not.allowed", treeName);
+                return;
+        }
+
+        env.messages.error(HTML, tree, "dc.tag.not.allowed.here", treeName);
+    }
+
     private void checkHeader(StartElementTree tree, HtmlTag tag) {
         // verify the new tag
         if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) {
@@ -359,9 +406,8 @@
             env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
         } else if (t.endKind == HtmlTag.EndKind.NONE) {
             env.messages.error(HTML, tree, "dc.tag.end.not.permitted", treeName);
-        } else if (tagStack.isEmpty()) {
-            env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
         } else {
+            boolean done = false;
             while (!tagStack.isEmpty()) {
                 TagStackItem top = tagStack.peek();
                 if (t == top.tag) {
@@ -375,14 +421,12 @@
                     }
                     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_ELEMENT)
+                            && !top.flags.contains(Flag.HAS_INLINE_TAG)) {
                         env.messages.warning(HTML, tree, "dc.tag.empty", treeName);
                     }
-                    if (t.flags.contains(HtmlTag.Flag.NO_TEXT)
-                            && top.flags.contains(Flag.HAS_TEXT)) {
-                        env.messages.error(HTML, tree, "dc.text.not.allowed", treeName);
-                    }
                     tagStack.pop();
+                    done = true;
                     break;
                 } else if (top.tag == null || top.tag.endKind != HtmlTag.EndKind.REQUIRED) {
                     tagStack.pop();
@@ -400,10 +444,15 @@
                         tagStack.pop();
                     } else {
                         env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
+                        done = true;
                         break;
                     }
                 }
             }
+
+            if (!done && tagStack.isEmpty()) {
+                env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
+            }
         }
 
         return super.visitEndElement(tree, ignore);
@@ -447,14 +496,18 @@
                         if (currTag != HtmlTag.A) {
                             break;
                         }
-                    // fallthrough
+                        // fallthrough
                     case ID:
                         String value = getAttrValue(tree);
-                        if (!validName.matcher(value).matches()) {
-                            env.messages.error(HTML, tree, "dc.invalid.anchor", value);
-                        }
-                        if (!foundAnchors.add(value)) {
-                            env.messages.error(HTML, tree, "dc.anchor.already.defined", value);
+                        if (value == null) {
+                            env.messages.error(HTML, tree, "dc.anchor.value.missing");
+                        } else {
+                            if (!validName.matcher(value).matches()) {
+                                env.messages.error(HTML, tree, "dc.invalid.anchor", value);
+                            }
+                            if (!foundAnchors.add(value)) {
+                                env.messages.error(HTML, tree, "dc.anchor.already.defined", value);
+                            }
                         }
                         break;
 
@@ -522,7 +575,14 @@
     }
 
     @Override
+    public Void visitDocRoot(DocRootTree tree, Void ignore) {
+        markEnclosingTag(Flag.HAS_INLINE_TAG);
+        return super.visitDocRoot(tree, ignore);
+    }
+
+    @Override
     public Void visitInheritDoc(InheritDocTree tree, Void ignore) {
+        markEnclosingTag(Flag.HAS_INLINE_TAG);
         // TODO: verify on overridden method
         foundInheritDoc = true;
         return super.visitInheritDoc(tree, ignore);
@@ -530,6 +590,7 @@
 
     @Override
     public Void visitLink(LinkTree tree, Void ignore) {
+        markEnclosingTag(Flag.HAS_INLINE_TAG);
         // simulate inline context on tag stack
         HtmlTag t = (tree.getKind() == DocTree.Kind.LINK)
                 ? HtmlTag.CODE : HtmlTag.SPAN;
@@ -542,6 +603,20 @@
     }
 
     @Override
+    public Void visitLiteral(LiteralTree tree, Void ignore) {
+        markEnclosingTag(Flag.HAS_INLINE_TAG);
+        if (tree.getKind() == DocTree.Kind.CODE) {
+            for (TagStackItem tsi: tagStack) {
+                if (tsi.tag == HtmlTag.CODE) {
+                    env.messages.warning(HTML, tree, "dc.tag.code.within.code");
+                    break;
+                }
+            }
+        }
+        return super.visitLiteral(tree, ignore);
+    }
+
+    @Override
     public Void visitParam(ParamTree tree, Void ignore) {
         boolean typaram = tree.isTypeParameter();
         IdentifierTree nameTree = tree.getName();
@@ -684,6 +759,12 @@
     }
 
     @Override
+    public Void visitValue(ValueTree tree, Void ignore) {
+        markEnclosingTag(Flag.HAS_INLINE_TAG);
+        return super.visitValue(tree, ignore);
+    }
+
+    @Override
     public Void visitVersion(VersionTree tree, Void ignore) {
         warnIfEmpty(tree, tree.getBody());
         return super.visitVersion(tree, ignore);
@@ -740,7 +821,7 @@
         for (DocTree d: list) {
             switch (d.getKind()) {
                 case TEXT:
-                    if (!((TextTree) d).getBody().trim().isEmpty())
+                    if (hasNonWhitespace((TextTree) d))
                         return;
                     break;
                 default:
@@ -749,6 +830,16 @@
         }
         env.messages.warning(SYNTAX, tree, "dc.empty", tree.getKind().tagName);
     }
+
+    boolean hasNonWhitespace(TextTree tree) {
+        String s = tree.getBody();
+        for (int i = 0; i < s.length(); i++) {
+            if (!Character.isWhitespace(s.charAt(i)))
+                return true;
+        }
+        return false;
+    }
+
     // </editor-fold>
 
 }
--- a/src/share/classes/com/sun/tools/doclint/DocLint.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclint/DocLint.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -122,7 +122,7 @@
 
         if (javacFiles.isEmpty()) {
             if (!needHelp)
-                System.out.println("no files given");
+                out.println("no files given");
         }
 
         JavacTool tool = JavacTool.create();
@@ -179,11 +179,11 @@
                 }
             } else if (arg.equals(STATS)) {
                 env.messages.setStatsEnabled(true);
-            } else if (arg.matches("-bootclasspath") && i + 1 < args.length) {
+            } else if (arg.equals("-bootclasspath") && i + 1 < args.length) {
                 javacBootClassPath = splitPath(args[++i]);
-            } else if (arg.matches("-classpath") && i + 1 < args.length) {
+            } else if (arg.equals("-classpath") && i + 1 < args.length) {
                 javacClassPath = splitPath(args[++i]);
-            } else if (arg.matches("-sourcepath") && i + 1 < args.length) {
+            } else if (arg.equals("-sourcepath") && i + 1 < args.length) {
                 javacSourcePath = splitPath(args[++i]);
             } else if (arg.equals(XMSGS_OPTION)) {
                 env.messages.setOptions(null);
@@ -234,6 +234,8 @@
         out.println("    equivalent to -Xmsgs:all/protected, meaning that");
         out.println("    all messages are reported for protected and public");
         out.println("    declarations only. ");
+        out.println("  -stats");
+        out.println("    Report statistics on the reported issues.");
         out.println("  -h -help --help -usage -?");
         out.println("    Show this message.");
         out.println("");
@@ -247,7 +249,7 @@
 
     List<File> splitPath(String path) {
         List<File> files = new ArrayList<File>();
-        for (String f: path.split(File.separator)) {
+        for (String f: path.split(File.pathSeparator)) {
             if (f.length() > 0)
                 files.add(new File(f));
         }
--- a/src/share/classes/com/sun/tools/doclint/Entity.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclint/Entity.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -43,7 +43,7 @@
  * risk.  This code and its internal interfaces are subject to change
  * or deletion without notice.</b></p>
  */
-enum Entity {
+public enum Entity {
     nbsp(160),
     iexcl(161),
     cent(162),
--- a/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -57,16 +57,22 @@
     B(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
-    BLOCKQUOTE,
+    BIG(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT)),
+
+    BLOCKQUOTE(BlockType.BLOCK, EndKind.REQUIRED,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
 
     BODY(BlockType.OTHER, EndKind.REQUIRED),
 
     BR(BlockType.INLINE, EndKind.NONE,
             attrs(AttrKind.USE_CSS, CLEAR)),
 
-    CAPTION(EnumSet.of(Flag.EXPECT_CONTENT)),
+    CAPTION(BlockType.TABLE_ITEM, EndKind.REQUIRED,
+            EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
 
-    CENTER,
+    CENTER(BlockType.BLOCK, EndKind.REQUIRED,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
 
     CITE(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
@@ -74,17 +80,23 @@
     CODE(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
-    DD(BlockType.BLOCK, EndKind.OPTIONAL,
-            EnumSet.of(Flag.EXPECT_CONTENT)),
+    DD(BlockType.LIST_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
 
-    DIV,
+    DIV(BlockType.BLOCK, EndKind.REQUIRED,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
 
     DL(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
-            attrs(AttrKind.USE_CSS, COMPACT)),
+            EnumSet.of(Flag.EXPECT_CONTENT),
+            attrs(AttrKind.USE_CSS, COMPACT)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == DT) || (t == DD);
+        }
+    },
 
-    DT(BlockType.BLOCK, EndKind.OPTIONAL,
-            EnumSet.of(Flag.EXPECT_CONTENT)),
+    DT(BlockType.LIST_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
 
     EM(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.NO_NEST)),
@@ -97,12 +109,12 @@
 
     FRAMESET(BlockType.OTHER, EndKind.REQUIRED),
 
-    H1,
-    H2,
-    H3,
-    H4,
-    H5,
-    H6,
+    H1(BlockType.BLOCK, EndKind.REQUIRED),
+    H2(BlockType.BLOCK, EndKind.REQUIRED),
+    H3(BlockType.BLOCK, EndKind.REQUIRED),
+    H4(BlockType.BLOCK, EndKind.REQUIRED),
+    H5(BlockType.BLOCK, EndKind.REQUIRED),
+    H6(BlockType.BLOCK, EndKind.REQUIRED),
 
     HEAD(BlockType.OTHER, EndKind.REQUIRED),
 
@@ -118,31 +130,54 @@
             attrs(AttrKind.OBSOLETE, NAME),
             attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)),
 
-    LI(BlockType.BLOCK, EndKind.OPTIONAL),
+    LI(BlockType.LIST_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
 
     LINK(BlockType.OTHER, EndKind.NONE),
 
-    MENU,
+    MENU(BlockType.BLOCK, EndKind.REQUIRED) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == LI);
+        }
+    },
 
     META(BlockType.OTHER, EndKind.NONE),
 
     NOFRAMES(BlockType.OTHER, EndKind.REQUIRED),
 
-    NOSCRIPT(BlockType.OTHER, EndKind.REQUIRED),
+    NOSCRIPT(BlockType.BLOCK, EndKind.REQUIRED),
 
     OL(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
-            attrs(AttrKind.USE_CSS, START, TYPE)),
+            EnumSet.of(Flag.EXPECT_CONTENT),
+            attrs(AttrKind.USE_CSS, START, TYPE)){
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == LI);
+        }
+    },
 
     P(BlockType.BLOCK, EndKind.OPTIONAL,
             EnumSet.of(Flag.EXPECT_CONTENT),
             attrs(AttrKind.USE_CSS, ALIGN)),
 
-    PRE(EnumSet.of(Flag.EXPECT_CONTENT)),
+    PRE(BlockType.BLOCK, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            switch (t) {
+                case IMG: case BIG: case SMALL: case SUB: case SUP:
+                    return false;
+                default:
+                    return (t.blockType == BlockType.INLINE);
+            }
+        }
+    },
 
     SCRIPT(BlockType.OTHER, EndKind.REQUIRED),
 
-    SMALL(BlockType.INLINE, EndKind.REQUIRED),
+    SMALL(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT)),
 
     SPAN(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT)),
@@ -157,37 +192,70 @@
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
     TABLE(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
+            EnumSet.of(Flag.EXPECT_CONTENT),
             attrs(AttrKind.OK, SUMMARY, Attr.FRAME, RULES, BORDER,
                 CELLPADDING, CELLSPACING),
-            attrs(AttrKind.USE_CSS, ALIGN, WIDTH, BGCOLOR)),
+            attrs(AttrKind.USE_CSS, ALIGN, WIDTH, BGCOLOR)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            switch (t) {
+                case CAPTION:
+                case THEAD: case TBODY: case TFOOT:
+                case TR: // HTML 3.2
+                    return true;
+                default:
+                    return false;
+            }
+        }
+    },
 
-    TBODY(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
-            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)),
+    TBODY(BlockType.TABLE_ITEM, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT),
+            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == TR);
+        }
+    },
 
-    TD(BlockType.BLOCK, EndKind.OPTIONAL,
+    TD(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
             attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS,
                 ALIGN, CHAR, CHAROFF, VALIGN),
             attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)),
 
-    TFOOT(BlockType.BLOCK, EndKind.REQUIRED,
-            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)),
+    TFOOT(BlockType.TABLE_ITEM, EndKind.REQUIRED,
+            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == TR);
+        }
+    },
 
-    TH(BlockType.BLOCK, EndKind.OPTIONAL,
+    TH(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
+            EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
             attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS,
                 ALIGN, CHAR, CHAROFF, VALIGN),
             attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)),
 
-    THEAD(BlockType.BLOCK, EndKind.REQUIRED,
-            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)),
+    THEAD(BlockType.TABLE_ITEM, EndKind.REQUIRED,
+            attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == TR);
+        }
+    },
 
     TITLE(BlockType.OTHER, EndKind.REQUIRED),
 
-    TR(BlockType.BLOCK, EndKind.OPTIONAL,
-            EnumSet.of(Flag.NO_TEXT),
+    TR(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
             attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN),
-            attrs(AttrKind.USE_CSS, BGCOLOR)),
+            attrs(AttrKind.USE_CSS, BGCOLOR)) {
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == TH) || (t == TD);
+        }
+    },
 
     TT(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
@@ -196,8 +264,13 @@
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
     UL(BlockType.BLOCK, EndKind.REQUIRED,
-            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_TEXT),
-            attrs(AttrKind.USE_CSS, COMPACT, TYPE)),
+            EnumSet.of(Flag.EXPECT_CONTENT),
+            attrs(AttrKind.USE_CSS, COMPACT, TYPE)){
+        @Override
+        public boolean accepts(HtmlTag t) {
+            return (t == LI);
+        }
+    },
 
     VAR(BlockType.INLINE, EndKind.REQUIRED);
 
@@ -207,6 +280,8 @@
     public static enum BlockType {
         BLOCK,
         INLINE,
+        LIST_ITEM,
+        TABLE_ITEM,
         OTHER;
     }
 
@@ -220,9 +295,10 @@
     }
 
     public static enum Flag {
+        ACCEPTS_BLOCK,
+        ACCEPTS_INLINE,
         EXPECT_CONTENT,
-        NO_NEST,
-        NO_TEXT
+        NO_NEST
     }
 
     public static enum Attr {
@@ -273,7 +349,7 @@
         static final Map<String,Attr> index = new HashMap<String,Attr>();
         static {
             for (Attr t: values()) {
-                index.put(t.name().toLowerCase(), t);
+                index.put(t.getText(), t);
             }
         }
     }
@@ -300,22 +376,14 @@
     public final Set<Flag> flags;
     private final Map<Attr,AttrKind> attrs;
 
-
-    HtmlTag() {
-        this(BlockType.BLOCK, EndKind.REQUIRED);
-    }
-
-    HtmlTag(Set<Flag> flags) {
-        this(BlockType.BLOCK, EndKind.REQUIRED, flags);
-    }
-
     HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) {
         this(blockType, endKind, Collections.<Flag>emptySet(), attrMaps);
     }
 
     HtmlTag(BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) {
         this.blockType = blockType;
-        this.endKind = endKind;this.flags = flags;
+        this.endKind = endKind;
+        this.flags = flags;
         this.attrs = new EnumMap<Attr,AttrKind>(Attr.class);
         for (Map<Attr,AttrKind> m: attrMaps)
             this.attrs.putAll(m);
@@ -324,6 +392,35 @@
         attrs.put(Attr.STYLE, AttrKind.OK);
     }
 
+    public boolean accepts(HtmlTag t) {
+        if (flags.contains(Flag.ACCEPTS_BLOCK) && flags.contains(Flag.ACCEPTS_INLINE)) {
+            return (t.blockType == BlockType.BLOCK) || (t.blockType == BlockType.INLINE);
+        } else if (flags.contains(Flag.ACCEPTS_BLOCK)) {
+            return (t.blockType == BlockType.BLOCK);
+        } else if (flags.contains(Flag.ACCEPTS_INLINE)) {
+            return (t.blockType == BlockType.INLINE);
+        } else
+            switch (blockType) {
+                case BLOCK:
+                case INLINE:
+                    return (t.blockType == BlockType.INLINE);
+                case OTHER:
+                    // OTHER tags are invalid in doc comments, and will be
+                    // reported separately, so silently accept/ignore any content
+                    return true;
+                default:
+                    // any combination which could otherwise arrive here
+                    // ought to have been handled in an overriding method
+                    throw new AssertionError(this + ":" + t);
+            }
+    }
+
+    public boolean acceptsText() {
+        // generally, anywhere we can put text we can also put inline tag
+        // so check if a typical inline tag is allowed
+        return accepts(B);
+    }
+
     public String getText() {
         return name().toLowerCase();
     }
@@ -346,7 +443,7 @@
     private static final Map<String,HtmlTag> index = new HashMap<String,HtmlTag>();
     static {
         for (HtmlTag t: values()) {
-            index.put(t.name().toLowerCase(), t);
+            index.put(t.getText(), t);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -24,6 +24,7 @@
 #
 
 dc.anchor.already.defined = anchor already defined: {0}
+dc.anchor.value.missing = no value given for anchor
 dc.attr.lacks.value = attribute lacks value
 dc.attr.obsolete = attribute obsolete: {0}
 dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0}
@@ -47,12 +48,14 @@
 dc.no.summary.or.caption.for.table=no summary or caption for table
 dc.param.name.not.found = @param name not found
 dc.ref.not.found = reference not found
+dc.tag.code.within.code = '{@code'} within <code>
 dc.tag.empty = empty <{0}> tag
 dc.tag.end.not.permitted = invalid end tag: </{0}>
 dc.tag.end.unexpected = unexpected end tag: </{0}>
 dc.tag.header.sequence.1 = header used out of sequence: <{0}>
 dc.tag.header.sequence.2 = header used out of sequence: <{0}>
 dc.tag.nested.not.allowed=nested tag not allowed: <{0}>
+dc.tag.not.allowed.here = tag not allowed here: <{0}>
 dc.tag.not.allowed = element not allowed in documentation comments: <{0}>
 dc.tag.not.allowed.inline.element = block element not allowed within inline element <{1}>: {0}
 dc.tag.not.allowed.inline.tag = block element not allowed within @{1}: {0}
--- a/src/share/classes/com/sun/tools/javac/Main.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/Main.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -41,6 +41,7 @@
  * risk.  This code and its internal interfaces are subject to change
  * or deletion without notice.
  */
+@jdk.Supported
 public class Main {
 
     /** Unsupported command line interface.
--- a/src/share/classes/com/sun/tools/javac/Server.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2005, 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.
- */
-
-package com.sun.tools.javac;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.logging.Logger;
-import javax.tools.*;
-
-/**
- * Java Compiler Server.  Can be used to speed up a set of (small)
- * compilation tasks by caching jar files between compilations.
- *
- * <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>
- *
- * @author Peter von der Ah&eacute;
- * @since 1.6
- */
-class Server implements Runnable {
-    private final BufferedReader in;
-    private final OutputStream out;
-    private final boolean isSocket;
-    private static final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
-    private static final Logger logger = Logger.getLogger("com.sun.tools.javac");
-    static class CwdFileManager extends ForwardingJavaFileManager<JavaFileManager> {
-        String cwd;
-        CwdFileManager(JavaFileManager fileManager) {
-            super(fileManager);
-        }
-        String getAbsoluteName(String name) {
-            if (new File(name).isAbsolute()) {
-                return name;
-            } else {
-                return new File(cwd,name).getPath();
-            }
-        }
-//      public JavaFileObject getFileForInput(String name)
-//          throws IOException
-//      {
-//          return super.getFileForInput(getAbsoluteName(name));
-//      }
-    }
-    // static CwdFileManager fm = new CwdFileManager(tool.getStandardFileManager());
-    static final StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
-    static {
-        // Use the same file manager for all compilations.  This will
-        // cache jar files in the standard file manager.  Use
-        // tool.getStandardFileManager().close() to release.
-        // FIXME tool.setFileManager(fm);
-        logger.setLevel(java.util.logging.Level.SEVERE);
-    }
-    private Server(BufferedReader in, OutputStream out, boolean isSocket) {
-        this.in = in;
-        this.out = out;
-        this.isSocket = isSocket;
-    }
-    private Server(BufferedReader in, OutputStream out) {
-        this(in, out, false);
-    }
-    private Server(Socket socket) throws IOException, UnsupportedEncodingException {
-        this(new BufferedReader(new InputStreamReader(socket.getInputStream(), "utf-8")),
-             socket.getOutputStream(),
-             true);
-    }
-    public void run() {
-        List<String> args = new ArrayList<String>();
-        int res = -1;
-        try {
-            String line = null;
-            try {
-                line = in.readLine();
-            } catch (IOException e) {
-                System.err.println(e.getLocalizedMessage());
-                System.exit(0);
-                line = null;
-            }
-            // fm.cwd=null;
-            String cwd = null;
-            while (line != null) {
-                if (line.startsWith("PWD:")) {
-                    cwd = line.substring(4);
-                } else if (line.equals("END")) {
-                    break;
-                } else if (!"-XDstdout".equals(line)) {
-                    args.add(line);
-                }
-                try {
-                    line = in.readLine();
-                } catch (IOException e) {
-                    System.err.println(e.getLocalizedMessage());
-                    System.exit(0);
-                    line = null;
-                }
-            }
-            Iterable<File> path = cwd == null ? null : Arrays.<File>asList(new File(cwd));
-            // try { in.close(); } catch (IOException e) {}
-            long msec = System.currentTimeMillis();
-            try {
-                synchronized (tool) {
-                    for (StandardLocation location : StandardLocation.values())
-                        fm.setLocation(location, path);
-                    res = compile(out, fm, args);
-                    // FIXME res = tool.run((InputStream)null, null, out, args.toArray(new String[args.size()]));
-                }
-            } catch (Throwable ex) {
-                logger.log(java.util.logging.Level.SEVERE, args.toString(), ex);
-                PrintWriter p = new PrintWriter(out, true);
-                ex.printStackTrace(p);
-                p.flush();
-            }
-            if (res >= 3) {
-                logger.severe(String.format("problem: %s", args));
-            } else {
-                logger.info(String.format("success: %s", args));
-            }
-            // res = compile(args.toArray(new String[args.size()]), out);
-            msec -= System.currentTimeMillis();
-            logger.info(String.format("Real time: %sms", -msec));
-        } finally {
-            if (!isSocket) {
-                try { in.close(); } catch (IOException e) {}
-            }
-            try {
-                out.write(String.format("EXIT: %s%n", res).getBytes());
-            } catch (IOException ex) {
-                logger.log(java.util.logging.Level.SEVERE, args.toString(), ex);
-            }
-            try {
-                out.flush();
-                out.close();
-            } catch (IOException ex) {
-                logger.log(java.util.logging.Level.SEVERE, args.toString(), ex);
-            }
-            logger.info(String.format("EXIT: %s", res));
-        }
-    }
-    public static void main(String... args) throws FileNotFoundException {
-        if (args.length == 2) {
-            for (;;) {
-                throw new UnsupportedOperationException("TODO");
-//              BufferedReader in = new BufferedReader(new FileReader(args[0]));
-//              PrintWriter out = new PrintWriter(args[1]);
-//              new Server(in, out).run();
-//              System.out.flush();
-//              System.err.flush();
-            }
-        } else {
-            ExecutorService pool = Executors.newCachedThreadPool();
-            try
-                {
-                ServerSocket socket = new ServerSocket(0xcafe, -1, null);
-                for (;;) {
-                    pool.execute(new Server(socket.accept()));
-                }
-            }
-            catch (IOException e) {
-                System.err.format("Error: %s%n", e.getLocalizedMessage());
-                pool.shutdown();
-            }
-        }
-    }
-
-    private int compile(OutputStream out, StandardJavaFileManager fm, List<String> args) {
-        // FIXME parse args and use getTask
-        // System.err.println("Running " + args);
-        return tool.run(null, null, out, args.toArray(new String[args.size()]));
-    }
-}
--- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -121,19 +121,23 @@
         return result.toList();
     }
 
-    public Boolean call() {
+    public Main.Result doCall() {
         if (!used.getAndSet(true)) {
             initContext();
             notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
             compilerMain.setAPIMode(true);
             result = compilerMain.compile(args, classNames, context, fileObjects, processors);
             cleanup();
-            return result.isOK();
+            return result;
         } else {
             throw new IllegalStateException("multiple calls to method 'call'");
         }
     }
 
+    public Boolean call() {
+        return doCall().isOK();
+    }
+
     public void setProcessors(Iterable<? extends Processor> processors) {
         processors.getClass(); // null check
         // not mt-safe
@@ -154,10 +158,11 @@
                 throw new IllegalStateException();
         } else {
             initContext();
+            compilerMain.log = Log.instance(context);
             compilerMain.setOptions(Options.instance(context));
             compilerMain.filenames = new LinkedHashSet<File>();
             Collection<File> filenames = compilerMain.processArgs(CommandLine.parse(args), classNames);
-            if (!filenames.isEmpty())
+            if (filenames != null && !filenames.isEmpty())
                 throw new IllegalArgumentException("Malformed arguments " + toString(filenames, " "));
             compiler = JavaCompiler.instance(context);
             compiler.keepComments = true;
--- a/src/share/classes/com/sun/tools/javac/code/Annotations.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Annotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -48,7 +48,7 @@
  *
  * An instance of this class can be in one of three states:
  *
- * NOT_STARTED indicates that the Symbol this instance belongs to have not been
+ * NOT_STARTED indicates that the Symbol this instance belongs to has not been
  * annotated (yet). Specifically if the declaration is not annotated this
  * instance will never move past NOT_STARTED. You can never go back to
  * NOT_STARTED.
@@ -59,7 +59,7 @@
  *
  * "unnamed" this Annotations contains some attributes, possibly the final set.
  * While in this state you can only prepend or append to the attributes not set
- * it directly. You can also move back to the IN_PROGRESS sate using reset().
+ * it directly. You can also move back to the IN_PROGRESS state using reset().
  *
  * <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
@@ -67,14 +67,21 @@
  */
 public class Annotations {
 
-    private static final List<Attribute.Compound> NOT_STARTED = List.of(null);
-    private static final List<Attribute.Compound> IN_PROGRESS = List.of(null);
+    private static final List<Attribute.Compound> DECL_NOT_STARTED = List.of(null);
+    private static final List<Attribute.Compound> DECL_IN_PROGRESS = List.of(null);
+
     /*
      * This field should never be null
      */
-    private List<Attribute.Compound> attributes = NOT_STARTED;
+    private List<Attribute.Compound> attributes = DECL_NOT_STARTED;
+
     /*
-     * The Symbol this Annotations belong to
+     * This field should never be null
+     */
+    private List<Attribute.TypeCompound> type_attributes = List.<Attribute.TypeCompound>nil();
+
+    /*
+     * The Symbol this Annotations instance belongs to
      */
     private final Symbol sym;
 
@@ -82,11 +89,15 @@
         this.sym = sym;
     }
 
-    public List<Attribute.Compound> getAttributes() {
-        return filterSentinels(attributes);
+    public List<Attribute.Compound> getDeclarationAttributes() {
+        return filterDeclSentinels(attributes);
     }
 
-    public void setAttributes(List<Attribute.Compound> a) {
+    public List<Attribute.TypeCompound> getTypeAttributes() {
+        return type_attributes;
+    }
+
+    public void setDeclarationAttributes(List<Attribute.Compound> a) {
         Assert.check(pendingCompletion() || !isStarted());
         if (a == null) {
             throw new NullPointerException();
@@ -94,31 +105,51 @@
         attributes = a;
     }
 
+    public void setTypeAttributes(List<Attribute.TypeCompound> a) {
+        if (a == null) {
+            throw new NullPointerException();
+        }
+        type_attributes = a;
+    }
+
     public void setAttributes(Annotations other) {
         if (other == null) {
             throw new NullPointerException();
         }
-        setAttributes(other.getAttributes());
+        setDeclarationAttributes(other.getDeclarationAttributes());
+        setTypeAttributes(other.getTypeAttributes());
+    }
+
+    public void setDeclarationAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.Compound> ctx) {
+        Assert.check(pendingCompletion() || (!isStarted() && sym.kind == PCK));
+        this.setDeclarationAttributes(getAttributesForCompletion(ctx));
     }
 
-    public void setAttributesWithCompletion(final Annotate.AnnotateRepeatedContext ctx) {
-        Assert.check(pendingCompletion() || (!isStarted() && sym.kind == PCK));
+    public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx) {
+        this.appendUniqueTypes(getAttributesForCompletion(ctx));
+    }
 
-        Map<Symbol.TypeSymbol, ListBuffer<Attribute.Compound>> annotated = ctx.annotated;
+    private <T extends Attribute.Compound> List<T> getAttributesForCompletion(
+            final Annotate.AnnotateRepeatedContext<T> ctx) {
+
+        Map<Symbol.TypeSymbol, ListBuffer<T>> annotated = ctx.annotated;
         boolean atLeastOneRepeated = false;
-        List<Attribute.Compound> buf = List.<Attribute.Compound>nil();
-        for (ListBuffer<Attribute.Compound> lb : annotated.values()) {
+        List<T> buf = List.<T>nil();
+        for (ListBuffer<T> lb : annotated.values()) {
             if (lb.size() == 1) {
                 buf = buf.prepend(lb.first());
             } else { // repeated
-                buf = buf.prepend(new Placeholder(lb.toList(), sym));
+                // This will break when other subtypes of Attributs.Compound
+                // are introduced, because PlaceHolder is a subtype of TypeCompound.
+                T res;
+                @SuppressWarnings("unchecked")
+                T ph = (T) new Placeholder<T>(ctx, lb.toList(), sym);
+                res = ph;
+                buf = buf.prepend(res);
                 atLeastOneRepeated = true;
             }
         }
 
-        // Add non-repeating attributes
-        setAttributes(buf.reverse());
-
         if (atLeastOneRepeated) {
             // The Symbol s is now annotated with a combination of
             // finished non-repeating annotations and placeholders for
@@ -126,19 +157,18 @@
             //
             // We need to do this in two passes because when creating
             // a container for a repeating annotation we must
-            // guarantee that the @ContainedBy on the
+            // guarantee that the @Repeatable on the
             // contained annotation is fully annotated
             //
             // The way we force this order is to do all repeating
             // annotations in a pass after all non-repeating are
-            // finished. This will work because @ContainedBy
+            // finished. This will work because @Repeatable
             // is non-repeating and therefore will be annotated in the
             // fist pass.
 
             // Queue a pass that will replace Attribute.Placeholders
             // with Attribute.Compound (made from synthesized containers).
             ctx.annotateRepeated(new Annotate.Annotator() {
-
                 @Override
                 public String toString() {
                     return "repeated annotation pass of: " + sym + " in: " + sym.owner;
@@ -150,10 +180,12 @@
                 }
             });
         }
+        // Add non-repeating attributes
+        return buf.reverse();
     }
 
     public Annotations reset() {
-        attributes = IN_PROGRESS;
+        attributes = DECL_IN_PROGRESS;
         return this;
     }
 
@@ -163,12 +195,16 @@
                 || attributes.isEmpty();
     }
 
+    public boolean isTypesEmpty() {
+        return type_attributes.isEmpty();
+    }
+
     public boolean pendingCompletion() {
-        return attributes == IN_PROGRESS;
+        return attributes == DECL_IN_PROGRESS;
     }
 
     public Annotations append(List<Attribute.Compound> l) {
-        attributes = filterSentinels(attributes);
+        attributes = filterDeclSentinels(attributes);
 
         if (l.isEmpty()) {
             ; // no-op
@@ -180,8 +216,24 @@
         return this;
     }
 
+    public Annotations appendUniqueTypes(List<Attribute.TypeCompound> l) {
+        if (l.isEmpty()) {
+            ; // no-op
+        } else if (type_attributes.isEmpty()) {
+            type_attributes = l;
+        } else {
+            // TODO: in case we expect a large number of annotations, this
+            // might be inefficient.
+            for (Attribute.TypeCompound tc : l) {
+                if (!type_attributes.contains(tc))
+                    type_attributes = type_attributes.append(tc);
+            }
+        }
+        return this;
+    }
+
     public Annotations prepend(List<Attribute.Compound> l) {
-        attributes = filterSentinels(attributes);
+        attributes = filterDeclSentinels(attributes);
 
         if (l.isEmpty()) {
             ; // no-op
@@ -193,19 +245,29 @@
         return this;
     }
 
-    private List<Attribute.Compound> filterSentinels(List<Attribute.Compound> a) {
-        return (a == IN_PROGRESS || a == NOT_STARTED)
+    private List<Attribute.Compound> filterDeclSentinels(List<Attribute.Compound> a) {
+        return (a == DECL_IN_PROGRESS || a == DECL_NOT_STARTED)
                 ? List.<Attribute.Compound>nil()
                 : a;
     }
 
     private boolean isStarted() {
-        return attributes != NOT_STARTED;
+        return attributes != DECL_NOT_STARTED;
     }
 
     private List<Attribute.Compound> getPlaceholders() {
         List<Attribute.Compound> res = List.<Attribute.Compound>nil();
-        for (Attribute.Compound a : filterSentinels(attributes)) {
+        for (Attribute.Compound a : filterDeclSentinels(attributes)) {
+            if (a instanceof Placeholder) {
+                res = res.prepend(a);
+            }
+        }
+        return res.reverse();
+    }
+
+    private List<Attribute.TypeCompound> getTypePlaceholders() {
+        List<Attribute.TypeCompound> res = List.<Attribute.TypeCompound>nil();
+        for (Attribute.TypeCompound a : type_attributes) {
             if (a instanceof Placeholder) {
                 res = res.prepend(a);
             }
@@ -216,68 +278,100 @@
     /*
      * Replace Placeholders for repeating annotations with their containers
      */
-    private void complete(Annotate.AnnotateRepeatedContext ctx) {
-        Assert.check(!pendingCompletion());
+    private <T extends Attribute.Compound> void complete(Annotate.AnnotateRepeatedContext<T> ctx) {
         Log log = ctx.log;
         Env<AttrContext> env = ctx.env;
         JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
         try {
+            // TODO: can we reduce duplication in the following branches?
+            if (ctx.isTypeCompound) {
+                Assert.check(!isTypesEmpty());
 
-            if (isEmpty()) {
-                return;
-            }
+                if (isTypesEmpty()) {
+                    return;
+                }
 
-            List<Attribute.Compound> result = List.nil();
-            for (Attribute.Compound a : getAttributes()) {
-                if (a instanceof Placeholder) {
-                    Attribute.Compound replacement = replaceOne((Placeholder) a, ctx);
+                List<Attribute.TypeCompound> result = List.nil();
+                for (Attribute.TypeCompound a : getTypeAttributes()) {
+                    if (a instanceof Placeholder) {
+                        @SuppressWarnings("unchecked")
+                        Placeholder<Attribute.TypeCompound> ph = (Placeholder<Attribute.TypeCompound>) a;
+                        Attribute.TypeCompound replacement = replaceOne(ph, ph.getRepeatedContext());
+
+                        if (null != replacement) {
+                            result = result.prepend(replacement);
+                        }
+                    } else {
+                        result = result.prepend(a);
+                    }
+                }
+
+                type_attributes = result.reverse();
 
-                    if (null != replacement) {
-                        result = result.prepend(replacement);
-                    }
-                } else {
-                    result = result.prepend(a);
+                Assert.check(Annotations.this.getTypePlaceholders().isEmpty());
+            } else {
+                Assert.check(!pendingCompletion());
+
+                if (isEmpty()) {
+                    return;
                 }
-            }
+
+                List<Attribute.Compound> result = List.nil();
+                for (Attribute.Compound a : getDeclarationAttributes()) {
+                    if (a instanceof Placeholder) {
+                        @SuppressWarnings("unchecked")
+                        Attribute.Compound replacement = replaceOne((Placeholder<T>) a, ctx);
 
-            attributes = result.reverse();
+                        if (null != replacement) {
+                            result = result.prepend(replacement);
+                        }
+                    } else {
+                        result = result.prepend(a);
+                    }
+                }
 
-            Assert.check(Annotations.this.getPlaceholders().isEmpty());
+                attributes = result.reverse();
+
+                Assert.check(Annotations.this.getPlaceholders().isEmpty());
+            }
         } finally {
             log.useSource(oldSource);
         }
     }
 
-    private Attribute.Compound replaceOne(Placeholder placeholder, Annotate.AnnotateRepeatedContext ctx) {
+    private <T extends Attribute.Compound> T replaceOne(Placeholder<T> placeholder, Annotate.AnnotateRepeatedContext<T> ctx) {
         Log log = ctx.log;
 
         // Process repeated annotations
-        Attribute.Compound validRepeated =
-            ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);
+        T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);
 
         if (validRepeated != null) {
             // Check that the container isn't manually
             // present along with repeated instances of
             // its contained annotation.
-            ListBuffer<Attribute.Compound> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
+            ListBuffer<T> manualContainer = ctx.annotated.get(validRepeated.type.tsym);
             if (manualContainer != null) {
-                log.error(ctx.pos.get(manualContainer.first()), "invalid.containedby.annotation.repeated.and.container.present",
+                log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
                         manualContainer.first().type.tsym);
             }
         }
 
         // A null return will delete the Placeholder
         return validRepeated;
-
     }
 
-    private static class Placeholder extends Attribute.Compound {
+    private static class Placeholder<T extends Attribute.Compound> extends Attribute.TypeCompound {
+
+        private final Annotate.AnnotateRepeatedContext<T> ctx;
+        private final List<T> placeholderFor;
+        private final Symbol on;
 
-        private List<Attribute.Compound> placeholderFor;
-        private Symbol on;
-
-        public Placeholder(List<Attribute.Compound> placeholderFor, Symbol on) {
-            super(Type.noType, List.<Pair<Symbol.MethodSymbol, Attribute>>nil());
+        public Placeholder(Annotate.AnnotateRepeatedContext<T> ctx, List<T> placeholderFor, Symbol on) {
+            super(on.type, List.<Pair<Symbol.MethodSymbol, Attribute>>nil(),
+                    ctx.isTypeCompound ?
+                            ((Attribute.TypeCompound)placeholderFor.head).position :
+                                null);
+            this.ctx = ctx;
             this.placeholderFor = placeholderFor;
             this.on = on;
         }
@@ -287,8 +381,12 @@
             return "<placeholder: " + placeholderFor + " on: " + on + ">";
         }
 
-        public List<Attribute.Compound> getPlaceholderFor() {
+        public List<T> getPlaceholderFor() {
             return placeholderFor;
         }
+
+        public Annotate.AnnotateRepeatedContext<T> getRepeatedContext() {
+            return ctx;
+        }
     }
 }
--- a/src/share/classes/com/sun/tools/javac/code/Attribute.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Attribute.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -217,6 +217,21 @@
         }
     }
 
+    public static class TypeCompound extends Compound {
+        public TypeAnnotationPosition position;
+        public TypeCompound(Compound compound,
+                TypeAnnotationPosition position) {
+            this(compound.type, compound.values, position);
+        }
+        public TypeCompound(Type type,
+                List<Pair<MethodSymbol, Attribute>> values,
+                TypeAnnotationPosition position) {
+            super(type, values);
+            this.position = position;
+        }
+
+    }
+
     /** The value for an annotation element of an array type.
      */
     public static class Array extends Attribute {
--- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -74,6 +74,7 @@
         if ((mask&DEPRECATED) != 0) flags.add(Flag.DEPRECATED);
         if ((mask&HASINIT) != 0) flags.add(Flag.HASINIT);
         if ((mask&ENUM) != 0) flags.add(Flag.ENUM);
+        if ((mask&MANDATED) != 0) flags.add(Flag.MANDATED);
         if ((mask&IPROXY) != 0) flags.add(Flag.IPROXY);
         if ((mask&NOOUTERTHIS) != 0) flags.add(Flag.NOOUTERTHIS);
         if ((mask&EXISTS) != 0) flags.add(Flag.EXISTS);
@@ -114,6 +115,9 @@
      *  classfile v49.0. */
     public static final int ENUM         = 1<<14;
 
+    /** Added in SE8, represents constructs implicitly declared in source. */
+    public static final int MANDATED     = 1<<15;
+
     public static final int StandardFlags = 0x0fff;
     public static final int ModifierFlags = StandardFlags & ~INTERFACE;
 
@@ -233,28 +237,28 @@
     public static final long PROPRIETARY = 1L<<38;
 
     /**
-     * Flag that marks a a multi-catch parameter
+     * Flag that marks a multi-catch parameter.
      */
     public static final long UNION = 1L<<39;
 
     /**
-     * Flag that marks a special kind of bridge methods (the ones that
-     * come from restricted supertype bounds)
+     * Flag that marks a special kind of bridge method (the ones that
+     * come from restricted supertype bounds).
      */
     public static final long OVERRIDE_BRIDGE = 1L<<40;
 
     /**
-     * Flag that marks an 'effectively final' local variable
+     * Flag that marks an 'effectively final' local variable.
      */
     public static final long EFFECTIVELY_FINAL = 1L<<41;
 
     /**
-     * Flag that marks non-override equivalent methods with the same signature
+     * Flag that marks non-override equivalent methods with the same signature.
      */
     public static final long CLASH = 1L<<42;
 
     /**
-     * Flag that marks either a default method or an interface containing default methods
+     * Flag that marks either a default method or an interface containing default methods.
      */
     public static final long DEFAULT = 1L<<43;
 
@@ -264,6 +268,16 @@
      */
     public static final long AUXILIARY = 1L<<44;
 
+    /**
+     * Flag that marks that a symbol is not available in the current profile
+     */
+    public static final long NOT_IN_PROFILE = 1L<<45;
+
+    /**
+     * Flag that indicates that an override error has been detected by Check.
+     */
+    public static final long BAD_OVERRIDE = 1L<<45;
+
     /** Modifier masks.
      */
     public static final int
@@ -280,7 +294,7 @@
                                 SYNCHRONIZED | FINAL | STRICTFP;
     public static final long
         ExtendedStandardFlags       = (long)StandardFlags | DEFAULT,
-        InterfaceDefaultMethodMask  = ABSTRACT | PUBLIC | STRICTFP | SYNCHRONIZED | DEFAULT,
+        InterfaceMethodMask         = ABSTRACT | STATIC | PUBLIC | STRICTFP | DEFAULT,
         LocalVarFlags               = FINAL | PARAMETER;
 
 
@@ -342,6 +356,7 @@
         DEPRECATED("deprecated"),
         HASINIT("hasinit"),
         ENUM("enum"),
+        MANDATED("mandated"),
         IPROXY("iproxy"),
         NOOUTERTHIS("noouterthis"),
         EXISTS("exists"),
--- a/src/share/classes/com/sun/tools/javac/code/Lint.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Lint.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -26,10 +26,7 @@
 package com.sun.tools.javac.code;
 
 import java.util.EnumSet;
-import java.util.HashMap;
 import java.util.Map;
-import java.util.Set;
-import javax.lang.model.element.Modifier;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.List;
@@ -74,7 +71,7 @@
      * the given annotations.
      */
     public Lint augment(Annotations annots) {
-        return augmentor.augment(this, annots.getAttributes());
+        return augmentor.augment(this, annots.getDeclarationAttributes());
     }
 
     /**
@@ -82,7 +79,7 @@
      * the given annotations and flags.
      */
     public Lint augment(Annotations annots, long flags) {
-        Lint l = augmentor.augment(this, annots.getAttributes());
+        Lint l = augmentor.augment(this, annots.getDeclarationAttributes());
         if ((flags & DEPRECATED) != 0) {
             if (l == this)
                 l = new Lint(this);
--- a/src/share/classes/com/sun/tools/javac/code/Printer.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Printer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, 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
@@ -27,7 +27,10 @@
 
 import java.util.Locale;
 
+import javax.lang.model.type.TypeKind;
+
 import com.sun.tools.javac.api.Messages;
+import com.sun.tools.javac.code.Type.AnnotatedType;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.util.List;
@@ -35,7 +38,6 @@
 
 import static com.sun.tools.javac.code.BoundKind.*;
 import static com.sun.tools.javac.code.Flags.*;
-import static com.sun.tools.javac.code.TypeTag.ARRAY;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.code.TypeTag.FORALL;
 
@@ -188,7 +190,7 @@
         StringBuilder buf = new StringBuilder();
         if (t.getEnclosingType().tag == CLASS && t.tsym.owner.kind == Kinds.TYP) {
             buf.append(visit(t.getEnclosingType(), locale));
-            buf.append(".");
+            buf.append('.');
             buf.append(className(t, false, locale));
         } else {
             buf.append(className(t, true, locale));
@@ -196,7 +198,7 @@
         if (t.getTypeArguments().nonEmpty()) {
             buf.append('<');
             buf.append(visitTypes(t.getTypeArguments(), locale));
-            buf.append(">");
+            buf.append('>');
         }
         return buf.toString();
     }
@@ -231,6 +233,17 @@
         return visitType(t, locale);
     }
 
+    @Override
+    public String visitAnnotatedType(AnnotatedType t, Locale locale) {
+        if (t.typeAnnotations != null &&
+                t.typeAnnotations.nonEmpty()) {
+            // TODO: better logic for arrays, ...
+            return "(" + t.typeAnnotations + " :: " + visit(t.underlyingType, locale) + ")";
+        } else {
+            return "({} :: " + visit(t.underlyingType, locale) + ")";
+        }
+    }
+
     public String visitType(Type t, Locale locale) {
         String s = (t.tsym == null || t.tsym.name == null)
                 ? localize(locale, "compiler.misc.type.none")
@@ -296,8 +309,13 @@
                 args = args.tail;
                 buf.append(',');
             }
-            if (args.head.tag == ARRAY) {
-                buf.append(visit(((ArrayType) args.head).elemtype, locale));
+            if (args.head.unannotatedType().getKind() == TypeKind.ARRAY) {
+                buf.append(visit(((ArrayType) args.head.unannotatedType()).elemtype, locale));
+                if (args.head.getAnnotationMirrors().nonEmpty()) {
+                    buf.append(' ');
+                    buf.append(args.head.getAnnotationMirrors());
+                    buf.append(' ');
+                }
                 buf.append("...");
             } else {
                 buf.append(visit(args.head, locale));
--- a/src/share/classes/com/sun/tools/javac/code/Source.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Source.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -176,9 +176,6 @@
     public boolean allowTryWithResources() {
         return compareTo(JDK1_7) >= 0;
     }
-    public boolean allowTypeAnnotations() {
-        return compareTo(JDK1_7) >= 0;
-    }
     public boolean allowBinaryLiterals() {
         return compareTo(JDK1_7) >= 0;
     }
@@ -206,18 +203,30 @@
     public boolean allowDefaultMethods() {
         return compareTo(JDK1_8) >= 0;
     }
+    public boolean allowStaticInterfaceMethods() {
+        return compareTo(JDK1_8) >= 0;
+    }
     public boolean allowStrictMethodClashCheck() {
         return compareTo(JDK1_8) >= 0;
     }
     public boolean allowEffectivelyFinalInInnerClasses() {
         return compareTo(JDK1_8) >= 0;
     }
+    public boolean allowTypeAnnotations() {
+        return compareTo(JDK1_8) >= 0;
+    }
     public boolean allowRepeatedAnnotations() {
         return compareTo(JDK1_8) >= 0;
     }
     public boolean allowIntersectionTypesInCast() {
         return compareTo(JDK1_8) >= 0;
     }
+    public boolean allowGraphInference() {
+        return compareTo(JDK1_8) >= 0;
+    }
+    public boolean allowStructuralMostSpecific() {
+        return compareTo(JDK1_8) >= 0;
+    }
     public static SourceVersion toSourceVersion(Source source) {
         switch(source) {
         case JDK1_2:
--- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -84,7 +84,15 @@
      *  method to make sure that the class symbol is loaded.
      */
     public List<Attribute.Compound> getRawAttributes() {
-        return annotations.getAttributes();
+        return annotations.getDeclarationAttributes();
+    }
+
+    /** An accessor method for the type attributes of this symbol.
+     *  Attributes of class symbols should be accessed through the accessor
+     *  method to make sure that the class symbol is loaded.
+     */
+    public List<Attribute.TypeCompound> getRawTypeAttributes() {
+        return annotations.getTypeAttributes();
     }
 
     /** Fetch a particular annotation from a symbol. */
@@ -209,6 +217,14 @@
         return (flags() & INTERFACE) != 0;
     }
 
+    public boolean isPrivate() {
+        return (flags_field & Flags.AccessFlags) == PRIVATE;
+    }
+
+    public boolean isEnum() {
+        return (flags() & ENUM) != 0;
+    }
+
     /** Is this symbol declared (directly or indirectly) local
      *  to a method or variable initializer?
      *  Also includes fields of inner classes which are in
@@ -221,7 +237,7 @@
     }
 
     /** Has this symbol an empty name? This includes anonymous
-     *  inner classses.
+     *  inner classes.
      */
     public boolean isAnonymous() {
         return name.isEmpty();
@@ -450,16 +466,29 @@
      * This is the implementation for {@code
      * javax.lang.model.element.Element.getAnnotationMirrors()}.
      */
-    public final List<Attribute.Compound> getAnnotationMirrors() {
+    public final List<? extends AnnotationMirror> getAnnotationMirrors() {
         return getRawAttributes();
     }
 
     /**
+     * TODO: Should there be a {@code
+     * javax.lang.model.element.Element.getTypeAnnotationMirrors()}.
+     */
+    public final List<Attribute.TypeCompound> getTypeAnnotationMirrors() {
+        return getRawTypeAttributes();
+    }
+
+    /**
      * @deprecated this method should never be used by javac internally.
      */
     @Deprecated
     public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) {
-        return JavacElements.getAnnotation(this, 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.getAnnotations(this, annoType);
     }
 
     // TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList
@@ -475,9 +504,9 @@
         return l.toList();
     }
 
-    public static class DelegatedSymbol extends Symbol {
-        protected Symbol other;
-        public DelegatedSymbol(Symbol other) {
+    public static class DelegatedSymbol<T extends Symbol> extends Symbol {
+        protected T other;
+        public DelegatedSymbol(T other) {
             super(other.kind, other.flags_field, other.name, other.type, other.owner);
             this.other = other;
         }
@@ -511,6 +540,10 @@
         public <R, P> R accept(Symbol.Visitor<R, P> v, P p) {
             return v.visitSymbol(other, p);
         }
+
+        public T getUnderlyingSymbol() {
+            return other;
+        }
     }
 
     /** A class for type symbols. Type variables are represented by instances
@@ -790,6 +823,12 @@
             return super.getRawAttributes();
         }
 
+        @Override
+        public List<Attribute.TypeCompound> getRawTypeAttributes() {
+            if (completer != null) complete();
+            return super.getRawTypeAttributes();
+        }
+
         public Type erasure(Types types) {
             if (erasure_field == null)
                 erasure_field = new ClassType(types.erasure(type.getEnclosingType()),
@@ -896,11 +935,12 @@
         }
 
         /**
-         * @deprecated this method should never be used by javac internally.
+         * Since this method works in terms of the runtime representation
+         * of annotations, it should never be used by javac internally.
          */
-        @Override @Deprecated
+        @Override
         public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) {
-            return JavacElements.getAnnotation(this, annoType);
+            return JavacAnnoConstructs.getAnnotation(this, annoType);
         }
 
         public <R, P> R accept(ElementVisitor<R, P> v, P p) {
@@ -1051,6 +1091,9 @@
         /** The code of the method. */
         public Code code = null;
 
+        /** The extra (synthetic/mandated) parameters of the method. */
+        public List<VarSymbol> extraParams = List.nil();
+
         /** The parameters of the method. */
         public List<VarSymbol> params = null;
 
@@ -1228,7 +1271,8 @@
             case Flags.PRIVATE:
                 return false;
             case Flags.PUBLIC:
-                return true;
+                return !this.owner.isInterface() ||
+                        (flags_field & STATIC) == 0;
             case Flags.PROTECTED:
                 return (origin.flags() & INTERFACE) == 0;
             case 0:
@@ -1242,6 +1286,18 @@
             }
         }
 
+        @Override
+        public boolean isInheritedIn(Symbol clazz, Types types) {
+            switch ((int)(flags_field & Flags.AccessFlags)) {
+                case PUBLIC:
+                    return !this.owner.isInterface() ||
+                            clazz == owner ||
+                            (flags_field & STATIC) == 0;
+                default:
+                    return super.isInheritedIn(clazz, types);
+            }
+        }
+
         /** The implementation of this (abstract) symbol in class origin;
          *  null if none exists. Synthetic methods are not considered
          *  as possible implementations.
@@ -1250,7 +1306,7 @@
             return implementation(origin, types, checkResult, implementation_filter);
         }
         // where
-            private static final Filter<Symbol> implementation_filter = new Filter<Symbol>() {
+            public static final Filter<Symbol> implementation_filter = new Filter<Symbol>() {
                 public boolean accepts(Symbol s) {
                     return s.kind == Kinds.MTH &&
                             (s.flags() & SYNTHETIC) == 0;
@@ -1283,8 +1339,9 @@
                 List<Name> paramNames = savedParameterNames;
                 savedParameterNames = null;
                 // discard the provided names if the list of names is the wrong size.
-                if (paramNames == null || paramNames.size() != type.getParameterTypes().size())
+                if (paramNames == null || paramNames.size() != type.getParameterTypes().size()) {
                     paramNames = List.nil();
+                }
                 ListBuffer<VarSymbol> buf = new ListBuffer<VarSymbol>();
                 List<Name> remaining = paramNames;
                 // assert: remaining and paramNames are both empty or both
@@ -1368,7 +1425,7 @@
             return defaultValue;
         }
 
-         public List<VarSymbol> getParameters() {
+        public List<VarSymbol> getParameters() {
             return params();
         }
 
@@ -1388,6 +1445,10 @@
             return v.visitMethodSymbol(this, p);
         }
 
+        public Type getReceiverType() {
+            return asType().getReceiverType();
+        }
+
         public Type getReturnType() {
             return asType().getReturnType();
         }
--- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -126,6 +126,7 @@
     public final Type stringBuilderType;
     public final Type cloneableType;
     public final Type serializableType;
+    public final Type serializedLambdaType;
     public final Type methodHandleType;
     public final Type methodHandleLookupType;
     public final Type methodTypeType;
@@ -147,6 +148,7 @@
     public final Type listType;
     public final Type collectionsType;
     public final Type comparableType;
+    public final Type comparatorType;
     public final Type arraysType;
     public final Type iterableType;
     public final Type iteratorType;
@@ -156,15 +158,16 @@
     public final Type deprecatedType;
     public final Type suppressWarningsType;
     public final Type inheritedType;
+    public final Type profileType;
     public final Type proprietaryType;
     public final Type systemType;
     public final Type autoCloseableType;
     public final Type trustMeType;
     public final Type lambdaMetafactory;
-    public final Type containedByType;
-    public final Type containerForType;
+    public final Type repeatableType;
     public final Type documentedType;
     public final Type elementTypeType;
+    public final Type functionalInterfaceType;
 
     /** The symbol representing the length field of an array.
      */
@@ -360,6 +363,22 @@
 
     }
 
+    // Enter a synthetic class that is used to mark classes in ct.sym.
+    // This class does not have a class file.
+    private Type enterSyntheticAnnotation(String name) {
+        ClassType type = (ClassType)enterClass(name);
+        ClassSymbol sym = (ClassSymbol)type.tsym;
+        sym.completer = null;
+        sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
+        sym.erasure_field = type;
+        sym.members_field = new Scope(sym);
+        type.typarams_field = List.nil();
+        type.allparams_field = List.nil();
+        type.supertype_field = annotationType;
+        type.interfaces_field = List.nil();
+        return type;
+    }
+
     /** Constructor; enters all predefined identifiers and operators
      *  into symbol table.
      */
@@ -458,6 +477,7 @@
         cloneableType = enterClass("java.lang.Cloneable");
         throwableType = enterClass("java.lang.Throwable");
         serializableType = enterClass("java.io.Serializable");
+        serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda");
         methodHandleType = enterClass("java.lang.invoke.MethodHandle");
         methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup");
         methodTypeType = enterClass("java.lang.invoke.MethodType");
@@ -483,6 +503,7 @@
         listType = enterClass("java.util.List");
         collectionsType = enterClass("java.util.Collections");
         comparableType = enterClass("java.lang.Comparable");
+        comparatorType = enterClass("java.util.Comparator");
         arraysType = enterClass("java.util.Arrays");
         iterableType = target.hasIterable()
             ? enterClass("java.lang.Iterable")
@@ -494,8 +515,7 @@
         deprecatedType = enterClass("java.lang.Deprecated");
         suppressWarningsType = enterClass("java.lang.SuppressWarnings");
         inheritedType = enterClass("java.lang.annotation.Inherited");
-        containedByType = enterClass("java.lang.annotation.ContainedBy");
-        containerForType = enterClass("java.lang.annotation.ContainerFor");
+        repeatableType = enterClass("java.lang.annotation.Repeatable");
         documentedType = enterClass("java.lang.annotation.Documented");
         elementTypeType = enterClass("java.lang.annotation.ElementType");
         systemType = enterClass("java.lang.System");
@@ -509,11 +529,13 @@
         nativeHeaderType = enterClass("java.lang.annotation.Native");
         nativeHeaderType_old = enterClass("javax.tools.annotation.GenerateNativeHeader");
         lambdaMetafactory = enterClass("java.lang.invoke.LambdaMetafactory");
+        functionalInterfaceType = enterClass("java.lang.FunctionalInterface");
 
         synthesizeEmptyInterfaceIfMissing(autoCloseableType);
         synthesizeEmptyInterfaceIfMissing(cloneableType);
         synthesizeEmptyInterfaceIfMissing(serializableType);
         synthesizeEmptyInterfaceIfMissing(lambdaMetafactory);
+        synthesizeEmptyInterfaceIfMissing(serializedLambdaType);
         synthesizeBoxTypeIfMissing(doubleType);
         synthesizeBoxTypeIfMissing(floatType);
         synthesizeBoxTypeIfMissing(voidType);
@@ -521,17 +543,13 @@
         // Enter a synthetic class that is used to mark internal
         // proprietary classes in ct.sym.  This class does not have a
         // class file.
-        ClassType proprietaryType = (ClassType)enterClass("sun.Proprietary+Annotation");
-        this.proprietaryType = proprietaryType;
-        ClassSymbol proprietarySymbol = (ClassSymbol)proprietaryType.tsym;
-        proprietarySymbol.completer = null;
-        proprietarySymbol.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
-        proprietarySymbol.erasure_field = proprietaryType;
-        proprietarySymbol.members_field = new Scope(proprietarySymbol);
-        proprietaryType.typarams_field = List.nil();
-        proprietaryType.allparams_field = List.nil();
-        proprietaryType.supertype_field = annotationType;
-        proprietaryType.interfaces_field = List.nil();
+        proprietaryType = enterSyntheticAnnotation("sun.Proprietary+Annotation");
+
+        // Enter a synthetic class that is used to provide profile info for
+        // classes in ct.sym.  This class does not have a class file.
+        profileType = enterSyntheticAnnotation("jdk.Profile+Annotation");
+        MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
+        profileType.tsym.members().enter(m);
 
         // Enter a class for arrays.
         // The class implements java.lang.Cloneable and java.io.Serializable.
--- a/src/share/classes/com/sun/tools/javac/code/TargetType.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/TargetType.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,10 +25,7 @@
 
 package com.sun.tools.javac.code;
 
-import java.util.EnumSet;
-import java.util.Set;
-
-import static com.sun.tools.javac.code.TargetType.TargetAttribute.*;
+import com.sun.tools.javac.util.Assert;
 
 /**
  * Describes the type of program element an extended annotation (or extended
@@ -44,178 +41,92 @@
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
+// Code duplicated in com.sun.tools.classfile.TypeAnnotation.TargetType
 public enum TargetType {
-
-    //
-    // Some target types are commented out, because Java doesn't permit such
-    // targets.  They are included here to confirm that their omission is
-    // intentional omission not an accidental omission.
-    //
-
-    /** For annotations on typecasts. */
-    TYPECAST(0x00, IsLocal),
-
-    /** For annotations on a type argument or nested array of a typecast. */
-    TYPECAST_GENERIC_OR_ARRAY(0x01, HasLocation, IsLocal),
-
-    /** For annotations on type tests. */
-    INSTANCEOF(0x02, IsLocal),
-
-    /** For annotations on a type argument or nested array of a type test. */
-    INSTANCEOF_GENERIC_OR_ARRAY(0x03, HasLocation, IsLocal),
-
-    /** For annotations on object creation expressions. */
-    NEW(0x04, IsLocal),
-
-    /**
-     * For annotations on a type argument or nested array of an object creation
-     * expression.
-     */
-    NEW_GENERIC_OR_ARRAY(0x05, HasLocation, IsLocal),
-
-
-    /** For annotations on the method receiver. */
-    METHOD_RECEIVER(0x06),
-
-    // invalid location
-    //@Deprecated METHOD_RECEIVER_GENERIC_OR_ARRAY(0x07, HasLocation),
-
-    /** For annotations on local variables. */
-    LOCAL_VARIABLE(0x08, IsLocal),
+    /** For annotations on a class type parameter declaration. */
+    CLASS_TYPE_PARAMETER(0x00),
 
-    /** For annotations on a type argument or nested array of a local. */
-    LOCAL_VARIABLE_GENERIC_OR_ARRAY(0x09, HasLocation, IsLocal),
-
-    // handled by regular annotations
-    //@Deprecated METHOD_RETURN(0x0A),
-
-    /**
-     * For annotations on a type argument or nested array of a method return
-     * type.
-     */
-    METHOD_RETURN_GENERIC_OR_ARRAY(0x0B, HasLocation),
-
-    // handled by regular annotations
-    //@Deprecated METHOD_PARAMETER(0x0C),
-
-    /** For annotations on a type argument or nested array of a method parameter. */
-    METHOD_PARAMETER_GENERIC_OR_ARRAY(0x0D, HasLocation),
-
-    // handled by regular annotations
-    //@Deprecated FIELD(0x0E),
-
-    /** For annotations on a type argument or nested array of a field. */
-    FIELD_GENERIC_OR_ARRAY(0x0F, HasLocation),
-
-    /** For annotations on a bound of a type parameter of a class. */
-    CLASS_TYPE_PARAMETER_BOUND(0x10, HasBound, HasParameter),
-
-    /**
-     * For annotations on a type argument or nested array of a bound of a type
-     * parameter of a class.
-     */
-    CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x11, HasBound, HasLocation, HasParameter),
-
-    /** For annotations on a bound of a type parameter of a method. */
-    METHOD_TYPE_PARAMETER_BOUND(0x12, HasBound, HasParameter),
-
-    /**
-     * For annotations on a type argument or nested array of a bound of a type
-     * parameter of a method.
-     */
-    METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY(0x13, HasBound, HasLocation, HasParameter),
+    /** For annotations on a method type parameter declaration. */
+    METHOD_TYPE_PARAMETER(0x01),
 
     /** For annotations on the type of an "extends" or "implements" clause. */
-    CLASS_EXTENDS(0x14),
+    CLASS_EXTENDS(0x10),
+
+    /** For annotations on a bound of a type parameter of a class. */
+    CLASS_TYPE_PARAMETER_BOUND(0x11),
+
+    /** For annotations on a bound of a type parameter of a method. */
+    METHOD_TYPE_PARAMETER_BOUND(0x12),
 
-    /** For annotations on the inner type of an "extends" or "implements" clause. */
-    CLASS_EXTENDS_GENERIC_OR_ARRAY(0x15, HasLocation),
+    /** For annotations on a field. */
+    FIELD(0x13),
+
+    /** For annotations on a method return type. */
+    METHOD_RETURN(0x14),
+
+    /** For annotations on the method receiver. */
+    METHOD_RECEIVER(0x15),
+
+    /** For annotations on a method parameter. */
+    METHOD_FORMAL_PARAMETER(0x16),
 
     /** For annotations on a throws clause in a method declaration. */
-    THROWS(0x16),
+    THROWS(0x17),
 
-    // invalid location
-    //@Deprecated THROWS_GENERIC_OR_ARRAY(0x17, HasLocation),
+    /** For annotations on a local variable. */
+    LOCAL_VARIABLE(0x40, true),
+
+    /** For annotations on a resource variable. */
+    RESOURCE_VARIABLE(0x41, true),
 
-    /** For annotations in type arguments of object creation expressions. */
-    NEW_TYPE_ARGUMENT(0x18, IsLocal),
-    NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x19, HasLocation, IsLocal),
+    /** For annotations on an exception parameter. */
+    EXCEPTION_PARAMETER(0x42, true),
 
-    METHOD_TYPE_ARGUMENT(0x1A, IsLocal),
-    METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY(0x1B, HasLocation, IsLocal),
+    /** For annotations on a type test. */
+    INSTANCEOF(0x43, true),
+
+    /** For annotations on an object creation expression. */
+    NEW(0x44, true),
 
-    WILDCARD_BOUND(0x1C, HasBound),
-    WILDCARD_BOUND_GENERIC_OR_ARRAY(0x1D, HasBound, HasLocation),
+    /** For annotations on a constructor reference receiver. */
+    CONSTRUCTOR_REFERENCE(0x45, true),
 
-    CLASS_LITERAL(0x1E, IsLocal),
-    CLASS_LITERAL_GENERIC_OR_ARRAY(0x1F, HasLocation, IsLocal),
+    /** For annotations on a method reference receiver. */
+    METHOD_REFERENCE(0x46, true),
 
-    METHOD_TYPE_PARAMETER(0x20, HasParameter),
+    /** For annotations on a typecast. */
+    CAST(0x47, true),
 
-    // invalid location
-    //@Deprecated METHOD_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x21, HasLocation, HasParameter),
+    /** For annotations on a type argument of an object creation expression. */
+    CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT(0x48, true),
+
+    /** For annotations on a type argument of a method call. */
+    METHOD_INVOCATION_TYPE_ARGUMENT(0x49, true),
 
-    CLASS_TYPE_PARAMETER(0x22, HasParameter),
+    /** For annotations on a type argument of a constructor reference. */
+    CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT(0x4A, true),
 
-    // invalid location
-    //@Deprecated CLASS_TYPE_PARAMETER_GENERIC_OR_ARRAY(0x23, HasLocation, HasParameter),
+    /** For annotations on a type argument of a method reference. */
+    METHOD_REFERENCE_TYPE_ARGUMENT(0x4B, true),
 
     /** For annotations with an unknown target. */
-    UNKNOWN(-1);
+    UNKNOWN(0xFF);
 
-    static final int MAXIMUM_TARGET_TYPE_VALUE = 0x22;
+    private static final int MAXIMUM_TARGET_TYPE_VALUE = 0x4B;
 
     private final int targetTypeValue;
-    private final Set<TargetAttribute> flags;
+    private final boolean isLocal;
 
-    TargetType(int targetTypeValue, TargetAttribute... attributes) {
-        if (targetTypeValue < Byte.MIN_VALUE
-                || targetTypeValue > Byte.MAX_VALUE)
-                throw new AssertionError("attribute type value needs to be a byte: " + targetTypeValue);
-        this.targetTypeValue = (byte)targetTypeValue;
-        flags = EnumSet.noneOf(TargetAttribute.class);
-        for (TargetAttribute attr : attributes)
-            flags.add(attr);
-    }
-
-    /**
-     * Returns whether or not this TargetType represents an annotation whose
-     * target is an inner type of a generic or array type.
-     *
-     * @return true if this TargetType represents an annotation on an inner
-     *         type, false otherwise
-     */
-    public boolean hasLocation() {
-        return flags.contains(HasLocation);
+    private TargetType(int targetTypeValue) {
+        this(targetTypeValue, false);
     }
 
-    public TargetType getGenericComplement() {
-        if (hasLocation())
-            return this;
-        else
-            return fromTargetTypeValue(targetTypeValue() + 1);
-    }
-
-    /**
-     * Returns whether or not this TargetType represents an annotation whose
-     * target has a parameter index.
-     *
-     * @return true if this TargetType has a parameter index,
-     *         false otherwise
-     */
-    public boolean hasParameter() {
-        return flags.contains(HasParameter);
-    }
-
-    /**
-     * Returns whether or not this TargetType represents an annotation whose
-     * target is a type parameter bound.
-     *
-     * @return true if this TargetType represents an type parameter bound
-     *         annotation, false otherwise
-     */
-    public boolean hasBound() {
-        return flags.contains(HasBound);
+    private TargetType(int targetTypeValue, boolean isLocal) {
+        if (targetTypeValue < 0
+                || targetTypeValue > 255)
+                Assert.error("Attribute type value needs to be an unsigned byte: " + String.format("0x%02X", targetTypeValue));
+        this.targetTypeValue = targetTypeValue;
+        this.isLocal = isLocal;
     }
 
     /**
@@ -226,7 +137,7 @@
      * member declaration signature tree
      */
     public boolean isLocal() {
-        return flags.contains(IsLocal);
+        return isLocal;
     }
 
     public int targetTypeValue() {
@@ -239,7 +150,7 @@
         targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
         TargetType[] alltargets = values();
         for (TargetType target : alltargets) {
-            if (target.targetTypeValue >= 0)
+            if (target.targetTypeValue != UNKNOWN.targetTypeValue)
                 targets[target.targetTypeValue] = target;
         }
         for (int i = 0; i <= MAXIMUM_TARGET_TYPE_VALUE; ++i) {
@@ -249,22 +160,18 @@
     }
 
     public static boolean isValidTargetTypeValue(int tag) {
-        if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
+        if (tag == UNKNOWN.targetTypeValue)
             return true;
 
         return (tag >= 0 && tag < targets.length);
     }
 
     public static TargetType fromTargetTypeValue(int tag) {
-        if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
+        if (tag == UNKNOWN.targetTypeValue)
             return UNKNOWN;
 
         if (tag < 0 || tag >= targets.length)
-            throw new IllegalArgumentException("Unknown TargetType: " + tag);
+            Assert.error("Unknown TargetType: " + tag);
         return targets[tag];
     }
-
-    static enum TargetAttribute {
-        HasLocation, HasParameter, HasBound, IsLocal;
-    }
 }
--- a/src/share/classes/com/sun/tools/javac/code/Type.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,12 +25,16 @@
 
 package com.sun.tools.javac.code;
 
+import com.sun.tools.javac.model.JavacAnnoConstructs;
+import com.sun.tools.javac.model.JavacTypes;
+import java.lang.annotation.Annotation;
 import java.util.Collections;
 import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.Map;
 import java.util.Set;
 
+import javax.lang.model.element.AnnotationMirror;
 import javax.lang.model.type.*;
 
 import com.sun.tools.javac.code.Symbol.*;
@@ -87,7 +91,7 @@
      */
     protected TypeTag tag;
 
-    /** The defining class / interface / package / type variable
+    /** The defining class / interface / package / type variable.
      */
     public TypeSymbol tsym;
 
@@ -166,7 +170,7 @@
     /**
      * Get the representation of this type used for modelling purposes.
      * By default, this is itself. For ErrorType, a different value
-     * may be provided,
+     * may be provided.
      */
     public Type getModelType() {
         return this;
@@ -245,6 +249,35 @@
         return this;
     }
 
+    public boolean isAnnotated() {
+        return false;
+    }
+
+    /**
+     * If this is an annotated type, return the underlying type.
+     * Otherwise, return the type itself.
+     */
+    public Type unannotatedType() {
+        return this;
+    }
+
+    @Override
+    public List<? extends 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")
+        A[] tmp = (A[]) java.lang.reflect.Array.newInstance(annotationType, 0);
+        return tmp;
+    }
+
     /** Return the base types of a list of types.
      */
     public static List<Type> baseTypes(List<Type> ts) {
@@ -339,8 +372,11 @@
             args = args.tail;
             buf.append(',');
         }
-        if (args.head.tag == ARRAY) {
-            buf.append(((ArrayType)args.head).elemtype);
+        if (args.head.unannotatedType().tag == ARRAY) {
+            buf.append(((ArrayType)args.head.unannotatedType()).elemtype);
+            if (args.head.getAnnotationMirrors().nonEmpty()) {
+                buf.append(args.head.getAnnotationMirrors());
+            }
             buf.append("...");
         } else {
             buf.append(args.head);
@@ -351,9 +387,10 @@
     /** Access methods.
      */
     public List<Type>        getTypeArguments()  { return List.nil(); }
-    public Type              getEnclosingType() { return null; }
+    public Type              getEnclosingType()  { return null; }
     public List<Type>        getParameterTypes() { return List.nil(); }
     public Type              getReturnType()     { return null; }
+    public Type              getReceiverType()   { return null; }
     public List<Type>        getThrownTypes()    { return List.nil(); }
     public Type              getUpperBound()     { return null; }
     public Type              getLowerBound()     { return null; }
@@ -600,7 +637,7 @@
 
         /** The enclosing type of this type. If this is the type of an inner
          *  class, outer_field refers to the type of its enclosing
-         *  instance class, in all other cases it referes to noType.
+         *  instance class, in all other cases it refers to noType.
          */
         private Type outer_field;
 
@@ -974,6 +1011,10 @@
         public Type restype;
         public List<Type> thrown;
 
+        /** The type annotations on the method receiver.
+         */
+        public Type recvtype;
+
         public MethodType(List<Type> argtypes,
                           Type restype,
                           List<Type> thrown,
@@ -1000,6 +1041,7 @@
 
         public List<Type>        getParameterTypes() { return argtypes; }
         public Type              getReturnType()     { return restype; }
+        public Type              getReceiverType()   { return recvtype; }
         public List<Type>        getThrownTypes()    { return thrown; }
 
         public boolean isErroneous() {
@@ -1028,6 +1070,7 @@
             for (List<Type> l = argtypes; l.nonEmpty(); l = l.tail)
                 l.head.complete();
             restype.complete();
+            recvtype.complete();
             for (List<Type> l = thrown; l.nonEmpty(); l = l.tail)
                 l.head.complete();
         }
@@ -1112,7 +1155,11 @@
         }
 
         @Override
-        public Type getUpperBound() { return bound; }
+        public Type getUpperBound() {
+            if ((bound == null || bound.tag == NONE) && this != tsym.type)
+                bound = tsym.type.getUpperBound();
+            return bound;
+        }
 
         int rank_field = -1;
 
@@ -1183,6 +1230,7 @@
         public Type getEnclosingType() { return qtype.getEnclosingType(); }
         public List<Type> getParameterTypes() { return qtype.getParameterTypes(); }
         public Type getReturnType() { return qtype.getReturnType(); }
+        public Type getReceiverType() { return qtype.getReceiverType(); }
         public List<Type> getThrownTypes() { return qtype.getThrownTypes(); }
         public List<Type> allparams() { return qtype.allparams(); }
         public Type getUpperBound() { return qtype.getUpperBound(); }
@@ -1284,6 +1332,9 @@
         /** inference variable's inferred type (set from Infer.java) */
         public Type inst = null;
 
+        /** number of declared (upper) bounds */
+        public int declaredCount;
+
         /** inference variable's change listener */
         public UndetVarListener listener = null;
 
@@ -1293,13 +1344,11 @@
         }
 
         public UndetVar(TypeVar origin, Types types) {
-            this(origin, types, true);
-        }
-
-        public UndetVar(TypeVar origin, Types types, boolean includeBounds) {
             super(UNDETVAR, origin);
             bounds = new EnumMap<InferenceBound, List<Type>>(InferenceBound.class);
-            bounds.put(InferenceBound.UPPER, includeBounds ? types.getBounds(origin) : List.<Type>nil());
+            List<Type> declaredBounds = types.getBounds(origin);
+            declaredCount = declaredBounds.length();
+            bounds.put(InferenceBound.UPPER, declaredBounds);
             bounds.put(InferenceBound.LOWER, List.<Type>nil());
             bounds.put(InferenceBound.EQ, List.<Type>nil());
         }
@@ -1315,38 +1364,89 @@
         }
 
         /** get all bounds of a given kind */
-        public List<Type> getBounds(InferenceBound ib) {
-            return bounds.get(ib);
+        public List<Type> getBounds(InferenceBound... ibs) {
+            ListBuffer<Type> buf = ListBuffer.lb();
+            for (InferenceBound ib : ibs) {
+                buf.appendList(bounds.get(ib));
+            }
+            return buf.toList();
+        }
+
+        /** get the list of declared (upper) bounds */
+        public List<Type> getDeclaredBounds() {
+            ListBuffer<Type> buf = ListBuffer.lb();
+            int count = 0;
+            for (Type b : getBounds(InferenceBound.UPPER)) {
+                if (count++ == declaredCount) break;
+                buf.append(b);
+            }
+            return buf.toList();
         }
 
         /** add a bound of a given kind - this might trigger listener notification */
         public void addBound(InferenceBound ib, Type bound, Types types) {
+            Type bound2 = toTypeVarMap.apply(bound);
             List<Type> prevBounds = bounds.get(ib);
             for (Type b : prevBounds) {
-                if (types.isSameType(b, bound)) {
-                    return;
-                }
+                //check for redundancy - use strict version of isSameType on tvars
+                //(as the standard version will lead to false positives w.r.t. clones ivars)
+                if (types.isSameType(b, bound2, true) || bound == qtype) return;
             }
-            bounds.put(ib, prevBounds.prepend(bound));
+            bounds.put(ib, prevBounds.prepend(bound2));
             notifyChange(EnumSet.of(ib));
         }
+        //where
+            Type.Mapping toTypeVarMap = new Mapping("toTypeVarMap") {
+                @Override
+                public Type apply(Type t) {
+                    if (t.hasTag(UNDETVAR)) {
+                        UndetVar uv = (UndetVar)t;
+                        return uv.qtype;
+                    } else {
+                        return t.map(this);
+                    }
+                }
+            };
 
         /** replace types in all bounds - this might trigger listener notification */
         public void substBounds(List<Type> from, List<Type> to, Types types) {
-            EnumSet<InferenceBound> changed = EnumSet.noneOf(InferenceBound.class);
-            Map<InferenceBound, List<Type>> bounds2 = new EnumMap<InferenceBound, List<Type>>(InferenceBound.class);
-            for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
-                InferenceBound ib = _entry.getKey();
-                List<Type> prevBounds = _entry.getValue();
-                List<Type> newBounds = types.subst(prevBounds, from, to);
-                bounds2.put(ib, newBounds);
-                if (prevBounds != newBounds) {
-                    changed.add(ib);
+            List<Type> instVars = from.diff(to);
+            //if set of instantiated ivars is empty, there's nothing to do!
+            if (instVars.isEmpty()) return;
+            final EnumSet<InferenceBound> boundsChanged = EnumSet.noneOf(InferenceBound.class);
+            UndetVarListener prevListener = listener;
+            try {
+                //setup new listener for keeping track of changed bounds
+                listener = new UndetVarListener() {
+                    public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
+                        boundsChanged.addAll(ibs);
+                    }
+                };
+                for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
+                    InferenceBound ib = _entry.getKey();
+                    List<Type> prevBounds = _entry.getValue();
+                    ListBuffer<Type> newBounds = ListBuffer.lb();
+                    ListBuffer<Type> deps = ListBuffer.lb();
+                    //step 1 - re-add bounds that are not dependent on ivars
+                    for (Type t : prevBounds) {
+                        if (!t.containsAny(instVars)) {
+                            newBounds.append(t);
+                        } else {
+                            deps.append(t);
+                        }
+                    }
+                    //step 2 - replace bounds
+                    bounds.put(ib, newBounds.toList());
+                    //step 3 - for each dependency, add new replaced bound
+                    for (Type dep : deps) {
+                        addBound(ib, types.subst(dep, from, to), types);
+                    }
                 }
-            }
-            if (!changed.isEmpty()) {
-                bounds = bounds2;
-                notifyChange(changed);
+            } finally {
+                listener = prevListener;
+                if (!boundsChanged.isEmpty()) {
+                    notifyChange(boundsChanged);
+                }
             }
         }
 
@@ -1435,7 +1535,7 @@
         }
 
         public Type constType(Object constValue) { return this; }
-        public Type getEnclosingType()          { return this; }
+        public Type getEnclosingType()           { return this; }
         public Type getReturnType()              { return this; }
         public Type asSub(Symbol sym)            { return this; }
         public Type map(Mapping f)               { return this; }
@@ -1461,11 +1561,180 @@
         }
     }
 
+    public static class AnnotatedType extends Type
+            implements
+                javax.lang.model.type.ArrayType,
+                javax.lang.model.type.DeclaredType,
+                javax.lang.model.type.PrimitiveType,
+                javax.lang.model.type.TypeVariable,
+                javax.lang.model.type.WildcardType {
+        /** The type annotations on this type.
+         */
+        public List<Attribute.TypeCompound> typeAnnotations;
+
+        /** The underlying type that is annotated.
+         */
+        public Type underlyingType;
+
+        public AnnotatedType(Type underlyingType) {
+            super(underlyingType.tag, 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,
+                Type underlyingType) {
+            super(underlyingType.tag, underlyingType.tsym);
+            this.typeAnnotations = typeAnnotations;
+            this.underlyingType = underlyingType;
+            Assert.check(!underlyingType.isAnnotated(),
+                    "Can't annotate already annotated type: " + underlyingType +
+                    "; adding: " + typeAnnotations);
+        }
+
+        @Override
+        public boolean isAnnotated() {
+            return true;
+        }
+
+        @Override
+        public List<? extends 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() {
+            return underlyingType.getKind();
+        }
+
+        @Override
+        public Type unannotatedType() {
+            return underlyingType;
+        }
+
+        @Override
+        public <R,S> R accept(Type.Visitor<R,S> v, S s) {
+            return v.visitAnnotatedType(this, s);
+        }
+
+        @Override
+        public <R, P> R accept(TypeVisitor<R, P> v, P p) {
+            return underlyingType.accept(v, p);
+        }
+
+        @Override
+        public Type map(Mapping f) {
+            underlyingType.map(f);
+            return this;
+        }
+
+        @Override
+        public Type constType(Object constValue) { return underlyingType.constType(constValue); }
+        @Override
+        public Type getEnclosingType()           { return underlyingType.getEnclosingType(); }
+
+        @Override
+        public Type getReturnType()              { return underlyingType.getReturnType(); }
+        @Override
+        public List<Type> getTypeArguments()     { return underlyingType.getTypeArguments(); }
+        @Override
+        public List<Type> getParameterTypes()    { return underlyingType.getParameterTypes(); }
+        @Override
+        public Type getReceiverType()            { return underlyingType.getReceiverType(); }
+        @Override
+        public List<Type> getThrownTypes()       { return underlyingType.getThrownTypes(); }
+        @Override
+        public Type getUpperBound()              { return underlyingType.getUpperBound(); }
+        @Override
+        public Type getLowerBound()              { return underlyingType.getLowerBound(); }
+
+        @Override
+        public boolean isErroneous()             { return underlyingType.isErroneous(); }
+        @Override
+        public boolean isCompound()              { return underlyingType.isCompound(); }
+        @Override
+        public boolean isInterface()             { return underlyingType.isInterface(); }
+        @Override
+        public List<Type> allparams()            { return underlyingType.allparams(); }
+        @Override
+        public boolean isNumeric()               { return underlyingType.isNumeric(); }
+        @Override
+        public boolean isReference()             { return underlyingType.isReference(); }
+        @Override
+        public boolean isParameterized()         { return underlyingType.isParameterized(); }
+        @Override
+        public boolean isRaw()                   { return underlyingType.isRaw(); }
+        @Override
+        public boolean isFinal()                 { return underlyingType.isFinal(); }
+        @Override
+        public boolean isSuperBound()            { return underlyingType.isSuperBound(); }
+        @Override
+        public boolean isExtendsBound()          { return underlyingType.isExtendsBound(); }
+        @Override
+        public boolean isUnbound()               { return underlyingType.isUnbound(); }
+
+        @Override
+        public String toString() {
+            // TODO more logic for arrays, etc.
+            if (typeAnnotations != null &&
+                    !typeAnnotations.isEmpty()) {
+                return "(" + typeAnnotations.toString() + " :: " + underlyingType.toString() + ")";
+            } else {
+                return "({} :: " + underlyingType.toString() +")";
+            }
+        }
+
+        @Override
+        public boolean contains(Type t)          { return underlyingType.contains(t); }
+
+        // TODO: attach annotations?
+        @Override
+        public Type withTypeVar(Type t)          { return underlyingType.withTypeVar(t); }
+
+        // TODO: attach annotations?
+        @Override
+        public TypeSymbol asElement()            { return underlyingType.asElement(); }
+
+        // TODO: attach annotations?
+        @Override
+        public MethodType asMethodType()         { return underlyingType.asMethodType(); }
+
+        @Override
+        public void complete()                   { underlyingType.complete(); }
+
+        @Override
+        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;
+        }
+
+        @Override
+        public TypeMirror getExtendsBound()      { return ((WildcardType)underlyingType).getExtendsBound(); }
+        @Override
+        public TypeMirror getSuperBound()        { return ((WildcardType)underlyingType).getSuperBound(); }
+    }
+
     /**
      * A visitor for types.  A visitor is used to implement operations
      * (or relations) on types.  Most common operations on types are
      * binary relations and this interface is designed for binary
-     * relations, that is, operations on the form
+     * relations, that is, operations of the form
      * Type&nbsp;&times;&nbsp;S&nbsp;&rarr;&nbsp;R.
      * <!-- In plain text: Type x S -> R -->
      *
@@ -1486,6 +1755,7 @@
         R visitForAll(ForAll t, S s);
         R visitUndetVar(UndetVar t, S s);
         R visitErrorType(ErrorType t, S s);
+        R visitAnnotatedType(AnnotatedType t, S s);
         R visitType(Type t, S s);
     }
 }
--- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -25,6 +25,8 @@
 
 package com.sun.tools.javac.code;
 
+import java.util.Iterator;
+
 import com.sun.tools.javac.util.*;
 
 /** A type annotation position.
@@ -34,17 +36,98 @@
 *  This code and its internal interfaces are subject to change or
 *  deletion without notice.</b>
 */
+// Code duplicated in com.sun.tools.classfile.TypeAnnotation.Position
 public class TypeAnnotationPosition {
 
+    public enum TypePathEntryKind {
+        ARRAY(0),
+        INNER_TYPE(1),
+        WILDCARD(2),
+        TYPE_ARGUMENT(3);
+
+        public final int tag;
+
+        private TypePathEntryKind(int tag) {
+            this.tag = tag;
+        }
+    }
+
+    public static class TypePathEntry {
+        /** The fixed number of bytes per TypePathEntry. */
+        public static final int bytesPerEntry = 2;
+
+        public final TypePathEntryKind tag;
+        public final int arg;
+
+        public static final TypePathEntry ARRAY = new TypePathEntry(TypePathEntryKind.ARRAY);
+        public static final TypePathEntry INNER_TYPE = new TypePathEntry(TypePathEntryKind.INNER_TYPE);
+        public static final TypePathEntry WILDCARD = new TypePathEntry(TypePathEntryKind.WILDCARD);
+
+        private TypePathEntry(TypePathEntryKind tag) {
+            Assert.check(tag == TypePathEntryKind.ARRAY ||
+                    tag == TypePathEntryKind.INNER_TYPE ||
+                    tag == TypePathEntryKind.WILDCARD,
+                    "Invalid TypePathEntryKind: " + tag);
+            this.tag = tag;
+            this.arg = 0;
+        }
+
+        public TypePathEntry(TypePathEntryKind tag, int arg) {
+            Assert.check(tag == TypePathEntryKind.TYPE_ARGUMENT,
+                    "Invalid TypePathEntryKind: " + tag);
+            this.tag = tag;
+            this.arg = arg;
+        }
+
+        public static TypePathEntry fromBinary(int tag, int arg) {
+            Assert.check(arg == 0 || tag == TypePathEntryKind.TYPE_ARGUMENT.tag,
+                    "Invalid TypePathEntry tag/arg: " + tag + "/" + arg);
+            switch (tag) {
+            case 0:
+                return ARRAY;
+            case 1:
+                return INNER_TYPE;
+            case 2:
+                return WILDCARD;
+            case 3:
+                return new TypePathEntry(TypePathEntryKind.TYPE_ARGUMENT, arg);
+            default:
+                Assert.error("Invalid TypePathEntryKind tag: " + tag);
+                return null;
+            }
+        }
+
+        @Override
+        public String toString() {
+            return tag.toString() +
+                    (tag == TypePathEntryKind.TYPE_ARGUMENT ? ("(" + arg + ")") : "");
+        }
+
+        @Override
+        public boolean equals(Object other) {
+            if (! (other instanceof TypePathEntry)) {
+                return false;
+            }
+            TypePathEntry tpe = (TypePathEntry) other;
+            return this.tag == tpe.tag && this.arg == tpe.arg;
+        }
+
+        @Override
+        public int hashCode() {
+            return this.tag.hashCode() * 17 + this.arg;
+        }
+    }
+
     public TargetType type = TargetType.UNKNOWN;
 
     // For generic/array types.
-    public List<Integer> location = List.nil();
+    public List<TypePathEntry> location = List.nil();
 
     // Tree position.
     public int pos = -1;
 
-    // For typecasts, type tests, new (and locals, as start_pc).
+    // For type casts, type tests, new, locals (as start_pc),
+    // and method and constructor reference type arguments.
     public boolean isValidOffset = false;
     public int offset = -1;
 
@@ -59,11 +142,13 @@
     // For type parameter and method parameter
     public int parameter_index = Integer.MIN_VALUE;
 
-    // For class extends, implements, and throws classes
+    // For class extends, implements, and throws clauses
     public int type_index = Integer.MIN_VALUE;
 
-    // For wildcards
-    public TypeAnnotationPosition wildcard_position = null;
+    // For exception parameters, index into exception table
+    public int exception_index = Integer.MIN_VALUE;
+
+    public TypeAnnotationPosition() {}
 
     @Override
     public String toString() {
@@ -72,27 +157,28 @@
         sb.append(type);
 
         switch (type) {
-        // type case
-        case TYPECAST:
-        case TYPECAST_GENERIC_OR_ARRAY:
-            // object creation
+        // instanceof
         case INSTANCEOF:
-        case INSTANCEOF_GENERIC_OR_ARRAY:
-            // new expression
+        // new expression
         case NEW:
-        case NEW_GENERIC_OR_ARRAY:
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
             sb.append(", offset = ");
             sb.append(offset);
             break;
-            // local variable
+        // local variable
         case LOCAL_VARIABLE:
-        case LOCAL_VARIABLE_GENERIC_OR_ARRAY:
+        // resource variable
+        case RESOURCE_VARIABLE:
+            if (lvarOffset == null) {
+                sb.append(", lvarOffset is null!");
+                break;
+            }
             sb.append(", {");
             for (int i = 0; i < lvarOffset.length; ++i) {
                 if (i != 0) sb.append("; ");
-                sb.append(", start_pc = ");
+                sb.append("start_pc = ");
                 sb.append(lvarOffset[i]);
                 sb.append(", length = ");
                 sb.append(lvarLength[i]);
@@ -101,73 +187,69 @@
             }
             sb.append("}");
             break;
-            // method receiver
+        // method receiver
         case METHOD_RECEIVER:
             // Do nothing
             break;
-            // type parameters
+        // type parameter
         case CLASS_TYPE_PARAMETER:
         case METHOD_TYPE_PARAMETER:
             sb.append(", param_index = ");
             sb.append(parameter_index);
             break;
-            // type parameters bound
+        // type parameter bound
         case CLASS_TYPE_PARAMETER_BOUND:
-        case CLASS_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
         case METHOD_TYPE_PARAMETER_BOUND:
-        case METHOD_TYPE_PARAMETER_BOUND_GENERIC_OR_ARRAY:
             sb.append(", param_index = ");
             sb.append(parameter_index);
             sb.append(", bound_index = ");
             sb.append(bound_index);
             break;
-            // wildcard
-        case WILDCARD_BOUND:
-        case WILDCARD_BOUND_GENERIC_OR_ARRAY:
-            sb.append(", wild_card = ");
-            sb.append(wildcard_position);
-            break;
-            // Class extends and implements clauses
+        // class extends or implements clause
         case CLASS_EXTENDS:
-        case CLASS_EXTENDS_GENERIC_OR_ARRAY:
             sb.append(", type_index = ");
             sb.append(type_index);
             break;
-            // throws
+        // throws
         case THROWS:
             sb.append(", type_index = ");
             sb.append(type_index);
             break;
-        case CLASS_LITERAL:
-        case CLASS_LITERAL_GENERIC_OR_ARRAY:
-            sb.append(", offset = ");
-            sb.append(offset);
+        // exception parameter
+        case EXCEPTION_PARAMETER:
+            sb.append(", exception_index = ");
+            sb.append(exception_index);
             break;
-            // method parameter: not specified
-        case METHOD_PARAMETER_GENERIC_OR_ARRAY:
+        // method parameter
+        case METHOD_FORMAL_PARAMETER:
             sb.append(", param_index = ");
             sb.append(parameter_index);
             break;
-            // method type argument: wasn't specified
-        case METHOD_TYPE_ARGUMENT:
-        case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
+        // type cast
+        case CAST:
+        // method/constructor/reference type argument
+        case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+        case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+        case METHOD_REFERENCE_TYPE_ARGUMENT:
             sb.append(", offset = ");
             sb.append(offset);
             sb.append(", type_index = ");
             sb.append(type_index);
             break;
-            // We don't need to worry abut these
-        case METHOD_RETURN_GENERIC_OR_ARRAY:
-        case FIELD_GENERIC_OR_ARRAY:
+        // We don't need to worry about these
+        case METHOD_RETURN:
+        case FIELD:
             break;
         case UNKNOWN:
+            sb.append(", position UNKNOWN!");
             break;
         default:
-            //                throw new AssertionError("unknown type: " + type);
+            Assert.error("Unknown target type: " + type);
         }
 
         // Append location data for generics/arrays.
-        if (type.hasLocation()) {
+        if (!location.isEmpty()) {
             sb.append(", location = (");
             sb.append(location);
             sb.append(")");
@@ -186,10 +268,33 @@
      * @return true if the target has not been optimized away
      */
     public boolean emitToClassfile() {
-        if (type == TargetType.WILDCARD_BOUND
-            || type == TargetType.WILDCARD_BOUND_GENERIC_OR_ARRAY)
-            return wildcard_position.isValidOffset;
-        else
-            return !type.isLocal() || isValidOffset;
+        return !type.isLocal() || isValidOffset;
+    }
+
+    /**
+     * Decode the binary representation for a type path and set
+     * the {@code location} field.
+     *
+     * @param list The bytecode representation of the type path.
+     */
+    public static List<TypePathEntry> getTypePathFromBinary(java.util.List<Integer> list) {
+        ListBuffer<TypePathEntry> loc = ListBuffer.lb();
+        Iterator<Integer> iter = list.iterator();
+        while (iter.hasNext()) {
+            Integer fst = iter.next();
+            Assert.check(iter.hasNext(), "Could not decode type path: " + list);
+            Integer snd = iter.next();
+            loc = loc.append(TypePathEntry.fromBinary(fst, snd));
+        }
+        return loc.toList();
+    }
+
+    public static List<Integer> getBinaryFromTypePath(java.util.List<TypePathEntry> locs) {
+        ListBuffer<Integer> loc = ListBuffer.lb();
+        for (TypePathEntry tpe : locs) {
+            loc = loc.append(tpe.tag.tag);
+            loc = loc.append(tpe.arg);
+        }
+        return loc.toList();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,1095 @@
+/*
+ * 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.  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 javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.type.TypeKind;
+
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Attribute.TypeCompound;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Type.AnnotatedType;
+import com.sun.tools.javac.code.Type.ArrayType;
+import com.sun.tools.javac.code.Type.CapturedType;
+import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.code.Type.ErrorType;
+import com.sun.tools.javac.code.Type.ForAll;
+import com.sun.tools.javac.code.Type.MethodType;
+import com.sun.tools.javac.code.Type.PackageType;
+import com.sun.tools.javac.code.Type.TypeVar;
+import com.sun.tools.javac.code.Type.UndetVar;
+import com.sun.tools.javac.code.Type.Visitor;
+import com.sun.tools.javac.code.Type.WildcardType;
+import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntry;
+import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntryKind;
+import com.sun.tools.javac.code.TypeTag;
+import com.sun.tools.javac.code.Symbol.VarSymbol;
+import com.sun.tools.javac.comp.Annotate.Annotator;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCBlock;
+import com.sun.tools.javac.tree.JCTree.JCClassDecl;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
+import com.sun.tools.javac.tree.JCTree.JCTypeApply;
+import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
+import com.sun.tools.javac.tree.TreeScanner;
+import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Names;
+
+/**
+ * Contains operations specific to processing type annotations.
+ * This class has two functions:
+ * separate declaration from type annotations and insert the type
+ * annotations to their types;
+ * and determine the TypeAnnotationPositions for all type annotations.
+ */
+public class TypeAnnotations {
+    // Class cannot be instantiated.
+    private TypeAnnotations() {}
+
+    /**
+     * Separate type annotations from declaration annotations and
+     * determine the correct positions for type annotations.
+     * This version only visits types in signatures and should be
+     * called from MemberEnter.
+     * The method returns the Annotator object that should be added
+     * to the correct Annotate queue for later processing.
+     */
+    public static Annotator organizeTypeAnnotationsSignatures(final Symtab syms, final Names names,
+            final Log log, final JCClassDecl tree) {
+        return new Annotator() {
+            @Override
+            public void enterAnnotation() {
+                new TypeAnnotationPositions(syms, names, log, true).scan(tree);
+            }
+        };
+    }
+
+    /**
+     * This version only visits types in bodies, that is, field initializers,
+     * top-level blocks, and method bodies, and should be called from Attr.
+     */
+    public static void organizeTypeAnnotationsBodies(Symtab syms, Names names, Log log, JCClassDecl tree) {
+        new TypeAnnotationPositions(syms, names, log, false).scan(tree);
+    }
+
+    private static class TypeAnnotationPositions extends TreeScanner {
+
+        private enum AnnotationType { DECLARATION, TYPE, BOTH };
+
+        private final Symtab syms;
+        private final Names names;
+        private final Log log;
+        private final boolean sigOnly;
+
+        private TypeAnnotationPositions(Symtab syms, Names names, Log log, boolean sigOnly) {
+            this.syms = syms;
+            this.names = names;
+            this.log = log;
+            this.sigOnly = sigOnly;
+        }
+
+        /*
+         * When traversing the AST we keep the "frames" of visited
+         * trees in order to determine the position of annotations.
+         */
+        private ListBuffer<JCTree> frames = ListBuffer.lb();
+
+        protected void push(JCTree t) { frames = frames.prepend(t); }
+        protected JCTree pop() { return frames.next(); }
+        // could this be frames.elems.tail.head?
+        private JCTree peek2() { return frames.toList().tail.head; }
+
+        @Override
+        public void scan(JCTree tree) {
+            push(tree);
+            super.scan(tree);
+            pop();
+        }
+
+        /**
+         * Separates type annotations from declaration annotations.
+         * This step is needed because in certain locations (where declaration
+         * and type annotations can be mixed, e.g. the type of a field)
+         * we never build an JCAnnotatedType. This step finds these
+         * annotations and marks them as if they were part of the type.
+         */
+        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>();
+
+            for (Attribute.Compound a : annotations) {
+                switch (annotationType(a, sym)) {
+                case DECLARATION:
+                    declAnnos.append(a);
+                    break;
+                case BOTH: {
+                    declAnnos.append(a);
+                    Attribute.TypeCompound ta = toTypeCompound(a, pos);
+                    typeAnnos.append(ta);
+                    break;
+                }
+                case TYPE: {
+                    Attribute.TypeCompound ta = toTypeCompound(a, pos);
+                    typeAnnos.append(ta);
+                    break;
+                }
+                }
+            }
+
+            sym.annotations.reset();
+            sym.annotations.setDeclarationAttributes(declAnnos.toList());
+
+            List<Attribute.TypeCompound> typeAnnotations = typeAnnos.toList();
+
+            if (type == null) {
+                // When type is null, put the type annotations to the symbol.
+                // This is used for constructor return annotations, for which
+                // no appropriate type exists.
+                sym.annotations.appendUniqueTypes(typeAnnotations);
+                return;
+            }
+
+            // type is non-null and annotations are added to that type
+            type = typeWithAnnotations(typetree, type, typeAnnotations, log);
+
+            if (sym.getKind() == ElementKind.METHOD) {
+                sym.type.asMethodType().restype = type;
+            } else {
+                sym.type = type;
+            }
+
+            sym.annotations.appendUniqueTypes(typeAnnotations);
+            if (sym.getKind() == ElementKind.PARAMETER &&
+                    sym.getQualifiedName().equals(names._this)) {
+                sym.owner.type.asMethodType().recvtype = type;
+                // note that the typeAnnotations will also be added to the owner below.
+            }
+            if (sym.getKind() == ElementKind.PARAMETER ||
+                    sym.getKind() == ElementKind.LOCAL_VARIABLE ||
+                    sym.getKind() == ElementKind.RESOURCE_VARIABLE ||
+                    sym.getKind() == ElementKind.EXCEPTION_PARAMETER) {
+                // Make sure all type annotations from the symbol are also
+                // on the owner.
+                sym.owner.annotations.appendUniqueTypes(sym.getTypeAnnotationMirrors());
+            }
+        }
+
+        // This method has a similar purpose as
+        // {@link com.sun.tools.javac.parser.JavacParser.insertAnnotationsToMostInner(JCExpression, List<JCTypeAnnotation>, boolean)}
+        // We found a type annotation in a declaration annotation position,
+        // for example, on the return type.
+        // Such an annotation is _not_ part of an JCAnnotatedType tree and we therefore
+        // need to set its position explicitly.
+        // The method returns a copy of type that contains these annotations.
+        //
+        // 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 static Type typeWithAnnotations(final JCTree typetree, final Type type,
+                final List<Attribute.TypeCompound> annotations, Log log) {
+            // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s)%n",
+            //         typetree, type, annotations);
+            if (annotations.isEmpty()) {
+                return type;
+            }
+            if (type.hasTag(TypeTag.ARRAY)) {
+                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;
+                    }
+                }
+                JCArrayTypeTree arTree = arrayTypeTree(typetree);
+
+                ListBuffer<TypePathEntry> depth = ListBuffer.lb();
+                depth = depth.append(TypePathEntry.ARRAY);
+                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;
+                        tomodify = new Type.ArrayType(null, arType.tsym);
+                        newAT.underlyingType = tomodify;
+                    } else {
+                        arType = (Type.ArrayType) arType.elemtype;
+                        tomodify.elemtype = new Type.ArrayType(null, arType.tsym);
+                        tomodify = (Type.ArrayType) tomodify.elemtype;
+                    }
+                    arTree = arrayTypeTree(arTree.elemtype);
+                    depth = depth.append(TypePathEntry.ARRAY);
+                }
+                Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations, log);
+                tomodify.elemtype = arelemType;
+                {
+                    // All annotations share the same position; modify the first one.
+                    Attribute.TypeCompound a = annotations.get(0);
+                    TypeAnnotationPosition p = a.position;
+                    p.location = p.location.prependList(depth.toList());
+                }
+                return toreturn;
+            } else if (type.hasTag(TypeTag.TYPEVAR)) {
+                // Nothing to do for type variables.
+                return type;
+            } else {
+                Type enclTy = type;
+                Element enclEl = type.asElement();
+                JCTree enclTr = typetree;
+
+                while (enclEl != null &&
+                        enclEl.getKind() != ElementKind.PACKAGE &&
+                        enclTy != null &&
+                        enclTy.getKind() != TypeKind.NONE &&
+                        enclTy.getKind() != TypeKind.ERROR &&
+                        (enclTr.getKind() == JCTree.Kind.MEMBER_SELECT ||
+                         enclTr.getKind() == JCTree.Kind.PARAMETERIZED_TYPE ||
+                         enclTr.getKind() == JCTree.Kind.ANNOTATED_TYPE)) {
+                    // Iterate also over the type tree, not just the type: the type is already
+                    // completely resolved and we cannot distinguish where the annotation
+                    // belongs for a nested type.
+                    if (enclTr.getKind() == JCTree.Kind.MEMBER_SELECT) {
+                        // only change encl in this case.
+                        enclTy = enclTy.getEnclosingType();
+                        enclEl = enclEl.getEnclosingElement();
+                        enclTr = ((JCFieldAccess)enclTr).getExpression();
+                    } else if (enclTr.getKind() == JCTree.Kind.PARAMETERIZED_TYPE) {
+                        enclTr = ((JCTypeApply)enclTr).getType();
+                    } else {
+                        // only other option because of while condition
+                        enclTr = ((JCAnnotatedType)enclTr).getUnderlyingType();
+                    }
+                }
+
+                /** We are trying to annotate some enclosing type,
+                 * 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());
+                    return type;
+                }
+
+                // At this point we have visited the part of the nested
+                // type that is written in the source code.
+                // Now count from here to the actual top-level class to determine
+                // the correct nesting.
+
+                // The genericLocation for the annotation.
+                ListBuffer<TypePathEntry> depth = ListBuffer.lb();
+
+                Type topTy = enclTy;
+                while (enclEl != null &&
+                        enclEl.getKind() != ElementKind.PACKAGE &&
+                        topTy != null &&
+                        topTy.getKind() != TypeKind.NONE &&
+                        topTy.getKind() != TypeKind.ERROR) {
+                    topTy = topTy.getEnclosingType();
+                    enclEl = enclEl.getEnclosingElement();
+
+                    if (topTy != null && topTy.getKind() != TypeKind.NONE) {
+                        // Only count enclosing types.
+                        depth = depth.append(TypePathEntry.INNER_TYPE);
+                    }
+                }
+
+                if (depth.nonEmpty()) {
+                    // Only need to change the annotation positions
+                    // if they are on an enclosed type.
+                    // All annotations share the same position; modify the first one.
+                    Attribute.TypeCompound a = annotations.get(0);
+                    TypeAnnotationPosition p = a.position;
+                    p.location = p.location.appendList(depth.toList());
+                }
+
+                Type ret = typeWithAnnotations(type, enclTy, annotations);
+                return ret;
+            }
+        }
+
+        private static JCArrayTypeTree arrayTypeTree(JCTree typetree) {
+            if (typetree.getKind() == JCTree.Kind.ARRAY_TYPE) {
+                return (JCArrayTypeTree) typetree;
+            } else if (typetree.getKind() == JCTree.Kind.ANNOTATED_TYPE) {
+                return (JCArrayTypeTree) ((JCAnnotatedType)typetree).underlyingType;
+            } else {
+                Assert.error("Could not determine array type from type tree: " + typetree);
+                return null;
+            }
+        }
+
+        /** Return a copy of the first type that only differs by
+         * inserting the annotations to the left-most/inner-most type
+         * or the type given by stopAt.
+         *
+         * We need the stopAt parameter to know where on a type to
+         * put the annotations.
+         * If we have nested classes Outer > Middle > Inner, and we
+         * have the source type "@A Middle.Inner", we will invoke
+         * this method with type = Outer.Middle.Inner,
+         * stopAt = Middle.Inner, and annotations = @A.
+         *
+         * @param type The type to copy.
+         * @param stopAt The type to stop at.
+         * @param annotations The annotations to insert.
+         * @return A copy of type that contains the annotations.
+         */
+        private static Type typeWithAnnotations(final Type type,
+                final Type stopAt,
+                final List<Attribute.TypeCompound> annotations) {
+            Visitor<Type, List<TypeCompound>> visitor =
+                    new Type.Visitor<Type, List<Attribute.TypeCompound>>() {
+                @Override
+                public Type visitClassType(ClassType t, List<TypeCompound> s) {
+                    // assert that t.constValue() == null?
+                    if (t == stopAt ||
+                        t.getEnclosingType() == Type.noType) {
+                        return new AnnotatedType(s, t);
+                    } else {
+                        ClassType ret = new ClassType(t.getEnclosingType().accept(this, s),
+                                t.typarams_field, t.tsym);
+                        ret.all_interfaces_field = t.all_interfaces_field;
+                        ret.allparams_field = t.allparams_field;
+                        ret.interfaces_field = t.interfaces_field;
+                        ret.rank_field = t.rank_field;
+                        ret.supertype_field = t.supertype_field;
+                        return ret;
+                    }
+                }
+
+                @Override
+                public Type visitAnnotatedType(AnnotatedType t, List<TypeCompound> s) {
+                    return new AnnotatedType(t.typeAnnotations, t.underlyingType.accept(this, s));
+                }
+
+                @Override
+                public Type visitWildcardType(WildcardType t, List<TypeCompound> s) {
+                    return new AnnotatedType(s, t);
+                }
+
+                @Override
+                public Type visitArrayType(ArrayType t, List<TypeCompound> s) {
+                    ArrayType ret = new ArrayType(t.elemtype.accept(this, s), t.tsym);
+                    return ret;
+                }
+
+                @Override
+                public Type visitMethodType(MethodType t, List<TypeCompound> s) {
+                    // Impossible?
+                    return t;
+                }
+
+                @Override
+                public Type visitPackageType(PackageType t, List<TypeCompound> s) {
+                    // Impossible?
+                    return t;
+                }
+
+                @Override
+                public Type visitTypeVar(TypeVar t, List<TypeCompound> s) {
+                    return new AnnotatedType(s, t);
+                }
+
+                @Override
+                public Type visitCapturedType(CapturedType t, List<TypeCompound> s) {
+                    return new AnnotatedType(s, t);
+                }
+
+                @Override
+                public Type visitForAll(ForAll t, List<TypeCompound> s) {
+                    // Impossible?
+                    return t;
+                }
+
+                @Override
+                public Type visitUndetVar(UndetVar t, List<TypeCompound> s) {
+                    // Impossible?
+                    return t;
+                }
+
+                @Override
+                public Type visitErrorType(ErrorType t, List<TypeCompound> s) {
+                    return new AnnotatedType(s, t);
+                }
+
+                @Override
+                public Type visitType(Type t, List<TypeCompound> s) {
+                    return new AnnotatedType(s, t);
+                }
+            };
+
+            return type.accept(visitor, annotations);
+        }
+
+        private static Attribute.TypeCompound toTypeCompound(Attribute.Compound a, TypeAnnotationPosition p) {
+            // It is safe to alias the position.
+            return new Attribute.TypeCompound(a, p);
+        }
+
+        private AnnotationType annotationType(Attribute.Compound a, Symbol s) {
+            Attribute.Compound atTarget =
+                a.type.tsym.attribute(syms.annotationTargetType.tsym);
+            if (atTarget == null) {
+                return inferTargetMetaInfo(a, s);
+            }
+            Attribute atValue = atTarget.member(names.value);
+            if (!(atValue instanceof Attribute.Array)) {
+                Assert.error("annotationType(): bad @Target argument " + atValue +
+                        " (" + atValue.getClass() + ")");
+                return AnnotationType.DECLARATION; // error recovery
+            }
+            Attribute.Array arr = (Attribute.Array) atValue;
+            boolean isDecl = false, isType = false;
+            for (Attribute app : arr.values) {
+                if (!(app instanceof Attribute.Enum)) {
+                    Assert.error("annotationType(): unrecognized Attribute kind " + app +
+                            " (" + app.getClass() + ")");
+                    isDecl = true;
+                    continue;
+                }
+                Attribute.Enum e = (Attribute.Enum) app;
+                if (e.value.name == names.TYPE) {
+                    if (s.kind == Kinds.TYP)
+                        isDecl = true;
+                } else if (e.value.name == names.FIELD) {
+                    if (s.kind == Kinds.VAR &&
+                            s.owner.kind != Kinds.MTH)
+                        isDecl = true;
+                } else if (e.value.name == names.METHOD) {
+                    if (s.kind == Kinds.MTH &&
+                            !s.isConstructor())
+                        isDecl = true;
+                } else if (e.value.name == names.PARAMETER) {
+                    if (s.kind == Kinds.VAR &&
+                            s.owner.kind == Kinds.MTH &&
+                            (s.flags() & Flags.PARAMETER) != 0)
+                        isDecl = true;
+                } else if (e.value.name == names.CONSTRUCTOR) {
+                    if (s.kind == Kinds.MTH &&
+                            s.isConstructor())
+                        isDecl = true;
+                } else if (e.value.name == names.LOCAL_VARIABLE) {
+                    if (s.kind == Kinds.VAR &&
+                            s.owner.kind == Kinds.MTH &&
+                            (s.flags() & Flags.PARAMETER) == 0)
+                        isDecl = true;
+                } else if (e.value.name == names.ANNOTATION_TYPE) {
+                    if (s.kind == Kinds.TYP &&
+                            (s.flags() & Flags.ANNOTATION) != 0)
+                        isDecl = true;
+                } else if (e.value.name == names.PACKAGE) {
+                    if (s.kind == Kinds.PCK)
+                        isDecl = true;
+                } else if (e.value.name == names.TYPE_USE) {
+                    if (s.kind == Kinds.TYP ||
+                            s.kind == Kinds.VAR ||
+                            (s.kind == Kinds.MTH && !s.isConstructor() &&
+                            !s.type.getReturnType().hasTag(TypeTag.VOID)) ||
+                            (s.kind == Kinds.MTH && s.isConstructor()))
+                        isType = true;
+                } else if (e.value.name == names.TYPE_PARAMETER) {
+                    /* Irrelevant in this case */
+                    // TYPE_PARAMETER doesn't aid in distinguishing between
+                    // Type annotations and declaration annotations on an
+                    // Element
+                } else {
+                    Assert.error("annotationType(): unrecognized Attribute name " + e.value.name +
+                            " (" + e.value.name.getClass() + ")");
+                    isDecl = true;
+                }
+            }
+            if (isDecl && isType) {
+                return AnnotationType.BOTH;
+            } else if (isType) {
+                return AnnotationType.TYPE;
+            } else {
+                return AnnotationType.DECLARATION;
+            }
+        }
+
+        /** Infer the target annotation kind, if none is give.
+         * We only infer declaration annotations.
+         */
+        private static AnnotationType inferTargetMetaInfo(Attribute.Compound a, Symbol s) {
+            return AnnotationType.DECLARATION;
+        }
+
+
+        /* This is the beginning of the second part of organizing
+         * type annotations: determine the type annotation positions.
+         */
+
+        private void resolveFrame(JCTree tree, JCTree frame,
+                List<JCTree> path, TypeAnnotationPosition p) {
+            /*
+            System.out.println("Resolving tree: " + tree + " kind: " + tree.getKind());
+            System.out.println("    Framing tree: " + frame + " kind: " + frame.getKind());
+            */
+
+            // Note that p.offset is set in
+            // com.sun.tools.javac.jvm.Gen.setTypeAnnotationPositions(int)
+
+            switch (frame.getKind()) {
+                case TYPE_CAST:
+                    p.type = TargetType.CAST;
+                    p.pos = frame.pos;
+                    return;
+
+                case INSTANCE_OF:
+                    p.type = TargetType.INSTANCEOF;
+                    p.pos = frame.pos;
+                    return;
+
+                case NEW_CLASS:
+                    JCNewClass frameNewClass = (JCNewClass)frame;
+                    if (frameNewClass.typeargs.contains(tree)) {
+                        p.type = TargetType.CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT;
+                        p.type_index = frameNewClass.typeargs.indexOf(tree);
+                    } else {
+                        p.type = TargetType.NEW;
+                    }
+                    p.pos = frame.pos;
+                    return;
+
+                case NEW_ARRAY:
+                    p.type = TargetType.NEW;
+                    p.pos = frame.pos;
+                    return;
+
+                case ANNOTATION_TYPE:
+                case CLASS:
+                case ENUM:
+                case INTERFACE:
+                    p.pos = frame.pos;
+                    if (((JCClassDecl)frame).extending == tree) {
+                        p.type = TargetType.CLASS_EXTENDS;
+                        p.type_index = -1;
+                    } else if (((JCClassDecl)frame).implementing.contains(tree)) {
+                        p.type = TargetType.CLASS_EXTENDS;
+                        p.type_index = ((JCClassDecl)frame).implementing.indexOf(tree);
+                    } else if (((JCClassDecl)frame).typarams.contains(tree)) {
+                        p.type = TargetType.CLASS_TYPE_PARAMETER;
+                        p.parameter_index = ((JCClassDecl)frame).typarams.indexOf(tree);
+                    } else {
+                        Assert.error("Could not determine position of tree " + tree +
+                                " within frame " + frame);
+                    }
+                    return;
+
+                case METHOD: {
+                    JCMethodDecl frameMethod = (JCMethodDecl) frame;
+                    p.pos = frame.pos;
+                    if (frameMethod.thrown.contains(tree)) {
+                        p.type = TargetType.THROWS;
+                        p.type_index = frameMethod.thrown.indexOf(tree);
+                    } else if (frameMethod.restype == tree) {
+                        p.type = TargetType.METHOD_RETURN;
+                    } else if (frameMethod.typarams.contains(tree)) {
+                        p.type = TargetType.METHOD_TYPE_PARAMETER;
+                        p.parameter_index = frameMethod.typarams.indexOf(tree);
+                    } else {
+                        Assert.error("Could not determine position of tree " + tree +
+                                " within frame " + frame);
+                    }
+                    return;
+                }
+
+                case PARAMETERIZED_TYPE: {
+                    if (((JCTypeApply)frame).clazz == tree) {
+                        // generic: RAW; noop
+                    } else if (((JCTypeApply)frame).arguments.contains(tree)) {
+                        JCTypeApply taframe = (JCTypeApply) frame;
+                        int arg = taframe.arguments.indexOf(tree);
+                        p.location = p.location.prepend(new TypePathEntry(TypePathEntryKind.TYPE_ARGUMENT, arg));
+
+                        locateNestedTypes(taframe.type, p);
+                    } else {
+                        Assert.error("Could not determine type argument position of tree " + tree +
+                                " within frame " + frame);
+                    }
+
+                    List<JCTree> newPath = path.tail;
+                    resolveFrame(newPath.head, newPath.tail.head, newPath, p);
+                    return;
+                }
+
+                case MEMBER_REFERENCE: {
+                    JCMemberReference mrframe = (JCMemberReference) frame;
+
+                    if (mrframe.expr == tree) {
+                        switch (mrframe.mode) {
+                        case INVOKE:
+                            p.type = TargetType.METHOD_REFERENCE;
+                            break;
+                        case NEW:
+                            p.type = TargetType.CONSTRUCTOR_REFERENCE;
+                            break;
+                        default:
+                            Assert.error("Unknown method reference mode " + mrframe.mode +
+                                    " for tree " + tree + " within frame " + frame);
+                        }
+                        p.pos = frame.pos;
+                    } else if (mrframe.typeargs != null &&
+                            mrframe.typeargs.contains(tree)) {
+                        int arg = mrframe.typeargs.indexOf(tree);
+                        p.type_index = arg;
+                        switch (mrframe.mode) {
+                        case INVOKE:
+                            p.type = TargetType.METHOD_REFERENCE_TYPE_ARGUMENT;
+                            break;
+                        case NEW:
+                            p.type = TargetType.CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT;
+                            break;
+                        default:
+                            Assert.error("Unknown method reference mode " + mrframe.mode +
+                                    " for tree " + tree + " within frame " + frame);
+                        }
+                        p.pos = frame.pos;
+                    } else {
+                        Assert.error("Could not determine type argument position of tree " + tree +
+                                " within frame " + frame);
+                    }
+                    return;
+                }
+
+                case ARRAY_TYPE: {
+                    ListBuffer<TypePathEntry> index = ListBuffer.lb();
+                    index = index.append(TypePathEntry.ARRAY);
+                    List<JCTree> newPath = path.tail;
+                    while (true) {
+                        JCTree npHead = newPath.tail.head;
+                        if (npHead.hasTag(JCTree.Tag.TYPEARRAY)) {
+                            newPath = newPath.tail;
+                            index = index.append(TypePathEntry.ARRAY);
+                        } else if (npHead.hasTag(JCTree.Tag.ANNOTATED_TYPE)) {
+                            newPath = newPath.tail;
+                        } else {
+                            break;
+                        }
+                    }
+                    p.location = p.location.prependList(index.toList());
+                    resolveFrame(newPath.head, newPath.tail.head, newPath, p);
+                    return;
+                }
+
+                case TYPE_PARAMETER:
+                    if (path.tail.tail.head.hasTag(JCTree.Tag.CLASSDEF)) {
+                        JCClassDecl clazz = (JCClassDecl)path.tail.tail.head;
+                        p.type = TargetType.CLASS_TYPE_PARAMETER_BOUND;
+                        p.parameter_index = clazz.typarams.indexOf(path.tail.head);
+                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
+                        if (((JCTypeParameter)frame).bounds.get(0).type.isInterface()) {
+                            // Account for an implicit Object as bound 0
+                            p.bound_index += 1;
+                        }
+                    } else if (path.tail.tail.head.hasTag(JCTree.Tag.METHODDEF)) {
+                        JCMethodDecl method = (JCMethodDecl)path.tail.tail.head;
+                        p.type = TargetType.METHOD_TYPE_PARAMETER_BOUND;
+                        p.parameter_index = method.typarams.indexOf(path.tail.head);
+                        p.bound_index = ((JCTypeParameter)frame).bounds.indexOf(tree);
+                        if (((JCTypeParameter)frame).bounds.get(0).type.isInterface()) {
+                            // Account for an implicit Object as bound 0
+                            p.bound_index += 1;
+                        }
+                    } else {
+                        Assert.error("Could not determine position of tree " + tree +
+                                " within frame " + frame);
+                    }
+                    p.pos = frame.pos;
+                    return;
+
+                case VARIABLE:
+                    VarSymbol v = ((JCVariableDecl)frame).sym;
+                    p.pos = frame.pos;
+                    switch (v.getKind()) {
+                        case LOCAL_VARIABLE:
+                            p.type = TargetType.LOCAL_VARIABLE;
+                            break;
+                        case FIELD:
+                            p.type = TargetType.FIELD;
+                            break;
+                        case PARAMETER:
+                            if (v.getQualifiedName().equals(names._this)) {
+                                // TODO: Intro a separate ElementKind?
+                                p.type = TargetType.METHOD_RECEIVER;
+                            } else {
+                                p.type = TargetType.METHOD_FORMAL_PARAMETER;
+                                p.parameter_index = methodParamIndex(path, frame);
+                            }
+                            break;
+                        case EXCEPTION_PARAMETER:
+                            p.type = TargetType.EXCEPTION_PARAMETER;
+                            break;
+                        case RESOURCE_VARIABLE:
+                            p.type = TargetType.RESOURCE_VARIABLE;
+                            break;
+                        default:
+                            Assert.error("Found unexpected type annotation for variable: " + v + " with kind: " + v.getKind());
+                    }
+                    return;
+
+                case ANNOTATED_TYPE: {
+                    if (frame == tree) {
+                        // This is only true for the first annotated type we see.
+                        // For any other annotated types along the path, we do
+                        // not care about inner types.
+                        JCAnnotatedType atypetree = (JCAnnotatedType) frame;
+                        final Type utype = atypetree.underlyingType.type;
+                        Symbol tsym = utype.tsym;
+                        if (tsym.getKind().equals(ElementKind.TYPE_PARAMETER) ||
+                                utype.getKind().equals(TypeKind.WILDCARD) ||
+                                utype.getKind().equals(TypeKind.ARRAY)) {
+                            // Type parameters, wildcards, and arrays have the declaring
+                            // class/method as enclosing elements.
+                            // There is actually nothing to do for them.
+                        } else {
+                            locateNestedTypes(utype, p);
+                        }
+                    }
+                    List<JCTree> newPath = path.tail;
+                    resolveFrame(newPath.head, newPath.tail.head, newPath, p);
+                    return;
+                }
+
+                case UNION_TYPE: {
+                    // TODO: can we store any information here to help in
+                    // determining the final position?
+                    List<JCTree> newPath = path.tail;
+                    resolveFrame(newPath.head, newPath.tail.head, newPath, p);
+                    return;
+                }
+
+                case INTERSECTION_TYPE: {
+                    JCTypeIntersection isect = (JCTypeIntersection)frame;
+                    p.type_index = isect.bounds.indexOf(tree);
+                    List<JCTree> newPath = path.tail;
+                    resolveFrame(newPath.head, newPath.tail.head, newPath, p);
+                    return;
+                }
+
+                case METHOD_INVOCATION: {
+                    JCMethodInvocation invocation = (JCMethodInvocation)frame;
+                    if (!invocation.typeargs.contains(tree)) {
+                        Assert.error("{" + tree + "} is not an argument in the invocation: " + invocation);
+                    }
+                    p.type = TargetType.METHOD_INVOCATION_TYPE_ARGUMENT;
+                    p.pos = invocation.pos;
+                    p.type_index = invocation.typeargs.indexOf(tree);
+                    return;
+                }
+
+                case EXTENDS_WILDCARD:
+                case SUPER_WILDCARD: {
+                    // Annotations in wildcard bounds
+                    p.location = p.location.prepend(TypePathEntry.WILDCARD);
+                    List<JCTree> newPath = path.tail;
+                    resolveFrame(newPath.head, newPath.tail.head, newPath, p);
+                    return;
+                }
+
+                case MEMBER_SELECT: {
+                    List<JCTree> newPath = path.tail;
+                    resolveFrame(newPath.head, newPath.tail.head, newPath, p);
+                    return;
+                }
+
+                default:
+                    Assert.error("Unresolved frame: " + frame + " of kind: " + frame.getKind() +
+                            "\n    Looking for tree: " + tree);
+                    return;
+            }
+        }
+
+        private static void locateNestedTypes(Type type, TypeAnnotationPosition p) {
+            // The number of "steps" to get from the full type to the
+            // left-most outer type.
+            ListBuffer<TypePathEntry> depth = ListBuffer.lb();
+
+            Type encl = type.getEnclosingType();
+            while (encl != null &&
+                    encl.getKind() != TypeKind.NONE &&
+                    encl.getKind() != TypeKind.ERROR) {
+                depth = depth.append(TypePathEntry.INNER_TYPE);
+                encl = encl.getEnclosingType();
+            }
+            if (depth.nonEmpty()) {
+                p.location = p.location.prependList(depth.toList());
+            }
+        }
+
+        private static int methodParamIndex(List<JCTree> path, JCTree param) {
+            List<JCTree> curr = path;
+            while (curr.head.getTag() != Tag.METHODDEF) {
+                curr = curr.tail;
+            }
+            JCMethodDecl method = (JCMethodDecl)curr.head;
+            return method.params.indexOf(param);
+        }
+
+        // Each class (including enclosed inner classes) is visited separately.
+        // This flag is used to prevent from visiting inner classes.
+        private boolean isInClass = false;
+
+        @Override
+        public void visitClassDef(JCClassDecl tree) {
+            if (isInClass)
+                return;
+            isInClass = true;
+            if (sigOnly) {
+                scan(tree.mods);
+                scan(tree.typarams);
+                scan(tree.extending);
+                scan(tree.implementing);
+            }
+            scan(tree.defs);
+        }
+
+        /**
+         * Resolve declaration vs. type annotations in methods and
+         * then determine the positions.
+         */
+        @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;
+            }
+            if (sigOnly) {
+                {
+                    TypeAnnotationPosition pos = new TypeAnnotationPosition();
+                    pos.type = TargetType.METHOD_RETURN;
+                    if (tree.sym.isConstructor()) {
+                        pos.pos = tree.pos;
+                        // Use null to mark that the annotations go with the symbol.
+                        separateAnnotationsKinds(tree, null, tree.sym, pos);
+                    } else {
+                        pos.pos = tree.restype.pos;
+                        separateAnnotationsKinds(tree.restype, tree.sym.type.getReturnType(),
+                                tree.sym, pos);
+                    }
+                }
+                if (tree.recvparam != null && tree.recvparam.sym != null) {
+                    // TODO: make sure there are no declaration annotations.
+                    TypeAnnotationPosition pos = new TypeAnnotationPosition();
+                    pos.type = TargetType.METHOD_RECEIVER;
+                    pos.pos = tree.recvparam.vartype.pos;
+                    separateAnnotationsKinds(tree.recvparam.vartype, tree.recvparam.sym.type,
+                            tree.recvparam.sym, pos);
+                }
+                int i = 0;
+                for (JCVariableDecl param : tree.params) {
+                    TypeAnnotationPosition pos = new TypeAnnotationPosition();
+                    pos.type = TargetType.METHOD_FORMAL_PARAMETER;
+                    pos.parameter_index = i;
+                    pos.pos = param.vartype.pos;
+                    separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos);
+                    ++i;
+                }
+            }
+
+            push(tree);
+            // 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);
+            }
+            pop();
+        }
+
+        /**
+         * Resolve declaration vs. type annotations in variable declarations and
+         * then determine the positions.
+         */
+        @Override
+        public void visitVarDef(final JCVariableDecl tree) {
+            if (tree.sym == null) {
+                // Something is wrong already. Quietly ignore.
+            } else if (tree.sym.getKind() == ElementKind.PARAMETER) {
+                // Parameters are handled in visitMethodDef above.
+            } else if (tree.sym.getKind() == ElementKind.FIELD) {
+                if (sigOnly) {
+                    TypeAnnotationPosition pos = new TypeAnnotationPosition();
+                    pos.type = TargetType.FIELD;
+                    pos.pos = tree.pos;
+                    separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
+                }
+            } else if (tree.sym.getKind() == ElementKind.LOCAL_VARIABLE) {
+                TypeAnnotationPosition pos = new TypeAnnotationPosition();
+                pos.type = TargetType.LOCAL_VARIABLE;
+                pos.pos = tree.pos;
+                separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
+            } else if (tree.sym.getKind() == ElementKind.EXCEPTION_PARAMETER) {
+                TypeAnnotationPosition pos = new TypeAnnotationPosition();
+                pos.type = TargetType.EXCEPTION_PARAMETER;
+                pos.pos = tree.pos;
+                separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
+            } else if (tree.sym.getKind() == ElementKind.RESOURCE_VARIABLE) {
+                TypeAnnotationPosition pos = new TypeAnnotationPosition();
+                pos.type = TargetType.RESOURCE_VARIABLE;
+                pos.pos = tree.pos;
+                separateAnnotationsKinds(tree.vartype, tree.sym.type, tree.sym, pos);
+            } else if (tree.sym.getKind() == ElementKind.ENUM_CONSTANT) {
+                // No type annotations can occur here.
+            } else {
+                // There is nothing else in a variable declaration that needs separation.
+                Assert.error("Unhandled variable kind: " + tree + " of kind: " + tree.sym.getKind());
+            }
+
+            push(tree);
+            // super.visitVarDef(tree);
+            scan(tree.mods);
+            scan(tree.vartype);
+            if (!sigOnly) {
+                scan(tree.init);
+            }
+            pop();
+        }
+
+        @Override
+        public void visitBlock(JCBlock tree) {
+            // Do not descend into top-level blocks when only interested
+            // in the signature.
+            if (!sigOnly) {
+                scan(tree.stats);
+            }
+        }
+
+        @Override
+        public void visitAnnotatedType(JCAnnotatedType tree) {
+            push(tree);
+            findPosition(tree, tree, tree.annotations);
+            pop();
+            super.visitAnnotatedType(tree);
+        }
+
+        @Override
+        public void visitTypeParameter(JCTypeParameter tree) {
+            findPosition(tree, peek2(), tree.annotations);
+            super.visitTypeParameter(tree);
+        }
+
+        @Override
+        public void visitNewArray(JCNewArray tree) {
+            findPosition(tree, tree, tree.annotations);
+            int dimAnnosCount = tree.dimAnnotations.size();
+            ListBuffer<TypePathEntry> depth = ListBuffer.lb();
+
+            // handle annotations associated with dimensions
+            for (int i = 0; i < dimAnnosCount; ++i) {
+                TypeAnnotationPosition p = new TypeAnnotationPosition();
+                p.pos = tree.pos;
+                p.type = TargetType.NEW;
+                if (i != 0) {
+                    depth = depth.append(TypePathEntry.ARRAY);
+                    p.location = p.location.appendList(depth.toList());
+                }
+
+                setTypeAnnotationPos(tree.dimAnnotations.get(i), p);
+            }
+
+            // handle "free" annotations
+            // int i = dimAnnosCount == 0 ? 0 : dimAnnosCount - 1;
+            // TODO: is depth.size == i here?
+            JCExpression elemType = tree.elemtype;
+            while (elemType != null) {
+                if (elemType.hasTag(JCTree.Tag.ANNOTATED_TYPE)) {
+                    JCAnnotatedType at = (JCAnnotatedType)elemType;
+                    TypeAnnotationPosition p = new TypeAnnotationPosition();
+                    p.type = TargetType.NEW;
+                    p.pos = tree.pos;
+                    p.location = p.location.appendList(depth.toList());
+                    setTypeAnnotationPos(at.annotations, p);
+                    elemType = at.underlyingType;
+                } else if (elemType.hasTag(JCTree.Tag.TYPEARRAY)) {
+                    depth = depth.append(TypePathEntry.ARRAY);
+                    elemType = ((JCArrayTypeTree)elemType).elemtype;
+                } else {
+                    break;
+                }
+            }
+            scan(tree.elems);
+        }
+
+        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);
+                System.out.println("    frame: " + frame);
+                */
+                TypeAnnotationPosition p = new TypeAnnotationPosition();
+                resolveFrame(tree, frame, frames.toList(), p);
+                setTypeAnnotationPos(annotations, p);
+            }
+        }
+
+        private static void setTypeAnnotationPos(List<JCAnnotation> annotations,
+                TypeAnnotationPosition position) {
+            for (JCAnnotation anno : annotations) {
+                ((Attribute.TypeCompound) anno.attribute).position = position;
+            }
+        }
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -34,19 +34,21 @@
 import java.util.Set;
 import java.util.WeakHashMap;
 
+import javax.lang.model.type.TypeKind;
+
 import com.sun.tools.javac.code.Attribute.RetentionPolicy;
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
 import com.sun.tools.javac.comp.Check;
 import com.sun.tools.javac.jvm.ClassReader;
 import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.util.List;
 import static com.sun.tools.javac.code.BoundKind.*;
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Scope.*;
 import static com.sun.tools.javac.code.Symbol.*;
 import static com.sun.tools.javac.code.Type.*;
 import static com.sun.tools.javac.code.TypeTag.*;
+import static com.sun.tools.javac.jvm.ClassFile.externalize;
 import static com.sun.tools.javac.util.ListBuffer.lb;
 
 /**
@@ -354,8 +356,14 @@
                 return descSym;
             }
 
-            public Type getType(Type origin) {
-                return memberType(origin, descSym);
+            public Type getType(Type site) {
+                site = removeWildcards(site);
+                if (!chk.checkValidGenericType(site)) {
+                    //if the inferred functional interface type is not well-formed,
+                    //or if it's not a subtype of the original target, issue an error
+                    throw failure(diags.fragment("no.suitable.functional.intf.inst", site));
+                }
+                return memberType(site, descSym);
             }
         }
 
@@ -392,9 +400,9 @@
          * Compute the function descriptor associated with a given functional interface
          */
         public FunctionDescriptor findDescriptorInternal(TypeSymbol origin, CompoundScope membersCache) throws FunctionDescriptorLookupError {
-            if (!origin.isInterface()) {
+            if (!origin.isInterface() || (origin.flags() & ANNOTATION) != 0) {
                 //t must be an interface
-                throw failure("not.a.functional.intf");
+                throw failure("not.a.functional.intf", origin);
             }
 
             final ListBuffer<Symbol> abstracts = ListBuffer.lb();
@@ -406,13 +414,13 @@
                     abstracts.append(sym);
                 } else {
                     //the target method(s) should be the only abstract members of t
-                    throw failure("not.a.functional.intf.1",
+                    throw failure("not.a.functional.intf.1",  origin,
                             diags.fragment("incompatible.abstracts", Kinds.kindName(origin), origin));
                 }
             }
             if (abstracts.isEmpty()) {
                 //t must define a suitable non-generic method
-                throw failure("not.a.functional.intf.1",
+                throw failure("not.a.functional.intf.1", origin,
                             diags.fragment("no.abstracts", Kinds.kindName(origin), origin));
             } else if (abstracts.size() == 1) {
                 return new FunctionDescriptor(abstracts.first());
@@ -504,7 +512,7 @@
                 @Override
                 public Type getType(Type origin) {
                     Type mt = memberType(origin, getSymbol());
-                    return new MethodType(mt.getParameterTypes(), mt.getReturnType(), thrown1, syms.methodClass);
+                    return createMethodTypeWithThrown(mt, thrown1);
                 }
             };
         }
@@ -553,6 +561,51 @@
             return false;
         }
     }
+
+    public boolean isFunctionalInterface(Type site) {
+        try {
+            findDescriptorType(site);
+            return true;
+        } catch (FunctionDescriptorLookupError ex) {
+            return false;
+        }
+    }
+
+    public Type removeWildcards(Type site) {
+        Type capturedSite = capture(site);
+        if (capturedSite != site) {
+            Type formalInterface = site.tsym.type;
+            ListBuffer<Type> typeargs = ListBuffer.lb();
+            List<Type> actualTypeargs = site.getTypeArguments();
+            List<Type> capturedTypeargs = capturedSite.getTypeArguments();
+            //simply replace the wildcards with its bound
+            for (Type t : formalInterface.getTypeArguments()) {
+                if (actualTypeargs.head.hasTag(WILDCARD)) {
+                    WildcardType wt = (WildcardType)actualTypeargs.head;
+                    Type bound;
+                    switch (wt.kind) {
+                        case EXTENDS:
+                        case UNBOUND:
+                            CapturedType capVar = (CapturedType)capturedTypeargs.head;
+                            //use declared bound if it doesn't depend on formal type-args
+                            bound = capVar.bound.containsAny(capturedSite.getTypeArguments()) ?
+                                    syms.objectType : capVar.bound;
+                            break;
+                        default:
+                            bound = wt.type;
+                    }
+                    typeargs.append(bound);
+                } else {
+                    typeargs.append(actualTypeargs.head);
+                }
+                actualTypeargs = actualTypeargs.tail;
+                capturedTypeargs = capturedTypeargs.tail;
+            }
+            return subst(formalInterface, formalInterface.getTypeArguments(), typeargs.toList());
+        } else {
+            return site;
+        }
+    }
     // </editor-fold>
 
    /**
@@ -654,6 +707,8 @@
     //where
         private boolean isSubtypeUncheckedInternal(Type t, Type s, Warner warn) {
             if (t.hasTag(ARRAY) && s.hasTag(ARRAY)) {
+                t = t.unannotatedType();
+                s = s.unannotatedType();
                 if (((ArrayType)t).elemtype.isPrimitive()) {
                     return isSameType(elemtype(t), elemtype(s));
                 } else {
@@ -679,7 +734,10 @@
         }
 
         private void checkUnsafeVarargsConversion(Type t, Type s, Warner warn) {
-            if (t.tag != ARRAY || isReifiable(t)) return;
+            if (t.tag != ARRAY || isReifiable(t))
+                return;
+            t = t.unannotatedType();
+            s = s.unannotatedType();
             ArrayType from = (ArrayType)t;
             boolean shouldWarn = false;
             switch (s.tag) {
@@ -712,6 +770,12 @@
         if (t == s)
             return true;
 
+        t = t.unannotatedType();
+        s = s.unannotatedType();
+
+        if (t == s)
+            return true;
+
         if (s.isPartial())
             return isSuperType(s, t);
 
@@ -934,9 +998,12 @@
      * lists are of different length, return false.
      */
     public boolean isSameTypes(List<Type> ts, List<Type> ss) {
+        return isSameTypes(ts, ss, false);
+    }
+    public boolean isSameTypes(List<Type> ts, List<Type> ss, boolean strict) {
         while (ts.tail != null && ss.tail != null
                /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ &&
-               isSameType(ts.head, ss.head)) {
+               isSameType(ts.head, ss.head, strict)) {
             ts = ts.tail;
             ss = ss.tail;
         }
@@ -948,10 +1015,15 @@
      * Is t the same type as s?
      */
     public boolean isSameType(Type t, Type s) {
-        return isSameType.visit(t, s);
+        return isSameType(t, s, false);
+    }
+    public boolean isSameType(Type t, Type s, boolean strict) {
+        return strict ?
+                isSameTypeStrict.visit(t, s) :
+                isSameTypeLoose.visit(t, s);
     }
     // where
-        private TypeRelation isSameType = new TypeRelation() {
+        abstract class SameTypeVisitor extends TypeRelation {
 
             public Boolean visitType(Type t, Type s) {
                 if (t == s)
@@ -968,8 +1040,7 @@
                     if (s.tag == TYPEVAR) {
                         //type-substitution does not preserve type-var types
                         //check that type var symbols and bounds are indeed the same
-                        return t.tsym == s.tsym &&
-                                visit(t.getUpperBound(), s.getUpperBound());
+                        return sameTypeVars((TypeVar)t, (TypeVar)s);
                     }
                     else {
                         //special case for s == ? super X, where upper(s) = u
@@ -984,6 +1055,8 @@
                 }
             }
 
+            abstract boolean sameTypeVars(TypeVar tv1, TypeVar tv2);
+
             @Override
             public Boolean visitWildcardType(WildcardType t, Type s) {
                 if (s.isPartial())
@@ -1018,9 +1091,11 @@
                 }
                 return t.tsym == s.tsym
                     && visit(t.getEnclosingType(), s.getEnclosingType())
-                    && containsTypeEquivalent(t.getTypeArguments(), s.getTypeArguments());
+                    && containsTypes(t.getTypeArguments(), s.getTypeArguments());
             }
 
+            abstract protected boolean containsTypes(List<Type> ts1, List<Type> ts2);
+
             @Override
             public Boolean visitArrayType(ArrayType t, Type s) {
                 if (t == s)
@@ -1073,6 +1148,47 @@
             public Boolean visitErrorType(ErrorType t, Type s) {
                 return true;
             }
+        }
+
+        /**
+         * Standard type-equality relation - type variables are considered
+         * equals if they share the same type symbol.
+         */
+        TypeRelation isSameTypeLoose = new SameTypeVisitor() {
+            @Override
+            boolean sameTypeVars(TypeVar tv1, TypeVar tv2) {
+                return tv1.tsym == tv2.tsym && visit(tv1.getUpperBound(), tv2.getUpperBound());
+            }
+            @Override
+            protected boolean containsTypes(List<Type> ts1, List<Type> ts2) {
+                return containsTypeEquivalent(ts1, ts2);
+            }
+        };
+
+        /**
+         * Strict type-equality relation - type variables are considered
+         * equals if they share the same object identity.
+         */
+        TypeRelation isSameTypeStrict = new SameTypeVisitor() {
+            @Override
+            boolean sameTypeVars(TypeVar tv1, TypeVar tv2) {
+                return tv1 == tv2;
+            }
+            @Override
+            protected boolean containsTypes(List<Type> ts1, List<Type> ts2) {
+                return isSameTypes(ts1, ts2, true);
+            }
+
+            @Override
+            public Boolean visitWildcardType(WildcardType t, Type s) {
+                if (!s.hasTag(WILDCARD)) {
+                    return false;
+                } else {
+                    WildcardType t2 = (WildcardType)s;
+                    return t.kind == t2.kind &&
+                            isSameType(t.type, t2.type, true);
+                }
+            }
         };
     // </editor-fold>
 
@@ -1313,23 +1429,10 @@
                     }
                 }
 
-                if (t.isCompound()) {
-                    Warner oldWarner = warnStack.head;
-                    warnStack.head = noWarnings;
-                    if (!visit(supertype(t), s))
-                        return false;
-                    for (Type intf : interfaces(t)) {
-                        if (!visit(intf, s))
-                            return false;
-                    }
-                    if (warnStack.head.hasLint(LintCategory.UNCHECKED))
-                        oldWarner.warn(LintCategory.UNCHECKED);
-                    return true;
-                }
-
-                if (s.isCompound()) {
-                    // call recursively to reuse the above code
-                    return visitClassType((ClassType)s, t);
+                if (t.isCompound() || s.isCompound()) {
+                    return !t.isCompound() ?
+                            visitIntersectionType((IntersectionClassType)s, t, true) :
+                            visitIntersectionType((IntersectionClassType)t, s, false);
                 }
 
                 if (s.tag == CLASS || s.tag == ARRAY) {
@@ -1407,6 +1510,18 @@
                 return false;
             }
 
+            boolean visitIntersectionType(IntersectionClassType ict, Type s, boolean reverse) {
+                Warner warn = noWarnings;
+                for (Type c : ict.getComponents()) {
+                    warn.clear();
+                    if (reverse ? !isCastable(s, c, warn) : !isCastable(c, s, warn))
+                        return false;
+                }
+                if (warn.hasLint(LintCategory.UNCHECKED))
+                    warnStack.head.warn(LintCategory.UNCHECKED);
+                return true;
+            }
+
             @Override
             public Boolean visitArrayType(ArrayType t, Type s) {
                 switch (s.tag) {
@@ -1653,6 +1768,7 @@
         case WILDCARD:
             return elemtype(upperBound(t));
         case ARRAY:
+            t = t.unannotatedType();
             return ((ArrayType)t).elemtype;
         case FORALL:
             return elemtype(((ForAll)t).qtype);
@@ -1981,6 +2097,19 @@
             public Type visitErrorType(ErrorType t, Boolean recurse) {
                 return t;
             }
+
+            @Override
+            public Type visitAnnotatedType(AnnotatedType t, Boolean recurse) {
+                Type erased = erasure(t.underlyingType, 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;
+                }
+                return new AnnotatedType(t.typeAnnotations, erased);
+            }
         };
 
     private Mapping erasureFun = new Mapping ("erasure") {
@@ -2503,16 +2632,17 @@
                 candidates = candidates.prepend((MethodSymbol)s);
             }
         }
-        return prune(candidates, ownerComparator);
+        return prune(candidates);
     }
 
-    public List<MethodSymbol> prune(List<MethodSymbol> methods, Comparator<MethodSymbol> cmp) {
+    public List<MethodSymbol> prune(List<MethodSymbol> methods) {
         ListBuffer<MethodSymbol> methodsMin = ListBuffer.lb();
         for (MethodSymbol m1 : methods) {
             boolean isMin_m1 = true;
             for (MethodSymbol m2 : methods) {
                 if (m1 == m2) continue;
-                if (cmp.compare(m2, m1) < 0) {
+                if (m2.owner != m1.owner &&
+                        asSuper(m2.owner.type, m1.owner) != null) {
                     isMin_m1 = false;
                     break;
                 }
@@ -2522,12 +2652,6 @@
         }
         return methodsMin.toList();
     }
-
-    Comparator<MethodSymbol> ownerComparator = new Comparator<MethodSymbol>() {
-        public int compare(MethodSymbol s1, MethodSymbol s2) {
-            return s1.owner.isSubClass(s2.owner, Types.this) ? -1 : 1;
-        }
-    };
     // where
             private class MethodFilter implements Filter<Symbol> {
 
@@ -2923,6 +3047,7 @@
      * graph. Undefined for all but reference types.
      */
     public int rank(Type t) {
+        t = t.unannotatedType();
         switch(t.tag) {
         case CLASS: {
             ClassType cls = (ClassType)t;
@@ -3624,6 +3749,7 @@
                 t = subst(type1, t.tsym.type.getTypeArguments(), t.getTypeArguments());
             }
         }
+        t = t.unannotatedType();
         ClassType cls = (ClassType)t;
         if (cls.isRaw() || !cls.isParameterized())
             return cls;
@@ -3773,11 +3899,18 @@
     }
 
     private boolean giveWarning(Type from, Type to) {
-        Type subFrom = asSub(from, to.tsym);
-        return to.isParameterized() &&
-                (!(isUnbounded(to) ||
-                isSubtype(from, to) ||
-                ((subFrom != null) && containsType(to.allparams(), subFrom.allparams()))));
+        List<Type> bounds = to.isCompound() ?
+                ((IntersectionClassType)to).getComponents() : List.of(to);
+        for (Type b : bounds) {
+            Type subFrom = asSub(from, b.tsym);
+            if (b.isParameterized() &&
+                    (!(isUnbounded(b) ||
+                    isSubtype(from, b) ||
+                    ((subFrom != null) && containsType(b.allparams(), subFrom.allparams()))))) {
+                return true;
+            }
+        }
+        return false;
     }
 
     private List<Type> superClosure(Type t, Type s) {
@@ -4142,6 +4275,8 @@
         public R visitForAll(ForAll t, S s)             { return visitType(t, s); }
         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); }
     }
 
     /**
@@ -4252,4 +4387,172 @@
         return vis;
     }
     // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Signature Generation">
+
+    public static abstract class SignatureGenerator {
+
+        private final Types types;
+
+        protected abstract void append(char ch);
+        protected abstract void append(byte[] ba);
+        protected abstract void append(Name name);
+        protected void classReference(ClassSymbol c) { /* by default: no-op */ }
+
+        protected SignatureGenerator(Types types) {
+            this.types = types;
+        }
+
+        /**
+         * Assemble signature of given type in string buffer.
+         */
+        public void assembleSig(Type type) {
+            type = type.unannotatedType();
+            switch (type.getTag()) {
+                case BYTE:
+                    append('B');
+                    break;
+                case SHORT:
+                    append('S');
+                    break;
+                case CHAR:
+                    append('C');
+                    break;
+                case INT:
+                    append('I');
+                    break;
+                case LONG:
+                    append('J');
+                    break;
+                case FLOAT:
+                    append('F');
+                    break;
+                case DOUBLE:
+                    append('D');
+                    break;
+                case BOOLEAN:
+                    append('Z');
+                    break;
+                case VOID:
+                    append('V');
+                    break;
+                case CLASS:
+                    append('L');
+                    assembleClassSig(type);
+                    append(';');
+                    break;
+                case ARRAY:
+                    ArrayType at = (ArrayType) type;
+                    append('[');
+                    assembleSig(at.elemtype);
+                    break;
+                case METHOD:
+                    MethodType mt = (MethodType) type;
+                    append('(');
+                    assembleSig(mt.argtypes);
+                    append(')');
+                    assembleSig(mt.restype);
+                    if (hasTypeVar(mt.thrown)) {
+                        for (List<Type> l = mt.thrown; l.nonEmpty(); l = l.tail) {
+                            append('^');
+                            assembleSig(l.head);
+                        }
+                    }
+                    break;
+                case WILDCARD: {
+                    Type.WildcardType ta = (Type.WildcardType) type;
+                    switch (ta.kind) {
+                        case SUPER:
+                            append('-');
+                            assembleSig(ta.type);
+                            break;
+                        case EXTENDS:
+                            append('+');
+                            assembleSig(ta.type);
+                            break;
+                        case UNBOUND:
+                            append('*');
+                            break;
+                        default:
+                            throw new AssertionError(ta.kind);
+                    }
+                    break;
+                }
+                case TYPEVAR:
+                    append('T');
+                    append(type.tsym.name);
+                    append(';');
+                    break;
+                case FORALL:
+                    Type.ForAll ft = (Type.ForAll) type;
+                    assembleParamsSig(ft.tvars);
+                    assembleSig(ft.qtype);
+                    break;
+                default:
+                    throw new AssertionError("typeSig " + type.getTag());
+            }
+        }
+
+        public boolean hasTypeVar(List<Type> l) {
+            while (l.nonEmpty()) {
+                if (l.head.hasTag(TypeTag.TYPEVAR)) {
+                    return true;
+                }
+                l = l.tail;
+            }
+            return false;
+        }
+
+        public void assembleClassSig(Type type) {
+            type = type.unannotatedType();
+            ClassType ct = (ClassType) type;
+            ClassSymbol c = (ClassSymbol) ct.tsym;
+            classReference(c);
+            Type outer = ct.getEnclosingType();
+            if (outer.allparams().nonEmpty()) {
+                boolean rawOuter =
+                        c.owner.kind == Kinds.MTH || // either a local class
+                        c.name == types.names.empty; // or anonymous
+                assembleClassSig(rawOuter
+                        ? types.erasure(outer)
+                        : outer);
+                append('.');
+                Assert.check(c.flatname.startsWith(c.owner.enclClass().flatname));
+                append(rawOuter
+                        ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength() + 1, c.flatname.getByteLength())
+                        : c.name);
+            } else {
+                append(externalize(c.flatname));
+            }
+            if (ct.getTypeArguments().nonEmpty()) {
+                append('<');
+                assembleSig(ct.getTypeArguments());
+                append('>');
+            }
+        }
+
+        public void assembleParamsSig(List<Type> typarams) {
+            append('<');
+            for (List<Type> ts = typarams; ts.nonEmpty(); ts = ts.tail) {
+                Type.TypeVar tvar = (Type.TypeVar) ts.head;
+                append(tvar.tsym.name);
+                List<Type> bounds = types.getBounds(tvar);
+                if ((bounds.head.tsym.flags() & INTERFACE) != 0) {
+                    append(':');
+                }
+                for (List<Type> l = bounds; l.nonEmpty(); l = l.tail) {
+                    append(':');
+                    assembleSig(l.head);
+                }
+            }
+            append('>');
+        }
+
+        private void assembleSig(List<Type> types) {
+            for (List<Type> ts = types; ts.nonEmpty(); ts = ts.tail) {
+                assembleSig(ts.head);
+            }
+        }
+    }
+    // </editor-fold>
 }
--- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -26,6 +26,7 @@
 package com.sun.tools.javac.comp;
 
 import java.util.Map;
+
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.code.*;
@@ -87,20 +88,30 @@
     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>();
+
+    public void earlier(Annotator a) {
+        q.prepend(a);
+    }
 
     public void normal(Annotator a) {
         q.append(a);
     }
 
-    public void earlier(Annotator a) {
-        q.prepend(a);
+    public void typeAnnotation(Annotator a) {
+        typesQ.append(a);
     }
 
     public void repeated(Annotator a) {
         repeatedQ.append(a);
     }
 
+    public void afterRepeated(Annotator a) {
+        afterRepeatedQ.append(a);
+    }
+
     /** Called when the Enter phase starts. */
     public void enterStart() {
         enterCount++;
@@ -116,12 +127,18 @@
         if (enterCount != 0) return;
         enterCount++;
         try {
-            while (q.nonEmpty())
+            while (q.nonEmpty()) {
                 q.next().enterAnnotation();
-
+            }
+            while (typesQ.nonEmpty()) {
+                typesQ.next().enterAnnotation();
+            }
             while (repeatedQ.nonEmpty()) {
                 repeatedQ.next().enterAnnotation();
             }
+            while (afterRepeatedQ.nonEmpty()) {
+                afterRepeatedQ.next().enterAnnotation();
+            }
         } finally {
             enterCount--;
         }
@@ -141,16 +158,18 @@
      * This context contains all the information needed to synthesize new
      * annotations trees by the completer for repeating annotations.
      */
-    public class AnnotateRepeatedContext {
+    public class AnnotateRepeatedContext<T extends Attribute.Compound> {
         public final Env<AttrContext> env;
-        public final Map<Symbol.TypeSymbol, ListBuffer<Attribute.Compound>> annotated;
-        public final Map<Attribute.Compound, JCDiagnostic.DiagnosticPosition> pos;
+        public final Map<Symbol.TypeSymbol, ListBuffer<T>> annotated;
+        public final Map<T, JCDiagnostic.DiagnosticPosition> pos;
         public final Log log;
+        public final boolean isTypeCompound;
 
         public AnnotateRepeatedContext(Env<AttrContext> env,
-                                       Map<Symbol.TypeSymbol, ListBuffer<Attribute.Compound>> annotated,
-                                       Map<Attribute.Compound, JCDiagnostic.DiagnosticPosition> pos,
-                                       Log log) {
+                                       Map<Symbol.TypeSymbol, ListBuffer<T>> annotated,
+                                       Map<T, JCDiagnostic.DiagnosticPosition> pos,
+                                       Log log,
+                                       boolean isTypeCompound) {
             Assert.checkNonNull(env);
             Assert.checkNonNull(annotated);
             Assert.checkNonNull(pos);
@@ -160,6 +179,7 @@
             this.annotated = annotated;
             this.pos = pos;
             this.log = log;
+            this.isTypeCompound = isTypeCompound;
         }
 
         /**
@@ -170,7 +190,7 @@
          * @param repeatingAnnotations a List of repeating annotations
          * @return a new Attribute.Compound that is the container for the repeatingAnnotations
          */
-        public Attribute.Compound processRepeatedAnnotations(List<Attribute.Compound> repeatingAnnotations, Symbol sym) {
+        public T processRepeatedAnnotations(List<T> repeatingAnnotations, Symbol sym) {
             return Annotate.this.processRepeatedAnnotations(repeatingAnnotations, this, sym);
         }
 
@@ -246,7 +266,12 @@
                            ((MethodSymbol)method, value));
             t.type = result;
         }
-        return new Attribute.Compound(a.type, buf.toList());
+        // TODO: this should be a TypeCompound if "a" is a JCTypeAnnotation.
+        // However, how do we find the correct position?
+        Attribute.Compound ac = new Attribute.Compound(a.type, buf.toList());
+        // TODO: is this something we want? Who would use it?
+        // a.attribute = ac;
+        return ac;
     }
 
     Attribute enterAttributeValue(Type expected,
@@ -329,6 +354,15 @@
         return new Attribute.Error(attr.attribExpr(tree, env, expected));
     }
 
+    Attribute.TypeCompound enterTypeAnnotation(JCAnnotation a,
+            Type expected,
+            Env<AttrContext> env) {
+        Attribute.Compound c = enterAnnotation(a, expected, env);
+        Attribute.TypeCompound tc = new Attribute.TypeCompound(c.type, c.values, new TypeAnnotationPosition());
+        a.attribute = tc;
+        return tc;
+    }
+
     /* *********************************
      * Support for repeating annotations
      ***********************************/
@@ -337,10 +371,10 @@
      * synthesized container annotation or null IFF all repeating
      * annotation are invalid.  This method reports errors/warnings.
      */
-    private Attribute.Compound processRepeatedAnnotations(List<Attribute.Compound> annotations,
-                                                          AnnotateRepeatedContext ctx,
-                                                          Symbol on) {
-        Attribute.Compound firstOccurrence = annotations.head;
+    private <T extends Attribute.Compound> T processRepeatedAnnotations(List<T> annotations,
+            AnnotateRepeatedContext<T> ctx,
+            Symbol on) {
+        T firstOccurrence = annotations.head;
         List<Attribute> repeated = List.nil();
         Type origAnnoType = null;
         Type arrayOfOrigAnnoType = null;
@@ -350,18 +384,26 @@
         Assert.check(!annotations.isEmpty() &&
                      !annotations.tail.isEmpty()); // i.e. size() > 1
 
-        for (List<Attribute.Compound> al = annotations;
+        int count = 0;
+        for (List<T> al = annotations;
              !al.isEmpty();
              al = al.tail)
         {
-            Attribute.Compound currentAnno = al.head;
+            count++;
+
+            // There must be more than a single anno in the annotation list
+            Assert.check(count > 1 || !al.tail.isEmpty());
+
+            T currentAnno = al.head;
 
             origAnnoType = currentAnno.type;
             if (arrayOfOrigAnnoType == null) {
                 arrayOfOrigAnnoType = types.makeArrayType(origAnnoType);
-}
+            }
 
-            Type currentContainerType = getContainingType(currentAnno, ctx.pos.get(currentAnno));
+            // Only report errors if this isn't the first occurrence I.E. count > 1
+            boolean reportError = count > 1;
+            Type currentContainerType = getContainingType(currentAnno, ctx.pos.get(currentAnno), reportError);
             if (currentContainerType == null) {
                 continue;
             }
@@ -383,25 +425,46 @@
 
         if (!repeated.isEmpty()) {
             repeated = repeated.reverse();
-            JCAnnotation annoTree;
             TreeMaker m = make.at(ctx.pos.get(firstOccurrence));
             Pair<MethodSymbol, Attribute> p =
                     new Pair<MethodSymbol, Attribute>(containerValueSymbol,
                                                       new Attribute.Array(arrayOfOrigAnnoType, repeated));
-            annoTree = m.Annotation(new Attribute.Compound(targetContainerType,
-                    List.of(p)));
+            if (ctx.isTypeCompound) {
+                /* TODO: the following code would be cleaner:
+                Attribute.TypeCompound at = new Attribute.TypeCompound(targetContainerType, List.of(p),
+                        ((Attribute.TypeCompound)annotations.head).position);
+                JCTypeAnnotation annoTree = m.TypeAnnotation(at);
+                at = enterTypeAnnotation(annoTree, targetContainerType, ctx.env);
+                */
+                // However, we directly construct the TypeCompound to keep the
+                // direct relation to the contained TypeCompounds.
+                Attribute.TypeCompound at = new Attribute.TypeCompound(targetContainerType, List.of(p),
+                        ((Attribute.TypeCompound)annotations.head).position);
 
-            if (!chk.annotationApplicable(annoTree, on))
-                log.error(annoTree.pos(), "invalid.containedby.annotation.incompatible.target", targetContainerType, origAnnoType);
+                // TODO: annotation applicability checks from below?
+
+                at.setSynthesized(true);
 
-            if (!chk.validateAnnotationDeferErrors(annoTree))
-                log.error(annoTree.pos(), "duplicate.annotation.invalid.repeated", origAnnoType);
+                @SuppressWarnings("unchecked")
+                T x = (T) at;
+                return x;
+            } else {
+                Attribute.Compound c = new Attribute.Compound(targetContainerType, List.of(p));
+                JCAnnotation annoTree = m.Annotation(c);
+
+                if (!chk.annotationApplicable(annoTree, on))
+                    log.error(annoTree.pos(), "invalid.repeatable.annotation.incompatible.target", targetContainerType, origAnnoType);
 
-            Attribute.Compound c = enterAnnotation(annoTree,
-                                                   targetContainerType,
-                                                   ctx.env);
-            c.setSynthesized(true);
-            return c;
+                if (!chk.validateAnnotationDeferErrors(annoTree))
+                    log.error(annoTree.pos(), "duplicate.annotation.invalid.repeated", origAnnoType);
+
+                c = enterAnnotation(annoTree, targetContainerType, ctx.env);
+                c.setSynthesized(true);
+
+                @SuppressWarnings("unchecked")
+                T x = (T) c;
+                return x;
+            }
         } else {
             return null; // errors should have been reported elsewhere
         }
@@ -409,16 +472,18 @@
 
     /** Fetches the actual Type that should be the containing annotation. */
     private Type getContainingType(Attribute.Compound currentAnno,
-            DiagnosticPosition pos)
+            DiagnosticPosition pos,
+            boolean reportError)
     {
         Type origAnnoType = currentAnno.type;
         TypeSymbol origAnnoDecl = origAnnoType.tsym;
 
-        // Fetch the ContainedBy annotation from the current
+        // Fetch the Repeatable annotation from the current
         // annotation's declaration, or null if it has none
-        Attribute.Compound ca = origAnnoDecl.attribute(syms.containedByType.tsym);
-        if (ca == null) { // has no ContainedBy annotation
-            log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.containedByType);
+        Attribute.Compound ca = origAnnoDecl.attribute(syms.repeatableType.tsym);
+        if (ca == null) { // has no Repeatable annotation
+            if (reportError)
+                log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.repeatableType);
             return null;
         }
 
@@ -440,23 +505,23 @@
             DiagnosticPosition pos,
             TypeSymbol annoDecl)
     {
-        // The next three checks check that the ContainedBy annotation
+        // The next three checks check that the Repeatable annotation
         // on the declaration of the annotation type that is repeating is
         // valid.
 
-        // ContainedBy must have at least one element
+        // Repeatable must have at least one element
         if (ca.values.isEmpty()) {
-            log.error(pos, "invalid.containedby.annotation", annoDecl);
+            log.error(pos, "invalid.repeatable.annotation", annoDecl);
             return null;
         }
         Pair<MethodSymbol,Attribute> p = ca.values.head;
         Name name = p.fst.name;
         if (name != names.value) { // should contain only one element, named "value"
-            log.error(pos, "invalid.containedby.annotation", annoDecl);
+            log.error(pos, "invalid.repeatable.annotation", annoDecl);
             return null;
         }
         if (!(p.snd instanceof Attribute.Class)) { // check that the value of "value" is an Attribute.Class
-            log.error(pos, "invalid.containedby.annotation", annoDecl);
+            log.error(pos, "invalid.repeatable.annotation", annoDecl);
             return null;
         }
 
@@ -491,13 +556,13 @@
         }
         if (error) {
             log.error(pos,
-                      "invalid.containedby.annotation.multiple.values",
+                      "invalid.repeatable.annotation.multiple.values",
                       targetContainerType,
                       nr_value_elems);
             return null;
         } else if (nr_value_elems == 0) {
             log.error(pos,
-                      "invalid.containedby.annotation.no.value",
+                      "invalid.repeatable.annotation.no.value",
                       targetContainerType);
             return null;
         }
@@ -506,7 +571,7 @@
         // probably "impossible" to fail this
         if (containerValueSymbol.kind != Kinds.MTH) {
             log.error(pos,
-                      "invalid.containedby.annotation.invalid.value",
+                      "invalid.repeatable.annotation.invalid.value",
                       targetContainerType);
             fatalError = true;
         }
@@ -518,7 +583,7 @@
         if (!(types.isArray(valueRetType) &&
               types.isSameType(expectedType, valueRetType))) {
             log.error(pos,
-                      "invalid.containedby.annotation.value.return",
+                      "invalid.repeatable.annotation.value.return",
                       targetContainerType,
                       valueRetType,
                       expectedType);
@@ -528,10 +593,7 @@
             fatalError = true;
         }
 
-        // Explicitly no check for/validity of @ContainerFor. That is
-        // done on declaration of the container, and at reflect time.
-
-        // The rest of the conditions for a valid containing annotation are made
+        // The conditions for a valid containing annotation are made
         // in Check.validateRepeatedAnnotaton();
 
         return fatalError ? null : containerValueSymbol;
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,9 +26,9 @@
 package com.sun.tools.javac.comp;
 
 import java.util.*;
-import java.util.Set;
 
 import javax.lang.model.element.ElementKind;
+import javax.lang.model.type.TypeKind;
 import javax.tools.JavaFileObject;
 
 import com.sun.source.tree.IdentifierTree;
@@ -43,11 +43,11 @@
 import com.sun.tools.javac.comp.Check.CheckContext;
 import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
 import com.sun.tools.javac.comp.Infer.InferenceContext;
-import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
+import com.sun.tools.javac.comp.Infer.FreeTypeListener;
 import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
@@ -244,8 +244,8 @@
                     @Override
                     public void typesInferred(InferenceContext inferenceContext) {
                         ResultInfo pendingResult =
-                                    resultInfo.dup(inferenceContext.asInstType(resultInfo.pt, types));
-                        check(tree, inferenceContext.asInstType(found, types), ownkind, pendingResult);
+                                    resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
+                        check(tree, inferenceContext.asInstType(found), ownkind, pendingResult);
                     }
                 });
                 return tree.type = resultInfo.pt;
@@ -766,6 +766,8 @@
         JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile);
 
         try {
+            memberEnter.typeAnnotate(initializer, env, env.info.enclVar);
+            annotate.flush();
             Type itype = attribExpr(initializer, env, type);
             if (itype.constValue() != null)
                 return coerce(itype, type).constValue();
@@ -879,6 +881,7 @@
             deferredLintHandler.flush(tree.pos());
             chk.checkDeprecatedAnnotation(tree.pos(), m);
 
+
             // Create a new environment with local scope
             // for attributing the method.
             Env<AttrContext> localEnv = memberEnter.methodEnv(tree, env);
@@ -922,6 +925,21 @@
             // Check that result type is well-formed.
             chk.validate(tree.restype, localEnv);
 
+            // Check that receiver type is well-formed.
+            if (tree.recvparam != null) {
+                // Use a new environment to check the receiver parameter.
+                // Otherwise I get "might not have been initialized" errors.
+                // Is there a better way?
+                Env<AttrContext> newEnv = memberEnter.methodEnv(tree, env);
+                attribType(tree.recvparam, newEnv);
+                chk.validate(tree.recvparam, newEnv);
+                if (!(tree.recvparam.type == m.owner.type || types.isSameType(tree.recvparam.type, m.owner.type))) {
+                    // The == covers the common non-generic case, but for generic classes we need isSameType;
+                    // note that equals didn't work.
+                    log.error(tree.recvparam.pos(), "incorrect.receiver.type");
+                }
+            }
+
             // annotation method checks
             if ((owner.flags() & ANNOTATION) != 0) {
                 // annotation method cannot have throws clause
@@ -953,8 +971,7 @@
                 // Empty bodies are only allowed for
                 // abstract, native, or interface methods, or for methods
                 // in a retrofit signature class.
-                if (isDefaultMethod || ((owner.flags() & INTERFACE) == 0 &&
-                    (tree.mods.flags & (ABSTRACT | NATIVE)) == 0) &&
+                if (isDefaultMethod || (tree.sym.flags() & (ABSTRACT | NATIVE)) == 0 &&
                     !relax)
                     log.error(tree.pos(), "missing.meth.body.or.decl.abstract");
                 if (tree.defaultValue != null) {
@@ -996,9 +1013,14 @@
                     }
                 }
 
+                // Attribute all type annotations in the body
+                memberEnter.typeAnnotate(tree.body, localEnv, m);
+                annotate.flush();
+
                 // Attribute method body.
                 attribStat(tree.body, localEnv);
             }
+
             localEnv.info.scope.leave();
             result = tree.type = m.type;
             chk.validateAnnotations(tree.mods.annotations, m);
@@ -1019,6 +1041,12 @@
                 memberEnter.memberEnter(tree, env);
                 annotate.flush();
             }
+        } else {
+            if (tree.init != null) {
+                // Field initializer expression need to be entered.
+                memberEnter.typeAnnotate(tree.init, env, tree.sym);
+                annotate.flush();
+            }
         }
 
         VarSymbol v = tree.sym;
@@ -1073,9 +1101,15 @@
             Env<AttrContext> localEnv =
                 env.dup(tree, env.info.dup(env.info.scope.dupUnshared()));
             localEnv.info.scope.owner =
-                new MethodSymbol(tree.flags | BLOCK, names.empty, null,
-                                 env.info.scope.owner);
+                new MethodSymbol(tree.flags | BLOCK |
+                    env.info.scope.owner.flags() & STRICTFP, names.empty, null,
+                    env.info.scope.owner);
             if ((tree.flags & STATIC) != 0) localEnv.info.staticLevel++;
+
+            // Attribute all type annotations in the block
+            memberEnter.typeAnnotate(tree, localEnv, localEnv.info.scope.owner);
+            annotate.flush();
+
             attribStats(tree.stats, localEnv);
         } else {
             // Create a new local environment with a local scope.
@@ -1376,18 +1410,19 @@
     public void visitConditional(JCConditional tree) {
         Type condtype = attribExpr(tree.cond, env, syms.booleanType);
 
-        boolean standaloneConditional = !allowPoly ||
+        tree.polyKind = (!allowPoly ||
                 pt().hasTag(NONE) && pt() != Type.recoveryType ||
-                isBooleanOrNumeric(env, tree);
-
-        if (!standaloneConditional && resultInfo.pt.hasTag(VOID)) {
+                isBooleanOrNumeric(env, tree)) ?
+                PolyKind.STANDALONE : PolyKind.POLY;
+
+        if (tree.polyKind == PolyKind.POLY && resultInfo.pt.hasTag(VOID)) {
             //cannot get here (i.e. it means we are returning from void method - which is already an error)
             resultInfo.checkContext.report(tree, diags.fragment("conditional.target.cant.be.void"));
             result = tree.type = types.createErrorType(resultInfo.pt);
             return;
         }
 
-        ResultInfo condInfo = standaloneConditional ?
+        ResultInfo condInfo = tree.polyKind == PolyKind.STANDALONE ?
                 unknownExprInfo :
                 resultInfo.dup(new Check.NestedCheckContext(resultInfo.checkContext) {
                     //this will use enclosing check context to check compatibility of
@@ -1402,7 +1437,7 @@
         Type truetype = attribTree(tree.truepart, env, condInfo);
         Type falsetype = attribTree(tree.falsepart, env, condInfo);
 
-        Type owntype = standaloneConditional ? condType(tree, truetype, falsetype) : pt();
+        Type owntype = (tree.polyKind == PolyKind.STANDALONE) ? condType(tree, truetype, falsetype) : pt();
         if (condtype.constValue() != null &&
                 truetype.constValue() != null &&
                 falsetype.constValue() != null &&
@@ -1424,12 +1459,30 @@
                     JCConditional condTree = (JCConditional)tree;
                     return isBooleanOrNumeric(env, condTree.truepart) &&
                             isBooleanOrNumeric(env, condTree.falsepart);
+                case APPLY:
+                    JCMethodInvocation speculativeMethodTree =
+                            (JCMethodInvocation)deferredAttr.attribSpeculative(tree, env, unknownExprInfo);
+                    Type owntype = TreeInfo.symbol(speculativeMethodTree.meth).type.getReturnType();
+                    return types.unboxedTypeOrType(owntype).isPrimitive();
+                case NEWCLASS:
+                    JCExpression className =
+                            removeClassParams.translate(((JCNewClass)tree).clazz);
+                    JCExpression speculativeNewClassTree =
+                            (JCExpression)deferredAttr.attribSpeculative(className, env, unknownTypeInfo);
+                    return types.unboxedTypeOrType(speculativeNewClassTree.type).isPrimitive();
                 default:
                     Type speculativeType = deferredAttr.attribSpeculative(tree, env, unknownExprInfo).type;
                     speculativeType = types.unboxedTypeOrType(speculativeType);
                     return speculativeType.isPrimitive();
             }
         }
+        //where
+            TreeTranslator removeClassParams = new TreeTranslator() {
+                @Override
+                public void visitTypeApply(JCTypeApply tree) {
+                    result = translate(tree.clazz);
+                }
+            };
 
         /** Compute the type of a conditional expression, after
          *  checking that it exists.  See JLS 15.25. Does not take into
@@ -1828,10 +1881,24 @@
         // If enclosing class is given, attribute it, and
         // complete class name to be fully qualified
         JCExpression clazz = tree.clazz; // Class field following new
-        JCExpression clazzid =          // Identifier in class field
-            (clazz.hasTag(TYPEAPPLY))
-            ? ((JCTypeApply) clazz).clazz
-            : clazz;
+        JCExpression clazzid;            // Identifier in class field
+        JCAnnotatedType annoclazzid;     // Annotated type enclosing clazzid
+        annoclazzid = null;
+
+        if (clazz.hasTag(TYPEAPPLY)) {
+            clazzid = ((JCTypeApply) clazz).clazz;
+            if (clazzid.hasTag(ANNOTATED_TYPE)) {
+                annoclazzid = (JCAnnotatedType) clazzid;
+                clazzid = annoclazzid.underlyingType;
+            }
+        } else {
+            if (clazz.hasTag(ANNOTATED_TYPE)) {
+                annoclazzid = (JCAnnotatedType) clazz;
+                clazzid = annoclazzid.underlyingType;
+            } else {
+                clazzid = clazz;
+            }
+        }
 
         JCExpression clazzid1 = clazzid; // The same in fully qualified form
 
@@ -1846,14 +1913,30 @@
             // yields a clazz T.C.
             Type encltype = chk.checkRefType(tree.encl.pos(),
                                              attribExpr(tree.encl, env));
+            // TODO 308: in <expr>.new C, do we also want to add the type annotations
+            // from expr to the combined type, or not? Yes, do this.
             clazzid1 = make.at(clazz.pos).Select(make.Type(encltype),
                                                  ((JCIdent) clazzid).name);
-            if (clazz.hasTag(TYPEAPPLY))
-                clazz = make.at(tree.pos).
+
+            if (clazz.hasTag(ANNOTATED_TYPE)) {
+                JCAnnotatedType annoType = (JCAnnotatedType) clazz;
+                List<JCAnnotation> annos = annoType.annotations;
+
+                if (annoType.underlyingType.hasTag(TYPEAPPLY)) {
+                    clazzid1 = make.at(tree.pos).
+                        TypeApply(clazzid1,
+                                  ((JCTypeApply) clazz).arguments);
+                }
+
+                clazzid1 = make.at(tree.pos).
+                    AnnotatedType(annos, clazzid1);
+            } else if (clazz.hasTag(TYPEAPPLY)) {
+                clazzid1 = make.at(tree.pos).
                     TypeApply(clazzid1,
                               ((JCTypeApply) clazz).arguments);
-            else
-                clazz = clazzid1;
+            }
+
+            clazz = clazzid1;
         }
 
         // Attribute clazz expression and store
@@ -1870,6 +1953,9 @@
             tree.clazz.type = clazztype;
             TreeInfo.setSymbol(clazzid, TreeInfo.symbol(clazzid1));
             clazzid.type = ((JCIdent) clazzid).sym.type;
+            if (annoclazzid != null) {
+                annoclazzid.type = clazzid.type;
+            }
             if (!clazztype.isErroneous()) {
                 if (cdef != null && clazztype.tsym.isInterface()) {
                     log.error(tree.encl.pos(), "anon.class.impl.intf.no.qual.for.new");
@@ -2065,8 +2151,11 @@
                     ResultInfo findDiamondResult = new ResultInfo(VAL,
                             resultInfo.checkContext.inferenceContext().free(resultInfo.pt) ? Type.noType : pt());
                     Type inferred = deferredAttr.attribSpeculative(tree, env, findDiamondResult).type;
+                    Type polyPt = allowPoly ?
+                            syms.objectType :
+                            clazztype;
                     if (!inferred.isErroneous() &&
-                        types.isAssignable(inferred, pt().hasTag(NONE) ? syms.objectType : pt(), types.noWarnings)) {
+                        types.isAssignable(inferred, pt().hasTag(NONE) ? polyPt : pt(), types.noWarnings)) {
                         String key = types.isSameType(clazztype, inferred) ?
                             "diamond.redundant.args" :
                             "diamond.redundant.args.1";
@@ -2173,17 +2262,18 @@
         boolean needsRecovery =
                 resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK;
         try {
+            Type target = pt();
             List<Type> explicitParamTypes = null;
-            if (TreeInfo.isExplicitLambda(that)) {
+            if (that.paramKind == JCLambda.ParameterKind.EXPLICIT) {
                 //attribute lambda parameters
                 attribStats(that.params, localEnv);
                 explicitParamTypes = TreeInfo.types(that.params);
+                target = infer.instantiateFunctionalInterface(that, target, explicitParamTypes, resultInfo.checkContext);
             }
 
-            Type target;
             Type lambdaType;
             if (pt() != Type.recoveryType) {
-                target = infer.instantiateFunctionalInterface(that, checkIntersectionTarget(that, resultInfo), explicitParamTypes, resultInfo.checkContext);
+                target = checkIntersectionTarget(that, target, resultInfo.checkContext);
                 lambdaType = types.findDescriptorType(target);
                 chk.checkFunctionalInterface(that, target);
             } else {
@@ -2191,6 +2281,8 @@
                 lambdaType = fallbackDescriptorType(that);
             }
 
+            setFunctionalInfo(that, pt(), lambdaType, resultInfo.checkContext.inferenceContext());
+
             if (lambdaType.hasTag(FORALL)) {
                 //lambda expression target desc cannot be a generic method
                 resultInfo.checkContext.report(that, diags.fragment("invalid.generic.lambda.target",
@@ -2199,7 +2291,7 @@
                 return;
             }
 
-            if (!TreeInfo.isExplicitLambda(that)) {
+            if (that.paramKind == JCLambda.ParameterKind.IMPLICIT) {
                 //add param type info in the AST
                 List<Type> actuals = lambdaType.getParameterTypes();
                 List<JCVariableDecl> params = that.params;
@@ -2282,8 +2374,7 @@
         }
     }
 
-    private Type checkIntersectionTarget(DiagnosticPosition pos, ResultInfo resultInfo) {
-        Type pt = resultInfo.pt;
+    private Type checkIntersectionTarget(DiagnosticPosition pos, Type pt, CheckContext checkContext) {
         if (pt != Type.recoveryType && pt.isCompound()) {
             IntersectionClassType ict = (IntersectionClassType)pt;
             List<Type> bounds = ict.allInterfaces ?
@@ -2292,7 +2383,7 @@
             types.findDescriptorType(bounds.head); //propagate exception outwards!
             for (Type bound : bounds.tail) {
                 if (!types.isMarkerInterface(bound)) {
-                    resultInfo.checkContext.report(pos, diags.fragment("secondary.bound.must.be.marker.intf", bound));
+                    checkContext.report(pos, diags.fragment("secondary.bound.must.be.marker.intf", bound));
                 }
             }
             //for now (translation doesn't support intersection types)
@@ -2330,7 +2421,7 @@
                 inferenceContext.addFreeTypeListener(ts, new FreeTypeListener() {
                     @Override
                     public void typesInferred(InferenceContext inferenceContext) {
-                        checkAccessibleTypes(pos, env, inferenceContext, inferenceContext.asInstTypes(ts, types));
+                        checkAccessibleTypes(pos, env, inferenceContext, inferenceContext.asInstTypes(ts));
                     }
                 });
             } else {
@@ -2355,9 +2446,9 @@
             @Override
             public boolean compatible(Type found, Type req, Warner warn) {
                 //return type must be compatible in both current context and assignment context
-                return types.isAssignable(found, inferenceContext().asFree(req, types), warn) &&
-                        super.compatible(found, req, warn);
+                return chk.basicHandler.compatible(found, inferenceContext().asFree(req), warn);
             }
+
             @Override
             public void report(DiagnosticPosition pos, JCDiagnostic details) {
                 enclosingContext.report(pos, diags.fragment("incompatible.ret.type.in.lambda", details));
@@ -2390,7 +2481,7 @@
         * descriptor.
         */
         private void checkLambdaCompatible(JCLambda tree, Type descriptor, CheckContext checkContext, boolean speculativeAttr) {
-            Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType(), types);
+            Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType());
 
             //return values have already been checked - but if lambda has no return
             //values, we must ensure that void/value compatibility is correct;
@@ -2402,13 +2493,13 @@
                         diags.fragment("missing.ret.val", returnType)));
             }
 
-            List<Type> argTypes = checkContext.inferenceContext().asFree(descriptor.getParameterTypes(), types);
+            List<Type> argTypes = checkContext.inferenceContext().asFree(descriptor.getParameterTypes());
             if (!types.isSameTypes(argTypes, TreeInfo.types(tree.params))) {
                 checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
             }
 
             if (!speculativeAttr) {
-                List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes(), types);
+                List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes());
                 if (chk.unhandled(tree.inferredThrownTypes == null ? List.<Type>nil() : tree.inferredThrownTypes, thrownTypes).nonEmpty()) {
                     log.error(tree, "incompatible.thrown.types.in.lambda", tree.inferredThrownTypes);
                 }
@@ -2444,8 +2535,7 @@
         try {
             //attribute member reference qualifier - if this is a constructor
             //reference, the expected kind must be a type
-            Type exprType = attribTree(that.expr,
-                    env, new ResultInfo(that.getMode() == ReferenceMode.INVOKE ? VAL | TYP : TYP, Type.noType));
+            Type exprType = attribTree(that.expr, env, memberReferenceQualifierResult(that));
 
             if (that.getMode() == JCMemberReference.ReferenceMode.NEW) {
                 exprType = chk.checkConstructorRefType(that.expr, exprType);
@@ -2453,7 +2543,7 @@
 
             if (exprType.isErroneous()) {
                 //if the qualifier expression contains problems,
-                //give up atttribution of method reference
+                //give up attribution of method reference
                 result = that.type = exprType;
                 return;
             }
@@ -2473,7 +2563,7 @@
             Type target;
             Type desc;
             if (pt() != Type.recoveryType) {
-                target = infer.instantiateFunctionalInterface(that, checkIntersectionTarget(that, resultInfo), null, resultInfo.checkContext);
+                target = checkIntersectionTarget(that, pt(), resultInfo.checkContext);
                 desc = types.findDescriptorType(target);
                 chk.checkFunctionalInterface(that, target);
             } else {
@@ -2481,12 +2571,11 @@
                 desc = fallbackDescriptorType(that);
             }
 
+            setFunctionalInfo(that, pt(), desc, resultInfo.checkContext.inferenceContext());
             List<Type> argtypes = desc.getParameterTypes();
 
-            boolean allowBoxing =
-                    resultInfo.checkContext.deferredAttrContext().phase.isBoxingRequired();
             Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = rs.resolveMemberReference(that.pos(), localEnv, that,
-                    that.expr.type, that.name, argtypes, typeargtypes, allowBoxing);
+                    that.expr.type, that.name, argtypes, typeargtypes, true);
 
             Symbol refSym = refResult.fst;
             Resolve.ReferenceLookupHelper lookupHelper = refResult.snd;
@@ -2535,8 +2624,39 @@
                 }
             }
 
+            that.sym = refSym.baseSymbol();
+            that.kind = lookupHelper.referenceKind(that.sym);
+            that.ownerAccessible = rs.isAccessible(localEnv, that.sym.enclClass());
+
+            if (desc.getReturnType() == Type.recoveryType) {
+                // stop here
+                result = that.type = target;
+                return;
+            }
+
             if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
-                if (refSym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) &&
+
+                if (!that.kind.isUnbound() &&
+                        that.getMode() == ReferenceMode.INVOKE &&
+                        TreeInfo.isStaticSelector(that.expr, names) &&
+                        !that.sym.isStatic()) {
+                    log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
+                            diags.fragment("non-static.cant.be.ref", Kinds.kindName(refSym), refSym));
+                    result = that.type = types.createErrorType(target);
+                    return;
+                }
+
+                if (that.kind.isUnbound() &&
+                        that.getMode() == ReferenceMode.INVOKE &&
+                        TreeInfo.isStaticSelector(that.expr, names) &&
+                        that.sym.isStatic()) {
+                    log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
+                            diags.fragment("static.method.in.unbound.lookup", Kinds.kindName(refSym), refSym));
+                    result = that.type = types.createErrorType(target);
+                    return;
+                }
+
+                if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) &&
                         exprType.getTypeArguments().nonEmpty()) {
                     //static ref with class type-args
                     log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
@@ -2545,20 +2665,19 @@
                     return;
                 }
 
-                if (refSym.isStatic() && !TreeInfo.isStaticSelector(that.expr, names) &&
-                        !lookupHelper.referenceKind(refSym).isUnbound()) {
+                if (that.sym.isStatic() && !TreeInfo.isStaticSelector(that.expr, names) &&
+                        !that.kind.isUnbound()) {
                     //no static bound mrefs
                     log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
                             diags.fragment("static.bound.mref"));
                     result = that.type = types.createErrorType(target);
                     return;
                 }
-            }
-
-            if (desc.getReturnType() == Type.recoveryType) {
-                // stop here
-                result = that.type = target;
-                return;
+
+                if (!refSym.isStatic() && that.kind == JCMemberReference.ReferenceKind.SUPER) {
+                    // Check that super-qualified symbols are not abstract (JLS)
+                    rs.checkNonAbstract(that.pos(), that.sym);
+                }
             }
 
             that.sym = refSym.baseSymbol();
@@ -2593,10 +2712,16 @@
             return;
         }
     }
+    //where
+        ResultInfo memberReferenceQualifierResult(JCMemberReference tree) {
+            //if this is a constructor reference, the expected kind must be a type
+            return new ResultInfo(tree.getMode() == ReferenceMode.INVOKE ? VAL | TYP : TYP, Type.noType);
+        }
+
 
     @SuppressWarnings("fallthrough")
     void checkReferenceCompatible(JCMemberReference tree, Type descriptor, Type refType, CheckContext checkContext, boolean speculativeAttr) {
-        Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType(), types);
+        Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType());
 
         Type resType;
         switch (tree.getMode()) {
@@ -2628,13 +2753,41 @@
         }
 
         if (!speculativeAttr) {
-            List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes(), types);
+            List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes());
             if (chk.unhandled(refType.getThrownTypes(), thrownTypes).nonEmpty()) {
                 log.error(tree, "incompatible.thrown.types.in.mref", refType.getThrownTypes());
             }
         }
     }
 
+    /**
+     * Set functional type info on the underlying AST. Note: as the target descriptor
+     * might contain inference variables, we might need to register an hook in the
+     * current inference context.
+     */
+    private void setFunctionalInfo(final JCFunctionalExpression fExpr, final Type pt, final Type descriptorType, InferenceContext inferenceContext) {
+        if (inferenceContext.free(descriptorType)) {
+            inferenceContext.addFreeTypeListener(List.of(pt, descriptorType), new FreeTypeListener() {
+                public void typesInferred(InferenceContext inferenceContext) {
+                    setFunctionalInfo(fExpr, pt, inferenceContext.asInstType(descriptorType), inferenceContext);
+                }
+            });
+        } else {
+            ListBuffer<TypeSymbol> targets = ListBuffer.lb();
+            if (pt.hasTag(CLASS)) {
+                if (pt.isCompound()) {
+                    for (Type t : ((IntersectionClassType)pt()).interfaces_field) {
+                        targets.append(t.tsym);
+                    }
+                } else {
+                    targets.append(pt.tsym);
+                }
+            }
+            fExpr.targets = targets.toList();
+            fExpr.descriptorType = descriptorType;
+        }
+    }
+
     public void visitParens(JCParens tree) {
         Type owntype = attribTree(tree.expr, env, resultInfo);
         result = check(tree, owntype, pkind(), resultInfo);
@@ -3207,8 +3360,18 @@
                     // Tree<Point>.Visitor.
                     else if (ownOuter.hasTag(CLASS) && site != ownOuter) {
                         Type normOuter = site;
-                        if (normOuter.hasTag(CLASS))
+                        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);
                         if (normOuter != ownOuter)
@@ -3274,6 +3437,7 @@
             if (sym.name != names.init) {
                 chk.checkDeprecated(tree.pos(), env.info.scope.owner, sym);
                 chk.checkSunAPI(tree.pos(), sym);
+                chk.checkProfile(tree.pos(), sym);
             }
 
             // Test (3): if symbol is a variable, check that its type and
@@ -3432,6 +3596,14 @@
             env.info.defaultSuperCallSite = null;
         }
 
+        if (sym.isStatic() && site.isInterface() && env.tree.hasTag(APPLY)) {
+            JCMethodInvocation app = (JCMethodInvocation)env.tree;
+            if (app.meth.hasTag(SELECT) &&
+                    !TreeInfo.isStaticSelector(((JCFieldAccess)app.meth).selected, names)) {
+                log.error(env.tree.pos(), "illegal.static.intf.meth.call", site);
+            }
+        }
+
         // Compute the identifier's instantiated type.
         // For methods, we need to compute the instance type by
         // Resolve.instantiate from the symbol's type as well as
@@ -3587,8 +3759,15 @@
         tree.type = result = checkIntersection(tree, tree.bounds);
     }
 
-     public void visitTypeParameter(JCTypeParameter tree) {
-        TypeVar typeVar = (TypeVar)tree.type;
+    public void visitTypeParameter(JCTypeParameter tree) {
+        TypeVar typeVar = (TypeVar) tree.type;
+
+        if (tree.annotations != null && tree.annotations.nonEmpty()) {
+            AnnotatedType antype = new AnnotatedType(typeVar);
+            annotateType(antype, tree.annotations);
+            tree.type = antype;
+        }
+
         if (!typeVar.bound.isErroneous()) {
             //fixup type-parameter bound computed in 'attribTypeVariables'
             typeVar.bound = checkIntersection(tree, tree.bounds);
@@ -3684,6 +3863,44 @@
         result = tree.type = syms.errType;
     }
 
+    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;
+    }
+
+    /**
+     * 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() {
+            @Override
+            public String toString() {
+                return "annotate " + annotations + " onto " + type;
+            }
+            @Override
+            public void enterAnnotation() {
+                List<Attribute.TypeCompound> compounds = fromAnnotations(annotations);
+                type.typeAnnotations = compounds;
+            }
+        });
+    }
+
+    private static List<Attribute.TypeCompound> fromAnnotations(List<JCAnnotation> annotations) {
+        if (annotations.isEmpty())
+            return List.nil();
+
+        ListBuffer<Attribute.TypeCompound> buf = ListBuffer.lb();
+        for (JCAnnotation anno : annotations) {
+            buf.append((Attribute.TypeCompound) anno.attribute);
+        }
+        return buf.toList();
+    }
+
     public void visitErroneous(JCErroneous tree) {
         if (tree.errs != null)
             for (JCTree err : tree.errs)
@@ -3792,13 +4009,13 @@
                 // Enums may not be extended by source-level classes
                 if (st.tsym != null &&
                     ((st.tsym.flags_field & Flags.ENUM) != 0) &&
-                    ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0) &&
-                    !target.compilerBootstrap(c)) {
+                    ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0)) {
                     log.error(env.tree.pos(), "enum.types.not.extensible");
                 }
                 attribClassBody(env, c);
 
                 chk.checkDeprecatedAnnotation(env.tree.pos(), c);
+                chk.checkClassOverrideEqualsAndHashIfNeeded(env.tree.pos(), c);
             } finally {
                 env.info.returnResult = prevReturnRes;
                 log.useSource(prev);
@@ -3844,24 +4061,14 @@
                 log.error(tree.typarams.head.pos(),
                           "intf.annotation.cant.have.type.params");
 
-            // If this annotation has a @ContainedBy, validate
-            Attribute.Compound containedBy = c.attribute(syms.containedByType.tsym);
-            if (containedBy != null) {
-                // get diagnositc position for error reporting
-                DiagnosticPosition cbPos = getDiagnosticPosition(tree, containedBy.type);
+            // If this annotation has a @Repeatable, validate
+            Attribute.Compound repeatable = c.attribute(syms.repeatableType.tsym);
+            if (repeatable != null) {
+                // get diagnostic position for error reporting
+                DiagnosticPosition cbPos = getDiagnosticPosition(tree, repeatable.type);
                 Assert.checkNonNull(cbPos);
 
-                chk.validateContainedBy(c, containedBy, cbPos);
-            }
-
-            // If this annotation has a @ContainerFor, validate
-            Attribute.Compound containerFor = c.attribute(syms.containerForType.tsym);
-            if (containerFor != null) {
-                // get diagnositc position for error reporting
-                DiagnosticPosition cfPos = getDiagnosticPosition(tree, containerFor.type);
-                Assert.checkNonNull(cfPos);
-
-                chk.validateContainerFor(c, containerFor, cfPos);
+                chk.validateRepeatable(c, repeatable, cbPos);
             }
         } else {
             // Check that all extended classes and interfaces
@@ -3925,6 +4132,12 @@
             (c.flags() & ABSTRACT) == 0) {
             checkSerialVersionUID(tree, c);
         }
+
+        // Correctly organize the postions of the type annotations
+        TypeAnnotations.organizeTypeAnnotationsBodies(this.syms, this.names, this.log, tree);
+
+        // Check type annotations applicability rules
+        validateTypeAnnotations(tree);
     }
         // where
         /** get a diagnostic position for an attribute of Type t, or null if attribute missing */
@@ -3979,8 +4192,98 @@
         }
 
     private Type capture(Type type) {
-        return types.capture(type);
+        //do not capture free types
+        return resultInfo.checkContext.inferenceContext().free(type) ?
+                type : types.capture(type);
+    }
+
+    private void validateTypeAnnotations(JCTree tree) {
+        tree.accept(typeAnnotationsValidator);
     }
+    //where
+    private final JCTree.Visitor typeAnnotationsValidator =
+        new TreeScanner() {
+        public void visitAnnotation(JCAnnotation tree) {
+            if (tree.hasTag(TYPE_ANNOTATION)) {
+                // TODO: It seems to WMD as if the annotation in
+                // parameters, in particular also the recvparam, are never
+                // of type JCTypeAnnotation and therefore never checked!
+                // Luckily this check doesn't really do anything that isn't
+                // also done elsewhere.
+                chk.validateTypeAnnotation(tree, false);
+            }
+            super.visitAnnotation(tree);
+        }
+        public void visitTypeParameter(JCTypeParameter tree) {
+            chk.validateTypeAnnotations(tree.annotations, true);
+            scan(tree.bounds);
+            // Don't call super.
+            // This is needed because above we call validateTypeAnnotation with
+            // false, which would forbid annotations on type parameters.
+            // super.visitTypeParameter(tree);
+        }
+        public void visitMethodDef(JCMethodDecl tree) {
+            // Static methods cannot have receiver type annotations.
+            // In test case FailOver15.java, the nested method getString has
+            // a null sym, because an unknown class is instantiated.
+            // I would say it's safe to skip.
+            if (tree.sym != null && (tree.sym.flags() & Flags.STATIC) != 0) {
+                if (tree.recvparam != null) {
+                    // TODO: better error message. Is the pos good?
+                    log.error(tree.recvparam.pos(), "annotation.type.not.applicable");
+                }
+            }
+            if (tree.restype != null && tree.restype.type != null) {
+                validateAnnotatedType(tree.restype, tree.restype.type);
+            }
+            super.visitMethodDef(tree);
+        }
+        public void visitVarDef(final JCVariableDecl tree) {
+            if (tree.sym != null && tree.sym.type != null)
+                validateAnnotatedType(tree, tree.sym.type);
+            super.visitVarDef(tree);
+        }
+        public void visitTypeCast(JCTypeCast tree) {
+            if (tree.clazz != null && tree.clazz.type != null)
+                validateAnnotatedType(tree.clazz, tree.clazz.type);
+            super.visitTypeCast(tree);
+        }
+        public void visitTypeTest(JCInstanceOf tree) {
+            if (tree.clazz != null && tree.clazz.type != null)
+                validateAnnotatedType(tree.clazz, tree.clazz.type);
+            super.visitTypeTest(tree);
+        }
+        // TODO: what else do we need?
+        // public void visitNewClass(JCNewClass tree) {
+        // public void visitNewArray(JCNewArray tree) {
+
+        /* I would want to model this after
+         * com.sun.tools.javac.comp.Check.Validator.visitSelectInternal(JCFieldAccess)
+         * and override visitSelect and visitTypeApply.
+         * However, we only set the annotated type in the top-level type
+         * of the symbol.
+         * Therefore, we need to override each individual location where a type
+         * can occur.
+         */
+        private void validateAnnotatedType(final JCTree errtree, final Type type) {
+            if (type.getEnclosingType() != null &&
+                    type != type.getEnclosingType()) {
+                validateEnclosingAnnotatedType(errtree, type.getEnclosingType());
+            }
+            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");
+            }
+        }
+    };
 
     // <editor-fold desc="post-attribution visitor">
 
@@ -4088,11 +4391,28 @@
         }
 
         @Override
+        public void visitLambda(JCLambda that) {
+            super.visitLambda(that);
+            if (that.descriptorType == null) {
+                that.descriptorType = syms.unknownType;
+            }
+            if (that.targets == null) {
+                that.targets = List.nil();
+            }
+        }
+
+        @Override
         public void visitReference(JCMemberReference that) {
             super.visitReference(that);
             if (that.sym == null) {
                 that.sym = new MethodSymbol(0, names.empty, syms.unknownType, syms.noSymbol);
             }
+            if (that.descriptorType == null) {
+                that.descriptorType = syms.unknownType;
+            }
+            if (that.targets == null) {
+                that.targets = List.nil();
+            }
         }
     }
     // </editor-fold>
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,7 +26,7 @@
 package com.sun.tools.javac.comp;
 
 import java.util.*;
-import java.util.Set;
+
 import javax.tools.JavaFileManager;
 
 import com.sun.tools.javac.code.*;
@@ -36,14 +36,15 @@
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
 
-import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.code.Lint;
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
 import com.sun.tools.javac.comp.Infer.InferenceContext;
-import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
+import com.sun.tools.javac.comp.Infer.FreeTypeListener;
+import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Flags.ANNOTATION;
@@ -79,6 +80,7 @@
     private boolean enableSunApiLintControl;
     private final TreeInfo treeinfo;
     private final JavaFileManager fileManager;
+    private final Profile profile;
 
     // The set of lint options currently in effect. It is initialized
     // from the context, and then is set/reset as needed by Attr as it
@@ -100,13 +102,16 @@
         context.put(checkKey, this);
 
         names = Names.instance(context);
+        dfltTargetMeta = new Name[] { names.PACKAGE, names.TYPE,
+            names.FIELD, names.METHOD, names.CONSTRUCTOR,
+            names.ANNOTATION_TYPE, names.LOCAL_VARIABLE, names.PARAMETER};
         log = Log.instance(context);
         rs = Resolve.instance(context);
         syms = Symtab.instance(context);
         enter = Enter.instance(context);
         deferredAttr = DeferredAttr.instance(context);
         infer = Infer.instance(context);
-        this.types = Types.instance(context);
+        types = Types.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         Options options = Options.instance(context);
         lint = Lint.instance(context);
@@ -129,6 +134,8 @@
         Target target = Target.instance(context);
         syntheticNameChar = target.syntheticNameChar();
 
+        profile = Profile.instance(context);
+
         boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
         boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
         boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
@@ -278,7 +285,7 @@
      *  @param ex         The failure to report.
      */
     public Type completionError(DiagnosticPosition pos, CompletionFailure ex) {
-        log.error(pos, "cant.access", ex.sym, ex.getDetailValue());
+        log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, pos, "cant.access", ex.sym, ex.getDetailValue());
         if (ex instanceof ClassReader.BadClassFile
                 && !suppressAbortOnBadClassFile) throw new Abort();
         else return syms.errType;
@@ -526,7 +533,7 @@
             inferenceContext.addFreeTypeListener(List.of(req), new FreeTypeListener() {
                 @Override
                 public void typesInferred(InferenceContext inferenceContext) {
-                    checkType(pos, found, inferenceContext.asInstType(req, types), checkContext);
+                    checkType(pos, found, inferenceContext.asInstType(req), checkContext);
                 }
             });
         }
@@ -571,35 +578,28 @@
         if (!tree.type.isErroneous() &&
                 (env.info.lint == null || env.info.lint.isEnabled(Lint.LintCategory.CAST))
                 && types.isSameType(tree.expr.type, tree.clazz.type)
+                && !(ignoreAnnotatedCasts && TreeInfo.containsTypeAnnotation(tree.clazz))
                 && !is292targetTypeCast(tree)) {
             log.warning(Lint.LintCategory.CAST,
                     tree.pos(), "redundant.cast", tree.expr.type);
         }
     }
     //where
-            private boolean is292targetTypeCast(JCTypeCast tree) {
-                boolean is292targetTypeCast = false;
-                JCExpression expr = TreeInfo.skipParens(tree.expr);
-                if (expr.hasTag(APPLY)) {
-                    JCMethodInvocation apply = (JCMethodInvocation)expr;
-                    Symbol sym = TreeInfo.symbol(apply.meth);
-                    is292targetTypeCast = sym != null &&
-                        sym.kind == MTH &&
-                        (sym.flags() & HYPOTHETICAL) != 0;
-                }
-                return is292targetTypeCast;
+        private boolean is292targetTypeCast(JCTypeCast tree) {
+            boolean is292targetTypeCast = false;
+            JCExpression expr = TreeInfo.skipParens(tree.expr);
+            if (expr.hasTag(APPLY)) {
+                JCMethodInvocation apply = (JCMethodInvocation)expr;
+                Symbol sym = TreeInfo.symbol(apply.meth);
+                is292targetTypeCast = sym != null &&
+                    sym.kind == MTH &&
+                    (sym.flags() & HYPOTHETICAL) != 0;
             }
-
-
-
-//where
-        /** Is type a type variable, or a (possibly multi-dimensional) array of
-         *  type variables?
-         */
-        boolean isTypeVar(Type t) {
-            return t.hasTag(TYPEVAR) || t.hasTag(ARRAY) && isTypeVar(types.elemtype(t));
+            return is292targetTypeCast;
         }
 
+        private static final boolean ignoreAnnotatedCasts = true;
+
     /** Check that a type is within some bounds.
      *
      *  Used in TypeApply to verify that, e.g., X in {@code V<X>} is a valid
@@ -634,32 +634,54 @@
         }
     }
 
+    Type checkClassOrArrayType(DiagnosticPosition pos, Type t) {
+        if (!t.hasTag(CLASS) && !t.hasTag(ARRAY) && !t.hasTag(ERROR)) {
+            return typeTagError(pos,
+                                diags.fragment("type.req.class.array"),
+                                asTypeParam(t));
+        } else {
+            return t;
+        }
+    }
+
     /** Check that type is a class or interface type.
      *  @param pos           Position to be used for error reporting.
      *  @param t             The type to be checked.
      */
     Type checkClassType(DiagnosticPosition pos, Type t) {
-        if (!t.hasTag(CLASS) && !t.hasTag(ERROR))
+        if (!t.hasTag(CLASS) && !t.hasTag(ERROR)) {
             return typeTagError(pos,
                                 diags.fragment("type.req.class"),
-                                (t.hasTag(TYPEVAR))
-                                ? diags.fragment("type.parameter", t)
-                                : t);
-        else
+                                asTypeParam(t));
+        } else {
             return t;
+        }
     }
+    //where
+        private Object asTypeParam(Type t) {
+            return (t.hasTag(TYPEVAR))
+                                    ? diags.fragment("type.parameter", t)
+                                    : t;
+        }
 
     /** Check that type is a valid qualifier for a constructor reference expression
      */
     Type checkConstructorRefType(DiagnosticPosition pos, Type t) {
-        t = checkClassType(pos, t);
+        t = checkClassOrArrayType(pos, t);
         if (t.hasTag(CLASS)) {
             if ((t.tsym.flags() & (ABSTRACT | INTERFACE)) != 0) {
-                log.error(pos, "abstract.cant.be.instantiated");
+                log.error(pos, "abstract.cant.be.instantiated", t.tsym);
                 t = types.createErrorType(t);
             } else if ((t.tsym.flags() & ENUM) != 0) {
                 log.error(pos, "enum.cant.be.instantiated");
                 t = types.createErrorType(t);
+            } else {
+                t = checkClassType(pos, t, true);
+            }
+        } else if (t.hasTag(ARRAY)) {
+            if (!types.isReifiable(((ArrayType)t).elemtype)) {
+                log.error(pos, "generic.array.creation");
+                t = types.createErrorType(t);
             }
         }
         return t;
@@ -690,11 +712,8 @@
      *  @param t             The type to be checked.
      */
     Type checkReifiableReferenceType(DiagnosticPosition pos, Type t) {
-        if (!t.hasTag(CLASS) && !t.hasTag(ARRAY) && !t.hasTag(ERROR)) {
-            return typeTagError(pos,
-                                diags.fragment("type.req.class.array"),
-                                t);
-        } else if (!types.isReifiable(t)) {
+        t = checkClassOrArrayType(pos, t);
+        if (!t.isErroneous() && !types.isReifiable(t)) {
             log.error(pos, "illegal.generic.type.for.instof");
             return types.createErrorType(t);
         } else {
@@ -840,7 +859,7 @@
         // System.out.println("actuals: " + argtypes);
         List<Type> formals = owntype.getParameterTypes();
         Type last = useVarargs ? formals.last() : null;
-        if (sym.name==names.init &&
+        if (sym.name == names.init &&
                 sym.owner == syms.enumSym)
                 formals = formals.tail.tail;
         List<JCExpression> args = argtrees;
@@ -888,7 +907,6 @@
                    syms.methodClass);
         }
         if (useVarargs) {
-            JCTree tree = env.tree;
             Type argtype = owntype.getParameterTypes().last();
             if (!types.isReifiable(argtype) &&
                     (!allowSimplifiedVarargs ||
@@ -899,22 +917,13 @@
                                   argtype);
             }
             if (!((MethodSymbol)sym.baseSymbol()).isSignaturePolymorphic(types)) {
-                Type elemtype = types.elemtype(argtype);
-                switch (tree.getTag()) {
-                    case APPLY:
-                        ((JCMethodInvocation) tree).varargsElement = elemtype;
-                        break;
-                    case NEWCLASS:
-                        ((JCNewClass) tree).varargsElement = elemtype;
-                        break;
-                    case REFERENCE:
-                        ((JCMemberReference) tree).varargsElement = elemtype;
-                        break;
-                    default:
-                        throw new AssertionError(""+tree);
-                }
+                TreeInfo.setVarargsElement(env.tree, types.elemtype(argtype));
             }
          }
+         PolyKind pkind = (sym.type.hasTag(FORALL) &&
+                 sym.type.getReturnType().containsAny(((ForAll)sym.type).tvars)) ?
+                 PolyKind.POLY : PolyKind.STANDALONE;
+         TreeInfo.setPolyKind(env.tree, pkind);
          return owntype;
     }
     //where
@@ -1024,7 +1033,7 @@
         };
 
     /** Check that given modifiers are legal for given symbol and
-     *  return modifiers together with any implicit modififiers for that symbol.
+     *  return modifiers together with any implicit modifiers for that symbol.
      *  Warning: we can't use flags() here since this method
      *  is called during class enter, when flags() would cause a premature
      *  completion.
@@ -1055,9 +1064,12 @@
                 } else
                     mask = ConstructorFlags;
             }  else if ((sym.owner.flags_field & INTERFACE) != 0) {
-                if ((flags & DEFAULT) != 0) {
-                    mask = InterfaceDefaultMethodMask;
-                    implicit = PUBLIC | ABSTRACT;
+                if ((flags & (DEFAULT | STATIC)) != 0) {
+                    mask = InterfaceMethodMask;
+                    implicit = PUBLIC;
+                    if ((flags & DEFAULT) != 0) {
+                        implicit |= ABSTRACT;
+                    }
                 } else {
                     mask = implicit = InterfaceMethodFlags;
                 }
@@ -1067,7 +1079,7 @@
             }
             // Imply STRICTFP if owner has STRICTFP set.
             if (((flags|implicit) & Flags.ABSTRACT) == 0)
-              implicit |= sym.owner.flags_field & STRICTFP;
+                implicit |= sym.owner.flags_field & STRICTFP;
             break;
         case TYP:
             if (sym.isLocal()) {
@@ -1127,6 +1139,10 @@
                                 PRIVATE | STATIC | DEFAULT))
                  &&
                  checkDisjoint(pos, flags,
+                                STATIC,
+                                DEFAULT)
+                 &&
+                 checkDisjoint(pos, flags,
                                ABSTRACT | INTERFACE,
                                FINAL | NATIVE | SYNCHRONIZED)
                  &&
@@ -1316,6 +1332,11 @@
             }
         }
 
+        @Override
+        public void visitAnnotatedType(JCAnnotatedType tree) {
+            tree.underlyingType.accept(this);
+        }
+
         /** Default visitor method: do nothing.
          */
         @Override
@@ -1577,6 +1598,7 @@
                    (other.flags() & STATIC) == 0) {
             log.error(TreeInfo.diagnosticPositionFor(m, tree), "override.static",
                       cannotOverride(m, other));
+            m.flags_field |= BAD_OVERRIDE;
             return;
         }
 
@@ -1588,6 +1610,7 @@
             log.error(TreeInfo.diagnosticPositionFor(m, tree), "override.meth",
                       cannotOverride(m, other),
                       asFlagSet(other.flags() & (FINAL | STATIC)));
+            m.flags_field |= BAD_OVERRIDE;
             return;
         }
 
@@ -1604,6 +1627,7 @@
                       other.flags() == 0 ?
                           Flag.PACKAGE :
                           asFlagSet(other.flags() & AccessFlags));
+            m.flags_field |= BAD_OVERRIDE;
             return;
         }
 
@@ -1631,6 +1655,7 @@
                           "override.incompatible.ret",
                           cannotOverride(m, other),
                           mtres, otres);
+                m.flags_field |= BAD_OVERRIDE;
                 return;
             }
         } else if (overrideWarner.hasNonSilentLint(LintCategory.UNCHECKED)) {
@@ -1650,6 +1675,7 @@
                       "override.meth.doesnt.throw",
                       cannotOverride(m, other),
                       unhandledUnerased.head);
+            m.flags_field |= BAD_OVERRIDE;
             return;
         }
         else if (unhandledUnerased.nonEmpty()) {
@@ -1945,6 +1971,52 @@
         }
     }
 
+    private Filter<Symbol> equalsHasCodeFilter = new Filter<Symbol>() {
+        public boolean accepts(Symbol s) {
+            return MethodSymbol.implementation_filter.accepts(s) &&
+                    (s.flags() & BAD_OVERRIDE) == 0;
+
+        }
+    };
+
+    public void checkClassOverrideEqualsAndHashIfNeeded(DiagnosticPosition pos,
+            ClassSymbol someClass) {
+        /* At present, annotations cannot possibly have a method that is override
+         * equivalent with Object.equals(Object) but in any case the condition is
+         * fine for completeness.
+         */
+        if (someClass == (ClassSymbol)syms.objectType.tsym ||
+            someClass.isInterface() || someClass.isEnum() ||
+            (someClass.flags() & ANNOTATION) != 0 ||
+            (someClass.flags() & ABSTRACT) != 0) return;
+        //anonymous inner classes implementing interfaces need especial treatment
+        if (someClass.isAnonymous()) {
+            List<Type> interfaces =  types.interfaces(someClass.type);
+            if (interfaces != null && !interfaces.isEmpty() &&
+                interfaces.head.tsym == syms.comparatorType.tsym) return;
+        }
+        checkClassOverrideEqualsAndHash(pos, someClass);
+    }
+
+    private void checkClassOverrideEqualsAndHash(DiagnosticPosition pos,
+            ClassSymbol someClass) {
+        if (lint.isEnabled(LintCategory.OVERRIDES)) {
+            MethodSymbol equalsAtObject = (MethodSymbol)syms.objectType
+                    .tsym.members().lookup(names.equals).sym;
+            MethodSymbol hashCodeAtObject = (MethodSymbol)syms.objectType
+                    .tsym.members().lookup(names.hashCode).sym;
+            boolean overridesEquals = types.implementation(equalsAtObject,
+                someClass, false, equalsHasCodeFilter).owner == someClass;
+            boolean overridesHashCode = types.implementation(hashCodeAtObject,
+                someClass, false, equalsHasCodeFilter) != hashCodeAtObject;
+
+            if (overridesEquals && !overridesHashCode) {
+                log.warning(LintCategory.OVERRIDES, pos,
+                        "override.equals.but.not.hashcode", someClass);
+            }
+        }
+    }
+
     private boolean checkNameClash(ClassSymbol origin, Symbol s1, Symbol s2) {
         ClashFilter cf = new ClashFilter(origin.type);
         return (cf.accepts(s1) &&
@@ -2221,10 +2293,13 @@
     void checkFunctionalInterface(JCTree tree, Type funcInterface) {
         ClassType c = new ClassType(Type.noType, List.<Type>nil(), null);
         ClassSymbol csym = new ClassSymbol(0, names.empty, c, syms.noSymbol);
-        c.interfaces_field = List.of(funcInterface);
+        c.interfaces_field = List.of(types.removeWildcards(funcInterface));
         c.supertype_field = syms.objectType;
         c.tsym = csym;
         csym.members_field = new Scope(csym);
+        Symbol descSym = types.findDescriptorSymbol(funcInterface.tsym);
+        Type descType = types.findDescriptorType(funcInterface);
+        csym.members_field.enter(new MethodSymbol(PUBLIC, descSym.name, descType, csym));
         csym.completer = null;
         checkImplementations(tree, csym, csym);
     }
@@ -2236,7 +2311,7 @@
     void checkImplementations(JCClassDecl tree) {
         checkImplementations(tree, tree.sym, tree.sym);
     }
-//where
+    //where
         /** Check that all methods which implement some
          *  method in `ic' conform to the method they implement.
          */
@@ -2577,6 +2652,13 @@
             validateAnnotation(a, s);
     }
 
+    /** Check the type annotations.
+     */
+    public void validateTypeAnnotations(List<JCAnnotation> annotations, boolean isTypeParameter) {
+        for (JCAnnotation a : annotations)
+            validateTypeAnnotation(a, isTypeParameter);
+    }
+
     /** Check an annotation of a symbol.
      */
     private void validateAnnotation(JCAnnotation a, Symbol s) {
@@ -2589,113 +2671,72 @@
             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());
+                }
+            }
+        }
+    }
+
+    public void validateTypeAnnotation(JCAnnotation a, boolean isTypeParameter) {
+        Assert.checkNonNull(a.type, "annotation tree hasn't been attributed yet: " + a);
+        validateAnnotationTree(a);
+
+        if (!isTypeAnnotation(a, isTypeParameter))
+            log.error(a.pos(), "annotation.type.not.applicable");
     }
 
     /**
-     * Validate the proposed container 'containedBy' on the
+     * Validate the proposed container 'repeatable' on the
      * annotation type symbol 's'. Report errors at position
      * 'pos'.
      *
-     * @param s The (annotation)type declaration annotated with a @ContainedBy
-     * @param containedBy the @ContainedBy on 's'
+     * @param s The (annotation)type declaration annotated with a @Repeatable
+     * @param repeatable the @Repeatable on 's'
      * @param pos where to report errors
      */
-    public void validateContainedBy(TypeSymbol s, Attribute.Compound containedBy, DiagnosticPosition pos) {
-        Assert.check(types.isSameType(containedBy.type, syms.containedByType));
+    public void validateRepeatable(TypeSymbol s, Attribute.Compound repeatable, DiagnosticPosition pos) {
+        Assert.check(types.isSameType(repeatable.type, syms.repeatableType));
 
         Type t = null;
-        List<Pair<MethodSymbol,Attribute>> l = containedBy.values;
-        if (!l.isEmpty()) {
-            Assert.check(l.head.fst.name == names.value);
-            t = ((Attribute.Class)l.head.snd).getValue();
-        }
-
-        if (t == null) {
-            log.error(pos, "invalid.container.wrong.containedby", s, containedBy);
-            return;
-        }
-
-        validateHasContainerFor(t.tsym, s, pos);
-        validateRetention(t.tsym, s, pos);
-        validateDocumented(t.tsym, s, pos);
-        validateInherited(t.tsym, s, pos);
-        validateTarget(t.tsym, s, pos);
-        validateDefault(t.tsym, s, pos);
-    }
-
-    /**
-     * Validate the proposed container 'containerFor' on the
-     * annotation type symbol 's'. Report errors at position
-     * 'pos'.
-     *
-     * @param s The (annotation)type declaration annotated with a @ContainerFor
-     * @param containerFor the @ContainedFor on 's'
-     * @param pos where to report errors
-     */
-    public void validateContainerFor(TypeSymbol s, Attribute.Compound containerFor, DiagnosticPosition pos) {
-        Assert.check(types.isSameType(containerFor.type, syms.containerForType));
-
-        Type t = null;
-        List<Pair<MethodSymbol,Attribute>> l = containerFor.values;
+        List<Pair<MethodSymbol,Attribute>> l = repeatable.values;
         if (!l.isEmpty()) {
             Assert.check(l.head.fst.name == names.value);
             t = ((Attribute.Class)l.head.snd).getValue();
         }
 
         if (t == null) {
-            log.error(pos, "invalid.container.wrong.containerfor", s, containerFor);
-            return;
-        }
-
-        validateHasContainedBy(t.tsym, s, pos);
-    }
-
-    private void validateHasContainedBy(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
-        Attribute.Compound containedBy = container.attribute(syms.containedByType.tsym);
-
-        if (containedBy == null) {
-            log.error(pos, "invalid.container.no.containedby", container, syms.containedByType.tsym);
-            return;
-        }
-
-        Type t = null;
-        List<Pair<MethodSymbol,Attribute>> l = containedBy.values;
-        if (!l.isEmpty()) {
-            Assert.check(l.head.fst.name == names.value);
-            t = ((Attribute.Class)l.head.snd).getValue();
-        }
-
-        if (t == null) {
-            log.error(pos, "invalid.container.wrong.containedby", container, contained);
+            // errors should already have been reported during Annotate
             return;
         }
 
-        if (!types.isSameType(t, contained.type))
-            log.error(pos, "invalid.container.wrong.containedby", t.tsym, contained);
+        validateValue(t.tsym, s, pos);
+        validateRetention(t.tsym, s, pos);
+        validateDocumented(t.tsym, s, pos);
+        validateInherited(t.tsym, s, pos);
+        validateTarget(t.tsym, s, pos);
+        validateDefault(t.tsym, s, pos);
     }
 
-    private void validateHasContainerFor(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
-        Attribute.Compound containerFor = container.attribute(syms.containerForType.tsym);
-
-        if (containerFor == null) {
-            log.error(pos, "invalid.container.no.containerfor", container, syms.containerForType.tsym);
-            return;
+    private void validateValue(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
+        Scope.Entry e = container.members().lookup(names.value);
+        if (e.scope != null && e.sym.kind == MTH) {
+            MethodSymbol m = (MethodSymbol) e.sym;
+            Type ret = m.getReturnType();
+            if (!(ret.hasTag(ARRAY) && types.isSameType(((ArrayType)ret).elemtype, contained.type))) {
+                log.error(pos, "invalid.repeatable.annotation.value.return",
+                        container, ret, types.makeArrayType(contained.type));
+            }
+        } else {
+            log.error(pos, "invalid.repeatable.annotation.no.value", container);
         }
-
-        Type t = null;
-        List<Pair<MethodSymbol,Attribute>> l = containerFor.values;
-        if (!l.isEmpty()) {
-            Assert.check(l.head.fst.name == names.value);
-            t = ((Attribute.Class)l.head.snd).getValue();
-        }
-
-        if (t == null) {
-            log.error(pos, "invalid.container.wrong.containerfor", container, contained);
-            return;
-        }
-
-        if (!types.isSameType(t, contained.type))
-            log.error(pos, "invalid.container.wrong.containerfor", t.tsym, contained);
     }
 
     private void validateRetention(Symbol container, Symbol contained, DiagnosticPosition pos) {
@@ -2715,7 +2756,7 @@
             }
         }
         if (error ) {
-            log.error(pos, "invalid.containedby.annotation.retention",
+            log.error(pos, "invalid.repeatable.annotation.retention",
                       container, containerRetention,
                       contained, containedRetention);
         }
@@ -2724,7 +2765,7 @@
     private void validateDocumented(Symbol container, Symbol contained, DiagnosticPosition pos) {
         if (contained.attribute(syms.documentedType.tsym) != null) {
             if (container.attribute(syms.documentedType.tsym) == null) {
-                log.error(pos, "invalid.containedby.annotation.not.documented", container, contained);
+                log.error(pos, "invalid.repeatable.annotation.not.documented", container, contained);
             }
         }
     }
@@ -2732,31 +2773,23 @@
     private void validateInherited(Symbol container, Symbol contained, DiagnosticPosition pos) {
         if (contained.attribute(syms.inheritedType.tsym) != null) {
             if (container.attribute(syms.inheritedType.tsym) == null) {
-                log.error(pos, "invalid.containedby.annotation.not.inherited", container, contained);
+                log.error(pos, "invalid.repeatable.annotation.not.inherited", container, contained);
             }
         }
     }
 
     private void validateTarget(Symbol container, Symbol contained, DiagnosticPosition pos) {
-        Attribute.Array containedTarget = getAttributeTargetAttribute(contained);
-
-        // If contained has no Target, we are done
-        if (containedTarget == null) {
-            return;
-        }
-
-        // If contained has Target m1, container must have a Target
-        // annotation, m2, and m2 must be a subset of m1. (This is
-        // trivially true if contained has no target as per above).
-
-        // contained has target, but container has not, error
+        // The set of targets the container is applicable to must be a subset
+        // (with respect to annotation target semantics) of the set of targets
+        // the contained is applicable to. The target sets may be implicit or
+        // explicit.
+
+        Set<Name> containerTargets;
         Attribute.Array containerTarget = getAttributeTargetAttribute(container);
         if (containerTarget == null) {
-            log.error(pos, "invalid.containedby.annotation.incompatible.target", container, contained);
-            return;
-        }
-
-        Set<Name> containerTargets = new HashSet<Name>();
+            containerTargets = getDefaultTargetSet();
+        } else {
+            containerTargets = new HashSet<Name>();
         for (Attribute app : containerTarget.values) {
             if (!(app instanceof Attribute.Enum)) {
                 continue; // recovery
@@ -2764,8 +2797,14 @@
             Attribute.Enum e = (Attribute.Enum)app;
             containerTargets.add(e.value.name);
         }
-
-        Set<Name> containedTargets = new HashSet<Name>();
+        }
+
+        Set<Name> containedTargets;
+        Attribute.Array containedTarget = getAttributeTargetAttribute(contained);
+        if (containedTarget == null) {
+            containedTargets = getDefaultTargetSet();
+        } else {
+            containedTargets = new HashSet<Name>();
         for (Attribute app : containedTarget.values) {
             if (!(app instanceof Attribute.Enum)) {
                 continue; // recovery
@@ -2773,20 +2812,42 @@
             Attribute.Enum e = (Attribute.Enum)app;
             containedTargets.add(e.value.name);
         }
-
-        if (!isTargetSubset(containedTargets, containerTargets)) {
-            log.error(pos, "invalid.containedby.annotation.incompatible.target", container, contained);
+        }
+
+        if (!isTargetSubsetOf(containerTargets, containedTargets)) {
+            log.error(pos, "invalid.repeatable.annotation.incompatible.target", container, contained);
         }
     }
 
-    /** Checks that t is a subset of s, with respect to ElementType
+    /* get a set of names for the default target */
+    private Set<Name> getDefaultTargetSet() {
+        if (defaultTargets == null) {
+            Set<Name> targets = new HashSet<Name>();
+            targets.add(names.ANNOTATION_TYPE);
+            targets.add(names.CONSTRUCTOR);
+            targets.add(names.FIELD);
+            targets.add(names.LOCAL_VARIABLE);
+            targets.add(names.METHOD);
+            targets.add(names.PACKAGE);
+            targets.add(names.PARAMETER);
+            targets.add(names.TYPE);
+
+            defaultTargets = java.util.Collections.unmodifiableSet(targets);
+        }
+
+        return defaultTargets;
+    }
+    private Set<Name> defaultTargets;
+
+
+    /** Checks that s is a subset of t, with respect to ElementType
      * semantics, specifically {ANNOTATION_TYPE} is a subset of {TYPE}
      */
-    private boolean isTargetSubset(Set<Name> s, Set<Name> t) {
-        // Check that all elements in t are present in s
-        for (Name n2 : t) {
+    private boolean isTargetSubsetOf(Set<Name> s, Set<Name> t) {
+        // Check that all elements in s are present in t
+        for (Name n2 : s) {
             boolean currentElementOk = false;
-            for (Name n1 : s) {
+            for (Name n1 : t) {
                 if (n1 == n2) {
                     currentElementOk = true;
                     break;
@@ -2809,7 +2870,7 @@
                 elm.kind == Kinds.MTH &&
                 ((MethodSymbol)elm).defaultValue == null) {
                 log.error(pos,
-                          "invalid.containedby.annotation.elem.nondefault",
+                          "invalid.repeatable.annotation.elem.nondefault",
                           container,
                           elm);
             }
@@ -2834,45 +2895,90 @@
         return false;
     }
 
+    /** Is the annotation applicable to type annotations? */
+    protected boolean isTypeAnnotation(JCAnnotation a, boolean isTypeParameter) {
+        Attribute.Compound atTarget =
+            a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym);
+        if (atTarget == null) {
+            // An annotation without @Target is not a type annotation.
+            return false;
+        }
+
+        Attribute atValue = atTarget.member(names.value);
+        if (!(atValue instanceof Attribute.Array)) {
+            return false; // error recovery
+        }
+
+        Attribute.Array arr = (Attribute.Array) atValue;
+        for (Attribute app : arr.values) {
+            if (!(app instanceof Attribute.Enum)) {
+                return false; // recovery
+            }
+            Attribute.Enum e = (Attribute.Enum) app;
+
+            if (e.value.name == names.TYPE_USE)
+                return true;
+            else if (isTypeParameter && e.value.name == names.TYPE_PARAMETER)
+                return true;
+        }
+        return false;
+    }
+
     /** Is the annotation applicable to the symbol? */
     boolean annotationApplicable(JCAnnotation a, Symbol s) {
         Attribute.Array arr = getAttributeTargetAttribute(a.annotationType.type.tsym);
+        Name[] targets;
+
         if (arr == null) {
-            return true;
+            targets = defaultTargetMetaInfo(a, s);
+        } else {
+            // TODO: can we optimize this?
+            targets = new Name[arr.values.length];
+            for (int i=0; i<arr.values.length; ++i) {
+                Attribute app = arr.values[i];
+                if (!(app instanceof Attribute.Enum)) {
+                    return true; // recovery
+                }
+                Attribute.Enum e = (Attribute.Enum) app;
+                targets[i] = e.value.name;
+            }
         }
-        for (Attribute app : arr.values) {
-            if (!(app instanceof Attribute.Enum)) return true; // recovery
-            Attribute.Enum e = (Attribute.Enum) app;
-            if (e.value.name == names.TYPE)
+        for (Name target : targets) {
+            if (target == names.TYPE)
                 { if (s.kind == TYP) return true; }
-            else if (e.value.name == names.FIELD)
+            else if (target == names.FIELD)
                 { if (s.kind == VAR && s.owner.kind != MTH) return true; }
-            else if (e.value.name == names.METHOD)
+            else if (target == names.METHOD)
                 { if (s.kind == MTH && !s.isConstructor()) return true; }
-            else if (e.value.name == names.PARAMETER)
+            else if (target == names.PARAMETER)
                 { if (s.kind == VAR &&
                       s.owner.kind == MTH &&
                       (s.flags() & PARAMETER) != 0)
                     return true;
                 }
-            else if (e.value.name == names.CONSTRUCTOR)
+            else if (target == names.CONSTRUCTOR)
                 { if (s.kind == MTH && s.isConstructor()) return true; }
-            else if (e.value.name == names.LOCAL_VARIABLE)
+            else if (target == names.LOCAL_VARIABLE)
                 { if (s.kind == VAR && s.owner.kind == MTH &&
                       (s.flags() & PARAMETER) == 0)
                     return true;
                 }
-            else if (e.value.name == names.ANNOTATION_TYPE)
+            else if (target == names.ANNOTATION_TYPE)
                 { if (s.kind == TYP && (s.flags() & ANNOTATION) != 0)
                     return true;
                 }
-            else if (e.value.name == names.PACKAGE)
+            else if (target == names.PACKAGE)
                 { if (s.kind == PCK) return true; }
-            else if (e.value.name == names.TYPE_USE)
+            else if (target == names.TYPE_USE)
                 { if (s.kind == TYP ||
                       s.kind == VAR ||
                       (s.kind == MTH && !s.isConstructor() &&
-                       !s.type.getReturnType().hasTag(VOID)))
+                      !s.type.getReturnType().hasTag(VOID)) ||
+                      (s.kind == MTH && s.isConstructor()))
+                    return true;
+                }
+            else if (target == names.TYPE_PARAMETER)
+                { if (s.kind == TYP && s.type.hasTag(TYPEVAR))
                     return true;
                 }
             else
@@ -2891,6 +2997,11 @@
         return (Attribute.Array) atValue;
     }
 
+    private final Name[] dfltTargetMeta;
+    private Name[] defaultTargetMetaInfo(JCAnnotation a, Symbol s) {
+        return dfltTargetMeta;
+    }
+
     /** Check an annotation value.
      *
      * @param a The annotation tree to check
@@ -3006,6 +3117,12 @@
         }
     }
 
+    void checkProfile(final DiagnosticPosition pos, final Symbol s) {
+        if (profile != Profile.DEFAULT && (s.flags() & NOT_IN_PROFILE) != 0) {
+            log.error(pos, "not.in.profile", s, profile);
+        }
+    }
+
 /* *************************************************************************
  * Check for recursive annotation elements.
  **************************************************************************/
--- a/src/share/classes/com/sun/tools/javac/comp/ConstFold.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/ConstFold.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -29,8 +29,6 @@
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.util.*;
 
-import com.sun.tools.javac.code.Type.*;
-
 import static com.sun.tools.javac.code.TypeTag.BOOLEAN;
 
 import static com.sun.tools.javac.jvm.ByteCodes.*;
--- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Tue Jul 02 10:13:00 2013 +0100
@@ -38,6 +38,7 @@
 import javax.tools.JavaFileObject;
 
 import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Queue;
@@ -64,8 +65,10 @@
 
     final Attr attr;
     final Check chk;
+    final JCDiagnostic.Factory diags;
     final Enter enter;
     final Infer infer;
+    final Resolve rs;
     final Log log;
     final Symtab syms;
     final TreeMaker make;
@@ -82,14 +85,21 @@
         context.put(deferredAttrKey, this);
         attr = Attr.instance(context);
         chk = Check.instance(context);
+        diags = JCDiagnostic.Factory.instance(context);
         enter = Enter.instance(context);
         infer = Infer.instance(context);
+        rs = Resolve.instance(context);
         log = Log.instance(context);
         syms = Symtab.instance(context);
         make = TreeMaker.instance(context);
         types = Types.instance(context);
+        Names names = Names.instance(context);
+        stuckTree = make.Ident(names.empty).setType(Type.noType);
     }
 
+    /** shared tree for stuck expressions */
+    final JCTree stuckTree;
+
     /**
      * This type represents a deferred type. A deferred type starts off with
      * no information on the underlying expression type. Such info needs to be
@@ -177,29 +187,19 @@
          * attribution round must follow one or more speculative rounds.
          */
         Type check(ResultInfo resultInfo) {
+            return check(resultInfo, stuckVars(tree, env, resultInfo), basicCompleter);
+        }
+
+        Type check(ResultInfo resultInfo, List<Type> stuckVars, DeferredTypeCompleter deferredTypeCompleter) {
             DeferredAttrContext deferredAttrContext =
                     resultInfo.checkContext.deferredAttrContext();
             Assert.check(deferredAttrContext != emptyDeferredAttrContext);
-            List<Type> stuckVars = stuckVars(tree, env, resultInfo);
             if (stuckVars.nonEmpty()) {
                 deferredAttrContext.addDeferredAttrNode(this, resultInfo, stuckVars);
                 return Type.noType;
             } else {
                 try {
-                    switch (deferredAttrContext.mode) {
-                        case SPECULATIVE:
-                            Assert.check(mode == null ||
-                                    (mode == AttrMode.SPECULATIVE &&
-                                    speculativeType(deferredAttrContext.msym, deferredAttrContext.phase).hasTag(NONE)));
-                            JCTree speculativeTree = attribSpeculative(tree, env, resultInfo);
-                            speculativeCache.put(deferredAttrContext.msym, speculativeTree, deferredAttrContext.phase);
-                            return speculativeTree.type;
-                        case CHECK:
-                            Assert.check(mode == AttrMode.SPECULATIVE);
-                            return attr.attribTree(tree, env, resultInfo);
-                    }
-                    Assert.error();
-                    return null;
+                    return deferredTypeCompleter.complete(this, resultInfo, deferredAttrContext);
                 } finally {
                     mode = deferredAttrContext.mode;
                 }
@@ -208,6 +208,50 @@
     }
 
     /**
+     * A completer for deferred types. Defines an entry point for type-checking
+     * a deferred type.
+     */
+    interface DeferredTypeCompleter {
+        /**
+         * Entry point for type-checking a deferred type. Depending on the
+         * circumstances, type-checking could amount to full attribution
+         * or partial structural check (aka potential applicability).
+         */
+        Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext);
+    }
+
+    /**
+     * A basic completer for deferred types. This completer type-checks a deferred type
+     * using attribution; depending on the attribution mode, this could be either standard
+     * or speculative attribution.
+     */
+    DeferredTypeCompleter basicCompleter = new DeferredTypeCompleter() {
+        public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+            switch (deferredAttrContext.mode) {
+                case SPECULATIVE:
+                    //Note: if a symbol is imported twice we might do two identical
+                    //speculative rounds...
+                    Assert.check(dt.mode == null || dt.mode == AttrMode.SPECULATIVE);
+                    JCTree speculativeTree = attribSpeculative(dt.tree, dt.env, resultInfo);
+                    dt.speculativeCache.put(deferredAttrContext.msym, speculativeTree, deferredAttrContext.phase);
+                    return speculativeTree.type;
+                case CHECK:
+                    Assert.check(dt.mode != null);
+                    return attr.attribTree(dt.tree, dt.env, resultInfo);
+            }
+            Assert.error();
+            return null;
+        }
+    };
+
+    DeferredTypeCompleter dummyCompleter = new DeferredTypeCompleter() {
+        public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+            Assert.check(deferredAttrContext.mode == AttrMode.CHECK);
+            return dt.tree.type = Type.noType;
+        }
+    };
+
+    /**
      * The 'mode' in which the deferred type is to be type-checked
      */
     public enum AttrMode {
@@ -232,25 +276,33 @@
      * disabled during speculative type-checking.
      */
     JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
-        JCTree newTree = new TreeCopier<Object>(make).copy(tree);
+        final JCTree newTree = new TreeCopier<Object>(make).copy(tree);
         Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared()));
         speculativeEnv.info.scope.owner = env.info.scope.owner;
-        final JavaFileObject currentSource = log.currentSourceFile();
         Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
                 new Log.DeferredDiagnosticHandler(log, new Filter<JCDiagnostic>() {
-            public boolean accepts(JCDiagnostic t) {
-                return t.getDiagnosticSource().getFile().equals(currentSource);
+            public boolean accepts(final JCDiagnostic d) {
+                class PosScanner extends TreeScanner {
+                    boolean found = false;
+
+                    @Override
+                    public void scan(JCTree tree) {
+                        if (tree != null &&
+                                tree.pos() == d.getDiagnosticPosition()) {
+                            found = true;
+                        }
+                        super.scan(tree);
+                    }
+                };
+                PosScanner posScanner = new PosScanner();
+                posScanner.scan(newTree);
+                return posScanner.found;
             }
         });
         try {
             attr.attribTree(newTree, speculativeEnv, resultInfo);
             unenterScanner.scan(newTree);
             return newTree;
-        } catch (Abort ex) {
-            //if some very bad condition occurred during deferred attribution
-            //we should dump all errors before killing javac
-            deferredDiagnosticHandler.reportDeferredDiagnostics();
-            throw ex;
         } finally {
             unenterScanner.scan(newTree);
             log.popDiagnosticHandler(deferredDiagnosticHandler);
@@ -297,13 +349,22 @@
         /** inference context */
         final InferenceContext inferenceContext;
 
+        /** parent deferred context */
+        final DeferredAttrContext parent;
+
+        /** Warner object to report warnings */
+        final Warner warn;
+
         /** list of deferred attribution nodes to be processed */
         ArrayList<DeferredAttrNode> deferredAttrNodes = new ArrayList<DeferredAttrNode>();
 
-        DeferredAttrContext(AttrMode mode, Symbol msym, MethodResolutionPhase phase, InferenceContext inferenceContext) {
+        DeferredAttrContext(AttrMode mode, Symbol msym, MethodResolutionPhase phase,
+                InferenceContext inferenceContext, DeferredAttrContext parent, Warner warn) {
             this.mode = mode;
             this.msym = msym;
             this.phase = phase;
+            this.parent = parent;
+            this.warn = warn;
             this.inferenceContext = inferenceContext;
         }
 
@@ -328,76 +389,172 @@
                 //scan a defensive copy of the node list - this is because a deferred
                 //attribution round can add new nodes to the list
                 for (DeferredAttrNode deferredAttrNode : List.from(deferredAttrNodes)) {
-                    if (!deferredAttrNode.isStuck()) {
-                        deferredAttrNode.process();
+                    if (!deferredAttrNode.process(this)) {
+                        stuckVars.addAll(deferredAttrNode.stuckVars);
+                    } else {
                         deferredAttrNodes.remove(deferredAttrNode);
                         progress = true;
-                    } else {
-                        stuckVars.addAll(deferredAttrNode.stuckVars);
                     }
                 }
                 if (!progress) {
                     //remove all variables that have already been instantiated
                     //from the list of stuck variables
-                    inferenceContext.solveAny(inferenceContext.freeVarsIn(List.from(stuckVars)), types, infer);
-                    inferenceContext.notifyChange(types);
+                    inferenceContext.solveAny(List.from(stuckVars), warn);
+                    inferenceContext.notifyChange();
                 }
             }
         }
+    }
+
+    /**
+     * Class representing a deferred attribution node. It keeps track of
+     * a deferred type, along with the expected target type information.
+     */
+    class DeferredAttrNode implements Infer.FreeTypeListener {
+
+        /** underlying deferred type */
+        DeferredType dt;
+
+        /** underlying target type information */
+        ResultInfo resultInfo;
+
+        /** list of uninferred inference variables causing this node to be stuck */
+        List<Type> stuckVars;
+
+        DeferredAttrNode(DeferredType dt, ResultInfo resultInfo, List<Type> stuckVars) {
+            this.dt = dt;
+            this.resultInfo = resultInfo;
+            this.stuckVars = stuckVars;
+            if (!stuckVars.isEmpty()) {
+                resultInfo.checkContext.inferenceContext().addFreeTypeListener(stuckVars, this);
+            }
+        }
+
+        @Override
+        public void typesInferred(InferenceContext inferenceContext) {
+            stuckVars = List.nil();
+            resultInfo = resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
+        }
+
+        /**
+         * Process a deferred attribution node.
+         * Invariant: a stuck node cannot be processed.
+         */
+        @SuppressWarnings("fallthrough")
+        boolean process(DeferredAttrContext deferredAttrContext) {
+            switch (deferredAttrContext.mode) {
+                case SPECULATIVE:
+                    dt.check(resultInfo, List.<Type>nil(), new StructuralStuckChecker());
+                    return true;
+                case CHECK:
+                    if (stuckVars.nonEmpty()) {
+                        //stuck expression - see if we can propagate
+                        if (deferredAttrContext.parent != emptyDeferredAttrContext &&
+                                Type.containsAny(deferredAttrContext.parent.inferenceContext.inferencevars, List.from(stuckVars))) {
+                            deferredAttrContext.parent.deferredAttrNodes.add(this);
+                            dt.check(resultInfo, List.<Type>nil(), dummyCompleter);
+                            return true;
+                        } else {
+                            return false;
+                        }
+                    } else {
+                        dt.check(resultInfo, stuckVars, basicCompleter);
+                        return true;
+                    }
+                default:
+                    throw new AssertionError("Bad mode");
+            }
+        }
 
         /**
-         * Class representing a deferred attribution node. It keeps track of
-         * a deferred type, along with the expected target type information.
+         * Structural checker for stuck expressions
          */
-        class DeferredAttrNode implements Infer.InferenceContext.FreeTypeListener {
+        class StructuralStuckChecker extends TreeScanner implements DeferredTypeCompleter {
 
-            /** underlying deferred type */
-            DeferredType dt;
-
-            /** underlying target type information */
             ResultInfo resultInfo;
+            InferenceContext inferenceContext;
+            Env<AttrContext> env;
 
-            /** list of uninferred inference variables causing this node to be stuck */
-            List<Type> stuckVars;
+            public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) {
+                this.resultInfo = resultInfo;
+                this.inferenceContext = deferredAttrContext.inferenceContext;
+                this.env = dt.env.dup(dt.tree, dt.env.info.dup());
+                dt.tree.accept(this);
+                dt.speculativeCache.put(deferredAttrContext.msym, stuckTree, deferredAttrContext.phase);
+                return Type.noType;
+            }
 
-            DeferredAttrNode(DeferredType dt, ResultInfo resultInfo, List<Type> stuckVars) {
-                this.dt = dt;
-                this.resultInfo = resultInfo;
-                this.stuckVars = stuckVars;
-                if (!stuckVars.isEmpty()) {
-                    resultInfo.checkContext.inferenceContext().addFreeTypeListener(stuckVars, this);
+            @Override
+            public void visitLambda(JCLambda tree) {
+                Check.CheckContext checkContext = resultInfo.checkContext;
+                Type pt = resultInfo.pt;
+                if (inferenceContext.inferencevars.contains(pt)) {
+                    //ok
+                    return;
+                } else {
+                    //must be a functional descriptor
+                    try {
+                        Type desc = types.findDescriptorType(pt);
+                        if (desc.getParameterTypes().length() != tree.params.length()) {
+                            checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
+                        }
+                    } catch (Types.FunctionDescriptorLookupError ex) {
+                        checkContext.report(null, ex.getDiagnostic());
+                    }
                 }
             }
 
             @Override
-            public void typesInferred(InferenceContext inferenceContext) {
-                stuckVars = List.nil();
-                resultInfo = resultInfo.dup(inferenceContext.asInstType(resultInfo.pt, types));
+            public void visitNewClass(JCNewClass tree) {
+                //do nothing
+            }
+
+            @Override
+            public void visitApply(JCMethodInvocation tree) {
+                //do nothing
             }
 
-            /**
-             * is this node stuck?
-             */
-            boolean isStuck() {
-                return stuckVars.nonEmpty();
-            }
-
-            /**
-             * Process a deferred attribution node.
-             * Invariant: a stuck node cannot be processed.
-             */
-            void process() {
-                if (isStuck()) {
-                    throw new IllegalStateException("Cannot process a stuck deferred node");
+            @Override
+            public void visitReference(JCMemberReference tree) {
+                Check.CheckContext checkContext = resultInfo.checkContext;
+                Type pt = resultInfo.pt;
+                if (inferenceContext.inferencevars.contains(pt)) {
+                    //ok
+                    return;
+                } else {
+                    try {
+                        types.findDescriptorType(pt);
+                    } catch (Types.FunctionDescriptorLookupError ex) {
+                        checkContext.report(null, ex.getDiagnostic());
+                    }
+                    JCExpression exprTree = (JCExpression)attribSpeculative(tree.getQualifierExpression(), env,
+                            attr.memberReferenceQualifierResult(tree));
+                    ListBuffer<Type> argtypes = ListBuffer.lb();
+                    for (Type t : types.findDescriptorType(pt).getParameterTypes()) {
+                        argtypes.append(syms.errType);
+                    }
+                    JCMemberReference mref2 = new TreeCopier<Void>(make).copy(tree);
+                    mref2.expr = exprTree;
+                    Pair<Symbol, ?> lookupRes =
+                            rs.resolveMemberReference(tree, env, mref2, exprTree.type, tree.name, argtypes.toList(), null, true);
+                    switch (lookupRes.fst.kind) {
+                        //note: as argtypes are erroneous types, type-errors must
+                        //have been caused by arity mismatch
+                        case Kinds.ABSENT_MTH:
+                        case Kinds.WRONG_MTH:
+                        case Kinds.WRONG_MTHS:
+                        case Kinds.STATICERR:
+                        case Kinds.MISSING_ENCL:
+                           checkContext.report(null, diags.fragment("incompatible.arg.types.in.mref"));
+                    }
                 }
-                dt.check(resultInfo);
             }
         }
     }
 
     /** an empty deferred attribution context - all methods throw exceptions */
     final DeferredAttrContext emptyDeferredAttrContext =
-            new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, null) {
+            new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, null, null, null) {
                 @Override
                 void addDeferredAttrNode(DeferredType dt, ResultInfo ri, List<Type> stuckVars) {
                     Assert.error("Empty deferred context!");
@@ -420,7 +577,8 @@
 
         protected DeferredTypeMap(AttrMode mode, Symbol msym, MethodResolutionPhase phase) {
             super(String.format("deferredTypeMap[%s]", mode));
-            this.deferredAttrContext = new DeferredAttrContext(mode, msym, phase, infer.emptyContext);
+            this.deferredAttrContext = new DeferredAttrContext(mode, msym, phase,
+                    infer.emptyContext, emptyDeferredAttrContext, types.noWarnings);
         }
 
         protected boolean validState(DeferredType dt) {
@@ -498,10 +656,80 @@
                 if (resultInfo.pt.hasTag(NONE) || resultInfo.pt.isErroneous()) {
             return List.nil();
         } else {
-            StuckChecker sc = new StuckChecker(resultInfo, env);
+            return stuckVarsInternal(tree, resultInfo.pt, resultInfo.checkContext.inferenceContext());
+        }
+    }
+    //where
+        private List<Type> stuckVarsInternal(JCTree tree, Type pt, Infer.InferenceContext inferenceContext) {
+            StuckChecker sc = new StuckChecker(pt, inferenceContext);
             sc.scan(tree);
             return List.from(sc.stuckVars);
         }
+
+    /**
+     * A special tree scanner that would only visit portions of a given tree.
+     * The set of nodes visited by the scanner can be customized at construction-time.
+     */
+    abstract static class FilterScanner extends TreeScanner {
+
+        final Filter<JCTree> treeFilter;
+
+        FilterScanner(final Set<JCTree.Tag> validTags) {
+            this.treeFilter = new Filter<JCTree>() {
+                public boolean accepts(JCTree t) {
+                    return validTags.contains(t.getTag());
+                }
+            };
+        }
+
+        @Override
+        public void scan(JCTree tree) {
+            if (tree != null) {
+                if (treeFilter.accepts(tree)) {
+                    super.scan(tree);
+                } else {
+                    skip(tree);
+                }
+            }
+        }
+
+        /**
+         * handler that is executed when a node has been discarded
+         */
+        abstract void skip(JCTree tree);
+    }
+
+    /**
+     * A tree scanner suitable for visiting the target-type dependent nodes of
+     * a given argument expression.
+     */
+    static class PolyScanner extends FilterScanner {
+
+        PolyScanner() {
+            super(EnumSet.of(CONDEXPR, PARENS, LAMBDA, REFERENCE));
+        }
+
+        @Override
+        void skip(JCTree tree) {
+            //do nothing
+        }
+    }
+
+    /**
+     * A tree scanner suitable for visiting the target-type dependent nodes nested
+     * within a lambda expression body.
+     */
+    static class LambdaReturnScanner extends FilterScanner {
+
+        LambdaReturnScanner() {
+            super(EnumSet.of(BLOCK, CASE, CATCH, DOLOOP, FOREACHLOOP,
+                    FORLOOP, RETURN, SYNCHRONIZED, SWITCH, TRY, WHILELOOP));
+        }
+
+        @Override
+        void skip(JCTree tree) {
+            //do nothing
+        }
     }
 
     /**
@@ -510,83 +738,32 @@
      * inferring types that make some of the nested expressions incompatible
      * with their corresponding instantiated target
      */
-    class StuckChecker extends TreeScanner {
+    class StuckChecker extends PolyScanner {
 
         Type pt;
-        Filter<JCTree> treeFilter;
         Infer.InferenceContext inferenceContext;
         Set<Type> stuckVars = new LinkedHashSet<Type>();
-        Env<AttrContext> env;
 
-        final Filter<JCTree> argsFilter = new Filter<JCTree>() {
-            public boolean accepts(JCTree t) {
-                switch (t.getTag()) {
-                    case CONDEXPR:
-                    case LAMBDA:
-                    case PARENS:
-                    case REFERENCE:
-                        return true;
-                    default:
-                        return false;
-                }
-            }
-        };
-
-        final Filter<JCTree> lambdaBodyFilter = new Filter<JCTree>() {
-            public boolean accepts(JCTree t) {
-                switch (t.getTag()) {
-                    case BLOCK: case CASE: case CATCH: case DOLOOP:
-                    case FOREACHLOOP: case FORLOOP: case RETURN:
-                    case SYNCHRONIZED: case SWITCH: case TRY: case WHILELOOP:
-                        return true;
-                    default:
-                        return false;
-                }
-            }
-        };
-
-        StuckChecker(ResultInfo resultInfo, Env<AttrContext> env) {
-            this.pt = resultInfo.pt;
-            this.inferenceContext = resultInfo.checkContext.inferenceContext();
-            this.treeFilter = argsFilter;
-            this.env = env;
-        }
-
-        @Override
-        public void scan(JCTree tree) {
-            if (tree != null && treeFilter.accepts(tree)) {
-                super.scan(tree);
-            }
+        StuckChecker(Type pt, Infer.InferenceContext inferenceContext) {
+            this.pt = pt;
+            this.inferenceContext = inferenceContext;
         }
 
         @Override
         public void visitLambda(JCLambda tree) {
-            Type prevPt = pt;
-            Filter<JCTree> prevFilter = treeFilter;
-            try {
-                if (inferenceContext.inferenceVars().contains(pt)) {
-                    stuckVars.add(pt);
-                }
-                if (!types.isFunctionalInterface(pt.tsym)) {
-                    return;
-                }
-                Type descType = types.findDescriptorType(pt);
-                List<Type> freeArgVars = inferenceContext.freeVarsIn(descType.getParameterTypes());
-                if (!TreeInfo.isExplicitLambda(tree) &&
-                        freeArgVars.nonEmpty()) {
-                    stuckVars.addAll(freeArgVars);
-                }
-                pt = descType.getReturnType();
-                if (tree.getBodyKind() == JCTree.JCLambda.BodyKind.EXPRESSION) {
-                    scan(tree.getBody());
-                } else {
-                    treeFilter = lambdaBodyFilter;
-                    super.visitLambda(tree);
-                }
-            } finally {
-                pt = prevPt;
-                treeFilter = prevFilter;
+            if (inferenceContext.inferenceVars().contains(pt)) {
+                stuckVars.add(pt);
+            }
+            if (!types.isFunctionalInterface(pt)) {
+                return;
             }
+            Type descType = types.findDescriptorType(pt);
+            List<Type> freeArgVars = inferenceContext.freeVarsIn(descType.getParameterTypes());
+            if (tree.paramKind == JCLambda.ParameterKind.IMPLICIT &&
+                    freeArgVars.nonEmpty()) {
+                stuckVars.addAll(freeArgVars);
+            }
+            scanLambdaBody(tree, descType.getReturnType());
         }
 
         @Override
@@ -596,7 +773,7 @@
                 stuckVars.add(pt);
                 return;
             }
-            if (!types.isFunctionalInterface(pt.tsym)) {
+            if (!types.isFunctionalInterface(pt)) {
                 return;
             }
 
@@ -605,16 +782,19 @@
             stuckVars.addAll(freeArgVars);
         }
 
-        @Override
-        public void visitReturn(JCReturn tree) {
-            Filter<JCTree> prevFilter = treeFilter;
-            try {
-                treeFilter = argsFilter;
-                if (tree.expr != null) {
-                    scan(tree.expr);
-                }
-            } finally {
-                treeFilter = prevFilter;
+        void scanLambdaBody(JCLambda lambda, final Type pt) {
+            if (lambda.getBodyKind() == JCTree.JCLambda.BodyKind.EXPRESSION) {
+                stuckVars.addAll(stuckVarsInternal(lambda.body, pt, inferenceContext));
+            } else {
+                LambdaReturnScanner lambdaScanner = new LambdaReturnScanner() {
+                    @Override
+                    public void visitReturn(JCReturn tree) {
+                        if (tree.expr != null) {
+                            stuckVars.addAll(stuckVarsInternal(tree.expr, pt, inferenceContext));
+                        }
+                    }
+                };
+                lambdaScanner.scan(lambda.body);
             }
         }
     }
--- a/src/share/classes/com/sun/tools/javac/comp/Enter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Enter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -131,7 +131,11 @@
 
         predefClassDef = make.ClassDef(
             make.Modifiers(PUBLIC),
-            syms.predefClass.name, null, null, null, null);
+            syms.predefClass.name,
+            List.<JCTypeParameter>nil(),
+            null,
+            List.<JCExpression>nil(),
+            List.<JCTree>nil());
         predefClassDef.sym = syms.predefClass;
         todo = Todo.instance(context);
         fileManager = context.get(JavaFileManager.class);
--- a/src/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -35,6 +35,7 @@
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.Resolve;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
@@ -2175,6 +2176,11 @@
             unrefdResources.remove(sym);
         }
 
+        public void visitAnnotatedType(JCAnnotatedType tree) {
+            // annotations don't get scanned
+            tree.underlyingType.accept(this);
+        }
+
         public void visitTopLevel(JCCompilationUnit tree) {
             // Do nothing for TopLevel since each class is visited individually
         }
--- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,22 +25,30 @@
 
 package com.sun.tools.javac.comp;
 
-import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.Type.*;
-import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
-import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
-import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
-import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCTypeCast;
 import com.sun.tools.javac.tree.TreeInfo;
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
+import com.sun.tools.javac.comp.Infer.GraphSolver.InferenceGraph;
+import com.sun.tools.javac.comp.Infer.GraphSolver.InferenceGraph.Node;
+import com.sun.tools.javac.comp.Resolve.InapplicableMethodException;
+import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
 
 import static com.sun.tools.javac.code.TypeTag.*;
 
@@ -55,16 +63,15 @@
     protected static final Context.Key<Infer> inferKey =
         new Context.Key<Infer>();
 
-    /** A value for prototypes that admit any type, including polymorphic ones. */
-    public static final Type anyPoly = new Type(NONE, null);
-
+    Resolve rs;
+    Check chk;
     Symtab syms;
     Types types;
-    Check chk;
-    Resolve rs;
-    DeferredAttr deferredAttr;
+    JCDiagnostic.Factory diags;
     Log log;
-    JCDiagnostic.Factory diags;
+
+    /** should the graph solver be used? */
+    boolean allowGraphInference;
 
     public static Infer instance(Context context) {
         Infer instance = context.get(inferKey);
@@ -75,16 +82,22 @@
 
     protected Infer(Context context) {
         context.put(inferKey, this);
+
+        rs = Resolve.instance(context);
+        chk = Check.instance(context);
         syms = Symtab.instance(context);
         types = Types.instance(context);
-        rs = Resolve.instance(context);
-        deferredAttr = DeferredAttr.instance(context);
+        diags = JCDiagnostic.Factory.instance(context);
         log = Log.instance(context);
-        chk = Check.instance(context);
-        diags = JCDiagnostic.Factory.instance(context);
         inferenceException = new InferenceException(diags);
+        Options options = Options.instance(context);
+        allowGraphInference = Source.instance(context).allowGraphInference()
+                && options.isUnset("useLegacyInference");
     }
 
+    /** A value for prototypes that admit any type, including polymorphic ones. */
+    public static final Type anyPoly = new Type(NONE, null);
+
    /**
     * This exception class is design to store a list of diagnostics corresponding
     * to inference errors that can arise during a method applicability check.
@@ -114,153 +127,12 @@
         }
     }
 
-    private final InferenceException inferenceException;
-
-/***************************************************************************
- * Mini/Maximization of UndetVars
- ***************************************************************************/
-
-    /** Instantiate undetermined type variable to its minimal upper bound.
-     *  Throw a NoInstanceException if this not possible.
-     */
-   void maximizeInst(UndetVar that, Warner warn) throws InferenceException {
-        List<Type> hibounds = Type.filter(that.getBounds(InferenceBound.UPPER), boundFilter);
-        if (that.getBounds(InferenceBound.EQ).isEmpty()) {
-            if (hibounds.isEmpty())
-                that.inst = syms.objectType;
-            else if (hibounds.tail.isEmpty())
-                that.inst = hibounds.head;
-            else
-                that.inst = types.glb(hibounds);
-        } else {
-            that.inst = that.getBounds(InferenceBound.EQ).head;
-        }
-        if (that.inst == null ||
-            that.inst.isErroneous())
-            throw inferenceException
-                .setMessage("no.unique.maximal.instance.exists",
-                            that.qtype, hibounds);
-    }
+    protected final InferenceException inferenceException;
 
-    private Filter<Type> boundFilter = new Filter<Type>() {
-        @Override
-        public boolean accepts(Type t) {
-            return !t.isErroneous() && !t.hasTag(BOT);
-        }
-    };
-
-    /** Instantiate undetermined type variable to the lub of all its lower bounds.
-     *  Throw a NoInstanceException if this not possible.
-     */
-    void minimizeInst(UndetVar that, Warner warn) throws InferenceException {
-        List<Type> lobounds = Type.filter(that.getBounds(InferenceBound.LOWER), boundFilter);
-        if (that.getBounds(InferenceBound.EQ).isEmpty()) {
-            if (lobounds.isEmpty()) {
-                //do nothing - the inference variable is under-constrained
-                return;
-            } else if (lobounds.tail.isEmpty())
-                that.inst = lobounds.head.isPrimitive() ? syms.errType : lobounds.head;
-            else {
-                that.inst = types.lub(lobounds);
-            }
-            if (that.inst == null || that.inst.hasTag(ERROR))
-                    throw inferenceException
-                        .setMessage("no.unique.minimal.instance.exists",
-                                    that.qtype, lobounds);
-        } else {
-            that.inst = that.getBounds(InferenceBound.EQ).head;
-        }
-    }
-
-/***************************************************************************
- * Exported Methods
- ***************************************************************************/
-
+    // <editor-fold defaultstate="collapsed" desc="Inference routines">
     /**
-     * Instantiate uninferred inference variables (JLS 15.12.2.8). First
-     * if the method return type is non-void, we derive constraints from the
-     * expected type - then we use declared bound well-formedness to derive additional
-     * constraints. If no instantiation exists, or if several incomparable
-     * best instantiations exist throw a NoInstanceException.
-     */
-    public void instantiateUninferred(DiagnosticPosition pos,
-            InferenceContext inferenceContext,
-            MethodType mtype,
-            Attr.ResultInfo resultInfo,
-            Warner warn) throws InferenceException {
-        Type to = resultInfo.pt;
-        if (to.hasTag(NONE) || resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
-            to = mtype.getReturnType().isPrimitiveOrVoid() ?
-                    mtype.getReturnType() : syms.objectType;
-        }
-        Type qtype1 = inferenceContext.asFree(mtype.getReturnType(), types);
-        if (!types.isSubtype(qtype1,
-                qtype1.hasTag(UNDETVAR) ? types.boxedTypeOrType(to) : to)) {
-            throw inferenceException
-                    .setMessage("infer.no.conforming.instance.exists",
-                    inferenceContext.restvars(), mtype.getReturnType(), to);
-        }
-
-        while (true) {
-            boolean stuck = true;
-            for (Type t : inferenceContext.undetvars) {
-                UndetVar uv = (UndetVar)t;
-                if (uv.inst == null && (uv.getBounds(InferenceBound.EQ).nonEmpty() ||
-                        !inferenceContext.free(uv.getBounds(InferenceBound.UPPER)))) {
-                    maximizeInst((UndetVar)t, warn);
-                    stuck = false;
-                }
-            }
-            if (inferenceContext.restvars().isEmpty()) {
-                //all variables have been instantiated - exit
-                break;
-            } else if (stuck) {
-                //some variables could not be instantiated because of cycles in
-                //upper bounds - provide a (possibly recursive) default instantiation
-                instantiateAsUninferredVars(inferenceContext);
-                break;
-            } else {
-                //some variables have been instantiated - replace newly instantiated
-                //variables in remaining upper bounds and continue
-                for (Type t : inferenceContext.undetvars) {
-                    UndetVar uv = (UndetVar)t;
-                    uv.substBounds(inferenceContext.inferenceVars(), inferenceContext.instTypes(), types);
-                }
-            }
-        }
-    }
-
-    /**
-     * Infer cyclic inference variables as described in 15.12.2.8.
-     */
-    private void instantiateAsUninferredVars(InferenceContext inferenceContext) {
-        ListBuffer<Type> todo = ListBuffer.lb();
-        //step 1 - create fresh tvars
-        for (Type t : inferenceContext.undetvars) {
-            UndetVar uv = (UndetVar)t;
-            if (uv.inst == null) {
-                TypeSymbol fresh_tvar = new TypeSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
-                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null);
-                todo.append(uv);
-                uv.inst = fresh_tvar.type;
-            }
-        }
-        //step 2 - replace fresh tvars in their bounds
-        List<Type> formals = inferenceContext.inferenceVars();
-        for (Type t : todo) {
-            UndetVar uv = (UndetVar)t;
-            TypeVar ct = (TypeVar)uv.inst;
-            ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct), types));
-            if (ct.bound.isErroneous()) {
-                //report inference error if glb fails
-                reportBoundError(uv, BoundErrorKind.BAD_UPPER);
-            }
-            formals = formals.tail;
-        }
-    }
-
-    /** Instantiate a generic method type by finding instantiations for all its
-     * inference variables so that it can be applied to a given argument type list.
+     * Main inference entry point - instantiate a generic method type
+     * using given argument types and (possibly) an expected target-type.
      */
     public Type instantiateMethod(Env<AttrContext> env,
                                   List<Type> tvars,
@@ -271,269 +143,149 @@
                                   boolean allowBoxing,
                                   boolean useVarargs,
                                   Resolve.MethodResolutionContext resolveContext,
+                                  Resolve.MethodCheck methodCheck,
                                   Warner warn) throws InferenceException {
         //-System.err.println("instantiateMethod(" + tvars + ", " + mt + ", " + argtypes + ")"); //DEBUG
-        final InferenceContext inferenceContext = new InferenceContext(tvars, this, true);
+        final InferenceContext inferenceContext = new InferenceContext(tvars);
         inferenceException.clear();
-
         try {
-            rs.checkRawArgumentsAcceptable(env, msym, resolveContext.attrMode(), inferenceContext,
-                    argtypes, mt.getParameterTypes(), allowBoxing, useVarargs, warn,
-                    new InferenceCheckHandler(inferenceContext));
+            DeferredAttr.DeferredAttrContext deferredAttrContext =
+                    resolveContext.deferredAttrContext(msym, inferenceContext, resultInfo, warn);
+
+            methodCheck.argumentsAcceptable(env, deferredAttrContext,
+                    argtypes, mt.getParameterTypes(), warn);
 
-            // minimize as yet undetermined type variables
-            for (Type t : inferenceContext.undetvars) {
-                minimizeInst((UndetVar)t, warn);
+            if (allowGraphInference &&
+                    resultInfo != null &&
+                    !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
+                //inject return constraints earlier
+                checkWithinBounds(inferenceContext, warn); //propagation
+                generateReturnConstraints(resultInfo, mt, inferenceContext);
+                //propagate outwards if needed
+                if (resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
+                    //propagate inference context outwards and exit
+                    inferenceContext.dupTo(resultInfo.checkContext.inferenceContext());
+                    deferredAttrContext.complete();
+                    return mt;
+                }
             }
 
-            checkWithinBounds(inferenceContext, warn);
+            deferredAttrContext.complete();
 
-            mt = (MethodType)inferenceContext.asInstType(mt, types);
+            // minimize as yet undetermined type variables
+            if (allowGraphInference) {
+                inferenceContext.solve(warn);
+            } else {
+                inferenceContext.solveLegacy(true, warn, LegacyInferenceSteps.EQ_LOWER.steps); //minimizeInst
+            }
 
-            List<Type> restvars = inferenceContext.restvars();
+            mt = (MethodType)inferenceContext.asInstType(mt);
 
-            if (!restvars.isEmpty()) {
-                if (resultInfo != null && !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
-                    instantiateUninferred(env.tree.pos(), inferenceContext, mt, resultInfo, warn);
-                    checkWithinBounds(inferenceContext, warn);
-                    mt = (MethodType)inferenceContext.asInstType(mt, types);
-                    if (rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) {
-                        log.note(env.tree.pos, "deferred.method.inst", msym, mt, resultInfo.pt);
-                    }
-                }
+            if (!allowGraphInference &&
+                    inferenceContext.restvars().nonEmpty() &&
+                    resultInfo != null &&
+                    !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
+                generateReturnConstraints(resultInfo, mt, inferenceContext);
+                inferenceContext.solveLegacy(false, warn, LegacyInferenceSteps.EQ_UPPER.steps); //maximizeInst
+                mt = (MethodType)inferenceContext.asInstType(mt);
+            }
+
+            if (resultInfo != null && rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) {
+                log.note(env.tree.pos, "deferred.method.inst", msym, mt, resultInfo.pt);
             }
 
             // return instantiated version of method type
             return mt;
         } finally {
-            inferenceContext.notifyChange(types);
-        }
-    }
-    //where
-
-        /** inference check handler **/
-        class InferenceCheckHandler implements Resolve.MethodCheckHandler {
-
-            InferenceContext inferenceContext;
-
-            public InferenceCheckHandler(InferenceContext inferenceContext) {
-                this.inferenceContext = inferenceContext;
-            }
-
-            public InapplicableMethodException arityMismatch() {
-                return inferenceException.setMessage("infer.arg.length.mismatch", inferenceContext.inferenceVars());
-            }
-            public InapplicableMethodException argumentMismatch(boolean varargs, JCDiagnostic details) {
-                String key = varargs ?
-                        "infer.varargs.argument.mismatch" :
-                        "infer.no.conforming.assignment.exists";
-                return inferenceException.setMessage(key,
-                        inferenceContext.inferenceVars(), details);
-            }
-            public InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected) {
-                return inferenceException.setMessage("inaccessible.varargs.type",
-                        expected, Kinds.kindName(location), location);
-            }
-        }
-
-    /** check that type parameters are within their bounds.
-     */
-    void checkWithinBounds(InferenceContext inferenceContext,
-                           Warner warn) throws InferenceException {
-        //step 1 - check compatibility of instantiated type w.r.t. initial bounds
-        for (Type t : inferenceContext.undetvars) {
-            UndetVar uv = (UndetVar)t;
-            uv.substBounds(inferenceContext.inferenceVars(), inferenceContext.instTypes(), types);
-            checkCompatibleUpperBounds(uv, inferenceContext.inferenceVars());
-            if (!inferenceContext.restvars().contains(uv.qtype)) {
-                Type inst = inferenceContext.asInstType(t, types);
-                for (Type u : uv.getBounds(InferenceBound.UPPER)) {
-                    if (!types.isSubtypeUnchecked(inst, inferenceContext.asFree(u, types), warn)) {
-                        reportBoundError(uv, BoundErrorKind.UPPER);
-                    }
-                }
-                for (Type l : uv.getBounds(InferenceBound.LOWER)) {
-                    Assert.check(!inferenceContext.free(l));
-                    if (!types.isSubtypeUnchecked(l, inst, warn)) {
-                        reportBoundError(uv, BoundErrorKind.LOWER);
-                    }
-                }
-                for (Type e : uv.getBounds(InferenceBound.EQ)) {
-                    Assert.check(!inferenceContext.free(e));
-                    if (!types.isSameType(inst, e)) {
-                        reportBoundError(uv, BoundErrorKind.EQ);
-                    }
-                }
-            }
-        }
-
-        //step 2 - check that eq bounds are consistent w.r.t. eq/lower bounds
-        for (Type t : inferenceContext.undetvars) {
-            UndetVar uv = (UndetVar)t;
-            //check eq bounds consistency
-            Type eq = null;
-            for (Type e : uv.getBounds(InferenceBound.EQ)) {
-                Assert.check(!inferenceContext.free(e));
-                if (eq != null && !types.isSameType(e, eq)) {
-                    reportBoundError(uv, BoundErrorKind.EQ);
-                }
-                eq = e;
-                for (Type l : uv.getBounds(InferenceBound.LOWER)) {
-                    Assert.check(!inferenceContext.free(l));
-                    if (!types.isSubtypeUnchecked(l, e, warn)) {
-                        reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
-                    }
-                }
-                for (Type u : uv.getBounds(InferenceBound.UPPER)) {
-                    if (inferenceContext.free(u)) continue;
-                    if (!types.isSubtypeUnchecked(e, u, warn)) {
-                        reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
-                    }
-                }
+            if (resultInfo != null || !allowGraphInference) {
+                inferenceContext.notifyChange();
+            } else {
+                inferenceContext.notifyChange(inferenceContext.boundedVars());
             }
         }
     }
 
-    void checkCompatibleUpperBounds(UndetVar uv, List<Type> tvars) {
-        // VGJ: sort of inlined maximizeInst() below.  Adding
-        // bounds can cause lobounds that are above hibounds.
-        ListBuffer<Type> hiboundsNoVars = ListBuffer.lb();
-        for (Type t : Type.filter(uv.getBounds(InferenceBound.UPPER), boundFilter)) {
-            if (!t.containsAny(tvars)) {
-                hiboundsNoVars.append(t);
-            }
+    /**
+     * Generate constraints from the generic method's return type. If the method
+     * call occurs in a context where a type T is expected, use the expected
+     * type to derive more constraints on the generic method inference variables.
+     */
+    void generateReturnConstraints(Attr.ResultInfo resultInfo,
+            MethodType mt, InferenceContext inferenceContext) {
+        Type qtype1 = inferenceContext.asFree(mt.getReturnType());
+        Type to = returnConstraintTarget(qtype1, resultInfo.pt);
+        Assert.check(allowGraphInference || !resultInfo.checkContext.inferenceContext().free(to),
+                "legacy inference engine cannot handle constraints on both sides of a subtyping assertion");
+        //we need to skip capture?
+        Warner retWarn = new Warner();
+        if (!resultInfo.checkContext.compatible(qtype1, resultInfo.checkContext.inferenceContext().asFree(to), retWarn) ||
+                //unchecked conversion is not allowed
+                retWarn.hasLint(Lint.LintCategory.UNCHECKED)) {
+            throw inferenceException
+                    .setMessage("infer.no.conforming.instance.exists",
+                    inferenceContext.restvars(), mt.getReturnType(), to);
         }
-        List<Type> hibounds = hiboundsNoVars.toList();
-        Type hb = null;
-        if (hibounds.isEmpty())
-            hb = syms.objectType;
-        else if (hibounds.tail.isEmpty())
-            hb = hibounds.head;
-        else
-            hb = types.glb(hibounds);
-        if (hb == null || hb.isErroneous())
-            reportBoundError(uv, BoundErrorKind.BAD_UPPER);
-    }
-
-    enum BoundErrorKind {
-        BAD_UPPER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("incompatible.upper.bounds", uv.qtype,
-                        uv.getBounds(InferenceBound.UPPER));
-            }
-        },
-        BAD_EQ_UPPER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("incompatible.eq.upper.bounds", uv.qtype,
-                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.UPPER));
-            }
-        },
-        BAD_EQ_LOWER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("incompatible.eq.lower.bounds", uv.qtype,
-                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.LOWER));
-            }
-        },
-        UPPER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("inferred.do.not.conform.to.upper.bounds", uv.inst,
-                        uv.getBounds(InferenceBound.UPPER));
-            }
-        },
-        LOWER() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("inferred.do.not.conform.to.lower.bounds", uv.inst,
-                        uv.getBounds(InferenceBound.LOWER));
-            }
-        },
-        EQ() {
-            @Override
-            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
-                return ex.setMessage("inferred.do.not.conform.to.eq.bounds", uv.inst,
-                        uv.getBounds(InferenceBound.EQ));
-            }
-        };
-
-        abstract InapplicableMethodException setMessage(InferenceException ex, UndetVar uv);
     }
     //where
-    void reportBoundError(UndetVar uv, BoundErrorKind bk) {
-        throw bk.setMessage(inferenceException, uv);
-    }
-
-    // <editor-fold desc="functional interface instantiation">
-    /**
-     * This method is used to infer a suitable target functional interface in case
-     * the original parameterized interface contains wildcards. An inference process
-     * is applied so that wildcard bounds, as well as explicit lambda/method ref parameters
-     * (where applicable) are used to constraint the solution.
-     */
-    public Type instantiateFunctionalInterface(DiagnosticPosition pos, Type funcInterface,
-            List<Type> paramTypes, Check.CheckContext checkContext) {
-        if (types.capture(funcInterface) == funcInterface) {
-            //if capture doesn't change the type then return the target unchanged
-            //(this means the target contains no wildcards!)
-            return funcInterface;
-        } else {
-            Type formalInterface = funcInterface.tsym.type;
-            InferenceContext funcInterfaceContext =
-                    new InferenceContext(funcInterface.tsym.type.getTypeArguments(), this, false);
-            if (paramTypes != null) {
-                //get constraints from explicit params (this is done by
-                //checking that explicit param types are equal to the ones
-                //in the functional interface descriptors)
-                List<Type> descParameterTypes = types.findDescriptorType(formalInterface).getParameterTypes();
-                if (descParameterTypes.size() != paramTypes.size()) {
-                    checkContext.report(pos, diags.fragment("incompatible.arg.types.in.lambda"));
-                    return types.createErrorType(funcInterface);
+        private Type returnConstraintTarget(Type from, Type to) {
+            if (from.hasTag(VOID)) {
+                return syms.voidType;
+            } else if (to.hasTag(NONE)) {
+                return from.isPrimitive() ? from : syms.objectType;
+            } else if (from.hasTag(UNDETVAR) && to.isPrimitive()) {
+                if (!allowGraphInference) {
+                    //if legacy, just return boxed type
+                    return types.boxedClass(to).type;
                 }
-                for (Type p : descParameterTypes) {
-                    if (!types.isSameType(funcInterfaceContext.asFree(p, types), paramTypes.head)) {
-                        checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
-                        return types.createErrorType(funcInterface);
-                    }
-                    paramTypes = paramTypes.tail;
-                }
-                for (Type t : funcInterfaceContext.undetvars) {
-                    UndetVar uv = (UndetVar)t;
-                    minimizeInst(uv, types.noWarnings);
-                    if (uv.inst == null &&
-                            Type.filter(uv.getBounds(InferenceBound.UPPER), boundFilter).nonEmpty()) {
-                        maximizeInst(uv, types.noWarnings);
+                //if graph inference we need to skip conflicting boxed bounds...
+                UndetVar uv = (UndetVar)from;
+                for (Type t : uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) {
+                    Type boundAsPrimitive = types.unboxedType(t);
+                    if (boundAsPrimitive == null) continue;
+                    if (types.isConvertible(boundAsPrimitive, to)) {
+                        //effectively skip return-type constraint generation (compatibility)
+                        return syms.objectType;
                     }
                 }
-
-                formalInterface = funcInterfaceContext.asInstType(formalInterface, types);
+                return types.boxedClass(to).type;
+            } else {
+                return to;
             }
-            ListBuffer<Type> typeargs = ListBuffer.lb();
-            List<Type> actualTypeargs = funcInterface.getTypeArguments();
-            //for remaining uninferred type-vars in the functional interface type,
-            //simply replace the wildcards with its bound
-            for (Type t : formalInterface.getTypeArguments()) {
-                if (actualTypeargs.head.hasTag(WILDCARD)) {
-                    WildcardType wt = (WildcardType)actualTypeargs.head;
-                    typeargs.append(wt.type);
-                } else {
-                    typeargs.append(actualTypeargs.head);
-                }
-                actualTypeargs = actualTypeargs.tail;
+        }
+
+    /**
+      * Infer cyclic inference variables as described in 15.12.2.8.
+      */
+    private void instantiateAsUninferredVars(List<Type> vars, InferenceContext inferenceContext) {
+        ListBuffer<Type> todo = ListBuffer.lb();
+        //step 1 - create fresh tvars
+        for (Type t : vars) {
+            UndetVar uv = (UndetVar)inferenceContext.asFree(t);
+            List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER);
+            if (Type.containsAny(upperBounds, vars)) {
+                TypeSymbol fresh_tvar = new TypeSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner);
+                fresh_tvar.type = new TypeVar(fresh_tvar, types.makeCompoundType(uv.getBounds(InferenceBound.UPPER)), null);
+                todo.append(uv);
+                uv.inst = fresh_tvar.type;
+            } else if (upperBounds.nonEmpty()) {
+                uv.inst = types.glb(upperBounds);
+            } else {
+                uv.inst = syms.objectType;
             }
-            Type owntype = types.subst(formalInterface, funcInterfaceContext.inferenceVars(), typeargs.toList());
-            if (!chk.checkValidGenericType(owntype)) {
-                //if the inferred functional interface type is not well-formed,
-                //or if it's not a subtype of the original target, issue an error
-                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
-                return types.createErrorType(funcInterface);
+        }
+        //step 2 - replace fresh tvars in their bounds
+        List<Type> formals = vars;
+        for (Type t : todo) {
+            UndetVar uv = (UndetVar)t;
+            TypeVar ct = (TypeVar)uv.inst;
+            ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct)));
+            if (ct.bound.isErroneous()) {
+                //report inference error if glb fails
+                reportBoundError(uv, BoundErrorKind.BAD_UPPER);
             }
-            return owntype;
+            formals = formals.tail;
         }
     }
-    // </editor-fold>
 
     /**
      * Compute a synthetic method type corresponding to the requested polymorphic
@@ -587,7 +339,7 @@
         class ImplicitArgType extends DeferredAttr.DeferredTypeMap {
 
             public ImplicitArgType(Symbol msym, Resolve.MethodResolutionPhase phase) {
-                deferredAttr.super(AttrMode.SPECULATIVE, msym, phase);
+                rs.deferredAttr.super(AttrMode.SPECULATIVE, msym, phase);
             }
 
             public Type apply(Type t) {
@@ -601,23 +353,934 @@
         }
 
     /**
-     * Mapping that turns inference variables into undet vars
-     * (used by inference context)
+      * This method is used to infer a suitable target SAM in case the original
+      * SAM type contains one or more wildcards. An inference process is applied
+      * so that wildcard bounds, as well as explicit lambda/method ref parameters
+      * (where applicable) are used to constraint the solution.
+      */
+    public Type instantiateFunctionalInterface(DiagnosticPosition pos, Type funcInterface,
+            List<Type> paramTypes, Check.CheckContext checkContext) {
+        if (types.capture(funcInterface) == funcInterface) {
+            //if capture doesn't change the type then return the target unchanged
+            //(this means the target contains no wildcards!)
+            return funcInterface;
+        } else {
+            Type formalInterface = funcInterface.tsym.type;
+            InferenceContext funcInterfaceContext =
+                    new InferenceContext(funcInterface.tsym.type.getTypeArguments());
+
+            Assert.check(paramTypes != null);
+            //get constraints from explicit params (this is done by
+            //checking that explicit param types are equal to the ones
+            //in the functional interface descriptors)
+            List<Type> descParameterTypes = types.findDescriptorType(formalInterface).getParameterTypes();
+            if (descParameterTypes.size() != paramTypes.size()) {
+                checkContext.report(pos, diags.fragment("incompatible.arg.types.in.lambda"));
+                return types.createErrorType(funcInterface);
+            }
+            for (Type p : descParameterTypes) {
+                if (!types.isSameType(funcInterfaceContext.asFree(p), paramTypes.head)) {
+                    checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
+                    return types.createErrorType(funcInterface);
+                }
+                paramTypes = paramTypes.tail;
+            }
+
+            try {
+                funcInterfaceContext.solve(funcInterfaceContext.boundedVars(), types.noWarnings);
+            } catch (InferenceException ex) {
+                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
+            }
+
+            List<Type> actualTypeargs = funcInterface.getTypeArguments();
+            for (Type t : funcInterfaceContext.undetvars) {
+                UndetVar uv = (UndetVar)t;
+                if (uv.inst == null) {
+                    uv.inst = actualTypeargs.head;
+                }
+                actualTypeargs = actualTypeargs.tail;
+            }
+
+            Type owntype = funcInterfaceContext.asInstType(formalInterface);
+            if (!chk.checkValidGenericType(owntype)) {
+                //if the inferred functional interface type is not well-formed,
+                //or if it's not a subtype of the original target, issue an error
+                checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface));
+            }
+            return owntype;
+        }
+    }
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Bound checking">
+    /**
+     * Check bounds and perform incorporation
      */
-    class FromTypeVarFun extends Mapping {
+    void checkWithinBounds(InferenceContext inferenceContext,
+                             Warner warn) throws InferenceException {
+        MultiUndetVarListener mlistener = new MultiUndetVarListener(inferenceContext.undetvars);
+        try {
+            while (true) {
+                mlistener.reset();
+                if (!allowGraphInference) {
+                    //in legacy mode we lack of transitivity, so bound check
+                    //cannot be run in parallel with other incoprporation rounds
+                    for (Type t : inferenceContext.undetvars) {
+                        UndetVar uv = (UndetVar)t;
+                        IncorporationStep.CHECK_BOUNDS.apply(uv, inferenceContext, warn);
+                    }
+                }
+                for (Type t : inferenceContext.undetvars) {
+                    UndetVar uv = (UndetVar)t;
+                    //bound incorporation
+                    EnumSet<IncorporationStep> incorporationSteps = allowGraphInference ?
+                            incorporationStepsGraph : incorporationStepsLegacy;
+                    for (IncorporationStep is : incorporationSteps) {
+                        is.apply(uv, inferenceContext, warn);
+                    }
+                }
+                if (!mlistener.changed || !allowGraphInference) break;
+            }
+        }
+        finally {
+            mlistener.detach();
+        }
+    }
+    //where
+        /**
+         * This listener keeps track of changes on a group of inference variable
+         * bounds. Note: the listener must be detached (calling corresponding
+         * method) to make sure that the underlying inference variable is
+         * left in a clean state.
+         */
+        class MultiUndetVarListener implements UndetVar.UndetVarListener {
+
+            int rounds;
+            boolean changed;
+            List<Type> undetvars;
+
+            public MultiUndetVarListener(List<Type> undetvars) {
+                this.undetvars = undetvars;
+                for (Type t : undetvars) {
+                    UndetVar uv = (UndetVar)t;
+                    uv.listener = this;
+                }
+            }
+
+            public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
+                //avoid non-termination
+                if (rounds < MAX_INCORPORATION_STEPS) {
+                    changed = true;
+                }
+            }
+
+            void reset() {
+                rounds++;
+                changed = false;
+            }
+
+            void detach() {
+                for (Type t : undetvars) {
+                    UndetVar uv = (UndetVar)t;
+                    uv.listener = null;
+                }
+            }
+        };
+
+        /** max number of incorporation rounds */
+        static final int MAX_INCORPORATION_STEPS = 100;
 
-        boolean includeBounds;
+    /**
+     * This enumeration defines an entry point for doing inference variable
+     * bound incorporation - it can be used to inject custom incorporation
+     * logic into the basic bound checking routine
+     */
+    enum IncorporationStep {
+        /**
+         * Performs basic bound checking - i.e. is the instantiated type for a given
+         * inference variable compatible with its bounds?
+         */
+        CHECK_BOUNDS() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                uv.substBounds(inferenceContext.inferenceVars(), inferenceContext.instTypes(), infer.types);
+                infer.checkCompatibleUpperBounds(uv, inferenceContext);
+                if (uv.inst != null) {
+                    Type inst = uv.inst;
+                    for (Type u : uv.getBounds(InferenceBound.UPPER)) {
+                        if (!infer.types.isSubtypeUnchecked(inst, inferenceContext.asFree(u), warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.UPPER);
+                        }
+                    }
+                    for (Type l : uv.getBounds(InferenceBound.LOWER)) {
+                        if (!infer.types.isSubtypeUnchecked(inferenceContext.asFree(l), inst, warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.LOWER);
+                        }
+                    }
+                    for (Type e : uv.getBounds(InferenceBound.EQ)) {
+                        if (!infer.types.isSameType(inst, inferenceContext.asFree(e))) {
+                            infer.reportBoundError(uv, BoundErrorKind.EQ);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Check consistency of equality constraints. This is a slightly more aggressive
+         * inference routine that is designed as to maximize compatibility with JDK 7.
+         * Note: this is not used in graph mode.
+         */
+        EQ_CHECK_LEGACY() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                Type eq = null;
+                for (Type e : uv.getBounds(InferenceBound.EQ)) {
+                    Assert.check(!inferenceContext.free(e));
+                    if (eq != null && !infer.types.isSameType(e, eq)) {
+                        infer.reportBoundError(uv, BoundErrorKind.EQ);
+                    }
+                    eq = e;
+                    for (Type l : uv.getBounds(InferenceBound.LOWER)) {
+                        Assert.check(!inferenceContext.free(l));
+                        if (!infer.types.isSubtypeUnchecked(l, e, warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
+                        }
+                    }
+                    for (Type u : uv.getBounds(InferenceBound.UPPER)) {
+                        if (inferenceContext.free(u)) continue;
+                        if (!infer.types.isSubtypeUnchecked(e, u, warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Check consistency of equality constraints.
+         */
+        EQ_CHECK() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type e : uv.getBounds(InferenceBound.EQ)) {
+                    if (e.containsAny(inferenceContext.inferenceVars())) continue;
+                    for (Type u : uv.getBounds(InferenceBound.UPPER)) {
+                        if (!infer.types.isSubtypeUnchecked(e, inferenceContext.asFree(u), warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_UPPER);
+                        }
+                    }
+                    for (Type l : uv.getBounds(InferenceBound.LOWER)) {
+                        if (!infer.types.isSubtypeUnchecked(inferenceContext.asFree(l), e, warn)) {
+                            infer.reportBoundError(uv, BoundErrorKind.BAD_EQ_LOWER);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha <: T} and {@code alpha :> S}
+         * perform {@code S <: T} (which could lead to new bounds).
+         */
+        CROSS_UPPER_LOWER() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
+                    for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
+                        infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha <: T} and {@code alpha == S}
+         * perform {@code S <: T} (which could lead to new bounds).
+         */
+        CROSS_UPPER_EQ() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b1 : uv.getBounds(InferenceBound.UPPER)) {
+                    for (Type b2 : uv.getBounds(InferenceBound.EQ)) {
+                        infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha :> S} and {@code alpha == T}
+         * perform {@code S <: T} (which could lead to new bounds).
+         */
+        CROSS_EQ_LOWER() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b1 : uv.getBounds(InferenceBound.EQ)) {
+                    for (Type b2 : uv.getBounds(InferenceBound.LOWER)) {
+                        infer.types.isSubtypeUnchecked(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha == S} and {@code alpha == T}
+         * perform {@code S == T} (which could lead to new bounds).
+         */
+        CROSS_EQ_EQ() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b1 : uv.getBounds(InferenceBound.EQ)) {
+                    for (Type b2 : uv.getBounds(InferenceBound.EQ)) {
+                        if (b1 != b2) {
+                            infer.types.isSameType(inferenceContext.asFree(b2), inferenceContext.asFree(b1));
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha <: beta} propagate lower bounds
+         * from alpha to beta; also propagate upper bounds from beta to alpha.
+         */
+        PROP_UPPER() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b : uv.getBounds(InferenceBound.UPPER)) {
+                    if (inferenceContext.inferenceVars().contains(b)) {
+                        UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
+                        //alpha <: beta
+                        //0. set beta :> alpha
+                        uv2.addBound(InferenceBound.LOWER, uv.qtype, infer.types);
+                        //1. copy alpha's lower to beta's
+                        for (Type l : uv.getBounds(InferenceBound.LOWER)) {
+                            uv2.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types);
+                        }
+                        //2. copy beta's upper to alpha's
+                        for (Type u : uv2.getBounds(InferenceBound.UPPER)) {
+                            uv.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha :> beta} propagate lower bounds
+         * from beta to alpha; also propagate upper bounds from alpha to beta.
+         */
+        PROP_LOWER() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b : uv.getBounds(InferenceBound.LOWER)) {
+                    if (inferenceContext.inferenceVars().contains(b)) {
+                        UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
+                        //alpha :> beta
+                        //0. set beta <: alpha
+                        uv2.addBound(InferenceBound.UPPER, uv.qtype, infer.types);
+                        //1. copy alpha's upper to beta's
+                        for (Type u : uv.getBounds(InferenceBound.UPPER)) {
+                            uv2.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types);
+                        }
+                        //2. copy beta's lower to alpha's
+                        for (Type l : uv2.getBounds(InferenceBound.LOWER)) {
+                            uv.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types);
+                        }
+                    }
+                }
+            }
+        },
+        /**
+         * Given a bound set containing {@code alpha == beta} propagate lower/upper
+         * bounds from alpha to beta and back.
+         */
+        PROP_EQ() {
+            public void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn) {
+                Infer infer = inferenceContext.infer();
+                for (Type b : uv.getBounds(InferenceBound.EQ)) {
+                    if (inferenceContext.inferenceVars().contains(b)) {
+                        UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
+                        //alpha == beta
+                        //0. set beta == alpha
+                        uv2.addBound(InferenceBound.EQ, uv.qtype, infer.types);
+                        //1. copy all alpha's bounds to beta's
+                        for (InferenceBound ib : InferenceBound.values()) {
+                            for (Type b2 : uv.getBounds(ib)) {
+                                if (b2 != uv2) {
+                                    uv2.addBound(ib, inferenceContext.asInstType(b2), infer.types);
+                                }
+                            }
+                        }
+                        //2. copy all beta's bounds to alpha's
+                        for (InferenceBound ib : InferenceBound.values()) {
+                            for (Type b2 : uv2.getBounds(ib)) {
+                                if (b2 != uv) {
+                                    uv.addBound(ib, inferenceContext.asInstType(b2), infer.types);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        };
 
-        FromTypeVarFun(boolean includeBounds) {
-            super("fromTypeVarFunWithBounds");
-            this.includeBounds = includeBounds;
+        abstract void apply(UndetVar uv, InferenceContext inferenceContext, Warner warn);
+    }
+
+    /** incorporation steps to be executed when running in legacy mode */
+    EnumSet<IncorporationStep> incorporationStepsLegacy = EnumSet.of(IncorporationStep.EQ_CHECK_LEGACY);
+
+    /** incorporation steps to be executed when running in graph mode */
+    EnumSet<IncorporationStep> incorporationStepsGraph =
+            EnumSet.complementOf(EnumSet.of(IncorporationStep.EQ_CHECK_LEGACY));
+
+    /**
+     * Make sure that the upper bounds we got so far lead to a solvable inference
+     * variable by making sure that a glb exists.
+     */
+    void checkCompatibleUpperBounds(UndetVar uv, InferenceContext inferenceContext) {
+        List<Type> hibounds =
+                Type.filter(uv.getBounds(InferenceBound.UPPER), new BoundFilter(inferenceContext));
+        Type hb = null;
+        if (hibounds.isEmpty())
+            hb = syms.objectType;
+        else if (hibounds.tail.isEmpty())
+            hb = hibounds.head;
+        else
+            hb = types.glb(hibounds);
+        if (hb == null || hb.isErroneous())
+            reportBoundError(uv, BoundErrorKind.BAD_UPPER);
+    }
+    //where
+        protected static class BoundFilter implements Filter<Type> {
+
+            InferenceContext inferenceContext;
+
+            public BoundFilter(InferenceContext inferenceContext) {
+                this.inferenceContext = inferenceContext;
+            }
+
+            @Override
+            public boolean accepts(Type t) {
+                return !t.isErroneous() && !inferenceContext.free(t) &&
+                        !t.hasTag(BOT);
+            }
+        };
+
+    /**
+     * This enumeration defines all possible bound-checking related errors.
+     */
+    enum BoundErrorKind {
+        /**
+         * The (uninstantiated) inference variable has incompatible upper bounds.
+         */
+        BAD_UPPER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("incompatible.upper.bounds", uv.qtype,
+                        uv.getBounds(InferenceBound.UPPER));
+            }
+        },
+        /**
+         * An equality constraint is not compatible with an upper bound.
+         */
+        BAD_EQ_UPPER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("incompatible.eq.upper.bounds", uv.qtype,
+                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.UPPER));
+            }
+        },
+        /**
+         * An equality constraint is not compatible with a lower bound.
+         */
+        BAD_EQ_LOWER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("incompatible.eq.lower.bounds", uv.qtype,
+                        uv.getBounds(InferenceBound.EQ), uv.getBounds(InferenceBound.LOWER));
+            }
+        },
+        /**
+         * Instantiated inference variable is not compatible with an upper bound.
+         */
+        UPPER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("inferred.do.not.conform.to.upper.bounds", uv.inst,
+                        uv.getBounds(InferenceBound.UPPER));
+            }
+        },
+        /**
+         * Instantiated inference variable is not compatible with a lower bound.
+         */
+        LOWER() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("inferred.do.not.conform.to.lower.bounds", uv.inst,
+                        uv.getBounds(InferenceBound.LOWER));
+            }
+        },
+        /**
+         * Instantiated inference variable is not compatible with an equality constraint.
+         */
+        EQ() {
+            @Override
+            InapplicableMethodException setMessage(InferenceException ex, UndetVar uv) {
+                return ex.setMessage("inferred.do.not.conform.to.eq.bounds", uv.inst,
+                        uv.getBounds(InferenceBound.EQ));
+            }
+        };
+
+        abstract InapplicableMethodException setMessage(InferenceException ex, UndetVar uv);
+    }
+
+    /**
+     * Report a bound-checking error of given kind
+     */
+    void reportBoundError(UndetVar uv, BoundErrorKind bk) {
+        throw bk.setMessage(inferenceException, uv);
+    }
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Inference engine">
+    /**
+     * Graph inference strategy - act as an input to the inference solver; a strategy is
+     * composed of two ingredients: (i) find a node to solve in the inference graph,
+     * and (ii) tell th engine when we are done fixing inference variables
+     */
+    interface GraphStrategy {
+        /**
+         * Pick the next node (leaf) to solve in the graph
+         */
+        Node pickNode(InferenceGraph g);
+        /**
+         * Is this the last step?
+         */
+        boolean done();
+    }
+
+    /**
+     * Simple solver strategy class that locates all leaves inside a graph
+     * and picks the first leaf as the next node to solve
+     */
+    abstract class LeafSolver implements GraphStrategy {
+        public Node pickNode(InferenceGraph g) {
+                        Assert.check(!g.nodes.isEmpty(), "No nodes to solve!");
+            return g.nodes.get(0);
+        }
+    }
+
+    /**
+     * This solver uses an heuristic to pick the best leaf - the heuristic
+     * tries to select the node that has maximal probability to contain one
+     * or more inference variables in a given list
+     */
+    abstract class BestLeafSolver extends LeafSolver {
+
+        List<Type> varsToSolve;
+
+        BestLeafSolver(List<Type> varsToSolve) {
+            this.varsToSolve = varsToSolve;
         }
 
-        public Type apply(Type t) {
-            if (t.hasTag(TYPEVAR)) return new UndetVar((TypeVar)t, types, includeBounds);
-            else return t.map(this);
+        /**
+         * Computes the cost associated with a given node; the cost is computed
+         * as the total number of type-variables that should be eagerly instantiated
+         * in order to get to some of the variables in {@code varsToSolve} from
+         * a given node
+         */
+        void computeCostIfNeeded(Node n, Map<Node, Integer> costMap) {
+            if (costMap.containsKey(n)) {
+                return;
+            } else if (!Collections.disjoint(n.data, varsToSolve)) {
+                costMap.put(n, n.data.size());
+            } else {
+                int subcost = Integer.MAX_VALUE;
+                costMap.put(n, subcost); //avoid loops
+                for (Node n2 : n.getDependencies()) {
+                    computeCostIfNeeded(n2, costMap);
+                    subcost = Math.min(costMap.get(n2), subcost);
+                }
+                //update cost map to reflect real cost
+                costMap.put(n, subcost == Integer.MAX_VALUE ?
+                        Integer.MAX_VALUE :
+                        n.data.size() + subcost);
+            }
+        }
+
+        /**
+         * Pick the leaf that minimize cost
+         */
+        @Override
+        public Node pickNode(final InferenceGraph g) {
+            final Map<Node, Integer> costMap = new HashMap<Node, Integer>();
+            ArrayList<Node> leaves = new ArrayList<Node>();
+            for (Node n : g.nodes) {
+                computeCostIfNeeded(n, costMap);
+                if (n.isLeaf(n)) {
+                    leaves.add(n);
+                }
+            }
+            Assert.check(!leaves.isEmpty(), "No nodes to solve!");
+            Collections.sort(leaves, new java.util.Comparator<Node>() {
+                public int compare(Node n1, Node n2) {
+                    return costMap.get(n1) - costMap.get(n2);
+                }
+            });
+            return leaves.get(0);
+        }
+    }
+
+    /**
+     * The inference process can be thought of as a sequence of steps. Each step
+     * instantiates an inference variable using a subset of the inference variable
+     * bounds, if certain condition are met. Decisions such as the sequence in which
+     * steps are applied, or which steps are to be applied are left to the inference engine.
+     */
+    enum InferenceStep {
+
+        /**
+         * Instantiate an inference variables using one of its (ground) equality
+         * constraints
+         */
+        EQ(InferenceBound.EQ) {
+            @Override
+            Type solve(UndetVar uv, InferenceContext inferenceContext) {
+                return filterBounds(uv, inferenceContext).head;
+            }
+        },
+        /**
+         * Instantiate an inference variables using its (ground) lower bounds. Such
+         * bounds are merged together using lub().
+         */
+        LOWER(InferenceBound.LOWER) {
+            @Override
+            Type solve(UndetVar uv, InferenceContext inferenceContext) {
+                Infer infer = inferenceContext.infer();
+                List<Type> lobounds = filterBounds(uv, inferenceContext);
+                Type owntype = infer.types.lub(lobounds);
+                if (owntype.hasTag(ERROR)) {
+                    throw infer.inferenceException
+                        .setMessage("no.unique.minimal.instance.exists",
+                                    uv.qtype, lobounds);
+                } else {
+                    return owntype;
+                }
+            }
+        },
+        /**
+         * Instantiate an inference variables using its (ground) upper bounds. Such
+         * bounds are merged together using glb().
+         */
+        UPPER(InferenceBound.UPPER) {
+            @Override
+            Type solve(UndetVar uv, InferenceContext inferenceContext) {
+                Infer infer = inferenceContext.infer();
+                List<Type> hibounds = filterBounds(uv, inferenceContext);
+                Type owntype = infer.types.glb(hibounds);
+                if (owntype.isErroneous()) {
+                    throw infer.inferenceException
+                        .setMessage("no.unique.maximal.instance.exists",
+                                    uv.qtype, hibounds);
+                } else {
+                    return owntype;
+                }
+            }
+        },
+        /**
+         * Like the former; the only difference is that this step can only be applied
+         * if all upper bounds are ground.
+         */
+        UPPER_LEGACY(InferenceBound.UPPER) {
+            @Override
+            public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
+                return !inferenceContext.free(t.getBounds(ib));
+            }
+
+            @Override
+            Type solve(UndetVar uv, InferenceContext inferenceContext) {
+                return UPPER.solve(uv, inferenceContext);
+            }
+        };
+
+        final InferenceBound ib;
+
+        InferenceStep(InferenceBound ib) {
+            this.ib = ib;
+        }
+
+        /**
+         * Find an instantiated type for a given inference variable within
+         * a given inference context
+         */
+        abstract Type solve(UndetVar uv, InferenceContext inferenceContext);
+
+        /**
+         * Can the inference variable be instantiated using this step?
+         */
+        public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
+            return filterBounds(t, inferenceContext).nonEmpty();
+        }
+
+        /**
+         * Return the subset of ground bounds in a given bound set (i.e. eq/lower/upper)
+         */
+        List<Type> filterBounds(UndetVar uv, InferenceContext inferenceContext) {
+            return Type.filter(uv.getBounds(ib), new BoundFilter(inferenceContext));
+        }
+    }
+
+    /**
+     * This enumeration defines the sequence of steps to be applied when the
+     * solver works in legacy mode. The steps in this enumeration reflect
+     * the behavior of old inference routine (see JLS SE 7 15.12.2.7/15.12.2.8).
+     */
+    enum LegacyInferenceSteps {
+
+        EQ_LOWER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER)),
+        EQ_UPPER(EnumSet.of(InferenceStep.EQ, InferenceStep.UPPER_LEGACY));
+
+        final EnumSet<InferenceStep> steps;
+
+        LegacyInferenceSteps(EnumSet<InferenceStep> steps) {
+            this.steps = steps;
+        }
+    }
+
+    /**
+     * This enumeration defines the sequence of steps to be applied when the
+     * graph solver is used. This order is defined so as to maximize compatibility
+     * w.r.t. old inference routine (see JLS SE 7 15.12.2.7/15.12.2.8).
+     */
+    enum GraphInferenceSteps {
+
+        EQ(EnumSet.of(InferenceStep.EQ)),
+        EQ_LOWER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER)),
+        EQ_LOWER_UPPER(EnumSet.of(InferenceStep.EQ, InferenceStep.LOWER, InferenceStep.UPPER));
+
+        final EnumSet<InferenceStep> steps;
+
+        GraphInferenceSteps(EnumSet<InferenceStep> steps) {
+            this.steps = steps;
+        }
+    }
+
+    /**
+     * This is the graph inference solver - the solver organizes all inference variables in
+     * a given inference context by bound dependencies - in the general case, such dependencies
+     * would lead to a cyclic directed graph (hence the name); the dependency info is used to build
+     * an acyclic graph, where all cyclic variables are bundled together. An inference
+     * step corresponds to solving a node in the acyclic graph - this is done by
+     * relying on a given strategy (see GraphStrategy).
+     */
+    class GraphSolver {
+
+        InferenceContext inferenceContext;
+        Warner warn;
+
+        GraphSolver(InferenceContext inferenceContext, Warner warn) {
+            this.inferenceContext = inferenceContext;
+            this.warn = warn;
         }
-    };
+
+        /**
+         * Solve variables in a given inference context. The amount of variables
+         * to be solved, and the way in which the underlying acyclic graph is explored
+         * depends on the selected solver strategy.
+         */
+        void solve(GraphStrategy sstrategy) {
+            checkWithinBounds(inferenceContext, warn); //initial propagation of bounds
+            InferenceGraph inferenceGraph = new InferenceGraph();
+            while (!sstrategy.done()) {
+                InferenceGraph.Node nodeToSolve = sstrategy.pickNode(inferenceGraph);
+                List<Type> varsToSolve = List.from(nodeToSolve.data);
+                inferenceContext.save();
+                try {
+                    //repeat until all variables are solved
+                    outer: while (Type.containsAny(inferenceContext.restvars(), varsToSolve)) {
+                        //for each inference phase
+                        for (GraphInferenceSteps step : GraphInferenceSteps.values()) {
+                            if (inferenceContext.solveBasic(varsToSolve, step.steps)) {
+                                checkWithinBounds(inferenceContext, warn);
+                                continue outer;
+                            }
+                        }
+                        //no progress
+                        throw inferenceException;
+                    }
+                }
+                catch (InferenceException ex) {
+                    inferenceContext.rollback();
+                    instantiateAsUninferredVars(varsToSolve, inferenceContext);
+                    checkWithinBounds(inferenceContext, warn);
+                }
+                inferenceGraph.deleteNode(nodeToSolve);
+            }
+        }
+
+        /**
+         * The dependencies between the inference variables that need to be solved
+         * form a (possibly cyclic) graph. This class reduces the original dependency graph
+         * to an acyclic version, where cyclic nodes are folded into a single 'super node'.
+         */
+        class InferenceGraph {
+
+            /**
+             * This class represents a node in the graph. Each node corresponds
+             * to an inference variable and has edges (dependencies) on other
+             * nodes. The node defines an entry point that can be used to receive
+             * updates on the structure of the graph this node belongs to (used to
+             * keep dependencies in sync).
+             */
+            class Node extends GraphUtils.TarjanNode<ListBuffer<Type>> {
+
+                Set<Node> deps;
+
+                Node(Type ivar) {
+                    super(ListBuffer.of(ivar));
+                    this.deps = new HashSet<Node>();
+                }
+
+                @Override
+                public Iterable<? extends Node> getDependencies() {
+                    return deps;
+                }
+
+                @Override
+                public String printDependency(GraphUtils.Node<ListBuffer<Type>> to) {
+                    StringBuilder buf = new StringBuilder();
+                    String sep = "";
+                    for (Type from : data) {
+                        UndetVar uv = (UndetVar)inferenceContext.asFree(from);
+                        for (Type bound : uv.getBounds(InferenceBound.values())) {
+                            if (bound.containsAny(List.from(to.data))) {
+                                buf.append(sep);
+                                buf.append(bound);
+                                sep = ",";
+                            }
+                        }
+                    }
+                    return buf.toString();
+                }
+
+                boolean isLeaf(Node n) {
+                    //no deps, or only one self dep
+                    return (n.deps.isEmpty() ||
+                            n.deps.size() == 1 && n.deps.contains(n));
+                }
+
+                void mergeWith(List<? extends Node> nodes) {
+                    for (Node n : nodes) {
+                        Assert.check(n.data.length() == 1, "Attempt to merge a compound node!");
+                        data.appendList(n.data);
+                        deps.addAll(n.deps);
+                    }
+                    //update deps
+                    Set<Node> deps2 = new HashSet<Node>();
+                    for (Node d : deps) {
+                        if (data.contains(d.data.first())) {
+                            deps2.add(this);
+                        } else {
+                            deps2.add(d);
+                        }
+                    }
+                    deps = deps2;
+                }
+
+                void graphChanged(Node from, Node to) {
+                    if (deps.contains(from)) {
+                        deps.remove(from);
+                        if (to != null) {
+                            deps.add(to);
+                        }
+                    }
+                }
+            }
+
+            /** the nodes in the inference graph */
+            ArrayList<Node> nodes;
+
+            InferenceGraph() {
+                initNodes();
+            }
+
+            /**
+             * Delete a node from the graph. This update the underlying structure
+             * of the graph (including dependencies) via listeners updates.
+             */
+            public void deleteNode(Node n) {
+                Assert.check(nodes.contains(n));
+                nodes.remove(n);
+                notifyUpdate(n, null);
+            }
+
+            /**
+             * Notify all nodes of a change in the graph. If the target node is
+             * {@code null} the source node is assumed to be removed.
+             */
+            void notifyUpdate(Node from, Node to) {
+                for (Node n : nodes) {
+                    n.graphChanged(from, to);
+                }
+            }
+
+            /**
+             * Create the graph nodes. First a simple node is created for every inference
+             * variables to be solved. Then Tarjan is used to found all connected components
+             * in the graph. For each component containing more than one node, a super node is
+                 * created, effectively replacing the original cyclic nodes.
+             */
+            void initNodes() {
+                nodes = new ArrayList<Node>();
+                for (Type t : inferenceContext.restvars()) {
+                    nodes.add(new Node(t));
+                }
+                for (Node n_i : nodes) {
+                    Type i = n_i.data.first();
+                    for (Node n_j : nodes) {
+                        Type j = n_j.data.first();
+                        UndetVar uv_i = (UndetVar)inferenceContext.asFree(i);
+                        if (Type.containsAny(uv_i.getBounds(InferenceBound.values()), List.of(j))) {
+                            //update i's deps
+                            n_i.deps.add(n_j);
+                        }
+                    }
+                }
+                ArrayList<Node> acyclicNodes = new ArrayList<Node>();
+                for (List<? extends Node> conSubGraph : GraphUtils.tarjan(nodes)) {
+                    if (conSubGraph.length() > 1) {
+                        Node root = conSubGraph.head;
+                        root.mergeWith(conSubGraph.tail);
+                        for (Node n : conSubGraph) {
+                            notifyUpdate(n, root);
+                        }
+                    }
+                    acyclicNodes.add(conSubGraph.head);
+                }
+                nodes = acyclicNodes;
+            }
+
+            /**
+             * Debugging: dot representation of this graph
+             */
+            String toDot() {
+                StringBuilder buf = new StringBuilder();
+                for (Type t : inferenceContext.undetvars) {
+                    UndetVar uv = (UndetVar)t;
+                    buf.append(String.format("var %s - upper bounds = %s, lower bounds = %s, eq bounds = %s\\n",
+                            uv.qtype, uv.getBounds(InferenceBound.UPPER), uv.getBounds(InferenceBound.LOWER),
+                            uv.getBounds(InferenceBound.EQ)));
+                }
+                return GraphUtils.toDot(nodes, "inferenceGraph" + hashCode(), buf.toString());
+            }
+        }
+    }
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Inference context">
+    /**
+     * Functional interface for defining inference callbacks. Certain actions
+     * (i.e. subtyping checks) might need to be redone after all inference variables
+     * have been fixed.
+     */
+    interface FreeTypeListener {
+        void typesInferred(InferenceContext inferenceContext);
+    }
 
     /**
      * An inference context keeps track of the set of variables that are free
@@ -627,16 +1290,7 @@
      * it can be used as an entry point for performing upper/lower bound inference
      * (see InferenceKind).
      */
-    static class InferenceContext {
-
-        /**
-        * Single-method-interface for defining inference callbacks. Certain actions
-        * (i.e. subtyping checks) might need to be redone after all inference variables
-        * have been fixed.
-        */
-        interface FreeTypeListener {
-            void typesInferred(InferenceContext inferenceContext);
-        }
+     class InferenceContext {
 
         /** list of inference vars as undet vars */
         List<Type> undetvars;
@@ -644,15 +1298,26 @@
         /** list of inference vars in this context */
         List<Type> inferencevars;
 
+        /** backed up inference variables */
+        List<Type> saved_undet;
+
         java.util.Map<FreeTypeListener, List<Type>> freeTypeListeners =
                 new java.util.HashMap<FreeTypeListener, List<Type>>();
 
         List<FreeTypeListener> freetypeListeners = List.nil();
 
-        public InferenceContext(List<Type> inferencevars, Infer infer, boolean includeBounds) {
-            this.undetvars = Type.map(inferencevars, infer.new FromTypeVarFun(includeBounds));
+        public InferenceContext(List<Type> inferencevars) {
+            this.undetvars = Type.map(inferencevars, fromTypeVarFun);
             this.inferencevars = inferencevars;
         }
+        //where
+            Mapping fromTypeVarFun = new Mapping("fromTypeVarFunWithBounds") {
+                // mapping that turns inference variables into undet vars
+                public Type apply(Type t) {
+                    if (t.hasTag(TYPEVAR)) return new UndetVar((TypeVar)t, types);
+                    else return t.map(this);
+                }
+            };
 
         /**
          * returns the list of free variables (as type-variables) in this
@@ -664,19 +1329,51 @@
 
         /**
          * returns the list of uninstantiated variables (as type-variables) in this
-         * inference context (usually called after instantiate())
+         * inference context
          */
         List<Type> restvars() {
-            List<Type> undetvars = this.undetvars;
-            ListBuffer<Type> restvars = ListBuffer.lb();
-            for (Type t : instTypes()) {
-                UndetVar uv = (UndetVar)undetvars.head;
-                if (uv.qtype == t) {
-                    restvars.append(t);
+            return filterVars(new Filter<UndetVar>() {
+                public boolean accepts(UndetVar uv) {
+                    return uv.inst == null;
+                }
+            });
+        }
+
+        /**
+         * returns the list of instantiated variables (as type-variables) in this
+         * inference context
+         */
+        List<Type> instvars() {
+            return filterVars(new Filter<UndetVar>() {
+                public boolean accepts(UndetVar uv) {
+                    return uv.inst != null;
                 }
-                undetvars = undetvars.tail;
+            });
+        }
+
+        /**
+         * Get list of bounded inference variables (where bound is other than
+         * declared bounds).
+         */
+        final List<Type> boundedVars() {
+            return filterVars(new Filter<UndetVar>() {
+                public boolean accepts(UndetVar uv) {
+                    return uv.getBounds(InferenceBound.UPPER)
+                            .diff(uv.getDeclaredBounds())
+                            .appendList(uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)).nonEmpty();
+                }
+            });
+        }
+
+        private List<Type> filterVars(Filter<UndetVar> fu) {
+            ListBuffer<Type> res = ListBuffer.lb();
+            for (Type t : undetvars) {
+                UndetVar uv = (UndetVar)t;
+                if (fu.accepts(uv)) {
+                    res.append(uv.qtype);
+                }
             }
-            return restvars.toList();
+            return res.toList();
         }
 
         /**
@@ -725,14 +1422,14 @@
          * undet vars (used ahead of subtyping/compatibility checks to allow propagation
          * of inference constraints).
          */
-        final Type asFree(Type t, Types types) {
+        final Type asFree(Type t) {
             return types.subst(t, inferencevars, undetvars);
         }
 
-        final List<Type> asFree(List<Type> ts, Types types) {
+        final List<Type> asFree(List<Type> ts) {
             ListBuffer<Type> buf = ListBuffer.lb();
             for (Type t : ts) {
-                buf.append(asFree(t, types));
+                buf.append(asFree(t));
             }
             return buf.toList();
         }
@@ -751,14 +1448,14 @@
          * instantiated types - if one or more free variable has not been
          * fully instantiated, it will still be available in the resulting type.
          */
-        Type asInstType(Type t, Types types) {
+        Type asInstType(Type t) {
             return types.subst(t, inferencevars, instTypes());
         }
 
-        List<Type> asInstTypes(List<Type> ts, Types types) {
+        List<Type> asInstTypes(List<Type> ts) {
             ListBuffer<Type> buf = ListBuffer.lb();
             for (Type t : ts) {
-                buf.append(asInstType(t, types));
+                buf.append(asInstType(t));
             }
             return buf.toList();
         }
@@ -774,11 +1471,15 @@
          * Mark the inference context as complete and trigger evaluation
          * of all deferred checks.
          */
-        void notifyChange(Types types) {
+        void notifyChange() {
+            notifyChange(inferencevars.diff(restvars()));
+        }
+
+        void notifyChange(List<Type> inferredVars) {
             InferenceException thrownEx = null;
             for (Map.Entry<FreeTypeListener, List<Type>> entry :
                     new HashMap<FreeTypeListener, List<Type>>(freeTypeListeners).entrySet()) {
-                if (!Type.containsAny(entry.getValue(), restvars())) {
+                if (!Type.containsAny(entry.getValue(), inferencevars.diff(inferredVars))) {
                     try {
                         entry.getKey().typesInferred(this);
                         freeTypeListeners.remove(entry.getKey());
@@ -796,22 +1497,156 @@
             }
         }
 
-        void solveAny(List<Type> varsToSolve, Types types, Infer infer) {
-            boolean progress = false;
-            for (Type t : varsToSolve) {
-                UndetVar uv = (UndetVar)asFree(t, types);
-                if (uv.inst == null) {
-                    infer.minimizeInst(uv, types.noWarnings);
-                    if (uv.inst != null) {
-                        progress = true;
+        /**
+         * Save the state of this inference context
+         */
+        void save() {
+            ListBuffer<Type> buf = ListBuffer.lb();
+            for (Type t : undetvars) {
+                UndetVar uv = (UndetVar)t;
+                UndetVar uv2 = new UndetVar((TypeVar)uv.qtype, types);
+                for (InferenceBound ib : InferenceBound.values()) {
+                    for (Type b : uv.getBounds(ib)) {
+                        uv2.addBound(ib, b, types);
+                    }
+                }
+                uv2.inst = uv.inst;
+                buf.add(uv2);
+            }
+            saved_undet = buf.toList();
+        }
+
+        /**
+         * Restore the state of this inference context to the previous known checkpoint
+         */
+        void rollback() {
+            Assert.check(saved_undet != null && saved_undet.length() == undetvars.length());
+            undetvars = saved_undet;
+            saved_undet = null;
+        }
+
+        /**
+         * Copy variable in this inference context to the given context
+         */
+        void dupTo(final InferenceContext that) {
+            that.inferencevars = that.inferencevars.appendList(inferencevars);
+            that.undetvars = that.undetvars.appendList(undetvars);
+            //set up listeners to notify original inference contexts as
+            //propagated vars are inferred in new context
+            for (Type t : inferencevars) {
+                that.freeTypeListeners.put(new FreeTypeListener() {
+                    public void typesInferred(InferenceContext inferenceContext) {
+                        InferenceContext.this.notifyChange();
+                    }
+                }, List.of(t));
+            }
+        }
+
+        /**
+         * Solve with given graph strategy.
+         */
+        private void solve(GraphStrategy ss, Warner warn) {
+            GraphSolver s = new GraphSolver(this, warn);
+            s.solve(ss);
+        }
+
+        /**
+         * Solve all variables in this context.
+         */
+        public void solve(Warner warn) {
+            solve(new LeafSolver() {
+                public boolean done() {
+                    return restvars().isEmpty();
+                }
+            }, warn);
+        }
+
+        /**
+         * Solve all variables in the given list.
+         */
+        public void solve(final List<Type> vars, Warner warn) {
+            solve(new BestLeafSolver(vars) {
+                public boolean done() {
+                    return !free(asInstTypes(vars));
+                }
+            }, warn);
+        }
+
+        /**
+         * Solve at least one variable in given list.
+         */
+        public void solveAny(List<Type> varsToSolve, Warner warn) {
+            checkWithinBounds(this, warn); //propagate bounds
+            List<Type> boundedVars = boundedVars().intersect(restvars()).intersect(varsToSolve);
+            if (boundedVars.isEmpty()) {
+                throw inferenceException.setMessage("cyclic.inference",
+                                freeVarsIn(varsToSolve));
+            }
+            solve(new BestLeafSolver(boundedVars) {
+                public boolean done() {
+                    return instvars().intersect(varsToSolve).nonEmpty();
+                }
+            }, warn);
+        }
+
+        /**
+         * Apply a set of inference steps
+         */
+        private boolean solveBasic(EnumSet<InferenceStep> steps) {
+            return solveBasic(inferencevars, steps);
+        }
+
+        private boolean solveBasic(List<Type> varsToSolve, EnumSet<InferenceStep> steps) {
+            boolean changed = false;
+            for (Type t : varsToSolve.intersect(restvars())) {
+                UndetVar uv = (UndetVar)asFree(t);
+                for (InferenceStep step : steps) {
+                    if (step.accepts(uv, this)) {
+                        uv.inst = step.solve(uv, this);
+                        changed = true;
+                        break;
                     }
                 }
             }
-            if (!progress) {
-                throw infer.inferenceException.setMessage("cyclic.inference", varsToSolve);
+            return changed;
+        }
+
+        /**
+         * Instantiate inference variables in legacy mode (JLS 15.12.2.7, 15.12.2.8).
+         * During overload resolution, instantiation is done by doing a partial
+         * inference process using eq/lower bound instantiation. During check,
+         * we also instantiate any remaining vars by repeatedly using eq/upper
+         * instantiation, until all variables are solved.
+         */
+        public void solveLegacy(boolean partial, Warner warn, EnumSet<InferenceStep> steps) {
+            while (true) {
+                boolean stuck = !solveBasic(steps);
+                if (restvars().isEmpty() || partial) {
+                    //all variables have been instantiated - exit
+                    break;
+                } else if (stuck) {
+                    //some variables could not be instantiated because of cycles in
+                    //upper bounds - provide a (possibly recursive) default instantiation
+                    instantiateAsUninferredVars(restvars(), this);
+                    break;
+                } else {
+                    //some variables have been instantiated - replace newly instantiated
+                    //variables in remaining upper bounds and continue
+                    for (Type t : undetvars) {
+                        UndetVar uv = (UndetVar)t;
+                        uv.substBounds(inferenceVars(), instTypes(), types);
+                    }
+                }
             }
+            checkWithinBounds(this, warn);
+        }
+
+        private Infer infer() {
+            //back-door to infer
+            return Infer.this;
         }
     }
 
-    final InferenceContext emptyContext = new InferenceContext(List.<Type>nil(), this, false);
+    final InferenceContext emptyContext = new InferenceContext(List.<Type>nil());
+    // </editor-fold>
 }
--- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -31,8 +31,8 @@
 import com.sun.tools.javac.tree.TreeMaker;
 import com.sun.tools.javac.tree.TreeScanner;
 import com.sun.tools.javac.tree.TreeTranslator;
-import com.sun.tools.javac.code.Flags;
 import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Scope;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.DynamicMethodSymbol;
@@ -44,6 +44,7 @@
 import com.sun.tools.javac.code.Type.MethodType;
 import com.sun.tools.javac.code.Types;
 import com.sun.tools.javac.comp.LambdaToMethod.LambdaAnalyzer.*;
+import com.sun.tools.javac.comp.Lower.BasicFreeVarCollector;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.List;
@@ -57,9 +58,7 @@
 import static com.sun.tools.javac.comp.LambdaToMethod.LambdaSymbolKind.*;
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
-import static com.sun.tools.javac.code.TypeTag.BOT;
-import static com.sun.tools.javac.code.TypeTag.NONE;
-import static com.sun.tools.javac.code.TypeTag.VOID;
+import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /**
@@ -72,6 +71,7 @@
  */
 public class LambdaToMethod extends TreeTranslator {
 
+    private Lower lower;
     private Names names;
     private Symtab syms;
     private Resolve rs;
@@ -89,9 +89,52 @@
     /** current translation context (visitor argument) */
     private TranslationContext<?> context;
 
-    /** list of translated methods
-     **/
-    private ListBuffer<JCTree> translatedMethodList;
+    /** info about the current class being processed */
+    private KlassInfo kInfo;
+
+    /** Flag for alternate metafactories indicating the lambda object is intended to be serializable */
+    public static final int FLAG_SERIALIZABLE = 1 << 0;
+
+    /** Flag for alternate metafactories indicating the lambda object has multiple targets */
+    public static final int FLAG_MARKERS = 1 << 1;
+
+    private class KlassInfo {
+
+        /**
+         * list of methods to append
+         */
+        private ListBuffer<JCTree> appendedMethodList;
+
+        /**
+         * list of deserialization cases
+         */
+        private final Map<String, ListBuffer<JCStatement>> deserializeCases;
+
+       /**
+         * deserialize method symbol
+         */
+        private final MethodSymbol deserMethodSym;
+
+        /**
+         * deserialize method parameter symbol
+         */
+        private final VarSymbol deserParamSym;
+
+        private KlassInfo(Symbol kSym) {
+            appendedMethodList = ListBuffer.lb();
+            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);
+            deserParamSym = new VarSymbol(FINAL, names.fromString("lambda"),
+                    syms.serializedLambdaType, deserMethodSym);
+        }
+
+        private void addMethod(JCTree decl) {
+            appendedMethodList = appendedMethodList.prepend(decl);
+        }
+    }
 
     // <editor-fold defaultstate="collapsed" desc="Instantiating">
     private static final Context.Key<LambdaToMethod> unlambdaKey =
@@ -106,17 +149,14 @@
     }
 
     private LambdaToMethod(Context context) {
+        lower = Lower.instance(context);
         names = Names.instance(context);
         syms = Symtab.instance(context);
         rs = Resolve.instance(context);
         make = TreeMaker.instance(context);
         types = Types.instance(context);
         transTypes = TransTypes.instance(context);
-        this.analyzer = makeAnalyzer();
-    }
-
-    private LambdaAnalyzer makeAnalyzer() {
-        return new LambdaAnalyzer();
+        analyzer = new LambdaAnalyzer();
     }
     // </editor-fold>
 
@@ -168,18 +208,22 @@
             //analyze class
             analyzer.analyzeClass(tree);
         }
-        ListBuffer<JCTree> prevTranslated = translatedMethodList;
+        KlassInfo prevKlassInfo = kInfo;
         try {
-            translatedMethodList = ListBuffer.lb();
+            kInfo = new KlassInfo(tree.sym);
             super.visitClassDef(tree);
+            if (!kInfo.deserializeCases.isEmpty()) {
+                kInfo.addMethod(makeDeserializeMethod(tree.sym));
+            }
             //add all translated instance methods here
-            tree.defs = tree.defs.appendList(translatedMethodList.toList());
-            for (JCTree lambda : translatedMethodList) {
+            List<JCTree> newMethods = kInfo.appendedMethodList.toList();
+            tree.defs = tree.defs.appendList(newMethods);
+            for (JCTree lambda : newMethods) {
                 tree.sym.members().enter(((JCMethodDecl)lambda).sym);
             }
             result = tree;
         } finally {
-            translatedMethodList = prevTranslated;
+            kInfo = prevKlassInfo;
         }
     }
 
@@ -217,7 +261,7 @@
         lambdaDecl.body = translate(makeLambdaBody(tree, lambdaDecl));
 
         //Add the method to the list of methods to be added to this class.
-        translatedMethodList = translatedMethodList.prepend(lambdaDecl);
+        kInfo.addMethod(lambdaDecl);
 
         //now that we have generated a method for the lambda expression,
         //we can translate the lambda into a method reference pointing to the newly
@@ -234,7 +278,7 @@
 
         if (!sym.isStatic()) {
             syntheticInits.append(makeThis(
-                    sym.owner.asType(),
+                    sym.owner.enclClass().asType(),
                     localContext.owner.enclClass()));
         }
 
@@ -253,7 +297,7 @@
         int refKind = referenceKind(sym);
 
         //convert to an invokedynamic call
-        result = makeMetaFactoryIndyCall(tree, tree.targetType, refKind, sym, indy_args);
+        result = makeMetaFactoryIndyCall(tree, context.needsAltMetafactory(), context.isSerializable(), refKind, sym, indy_args);
     }
 
     private JCIdent makeThis(Type type, Symbol owner) {
@@ -291,8 +335,8 @@
             case IMPLICIT_INNER:    /** Inner :: new */
             case SUPER:             /** super :: instMethod */
                 init = makeThis(
-                    localContext.owner.owner.asType(),
-                    localContext.owner);
+                    localContext.owner.enclClass().asType(),
+                    localContext.owner.enclClass());
                 break;
 
             case BOUND:             /** Expr :: instMethod */
@@ -302,6 +346,7 @@
             case UNBOUND:           /** Type :: instMethod */
             case STATIC:            /** Type :: staticMethod */
             case TOPLEVEL:          /** Top level :: new */
+            case ARRAY_CTOR:        /** ArrayType :: new */
                 init = null;
                 break;
 
@@ -313,7 +358,7 @@
 
 
         //build a sam instance using an indy call to the meta-factory
-        result = makeMetaFactoryIndyCall(tree, tree.targetType, localContext.referenceKind(), refSym, indy_args);
+        result = makeMetaFactoryIndyCall(tree, localContext.needsAltMetafactory(), localContext.isSerializable(), localContext.referenceKind(), refSym, indy_args);
     }
 
     /**
@@ -332,6 +377,9 @@
             } else if (lambdaContext.getSymbolMap(LOCAL_VAR).containsKey(tree.sym)) {
                 Symbol translatedSym = lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym);
                 result = make.Ident(translatedSym).setType(tree.type);
+            } else if (lambdaContext.getSymbolMap(TYPE_VAR).containsKey(tree.sym)) {
+                Symbol translatedSym = lambdaContext.getSymbolMap(TYPE_VAR).get(tree.sym);
+                result = make.Ident(translatedSym).setType(translatedSym.type);
             } else if (lambdaContext.getSymbolMap(CAPTURED_VAR).containsKey(tree.sym)) {
                 Symbol translatedSym = lambdaContext.getSymbolMap(CAPTURED_VAR).get(tree.sym);
                 result = make.Ident(translatedSym).setType(tree.type);
@@ -361,6 +409,16 @@
         if (context != null && lambdaContext.getSymbolMap(LOCAL_VAR).containsKey(tree.sym)) {
             JCExpression init = translate(tree.init);
             result = make.VarDef((VarSymbol)lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym), init);
+        } else if (context != null && lambdaContext.getSymbolMap(TYPE_VAR).containsKey(tree.sym)) {
+            JCExpression init = translate(tree.init);
+            VarSymbol xsym = (VarSymbol)lambdaContext.getSymbolMap(TYPE_VAR).get(tree.sym);
+            result = make.VarDef(xsym, init);
+            // Replace the entered symbol for this variable
+            Scope sc = tree.sym.owner.members();
+            if (sc != null) {
+                sc.remove(tree.sym);
+                sc.enter(xsym);
+            }
         } else {
             super.visitVarDef(tree);
         }
@@ -450,6 +508,135 @@
         return trans_block;
     }
 
+    private JCMethodDecl makeDeserializeMethod(Symbol kSym) {
+        ListBuffer<JCCase> cases = ListBuffer.lb();
+        ListBuffer<JCBreak> breaks = ListBuffer.lb();
+        for (Map.Entry<String, ListBuffer<JCStatement>> entry : kInfo.deserializeCases.entrySet()) {
+            JCBreak br = make.Break(null);
+            breaks.add(br);
+            List<JCStatement> stmts = entry.getValue().append(br).toList();
+            cases.add(make.Case(make.Literal(entry.getKey()), stmts));
+        }
+        JCSwitch sw = make.Switch(deserGetter("getImplMethodName", syms.stringType), cases.toList());
+        for (JCBreak br : breaks) {
+            br.target = sw;
+        }
+        JCBlock body = make.Block(0L, List.<JCStatement>of(
+                sw,
+                make.Throw(makeNewClass(
+                    syms.illegalArgumentExceptionType,
+                    List.<JCExpression>of(make.Literal("Invalid lambda deserialization"))))));
+        JCMethodDecl deser = make.MethodDef(make.Modifiers(kInfo.deserMethodSym.flags()),
+                        names.deserializeLambda,
+                        make.QualIdent(kInfo.deserMethodSym.getReturnType().tsym),
+                        List.<JCTypeParameter>nil(),
+                        List.of(make.VarDef(kInfo.deserParamSym, null)),
+                        List.<JCExpression>nil(),
+                        body,
+                        null);
+        deser.sym = kInfo.deserMethodSym;
+        deser.type = kInfo.deserMethodSym.type;
+        //System.err.printf("DESER: '%s'\n", deser);
+        return deser;
+    }
+
+    /** Make an attributed class instance creation expression.
+     *  @param ctype    The class type.
+     *  @param args     The constructor arguments.
+     */
+    JCNewClass makeNewClass(Type ctype, List<JCExpression> args) {
+        JCNewClass tree = make.NewClass(null,
+            null, make.QualIdent(ctype.tsym), args, null);
+        tree.constructor = rs.resolveConstructor(
+            null, attrEnv, ctype, TreeInfo.types(args), List.<Type>nil());
+        tree.type = ctype;
+        return tree;
+    }
+
+    private void addDeserializationCase(int implMethodKind, Symbol refSym, Type targetType, MethodSymbol samSym,
+            DiagnosticPosition pos, List<Object> staticArgs, MethodType indyType) {
+        String functionalInterfaceClass = classSig(targetType);
+        String functionalInterfaceMethodName = samSym.getSimpleName().toString();
+        String functionalInterfaceMethodSignature = methodSig(types.erasure(samSym.type));
+        String implClass = classSig(types.erasure(refSym.owner.type));
+        String implMethodName = refSym.getQualifiedName().toString();
+        String implMethodSignature = methodSig(types.erasure(refSym.type));
+
+        JCExpression kindTest = eqTest(syms.intType, deserGetter("getImplMethodKind", syms.intType), make.Literal(implMethodKind));
+        ListBuffer<JCExpression> serArgs = ListBuffer.lb();
+        int i = 0;
+        for (Type t : indyType.getParameterTypes()) {
+            List<JCExpression> indexAsArg = ListBuffer.<JCExpression>lb().append(make.Literal(i)).toList();
+            List<Type> argTypes = ListBuffer.<Type>lb().append(syms.intType).toList();
+            serArgs.add(make.TypeCast(types.erasure(t), deserGetter("getCapturedArg", syms.objectType, argTypes, indexAsArg)));
+            ++i;
+        }
+        JCStatement stmt = make.If(
+                deserTest(deserTest(deserTest(deserTest(deserTest(
+                    kindTest,
+                    "getFunctionalInterfaceClass", functionalInterfaceClass),
+                    "getFunctionalInterfaceMethodName", functionalInterfaceMethodName),
+                    "getFunctionalInterfaceMethodSignature", functionalInterfaceMethodSignature),
+                    "getImplClass", implClass),
+                    "getImplMethodSignature", implMethodSignature),
+                make.Return(makeIndyCall(
+                    pos,
+                    syms.lambdaMetafactory,
+                    names.altMetaFactory,
+                    staticArgs, indyType, serArgs.toList())),
+                null);
+        ListBuffer<JCStatement> stmts = kInfo.deserializeCases.get(implMethodName);
+        if (stmts == null) {
+            stmts = ListBuffer.lb();
+            kInfo.deserializeCases.put(implMethodName, stmts);
+        }
+        /****
+        System.err.printf("+++++++++++++++++\n");
+        System.err.printf("*functionalInterfaceClass: '%s'\n", functionalInterfaceClass);
+        System.err.printf("*functionalInterfaceMethodName: '%s'\n", functionalInterfaceMethodName);
+        System.err.printf("*functionalInterfaceMethodSignature: '%s'\n", functionalInterfaceMethodSignature);
+        System.err.printf("*implMethodKind: %d\n", implMethodKind);
+        System.err.printf("*implClass: '%s'\n", implClass);
+        System.err.printf("*implMethodName: '%s'\n", implMethodName);
+        System.err.printf("*implMethodSignature: '%s'\n", implMethodSignature);
+        ****/
+        stmts.append(stmt);
+    }
+
+    private JCExpression eqTest(Type argType, JCExpression arg1, JCExpression arg2) {
+        JCBinary testExpr = make.Binary(JCTree.Tag.EQ, arg1, arg2);
+        testExpr.operator = rs.resolveBinaryOperator(null, JCTree.Tag.EQ, attrEnv, argType, argType);
+        testExpr.setType(syms.booleanType);
+        return testExpr;
+    }
+
+    private JCExpression deserTest(JCExpression prev, String func, String lit) {
+        MethodType eqmt = new MethodType(List.of(syms.objectType), syms.booleanType, List.<Type>nil(), syms.methodClass);
+        Symbol eqsym = rs.resolveQualifiedMethod(null, attrEnv, syms.objectType, names.equals, List.of(syms.objectType), List.<Type>nil());
+        JCMethodInvocation eqtest = make.Apply(
+                List.<JCExpression>nil(),
+                make.Select(deserGetter(func, syms.stringType), eqsym).setType(eqmt),
+                List.<JCExpression>of(make.Literal(lit)));
+        eqtest.setType(syms.booleanType);
+        JCBinary compound = make.Binary(JCTree.Tag.AND, prev, eqtest);
+        compound.operator = rs.resolveBinaryOperator(null, JCTree.Tag.AND, attrEnv, syms.booleanType, syms.booleanType);
+        compound.setType(syms.booleanType);
+        return compound;
+    }
+
+    private JCExpression deserGetter(String func, Type type) {
+        return deserGetter(func, type, List.<Type>nil(), List.<JCExpression>nil());
+    }
+
+    private JCExpression deserGetter(String func, Type type, List<Type> argTypes, List<JCExpression> args) {
+        MethodType getmt = new MethodType(argTypes, type, List.<Type>nil(), syms.methodClass);
+        Symbol getsym = rs.resolveQualifiedMethod(null, attrEnv, syms.serializedLambdaType, names.fromString(func), argTypes, List.<Type>nil());
+        return make.Apply(
+                    List.<JCExpression>nil(),
+                    make.Select(make.Ident(kInfo.deserParamSym).setType(syms.serializedLambdaType), getsym).setType(getmt),
+                    args).setType(type);
+    }
+
     /**
      * Create new synthetic method with given flags, name, type, owner
      */
@@ -502,19 +689,6 @@
 
     // </editor-fold>
 
-    private MethodSymbol makeSamDescriptor(Type targetType) {
-        return (MethodSymbol)types.findDescriptorSymbol(targetType.tsym);
-    }
-
-    private Type makeFunctionalDescriptorType(Type targetType, MethodSymbol samDescriptor, boolean erased) {
-        Type descType = types.memberType(targetType, samDescriptor);
-        return erased ? types.erasure(descType) : descType;
-    }
-
-    private Type makeFunctionalDescriptorType(Type targetType, boolean erased) {
-        return makeFunctionalDescriptorType(targetType, makeSamDescriptor(targetType), erased);
-    }
-
     /**
      * Generate an adapter method "bridge" for a method reference which cannot
      * be used directly.
@@ -568,7 +742,8 @@
                 List<Type> refPTypes = tree.sym.type.getParameterTypes();
                 int refSize = refPTypes.size();
                 int samSize = samPTypes.size();
-                int last = localContext.needsVarArgsConversion() ? refSize - 1 : refSize;   // Last parameter to copy from referenced method
+                // Last parameter to copy from referenced method
+                int last = localContext.needsVarArgsConversion() ? refSize - 1 : refSize;
 
                 List<Type> l = refPTypes;
                 // Use parameter types of the referenced method, excluding final var args
@@ -593,12 +768,13 @@
                         null,
                         null);
                 bridgeDecl.sym = (MethodSymbol) localContext.bridgeSym;
-                bridgeDecl.type = localContext.bridgeSym.type = types.createMethodTypeWithParameters(samDesc, TreeInfo.types(params.toList()));
+                bridgeDecl.type = localContext.bridgeSym.type =
+                        types.createMethodTypeWithParameters(samDesc, TreeInfo.types(params.toList()));
 
                 //bridge method body generation - this can be either a method call or a
                 //new instance creation expression, depending on the member reference kind
                 JCExpression bridgeExpr = (tree.getMode() == ReferenceMode.INVOKE)
-                        ? bridgeExpressionInvoke(rcvr)
+                        ? bridgeExpressionInvoke(makeReceiver(rcvr))
                         : bridgeExpressionNew();
 
                 //the body is either a return expression containing a method call,
@@ -611,6 +787,16 @@
                 make.at(prevPos);
             }
         }
+        //where
+            private JCExpression makeReceiver(VarSymbol rcvr) {
+                if (rcvr == null) return null;
+                JCExpression rcvrExpr = make.Ident(rcvr);
+                Type rcvrType = tree.sym.enclClass().type;
+                if (!rcvr.type.tsym.isSubClass(rcvrType.tsym, types)) {
+                    rcvrExpr = make.TypeCast(make.Type(rcvrType), rcvrExpr).setType(rcvrType);
+                }
+                return rcvrExpr;
+            }
 
         /**
          * determine the receiver of the bridged method call - the receiver can
@@ -618,12 +804,12 @@
          * original qualifier expression is never used here, as it might refer
          * to symbols not available in the static context of the bridge
          */
-        private JCExpression bridgeExpressionInvoke(VarSymbol rcvr) {
+        private JCExpression bridgeExpressionInvoke(JCExpression rcvr) {
             JCExpression qualifier =
                     tree.sym.isStatic() ?
                         make.Type(tree.sym.owner.type) :
                         (rcvr != null) ?
-                            make.Ident(rcvr) :
+                            rcvr :
                             tree.getQualifierExpression();
 
             //create the qualifier expression
@@ -633,7 +819,8 @@
 
             //create the method call expression
             JCExpression apply = make.Apply(List.<JCExpression>nil(), select,
-                    convertArgs(tree.sym, args.toList(), tree.varargsElement)).setType(tree.sym.erasure(types).getReturnType());
+                    convertArgs(tree.sym, args.toList(), tree.varargsElement)).
+                    setType(tree.sym.erasure(types).getReturnType());
 
             apply = transTypes.coerce(apply, localContext.generatedRefSig().getReturnType());
             setVarargsIfNeeded(apply, tree.varargsElement);
@@ -645,24 +832,34 @@
          * to the first bridge synthetic parameter
          */
         private JCExpression bridgeExpressionNew() {
-            JCExpression encl = null;
-            switch (tree.kind) {
-                case UNBOUND:
-                case IMPLICIT_INNER:
-                    encl = make.Ident(params.first());
-            }
+            if (tree.kind == ReferenceKind.ARRAY_CTOR) {
+                //create the array creation expression
+                JCNewArray newArr = make.NewArray(
+                        make.Type(types.elemtype(tree.getQualifierExpression().type)),
+                        List.of(make.Ident(params.first())),
+                        null);
+                newArr.type = tree.getQualifierExpression().type;
+                return newArr;
+            } else {
+                JCExpression encl = null;
+                switch (tree.kind) {
+                    case UNBOUND:
+                    case IMPLICIT_INNER:
+                        encl = make.Ident(params.first());
+                }
 
-            //create the instance creation expression
-            JCNewClass newClass = make.NewClass(encl,
-                    List.<JCExpression>nil(),
-                    make.Type(tree.getQualifierExpression().type),
-                    convertArgs(tree.sym, args.toList(), tree.varargsElement),
-                    null);
-            newClass.constructor = tree.sym;
-            newClass.constructorType = tree.sym.erasure(types);
-            newClass.type = tree.getQualifierExpression().type;
-            setVarargsIfNeeded(newClass, tree.varargsElement);
-            return newClass;
+                //create the instance creation expression
+                JCNewClass newClass = make.NewClass(encl,
+                        List.<JCExpression>nil(),
+                        make.Type(tree.getQualifierExpression().type),
+                        convertArgs(tree.sym, args.toList(), tree.varargsElement),
+                        null);
+                newClass.constructor = tree.sym;
+                newClass.constructorType = tree.sym.erasure(types);
+                newClass.type = tree.getQualifierExpression().type;
+                setVarargsIfNeeded(newClass, tree.varargsElement);
+                return newClass;
+            }
         }
 
         private VarSymbol addParameter(String name, Type p, boolean genArg) {
@@ -681,19 +878,20 @@
      * * super is used
      */
     private void bridgeMemberReference(JCMemberReference tree, ReferenceTranslationContext localContext) {
-        JCMethodDecl bridgeDecl = (new MemberReferenceBridger(tree, localContext).bridge());
-        translatedMethodList = translatedMethodList.prepend(bridgeDecl);
+        kInfo.addMethod(new MemberReferenceBridger(tree, localContext).bridge());
     }
 
     /**
      * Generate an indy method call to the meta factory
      */
-    private JCExpression makeMetaFactoryIndyCall(JCExpression tree, Type targetType, int refKind, Symbol refSym, List<JCExpression> indy_args) {
+    private JCExpression makeMetaFactoryIndyCall(JCFunctionalExpression tree, boolean needsAltMetafactory,
+            boolean isSerializable, int refKind, Symbol refSym, List<JCExpression> indy_args) {
         //determine the static bsm args
-        Type mtype = makeFunctionalDescriptorType(targetType, true);
+        Type mtype = types.erasure(tree.descriptorType);
+        MethodSymbol samSym = (MethodSymbol) types.findDescriptorSymbol(tree.type.tsym);
         List<Object> staticArgs = List.<Object>of(
                 new Pool.MethodHandle(ClassFile.REF_invokeInterface,
-                    types.findDescriptorSymbol(targetType.tsym), types),
+                    types.findDescriptorSymbol(tree.type.tsym), types),
                 new Pool.MethodHandle(refKind, refSym, types),
                 new MethodType(mtype.getParameterTypes(),
                         mtype.getReturnType(),
@@ -712,14 +910,39 @@
                 List.<Type>nil(),
                 syms.methodClass);
 
-        return makeIndyCall(tree, syms.lambdaMetafactory, names.metaFactory, staticArgs, indyType, indy_args);
+        Name metafactoryName = needsAltMetafactory ?
+                names.altMetaFactory : names.metaFactory;
+
+        if (needsAltMetafactory) {
+            ListBuffer<Object> markers = ListBuffer.lb();
+            for (Symbol t : tree.targets.tail) {
+                if (t != syms.serializableType.tsym) {
+                    markers.append(t);
+                }
+            }
+            int flags = isSerializable? FLAG_SERIALIZABLE : 0;
+            boolean hasMarkers = markers.nonEmpty();
+            flags |= hasMarkers ? FLAG_MARKERS : 0;
+            staticArgs = staticArgs.append(flags);
+            if (hasMarkers) {
+                staticArgs = staticArgs.append(markers.length());
+                staticArgs = staticArgs.appendList(markers.toList());
+            }
+            if (isSerializable) {
+                addDeserializationCase(refKind, refSym, tree.type, samSym,
+                        tree, staticArgs, indyType);
+            }
+        }
+
+        return makeIndyCall(tree, syms.lambdaMetafactory, metafactoryName, staticArgs, indyType, indy_args);
     }
 
     /**
      * Generate an indy method call with given name, type and static bootstrap
      * arguments types
      */
-    private JCExpression makeIndyCall(DiagnosticPosition pos, Type site, Name bsmName, List<Object> staticArgs, MethodType indyType, List<JCExpression> indyArgs) {
+    private JCExpression makeIndyCall(DiagnosticPosition pos, Type site, Name bsmName,
+            List<Object> staticArgs, MethodType indyType, List<JCExpression> indyArgs) {
         int prevPos = make.pos;
         try {
             make.at(pos);
@@ -733,7 +956,9 @@
             DynamicMethodSymbol dynSym =
                     new DynamicMethodSymbol(names.lambda,
                                             syms.noSymbol,
-                                            bsm.isStatic() ? ClassFile.REF_invokeStatic : ClassFile.REF_invokeVirtual,
+                                            bsm.isStatic() ?
+                                                ClassFile.REF_invokeStatic :
+                                                ClassFile.REF_invokeVirtual,
                                             (MethodSymbol)bsm,
                                             indyType,
                                             staticArgs.toArray());
@@ -794,13 +1019,14 @@
             } else if (refSym.enclClass().isInterface()) {
                 return ClassFile.REF_invokeInterface;
             } else {
-                return ClassFile.REF_invokeVirtual;
+                return (refSym.flags() & PRIVATE) != 0 ?
+                        ClassFile.REF_invokeSpecial :
+                        ClassFile.REF_invokeVirtual;
             }
         }
     }
-    // </editor-fold>
 
-    // <editor-fold defaultstate="collapsed" desc="Lambda/reference analyzer">\
+    // <editor-fold defaultstate="collapsed" desc="Lambda/reference analyzer">
     /**
      * This visitor collects information about translation of a lambda expression.
      * More specifically, it keeps track of the enclosing contexts and captured locals
@@ -817,8 +1043,25 @@
          */
         private int lambdaCount = 0;
 
+        /**
+         * keep the count of lambda expression defined in given context (used to
+         * generate unambiguous names for serializable lambdas)
+         */
+        private Map<String, Integer> serializableLambdaCounts =
+                new HashMap<String, Integer>();
+
+        private Map<Symbol, JCClassDecl> localClassDefs;
+
+        /**
+         * maps for fake clinit symbols to be used as owners of lambda occurring in
+         * a static var init context
+         */
+        private Map<ClassSymbol, Symbol> clinits =
+                new HashMap<ClassSymbol, Symbol>();
+
         private void analyzeClass(JCClassDecl tree) {
             frameStack = List.nil();
+            localClassDefs = new HashMap<Symbol, JCClassDecl>();
             scan(tree);
         }
 
@@ -839,21 +1082,28 @@
         @Override
         public void visitClassDef(JCClassDecl tree) {
             List<Frame> prevStack = frameStack;
+            Map<String, Integer> prevSerializableLambdaCount =
+                    serializableLambdaCounts;
+            Map<ClassSymbol, Symbol> prevClinits = clinits;
             try {
-                if (frameStack.nonEmpty() && enclosingLambda() != null) {
+                serializableLambdaCounts = new HashMap<String, Integer>();
+                prevClinits = new HashMap<ClassSymbol, Symbol>();
+                if (tree.sym.owner.kind == MTH) {
+                    localClassDefs.put(tree.sym, tree);
+                }
+                if (directlyEnclosingLambda() != null) {
                     tree.sym.owner = owner();
-                    LambdaTranslationContext lambdaContext = (LambdaTranslationContext)contextMap.get(enclosingLambda());
-                    Type encl = lambdaContext.enclosingType();
-                    if (encl.hasTag(NONE)) {
-                        //if the translated lambda body occurs in a static context,
-                        //any class declaration within it must be made static
-                        tree.sym.flags_field |= STATIC;
-                        ((ClassType)tree.sym.type).setEnclosingType(Type.noType);
-                    } else {
-                        //if the translated lambda body is in an instance context
-                        //the enclosing type of any class declaration within it
-                        //must be updated to point to the new enclosing type (if any)
-                        ((ClassType)tree.sym.type).setEnclosingType(encl);
+                    if (tree.sym.hasOuterInstance()) {
+                        //if a class is defined within a lambda, the lambda must capture
+                        //its enclosing instance (if any)
+                        TranslationContext<?> localContext = context();
+                        while (localContext != null) {
+                            if (localContext.tree.getTag() == LAMBDA) {
+                                ((LambdaTranslationContext)localContext)
+                                        .addSymbol(tree.sym.type.getEnclosingType().tsym, CAPTURED_THIS);
+                            }
+                            localContext = localContext.prev;
+                        }
                     }
                 }
                 frameStack = frameStack.prepend(new Frame(tree));
@@ -861,19 +1111,14 @@
             }
             finally {
                 frameStack = prevStack;
-            }
-            if (frameStack.nonEmpty() && enclosingLambda() != null) {
-                // Any class defined within a lambda is an implicit 'this' reference
-                // because its constructor will reference the enclosing class
-                ((LambdaTranslationContext) context()).addSymbol(tree.sym.type.getEnclosingType().tsym, CAPTURED_THIS);
+                serializableLambdaCounts = prevSerializableLambdaCount;
+                clinits = prevClinits;
             }
         }
 
         @Override
         public void visitIdent(JCIdent tree) {
-            if (context() == null || !lambdaIdentSymbolFilter(tree.sym)) {
-                super.visitIdent(tree);
-            } else {
+            if (context() != null && lambdaIdentSymbolFilter(tree.sym)) {
                 if (tree.sym.kind == VAR &&
                         tree.sym.owner.kind == MTH &&
                         tree.type.constValue() == null) {
@@ -882,7 +1127,8 @@
                         if (localContext.tree.getTag() == LAMBDA) {
                             JCTree block = capturedDecl(localContext.depth, tree.sym);
                             if (block == null) break;
-                            ((LambdaTranslationContext)localContext).addSymbol(tree.sym, CAPTURED_VAR);
+                            ((LambdaTranslationContext)localContext)
+                                    .addSymbol(tree.sym, CAPTURED_VAR);
                         }
                         localContext = localContext.prev;
                     }
@@ -895,7 +1141,8 @@
                             switch (block.getTag()) {
                                 case CLASSDEF:
                                     JCClassDecl cdecl = (JCClassDecl)block;
-                                    ((LambdaTranslationContext)localContext).addSymbol(cdecl.sym, CAPTURED_THIS);
+                                    ((LambdaTranslationContext)localContext)
+                                            .addSymbol(cdecl.sym, CAPTURED_THIS);
                                     break;
                                 default:
                                     Assert.error("bad block kind");
@@ -905,6 +1152,7 @@
                     }
                 }
             }
+            super.visitIdent(tree);
         }
 
         @Override
@@ -941,10 +1189,50 @@
         @Override
         public void visitNewClass(JCNewClass tree) {
             if (lambdaNewClassFilter(context(), tree)) {
-                ((LambdaTranslationContext) context()).addSymbol(tree.type.getEnclosingType().tsym, CAPTURED_THIS);
+                TranslationContext<?> localContext = context();
+                while (localContext != null) {
+                    if (localContext.tree.getTag() == LAMBDA) {
+                        ((LambdaTranslationContext)localContext)
+                                .addSymbol(tree.type.getEnclosingType().tsym, CAPTURED_THIS);
+                    }
+                    localContext = localContext.prev;
+                }
+            }
+            if (context() != null && tree.type.tsym.owner.kind == MTH) {
+                LambdaTranslationContext lambdaContext = (LambdaTranslationContext)context();
+                captureLocalClassDefs(tree.type.tsym, lambdaContext);
             }
             super.visitNewClass(tree);
         }
+        //where
+            void captureLocalClassDefs(Symbol csym, final LambdaTranslationContext lambdaContext) {
+                JCClassDecl localCDef = localClassDefs.get(csym);
+                if (localCDef != null && localCDef.pos < lambdaContext.tree.pos) {
+                    BasicFreeVarCollector fvc = lower.new BasicFreeVarCollector() {
+                        @Override
+                        void addFreeVars(ClassSymbol c) {
+                            captureLocalClassDefs(c, lambdaContext);
+                        }
+                        @Override
+                        void visitSymbol(Symbol sym) {
+                            if (sym.kind == VAR &&
+                                    sym.owner.kind == MTH &&
+                                    ((VarSymbol)sym).getConstValue() == null) {
+                                TranslationContext<?> localContext = context();
+                                while (localContext != null) {
+                                    if (localContext.tree.getTag() == LAMBDA) {
+                                        JCTree block = capturedDecl(localContext.depth, sym);
+                                        if (block == null) break;
+                                        ((LambdaTranslationContext)localContext).addSymbol(sym, CAPTURED_VAR);
+                                    }
+                                    localContext = localContext.prev;
+                                }
+                            }
+                        }
+                    };
+                    fvc.scan(localCDef);
+                }
+            }
 
         @Override
         public void visitReference(JCMemberReference tree) {
@@ -972,9 +1260,22 @@
 
         @Override
         public void visitVarDef(JCVariableDecl tree) {
-            if (frameStack.head.tree.hasTag(LAMBDA)) {
-                ((LambdaTranslationContext)context()).addSymbol(tree.sym, LOCAL_VAR);
+            TranslationContext<?> context = context();
+            LambdaTranslationContext ltc = (context != null && context instanceof LambdaTranslationContext)?
+                    (LambdaTranslationContext)context :
+                    null;
+            if (ltc != null) {
+                if (frameStack.head.tree.hasTag(LAMBDA)) {
+                    ltc.addSymbol(tree.sym, LOCAL_VAR);
+                }
+                // Check for type variables (including as type arguments).
+                // If they occur within class nested in a lambda, mark for erasure
+                Type type = tree.sym.asType();
+                if (inClassWithinLambda() && !types.isSameType(types.erasure(type), type)) {
+                    ltc.addSymbol(tree.sym, TYPE_VAR);
+                }
             }
+
             List<Frame> prevStack = frameStack;
             try {
                 if (tree.sym.owner.kind == MTH) {
@@ -989,7 +1290,46 @@
         }
 
         private Name lambdaName() {
-            return names.lambda.append(names.fromString("$" + lambdaCount++));
+            return names.lambda.append(names.fromString("" + lambdaCount++));
+        }
+
+        /**
+         * For a serializable lambda, generate a name which maximizes name
+         * stability across deserialization.
+         * @param owner
+         * @return Name to use for the synthetic lambda method name
+         */
+        private Name serializedLambdaName(Symbol owner) {
+            StringBuilder buf = new StringBuilder();
+            buf.append(names.lambda);
+            // Append the name of the method enclosing the lambda.
+            String methodName = owner.name.toString();
+            if (methodName.equals("<clinit>"))
+                methodName = "static";
+            else if (methodName.equals("<init>"))
+                methodName = "new";
+            buf.append(methodName);
+            buf.append('$');
+            // Append a hash of the enclosing method signature to differentiate
+            // overloaded enclosing methods.  For lambdas enclosed in lambdas,
+            // the generated lambda method will not have type yet, but the
+            // enclosing method's name will have been generated with this same
+            // method, so it will be unique and never be overloaded.
+            if (owner.type != null) {
+                int methTypeHash = methodSig(owner.type).hashCode();
+                buf.append(Integer.toHexString(methTypeHash));
+            }
+            buf.append('$');
+            // The above appended name components may not be unique, append a
+            // count based on the above name components.
+            String temp = buf.toString();
+            Integer count = serializableLambdaCounts.get(temp);
+            if (count == null) {
+                count = 0;
+            }
+            buf.append(count++);
+            serializableLambdaCounts.put(temp, count);
+            return names.fromString(buf.toString());
         }
 
         /**
@@ -997,6 +1337,11 @@
          * (required to skip synthetic lambda symbols)
          */
         private Symbol owner() {
+            return owner(false);
+        }
+
+        @SuppressWarnings("fallthrough")
+        private Symbol owner(boolean skipLambda) {
             List<Frame> frameStack2 = frameStack;
             while (frameStack2.nonEmpty()) {
                 switch (frameStack2.head.tree.getTag()) {
@@ -1006,16 +1351,20 @@
                             break;
                         }
                         JCClassDecl cdecl = (JCClassDecl)frameStack2.tail.head.tree;
-                        return makeSyntheticMethod(((JCVariableDecl)frameStack2.head.tree).sym.flags() & STATIC, names.empty, null, cdecl.sym);
+                        return initSym(cdecl.sym,
+                                ((JCVariableDecl)frameStack2.head.tree).sym.flags() & STATIC);
                     case BLOCK:
                         JCClassDecl cdecl2 = (JCClassDecl)frameStack2.tail.head.tree;
-                        return makeSyntheticMethod(((JCBlock)frameStack2.head.tree).flags & STATIC | Flags.BLOCK, names.empty, null, cdecl2.sym);
+                        return initSym(cdecl2.sym,
+                                ((JCBlock)frameStack2.head.tree).flags & STATIC);
                     case CLASSDEF:
                         return ((JCClassDecl)frameStack2.head.tree).sym;
                     case METHODDEF:
                         return ((JCMethodDecl)frameStack2.head.tree).sym;
                     case LAMBDA:
-                        return ((LambdaTranslationContext)contextMap.get(frameStack2.head.tree)).translatedSym;
+                        if (!skipLambda)
+                            return ((LambdaTranslationContext)contextMap
+                                    .get(frameStack2.head.tree)).translatedSym;
                     default:
                         frameStack2 = frameStack2.tail;
                 }
@@ -1024,7 +1373,33 @@
             return null;
         }
 
-        private JCTree enclosingLambda() {
+        private Symbol initSym(ClassSymbol csym, long flags) {
+            boolean isStatic = (flags & STATIC) != 0;
+            if (isStatic) {
+                //static clinits are generated in Gen - so we need to fake them
+                Symbol clinit = clinits.get(csym);
+                if (clinit == null) {
+                    clinit = makeSyntheticMethod(STATIC,
+                            names.clinit,
+                            new MethodType(List.<Type>nil(), syms.voidType, List.<Type>nil(), syms.methodClass),
+                            csym);
+                    clinits.put(csym, clinit);
+                }
+                return clinit;
+            } else {
+                //get the first constructor and treat it as the instance init sym
+                for (Symbol s : csym.members_field.getElementsByName(names.init)) {
+                    return s;
+                }
+            }
+            Assert.error("init not found");
+            return null;
+        }
+
+        private JCTree directlyEnclosingLambda() {
+            if (frameStack.isEmpty()) {
+                return null;
+            }
             List<Frame> frameStack2 = frameStack;
             while (frameStack2.nonEmpty()) {
                 switch (frameStack2.head.tree.getTag()) {
@@ -1041,6 +1416,28 @@
             return null;
         }
 
+        private boolean inClassWithinLambda() {
+            if (frameStack.isEmpty()) {
+                return false;
+            }
+            List<Frame> frameStack2 = frameStack;
+            boolean classFound = false;
+            while (frameStack2.nonEmpty()) {
+                switch (frameStack2.head.tree.getTag()) {
+                    case LAMBDA:
+                        return classFound;
+                    case CLASSDEF:
+                        classFound = true;
+                        frameStack2 = frameStack2.tail;
+                        break;
+                    default:
+                        frameStack2 = frameStack2.tail;
+                }
+            }
+            // No lambda
+            return false;
+        }
+
         /**
          * Return the declaration corresponding to a symbol in the enclosing
          * scope; the depth parameter is used to filter out symbols defined
@@ -1155,7 +1552,7 @@
          * This class is used to store important information regarding translation of
          * lambda expression/method references (see subclasses).
          */
-        private abstract class TranslationContext<T extends JCTree> {
+        private abstract class TranslationContext<T extends JCFunctionalExpression> {
 
             /** the underlying (untranslated) tree */
             T tree;
@@ -1175,6 +1572,22 @@
                 this.depth = frameStack.size() - 1;
                 this.prev = context();
             }
+
+            /** does this functional expression need to be created using alternate metafactory? */
+            boolean needsAltMetafactory() {
+                return (tree.targets.length() > 1 ||
+                        isSerializable());
+            }
+
+            /** does this functional expression require serialization support? */
+            boolean isSerializable() {
+                for (Symbol target : tree.targets) {
+                    if (types.asSuper(target.type, syms.serializableType.tsym) != null) {
+                        return true;
+                    }
+                }
+                return false;
+            }
         }
 
         /**
@@ -1200,6 +1613,9 @@
             /** map from class symbols to translated synthetic parameters (for captured member access) */
             Map<Symbol, Symbol> capturedThis = new LinkedHashMap<Symbol, Symbol>();
 
+            /** map from original to translated lambda locals */
+            Map<Symbol, Symbol> typeVars = new LinkedHashMap<Symbol, Symbol>();
+
             /** the synthetic symbol for the method hoisting the translated lambda */
             Symbol translatedSym;
 
@@ -1211,40 +1627,58 @@
                 if (frame.tree.hasTag(VARDEF)) {
                     self = ((JCVariableDecl)frame.tree).sym;
                 }
-                this.translatedSym = makeSyntheticMethod(0, lambdaName(), null, owner.enclClass());
+                Name name = isSerializable() ? serializedLambdaName(owner) : lambdaName();
+                this.translatedSym = makeSyntheticMethod(0, name, null, owner.enclClass());
             }
 
             /**
              * Translate a symbol of a given kind into something suitable for the
              * synthetic lambda body
              */
-            Symbol translate(String name, Symbol sym, LambdaSymbolKind skind) {
-                if (skind == CAPTURED_THIS) {
-                    return sym;  // self represented
-                } else {
-                    return makeSyntheticVar(FINAL, name, types.erasure(sym.type), translatedSym);
+            Symbol translate(Name name, final Symbol sym, LambdaSymbolKind skind) {
+                switch (skind) {
+                    case CAPTURED_THIS:
+                        return sym;  // self represented
+                    case TYPE_VAR:
+                        // Just erase the type var
+                        return new VarSymbol(sym.flags(), name,
+                                types.erasure(sym.type), sym.owner);
+                    case CAPTURED_VAR:
+                        return new VarSymbol(SYNTHETIC | FINAL, name, types.erasure(sym.type), translatedSym) {
+                            @Override
+                            public Symbol baseSymbol() {
+                                //keep mapping with original captured symbol
+                                return sym;
+                            }
+                        };
+                    default:
+                        return makeSyntheticVar(FINAL, name, types.erasure(sym.type), translatedSym);
                 }
             }
 
             void addSymbol(Symbol sym, LambdaSymbolKind skind) {
                 Map<Symbol, Symbol> transMap = null;
-                String preferredName;
+                Name preferredName;
                 switch (skind) {
                     case CAPTURED_THIS:
                         transMap = capturedThis;
-                        preferredName = "encl$" + capturedThis.size();
+                        preferredName = names.fromString("encl$" + capturedThis.size());
                         break;
                     case CAPTURED_VAR:
                         transMap = capturedLocals;
-                        preferredName = "cap$" + capturedLocals.size();
+                        preferredName = names.fromString("cap$" + capturedLocals.size());
                         break;
                     case LOCAL_VAR:
                         transMap = lambdaLocals;
-                        preferredName = sym.name.toString();
+                        preferredName = sym.name;
                         break;
                     case PARAM:
                         transMap = lambdaParams;
-                        preferredName = sym.name.toString();
+                        preferredName = sym.name;
+                        break;
+                    case TYPE_VAR:
+                        transMap = typeVars;
+                        preferredName = sym.name;
                         break;
                     default: throw new AssertionError();
                 }
@@ -1269,6 +1703,9 @@
                         case PARAM:
                             translationMap.putAll(lambdaParams);
                             break;
+                        case TYPE_VAR:
+                            translationMap.putAll(typeVars);
+                            break;
                         default: throw new AssertionError();
                     }
                 }
@@ -1291,7 +1728,8 @@
 
                 // If instance access isn't needed, make it static
                 // Interface methods much be public default methods, otherwise make it private
-                translatedSym.flags_field = SYNTHETIC | (needInstance? 0 : STATIC) | (inInterface? PUBLIC | DEFAULT : PRIVATE);
+                translatedSym.flags_field = SYNTHETIC | (needInstance? 0 : STATIC) |
+                        (inInterface? PUBLIC | DEFAULT : PRIVATE);
 
                 //compute synthetic params
                 ListBuffer<JCVariableDecl> params = ListBuffer.lb();
@@ -1308,18 +1746,13 @@
                 syntheticParams = params.toList();
 
                 //prepend synthetic args to translated lambda method signature
-                translatedSym.type = (MethodType) types.createMethodTypeWithParameters(
-                        (MethodType) generatedLambdaSig(),
+                translatedSym.type = types.createMethodTypeWithParameters(
+                        generatedLambdaSig(),
                         TreeInfo.types(syntheticParams));
             }
 
-            Type enclosingType() {
-                //local inner classes defined inside a lambda are always non-static
-                return owner.enclClass().type;
-            }
-
             Type generatedLambdaSig() {
-                return types.erasure(types.findDescriptorType(tree.targetType));
+                return types.erasure(tree.descriptorType);
             }
         }
 
@@ -1362,12 +1795,27 @@
                 return tree.sym.owner == syms.arrayClass;
             }
 
+            boolean isPrivateConstructor() {
+                //hack needed to workaround 292 bug (8005122)
+                //when 292 issue is fixed we should simply remove this
+                return tree.sym.name == names.init &&
+                        (tree.sym.flags() & PRIVATE) != 0;
+            }
+
+            boolean receiverAccessible() {
+                //hack needed to workaround 292 bug (7087658)
+                //when 292 issue is fixed we should remove this and change the backend
+                //code to always generate a method handle to an accessible method
+                return tree.ownerAccessible;
+            }
+
             /**
              * Does this reference needs a bridge (i.e. var args need to be
              * expanded or "super" is used)
              */
             final boolean needsBridge() {
-                return isSuper || needsVarArgsConversion() || isArrayOp();
+                return isSuper || needsVarArgsConversion() || isArrayOp() ||
+                        isPrivateConstructor() || !receiverAccessible();
             }
 
             Type generatedRefSig() {
@@ -1375,7 +1823,7 @@
             }
 
             Type bridgedRefSig() {
-                return types.erasure(types.findDescriptorSymbol(tree.targetType.tsym).type);
+                return types.erasure(types.findDescriptorSymbol(tree.targets.head).type);
             }
         }
     }
@@ -1385,6 +1833,60 @@
         CAPTURED_VAR,
         CAPTURED_THIS,
         LOCAL_VAR,
-        PARAM;
+        PARAM,
+        TYPE_VAR;
+    }
+
+    /**
+     * ****************************************************************
+     * Signature Generation
+     * ****************************************************************
+     */
+
+    private String methodSig(Type type) {
+        L2MSignatureGenerator sg = new L2MSignatureGenerator();
+        sg.assembleSig(type);
+        return sg.toString();
+    }
+
+    private String classSig(Type type) {
+        L2MSignatureGenerator sg = new L2MSignatureGenerator();
+        sg.assembleClassSig(type);
+        return sg.toString();
+    }
+
+    /**
+     * Signature Generation
+     */
+    private class L2MSignatureGenerator extends Types.SignatureGenerator {
+
+        /**
+         * An output buffer for type signatures.
+         */
+        StringBuilder sb = new StringBuilder();
+
+        L2MSignatureGenerator() {
+            super(types);
+        }
+
+        @Override
+        protected void append(char ch) {
+            sb.append(ch);
+        }
+
+        @Override
+        protected void append(byte[] ba) {
+            sb.append(new String(ba));
+        }
+
+        @Override
+        protected void append(Name name) {
+            sb.append(name.toString());
+        }
+
+        @Override
+        public String toString() {
+            return sb.toString();
+        }
     }
 }
--- a/src/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -163,6 +163,12 @@
      */
     JCTree outermostMemberDef;
 
+    /** A map from local variable symbols to their translation (as per LambdaToMethod).
+     * This is required when a capturing local class is created from a lambda (in which
+     * case the captured symbols should be replaced with the translated lambda symbols).
+     */
+    Map<Symbol, Symbol> lambdaTranslationMap = null;
+
     /** A navigator class for assembling a mapping from local class symbols
      *  to class definition trees.
      *  There is only one case; all other cases simply traverse down the tree.
@@ -206,10 +212,51 @@
     Map<ClassSymbol,List<VarSymbol>> freevarCache;
 
     /** A navigator class for collecting the free variables accessed
-     *  from a local class.
-     *  There is only one case; all other cases simply traverse down the tree.
+     *  from a local class. There is only one case; all other cases simply
+     *  traverse down the tree. This class doesn't deal with the specific
+     *  of Lower - it's an abstract visitor that is meant to be reused in
+     *  order to share the local variable capture logic.
      */
-    class FreeVarCollector extends TreeScanner {
+    abstract class BasicFreeVarCollector extends TreeScanner {
+
+        /** Add all free variables of class c to fvs list
+         *  unless they are already there.
+         */
+        abstract void addFreeVars(ClassSymbol c);
+
+        /** If tree refers to a variable in owner of local class, add it to
+         *  free variables list.
+         */
+        public void visitIdent(JCIdent tree) {
+            visitSymbol(tree.sym);
+        }
+        // where
+        abstract void visitSymbol(Symbol _sym);
+
+        /** If tree refers to a class instance creation expression
+         *  add all free variables of the freshly created class.
+         */
+        public void visitNewClass(JCNewClass tree) {
+            ClassSymbol c = (ClassSymbol)tree.constructor.owner;
+            addFreeVars(c);
+            super.visitNewClass(tree);
+        }
+
+        /** If tree refers to a superclass constructor call,
+         *  add all free variables of the superclass.
+         */
+        public void visitApply(JCMethodInvocation tree) {
+            if (TreeInfo.name(tree.meth) == names._super) {
+                addFreeVars((ClassSymbol) TreeInfo.symbol(tree.meth).owner);
+            }
+            super.visitApply(tree);
+        }
+    }
+
+    /**
+     * Lower-specific subclass of {@code BasicFreeVarCollector}.
+     */
+    class FreeVarCollector extends BasicFreeVarCollector {
 
         /** The owner of the local class.
          */
@@ -238,10 +285,8 @@
             fvs = fvs.prepend(v);
         }
 
-        /** Add all free variables of class c to fvs list
-         *  unless they are already there.
-         */
-        private void addFreeVars(ClassSymbol c) {
+        @Override
+        void addFreeVars(ClassSymbol c) {
             List<VarSymbol> fvs = freevarCache.get(c);
             if (fvs != null) {
                 for (List<VarSymbol> l = fvs; l.nonEmpty(); l = l.tail) {
@@ -250,15 +295,8 @@
             }
         }
 
-        /** If tree refers to a variable in owner of local class, add it to
-         *  free variables list.
-         */
-        public void visitIdent(JCIdent tree) {
-            result = tree;
-            visitSymbol(tree.sym);
-        }
-        // where
-        private void visitSymbol(Symbol _sym) {
+        @Override
+        void visitSymbol(Symbol _sym) {
             Symbol sym = _sym;
             if (sym.kind == VAR || sym.kind == MTH) {
                 while (sym != null && sym.owner != owner)
@@ -281,7 +319,6 @@
          */
         public void visitNewClass(JCNewClass tree) {
             ClassSymbol c = (ClassSymbol)tree.constructor.owner;
-            addFreeVars(c);
             if (tree.encl == null &&
                 c.hasOuterInstance() &&
                 outerThisStack.head != null)
@@ -306,7 +343,6 @@
          */
         public void visitApply(JCMethodInvocation tree) {
             if (TreeInfo.name(tree.meth) == names._super) {
-                addFreeVars((ClassSymbol) TreeInfo.symbol(tree.meth).owner);
                 Symbol constructor = TreeInfo.symbol(tree.meth);
                 ClassSymbol c = (ClassSymbol)constructor.owner;
                 if (c.hasOuterInstance() &&
@@ -570,10 +606,19 @@
      *  @param flags    The class symbol's flags
      *  @param owner    The class symbol's owner
      */
-    ClassSymbol makeEmptyClass(long flags, ClassSymbol owner) {
+    JCClassDecl makeEmptyClass(long flags, ClassSymbol owner) {
+        return makeEmptyClass(flags, owner, null, true);
+    }
+
+    JCClassDecl makeEmptyClass(long flags, ClassSymbol owner, Name flatname,
+            boolean addToDefs) {
         // Create class symbol.
         ClassSymbol c = reader.defineClass(names.empty, owner);
-        c.flatname = chk.localClassName(c);
+        if (flatname != null) {
+            c.flatname = flatname;
+        } else {
+            c.flatname = chk.localClassName(c);
+        }
         c.sourcefile = owner.sourcefile;
         c.completer = null;
         c.members_field = new Scope(c);
@@ -597,9 +642,8 @@
         cdef.type = c.type;
 
         // Append class definition tree to owner's definitions.
-        odef.defs = odef.defs.prepend(cdef);
-
-        return c;
+        if (addToDefs) odef.defs = odef.defs.prepend(cdef);
+        return cdef;
     }
 
 /**************************************************************************
@@ -706,7 +750,7 @@
      * and synthethise a class (with makeEmptyClass) if one is not available.
      * However, there is a small possibility that an existing class will not
      * be generated as expected if it is inside a conditional with a constant
-     * expression. If that is found to be the case, create an empty class here.
+     * expression. If that is found to be the case, create an empty class tree here.
      */
     private void checkAccessConstructorTags() {
         for (List<ClassSymbol> l = accessConstrTags; l.nonEmpty(); l = l.tail) {
@@ -714,14 +758,10 @@
             if (isTranslatedClassAvailable(c))
                 continue;
             // Create class definition tree.
-            JCClassDecl cdef = make.ClassDef(
-                make.Modifiers(STATIC | SYNTHETIC), names.empty,
-                List.<JCTypeParameter>nil(),
-                null, List.<JCExpression>nil(), List.<JCTree>nil());
-            cdef.sym = c;
-            cdef.type = c.type;
-            // add it to the list of classes to be generated
-            translated.append(cdef);
+            JCClassDecl cdec = makeEmptyClass(STATIC | SYNTHETIC,
+                    c.outermostClass(), c.flatname, false);
+            swapAccessConstructorTag(c, cdec.sym);
+            translated.append(cdec);
         }
     }
     // where
@@ -735,6 +775,19 @@
         return false;
     }
 
+    void swapAccessConstructorTag(ClassSymbol oldCTag, ClassSymbol newCTag) {
+        for (MethodSymbol methodSymbol : accessConstrs.values()) {
+            Assert.check(methodSymbol.type.hasTag(METHOD));
+            MethodType oldMethodType =
+                    (MethodType)methodSymbol.type;
+            if (oldMethodType.argtypes.head.tsym == oldCTag)
+                methodSymbol.type =
+                    types.createMethodTypeWithParameters(oldMethodType,
+                        oldMethodType.getParameterTypes().tail
+                            .prepend(newCTag.erasure(types)));
+        }
+    }
+
 /**************************************************************************
  * Access methods
  *************************************************************************/
@@ -1154,6 +1207,14 @@
                             accessBase(tree.pos(), sym), sym).setType(tree.type);
                     }
                 }
+            } else if (sym.owner.kind == MTH && lambdaTranslationMap != null) {
+                //sym is a local variable - check the lambda translation map to
+                //see if sym has been translated to something else in the current
+                //scope (by LambdaToMethod)
+                Symbol translatedSym = lambdaTranslationMap.get(sym);
+                if (translatedSym != null) {
+                    tree = make.at(tree.pos).Ident(translatedSym);
+                }
             }
         }
         return tree;
@@ -1211,7 +1272,7 @@
                                          "1");
         ClassSymbol ctag = chk.compiled.get(flatname);
         if (ctag == null)
-            ctag = makeEmptyClass(STATIC | SYNTHETIC, topClass);
+            ctag = makeEmptyClass(STATIC | SYNTHETIC, topClass).sym;
         // keep a record of all tags, to verify that all are generated as required
         accessConstrTags = accessConstrTags.prepend(ctag);
         return ctag;
@@ -1428,22 +1489,49 @@
         return result;
     }
 
+    private VarSymbol makeOuterThisVarSymbol(Symbol owner, long flags) {
+        if (owner.kind == TYP &&
+            target.usePrivateSyntheticFields())
+            flags |= PRIVATE;
+        Type target = types.erasure(owner.enclClass().type.getEnclosingType());
+        VarSymbol outerThis =
+            new VarSymbol(flags, outerThisName(target, owner), target, owner);
+        outerThisStack = outerThisStack.prepend(outerThis);
+        return outerThis;
+    }
+
+    private JCVariableDecl makeOuterThisVarDecl(int pos, VarSymbol sym) {
+        JCVariableDecl vd = make.at(pos).VarDef(sym, null);
+        vd.vartype = access(vd.vartype);
+        return vd;
+    }
+
+    /** Definition for this$n field.
+     *  @param pos        The source code position of the definition.
+     *  @param owner      The method in which the definition goes.
+     */
+    JCVariableDecl outerThisDef(int pos, MethodSymbol owner) {
+        ClassSymbol c = owner.enclClass();
+        boolean isMandated =
+            // Anonymous constructors
+            (owner.isConstructor() && owner.isAnonymous()) ||
+            // Constructors of non-private inner member classes
+            (owner.isConstructor() && c.isInner() &&
+             !c.isPrivate() && !c.isStatic());
+        long flags =
+            FINAL | (isMandated ? MANDATED : SYNTHETIC);
+        VarSymbol outerThis = makeOuterThisVarSymbol(owner, flags);
+        owner.extraParams = owner.extraParams.prepend(outerThis);
+        return makeOuterThisVarDecl(pos, outerThis);
+    }
+
     /** Definition for this$n field.
      *  @param pos        The source code position of the definition.
      *  @param owner      The class in which the definition goes.
      */
-    JCVariableDecl outerThisDef(int pos, Symbol owner) {
-        long flags = FINAL | SYNTHETIC;
-        if (owner.kind == TYP &&
-            target.usePrivateSyntheticFields())
-            flags |= PRIVATE;
-        Type target = types.erasure(owner.enclClass().type.getEnclosingType());
-        VarSymbol outerThis = new VarSymbol(
-            flags, outerThisName(target, owner), target, owner);
-        outerThisStack = outerThisStack.prepend(outerThis);
-        JCVariableDecl vd = make.at(pos).VarDef(outerThis, null);
-        vd.vartype = access(vd.vartype);
-        return vd;
+    JCVariableDecl outerThisDef(int pos, ClassSymbol owner) {
+        VarSymbol outerThis = makeOuterThisVarSymbol(owner, FINAL | SYNTHETIC);
+        return makeOuterThisVarDecl(pos, outerThis);
     }
 
     /** Return a list of trees that load the free variables in given list,
@@ -1778,7 +1866,7 @@
             if (e.sym.kind == TYP &&
                 e.sym.name == names.empty &&
                 (e.sym.flags() & INTERFACE) == 0) return (ClassSymbol) e.sym;
-        return makeEmptyClass(STATIC | SYNTHETIC, clazz);
+        return makeEmptyClass(STATIC | SYNTHETIC, clazz).sym;
     }
 
     /** Return symbol for "class$" method. If there is no method definition
@@ -2288,7 +2376,7 @@
                 return tree.packageAnnotations.nonEmpty();
             case NONEMPTY:
                 for (Attribute.Compound a :
-                         tree.packge.annotations.getAttributes()) {
+                         tree.packge.annotations.getDeclarationAttributes()) {
                     Attribute.RetentionPolicy p = types.getRetention(a);
                     if (p != Attribute.RetentionPolicy.SOURCE)
                         return true;
@@ -2516,11 +2604,6 @@
 
         enumDefs.appendList(otherDefs.toList());
         tree.defs = enumDefs.toList();
-
-        // Add the necessary members for the EnumCompatibleMode
-        if (target.compilerBootstrap(tree.sym)) {
-            addEnumCompatibleMembers(tree);
-        }
     }
         // where
         private MethodSymbol systemArraycopyMethod;
@@ -2551,7 +2634,6 @@
                                        "enum" + target.syntheticNameChar() + "name"),
                       syms.stringType, tree.sym);
             nameParam.mods.flags |= SYNTHETIC; nameParam.sym.flags_field |= SYNTHETIC;
-
             JCVariableDecl ordParam = make.
                 Param(names.fromString(target.syntheticNameChar() +
                                        "enum" + target.syntheticNameChar() +
@@ -2562,36 +2644,14 @@
             tree.params = tree.params.prepend(ordParam).prepend(nameParam);
 
             MethodSymbol m = tree.sym;
+            m.extraParams = m.extraParams.prepend(ordParam.sym);
+            m.extraParams = m.extraParams.prepend(nameParam.sym);
             Type olderasure = m.erasure(types);
             m.erasure_field = new MethodType(
                 olderasure.getParameterTypes().prepend(syms.intType).prepend(syms.stringType),
                 olderasure.getReturnType(),
                 olderasure.getThrownTypes(),
                 syms.methodClass);
-
-            if (target.compilerBootstrap(m.owner)) {
-                // Initialize synthetic name field
-                Symbol nameVarSym = lookupSynthetic(names.fromString("$name"),
-                                                    tree.sym.owner.members());
-                JCIdent nameIdent = make.Ident(nameParam.sym);
-                JCIdent id1 = make.Ident(nameVarSym);
-                JCAssign newAssign = make.Assign(id1, nameIdent);
-                newAssign.type = id1.type;
-                JCExpressionStatement nameAssign = make.Exec(newAssign);
-                nameAssign.type = id1.type;
-                tree.body.stats = tree.body.stats.prepend(nameAssign);
-
-                // Initialize synthetic ordinal field
-                Symbol ordinalVarSym = lookupSynthetic(names.fromString("$ordinal"),
-                                                       tree.sym.owner.members());
-                JCIdent ordIdent = make.Ident(ordParam.sym);
-                id1 = make.Ident(ordinalVarSym);
-                newAssign = make.Assign(id1, ordIdent);
-                newAssign.type = id1.type;
-                JCExpressionStatement ordinalAssign = make.Exec(newAssign);
-                ordinalAssign.type = id1.type;
-                tree.body.stats = tree.body.stats.prepend(ordinalAssign);
-            }
         }
 
         JCMethodDecl prevMethodDef = currentMethodDef;
@@ -2680,10 +2740,37 @@
 
             outerThisStack = prevOuterThisStack;
         } else {
-            super.visitMethodDef(tree);
+            Map<Symbol, Symbol> prevLambdaTranslationMap =
+                    lambdaTranslationMap;
+            try {
+                lambdaTranslationMap = (tree.sym.flags() & SYNTHETIC) != 0 &&
+                        tree.sym.name.startsWith(names.lambda) ?
+                        makeTranslationMap(tree) : null;
+                super.visitMethodDef(tree);
+            } finally {
+                lambdaTranslationMap = prevLambdaTranslationMap;
+            }
         }
         result = tree;
     }
+    //where
+        private Map<Symbol, Symbol> makeTranslationMap(JCMethodDecl tree) {
+            Map<Symbol, Symbol> translationMap = new HashMap<Symbol,Symbol>();
+            for (JCVariableDecl vd : tree.params) {
+                Symbol p = vd.sym;
+                if (p != p.baseSymbol()) {
+                    translationMap.put(p.baseSymbol(), p);
+                }
+            }
+            return translationMap;
+        }
+
+    public void visitAnnotatedType(JCAnnotatedType tree) {
+        // No need to retain type annotations any longer.
+        // tree.annotations = translate(tree.annotations);
+        tree.underlyingType = translate(tree.underlyingType);
+        result = tree.underlyingType;
+    }
 
     public void visitTypeCast(JCTypeCast tree) {
         tree.clazz = translate(tree.clazz);
@@ -3042,8 +3129,11 @@
     }
 
     public void visitAssignop(final JCAssignOp tree) {
-        if (!tree.lhs.type.isPrimitive() &&
-            tree.operator.type.getReturnType().isPrimitive()) {
+        JCTree lhsAccess = access(TreeInfo.skipParens(tree.lhs));
+        final boolean boxingReq = !tree.lhs.type.isPrimitive() &&
+            tree.operator.type.getReturnType().isPrimitive();
+
+        if (boxingReq || lhsAccess.hasTag(APPLY)) {
             // boxing required; need to rewrite as x = (unbox typeof x)(x op y);
             // or if x == (typeof x)z then z = (unbox typeof x)((typeof x)z op y)
             // (but without recomputing x)
@@ -3065,8 +3155,9 @@
                         JCBinary opResult = make.Binary(newTag, expr, tree.rhs);
                         opResult.operator = newOperator;
                         opResult.type = newOperator.type.getReturnType();
-                        JCTypeCast newRhs = make.TypeCast(types.unboxedType(tree.type),
-                                                          opResult);
+                        JCExpression newRhs = boxingReq ?
+                            make.TypeCast(types.unboxedType(tree.type), opResult) :
+                            opResult;
                         return make.Assign((JCExpression)lhs, newRhs).setType(tree.type);
                     }
                 });
@@ -3314,14 +3405,16 @@
                 tree.expr = make.TypeCast(types.erasure(iterableType), tree.expr);
             Symbol iterator = lookupMethod(tree.expr.pos(),
                                            names.iterator,
-                                           types.erasure(syms.iterableType),
+                                           eType,
                                            List.<Type>nil());
             VarSymbol itvar = new VarSymbol(0, names.fromString("i" + target.syntheticNameChar()),
                                             types.erasure(iterator.type.getReturnType()),
                                             currentMethodSym);
-            JCStatement init = make.
-                VarDef(itvar,
-                       make.App(make.Select(tree.expr, iterator)));
+
+             JCStatement init = make.
+                VarDef(itvar, make.App(make.Select(tree.expr, iterator)
+                     .setType(types.erasure(iterator.type))));
+
             Symbol hasNext = lookupMethod(tree.expr.pos(),
                                           names.hasNext,
                                           itvar.type,
@@ -3687,8 +3780,16 @@
 
     @Override
     public void visitTry(JCTry tree) {
+        /* special case of try without catchers and with finally emtpy.
+         * Don't give it a try, translate only the body.
+         */
         if (tree.resources.isEmpty()) {
-            super.visitTry(tree);
+            if (tree.catchers.isEmpty() &&
+                tree.finalizer.getStatements().isEmpty()) {
+                result = translate(tree.body);
+            } else {
+                super.visitTry(tree);
+            }
         } else {
             result = makeTwrTry(tree);
         }
@@ -3758,168 +3859,4 @@
         }
         return translated.toList();
     }
-
-    //////////////////////////////////////////////////////////////
-    // The following contributed by Borland for bootstrapping purposes
-    //////////////////////////////////////////////////////////////
-    private void addEnumCompatibleMembers(JCClassDecl cdef) {
-        make_at(null);
-
-        // Add the special enum fields
-        VarSymbol ordinalFieldSym = addEnumOrdinalField(cdef);
-        VarSymbol nameFieldSym = addEnumNameField(cdef);
-
-        // Add the accessor methods for name and ordinal
-        MethodSymbol ordinalMethodSym = addEnumFieldOrdinalMethod(cdef, ordinalFieldSym);
-        MethodSymbol nameMethodSym = addEnumFieldNameMethod(cdef, nameFieldSym);
-
-        // Add the toString method
-        addEnumToString(cdef, nameFieldSym);
-
-        // Add the compareTo method
-        addEnumCompareTo(cdef, ordinalFieldSym);
-    }
-
-    private VarSymbol addEnumOrdinalField(JCClassDecl cdef) {
-        VarSymbol ordinal = new VarSymbol(PRIVATE|FINAL|SYNTHETIC,
-                                          names.fromString("$ordinal"),
-                                          syms.intType,
-                                          cdef.sym);
-        cdef.sym.members().enter(ordinal);
-        cdef.defs = cdef.defs.prepend(make.VarDef(ordinal, null));
-        return ordinal;
-    }
-
-    private VarSymbol addEnumNameField(JCClassDecl cdef) {
-        VarSymbol name = new VarSymbol(PRIVATE|FINAL|SYNTHETIC,
-                                          names.fromString("$name"),
-                                          syms.stringType,
-                                          cdef.sym);
-        cdef.sym.members().enter(name);
-        cdef.defs = cdef.defs.prepend(make.VarDef(name, null));
-        return name;
-    }
-
-    private MethodSymbol addEnumFieldOrdinalMethod(JCClassDecl cdef, VarSymbol ordinalSymbol) {
-        // Add the accessor methods for ordinal
-        Symbol ordinalSym = lookupMethod(cdef.pos(),
-                                         names.ordinal,
-                                         cdef.type,
-                                         List.<Type>nil());
-
-        Assert.check(ordinalSym instanceof MethodSymbol);
-
-        JCStatement ret = make.Return(make.Ident(ordinalSymbol));
-        cdef.defs = cdef.defs.append(make.MethodDef((MethodSymbol)ordinalSym,
-                                                    make.Block(0L, List.of(ret))));
-
-        return (MethodSymbol)ordinalSym;
-    }
-
-    private MethodSymbol addEnumFieldNameMethod(JCClassDecl cdef, VarSymbol nameSymbol) {
-        // Add the accessor methods for name
-        Symbol nameSym = lookupMethod(cdef.pos(),
-                                   names._name,
-                                   cdef.type,
-                                   List.<Type>nil());
-
-        Assert.check(nameSym instanceof MethodSymbol);
-
-        JCStatement ret = make.Return(make.Ident(nameSymbol));
-
-        cdef.defs = cdef.defs.append(make.MethodDef((MethodSymbol)nameSym,
-                                                    make.Block(0L, List.of(ret))));
-
-        return (MethodSymbol)nameSym;
-    }
-
-    private MethodSymbol addEnumToString(JCClassDecl cdef,
-                                         VarSymbol nameSymbol) {
-        Symbol toStringSym = lookupMethod(cdef.pos(),
-                                          names.toString,
-                                          cdef.type,
-                                          List.<Type>nil());
-
-        JCTree toStringDecl = null;
-        if (toStringSym != null)
-            toStringDecl = TreeInfo.declarationFor(toStringSym, cdef);
-
-        if (toStringDecl != null)
-            return (MethodSymbol)toStringSym;
-
-        JCStatement ret = make.Return(make.Ident(nameSymbol));
-
-        JCTree resTypeTree = make.Type(syms.stringType);
-
-        MethodType toStringType = new MethodType(List.<Type>nil(),
-                                                 syms.stringType,
-                                                 List.<Type>nil(),
-                                                 cdef.sym);
-        toStringSym = new MethodSymbol(PUBLIC,
-                                       names.toString,
-                                       toStringType,
-                                       cdef.type.tsym);
-        toStringDecl = make.MethodDef((MethodSymbol)toStringSym,
-                                      make.Block(0L, List.of(ret)));
-
-        cdef.defs = cdef.defs.prepend(toStringDecl);
-        cdef.sym.members().enter(toStringSym);
-
-        return (MethodSymbol)toStringSym;
-    }
-
-    private MethodSymbol addEnumCompareTo(JCClassDecl cdef, VarSymbol ordinalSymbol) {
-        Symbol compareToSym = lookupMethod(cdef.pos(),
-                                   names.compareTo,
-                                   cdef.type,
-                                   List.of(cdef.sym.type));
-
-        Assert.check(compareToSym instanceof MethodSymbol);
-
-        JCMethodDecl compareToDecl = (JCMethodDecl) TreeInfo.declarationFor(compareToSym, cdef);
-
-        ListBuffer<JCStatement> blockStatements = new ListBuffer<JCStatement>();
-
-        JCModifiers mod1 = make.Modifiers(0L);
-        Name oName = names.fromString("o");
-        JCVariableDecl par1 = make.Param(oName, cdef.type, compareToSym);
-
-        JCIdent paramId1 = make.Ident(names.java_lang_Object);
-        paramId1.type = cdef.type;
-        paramId1.sym = par1.sym;
-
-        ((MethodSymbol)compareToSym).params = List.of(par1.sym);
-
-        JCIdent par1UsageId = make.Ident(par1.sym);
-        JCIdent castTargetIdent = make.Ident(cdef.sym);
-        JCTypeCast cast = make.TypeCast(castTargetIdent, par1UsageId);
-        cast.setType(castTargetIdent.type);
-
-        Name otherName = names.fromString("other");
-
-        VarSymbol otherVarSym = new VarSymbol(mod1.flags,
-                                              otherName,
-                                              cdef.type,
-                                              compareToSym);
-        JCVariableDecl otherVar = make.VarDef(otherVarSym, cast);
-        blockStatements.append(otherVar);
-
-        JCIdent id1 = make.Ident(ordinalSymbol);
-
-        JCIdent fLocUsageId = make.Ident(otherVarSym);
-        JCExpression sel = make.Select(fLocUsageId, ordinalSymbol);
-        JCBinary bin = makeBinary(MINUS, id1, sel);
-        JCReturn ret = make.Return(bin);
-        blockStatements.append(ret);
-        JCMethodDecl compareToMethod = make.MethodDef((MethodSymbol)compareToSym,
-                                                   make.Block(0L,
-                                                              blockStatements.toList()));
-        compareToMethod.params = List.of(par1);
-        cdef.defs = cdef.defs.append(compareToMethod);
-
-        return (MethodSymbol)compareToSym;
-    }
-    //////////////////////////////////////////////////////////////
-    // The above contributed by Borland for bootstrapping purposes
-    //////////////////////////////////////////////////////////////
 }
--- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -25,15 +25,19 @@
 
 package com.sun.tools.javac.comp;
 
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.Set;
+
+import javax.lang.model.type.TypeKind;
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.util.List;
 
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Symbol.*;
@@ -345,12 +349,15 @@
      *  @param params      The method's value parameters.
      *  @param res             The method's result type,
      *                 null if it is a constructor.
+     *  @param recvparam       The method's receiver parameter,
+     *                 null if none given; TODO: or already set here?
      *  @param thrown      The method's thrown exceptions.
      *  @param env             The method's (local) environment.
      */
     Type signature(List<JCTypeParameter> typarams,
                    List<JCVariableDecl> params,
                    JCTree res,
+                   JCVariableDecl recvparam,
                    List<JCExpression> thrown,
                    Env<AttrContext> env) {
 
@@ -368,6 +375,15 @@
         // Attribute result type, if one is given.
         Type restype = res == null ? syms.voidType : attr.attribType(res, env);
 
+        // Attribute receiver type, if one is given.
+        Type recvtype;
+        if (recvparam!=null) {
+            memberEnter(recvparam, env);
+            recvtype = recvparam.vartype.type;
+        } else {
+            recvtype = null;
+        }
+
         // Attribute thrown exceptions.
         ListBuffer<Type> thrownbuf = new ListBuffer<Type>();
         for (List<JCExpression> l = thrown; l.nonEmpty(); l = l.tail) {
@@ -376,10 +392,12 @@
                 exc = chk.checkClassType(l.head.pos(), exc);
             thrownbuf.append(exc);
         }
-        Type mtype = new MethodType(argbuf.toList(),
+        MethodType mtype = new MethodType(argbuf.toList(),
                                     restype,
                                     thrownbuf.toList(),
                                     syms.methodClass);
+        mtype.recvtype = recvtype;
+
         return tvars.isEmpty() ? mtype : new ForAll(tvars, mtype);
     }
 
@@ -447,51 +465,14 @@
                       names.valueOf,
                       make.Type(tree.sym.type),
                       List.<JCTypeParameter>nil(),
-                      List.of(make.VarDef(make.Modifiers(Flags.PARAMETER),
+                      List.of(make.VarDef(make.Modifiers(Flags.PARAMETER |
+                                                         Flags.MANDATED),
                                             names.fromString("name"),
                                             make.Type(syms.stringType), null)),
                       List.<JCExpression>nil(), // thrown
                       null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
                       null);
         memberEnter(valueOf, env);
-
-        // the remaining members are for bootstrapping only
-        if (!target.compilerBootstrap(tree.sym)) return;
-
-        // public final int ordinal() { return ???; }
-        JCMethodDecl ordinal = make.at(tree.pos).
-            MethodDef(make.Modifiers(Flags.PUBLIC|Flags.FINAL),
-                      names.ordinal,
-                      make.Type(syms.intType),
-                      List.<JCTypeParameter>nil(),
-                      List.<JCVariableDecl>nil(),
-                      List.<JCExpression>nil(),
-                      null,
-                      null);
-        memberEnter(ordinal, env);
-
-        // public final String name() { return ???; }
-        JCMethodDecl name = make.
-            MethodDef(make.Modifiers(Flags.PUBLIC|Flags.FINAL),
-                      names._name,
-                      make.Type(syms.stringType),
-                      List.<JCTypeParameter>nil(),
-                      List.<JCVariableDecl>nil(),
-                      List.<JCExpression>nil(),
-                      null,
-                      null);
-        memberEnter(name, env);
-
-        // public int compareTo(E other) { return ???; }
-        MethodSymbol compareTo = new
-            MethodSymbol(Flags.PUBLIC,
-                         names.compareTo,
-                         new MethodType(List.of(tree.sym.type),
-                                        syms.intType,
-                                        List.<Type>nil(),
-                                        syms.methodClass),
-                         tree.sym);
-        memberEnter(make.MethodDef(compareTo, null), env);
     }
 
     public void visitTopLevel(JCCompilationUnit tree) {
@@ -573,7 +554,8 @@
         try {
             // Compute the method type
             m.type = signature(tree.typarams, tree.params,
-                               tree.restype, tree.thrown,
+                               tree.restype, tree.recvparam,
+                               tree.thrown,
                                localEnv);
         } finally {
             chk.setDeferredLintHandler(prevLintHandler);
@@ -597,6 +579,10 @@
             enclScope.enter(m);
         }
         annotateLater(tree.mods.annotations, localEnv, m);
+        // Visit the signature of the method. Note that
+        // TypeAnnotate doesn't descend into the body.
+        typeAnnotate(tree, localEnv, m);
+
         if (tree.defaultValue != null)
             annotateDefaultValueLater(tree.defaultValue, localEnv, m);
     }
@@ -642,7 +628,7 @@
             //(a plain array type) with the more precise VarargsType --- we need
             //to do it this way because varargs is represented in the tree as a modifier
             //on the parameter declaration, and not as a distinct type of array node.
-            ArrayType atype = (ArrayType)tree.vartype.type;
+            ArrayType atype = (ArrayType)tree.vartype.type.unannotatedType();
             tree.vartype.type = atype.makeVarargs();
         }
         Scope enclScope = enter.enterScope(env);
@@ -665,6 +651,8 @@
             enclScope.enter(v);
         }
         annotateLater(tree.mods.annotations, localEnv, v);
+        typeAnnotate(tree.vartype, env, tree.sym);
+        annotate.flush();
         v.pos = tree.pos;
     }
 
@@ -759,7 +747,7 @@
                             log.error(annotations.head.pos,
                                       "already.annotated",
                                       kindName(s), s);
-                        enterAnnotations(annotations, localEnv, s);
+                        actualEnterAnnotations(annotations, localEnv, s);
                     } finally {
                         log.useSource(prev);
                     }
@@ -781,7 +769,7 @@
     }
 
     /** Enter a set of annotations. */
-    private void enterAnnotations(List<JCAnnotation> annotations,
+    private void actualEnterAnnotations(List<JCAnnotation> annotations,
                           Env<AttrContext> env,
                           Symbol s) {
         Map<TypeSymbol, ListBuffer<Attribute.Compound>> annotated =
@@ -817,11 +805,11 @@
                 && s.owner.kind != MTH
                 && types.isSameType(c.type, syms.deprecatedType)) {
                 s.flags_field |= Flags.DEPRECATED;
-        }
+            }
         }
 
-        s.annotations.setAttributesWithCompletion(
-                annotate.new AnnotateRepeatedContext(env, annotated, pos, log));
+        s.annotations.setDeclarationAttributesWithCompletion(
+                annotate.new AnnotateRepeatedContext<Attribute.Compound>(env, annotated, pos, log, false));
     }
 
     /** Queue processing of an attribute default value. */
@@ -900,11 +888,17 @@
             // create an environment for evaluating the base clauses
             Env<AttrContext> baseEnv = baseEnv(tree, env);
 
+            if (tree.extending != null)
+                typeAnnotate(tree.extending, baseEnv, sym);
+            for (JCExpression impl : tree.implementing)
+                typeAnnotate(impl, baseEnv, sym);
+            annotate.flush();
+
             // Determine supertype.
             Type supertype =
                 (tree.extending != null)
                 ? attr.attribBase(tree.extending, baseEnv, true, false, true)
-                : ((tree.mods.flags & Flags.ENUM) != 0 && !target.compilerBootstrap(c))
+                : ((tree.mods.flags & Flags.ENUM) != 0)
                 ? attr.attribBase(enumBase(tree.pos, c), baseEnv,
                                   true, false, false)
                 : (c.fullname == names.java_lang_Object)
@@ -917,16 +911,6 @@
             ListBuffer<Type> all_interfaces = null; // lazy init
             Set<Type> interfaceSet = new HashSet<Type>();
             List<JCExpression> interfaceTrees = tree.implementing;
-            if ((tree.mods.flags & Flags.ENUM) != 0 && target.compilerBootstrap(c)) {
-                // add interface Comparable<T>
-                interfaceTrees =
-                    interfaceTrees.prepend(make.Type(new ClassType(syms.comparableType.getEnclosingType(),
-                                                                   List.of(c.type),
-                                                                   syms.comparableType.tsym)));
-                // add interface Serializable
-                interfaceTrees =
-                    interfaceTrees.prepend(make.Type(syms.serializableType));
-            }
             for (JCExpression iface : interfaceTrees) {
                 Type i = attr.attribBase(iface, baseEnv, false, true, true);
                 if (i.hasTag(CLASS)) {
@@ -969,10 +953,15 @@
             if (hasDeprecatedAnnotation(tree.mods.annotations))
                 c.flags_field |= DEPRECATED;
             annotateLater(tree.mods.annotations, baseEnv, c);
+            // class type parameters use baseEnv but everything uses env
 
             chk.checkNonCyclicDecl(tree);
 
             attr.attribTypeVariables(tree.typarams, baseEnv);
+            // Do this here, where we have the symbol.
+            for (JCTypeParameter tp : tree.typarams)
+                typeAnnotate(tp, baseEnv, sym);
+            annotate.flush();
 
             // Add default constructor if needed.
             if ((c.flags() & INTERFACE) == 0 &&
@@ -1050,12 +1039,120 @@
             } finally {
                 isFirst = true;
             }
+        }
+        annotate.afterRepeated(TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree));
+    }
 
-            // commit pending annotations
-            annotate.flush();
+    private void actualEnterTypeAnnotations(final List<JCAnnotation> annotations,
+            final Env<AttrContext> env,
+            final Symbol s) {
+        Map<TypeSymbol, ListBuffer<Attribute.TypeCompound>> annotated =
+                new LinkedHashMap<TypeSymbol, ListBuffer<Attribute.TypeCompound>>();
+        Map<Attribute.TypeCompound, DiagnosticPosition> pos =
+                new HashMap<Attribute.TypeCompound, DiagnosticPosition>();
+
+        for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
+            JCAnnotation a = al.head;
+            Attribute.TypeCompound tc = annotate.enterTypeAnnotation(a,
+                    syms.annotationType,
+                    env);
+            if (tc == null) {
+                continue;
+            }
+
+            if (annotated.containsKey(a.type.tsym)) {
+                if (source.allowRepeatedAnnotations()) {
+                    ListBuffer<Attribute.TypeCompound> l = annotated.get(a.type.tsym);
+                    l = l.append(tc);
+                    annotated.put(a.type.tsym, l);
+                    pos.put(tc, a.pos());
+                } else {
+                    log.error(a.pos(), "duplicate.annotation");
+                }
+            } else {
+                annotated.put(a.type.tsym, ListBuffer.of(tc));
+                pos.put(tc, a.pos());
+            }
+        }
+
+        s.annotations.appendTypeAttributesWithCompletion(
+                annotate.new AnnotateRepeatedContext<Attribute.TypeCompound>(env, annotated, pos, log, true));
+    }
+
+    public void typeAnnotate(final JCTree tree, final Env<AttrContext> env, final Symbol sym) {
+        tree.accept(new TypeAnnotate(env, sym));
+    }
+
+    /**
+     * We need to use a TreeScanner, because it is not enough to visit the top-level
+     * annotations. We also need to visit type arguments, etc.
+     */
+    private class TypeAnnotate extends TreeScanner {
+        private Env<AttrContext> env;
+        private Symbol sym;
+
+        public TypeAnnotate(final Env<AttrContext> env, final Symbol sym) {
+            this.env = env;
+            this.sym = sym;
+        }
+
+        void annotateTypeLater(final List<JCAnnotation> annotations) {
+            if (annotations.isEmpty()) {
+                return;
+            }
+
+            annotate.normal(new Annotate.Annotator() {
+                @Override
+                public String toString() {
+                    return "type annotate " + annotations + " onto " + sym + " in " + sym.owner;
+                }
+                @Override
+                public void enterAnnotation() {
+                    JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
+                    try {
+                        actualEnterTypeAnnotations(annotations, env, sym);
+                    } finally {
+                        log.useSource(prev);
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void visitAnnotatedType(final JCAnnotatedType tree) {
+            annotateTypeLater(tree.annotations);
+            super.visitAnnotatedType(tree);
+        }
+
+        @Override
+        public void visitTypeParameter(final JCTypeParameter tree) {
+            annotateTypeLater(tree.annotations);
+            super.visitTypeParameter(tree);
+        }
+
+        @Override
+        public void visitNewArray(final JCNewArray tree) {
+            annotateTypeLater(tree.annotations);
+            for (List<JCAnnotation> dimAnnos : tree.dimAnnotations)
+                annotateTypeLater(dimAnnos);
+            super.visitNewArray(tree);
+        }
+
+        @Override
+        public void visitMethodDef(final JCMethodDecl tree) {
+            scan(tree.mods);
+            scan(tree.restype);
+            scan(tree.typarams);
+            scan(tree.recvparam);
+            scan(tree.params);
+            scan(tree.thrown);
+            scan(tree.defaultValue);
+            // Do not annotate the body, just the signature.
+            // scan(tree.body);
         }
     }
 
+
     private Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
         Scope baseScope = new Scope(tree.sym);
         //import already entered local classes into base scope
@@ -1256,8 +1353,7 @@
         if (c.type != syms.objectType)
             stats = stats.prepend(SuperCall(make, typarams, params, based));
         if ((c.flags() & ENUM) != 0 &&
-            (types.supertype(c.type).tsym == syms.enumSym ||
-             target.compilerBootstrap(c))) {
+            (types.supertype(c.type).tsym == syms.enumSym)) {
             // constructors of true enums are private
             flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR;
         } else
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -35,12 +35,13 @@
 import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
 import com.sun.tools.javac.comp.DeferredAttr.DeferredType;
 import com.sun.tools.javac.comp.Infer.InferenceContext;
-import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
+import com.sun.tools.javac.comp.Infer.FreeTypeListener;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionContext.Candidate;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.tree.JCTree.JCMemberReference.ReferenceKind;
+import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -54,7 +55,6 @@
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
-import java.util.Set;
 
 import javax.lang.model.element.ElementVisitor;
 
@@ -92,6 +92,7 @@
     public final boolean varargsEnabled; // = source.allowVarargs();
     public final boolean allowMethodHandles;
     public final boolean allowDefaultMethods;
+    public final boolean allowStructuralMostSpecific;
     private final boolean debugResolve;
     final EnumSet<VerboseResolutionMode> verboseResolutionMode;
 
@@ -127,6 +128,7 @@
         Target target = Target.instance(context);
         allowMethodHandles = target.hasMethodHandles();
         allowDefaultMethods = source.allowDefaultMethods();
+        allowStructuralMostSpecific = source.allowStructuralMostSpecific();
         polymorphicSignatureScope = new Scope(syms.noSymbol);
 
         inapplicableMethodException = new InapplicableMethodException(diags);
@@ -506,6 +508,7 @@
                         List<Type> typeargtypes,
                         boolean allowBoxing,
                         boolean useVarargs,
+                        MethodCheck methodCheck,
                         Warner warn) throws Infer.InferenceException {
 
         Type mt = types.memberType(site, m);
@@ -558,10 +561,11 @@
                                     allowBoxing,
                                     useVarargs,
                                     currentResolutionContext,
+                                    methodCheck,
                                     warn);
 
-        checkRawArgumentsAcceptable(env, m, argtypes, mt.getParameterTypes(),
-                                allowBoxing, useVarargs, warn);
+        methodCheck.argumentsAcceptable(env, currentResolutionContext.deferredAttrContext(m, infer.emptyContext, resultInfo, warn),
+                                argtypes, mt.getParameterTypes(), warn);
         return mt;
     }
 
@@ -578,7 +582,7 @@
             currentResolutionContext.attrMode = DeferredAttr.AttrMode.CHECK;
             MethodResolutionPhase step = currentResolutionContext.step = env.info.pendingResolutionPhase;
             return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
-                    step.isBoxingRequired(), step.isVarargsRequired(), warn);
+                    step.isBoxingRequired(), step.isVarargsRequired(), resolveMethodCheck, warn);
         }
         finally {
             currentResolutionContext = prevContext;
@@ -595,80 +599,65 @@
                      List<Type> typeargtypes,
                      boolean allowBoxing,
                      boolean useVarargs,
+                     MethodCheck methodCheck,
                      Warner warn) {
         try {
             return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
-                                  allowBoxing, useVarargs, warn);
+                                  allowBoxing, useVarargs, methodCheck, warn);
         } catch (InapplicableMethodException ex) {
             return null;
         }
     }
 
-    /** Check if a parameter list accepts a list of args.
+    /**
+     * This interface defines an entry point that should be used to perform a
+     * method check. A method check usually consist in determining as to whether
+     * a set of types (actuals) is compatible with another set of types (formals).
+     * Since the notion of compatibility can vary depending on the circumstances,
+     * this interfaces allows to easily add new pluggable method check routines.
      */
-    boolean argumentsAcceptable(Env<AttrContext> env,
-                                Symbol msym,
+    interface MethodCheck {
+        /**
+         * Main method check routine. A method check usually consist in determining
+         * as to whether a set of types (actuals) is compatible with another set of
+         * types (formals). If an incompatibility is found, an unchecked exception
+         * is assumed to be thrown.
+         */
+        void argumentsAcceptable(Env<AttrContext> env,
+                                DeferredAttrContext deferredAttrContext,
                                 List<Type> argtypes,
                                 List<Type> formals,
-                                boolean allowBoxing,
-                                boolean useVarargs,
-                                Warner warn) {
-        try {
-            checkRawArgumentsAcceptable(env, msym, argtypes, formals, allowBoxing, useVarargs, warn);
-            return true;
-        } catch (InapplicableMethodException ex) {
-            return false;
-        }
-    }
-    /**
-     * A check handler is used by the main method applicability routine in order
-     * to handle specific method applicability failures. It is assumed that a class
-     * implementing this interface should throw exceptions that are a subtype of
-     * InapplicableMethodException (see below). Such exception will terminate the
-     * method applicability check and propagate important info outwards (for the
-     * purpose of generating better diagnostics).
-     */
-    interface MethodCheckHandler {
-        /* The number of actuals and formals differ */
-        InapplicableMethodException arityMismatch();
-        /* An actual argument type does not conform to the corresponding formal type */
-        InapplicableMethodException argumentMismatch(boolean varargs, JCDiagnostic details);
-        /* The element type of a varargs is not accessible in the current context */
-        InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected);
+                                Warner warn);
     }
 
     /**
-     * Basic method check handler used within Resolve - all methods end up
-     * throwing InapplicableMethodException; a diagnostic fragment that describes
-     * the cause as to why the method is not applicable is set on the exception
-     * before it is thrown.
+     * Helper enum defining all method check diagnostics (used by resolveMethodCheck).
      */
-    MethodCheckHandler resolveHandler = new MethodCheckHandler() {
-            public InapplicableMethodException arityMismatch() {
-                return inapplicableMethodException.setMessage("arg.length.mismatch");
-            }
-            public InapplicableMethodException argumentMismatch(boolean varargs, JCDiagnostic details) {
-                String key = varargs ?
-                        "varargs.argument.mismatch" :
-                        "no.conforming.assignment.exists";
-                return inapplicableMethodException.setMessage(key,
-                        details);
-            }
-            public InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected) {
-                return inapplicableMethodException.setMessage("inaccessible.varargs.type",
-                        expected, Kinds.kindName(location), location);
-            }
-    };
-
-    void checkRawArgumentsAcceptable(Env<AttrContext> env,
-                                Symbol msym,
-                                List<Type> argtypes,
-                                List<Type> formals,
-                                boolean allowBoxing,
-                                boolean useVarargs,
-                                Warner warn) {
-        checkRawArgumentsAcceptable(env, msym, currentResolutionContext.attrMode(), infer.emptyContext, argtypes, formals,
-                allowBoxing, useVarargs, warn, resolveHandler);
+    enum MethodCheckDiag {
+        /**
+         * Actuals and formals differs in length.
+         */
+        ARITY_MISMATCH("arg.length.mismatch", "infer.arg.length.mismatch"),
+        /**
+         * An actual is incompatible with a formal.
+         */
+        ARG_MISMATCH("no.conforming.assignment.exists", "infer.no.conforming.assignment.exists"),
+        /**
+         * An actual is incompatible with the varargs element type.
+         */
+        VARARG_MISMATCH("varargs.argument.mismatch", "infer.varargs.argument.mismatch"),
+        /**
+         * The varargs element type is inaccessible.
+         */
+        INACCESSIBLE_VARARGS("inaccessible.varargs.type", "inaccessible.varargs.type");
+
+        final String basicKey;
+        final String inferKey;
+
+        MethodCheckDiag(String basicKey, String inferKey) {
+            this.basicKey = basicKey;
+            this.inferKey = inferKey;
+        }
     }
 
     /**
@@ -689,68 +678,94 @@
      *
      * A method check handler (see above) is used in order to report errors.
      */
-    void checkRawArgumentsAcceptable(final Env<AttrContext> env,
-                                Symbol msym,
-                                DeferredAttr.AttrMode mode,
-                                final Infer.InferenceContext inferenceContext,
-                                List<Type> argtypes,
-                                List<Type> formals,
-                                boolean allowBoxing,
-                                boolean useVarargs,
-                                Warner warn,
-                                final MethodCheckHandler handler) {
-        Type varargsFormal = useVarargs ? formals.last() : null;
-
-        if (varargsFormal == null &&
-                argtypes.size() != formals.size()) {
-            throw handler.arityMismatch(); // not enough args
-        }
-
-        DeferredAttr.DeferredAttrContext deferredAttrContext =
-                deferredAttr.new DeferredAttrContext(mode, msym, currentResolutionContext.step, inferenceContext);
-
-        while (argtypes.nonEmpty() && formals.head != varargsFormal) {
-            ResultInfo mresult = methodCheckResult(formals.head, allowBoxing, false, inferenceContext, deferredAttrContext, handler, warn);
-            mresult.check(null, argtypes.head);
-            argtypes = argtypes.tail;
-            formals = formals.tail;
-        }
-
-        if (formals.head != varargsFormal) {
-            throw handler.arityMismatch(); // not enough args
-        }
-
-        if (useVarargs) {
-            //note: if applicability check is triggered by most specific test,
-            //the last argument of a varargs is _not_ an array type (see JLS 15.12.2.5)
-            final Type elt = types.elemtype(varargsFormal);
-            ResultInfo mresult = methodCheckResult(elt, allowBoxing, true, inferenceContext, deferredAttrContext, handler, warn);
-            while (argtypes.nonEmpty()) {
+    MethodCheck resolveMethodCheck = new MethodCheck() {
+        @Override
+        public void argumentsAcceptable(final Env<AttrContext> env,
+                                    DeferredAttrContext deferredAttrContext,
+                                    List<Type> argtypes,
+                                    List<Type> formals,
+                                    Warner warn) {
+            //should we expand formals?
+            boolean useVarargs = deferredAttrContext.phase.isVarargsRequired();
+
+            //inference context used during this method check
+            InferenceContext inferenceContext = deferredAttrContext.inferenceContext;
+
+            Type varargsFormal = useVarargs ? formals.last() : null;
+
+            if (varargsFormal == null &&
+                    argtypes.size() != formals.size()) {
+                reportMC(MethodCheckDiag.ARITY_MISMATCH, inferenceContext); // not enough args
+            }
+
+            while (argtypes.nonEmpty() && formals.head != varargsFormal) {
+                ResultInfo mresult = methodCheckResult(false, formals.head, deferredAttrContext, warn);
                 mresult.check(null, argtypes.head);
                 argtypes = argtypes.tail;
+                formals = formals.tail;
             }
-            //check varargs element type accessibility
-            varargsAccessible(env, elt, handler, inferenceContext);
-        }
-
-        deferredAttrContext.complete();
-    }
-
-    void varargsAccessible(final Env<AttrContext> env, final Type t, final Resolve.MethodCheckHandler handler, final InferenceContext inferenceContext) {
-        if (inferenceContext.free(t)) {
-            inferenceContext.addFreeTypeListener(List.of(t), new FreeTypeListener() {
-                @Override
-                public void typesInferred(InferenceContext inferenceContext) {
-                    varargsAccessible(env, inferenceContext.asInstType(t, types), handler, inferenceContext);
+
+            if (formals.head != varargsFormal) {
+                reportMC(MethodCheckDiag.ARITY_MISMATCH, inferenceContext); // not enough args
+            }
+
+            if (useVarargs) {
+                //note: if applicability check is triggered by most specific test,
+                //the last argument of a varargs is _not_ an array type (see JLS 15.12.2.5)
+                final Type elt = types.elemtype(varargsFormal);
+                ResultInfo mresult = methodCheckResult(true, elt, deferredAttrContext, warn);
+                while (argtypes.nonEmpty()) {
+                    mresult.check(null, argtypes.head);
+                    argtypes = argtypes.tail;
                 }
-            });
-        } else {
-            if (!isAccessible(env, t)) {
-                Symbol location = env.enclClass.sym;
-                throw handler.inaccessibleVarargs(location, t);
+                //check varargs element type accessibility
+                varargsAccessible(env, elt, inferenceContext);
             }
         }
-    }
+
+        private void reportMC(MethodCheckDiag diag, InferenceContext inferenceContext, Object... args) {
+            boolean inferDiag = inferenceContext != infer.emptyContext;
+            InapplicableMethodException ex = inferDiag ?
+                    infer.inferenceException : inapplicableMethodException;
+            if (inferDiag && (!diag.inferKey.equals(diag.basicKey))) {
+                Object[] args2 = new Object[args.length + 1];
+                System.arraycopy(args, 0, args2, 1, args.length);
+                args2[0] = inferenceContext.inferenceVars();
+                args = args2;
+            }
+            throw ex.setMessage(inferDiag ? diag.inferKey : diag.basicKey, args);
+        }
+
+        private void varargsAccessible(final Env<AttrContext> env, final Type t, final InferenceContext inferenceContext) {
+            if (inferenceContext.free(t)) {
+                inferenceContext.addFreeTypeListener(List.of(t), new FreeTypeListener() {
+                    @Override
+                    public void typesInferred(InferenceContext inferenceContext) {
+                        varargsAccessible(env, inferenceContext.asInstType(t), inferenceContext);
+                    }
+                });
+            } else {
+                if (!isAccessible(env, t)) {
+                    Symbol location = env.enclClass.sym;
+                    reportMC(MethodCheckDiag.INACCESSIBLE_VARARGS, inferenceContext, t, Kinds.kindName(location), location);
+                }
+            }
+        }
+
+        private ResultInfo methodCheckResult(final boolean varargsCheck, Type to,
+                final DeferredAttr.DeferredAttrContext deferredAttrContext, Warner rsWarner) {
+            CheckContext checkContext = new MethodCheckContext(!deferredAttrContext.phase.isBoxingRequired(), deferredAttrContext, rsWarner) {
+                MethodCheckDiag methodDiag = varargsCheck ?
+                                 MethodCheckDiag.VARARG_MISMATCH : MethodCheckDiag.ARG_MISMATCH;
+
+                @Override
+                public void report(DiagnosticPosition pos, JCDiagnostic details) {
+                    reportMC(methodDiag, deferredAttrContext.inferenceContext, details);
+                }
+            };
+            return new MethodResultInfo(to, checkContext);
+        }
+    };
 
     /**
      * Check context to be used during method applicability checks. A method check
@@ -758,23 +773,24 @@
      */
     abstract class MethodCheckContext implements CheckContext {
 
-        MethodCheckHandler handler;
-        boolean useVarargs;
-        Infer.InferenceContext inferenceContext;
+        boolean strict;
         DeferredAttrContext deferredAttrContext;
         Warner rsWarner;
 
-        public MethodCheckContext(MethodCheckHandler handler, boolean useVarargs,
-                Infer.InferenceContext inferenceContext, DeferredAttrContext deferredAttrContext, Warner rsWarner) {
-            this.handler = handler;
-            this.useVarargs = useVarargs;
-            this.inferenceContext = inferenceContext;
-            this.deferredAttrContext = deferredAttrContext;
-            this.rsWarner = rsWarner;
+        public MethodCheckContext(boolean strict, DeferredAttrContext deferredAttrContext, Warner rsWarner) {
+           this.strict = strict;
+           this.deferredAttrContext = deferredAttrContext;
+           this.rsWarner = rsWarner;
+        }
+
+        public boolean compatible(Type found, Type req, Warner warn) {
+            return strict ?
+                    types.isSubtypeUnchecked(found, deferredAttrContext.inferenceContext.asFree(req), warn) :
+                    types.isConvertible(found, deferredAttrContext.inferenceContext.asFree(req), warn);
         }
 
         public void report(DiagnosticPosition pos, JCDiagnostic details) {
-            throw handler.argumentMismatch(useVarargs, details);
+            throw inapplicableMethodException.setMessage(details);
         }
 
         public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) {
@@ -782,7 +798,7 @@
         }
 
         public InferenceContext inferenceContext() {
-            return inferenceContext;
+            return deferredAttrContext.inferenceContext;
         }
 
         public DeferredAttrContext deferredAttrContext() {
@@ -791,56 +807,13 @@
     }
 
     /**
-     * Subclass of method check context class that implements strict method conversion.
-     * Strict method conversion checks compatibility between types using subtyping tests.
-     */
-    class StrictMethodContext extends MethodCheckContext {
-
-        public StrictMethodContext(MethodCheckHandler handler, boolean useVarargs,
-                Infer.InferenceContext inferenceContext, DeferredAttrContext deferredAttrContext, Warner rsWarner) {
-            super(handler, useVarargs, inferenceContext, deferredAttrContext, rsWarner);
-        }
-
-        public boolean compatible(Type found, Type req, Warner warn) {
-            return types.isSubtypeUnchecked(found, inferenceContext.asFree(req, types), warn);
-        }
-    }
-
-    /**
-     * Subclass of method check context class that implements loose method conversion.
-     * Loose method conversion checks compatibility between types using method conversion tests.
+     * ResultInfo class to be used during method applicability checks. Check
+     * for deferred types goes through special path.
      */
-    class LooseMethodContext extends MethodCheckContext {
-
-        public LooseMethodContext(MethodCheckHandler handler, boolean useVarargs,
-                Infer.InferenceContext inferenceContext, DeferredAttrContext deferredAttrContext, Warner rsWarner) {
-            super(handler, useVarargs, inferenceContext, deferredAttrContext, rsWarner);
-        }
-
-        public boolean compatible(Type found, Type req, Warner warn) {
-            return types.isConvertible(found, inferenceContext.asFree(req, types), warn);
-        }
-    }
-
-    /**
-     * Create a method check context to be used during method applicability check
-     */
-    ResultInfo methodCheckResult(Type to, boolean allowBoxing, boolean useVarargs,
-            Infer.InferenceContext inferenceContext, DeferredAttr.DeferredAttrContext deferredAttrContext,
-            MethodCheckHandler methodHandler, Warner rsWarner) {
-        MethodCheckContext checkContext = allowBoxing ?
-                new LooseMethodContext(methodHandler, useVarargs, inferenceContext, deferredAttrContext, rsWarner) :
-                new StrictMethodContext(methodHandler, useVarargs, inferenceContext, deferredAttrContext, rsWarner);
-        return new MethodResultInfo(to, checkContext, deferredAttrContext);
-    }
-
     class MethodResultInfo extends ResultInfo {
 
-        DeferredAttr.DeferredAttrContext deferredAttrContext;
-
-        public MethodResultInfo(Type pt, CheckContext checkContext, DeferredAttr.DeferredAttrContext deferredAttrContext) {
+        public MethodResultInfo(Type pt, CheckContext checkContext) {
             attr.super(VAL, pt, checkContext);
-            this.deferredAttrContext = deferredAttrContext;
         }
 
         @Override
@@ -855,12 +828,219 @@
 
         @Override
         protected MethodResultInfo dup(Type newPt) {
-            return new MethodResultInfo(newPt, checkContext, deferredAttrContext);
+            return new MethodResultInfo(newPt, checkContext);
         }
 
         @Override
         protected ResultInfo dup(CheckContext newContext) {
-            return new MethodResultInfo(pt, newContext, deferredAttrContext);
+            return new MethodResultInfo(pt, newContext);
+        }
+    }
+
+    /**
+     * Most specific method applicability routine. Given a list of actual types A,
+     * a list of formal types F1, and a list of formal types F2, the routine determines
+     * as to whether the types in F1 can be considered more specific than those in F2 w.r.t.
+     * argument types A.
+     */
+    class MostSpecificCheck implements MethodCheck {
+
+        boolean strict;
+        List<Type> actuals;
+
+        MostSpecificCheck(boolean strict, List<Type> actuals) {
+            this.strict = strict;
+            this.actuals = actuals;
+        }
+
+        @Override
+        public void argumentsAcceptable(final Env<AttrContext> env,
+                                    DeferredAttrContext deferredAttrContext,
+                                    List<Type> formals1,
+                                    List<Type> formals2,
+                                    Warner warn) {
+            formals2 = adjustArgs(formals2, deferredAttrContext.msym, formals1.length(), deferredAttrContext.phase.isVarargsRequired());
+            while (formals2.nonEmpty()) {
+                ResultInfo mresult = methodCheckResult(formals2.head, deferredAttrContext, warn, actuals.head);
+                mresult.check(null, formals1.head);
+                formals1 = formals1.tail;
+                formals2 = formals2.tail;
+                actuals = actuals.isEmpty() ? actuals : actuals.tail;
+            }
+        }
+
+       /**
+        * Create a method check context to be used during the most specific applicability check
+        */
+        ResultInfo methodCheckResult(Type to, DeferredAttr.DeferredAttrContext deferredAttrContext,
+               Warner rsWarner, Type actual) {
+           return attr.new ResultInfo(Kinds.VAL, to,
+                   new MostSpecificCheckContext(strict, deferredAttrContext, rsWarner, actual));
+        }
+
+        /**
+         * Subclass of method check context class that implements most specific
+         * method conversion. If the actual type under analysis is a deferred type
+         * a full blown structural analysis is carried out.
+         */
+        class MostSpecificCheckContext extends MethodCheckContext {
+
+            Type actual;
+
+            public MostSpecificCheckContext(boolean strict, DeferredAttrContext deferredAttrContext, Warner rsWarner, Type actual) {
+                super(strict, deferredAttrContext, rsWarner);
+                this.actual = actual;
+            }
+
+            public boolean compatible(Type found, Type req, Warner warn) {
+                if (!allowStructuralMostSpecific || actual == null) {
+                    return super.compatible(found, req, warn);
+                } else {
+                    switch (actual.getTag()) {
+                        case DEFERRED:
+                            DeferredType dt = (DeferredType) actual;
+                            DeferredType.SpeculativeCache.Entry e = dt.speculativeCache.get(deferredAttrContext.msym, deferredAttrContext.phase);
+                            return (e == null || e.speculativeTree == deferredAttr.stuckTree)
+                                    ? false : mostSpecific(found, req, e.speculativeTree, warn);
+                        default:
+                            return standaloneMostSpecific(found, req, actual, warn);
+                    }
+                }
+            }
+
+            private boolean mostSpecific(Type t, Type s, JCTree tree, Warner warn) {
+                MostSpecificChecker msc = new MostSpecificChecker(t, s, warn);
+                msc.scan(tree);
+                return msc.result;
+            }
+
+            boolean polyMostSpecific(Type t1, Type t2, Warner warn) {
+                return (!t1.isPrimitive() && t2.isPrimitive())
+                        ? true : super.compatible(t1, t2, warn);
+            }
+
+            boolean standaloneMostSpecific(Type t1, Type t2, Type exprType, Warner warn) {
+                return (exprType.isPrimitive() == t1.isPrimitive()
+                        && exprType.isPrimitive() != t2.isPrimitive())
+                        ? true : super.compatible(t1, t2, warn);
+            }
+
+            /**
+             * Structural checker for most specific.
+             */
+            class MostSpecificChecker extends DeferredAttr.PolyScanner {
+
+                final Type t;
+                final Type s;
+                final Warner warn;
+                boolean result;
+
+                MostSpecificChecker(Type t, Type s, Warner warn) {
+                    this.t = t;
+                    this.s = s;
+                    this.warn = warn;
+                    result = true;
+                }
+
+                @Override
+                void skip(JCTree tree) {
+                    result &= standaloneMostSpecific(t, s, tree.type, warn);
+                }
+
+                @Override
+                public void visitConditional(JCConditional tree) {
+                    if (tree.polyKind == PolyKind.STANDALONE) {
+                        result &= standaloneMostSpecific(t, s, tree.type, warn);
+                    } else {
+                        super.visitConditional(tree);
+                    }
+                }
+
+                @Override
+                public void visitApply(JCMethodInvocation tree) {
+                    result &= (tree.polyKind == PolyKind.STANDALONE)
+                            ? standaloneMostSpecific(t, s, tree.type, warn)
+                            : polyMostSpecific(t, s, warn);
+                }
+
+                @Override
+                public void visitNewClass(JCNewClass tree) {
+                    result &= (tree.polyKind == PolyKind.STANDALONE)
+                            ? standaloneMostSpecific(t, s, tree.type, warn)
+                            : polyMostSpecific(t, s, warn);
+                }
+
+                @Override
+                public void visitReference(JCMemberReference tree) {
+                    if (types.isFunctionalInterface(t.tsym) &&
+                            types.isFunctionalInterface(s.tsym) &&
+                            types.asSuper(t, s.tsym) == null &&
+                            types.asSuper(s, t.tsym) == null) {
+                        Type desc_t = types.findDescriptorType(t);
+                        Type desc_s = types.findDescriptorType(s);
+                        if (types.isSameTypes(desc_t.getParameterTypes(), desc_s.getParameterTypes())) {
+                            if (!desc_s.getReturnType().hasTag(VOID)) {
+                                //perform structural comparison
+                                Type ret_t = desc_t.getReturnType();
+                                Type ret_s = desc_s.getReturnType();
+                                result &= ((tree.refPolyKind == PolyKind.STANDALONE)
+                                        ? standaloneMostSpecific(ret_t, ret_s, tree.sym.type.getReturnType(), warn)
+                                        : polyMostSpecific(ret_t, ret_s, warn));
+                            } else {
+                                return;
+                            }
+                        } else {
+                            result &= false;
+                        }
+                    } else {
+                        result &= MostSpecificCheckContext.super.compatible(t, s, warn);
+                    }
+                }
+
+                @Override
+                public void visitLambda(JCLambda tree) {
+                    if (types.isFunctionalInterface(t.tsym) &&
+                            types.isFunctionalInterface(s.tsym) &&
+                            types.asSuper(t, s.tsym) == null &&
+                            types.asSuper(s, t.tsym) == null) {
+                        Type desc_t = types.findDescriptorType(t);
+                        Type desc_s = types.findDescriptorType(s);
+                        if (tree.paramKind == JCLambda.ParameterKind.EXPLICIT
+                                || types.isSameTypes(desc_t.getParameterTypes(), desc_s.getParameterTypes())) {
+                            if (!desc_s.getReturnType().hasTag(VOID)) {
+                                //perform structural comparison
+                                Type ret_t = desc_t.getReturnType();
+                                Type ret_s = desc_s.getReturnType();
+                                scanLambdaBody(tree, ret_t, ret_s);
+                            } else {
+                                return;
+                            }
+                        } else {
+                            result &= false;
+                        }
+                    } else {
+                        result &= MostSpecificCheckContext.super.compatible(t, s, warn);
+                    }
+                }
+                //where
+
+                void scanLambdaBody(JCLambda lambda, final Type t, final Type s) {
+                    if (lambda.getBodyKind() == JCTree.JCLambda.BodyKind.EXPRESSION) {
+                        result &= MostSpecificCheckContext.this.mostSpecific(t, s, lambda.body, warn);
+                    } else {
+                        DeferredAttr.LambdaReturnScanner lambdaScanner =
+                                new DeferredAttr.LambdaReturnScanner() {
+                                    @Override
+                                    public void visitReturn(JCReturn tree) {
+                                        if (tree.expr != null) {
+                                            result &= MostSpecificCheckContext.this.mostSpecific(t, s, tree.expr, warn);
+                                        }
+                                    }
+                                };
+                        lambdaScanner.scan(lambda.body);
+                    }
+                }
+            }
         }
     }
 
@@ -1064,14 +1244,17 @@
                       boolean useVarargs,
                       boolean operator) {
         if (sym.kind == ERR ||
-                !sym.isInheritedIn(site.tsym, types) ||
-                (useVarargs && (sym.flags() & VARARGS) == 0)) {
+                !sym.isInheritedIn(site.tsym, types)) {
             return bestSoFar;
+        } else if (useVarargs && (sym.flags() & VARARGS) == 0) {
+            return bestSoFar.kind >= ERRONEOUS ?
+                    new BadVarargsMethod((ResolveError)bestSoFar) :
+                    bestSoFar;
         }
         Assert.check(sym.kind < AMBIGUOUS);
         try {
             Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes,
-                               allowBoxing, useVarargs, types.noWarnings);
+                               allowBoxing, useVarargs, resolveMethodCheck, types.noWarnings);
             if (!operator)
                 currentResolutionContext.addApplicableCandidate(sym, mt);
         } catch (InapplicableMethodException ex) {
@@ -1151,198 +1334,52 @@
                 if (m1Abstract && !m2Abstract) return m2;
                 if (m2Abstract && !m1Abstract) return m1;
                 // both abstract or both concrete
-                if (!m1Abstract && !m2Abstract)
-                    return ambiguityError(m1, m2);
-                // check that both signatures have the same erasure
-                if (!types.isSameTypes(m1.erasure(types).getParameterTypes(),
-                                       m2.erasure(types).getParameterTypes()))
-                    return ambiguityError(m1, m2);
-                // both abstract, neither overridden; merge throws clause and result type
-                Type mst = mostSpecificReturnType(mt1, mt2);
-                if (mst == null) {
-                    // Theoretically, this can't happen, but it is possible
-                    // due to error recovery or mixing incompatible class files
-                    return ambiguityError(m1, m2);
-                }
-                Symbol mostSpecific = mst == mt1 ? m1 : m2;
-                List<Type> allThrown = chk.intersect(mt1.getThrownTypes(), mt2.getThrownTypes());
-                Type newSig = types.createMethodTypeWithThrown(mostSpecific.type, allThrown);
-                MethodSymbol result = new MethodSymbol(
-                        mostSpecific.flags(),
-                        mostSpecific.name,
-                        newSig,
-                        mostSpecific.owner) {
-                    @Override
-                    public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult) {
-                        if (origin == site.tsym)
-                            return this;
-                        else
-                            return super.implementation(origin, types, checkResult);
-                        }
-                    };
-                return result;
+                return ambiguityError(m1, m2);
             }
             if (m1SignatureMoreSpecific) return m1;
             if (m2SignatureMoreSpecific) return m2;
             return ambiguityError(m1, m2);
         case AMBIGUOUS:
+            //check if m1 is more specific than all ambiguous methods in m2
             AmbiguityError e = (AmbiguityError)m2;
-            Symbol err1 = mostSpecific(argtypes, m1, e.sym, env, site, allowBoxing, useVarargs);
-            Symbol err2 = mostSpecific(argtypes, m1, e.sym2, env, site, allowBoxing, useVarargs);
-            if (err1 == err2) return err1;
-            if (err1 == e.sym && err2 == e.sym2) return m2;
-            if (err1 instanceof AmbiguityError &&
-                err2 instanceof AmbiguityError &&
-                ((AmbiguityError)err1).sym == ((AmbiguityError)err2).sym)
-                return ambiguityError(m1, m2);
-            else
-                return ambiguityError(err1, err2);
+            for (Symbol s : e.ambiguousSyms) {
+                if (mostSpecific(argtypes, m1, s, env, site, allowBoxing, useVarargs) != m1) {
+                    return e.addAmbiguousSymbol(m1);
+                }
+            }
+            return m1;
         default:
             throw new AssertionError();
         }
     }
     //where
     private boolean signatureMoreSpecific(List<Type> actuals, Env<AttrContext> env, Type site, Symbol m1, Symbol m2, boolean allowBoxing, boolean useVarargs) {
-        Symbol m12 = adjustVarargs(m1, m2, useVarargs);
-        Symbol m22 = adjustVarargs(m2, m1, useVarargs);
-        Type mtype1 = types.memberType(site, m12);
-        Type mtype2 = types.memberType(site, m22);
-
-        //check if invocation is more specific
-        if (invocationMoreSpecific(env, site, m22, mtype1.getParameterTypes(), allowBoxing, useVarargs)) {
-            return true;
-        }
-
-        //perform structural check
-
-        List<Type> formals1 = mtype1.getParameterTypes();
-        Type lastFormal1 = formals1.last();
-        List<Type> formals2 = mtype2.getParameterTypes();
-        Type lastFormal2 = formals2.last();
-        ListBuffer<Type> newFormals = ListBuffer.lb();
-
-        boolean hasStructuralPoly = false;
-        for (Type actual : actuals) {
-            //perform formal argument adaptation in case actuals > formals (varargs)
-            Type f1 = formals1.isEmpty() ?
-                    lastFormal1 : formals1.head;
-            Type f2 = formals2.isEmpty() ?
-                    lastFormal2 : formals2.head;
-
-            //is this a structural actual argument?
-            boolean isStructuralPoly = actual.hasTag(DEFERRED) &&
-                    (((DeferredType)actual).tree.hasTag(LAMBDA) ||
-                    ((DeferredType)actual).tree.hasTag(REFERENCE));
-
-            Type newFormal = f1;
-
-            if (isStructuralPoly) {
-                //for structural arguments only - check that corresponding formals
-                //are related - if so replace formal with <null>
-                hasStructuralPoly = true;
-                DeferredType dt = (DeferredType)actual;
-                Type t1 = deferredAttr.new DeferredTypeMap(AttrMode.SPECULATIVE, m1, currentResolutionContext.step).apply(dt);
-                Type t2 = deferredAttr.new DeferredTypeMap(AttrMode.SPECULATIVE, m2, currentResolutionContext.step).apply(dt);
-                if (t1.isErroneous() || t2.isErroneous() || !isStructuralSubtype(t1, t2)) {
-                    //not structural subtypes - simply fail
-                    return false;
-                } else {
-                    newFormal = syms.botType;
-                }
-            }
-
-            newFormals.append(newFormal);
-            if (newFormals.length() > mtype2.getParameterTypes().length()) {
-                //expand m2's type so as to fit the new formal arity (varargs)
-                m22.type = types.createMethodTypeWithParameters(m22.type, m22.type.getParameterTypes().append(f2));
-            }
-
-            formals1 = formals1.isEmpty() ? formals1 : formals1.tail;
-            formals2 = formals2.isEmpty() ? formals2 : formals2.tail;
-        }
-
-        if (!hasStructuralPoly) {
-            //if no structural actual was found, we're done
-            return false;
-        }
-        //perform additional adaptation if actuals < formals (varargs)
-        for (Type t : formals1) {
-            newFormals.append(t);
-        }
-        //check if invocation (with tweaked args) is more specific
-        return invocationMoreSpecific(env, site, m22, newFormals.toList(), allowBoxing, useVarargs);
-    }
-    //where
-    private boolean invocationMoreSpecific(Env<AttrContext> env, Type site, Symbol m2, List<Type> argtypes1, boolean allowBoxing, boolean useVarargs) {
         noteWarner.clear();
+        int maxLength = Math.max(
+                            Math.max(m1.type.getParameterTypes().length(), actuals.length()),
+                            m2.type.getParameterTypes().length());
         Type mst = instantiate(env, site, m2, null,
-                types.lowerBounds(argtypes1), null,
-                allowBoxing, false, noteWarner);
+                adjustArgs(types.lowerBounds(types.memberType(site, m1).getParameterTypes()), m1, maxLength, useVarargs), null,
+                allowBoxing, useVarargs, new MostSpecificCheck(!allowBoxing, actuals), noteWarner);
         return mst != null &&
                 !noteWarner.hasLint(Lint.LintCategory.UNCHECKED);
     }
-    //where
-    private Symbol adjustVarargs(Symbol to, Symbol from, boolean useVarargs) {
-        List<Type> fromArgs = from.type.getParameterTypes();
-        List<Type> toArgs = to.type.getParameterTypes();
-        if (useVarargs &&
-                (from.flags() & VARARGS) != 0 &&
-                (to.flags() & VARARGS) != 0) {
-            Type varargsTypeFrom = fromArgs.last();
-            Type varargsTypeTo = toArgs.last();
-            ListBuffer<Type> args = ListBuffer.lb();
-            if (toArgs.length() < fromArgs.length()) {
-                //if we are checking a varargs method 'from' against another varargs
-                //method 'to' (where arity of 'to' < arity of 'from') then expand signature
-                //of 'to' to 'fit' arity of 'from' (this means adding fake formals to 'to'
-                //until 'to' signature has the same arity as 'from')
-                while (fromArgs.head != varargsTypeFrom) {
-                    args.append(toArgs.head == varargsTypeTo ? types.elemtype(varargsTypeTo) : toArgs.head);
-                    fromArgs = fromArgs.tail;
-                    toArgs = toArgs.head == varargsTypeTo ?
-                        toArgs :
-                        toArgs.tail;
-                }
-            } else {
-                //formal argument list is same as original list where last
-                //argument (array type) is removed
-                args.appendList(toArgs.reverse().tail.reverse());
+    private List<Type> adjustArgs(List<Type> args, Symbol msym, int length, boolean allowVarargs) {
+        if ((msym.flags() & VARARGS) != 0 && allowVarargs) {
+            Type varargsElem = types.elemtype(args.last());
+            if (varargsElem == null) {
+                Assert.error("Bad varargs = " + args.last() + " " + msym);
             }
-            //append varargs element type as last synthetic formal
-            args.append(types.elemtype(varargsTypeTo));
-            Type mtype = types.createMethodTypeWithParameters(to.type, args.toList());
-            return new MethodSymbol(to.flags_field & ~VARARGS, to.name, mtype, to.owner);
+            List<Type> newArgs = args.reverse().tail.prepend(varargsElem).reverse();
+            while (newArgs.length() < length) {
+                newArgs = newArgs.append(newArgs.last());
+            }
+            return newArgs;
         } else {
-            return to;
+            return args;
         }
     }
     //where
-    boolean isStructuralSubtype(Type s, Type t) {
-
-        Type ret_s = types.findDescriptorType(s).getReturnType();
-        Type ret_t = types.findDescriptorType(t).getReturnType();
-
-        //covariant most specific check for function descriptor return type
-        if (!types.isSubtype(ret_s, ret_t)) {
-            return false;
-        }
-
-        List<Type> args_s = types.findDescriptorType(s).getParameterTypes();
-        List<Type> args_t = types.findDescriptorType(t).getParameterTypes();
-
-        //arity must be identical
-        if (args_s.length() != args_t.length()) {
-            return false;
-        }
-
-        //invariant most specific check for function descriptor parameter types
-        if (!types.isSameTypes(args_t, args_s)) {
-            return false;
-        }
-
-        return true;
-    }
-    //where
     Type mostSpecificReturnType(Type mt1, Type mt2) {
         Type rt1 = mt1.getReturnType();
         Type rt2 = mt2.getReturnType();
@@ -2366,9 +2403,11 @@
         try {
             currentResolutionContext = new MethodResolutionContext();
             Name name = treeinfo.operatorName(optag);
+            env.info.pendingResolutionPhase = currentResolutionContext.step = BASIC;
             Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes,
                                     null, false, false, true);
             if (boxingEnabled && sym.kind >= WRONG_MTHS)
+                env.info.pendingResolutionPhase = currentResolutionContext.step = BOX;
                 sym = findMethod(env, syms.predefClass.type, name, argtypes,
                                  null, true, false, true);
             return accessMethod(sym, pos, env.enclClass.sym.type, name,
@@ -2438,10 +2477,23 @@
                                   List<Type> typeargtypes,
                                   boolean boxingAllowed) {
         MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC;
+
+        ReferenceLookupHelper boundLookupHelper;
+        if (!name.equals(names.init)) {
+            //method reference
+            boundLookupHelper =
+                    new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
+        } else if (site.hasTag(ARRAY)) {
+            //array constructor reference
+            boundLookupHelper =
+                    new ArrayConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
+        } else {
+            //class constructor reference
+            boundLookupHelper =
+                    new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
+        }
+
         //step 1 - bound lookup
-        ReferenceLookupHelper boundLookupHelper = name.equals(names.init) ?
-                new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase) :
-                new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
         Env<AttrContext> boundEnv = env.dup(env.tree, env.info.dup());
         Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(), site.tsym, boundLookupHelper);
 
@@ -2452,10 +2504,10 @@
 
         //merge results
         Pair<Symbol, ReferenceLookupHelper> res;
-        if (unboundSym.kind != MTH) {
+        if (!lookupSuccess(unboundSym)) {
             res = new Pair<Symbol, ReferenceLookupHelper>(boundSym, boundLookupHelper);
             env.info.pendingResolutionPhase = boundEnv.info.pendingResolutionPhase;
-        } else if (boundSym.kind == MTH) {
+        } else if (lookupSuccess(boundSym)) {
             res = new Pair<Symbol, ReferenceLookupHelper>(ambiguityError(boundSym, unboundSym), boundLookupHelper);
             env.info.pendingResolutionPhase = boundEnv.info.pendingResolutionPhase;
         } else {
@@ -2465,6 +2517,10 @@
 
         return res;
     }
+    //private
+        boolean lookupSuccess(Symbol s) {
+            return s.kind == MTH || s.kind == AMBIGUOUS;
+        }
 
     /**
      * Helper for defining custom method-like lookup logic; a lookup helper
@@ -2524,6 +2580,10 @@
 
         @Override
         Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
+            if (sym.kind == AMBIGUOUS) {
+                AmbiguityError a_err = (AmbiguityError)sym;
+                sym = a_err.mergeAbstracts(site);
+            }
             if (sym.kind >= AMBIGUOUS) {
                 //if nothing is found return the 'first' error
                 sym = accessMethod(sym, pos, location, site, name, true, argtypes, typeargtypes);
@@ -2579,6 +2639,10 @@
         abstract JCMemberReference.ReferenceKind referenceKind(Symbol sym);
 
         Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
+            if (sym.kind == AMBIGUOUS) {
+                AmbiguityError a_err = (AmbiguityError)sym;
+                sym = a_err.mergeAbstracts(site);
+            }
             //skip error reporting
             return sym;
         }
@@ -2597,22 +2661,12 @@
             super(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
         }
 
-        protected Symbol lookupReferenceInternal(Env<AttrContext> env, MethodResolutionPhase phase) {
+        @Override
+        final Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
             return findMethod(env, site, name, argtypes, typeargtypes,
                     phase.isBoxingRequired(), phase.isVarargsRequired(), syms.operatorNames.contains(name));
         }
 
-        protected Symbol adjustLookupResult(Env<AttrContext> env, Symbol sym) {
-            return !TreeInfo.isStaticSelector(referenceTree.expr, names) ||
-                        sym.kind != MTH ||
-                        sym.isStatic() ? sym : new StaticError(sym);
-        }
-
-        @Override
-        final Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
-            return adjustLookupResult(env, lookupReferenceInternal(env, phase));
-        }
-
         @Override
         ReferenceLookupHelper unboundLookup() {
             if (TreeInfo.isStaticSelector(referenceTree.expr, names) &&
@@ -2649,14 +2703,11 @@
 
         UnboundMethodReferenceLookupHelper(JCMemberReference referenceTree, Name name, Type site,
                 List<Type> argtypes, List<Type> typeargtypes, MethodResolutionPhase maxPhase) {
-            super(referenceTree, name,
-                    site.isRaw() ? types.asSuper(argtypes.head, site.tsym) : site,
-                    argtypes.tail, typeargtypes, maxPhase);
-        }
-
-        @Override
-        protected Symbol adjustLookupResult(Env<AttrContext> env, Symbol sym) {
-            return sym.kind != MTH || !sym.isStatic() ? sym : new StaticError(sym);
+            super(referenceTree, name, site, argtypes.tail, typeargtypes, maxPhase);
+            Type asSuperSite = types.asSuper(argtypes.head, site.tsym);
+            if (site.isRaw() && !asSuperSite.isErroneous()) {
+                this.site = asSuperSite;
+            }
         }
 
         @Override
@@ -2671,6 +2722,33 @@
     }
 
     /**
+     * Helper class for array constructor lookup; an array constructor lookup
+     * is simulated by looking up a method that returns the array type specified
+     * as qualifier, and that accepts a single int parameter (size of the array).
+     */
+    class ArrayConstructorReferenceLookupHelper extends ReferenceLookupHelper {
+
+        ArrayConstructorReferenceLookupHelper(JCMemberReference referenceTree, Type site, List<Type> argtypes,
+                List<Type> typeargtypes, MethodResolutionPhase maxPhase) {
+            super(referenceTree, names.init, site, argtypes, typeargtypes, maxPhase);
+        }
+
+        @Override
+        protected Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
+            Scope sc = new Scope(syms.arrayClass);
+            MethodSymbol arrayConstr = new MethodSymbol(PUBLIC, name, null, site.tsym);
+            arrayConstr.type = new MethodType(List.of(syms.intType), site, List.<Type>nil(), syms.methodClass);
+            sc.enter(arrayConstr);
+            return findMethodInScope(env, site, name, argtypes, typeargtypes, sc, methodNotFound, phase.isBoxingRequired(), phase.isVarargsRequired(), false, false);
+        }
+
+        @Override
+        ReferenceKind referenceKind(Symbol sym) {
+            return ReferenceKind.ARRAY_CTOR;
+        }
+    }
+
+    /**
      * Helper class for constructor reference lookup. The lookup logic is based
      * upon either Resolve.findMethod or Resolve.findDiamond - depending on
      * whether the constructor reference needs diamond inference (this is the case
@@ -3014,9 +3092,7 @@
 
         @Override
         public Symbol access(Name name, TypeSymbol location) {
-            if (sym.kind >= AMBIGUOUS)
-                return ((ResolveError)sym).access(name, location);
-            else if ((sym.kind & ERRONEOUS) == 0 && (sym.kind & TYP) != 0)
+            if ((sym.kind & ERRONEOUS) == 0 && (sym.kind & TYP) != 0)
                 return types.createErrorType(name, location, sym.type).tsym;
             else
                 return sym;
@@ -3338,14 +3414,32 @@
      * (either methods, constructors or operands) are ambiguous
      * given an actual arguments/type argument list.
      */
-    class AmbiguityError extends InvalidSymbolError {
+    class AmbiguityError extends ResolveError {
 
         /** The other maximally specific symbol */
-        Symbol sym2;
+        List<Symbol> ambiguousSyms = List.nil();
+
+        @Override
+        public boolean exists() {
+            return true;
+        }
 
         AmbiguityError(Symbol sym1, Symbol sym2) {
-            super(AMBIGUOUS, sym1, "ambiguity error");
-            this.sym2 = sym2;
+            super(AMBIGUOUS, "ambiguity error");
+            ambiguousSyms = flatten(sym2).appendList(flatten(sym1));
+        }
+
+        private List<Symbol> flatten(Symbol sym) {
+            if (sym.kind == AMBIGUOUS) {
+                return ((AmbiguityError)sym).ambiguousSyms;
+            } else {
+                return List.of(sym);
+            }
+        }
+
+        AmbiguityError addAmbiguousSymbol(Symbol s) {
+            ambiguousSyms = ambiguousSyms.prepend(s);
+            return this;
         }
 
         @Override
@@ -3356,24 +3450,88 @@
                 Name name,
                 List<Type> argtypes,
                 List<Type> typeargtypes) {
-            AmbiguityError pair = this;
-            while (true) {
-                if (pair.sym.kind == AMBIGUOUS)
-                    pair = (AmbiguityError)pair.sym;
-                else if (pair.sym2.kind == AMBIGUOUS)
-                    pair = (AmbiguityError)pair.sym2;
-                else break;
-            }
-            Name sname = pair.sym.name;
-            if (sname == names.init) sname = pair.sym.owner.name;
+            List<Symbol> diagSyms = ambiguousSyms.reverse();
+            Symbol s1 = diagSyms.head;
+            Symbol s2 = diagSyms.tail.head;
+            Name sname = s1.name;
+            if (sname == names.init) sname = s1.owner.name;
             return diags.create(dkind, log.currentSource(),
                       pos, "ref.ambiguous", sname,
-                      kindName(pair.sym),
-                      pair.sym,
-                      pair.sym.location(site, types),
-                      kindName(pair.sym2),
-                      pair.sym2,
-                      pair.sym2.location(site, types));
+                      kindName(s1),
+                      s1,
+                      s1.location(site, types),
+                      kindName(s2),
+                      s2,
+                      s2.location(site, types));
+        }
+
+        /**
+         * If multiple applicable methods are found during overload and none of them
+         * is more specific than the others, attempt to merge their signatures.
+         */
+        Symbol mergeAbstracts(Type site) {
+            Symbol fst = ambiguousSyms.last();
+            Symbol res = fst;
+            for (Symbol s : ambiguousSyms.reverse()) {
+                Type mt1 = types.memberType(site, res);
+                Type mt2 = types.memberType(site, s);
+                if ((s.flags() & ABSTRACT) == 0 ||
+                        !types.overrideEquivalent(mt1, mt2) ||
+                        !types.isSameTypes(fst.erasure(types).getParameterTypes(),
+                                       s.erasure(types).getParameterTypes())) {
+                    //ambiguity cannot be resolved
+                    return this;
+                } else {
+                    Type mst = mostSpecificReturnType(mt1, mt2);
+                    if (mst == null) {
+                        // Theoretically, this can't happen, but it is possible
+                        // due to error recovery or mixing incompatible class files
+                        return this;
+                    }
+                    Symbol mostSpecific = mst == mt1 ? res : s;
+                    List<Type> allThrown = chk.intersect(mt1.getThrownTypes(), mt2.getThrownTypes());
+                    Type newSig = types.createMethodTypeWithThrown(mostSpecific.type, allThrown);
+                    res = new MethodSymbol(
+                            mostSpecific.flags(),
+                            mostSpecific.name,
+                            newSig,
+                            mostSpecific.owner);
+                }
+            }
+            return res;
+        }
+
+        @Override
+        protected Symbol access(Name name, TypeSymbol location) {
+            Symbol firstAmbiguity = ambiguousSyms.last();
+            return firstAmbiguity.kind == TYP ?
+                    types.createErrorType(name, location, firstAmbiguity.type).tsym :
+                    firstAmbiguity;
+        }
+    }
+
+    class BadVarargsMethod extends ResolveError {
+
+        ResolveError delegatedError;
+
+        BadVarargsMethod(ResolveError delegatedError) {
+            super(delegatedError.kind, "badVarargs");
+            this.delegatedError = delegatedError;
+        }
+
+        @Override
+        protected Symbol access(Name name, TypeSymbol location) {
+            return delegatedError.access(name, location);
+        }
+
+        @Override
+        public boolean exists() {
+            return true;
+        }
+
+        @Override
+        JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+            return delegatedError.getDiagnostic(dkind, pos, location, site, name, argtypes, typeargtypes);
         }
     }
 
@@ -3450,6 +3608,10 @@
             candidates = candidates.append(c);
         }
 
+        DeferredAttrContext deferredAttrContext(Symbol sym, InferenceContext inferenceContext, ResultInfo pendingResult, Warner warn) {
+            return deferredAttr.new DeferredAttrContext(attrMode, sym, step, inferenceContext, pendingResult != null ? pendingResult.checkContext.deferredAttrContext() : deferredAttr.emptyDeferredAttrContext, warn);
+        }
+
         /**
          * This class represents an overload resolution candidate. There are two
          * kinds of candidates: applicable methods and inapplicable methods;
@@ -3457,6 +3619,7 @@
          * while inapplicable candidates contain further details about the
          * reason why the method has been considered inapplicable.
          */
+        @SuppressWarnings("overrides")
         class Candidate {
 
             final MethodResolutionPhase step;
--- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -483,6 +483,7 @@
             tree.restype = translate(tree.restype, null);
             tree.typarams = List.nil();
             tree.params = translateVarDefs(tree.params);
+            tree.recvparam = translate(tree.recvparam, null);
             tree.thrown = translate(tree.thrown, null);
             tree.body = translate(tree.body, tree.sym.erasure(types).getReturnType());
             tree.type = erasure(tree.type);
@@ -549,9 +550,6 @@
             currentMethod = null;
             tree.params = translate(tree.params);
             tree.body = translate(tree.body, null);
-            //save non-erased target
-            tree.targetType = tree.type;
-            Assert.check(!tree.targetType.isCompound(), "Intersection-type targets not supported yet!");
             tree.type = erasure(tree.type);
             result = tree;
         }
@@ -785,9 +783,6 @@
 
     public void visitReference(JCMemberReference tree) {
         tree.expr = translate(tree.expr, null);
-        //save non-erased target
-        tree.targetType = tree.type;
-        Assert.check(!tree.targetType.isCompound(), "Intersection-type targets not supported yet!");
         tree.type = erasure(tree.type);
         result = tree;
     }
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -134,6 +134,11 @@
      **/
     public boolean preferSource;
 
+    /**
+     * The currently selected profile.
+     */
+    public final Profile profile;
+
     /** The log to use for verbose output
      */
     final Log log;
@@ -217,6 +222,13 @@
      */
     boolean haveParameterNameIndices;
 
+    /** Set this to false every time we start reading a method
+     * and are saving parameter names.  Set it to true when we see
+     * MethodParameters, if it's set when we see a LocalVariableTable,
+     * then we ignore the parameter names from the LVT.
+     */
+    boolean sawMethodParameters;
+
     /**
      * The set of attribute names for which warnings have been generated for the current class
      */
@@ -277,16 +289,20 @@
         annotate = Annotate.instance(context);
         verbose        = options.isSet(VERBOSE);
         checkClassFile = options.isSet("-checkclassfile");
+
         Source source = Source.instance(context);
         allowGenerics    = source.allowGenerics();
         allowVarargs     = source.allowVarargs();
         allowAnnotations = source.allowAnnotations();
         allowSimplifiedVarargs = source.allowSimplifiedVarargs();
         allowDefaultMethods = source.allowDefaultMethods();
+
         saveParameterNames = options.isSet("save-parameter-names");
         cacheCompletionFailure = options.isUnset("dev");
         preferSource = "source".equals(options.get("-Xprefer"));
 
+        profile = Profile.instance(context);
+
         completionFailureName =
             options.isSet("failcomplete")
             ? names.fromString(options.get("failcomplete"))
@@ -302,7 +318,9 @@
     /** Add member to class unless it is synthetic.
      */
     private void enterMember(ClassSymbol c, Symbol sym) {
-        if ((sym.flags_field & (SYNTHETIC|BRIDGE)) != SYNTHETIC)
+        // Synthetic members are not entered -- reason lost to history (optimization?).
+        // Lambda methods must be entered because they may have inner classes (which reference them)
+        if ((sym.flags_field & (SYNTHETIC|BRIDGE)) != SYNTHETIC || sym.name.startsWith(names.lambda))
             c.members_field.enter(sym);
     }
 
@@ -344,8 +362,8 @@
 
     /** Read a byte.
      */
-    byte nextByte() {
-        return buf[bp++];
+    int nextByte() {
+        return buf[bp++] & 0xFF;
     }
 
     /** Read an integer.
@@ -984,7 +1002,7 @@
             new AttributeReader(names.LocalVariableTable, V45_3, CLASS_OR_MEMBER_ATTRIBUTE) {
                 protected void read(Symbol sym, int attrLen) {
                     int newbp = bp + attrLen;
-                    if (saveParameterNames) {
+                    if (saveParameterNames && !sawMethodParameters) {
                         // Pick up parameter names from the variable table.
                         // Parameter names are not explicitly identified as such,
                         // but all parameter name entries in the LocalVariableTable
@@ -1017,6 +1035,25 @@
                 }
             },
 
+            new AttributeReader(names.MethodParameters, V52, MEMBER_ATTRIBUTE) {
+                protected void read(Symbol sym, int attrlen) {
+                    int newbp = bp + attrlen;
+                    if (saveParameterNames) {
+                        sawMethodParameters = true;
+                        int numEntries = nextByte();
+                        parameterNameIndices = new int[numEntries];
+                        haveParameterNameIndices = true;
+                        for (int i = 0; i < numEntries; i++) {
+                            int nameIndex = nextChar();
+                            int flags = nextChar();
+                            parameterNameIndices[i] = nameIndex;
+                        }
+                    }
+                    bp = newbp;
+                }
+            },
+
+
             new AttributeReader(names.SourceFile, V45_3, CLASS_ATTRIBUTE) {
                 protected void read(Symbol sym, int attrLen) {
                     ClassSymbol c = (ClassSymbol) sym;
@@ -1146,6 +1183,19 @@
                 }
             },
 
+            new AttributeReader(names.RuntimeVisibleTypeAnnotations, V52, CLASS_OR_MEMBER_ATTRIBUTE) {
+                protected void read(Symbol sym, int attrLen) {
+                    attachTypeAnnotations(sym);
+                }
+            },
+
+            new AttributeReader(names.RuntimeInvisibleTypeAnnotations, V52, CLASS_OR_MEMBER_ATTRIBUTE) {
+                protected void read(Symbol sym, int attrLen) {
+                    attachTypeAnnotations(sym);
+                }
+            },
+
+
             // The following attributes for a Code attribute are not currently handled
             // StackMapTable
             // SourceDebugExtension
@@ -1331,7 +1381,18 @@
                 CompoundAnnotationProxy proxy = readCompoundAnnotation();
                 if (proxy.type.tsym == syms.proprietaryType.tsym)
                     sym.flags_field |= PROPRIETARY;
-                else
+                else if (proxy.type.tsym == syms.profileType.tsym) {
+                    if (profile != Profile.DEFAULT) {
+                        for (Pair<Name,Attribute> v: proxy.values) {
+                            if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
+                                Attribute.Constant c = (Attribute.Constant) v.snd;
+                                if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
+                                    sym.flags_field |= NOT_IN_PROFILE;
+                                }
+                            }
+                        }
+                    }
+                } else
                     proxies.append(proxy);
             }
             annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
@@ -1355,6 +1416,17 @@
         }
     }
 
+    void attachTypeAnnotations(final Symbol sym) {
+        int numAttributes = nextChar();
+        if (numAttributes != 0) {
+            ListBuffer<TypeAnnotationProxy> proxies =
+                ListBuffer.lb();
+            for (int i = 0; i < numAttributes; i++)
+                proxies.append(readTypeAnnotation());
+            annotate.normal(new TypeAnnotationCompleter(sym, proxies.toList()));
+        }
+    }
+
     /** Attach the default value for an annotation element.
      */
     void attachAnnotationDefault(final Symbol sym) {
@@ -1401,6 +1473,111 @@
         return new CompoundAnnotationProxy(t, pairs.toList());
     }
 
+    TypeAnnotationProxy readTypeAnnotation() {
+        TypeAnnotationPosition position = readPosition();
+        CompoundAnnotationProxy proxy = readCompoundAnnotation();
+
+        return new TypeAnnotationProxy(proxy, position);
+    }
+
+    TypeAnnotationPosition readPosition() {
+        int tag = nextByte(); // TargetType tag is a byte
+
+        if (!TargetType.isValidTargetTypeValue(tag))
+            throw this.badClassFile("bad.type.annotation.value", String.format("0x%02X", tag));
+
+        TypeAnnotationPosition position = new TypeAnnotationPosition();
+        TargetType type = TargetType.fromTargetTypeValue(tag);
+
+        position.type = type;
+
+        switch (type) {
+        // instanceof
+        case INSTANCEOF:
+        // new expression
+        case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
+            position.offset = nextChar();
+            break;
+        // local variable
+        case LOCAL_VARIABLE:
+        // resource variable
+        case RESOURCE_VARIABLE:
+            int table_length = nextChar();
+            position.lvarOffset = new int[table_length];
+            position.lvarLength = new int[table_length];
+            position.lvarIndex = new int[table_length];
+
+            for (int i = 0; i < table_length; ++i) {
+                position.lvarOffset[i] = nextChar();
+                position.lvarLength[i] = nextChar();
+                position.lvarIndex[i] = nextChar();
+            }
+            break;
+        // exception parameter
+        case EXCEPTION_PARAMETER:
+            position.exception_index = nextByte();
+            break;
+        // method receiver
+        case METHOD_RECEIVER:
+            // Do nothing
+            break;
+        // type parameter
+        case CLASS_TYPE_PARAMETER:
+        case METHOD_TYPE_PARAMETER:
+            position.parameter_index = nextByte();
+            break;
+        // type parameter bound
+        case CLASS_TYPE_PARAMETER_BOUND:
+        case METHOD_TYPE_PARAMETER_BOUND:
+            position.parameter_index = nextByte();
+            position.bound_index = nextByte();
+            break;
+        // class extends or implements clause
+        case CLASS_EXTENDS:
+            position.type_index = nextChar();
+            break;
+        // throws
+        case THROWS:
+            position.type_index = nextChar();
+            break;
+        // method parameter
+        case METHOD_FORMAL_PARAMETER:
+            position.parameter_index = nextByte();
+            break;
+        // type cast
+        case CAST:
+        // method/constructor/reference type argument
+        case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+        case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+        case METHOD_REFERENCE_TYPE_ARGUMENT:
+            position.offset = nextChar();
+            position.type_index = nextByte();
+            break;
+        // We don't need to worry about these
+        case METHOD_RETURN:
+        case FIELD:
+            break;
+        case UNKNOWN:
+            throw new AssertionError("jvm.ClassReader: UNKNOWN target type should never occur!");
+        default:
+            throw new AssertionError("jvm.ClassReader: Unknown target type for position: " + position);
+        }
+
+        { // See whether there is location info and read it
+            int len = nextByte();
+            ListBuffer<Integer> loc = ListBuffer.lb();
+            for (int i = 0; i < len * TypeAnnotationPosition.TypePathEntry.bytesPerEntry; ++i)
+                loc = loc.append(nextByte());
+            position.location = TypeAnnotationPosition.getTypePathFromBinary(loc.toList());
+        }
+
+        return position;
+    }
+
     Attribute readAttributeValue() {
         char c = (char) buf[bp++];
         switch (c) {
@@ -1722,7 +1899,7 @@
                 Annotations annotations = sym.annotations;
                 List<Attribute.Compound> newList = deproxyCompoundList(l);
                 if (annotations.pendingCompletion()) {
-                    annotations.setAttributes(newList);
+                    annotations.setDeclarationAttributes(newList);
                 } else {
                     annotations.append(newList);
                 }
@@ -1732,6 +1909,39 @@
         }
     }
 
+    class TypeAnnotationCompleter extends AnnotationCompleter {
+
+        List<TypeAnnotationProxy> proxies;
+
+        TypeAnnotationCompleter(Symbol sym,
+                List<TypeAnnotationProxy> proxies) {
+            super(sym, List.<CompoundAnnotationProxy>nil());
+            this.proxies = proxies;
+        }
+
+        List<Attribute.TypeCompound> deproxyTypeCompoundList(List<TypeAnnotationProxy> proxies) {
+            ListBuffer<Attribute.TypeCompound> buf = ListBuffer.lb();
+            for (TypeAnnotationProxy proxy: proxies) {
+                Attribute.Compound compound = deproxyCompound(proxy.compound);
+                Attribute.TypeCompound typeCompound = new Attribute.TypeCompound(compound, proxy.position);
+                buf.add(typeCompound);
+            }
+            return buf.toList();
+        }
+
+        @Override
+        public void enterAnnotation() {
+            JavaFileObject previousClassFile = currentClassFile;
+            try {
+                currentClassFile = classFile;
+                List<Attribute.TypeCompound> newList = deproxyTypeCompoundList(proxies);
+                sym.annotations.setTypeAttributes(newList.prependList(sym.getRawTypeAttributes()));
+            } finally {
+                currentClassFile = previousClassFile;
+            }
+        }
+    }
+
 
 /************************************************************************
  * Reading Symbols
@@ -1826,6 +2036,7 @@
         } else
             Arrays.fill(parameterNameIndices, 0);
         haveParameterNameIndices = false;
+        sawMethodParameters = false;
     }
 
     /**
@@ -1845,12 +2056,16 @@
         // if no names were found in the class file, there's nothing more to do
         if (!haveParameterNameIndices)
             return;
-
-        int firstParam = ((sym.flags() & STATIC) == 0) ? 1 : 0;
-        // the code in readMethod may have skipped the first parameter when
-        // setting up the MethodType. If so, we make a corresponding allowance
-        // here for the position of the first parameter.  Note that this
-        // assumes the skipped parameter has a width of 1 -- i.e. it is not
+        // If we get parameter names from MethodParameters, then we
+        // don't need to skip.
+        int firstParam = 0;
+        if (!sawMethodParameters) {
+            firstParam = ((sym.flags() & STATIC) == 0) ? 1 : 0;
+            // the code in readMethod may have skipped the first
+            // parameter when setting up the MethodType. If so, we
+            // make a corresponding allowance here for the position of
+            // the first parameter.  Note that this assumes the
+            // skipped parameter has a width of 1 -- i.e. it is not
         // a double width type (long or double.)
         if (sym.name == names.init && currentOwner.hasOuterInstance()) {
             // Sometimes anonymous classes don't have an outer
@@ -1861,17 +2076,20 @@
         }
 
         if (sym.type != jvmType) {
-            // reading the method attributes has caused the symbol's type to
-            // be changed. (i.e. the Signature attribute.)  This may happen if
-            // there are hidden (synthetic) parameters in the descriptor, but
-            // not in the Signature.  The position of these hidden parameters
-            // is unspecified; for now, assume they are at the beginning, and
-            // so skip over them. The primary case for this is two hidden
-            // parameters passed into Enum constructors.
+                // reading the method attributes has caused the
+                // symbol's type to be changed. (i.e. the Signature
+                // attribute.)  This may happen if there are hidden
+                // (synthetic) parameters in the descriptor, but not
+                // in the Signature.  The position of these hidden
+                // parameters is unspecified; for now, assume they are
+                // at the beginning, and so skip over them. The
+                // primary case for this is two hidden parameters
+                // passed into Enum constructors.
             int skip = Code.width(jvmType.getParameterTypes())
                     - Code.width(sym.type.getParameterTypes());
             firstParam += skip;
         }
+        }
         List<Name> paramNames = List.nil();
         int index = firstParam;
         for (Type t: sym.type.getParameterTypes()) {
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -31,12 +31,17 @@
 import java.util.Set;
 import java.util.HashSet;
 
+import javax.lang.model.type.TypeKind;
 import javax.tools.JavaFileManager;
 import javax.tools.FileObject;
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Attribute.RetentionPolicy;
+import com.sun.tools.javac.code.Attribute.TypeCompound;
+import static com.sun.tools.javac.code.BoundKind.EXTENDS;
+import static com.sun.tools.javac.code.BoundKind.SUPER;
+import static com.sun.tools.javac.code.BoundKind.UNBOUND;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Types.UniqueType;
@@ -47,7 +52,6 @@
 import com.sun.tools.javac.jvm.Pool.Variable;
 import com.sun.tools.javac.util.*;
 
-import static com.sun.tools.javac.code.BoundKind.*;
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.TypeTag.*;
@@ -68,19 +72,17 @@
     protected static final Context.Key<ClassWriter> classWriterKey =
         new Context.Key<ClassWriter>();
 
-    private final Symtab syms;
-
     private final Options options;
 
     /** Switch: verbose output.
      */
     private boolean verbose;
 
-    /** Switch: scramble private names.
+    /** Switch: scramble private field names.
      */
     private boolean scramble;
 
-    /** Switch: scramble private names.
+    /** Switch: scramble all field names.
      */
     private boolean scrambleAll;
 
@@ -96,7 +98,7 @@
      */
     private boolean genCrt;
 
-    /** Switch: describe the generated stackmap
+    /** Switch: describe the generated stackmap.
      */
     boolean debugstackmap;
 
@@ -114,7 +116,7 @@
     private Types types;
 
     /** The initial sizes of the data and constant pool buffers.
-     *  sizes are increased when buffers get full.
+     *  Sizes are increased when buffers get full.
      */
     static final int DATA_BUF_SIZE = 0x0fff0;
     static final int POOL_BUF_SIZE = 0x1fff0;
@@ -127,10 +129,6 @@
      */
     ByteBuffer poolbuf = new ByteBuffer(POOL_BUF_SIZE);
 
-    /** An output buffer for type signatures.
-     */
-    ByteBuffer sigbuf = new ByteBuffer();
-
     /** The constant pool.
      */
     Pool pool;
@@ -159,6 +157,9 @@
     /** Access to files. */
     private final JavaFileManager fileManager;
 
+    /** Sole signature generator */
+    private final CWSignatureGenerator signatureGen;
+
     /** The tags and constants used in compressed stackmap. */
     static final int SAME_FRAME_SIZE = 64;
     static final int SAME_LOCALS_1_STACK_ITEM_EXTENDED = 247;
@@ -181,12 +182,12 @@
 
         log = Log.instance(context);
         names = Names.instance(context);
-        syms = Symtab.instance(context);
         options = Options.instance(context);
         target = Target.instance(context);
         source = Source.instance(context);
         types = Types.instance(context);
         fileManager = context.get(JavaFileManager.class);
+        signatureGen = new CWSignatureGenerator(types);
 
         verbose        = options.isSet(VERBOSE);
         scramble       = options.isSet("-scramble");
@@ -272,170 +273,81 @@
         buf.elems[adr+3] = (byte)((x      ) & 0xFF);
     }
 
-/******************************************************************
- * Signature Generation
- ******************************************************************/
-
-    /** Assemble signature of given type in string buffer.
+    /**
+     * Signature Generation
      */
-    void assembleSig(Type type) {
-        switch (type.getTag()) {
-        case BYTE:
-            sigbuf.appendByte('B');
-            break;
-        case SHORT:
-            sigbuf.appendByte('S');
-            break;
-        case CHAR:
-            sigbuf.appendByte('C');
-            break;
-        case INT:
-            sigbuf.appendByte('I');
-            break;
-        case LONG:
-            sigbuf.appendByte('J');
-            break;
-        case FLOAT:
-            sigbuf.appendByte('F');
-            break;
-        case DOUBLE:
-            sigbuf.appendByte('D');
-            break;
-        case BOOLEAN:
-            sigbuf.appendByte('Z');
-            break;
-        case VOID:
-            sigbuf.appendByte('V');
-            break;
-        case CLASS:
-            sigbuf.appendByte('L');
-            assembleClassSig(type);
-            sigbuf.appendByte(';');
-            break;
-        case ARRAY:
-            ArrayType at = (ArrayType)type;
-            sigbuf.appendByte('[');
-            assembleSig(at.elemtype);
-            break;
-        case METHOD:
-            MethodType mt = (MethodType)type;
-            sigbuf.appendByte('(');
-            assembleSig(mt.argtypes);
-            sigbuf.appendByte(')');
-            assembleSig(mt.restype);
-            if (hasTypeVar(mt.thrown)) {
-                for (List<Type> l = mt.thrown; l.nonEmpty(); l = l.tail) {
-                    sigbuf.appendByte('^');
-                    assembleSig(l.head);
-                }
+    private class CWSignatureGenerator extends Types.SignatureGenerator {
+
+        /**
+         * An output buffer for type signatures.
+         */
+        ByteBuffer sigbuf = new ByteBuffer();
+
+        CWSignatureGenerator(Types types) {
+            super(types);
+        }
+
+        /**
+         * Assemble signature of given type in string buffer.
+         * Check for uninitialized types before calling the general case.
+         */
+        @Override
+        public void assembleSig(Type type) {
+            type = type.unannotatedType();
+            switch (type.getTag()) {
+                case UNINITIALIZED_THIS:
+                case UNINITIALIZED_OBJECT:
+                    // we don't yet have a spec for uninitialized types in the
+                    // local variable table
+                    assembleSig(types.erasure(((UninitializedType)type).qtype));
+                    break;
+                default:
+                    super.assembleSig(type);
             }
-            break;
-        case WILDCARD: {
-            WildcardType ta = (WildcardType) type;
-            switch (ta.kind) {
-            case SUPER:
-                sigbuf.appendByte('-');
-                assembleSig(ta.type);
-                break;
-            case EXTENDS:
-                sigbuf.appendByte('+');
-                assembleSig(ta.type);
-                break;
-            case UNBOUND:
-                sigbuf.appendByte('*');
-                break;
-            default:
-                throw new AssertionError(ta.kind);
-            }
-            break;
+        }
+
+        @Override
+        protected void append(char ch) {
+            sigbuf.appendByte(ch);
+        }
+
+        @Override
+        protected void append(byte[] ba) {
+            sigbuf.appendBytes(ba);
+        }
+
+        @Override
+        protected void append(Name name) {
+            sigbuf.appendName(name);
         }
-        case TYPEVAR:
-            sigbuf.appendByte('T');
-            sigbuf.appendName(type.tsym.name);
-            sigbuf.appendByte(';');
-            break;
-        case FORALL:
-            ForAll ft = (ForAll)type;
-            assembleParamsSig(ft.tvars);
-            assembleSig(ft.qtype);
-            break;
-        case UNINITIALIZED_THIS:
-        case UNINITIALIZED_OBJECT:
-            // we don't yet have a spec for uninitialized types in the
-            // local variable table
-            assembleSig(types.erasure(((UninitializedType)type).qtype));
-            break;
-        default:
-            throw new AssertionError("typeSig " + type.getTag());
+
+        @Override
+        protected void classReference(ClassSymbol c) {
+            enterInner(c);
+        }
+
+        private void reset() {
+            sigbuf.reset();
+        }
+
+        private Name toName() {
+            return sigbuf.toName(names);
+        }
+
+        private boolean isEmpty() {
+            return sigbuf.length == 0;
         }
     }
 
-    boolean hasTypeVar(List<Type> l) {
-        while (l.nonEmpty()) {
-            if (l.head.hasTag(TYPEVAR)) return true;
-            l = l.tail;
-        }
-        return false;
-    }
-
-    void assembleClassSig(Type type) {
-        ClassType ct = (ClassType)type;
-        ClassSymbol c = (ClassSymbol)ct.tsym;
-        enterInner(c);
-        Type outer = ct.getEnclosingType();
-        if (outer.allparams().nonEmpty()) {
-            boolean rawOuter =
-                c.owner.kind == MTH || // either a local class
-                c.name == names.empty; // or anonymous
-            assembleClassSig(rawOuter
-                             ? types.erasure(outer)
-                             : outer);
-            sigbuf.appendByte('.');
-            Assert.check(c.flatname.startsWith(c.owner.enclClass().flatname));
-            sigbuf.appendName(rawOuter
-                              ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength()+1,c.flatname.getByteLength())
-                              : c.name);
-        } else {
-            sigbuf.appendBytes(externalize(c.flatname));
-        }
-        if (ct.getTypeArguments().nonEmpty()) {
-            sigbuf.appendByte('<');
-            assembleSig(ct.getTypeArguments());
-            sigbuf.appendByte('>');
-        }
-    }
-
-
-    void assembleSig(List<Type> types) {
-        for (List<Type> ts = types; ts.nonEmpty(); ts = ts.tail)
-            assembleSig(ts.head);
-    }
-
-    void assembleParamsSig(List<Type> typarams) {
-        sigbuf.appendByte('<');
-        for (List<Type> ts = typarams; ts.nonEmpty(); ts = ts.tail) {
-            TypeVar tvar = (TypeVar)ts.head;
-            sigbuf.appendName(tvar.tsym.name);
-            List<Type> bounds = types.getBounds(tvar);
-            if ((bounds.head.tsym.flags() & INTERFACE) != 0) {
-                sigbuf.appendByte(':');
-            }
-            for (List<Type> l = bounds; l.nonEmpty(); l = l.tail) {
-                sigbuf.appendByte(':');
-                assembleSig(l.head);
-            }
-        }
-        sigbuf.appendByte('>');
-    }
-
-    /** Return signature of given type
+    /**
+     * Return signature of given type
      */
     Name typeSig(Type type) {
-        Assert.check(sigbuf.length == 0);
+        Assert.check(signatureGen.isEmpty());
         //- System.out.println(" ? " + type);
-        assembleSig(type);
-        Name n = sigbuf.toName(names);
-        sigbuf.reset();
+        signatureGen.assembleSig(type);
+        Name n = signatureGen.toName();
+        signatureGen.reset();
         //- System.out.println("   " + n);
         return n;
     }
@@ -482,10 +394,8 @@
         while (i < pool.pp) {
             Object value = pool.pool[i];
             Assert.checkNonNull(value);
-            if (value instanceof Method)
-                value = ((Method)value).m;
-            else if (value instanceof Variable)
-                value = ((Variable)value).v;
+            if (value instanceof Method || value instanceof Variable)
+                value = ((DelegatedSymbol)value).getUnderlyingSymbol();
 
             if (value instanceof MethodSymbol) {
                 MethodSymbol m = (MethodSymbol)value;
@@ -713,7 +623,7 @@
             (flags & (SYNTHETIC|BRIDGE)) != SYNTHETIC &&
             (flags & ANONCONSTR) == 0 &&
             (!types.isSameType(sym.type, sym.erasure(types)) ||
-             hasTypeVar(sym.type.getThrownTypes()))) {
+            signatureGen.hasTypeVar(sym.type.getThrownTypes()))) {
             // note that a local class with captured variables
             // will get a signature attribute
             int alenIdx = writeAttr(names.Signature);
@@ -722,9 +632,42 @@
             acount++;
         }
         acount += writeJavaAnnotations(sym.getRawAttributes());
+        acount += writeTypeAnnotations(sym.getRawTypeAttributes());
         return acount;
     }
 
+    /**
+     * Write method parameter names attribute.
+     */
+    int writeMethodParametersAttr(MethodSymbol m) {
+        MethodType ty = m.externalType(types).asMethodType();
+        final int allparams = ty.argtypes.size();
+        if (m.params != null && allparams != 0) {
+            final int attrIndex = writeAttr(names.MethodParameters);
+            databuf.appendByte(allparams);
+            // Write extra parameters first
+            for (VarSymbol s : m.extraParams) {
+                final int flags =
+                    ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
+                    ((int) m.flags() & SYNTHETIC);
+                databuf.appendChar(pool.put(s.name));
+                databuf.appendChar(flags);
+            }
+            // Now write the real parameters
+            for (VarSymbol s : m.params) {
+                final int flags =
+                    ((int) s.flags() & (FINAL | SYNTHETIC | MANDATED)) |
+                    ((int) m.flags() & SYNTHETIC);
+                databuf.appendChar(pool.put(s.name));
+                databuf.appendChar(flags);
+            }
+            endAttr(attrIndex);
+            return 1;
+        } else
+            return 0;
+    }
+
+
     /** Write method parameter annotations;
      *  return number of attributes written.
      */
@@ -816,6 +759,76 @@
         return attrCount;
     }
 
+    int writeTypeAnnotations(List<Attribute.TypeCompound> typeAnnos) {
+        if (typeAnnos.isEmpty()) return 0;
+
+        ListBuffer<Attribute.TypeCompound> visibles = ListBuffer.lb();
+        ListBuffer<Attribute.TypeCompound> invisibles = ListBuffer.lb();
+
+        for (Attribute.TypeCompound tc : typeAnnos) {
+            if (tc.position == null || tc.position.type == TargetType.UNKNOWN) {
+                boolean found = false;
+                // TODO: the position for the container annotation of a
+                // repeating type annotation has to be set.
+                // This cannot be done when the container is created, because
+                // then the position is not determined yet.
+                // How can we link these pieces better together?
+                if (tc.values.size() == 1) {
+                    Pair<MethodSymbol, Attribute> val = tc.values.get(0);
+                    if (val.fst.getSimpleName().contentEquals("value") &&
+                            val.snd instanceof Attribute.Array) {
+                        Attribute.Array arr = (Attribute.Array) val.snd;
+                        if (arr.values.length != 0 &&
+                                arr.values[0] instanceof Attribute.TypeCompound) {
+                            TypeCompound atycomp = (Attribute.TypeCompound) arr.values[0];
+                            if (atycomp.position.type != TargetType.UNKNOWN) {
+                                tc.position = atycomp.position;
+                                found = true;
+                            }
+                        }
+                    }
+                }
+                if (!found) {
+                    // This happens for nested types like @A Outer. @B Inner.
+                    // For method parameters we get the annotation twice! Once with
+                    // a valid position, once unknown.
+                    // TODO: find a cleaner solution.
+                    // System.err.println("ClassWriter: Position UNKNOWN in type annotation: " + tc);
+                    continue;
+                }
+            }
+            if (!tc.position.emitToClassfile())
+                continue;
+            switch (types.getRetention(tc)) {
+            case SOURCE: break;
+            case CLASS: invisibles.append(tc); break;
+            case RUNTIME: visibles.append(tc); break;
+            default: ;// /* fail soft */ throw new AssertionError(vis);
+            }
+        }
+
+        int attrCount = 0;
+        if (visibles.length() != 0) {
+            int attrIndex = writeAttr(names.RuntimeVisibleTypeAnnotations);
+            databuf.appendChar(visibles.length());
+            for (Attribute.TypeCompound p : visibles)
+                writeTypeAnnotation(p);
+            endAttr(attrIndex);
+            attrCount++;
+        }
+
+        if (invisibles.length() != 0) {
+            int attrIndex = writeAttr(names.RuntimeInvisibleTypeAnnotations);
+            databuf.appendChar(invisibles.length());
+            for (Attribute.TypeCompound p : invisibles)
+                writeTypeAnnotation(p);
+            endAttr(attrIndex);
+            attrCount++;
+        }
+
+        return attrCount;
+    }
+
     /** A visitor to write an attribute including its leading
      *  single-character marker.
      */
@@ -892,6 +905,94 @@
             p.snd.accept(awriter);
         }
     }
+
+    void writeTypeAnnotation(Attribute.TypeCompound c) {
+        writePosition(c.position);
+        writeCompoundAttribute(c);
+    }
+
+    void writePosition(TypeAnnotationPosition p) {
+        databuf.appendByte(p.type.targetTypeValue()); // TargetType tag is a byte
+        switch (p.type) {
+        // instanceof
+        case INSTANCEOF:
+        // new expression
+        case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
+            databuf.appendChar(p.offset);
+            break;
+        // local variable
+        case LOCAL_VARIABLE:
+        // resource variable
+        case RESOURCE_VARIABLE:
+            databuf.appendChar(p.lvarOffset.length);  // for table length
+            for (int i = 0; i < p.lvarOffset.length; ++i) {
+                databuf.appendChar(p.lvarOffset[i]);
+                databuf.appendChar(p.lvarLength[i]);
+                databuf.appendChar(p.lvarIndex[i]);
+            }
+            break;
+        // exception parameter
+        case EXCEPTION_PARAMETER:
+            databuf.appendByte(p.exception_index);
+            break;
+        // method receiver
+        case METHOD_RECEIVER:
+            // Do nothing
+            break;
+        // type parameter
+        case CLASS_TYPE_PARAMETER:
+        case METHOD_TYPE_PARAMETER:
+            databuf.appendByte(p.parameter_index);
+            break;
+        // type parameter bound
+        case CLASS_TYPE_PARAMETER_BOUND:
+        case METHOD_TYPE_PARAMETER_BOUND:
+            databuf.appendByte(p.parameter_index);
+            databuf.appendByte(p.bound_index);
+            break;
+        // class extends or implements clause
+        case CLASS_EXTENDS:
+            databuf.appendChar(p.type_index);
+            break;
+        // throws
+        case THROWS:
+            databuf.appendChar(p.type_index);
+            break;
+        // method parameter
+        case METHOD_FORMAL_PARAMETER:
+            databuf.appendByte(p.parameter_index);
+            break;
+        // type cast
+        case CAST:
+        // method/constructor/reference type argument
+        case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+        case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+        case METHOD_REFERENCE_TYPE_ARGUMENT:
+            databuf.appendChar(p.offset);
+            databuf.appendByte(p.type_index);
+            break;
+        // We don't need to worry about these
+        case METHOD_RETURN:
+        case FIELD:
+            break;
+        case UNKNOWN:
+            throw new AssertionError("jvm.ClassWriter: UNKNOWN target type should never occur!");
+        default:
+            throw new AssertionError("jvm.ClassWriter: Unknown target type for position: " + p);
+        }
+
+        { // Append location data for generics/arrays.
+            databuf.appendByte(p.location.size());
+            java.util.List<Integer> loc = TypeAnnotationPosition.getBinaryFromTypePath(p.location);
+            for (int i : loc)
+                databuf.appendByte((byte)i);
+        }
+    }
+
 /**********************************************************************
  * Writing Objects
  **********************************************************************/
@@ -1034,6 +1135,8 @@
             endAttr(alenIdx);
             acount++;
         }
+        if (options.isSet(PARAMETERS))
+            acount += writeMethodParametersAttr(m);
         acount += writeMemberAttrs(m);
         acount += writeParameterAttrs(m);
         endAttrs(acountIdx, acount);
@@ -1539,7 +1642,7 @@
         Assert.check((c.flags() & COMPOUND) == 0);
         databuf.reset();
         poolbuf.reset();
-        sigbuf.reset();
+        signatureGen.reset();
         pool = c.pool;
         innerClasses = null;
         innerClassesQueue = null;
@@ -1600,12 +1703,12 @@
         if (sigReq) {
             Assert.check(source.allowGenerics());
             int alenIdx = writeAttr(names.Signature);
-            if (typarams.length() != 0) assembleParamsSig(typarams);
-            assembleSig(supertype);
+            if (typarams.length() != 0) signatureGen.assembleParamsSig(typarams);
+            signatureGen.assembleSig(supertype);
             for (List<Type> l = interfaces; l.nonEmpty(); l = l.tail)
-                assembleSig(l.head);
-            databuf.appendChar(pool.put(sigbuf.toName(names)));
-            sigbuf.reset();
+                signatureGen.assembleSig(l.head);
+            databuf.appendChar(pool.put(signatureGen.toName()));
+            signatureGen.reset();
             endAttr(alenIdx);
             acount++;
         }
@@ -1637,6 +1740,7 @@
 
         acount += writeFlagAttrs(c.flags());
         acount += writeJavaAnnotations(c.getRawAttributes());
+        acount += writeTypeAnnotations(c.getRawTypeAttributes());
         acount += writeEnclosingMethodAttribute(c);
         acount += writeExtraClassAttributes(c);
 
--- a/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -1924,17 +1924,70 @@
                 if (length < Character.MAX_VALUE) {
                     v.length = length;
                     putVar(v);
+                    fillLocalVarPosition(v);
                 }
             }
         }
         state.defined.excl(adr);
     }
 
+    private void fillLocalVarPosition(LocalVar lv) {
+        if (lv == null || lv.sym == null
+                || lv.sym.annotations.isTypesEmpty())
+            return;
+        for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) {
+            TypeAnnotationPosition p = ta.position;
+            p.lvarOffset = new int[] { (int)lv.start_pc };
+            p.lvarLength = new int[] { (int)lv.length };
+            p.lvarIndex = new int[] { (int)lv.reg };
+            p.isValidOffset = true;
+        }
+    }
+
+    // Method to be called after compressCatchTable to
+    // fill in the exception table index for type
+    // annotations on exception parameters.
+    public void fillExceptionParameterPositions() {
+        for (int i = 0; i < varBufferSize; ++i) {
+            LocalVar lv = varBuffer[i];
+            if (lv == null || lv.sym == null
+                    || lv.sym.annotations.isTypesEmpty()
+                    || !lv.sym.isExceptionParameter())
+                return;
+
+            int exidx = findExceptionIndex(lv);
+
+            for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) {
+                TypeAnnotationPosition p = ta.position;
+                p.exception_index = exidx;
+            }
+        }
+    }
+
+    private int findExceptionIndex(LocalVar lv) {
+        List<char[]> iter = catchInfo.toList();
+        int len = catchInfo.length();
+        for (int i = 0; i < len; ++i) {
+            char[] catchEntry = iter.head;
+            iter = iter.tail;
+            char handlerpc = catchEntry[2];
+            if (lv.start_pc == handlerpc + 1) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
     /** Put a live variable range into the buffer to be output to the
      *  class file.
      */
     void putVar(LocalVar var) {
-        if (!varDebugInfo) return;
+        // Keep local variables if
+        // 1) we need them for debug information
+        // 2) it is an exception type and it contains type annotations
+        if (!varDebugInfo &&
+                (!var.sym.isExceptionParameter() ||
+                var.sym.annotations.isTypesEmpty())) return;
         if ((var.sym.flags() & Flags.SYNTHETIC) != 0) return;
         if (varBuffer == null)
             varBuffer = new LocalVar[20];
--- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -513,7 +513,8 @@
         // that contains them as its body.
         if (clinitCode.length() != 0) {
             MethodSymbol clinit = new MethodSymbol(
-                STATIC, names.clinit,
+                STATIC | (c.flags() & STRICTFP),
+                names.clinit,
                 new MethodType(
                     List.<Type>nil(), syms.voidType,
                     List.<Type>nil(), syms.methodClass),
@@ -1016,8 +1017,11 @@
                     code.frameBeforeLast = null;
                 }
 
-                //compress exception table
+                // Compress exception table
                 code.compressCatchTable();
+
+                // Fill in type annotation positions for exception parameters
+                code.fillExceptionParameterPositions();
             }
         }
 
@@ -1738,6 +1742,7 @@
  *************************************************************************/
 
     public void visitApply(JCMethodInvocation tree) {
+        setTypeAnnotationPositions(tree.pos);
         // Generate code for method.
         Item m = genExpr(tree.meth, methodType);
         // Generate code for all arguments, where the expected types are
@@ -1775,10 +1780,48 @@
         result = items.makeStackItem(pt);
     }
 
+   private void setTypeAnnotationPositions(int treePos) {
+       MethodSymbol meth = code.meth;
+
+       for (Attribute.TypeCompound ta : meth.getRawTypeAttributes()) {
+           if (ta.position.pos == treePos) {
+               ta.position.offset = code.cp;
+               ta.position.lvarOffset = new int[] { code.cp };
+               ta.position.isValidOffset = true;
+           }
+       }
+
+       if (code.meth.getKind() != javax.lang.model.element.ElementKind.CONSTRUCTOR
+               && code.meth.getKind() != javax.lang.model.element.ElementKind.STATIC_INIT)
+           return;
+
+       for (Attribute.TypeCompound ta : meth.owner.getRawTypeAttributes()) {
+           if (ta.position.pos == treePos) {
+               ta.position.offset = code.cp;
+               ta.position.lvarOffset = new int[] { code.cp };
+               ta.position.isValidOffset = true;
+           }
+       }
+
+       ClassSymbol clazz = meth.enclClass();
+       for (Symbol s : new com.sun.tools.javac.model.FilteredMemberList(clazz.members())) {
+           if (!s.getKind().isField())
+               continue;
+           for (Attribute.TypeCompound ta : s.getRawTypeAttributes()) {
+               if (ta.position.pos == treePos) {
+                   ta.position.offset = code.cp;
+                   ta.position.lvarOffset = new int[] { code.cp };
+                   ta.position.isValidOffset = true;
+               }
+           }
+       }
+   }
+
     public void visitNewClass(JCNewClass tree) {
         // Enclosing instances or anonymous classes should have been eliminated
         // by now.
         Assert.check(tree.encl == null && tree.def == null);
+        setTypeAnnotationPositions(tree.pos);
 
         code.emitop2(new_, makeRef(tree.pos(), tree.type));
         code.emitop0(dup);
@@ -1793,6 +1836,7 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
+        setTypeAnnotationPositions(tree.pos);
 
         if (tree.elems != null) {
             Type elemtype = types.elemtype(tree.type);
@@ -2122,6 +2166,7 @@
         }
 
     public void visitTypeCast(JCTypeCast tree) {
+        setTypeAnnotationPositions(tree.pos);
         result = genExpr(tree.expr, tree.clazz.type).load();
         // Additional code is only needed if we cast to a reference type
         // which is not statically a supertype of the expression's type.
@@ -2138,6 +2183,7 @@
     }
 
     public void visitTypeTest(JCInstanceOf tree) {
+        setTypeAnnotationPositions(tree.pos);
         genExpr(tree.expr, tree.expr.type).load();
         code.emitop2(instanceof_, makeRef(tree.pos(), tree.clazz.type));
         result = items.makeStackItem(syms.booleanType);
@@ -2184,7 +2230,7 @@
             code.emitop2(ldc2, makeRef(tree.pos(), tree.selected.type));
             result = items.makeStackItem(pt);
             return;
-        }
+       }
 
         Symbol ssym = TreeInfo.symbol(tree.selected);
 
--- a/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -158,7 +158,7 @@
             return false;
 
         /* temporary code for backwards compatibility */
-        for (Attribute.Compound a: c.annotations.getAttributes()) {
+        for (Attribute.Compound a: c.annotations.getDeclarationAttributes()) {
             if (a.type.tsym == syms.nativeHeaderType_old.tsym)
                 return true;
         }
@@ -167,7 +167,7 @@
         for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
             if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0)
                 return true;
-            for (Attribute.Compound a: i.sym.annotations.getAttributes()) {
+            for (Attribute.Compound a: i.sym.annotations.getDeclarationAttributes()) {
                 if (a.type.tsym == syms.nativeHeaderType.tsym)
                     return true;
             }
--- a/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Pool.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -140,23 +140,23 @@
         return n == null ? -1 : n.intValue();
     }
 
-    static class Method extends DelegatedSymbol {
-        MethodSymbol m;
+    static class Method extends DelegatedSymbol<MethodSymbol> {
         UniqueType uniqueType;
         Method(MethodSymbol m, Types types) {
             super(m);
-            this.m = m;
             this.uniqueType = new UniqueType(m.type, types);
         }
-        public boolean equals(Object other) {
-            if (!(other instanceof Method)) return false;
-            MethodSymbol o = ((Method)other).m;
+        public boolean equals(Object any) {
+            if (!(any instanceof Method)) return false;
+            MethodSymbol o = ((Method)any).other;
+            MethodSymbol m = this.other;
             return
                 o.name == m.name &&
                 o.owner == m.owner &&
-                ((Method)other).uniqueType.equals(uniqueType);
+                ((Method)any).uniqueType.equals(uniqueType);
         }
         public int hashCode() {
+            MethodSymbol m = this.other;
             return
                 m.name.hashCode() * 33 +
                 m.owner.hashCode() * 9 +
@@ -173,21 +173,21 @@
         }
 
         @Override
-        public boolean equals(Object other) {
-            if (!super.equals(other)) return false;
-            if (!(other instanceof DynamicMethod)) return false;
-            DynamicMethodSymbol dm1 = (DynamicMethodSymbol)m;
-            DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)other).m;
+        public boolean equals(Object any) {
+            if (!super.equals(any)) return false;
+            if (!(any instanceof DynamicMethod)) return false;
+            DynamicMethodSymbol dm1 = (DynamicMethodSymbol)other;
+            DynamicMethodSymbol dm2 = (DynamicMethodSymbol)((DynamicMethod)any).other;
             return dm1.bsm == dm2.bsm &&
                         dm1.bsmKind == dm2.bsmKind &&
                         Arrays.equals(uniqueStaticArgs,
-                            ((DynamicMethod)other).uniqueStaticArgs);
+                            ((DynamicMethod)any).uniqueStaticArgs);
         }
 
         @Override
         public int hashCode() {
             int hash = super.hashCode();
-            DynamicMethodSymbol dm = (DynamicMethodSymbol)m;
+            DynamicMethodSymbol dm = (DynamicMethodSymbol)other;
             hash += dm.bsmKind * 7 +
                     dm.bsm.hashCode() * 11;
             for (int i = 0; i < dm.staticArgs.length; i++) {
@@ -209,23 +209,23 @@
         }
     }
 
-    static class Variable extends DelegatedSymbol {
-        VarSymbol v;
+    static class Variable extends DelegatedSymbol<VarSymbol> {
         UniqueType uniqueType;
         Variable(VarSymbol v, Types types) {
             super(v);
-            this.v = v;
             this.uniqueType = new UniqueType(v.type, types);
         }
-        public boolean equals(Object other) {
-            if (!(other instanceof Variable)) return false;
-            VarSymbol o = ((Variable)other).v;
+        public boolean equals(Object any) {
+            if (!(any instanceof Variable)) return false;
+            VarSymbol o = ((Variable)any).other;
+            VarSymbol v = other;
             return
                 o.name == v.name &&
                 o.owner == v.owner &&
-                ((Variable)other).uniqueType.equals(uniqueType);
+                ((Variable)any).uniqueType.equals(uniqueType);
         }
         public int hashCode() {
+            VarSymbol v = other;
             return
                 v.name.hashCode() * 33 +
                 v.owner.hashCode() * 9 +
@@ -293,6 +293,7 @@
                     expectedKind = Kinds.MTH;
                     break;
                 case ClassFile.REF_invokeStatic:
+                    interfaceOwner = true;
                     staticOk = true;
                 case ClassFile.REF_invokeVirtual:
                 case ClassFile.REF_invokeSpecial:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/jvm/Profile.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2002, 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.jvm;
+
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Options;
+import java.util.EnumSet;
+import java.util.Set;
+
+import static com.sun.tools.javac.main.Option.PROFILE;
+
+/** The target profile.
+ *
+ *  <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>
+ */
+public enum Profile {
+    COMPACT1("compact1", 1, Target.JDK1_8),
+    COMPACT2("compact2", 2, Target.JDK1_8),
+    COMPACT3("compact3", 3, Target.JDK1_8),
+
+    DEFAULT {
+        @Override
+        public boolean isValid(Target t) {
+            return true;
+        }
+    };
+
+    private static final Context.Key<Profile> profileKey =
+        new Context.Key<Profile>();
+
+    public static Profile instance(Context context) {
+        Profile instance = context.get(profileKey);
+        if (instance == null) {
+            Options options = Options.instance(context);
+            String profileString = options.get(PROFILE);
+            if (profileString != null) instance = lookup(profileString);
+            if (instance == null) instance = DEFAULT;
+            context.put(profileKey, instance);
+        }
+        return instance;
+    }
+
+    public final String name;
+    public final int value;
+    final Set<Target> targets;
+
+    Profile() {
+        name = null;
+        value = Integer.MAX_VALUE;
+        targets = null;
+    }
+
+    Profile(String name, int value, Target t, Target... targets) {
+        this.name = name;
+        this.value = value;
+        this.targets = EnumSet.of(t, targets);
+    }
+
+    public static Profile lookup(String name) {
+        // the set of values is small enough to do linear search
+        for (Profile p: values()) {
+            if (name.equals(p.name))
+                return p;
+        }
+        return null;
+    }
+
+    public static Profile lookup(int value) {
+        // the set of values is small enough to do linear search
+        for (Profile p: values()) {
+            if (value == p.value)
+                return p;
+        }
+        return null;
+    }
+
+    public boolean isValid(Target t) {
+        return targets.contains(t);
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/jvm/Target.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Target.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -31,7 +31,7 @@
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.util.*;
 
-import static com.sun.tools.javac.main.Option.*;
+import static com.sun.tools.javac.main.Option.TARGET;
 
 /** The classfile version target.
  *
@@ -48,17 +48,6 @@
     /** J2SE1.4 = Merlin. */
     JDK1_4("1.4", 48, 0),
 
-    /** Support for the JSR14 prototype compiler (targeting 1.4 VMs
-     *  augmented with a few support classes).  This is a transitional
-     *  option that will not be supported in the product.  */
-    JSR14("jsr14", 48, 0),
-
-    /** The following are undocumented transitional targets that we
-     *  had used to test VM fixes in update releases.  We do not
-     *  promise to retain support for them.  */
-    JDK1_4_1("1.4.1", 48, 0),
-    JDK1_4_2("1.4.2", 48, 0),
-
     /** Tiger. */
     JDK1_5("1.5", 49, 0),
 
@@ -175,23 +164,23 @@
         return compareTo(JDK1_5) >= 0;
     }
 
-    /** Beginning in -target 1.4.2, we make synthetic variables
+    /** Beginning in -target 1.5, we make synthetic variables
      *  package-private instead of private.  This is to prevent the
      *  necessity of access methods, which effectively relax the
      *  protection of the field but bloat the class files and affect
      *  execution.
      */
     public boolean usePrivateSyntheticFields() {
-        return compareTo(JDK1_4_2) < 0;
+        return compareTo(JDK1_5) < 0;
     }
 
     /** Sometimes we need to create a field to cache a value like a
-     *  class literal of the assertions flag.  In -target 1.4.2 and
+     *  class literal of the assertions flag.  In -target 1.5 and
      *  later we create a new synthetic class for this instead of
      *  using the outermost class.  See 4401576.
      */
     public boolean useInnerCacheClass() {
-        return compareTo(JDK1_4_2) >= 0;
+        return compareTo(JDK1_5) >= 0;
     }
 
     /** Return true if cldc-style stack maps need to be generated. */
@@ -276,7 +265,7 @@
      *  See 4468823
      */
     public boolean classLiteralsNoInit() {
-        return compareTo(JDK1_4_2) >= 0;
+        return compareTo(JDK1_5) >= 0;
     }
 
     /** Although we may not have support for class literals, when we
@@ -300,22 +289,10 @@
         return compareTo(JDK1_5) >= 0;
     }
 
-    /** For bootstrapping javac only, we do without java.lang.Enum if
-     *  necessary.
-     */
-    public boolean compilerBootstrap(Symbol c) {
-        return
-            this == JSR14 &&
-            (c.flags() & Flags.ENUM) != 0 &&
-            c.flatName().toString().startsWith("com.sun.tools.")
-            // && !Target.class.getSuperclass().getName().equals("java.lang.Enum")
-            ;
-    }
-
     /** In J2SE1.5.0, we introduced the "EnclosingMethod" attribute
      *  for improved reflection support.
      */
     public boolean hasEnclosingMethodAttribute() {
-        return compareTo(JDK1_5) >= 0 || this == JSR14;
+        return compareTo(JDK1_5) >= 0;
     }
 }
--- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -513,7 +513,7 @@
      */
     public CompileState shouldStopPolicyIfNoError;
 
-    /** A queue of all as yet unattributed classes.oLo
+    /** A queue of all as yet unattributed classes.
      */
     public Todo todo;
 
@@ -629,6 +629,8 @@
             if (!taskListener.isEmpty()) {
                 TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename);
                 taskListener.started(e);
+                keepComments = true;
+                genEndPos = true;
             }
             Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
             tree = parser.parseCompilationUnit();
--- a/src/share/classes/com/sun/tools/javac/main/Main.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/main/Main.java	Tue Jul 02 10:13:00 2013 +0100
@@ -49,6 +49,7 @@
 import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.file.CacheFSInfo;
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.processing.AnnotationProcessingError;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
@@ -76,7 +77,7 @@
 
     /** The log to use for diagnostic output.
      */
-    Log log;
+    public Log log;
 
     /**
      * If true, certain errors will cause an exception, such as command line
@@ -165,6 +166,7 @@
         this.ownName = name;
         this.out = out;
     }
+
     /** A table of all options that's passed to the JavaCompiler constructor.  */
     private Options options = null;
 
@@ -307,6 +309,15 @@
             }
         }
 
+        String profileString = options.get(PROFILE);
+        if (profileString != null) {
+            Profile profile = Profile.lookup(profileString);
+            if (!profile.isValid(target)) {
+                warning("warn.profile.target.conflict", profileString, target.name);
+                return null;
+            }
+        }
+
         // handle this here so it works even if no other options given
         String showClass = options.get("showClass");
         if (showClass != null) {
--- a/src/share/classes/com/sun/tools/javac/main/Option.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/main/Option.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -40,6 +40,7 @@
 import com.sun.tools.javac.code.Lint;
 import com.sun.tools.javac.code.Source;
 import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.util.Log;
@@ -176,6 +177,8 @@
 
     PROCESSORPATH("-processorpath", "opt.arg.path", "opt.processorpath", STANDARD, FILEMANAGER),
 
+    PARAMETERS("-parameters","opt.parameters", STANDARD, BASIC),
+
     D("-d", "opt.arg.directory", "opt.d", STANDARD, FILEMANAGER),
 
     S("-s", "opt.arg.directory", "opt.sourceDest", STANDARD, FILEMANAGER),
@@ -216,6 +219,18 @@
         }
     },
 
+    PROFILE("-profile", "opt.arg.profile", "opt.profile", STANDARD, BASIC) {
+        @Override
+        public boolean process(OptionHelper helper, String option, String operand) {
+            Profile profile = Profile.lookup(operand);
+            if (profile == null) {
+                helper.error("err.invalid.profile", operand);
+                return true;
+            }
+            return super.process(helper, option, operand);
+        }
+    },
+
     VERSION("-version", "opt.version", STANDARD, INFO) {
         @Override
         public boolean process(OptionHelper helper, String option) {
@@ -309,7 +324,7 @@
 
     // This option exists only for the purpose of documenting itself.
     // It's actually implemented by the launcher.
-    J("-J", "opt.arg.flag", "opt.J", STANDARD, INFO) {
+    J("-J", "opt.arg.flag", "opt.J", STANDARD, INFO, true) {
         @Override
         public boolean process(OptionHelper helper, String option) {
             throw new AssertionError
@@ -414,7 +429,7 @@
 
     // This option exists only for the purpose of documenting itself.
     // It's actually implemented by the CommandLine class.
-    AT("@", "opt.arg.file", "opt.AT", STANDARD, INFO) {
+    AT("@", "opt.arg.file", "opt.AT", STANDARD, INFO, true) {
         @Override
         public boolean process(OptionHelper helper, String option) {
             throw new AssertionError("the @ flag should be caught by CommandLine.");
--- a/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -273,7 +273,7 @@
 
     /**
      * ExceptionProxy for MirroredTypeException.
-     * The toString, hashCode, and equals methods foward to the underlying
+     * The toString, hashCode, and equals methods forward to the underlying
      * type.
      */
     private static final class MirroredTypeExceptionProxy extends ExceptionProxy {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,412 @@
+/*
+ * 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.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;
+
+/**
+ * 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 {
+            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 getAttributeOnClass(ClassSymbol annotated,
+                                                                Class<A> annoType) {
+        boolean inherited = annoType.isAnnotationPresent(Inherited.class);
+        Attribute.Compound result = null;
+        while (annotated.name != annotated.name.table.names.java_lang_Object) {
+            result = getAttribute(annotated, annoType);
+            if (result != null || !inherited)
+                break;
+            Type sup = annotated.getSuperclass();
+            if (!sup.hasTag(CLASS) || sup.isErroneous())
+                break;
+            annotated = (ClassSymbol) sup.tsym;
+        }
+        return result;
+    }
+
+    /**
+     * 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[] getAnnotations(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 name = annoType.getName();
+        String annoTypeName = annoType.getSimpleName();
+        String containerTypeName = containerType.getSimpleName();
+        int directIndex = -1, containerIndex = -1;
+        Attribute.Compound direct = null, container = null;
+        Attribute.Compound[] rawAttributes = annotated.getRawAttributes().toArray(new Attribute.Compound[0]);
+
+        // Find directly present annotations
+        for (int i = 0; i < rawAttributes.length; i++) {
+            if (annoTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
+                directIndex = i;
+                direct = rawAttributes[i];
+            } else if(containerTypeName != null &&
+                      containerTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
+                containerIndex = i;
+                container = rawAttributes[i];
+            }
+        }
+
+        // Deal with inherited annotations
+        if (annotated.kind == Kinds.TYP &&
+                (annotated instanceof ClassSymbol)) {
+            ClassSymbol s = (ClassSymbol)annotated;
+            if (direct == null && container == null) {
+                direct = getAttributeOnClass(s, annoType);
+                container = getAttributeOnClass(s, containerType);
+
+                // both are inherited and found, put container last
+                if (direct != null && container != null) {
+                    directIndex = 0;
+                    containerIndex = 1;
+                } else if (direct != null) {
+                    directIndex = 0;
+                } else {
+                    containerIndex = 0;
+                }
+            } else if (direct == null) {
+                direct = getAttributeOnClass(s, annoType);
+                if (direct != null)
+                    directIndex = containerIndex + 1;
+            } else if (container == null) {
+                container = getAttributeOnClass(s, containerType);
+                if (container != null)
+                    containerIndex = directIndex + 1;
+            }
+        }
+
+        // Pack them in an array
+        Attribute[] contained0 = new Attribute[0];
+        if (container != null)
+            contained0 = unpackAttributes(container);
+        ListBuffer<Attribute.Compound> compounds = ListBuffer.lb();
+        for (Attribute a : contained0)
+            if (a instanceof Attribute.Compound)
+                compounds = compounds.append((Attribute.Compound)a);
+        Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[0]);
+
+        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 name = annoType.getName();
+        String annoTypeName = annoType.getSimpleName();
+        String containerTypeName = containerType.getSimpleName();
+        int directIndex = -1, containerIndex = -1;
+        Attribute.Compound direct = null, container = null;
+        Attribute.Compound[] rawAttributes = annotated.getAnnotationMirrors().toArray(new Attribute.Compound[0]);
+
+        // Find directly present annotations
+        for (int i = 0; i < rawAttributes.length; i++) {
+            if (annoTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
+                directIndex = i;
+                direct = rawAttributes[i];
+            } else if(containerTypeName != null &&
+                      containerTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
+                containerIndex = i;
+                container = rawAttributes[i];
+            }
+        }
+
+        // Pack them in an array
+        Attribute[] contained0 = new Attribute[0];
+        if (container != null)
+            contained0 = unpackAttributes(container);
+        ListBuffer<Attribute.Compound> compounds = ListBuffer.lb();
+        for (Attribute a : contained0) {
+            if (a instanceof Attribute.Compound)
+                compounds = compounds.append((Attribute.Compound)a);
+        }
+        Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[0]);
+
+        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>
+}
--- a/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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,8 +25,6 @@
 
 package com.sun.tools.javac.model;
 
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Inherited;
 import java.util.Map;
 
 import javax.lang.model.SourceVersion;
@@ -38,7 +36,6 @@
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.code.TypeTag;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Enter;
 import com.sun.tools.javac.comp.Env;
@@ -96,43 +93,6 @@
         enter = Enter.instance(context);
     }
 
-
-    /**
-     * An internal-use utility that creates a reified annotation.
-     */
-    public static <A extends Annotation> A getAnnotation(Symbol annotated,
-                                                         Class<A> annoType) {
-        if (!annoType.isAnnotation())
-            throw new IllegalArgumentException("Not an annotation type: "
-                                               + annoType);
-        String name = annoType.getName();
-        for (Attribute.Compound anno : annotated.getAnnotationMirrors())
-            if (name.equals(anno.type.tsym.flatName().toString()))
-                return AnnotationProxyMaker.generateAnnotation(anno, annoType);
-        return null;
-    }
-
-    /**
-     * An internal-use utility that creates a reified annotation.
-     * This overloaded version take annotation inheritance into account.
-     */
-    public static <A extends Annotation> A getAnnotation(ClassSymbol annotated,
-                                                         Class<A> annoType) {
-        boolean inherited = annoType.isAnnotationPresent(Inherited.class);
-        A result = null;
-        while (annotated.name != annotated.name.table.names.java_lang_Object) {
-            result = getAnnotation((Symbol)annotated, annoType);
-            if (result != null || !inherited)
-                break;
-            Type sup = annotated.getSuperclass();
-            if (!sup.hasTag(CLASS) || sup.isErroneous())
-                break;
-            annotated = (ClassSymbol) sup.tsym;
-        }
-        return result;
-    }
-
-
     public PackageSymbol getPackageElement(CharSequence name) {
         String strName = name.toString();
         if (strName.equals(""))
@@ -238,8 +198,10 @@
         tree.accept(vis);
         if (vis.result == null)
             return null;
+
+        List<Attribute.Compound> annos = sym.getRawAttributes();
         return matchAnnoToTree(cast(Attribute.Compound.class, findme),
-                               sym.getAnnotationMirrors(),
+                               annos,
                                vis.result);
     }
 
@@ -442,7 +404,7 @@
      */
     public List<Attribute.Compound> getAllAnnotationMirrors(Element e) {
         Symbol sym = cast(Symbol.class, e);
-        List<Attribute.Compound> annos = sym.getAnnotationMirrors();
+        List<Attribute.Compound> annos = sym.getRawAttributes();
         while (sym.getKind() == ElementKind.CLASS) {
             Type sup = ((ClassSymbol) sym).getSuperclass();
             if (!sup.hasTag(CLASS) || sup.isErroneous() ||
@@ -451,7 +413,8 @@
             }
             sym = sup.tsym;
             List<Attribute.Compound> oldAnnos = annos;
-            for (Attribute.Compound anno : sym.getAnnotationMirrors()) {
+            List<Attribute.Compound> newAnnos = sym.getRawAttributes();
+            for (Attribute.Compound anno : newAnnos) {
                 if (isInherited(anno.type) &&
                         !containsAnnoOfType(oldAnnos, anno.type)) {
                     annos = annos.prepend(anno);
@@ -465,11 +428,7 @@
      * Tests whether an annotation type is @Inherited.
      */
     private boolean isInherited(Type annotype) {
-        for (Attribute.Compound anno : annotype.tsym.getAnnotationMirrors()) {
-            if (anno.type.tsym == syms.inheritedType.tsym)
-                return true;
-        }
-        return false;
+        return annotype.tsym.attribute(syms.inheritedType.tsym) != null;
     }
 
     /**
@@ -565,6 +524,16 @@
         return names.fromString(cs.toString());
     }
 
+    @Override
+    public boolean isFunctionalInterface(TypeElement element) {
+        if (element.getKind() != ElementKind.INTERFACE)
+            return false;
+        else {
+            TypeSymbol tsym = cast(TypeSymbol.class, element);
+            return types.isFunctionalInterface(tsym);
+        }
+    }
+
     /**
      * Returns the tree node and compilation unit corresponding to this
      * element, or null if they can't be found.
--- a/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -27,7 +27,6 @@
 
 import java.util.Collections;
 import java.util.EnumSet;
-import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
--- a/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -279,13 +279,7 @@
         try {
             nextChar();
             if (isIdentifierStart(ch)) {
-                int namePos = bp;
-                nextChar();
-                while (isIdentifierPart(ch))
-                    nextChar();
-                int nameLen = bp - namePos;
-
-                Name name = names.fromChars(buf, namePos, nameLen);
+                Name name = readIdentifier();
                 TagParser tp = tagParsers.get(name);
                 if (tp == null) {
                     List<DCTree> content = blockContent();
@@ -334,14 +328,9 @@
         try {
             nextChar();
             if (isIdentifierStart(ch)) {
-                int namePos = bp;
-                nextChar();
-                while (isIdentifierPart(ch))
-                    nextChar();
-                int nameLen = bp - namePos;
+                Name name = readIdentifier();
                 skipWhitespace();
 
-                Name name = names.fromChars(buf, namePos, nameLen);
                 TagParser tp = tagParsers.get(name);
                 if (tp == null) {
                     DCTree text = inlineText();
@@ -575,10 +564,8 @@
         int pos = bp;
 
         if (isJavaIdentifierStart(ch)) {
-            nextChar();
-            while (isJavaIdentifierPart(ch))
-                nextChar();
-            return m.at(pos).Identifier(names.fromChars(buf, pos, bp - pos));
+            Name name = readJavaIdentifier();
+            return m.at(pos).Identifier(name);
         }
 
         throw new ParseException("dc.identifier.expected");
@@ -703,39 +690,36 @@
     protected DCTree entity() {
         int p = bp;
         nextChar();
-        int namep = bp;
+        Name name = null;
         boolean checkSemi = false;
         if (ch == '#') {
+            int namep = bp;
             nextChar();
             if (isDecimalDigit(ch)) {
                 nextChar();
                 while (isDecimalDigit(ch))
                     nextChar();
-                checkSemi = true;
+                name = names.fromChars(buf, namep, bp - namep);
             } else if (ch == 'x' || ch == 'X') {
                 nextChar();
                 if (isHexDigit(ch)) {
                     nextChar();
                     while (isHexDigit(ch))
                         nextChar();
-                    checkSemi = true;
+                    name = names.fromChars(buf, namep, bp - namep);
                 }
             }
         } else if (isIdentifierStart(ch)) {
-            nextChar();
-            while (isIdentifierPart(ch))
-                nextChar();
-            checkSemi = true;
+            name = readIdentifier();
         }
 
-        if (checkSemi && ch == ';') {
+        if (name == null)
+            return erroneous("dc.bad.entity", p);
+        else {
+            if (ch != ';')
+                return erroneous("dc.missing.semicolon", p);
             nextChar();
-            return m.at(p).Entity(names.fromChars(buf, namep, bp - namep - 1));
-        } else {
-            String code = checkSemi
-                    ? "dc.missing.semicolon"
-                    : "dc.bad.entity";
-            return erroneous(code, p);
+            return m.at(p).Entity(name);
         }
     }
 
@@ -747,11 +731,7 @@
         int p = bp;
         nextChar();
         if (isIdentifierStart(ch)) {
-            int namePos = bp;
-            nextChar();
-            while (isIdentifierPart(ch))
-                nextChar();
-            int nameLen = bp - namePos;
+            Name name = readIdentifier();
             List<DCTree> attrs = htmlAttrs();
             if (attrs != null) {
                 boolean selfClosing = false;
@@ -761,22 +741,16 @@
                 }
                 if (ch == '>') {
                     nextChar();
-                    Name name = names.fromChars(buf, namePos, nameLen);
                     return m.at(p).StartElement(name, attrs, selfClosing);
                 }
             }
         } else if (ch == '/') {
             nextChar();
             if (isIdentifierStart(ch)) {
-                int namePos = bp;
-                nextChar();
-                while (isIdentifierPart(ch))
-                    nextChar();
-                int nameLen = bp - namePos;
+                Name name = readIdentifier();
                 skipWhitespace();
                 if (ch == '>') {
                     nextChar();
-                    Name name = names.fromChars(buf, namePos, nameLen);
                     return m.at(p).EndElement(name);
                 }
             }
@@ -822,10 +796,7 @@
         loop:
         while (isIdentifierStart(ch)) {
             int namePos = bp;
-            nextChar();
-            while (isIdentifierPart(ch))
-                nextChar();
-            int nameLen = bp - namePos;
+            Name name = readIdentifier();
             skipWhitespace();
             List<DCTree> value = null;
             ValueKind vkind = ValueKind.EMPTY;
@@ -862,7 +833,6 @@
                 skipWhitespace();
                 value = v.toList();
             }
-            Name name = names.fromChars(buf, namePos, nameLen);
             DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
             attrs.add(attr);
         }
@@ -897,7 +867,7 @@
     protected DCErroneous erroneous(String code, int pos) {
         int i = bp - 1;
         loop:
-        while (i > 0) {
+        while (i > pos) {
             switch (buf[i]) {
                 case '\f': case '\n': case '\r':
                     newline = true;
@@ -926,16 +896,24 @@
         return Character.isUnicodeIdentifierStart(ch);
     }
 
-    protected boolean isIdentifierPart(char ch) {
-        return Character.isUnicodeIdentifierPart(ch);
+    protected Name readIdentifier() {
+        int start = bp;
+        nextChar();
+        while (bp < buflen && Character.isUnicodeIdentifierPart(ch))
+            nextChar();
+        return names.fromChars(buf, start, bp - start);
     }
 
     protected boolean isJavaIdentifierStart(char ch) {
         return Character.isJavaIdentifierStart(ch);
     }
 
-    protected boolean isJavaIdentifierPart(char ch) {
-        return Character.isJavaIdentifierPart(ch);
+    protected Name readJavaIdentifier() {
+        int start = bp;
+        nextChar();
+        while (bp < buflen && Character.isJavaIdentifierPart(ch))
+            nextChar();
+        return names.fromChars(buf, start, bp - start);
     }
 
     protected boolean isDecimalDigit(char ch) {
--- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -88,6 +88,41 @@
     /** End position mappings container */
     private final AbstractEndPosTable endPosTable;
 
+    // Because of javac's limited lookahead, some contexts are ambiguous in
+    // the presence of type annotations even though they are not ambiguous
+    // in the absence of type annotations.  Consider this code:
+    //   void m(String [] m) { }
+    //   void m(String ... m) { }
+    // After parsing "String", javac calls bracketsOpt which immediately
+    // returns if the next character is not '['.  Similarly, javac can see
+    // if the next token is ... and in that case parse an ellipsis.  But in
+    // the presence of type annotations:
+    //   void m(String @A [] m) { }
+    //   void m(String @A ... m) { }
+    // no finite lookahead is enough to determine whether to read array
+    // levels or an ellipsis.  Furthermore, if you call bracketsOpt, then
+    // bracketsOpt first reads all the leading annotations and only then
+    // discovers that it needs to fail.  bracketsOpt needs a way to push
+    // back the extra annotations that it read.  (But, bracketsOpt should
+    // not *always* be allowed to push back extra annotations that it finds
+    // -- in most contexts, any such extra annotation is an error.
+    //
+    // The following two variables permit type annotations that have
+    // already been read to be stored for later use.  Alternate
+    // implementations are possible but would cause much larger changes to
+    // the parser.
+
+    /** Type annotations that have already been read but have not yet been used. **/
+    private List<JCAnnotation> typeAnnotationsPushedBack = List.nil();
+
+    /**
+     * If the parser notices extra annotations, then it either immediately
+     * issues an error (if this variable is false) or places the extra
+     * annotations in variable typeAnnotationsPushedBack (if this variable
+     * is true).
+     */
+    private boolean permitTypeAnnotationsPushBack = false;
+
     interface ErrorRecoveryAction {
         JCTree doRecover(JavacParser parser);
     }
@@ -124,9 +159,9 @@
         this.allowLambda = source.allowLambda();
         this.allowMethodReferences = source.allowMethodReferences();
         this.allowDefaultMethods = source.allowDefaultMethods();
-        this.allowIntersectionTypesInCast =
-                source.allowIntersectionTypesInCast() &&
-                fac.options.isSet("allowIntersectionTypes");
+        this.allowStaticInterfaceMethods = source.allowStaticInterfaceMethods();
+        this.allowIntersectionTypesInCast = source.allowIntersectionTypesInCast();
+        this.allowTypeAnnotations = source.allowTypeAnnotations();
         this.keepDocComments = keepDocComments;
         docComments = newDocCommentTable(keepDocComments, fac);
         this.keepLineMap = keepLineMap;
@@ -200,6 +235,10 @@
      */
     boolean allowDefaultMethods;
 
+    /** Switch: should we allow static methods in interfaces?
+     */
+    boolean allowStaticInterfaceMethods;
+
     /** Switch: should we allow intersection types in cast?
      */
     boolean allowIntersectionTypesInCast;
@@ -212,6 +251,20 @@
      */
     boolean keepLineMap;
 
+    /** Switch: should we recognize type annotations?
+     */
+    boolean allowTypeAnnotations;
+
+    /** Switch: is "this" allowed as an identifier?
+     * This is needed to parse receiver types.
+     */
+    boolean allowThisIdent;
+
+    /** The type of the method receiver, as specified by a first "this" parameter.
+     */
+    JCVariableDecl receiverParam;
+
+
     /** When terms are parsed, the mode determines which is expected:
      *     mode = EXPR        : an expression
      *     mode = TYPE        : a type
@@ -245,40 +298,42 @@
         token = S.token();
     }
 
-    protected boolean peekToken(TokenKind tk) {
+    protected boolean peekToken(Filter<TokenKind> tk) {
         return peekToken(0, tk);
     }
 
-    protected boolean peekToken(int lookahead, TokenKind tk) {
-        return S.token(lookahead + 1).kind == tk;
+    protected boolean peekToken(int lookahead, Filter<TokenKind> tk) {
+        return tk.accepts(S.token(lookahead + 1).kind);
     }
 
-    protected boolean peekToken(TokenKind tk1, TokenKind tk2) {
+    protected boolean peekToken(Filter<TokenKind> tk1, Filter<TokenKind> tk2) {
         return peekToken(0, tk1, tk2);
     }
 
-    protected boolean peekToken(int lookahead, TokenKind tk1, TokenKind tk2) {
-        return S.token(lookahead + 1).kind == tk1 &&
-                S.token(lookahead + 2).kind == tk2;
+    protected boolean peekToken(int lookahead, Filter<TokenKind> tk1, Filter<TokenKind> tk2) {
+        return tk1.accepts(S.token(lookahead + 1).kind) &&
+                tk2.accepts(S.token(lookahead + 2).kind);
     }
 
-    protected boolean peekToken(TokenKind tk1, TokenKind tk2, TokenKind tk3) {
+    protected boolean peekToken(Filter<TokenKind> tk1, Filter<TokenKind> tk2, Filter<TokenKind> tk3) {
         return peekToken(0, tk1, tk2, tk3);
     }
 
-    protected boolean peekToken(int lookahead, TokenKind tk1, TokenKind tk2, TokenKind tk3) {
-        return S.token(lookahead + 1).kind == tk1 &&
-                S.token(lookahead + 2).kind == tk2 &&
-                S.token(lookahead + 3).kind == tk3;
+    protected boolean peekToken(int lookahead, Filter<TokenKind> tk1, Filter<TokenKind> tk2, Filter<TokenKind> tk3) {
+        return tk1.accepts(S.token(lookahead + 1).kind) &&
+                tk2.accepts(S.token(lookahead + 2).kind) &&
+                tk3.accepts(S.token(lookahead + 3).kind);
     }
 
-    protected boolean peekToken(TokenKind... kinds) {
+    @SuppressWarnings("unchecked")
+    protected boolean peekToken(Filter<TokenKind>... kinds) {
         return peekToken(0, kinds);
     }
 
-    protected boolean peekToken(int lookahead, TokenKind... kinds) {
+    @SuppressWarnings("unchecked")
+    protected boolean peekToken(int lookahead, Filter<TokenKind>... kinds) {
         for (; lookahead < kinds.length ; lookahead++) {
-            if (S.token(lookahead + 1).kind != kinds[lookahead]) {
+            if (!kinds[lookahead].accepts(S.token(lookahead + 1).kind)) {
                 return false;
             }
         }
@@ -333,6 +388,7 @@
                     if (stopAtMemberDecl)
                         return;
                     break;
+                case UNDERSCORE:
                 case IDENTIFIER:
                    if (stopAtIdentifier)
                         return;
@@ -552,21 +608,45 @@
                 nextToken();
                 return name;
             }
+        } else if (token.kind == THIS) {
+            if (allowThisIdent) {
+                // Make sure we're using a supported source version.
+                checkTypeAnnotations();
+                Name name = token.name();
+                nextToken();
+                return name;
+            } else {
+                error(token.pos, "this.as.identifier");
+                nextToken();
+                return names.error;
+            }
+        } else if (token.kind == UNDERSCORE) {
+            warning(token.pos, "underscore.as.identifier");
+            Name name = token.name();
+            nextToken();
+            return name;
         } else {
             accept(IDENTIFIER);
             return names.error;
         }
-}
+    }
 
     /**
-     * Qualident = Ident { DOT Ident }
+     * Qualident = Ident { DOT [Annotations] Ident }
      */
-    public JCExpression qualident() {
+    public JCExpression qualident(boolean allowAnnos) {
         JCExpression t = toP(F.at(token.pos).Ident(ident()));
         while (token.kind == DOT) {
             int pos = token.pos;
             nextToken();
+            List<JCAnnotation> tyannos = null;
+            if (allowAnnos) {
+                tyannos = typeAnnotationsOpt();
+            }
             t = toP(F.at(pos).Select(t, ident()));
+            if (tyannos != null && tyannos.nonEmpty()) {
+                t = toP(F.at(tyannos.head.pos).AnnotatedType(tyannos, t));
+            }
         }
         return t;
     }
@@ -675,7 +755,7 @@
         nextToken();
         return t;
     }
-//where
+    //where
         boolean isZero(String s) {
             char[] cs = s.toCharArray();
             int base = ((cs.length > 1 && Character.toLowerCase(cs[1]) == 'x') ? 16 : 10);
@@ -695,7 +775,34 @@
         return term(EXPR);
     }
 
+    /**
+     * parses (optional) type annotations followed by a type. If the
+     * annotations are present before the type and are not consumed during array
+     * parsing, this method returns a {@link JCAnnotatedType} consisting of
+     * these annotations and the underlying type. Otherwise, it returns the
+     * underlying type.
+     *
+     * <p>
+     *
+     * Note that this method sets {@code mode} to {@code TYPE} first, before
+     * parsing annotations.
+     */
     public JCExpression parseType() {
+        List<JCAnnotation> annotations = typeAnnotationsOpt();
+        return parseType(annotations);
+    }
+
+    public JCExpression parseType(List<JCAnnotation> annotations) {
+        JCExpression result = unannotatedType();
+
+        if (annotations.nonEmpty()) {
+            result = insertAnnotationsToMostInner(result, annotations, false);
+        }
+
+        return result;
+    }
+
+    public JCExpression unannotatedType() {
         return term(TYPE);
     }
 
@@ -853,7 +960,7 @@
         opStackSupply.add(opStack);
         return t;
     }
-//where
+    //where
         /** Construct a binary or type test node.
          */
         private JCExpression makeOp(int pos,
@@ -932,9 +1039,9 @@
      *                 | NEW [TypeArguments] Creator
      *                 | "(" Arguments ")" "->" ( Expression | Block )
      *                 | Ident "->" ( Expression | Block )
-     *                 | Ident { "." Ident }
+     *                 | [Annotations] Ident { "." [Annotations] Ident }
      *                 | Expression3 MemberReferenceSuffix
-     *                   [ "[" ( "]" BracketsOpt "." CLASS | Expression "]" )
+     *                   [ [Annotations] "[" ( "]" BracketsOpt "." CLASS | Expression "]" )
      *                   | Arguments
      *                   | "." ( CLASS | THIS | [TypeArguments] SUPER Arguments | NEW [TypeArguments] InnerCreator )
      *                   ]
@@ -1056,7 +1163,45 @@
                 typeArgs = null;
             } else return illegal();
             break;
-        case IDENTIFIER: case ASSERT: case ENUM:
+        case MONKEYS_AT:
+            // Only annotated cast types and method references are valid
+            List<JCAnnotation> typeAnnos = typeAnnotationsOpt();
+            if (typeAnnos.isEmpty()) {
+                // else there would be no '@'
+                throw new AssertionError("Expected type annotations, but found none!");
+            }
+
+            JCExpression expr = term3();
+
+            if ((mode & TYPE) == 0) {
+                // Type annotations on class literals no longer legal
+                switch (expr.getTag()) {
+                case REFERENCE: {
+                    JCMemberReference mref = (JCMemberReference) expr;
+                    mref.expr = toP(F.at(pos).AnnotatedType(typeAnnos, mref.expr));
+                    t = mref;
+                    break;
+                }
+                case SELECT: {
+                    JCFieldAccess sel = (JCFieldAccess) expr;
+
+                    if (sel.name != names._class) {
+                        return illegal();
+                    } else {
+                        log.error(token.pos, "no.annotations.on.dot.class");
+                        return expr;
+                    }
+                }
+                default:
+                    return illegal(typeAnnos.head.pos);
+                }
+
+            } else {
+                // Type annotations targeting a cast
+                t = insertAnnotationsToMostInner(expr, typeAnnos, false);
+            }
+            break;
+        case UNDERSCORE: case IDENTIFIER: case ASSERT: case ENUM:
             if (typeArgs != null) return illegal();
             if ((mode & EXPR) != 0 && peekToken(ARROW)) {
                 t = lambdaExpressionOrStatement(false, false, pos);
@@ -1064,6 +1209,13 @@
                 t = toP(F.at(token.pos).Ident(ident()));
                 loop: while (true) {
                     pos = token.pos;
+                    final List<JCAnnotation> annos = typeAnnotationsOpt();
+
+                    // need to report an error later if LBRACKET is for array
+                    // index access rather than array creation level
+                    if (!annos.isEmpty() && token.kind != LBRACKET && token.kind != ELLIPSIS)
+                        return illegal(annos.head.pos);
+
                     switch (token.kind) {
                     case LBRACKET:
                         nextToken();
@@ -1071,11 +1223,23 @@
                             nextToken();
                             t = bracketsOpt(t);
                             t = toP(F.at(pos).TypeArray(t));
-                            t = bracketsSuffix(t);
+                            if (annos.nonEmpty()) {
+                                t = toP(F.at(pos).AnnotatedType(annos, t));
+                            }
+                            // .class is only allowed if there were no annotations
+                            JCExpression nt = bracketsSuffix(t);
+                            if (nt != t && (annos.nonEmpty() || TreeInfo.containsTypeAnnotation(t))) {
+                                // t and nt are different if bracketsSuffix parsed a .class.
+                                // The check for nonEmpty covers the case when the whole array is annotated.
+                                // Helper method isAnnotated looks for annos deeply within t.
+                                syntaxError("no.annotations.on.dot.class");
+                            }
+                            t = nt;
                         } else {
                             if ((mode & EXPR) != 0) {
                                 mode = EXPR;
                                 JCExpression t1 = term();
+                                if (!annos.isEmpty()) t = illegal(annos.head.pos);
                                 t = to(F.at(pos).Indexed(t, t1));
                             }
                             accept(RBRACKET);
@@ -1085,6 +1249,7 @@
                         if ((mode & EXPR) != 0) {
                             mode = EXPR;
                             t = arguments(typeArgs, t);
+                            if (!annos.isEmpty()) t = illegal(annos.head.pos);
                             typeArgs = null;
                         }
                         break loop;
@@ -1125,9 +1290,25 @@
                                 break loop;
                             }
                         }
+
+                        List<JCAnnotation> tyannos = null;
+                        if ((mode & TYPE) != 0 && token.kind == MONKEYS_AT) {
+                            tyannos = typeAnnotationsOpt();
+                        }
                         // typeArgs saved for next loop iteration.
                         t = toP(F.at(pos).Select(t, ident()));
+                        if (tyannos != null && tyannos.nonEmpty()) {
+                            t = toP(F.at(tyannos.head.pos).AnnotatedType(tyannos, t));
+                        }
                         break;
+                    case ELLIPSIS:
+                        if (this.permitTypeAnnotationsPushBack) {
+                            this.typeAnnotationsPushedBack = annos;
+                        } else if (annos.nonEmpty()) {
+                            // Don't return here -- error recovery attempt
+                            illegal(annos.head.pos);
+                        }
+                        break loop;
                     case LT:
                         if ((mode & TYPE) == 0 && isUnboundMemberRef()) {
                             //this is an unbound method reference whose qualifier
@@ -1201,6 +1382,8 @@
         if (typeArgs != null) illegal();
         while (true) {
             int pos1 = token.pos;
+            final List<JCAnnotation> annos = typeAnnotationsOpt();
+
             if (token.kind == LBRACKET) {
                 nextToken();
                 if ((mode & TYPE) != 0) {
@@ -1214,6 +1397,9 @@
                             mode = EXPR;
                             continue;
                         }
+                        if (annos.nonEmpty()) {
+                            t = toP(F.at(pos1).AnnotatedType(annos, t));
+                        }
                         return t;
                     }
                     mode = oldmode;
@@ -1242,7 +1428,15 @@
                     t = innerCreator(pos2, typeArgs, t);
                     typeArgs = null;
                 } else {
+                    List<JCAnnotation> tyannos = null;
+                    if ((mode & TYPE) != 0 && token.kind == MONKEYS_AT) {
+                        // is the mode check needed?
+                        tyannos = typeAnnotationsOpt();
+                    }
                     t = toP(F.at(pos1).Select(t, ident()));
+                    if (tyannos != null && tyannos.nonEmpty()) {
+                        t = toP(F.at(tyannos.head.pos).AnnotatedType(tyannos, t));
+                    }
                     t = argumentsOpt(typeArgs, typeArgumentsOpt(t));
                     typeArgs = null;
                 }
@@ -1252,6 +1446,12 @@
                 accept(COLCOL);
                 t = memberReferenceSuffix(pos1, t);
             } else {
+                if (!annos.isEmpty()) {
+                    if (permitTypeAnnotationsPushBack)
+                        typeAnnotationsPushedBack = annos;
+                    else
+                        return illegal(annos.head.pos);
+                }
                 break;
             }
         }
@@ -1267,18 +1467,40 @@
     /**
      * If we see an identifier followed by a '&lt;' it could be an unbound
      * method reference or a binary expression. To disambiguate, look for a
-     * matching '&gt;' and see if the subsequent terminal is either '.' or '#'.
+     * matching '&gt;' and see if the subsequent terminal is either '.' or '::'.
      */
     @SuppressWarnings("fallthrough")
     boolean isUnboundMemberRef() {
         int pos = 0, depth = 0;
-        for (Token t = S.token(pos) ; ; t = S.token(++pos)) {
+        outer: for (Token t = S.token(pos) ; ; t = S.token(++pos)) {
             switch (t.kind) {
-                case IDENTIFIER: case QUES: case EXTENDS: case SUPER:
+                case IDENTIFIER: case UNDERSCORE: case QUES: case EXTENDS: case SUPER:
                 case DOT: case RBRACKET: case LBRACKET: case COMMA:
                 case BYTE: case SHORT: case INT: case LONG: case FLOAT:
                 case DOUBLE: case BOOLEAN: case CHAR:
+                case MONKEYS_AT:
                     break;
+
+                case LPAREN:
+                    // skip annotation values
+                    int nesting = 0;
+                    for (; ; pos++) {
+                        TokenKind tk2 = S.token(pos).kind;
+                        switch (tk2) {
+                            case EOF:
+                                return false;
+                            case LPAREN:
+                                nesting++;
+                                break;
+                            case RPAREN:
+                                nesting--;
+                                if (nesting == 0) {
+                                    continue outer;
+                                }
+                                break;
+                        }
+                    }
+
                 case LT:
                     depth++; break;
                 case GTGTGT:
@@ -1304,13 +1526,13 @@
     /**
      * If we see an identifier followed by a '&lt;' it could be an unbound
      * method reference or a binary expression. To disambiguate, look for a
-     * matching '&gt;' and see if the subsequent terminal is either '.' or '#'.
+     * matching '&gt;' and see if the subsequent terminal is either '.' or '::'.
      */
     @SuppressWarnings("fallthrough")
     ParensResult analyzeParens() {
         int depth = 0;
         boolean type = false;
-        for (int lookahead = 0 ; ; lookahead++) {
+        outer: for (int lookahead = 0 ; ; lookahead++) {
             TokenKind tk = S.token(lookahead).kind;
             switch (tk) {
                 case EXTENDS: case SUPER: case COMMA:
@@ -1323,8 +1545,8 @@
                     if (peekToken(lookahead, RPAREN)) {
                         //Type, ')' -> cast
                         return ParensResult.CAST;
-                    } else if (peekToken(lookahead, IDENTIFIER)) {
-                        //Type, 'Identifier -> explicit lambda
+                    } else if (peekToken(lookahead, LAX_IDENTIFIER)) {
+                        //Type, Identifier/'_'/'assert'/'enum' -> explicit lambda
                         return ParensResult.EXPLICIT_LAMBDA;
                     }
                     break;
@@ -1350,16 +1572,19 @@
                         case INTLITERAL: case LONGLITERAL: case FLOATLITERAL:
                         case DOUBLELITERAL: case CHARLITERAL: case STRINGLITERAL:
                         case TRUE: case FALSE: case NULL:
-                            case NEW: case IDENTIFIER: case ASSERT: case ENUM:
+                        case NEW: case IDENTIFIER: case ASSERT: case ENUM: case UNDERSCORE:
                         case BYTE: case SHORT: case CHAR: case INT:
                         case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case VOID:
                             return ParensResult.CAST;
                         default:
                             return ParensResult.PARENS;
                     }
+                case UNDERSCORE:
+                case ASSERT:
+                case ENUM:
                 case IDENTIFIER:
-                    if (peekToken(lookahead, IDENTIFIER)) {
-                        // Identifier, Identifier -> explicit lambda
+                    if (peekToken(lookahead, LAX_IDENTIFIER)) {
+                        // Identifier, Identifier/'_'/'assert'/'enum' -> explicit lambda
                         return ParensResult.EXPLICIT_LAMBDA;
                     } else if (peekToken(lookahead, RPAREN, ARROW)) {
                         // Identifier, ')' '->' -> implicit lambda
@@ -1368,12 +1593,39 @@
                     break;
                 case FINAL:
                 case ELLIPSIS:
-                case MONKEYS_AT:
                     //those can only appear in explicit lambdas
                     return ParensResult.EXPLICIT_LAMBDA;
+                case MONKEYS_AT:
+                    type = true;
+                    lookahead += 1; //skip '@'
+                    while (peekToken(lookahead, DOT)) {
+                        lookahead += 2;
+                    }
+                    if (peekToken(lookahead, LPAREN)) {
+                        lookahead++;
+                        //skip annotation values
+                        int nesting = 0;
+                        for (; ; lookahead++) {
+                            TokenKind tk2 = S.token(lookahead).kind;
+                            switch (tk2) {
+                                case EOF:
+                                    return ParensResult.PARENS;
+                                case LPAREN:
+                                    nesting++;
+                                    break;
+                                case RPAREN:
+                                    nesting--;
+                                    if (nesting == 0) {
+                                        continue outer;
+                                    }
+                                break;
+                            }
+                        }
+                    }
+                    break;
                 case LBRACKET:
-                    if (peekToken(lookahead, RBRACKET, IDENTIFIER)) {
-                        // '[', ']', Identifier -> explicit lambda
+                    if (peekToken(lookahead, RBRACKET, LAX_IDENTIFIER)) {
+                        // '[', ']', Identifier/'_'/'assert'/'enum' -> explicit lambda
                         return ParensResult.EXPLICIT_LAMBDA;
                     } else if (peekToken(lookahead, RBRACKET, RPAREN) ||
                             peekToken(lookahead, RBRACKET, AMP)) {
@@ -1402,11 +1654,11 @@
                             // '>', ')' -> cast
                             // '>', '&' -> cast
                             return ParensResult.CAST;
-                        } else if (peekToken(lookahead, IDENTIFIER, COMMA) ||
-                                peekToken(lookahead, IDENTIFIER, RPAREN, ARROW) ||
+                        } else if (peekToken(lookahead, LAX_IDENTIFIER, COMMA) ||
+                                peekToken(lookahead, LAX_IDENTIFIER, RPAREN, ARROW) ||
                                 peekToken(lookahead, ELLIPSIS)) {
-                            // '>', Identifier, ',' -> explicit lambda
-                            // '>', Identifier, ')', '->' -> explicit lambda
+                            // '>', Identifier/'_'/'assert'/'enum', ',' -> explicit lambda
+                            // '>', Identifier/'_'/'assert'/'enum', ')', '->' -> explicit lambda
                             // '>', '...' -> explicit lambda
                             return ParensResult.EXPLICIT_LAMBDA;
                         }
@@ -1426,6 +1678,13 @@
         }
     }
 
+    /** Accepts all identifier-like tokens */
+    Filter<TokenKind> LAX_IDENTIFIER = new Filter<TokenKind>() {
+        public boolean accepts(TokenKind t) {
+            return t == IDENTIFIER || t == UNDERSCORE || t == ASSERT || t == ENUM;
+        }
+    };
+
     enum ParensResult {
         CAST,
         EXPLICIT_LAMBDA,
@@ -1433,21 +1692,9 @@
         PARENS;
     }
 
-    JCExpression lambdaExpressionOrStatement(JCVariableDecl firstParam, int pos) {
-        ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
-        params.append(firstParam);
-        JCVariableDecl lastParam = firstParam;
-        while ((lastParam.mods.flags & Flags.VARARGS) == 0 && token.kind == COMMA) {
-            nextToken();
-            params.append(lastParam = formalParameter());
-        }
-        accept(RPAREN);
-        return lambdaExpressionOrStatementRest(params.toList(), pos);
-    }
-
     JCExpression lambdaExpressionOrStatement(boolean hasParens, boolean explicitParams, int pos) {
         List<JCVariableDecl> params = explicitParams ?
-                formalParameters() :
+                formalParameters(true) :
                 implicitParameters(hasParens);
 
         return lambdaExpressionOrStatementRest(params, pos);
@@ -1609,37 +1856,43 @@
     /**
      *  {@literal
      *  TypeArgument = Type
-     *               | "?"
-     *               | "?" EXTENDS Type {"&" Type}
-     *               | "?" SUPER Type
+     *               | [Annotations] "?"
+     *               | [Annotations] "?" EXTENDS Type {"&" Type}
+     *               | [Annotations] "?" SUPER Type
      *  }
      */
     JCExpression typeArgument() {
-        if (token.kind != QUES) return parseType();
+        List<JCAnnotation> annotations = typeAnnotationsOpt();
+        if (token.kind != QUES) return parseType(annotations);
         int pos = token.pos;
         nextToken();
+        JCExpression result;
         if (token.kind == EXTENDS) {
             TypeBoundKind t = to(F.at(pos).TypeBoundKind(BoundKind.EXTENDS));
             nextToken();
             JCExpression bound = parseType();
-            return F.at(pos).Wildcard(t, bound);
+            result = F.at(pos).Wildcard(t, bound);
         } else if (token.kind == SUPER) {
             TypeBoundKind t = to(F.at(pos).TypeBoundKind(BoundKind.SUPER));
             nextToken();
             JCExpression bound = parseType();
-            return F.at(pos).Wildcard(t, bound);
-        } else if (token.kind == IDENTIFIER) {
+            result = F.at(pos).Wildcard(t, bound);
+        } else if (LAX_IDENTIFIER.accepts(token.kind)) {
             //error recovery
             TypeBoundKind t = F.at(Position.NOPOS).TypeBoundKind(BoundKind.UNBOUND);
             JCExpression wc = toP(F.at(pos).Wildcard(t, null));
             JCIdent id = toP(F.at(token.pos).Ident(ident()));
             JCErroneous err = F.at(pos).Erroneous(List.<JCTree>of(wc, id));
             reportSyntaxError(err, "expected3", GT, EXTENDS, SUPER);
-            return err;
+            result = err;
         } else {
             TypeBoundKind t = toP(F.at(pos).TypeBoundKind(BoundKind.UNBOUND));
-            return toP(F.at(pos).Wildcard(t, null));
+            result = toP(F.at(pos).Wildcard(t, null));
         }
+        if (!annotations.isEmpty()) {
+            result = toP(F.at(annotations.head.pos).AnnotatedType(annotations,result));
+        }
+        return result;
     }
 
     JCTypeApply typeArguments(JCExpression t, boolean diamondAllowed) {
@@ -1648,22 +1901,51 @@
         return toP(F.at(pos).TypeApply(t, args));
     }
 
-    /** BracketsOpt = {"[" "]"}
+    /**
+     * BracketsOpt = { [Annotations] "[" "]" }*
+     *
+     * <p>
+     *
+     * <code>annotations</code> is the list of annotations targeting
+     * the expression <code>t</code>.
      */
-    private JCExpression bracketsOpt(JCExpression t) {
+    private JCExpression bracketsOpt(JCExpression t,
+            List<JCAnnotation> annotations) {
+        List<JCAnnotation> nextLevelAnnotations = typeAnnotationsOpt();
+
         if (token.kind == LBRACKET) {
             int pos = token.pos;
             nextToken();
-            t = bracketsOptCont(t, pos);
-            F.at(pos);
+            t = bracketsOptCont(t, pos, nextLevelAnnotations);
+        } else if (!nextLevelAnnotations.isEmpty()) {
+            if (permitTypeAnnotationsPushBack) {
+                this.typeAnnotationsPushedBack = nextLevelAnnotations;
+            } else {
+                return illegal(nextLevelAnnotations.head.pos);
+            }
+        }
+
+        if (!annotations.isEmpty()) {
+            t = toP(F.at(token.pos).AnnotatedType(annotations, t));
         }
         return t;
     }
 
-    private JCArrayTypeTree bracketsOptCont(JCExpression t, int pos) {
+    /** BracketsOpt = [ "[" "]" { [Annotations] "[" "]"} ]
+     */
+    private JCExpression bracketsOpt(JCExpression t) {
+        return bracketsOpt(t, List.<JCAnnotation>nil());
+    }
+
+    private JCExpression bracketsOptCont(JCExpression t, int pos,
+            List<JCAnnotation> annotations) {
         accept(RBRACKET);
         t = bracketsOpt(t);
-        return toP(F.at(pos).TypeArray(t));
+        t = toP(F.at(pos).TypeArray(t));
+        if (annotations.nonEmpty()) {
+            t = toP(F.at(pos).AnnotatedType(annotations, t));
+        }
+        return t;
     }
 
     /** BracketsSuffixExpr = "." CLASS
@@ -1677,8 +1959,8 @@
             accept(CLASS);
             if (token.pos == endPosTable.errorEndPos) {
                 // error recovery
-                Name name = null;
-                if (token.kind == IDENTIFIER) {
+                Name name;
+                if (LAX_IDENTIFIER.accepts(token.kind)) {
                     name = token.name();
                     nextToken();
                 } else {
@@ -1715,8 +1997,8 @@
         if (token.kind == LT) {
             typeArgs = typeArguments(false);
         }
-        Name refName = null;
-        ReferenceMode refMode = null;
+        Name refName;
+        ReferenceMode refMode;
         if (token.kind == NEW) {
             refMode = ReferenceMode.NEW;
             refName = names.init;
@@ -1728,18 +2010,31 @@
         return toP(F.at(t.getStartPosition()).Reference(refMode, refName, t, typeArgs));
     }
 
-    /** Creator = Qualident [TypeArguments] ( ArrayCreatorRest | ClassCreatorRest )
+    /** Creator = [Annotations] Qualident [TypeArguments] ( ArrayCreatorRest | ClassCreatorRest )
      */
     JCExpression creator(int newpos, List<JCExpression> typeArgs) {
+        List<JCAnnotation> newAnnotations = typeAnnotationsOpt();
+
         switch (token.kind) {
         case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT:
         case DOUBLE: case BOOLEAN:
-            if (typeArgs == null)
-                return arrayCreatorRest(newpos, basicType());
+            if (typeArgs == null) {
+                if (newAnnotations.isEmpty()) {
+                    return arrayCreatorRest(newpos, basicType());
+                } else {
+                    return arrayCreatorRest(newpos, toP(F.at(newAnnotations.head.pos).AnnotatedType(newAnnotations, basicType())));
+                }
+            }
             break;
         default:
         }
-        JCExpression t = qualident();
+        JCExpression t = qualident(true);
+
+        // handle type annotations for non primitive arrays
+        if (newAnnotations.nonEmpty()) {
+            t = insertAnnotationsToMostInner(t, newAnnotations, false);
+        }
+
         int oldmode = mode;
         mode = TYPE;
         boolean diamondFound = false;
@@ -1757,7 +2052,13 @@
             }
             int pos = token.pos;
             nextToken();
+            List<JCAnnotation> tyannos = typeAnnotationsOpt();
             t = toP(F.at(pos).Select(t, ident()));
+
+            if (tyannos != null && tyannos.nonEmpty()) {
+                t = toP(F.at(tyannos.head.pos).AnnotatedType(tyannos, t));
+            }
+
             if (token.kind == LT) {
                 lastTypeargsPos = token.pos;
                 checkGenerics();
@@ -1766,7 +2067,7 @@
             }
         }
         mode = oldmode;
-        if (token.kind == LBRACKET) {
+        if (token.kind == LBRACKET || token.kind == MONKEYS_AT) {
             JCExpression e = arrayCreatorRest(newpos, t);
             if (diamondFound) {
                 reportSyntaxError(lastTypeargsPos, "cannot.create.array.with.diamond");
@@ -1787,7 +2088,15 @@
             }
             return e;
         } else if (token.kind == LPAREN) {
-            return classCreatorRest(newpos, null, typeArgs, t);
+            JCNewClass newClass = classCreatorRest(newpos, null, typeArgs, t);
+            if (newClass.def != null) {
+                assert newClass.def.mods.annotations.isEmpty();
+                if (newAnnotations.nonEmpty()) {
+                    newClass.def.mods.pos = earlier(newClass.def.mods.pos, newAnnotations.head.pos);
+                    newClass.def.mods.annotations = List.convert(JCAnnotation.class, newAnnotations);
+                }
+            }
+            return newClass;
         } else {
             setErrorEndPos(token.pos);
             reportSyntaxError(token.pos, "expected2", LPAREN, LBRACKET);
@@ -1796,10 +2105,17 @@
         }
     }
 
-    /** InnerCreator = Ident [TypeArguments] ClassCreatorRest
+    /** InnerCreator = [Annotations] Ident [TypeArguments] ClassCreatorRest
      */
     JCExpression innerCreator(int newpos, List<JCExpression> typeArgs, JCExpression encl) {
+        List<JCAnnotation> newAnnotations = typeAnnotationsOpt();
+
         JCExpression t = toP(F.at(token.pos).Ident(ident()));
+
+        if (newAnnotations.nonEmpty()) {
+            t = toP(F.at(newAnnotations.head.pos).AnnotatedType(newAnnotations, t));
+        }
+
         if (token.kind == LT) {
             int oldmode = mode;
             checkGenerics();
@@ -1809,35 +2125,65 @@
         return classCreatorRest(newpos, encl, typeArgs, t);
     }
 
-    /** ArrayCreatorRest = "[" ( "]" BracketsOpt ArrayInitializer
-     *                         | Expression "]" {"[" Expression "]"} BracketsOpt )
+    /** ArrayCreatorRest = [Annotations] "[" ( "]" BracketsOpt ArrayInitializer
+     *                         | Expression "]" {[Annotations]  "[" Expression "]"} BracketsOpt )
      */
     JCExpression arrayCreatorRest(int newpos, JCExpression elemtype) {
+        List<JCAnnotation> annos = typeAnnotationsOpt();
+
         accept(LBRACKET);
         if (token.kind == RBRACKET) {
             accept(RBRACKET);
-            elemtype = bracketsOpt(elemtype);
+            elemtype = bracketsOpt(elemtype, annos);
             if (token.kind == LBRACE) {
-                return arrayInitializer(newpos, elemtype);
+                JCNewArray na = (JCNewArray)arrayInitializer(newpos, elemtype);
+                if (annos.nonEmpty()) {
+                    // when an array initializer is present then
+                    // the parsed annotations should target the
+                    // new array tree
+                    // bracketsOpt inserts the annotation in
+                    // elemtype, and it needs to be corrected
+                    //
+                    JCAnnotatedType annotated = (JCAnnotatedType)elemtype;
+                    assert annotated.annotations == annos;
+                    na.annotations = annotated.annotations;
+                    na.elemtype = annotated.underlyingType;
+                }
+                return na;
             } else {
                 JCExpression t = toP(F.at(newpos).NewArray(elemtype, List.<JCExpression>nil(), null));
                 return syntaxError(token.pos, List.<JCTree>of(t), "array.dimension.missing");
             }
         } else {
             ListBuffer<JCExpression> dims = new ListBuffer<JCExpression>();
+
+            // maintain array dimension type annotations
+            ListBuffer<List<JCAnnotation>> dimAnnotations = ListBuffer.lb();
+            dimAnnotations.append(annos);
+
             dims.append(parseExpression());
             accept(RBRACKET);
-            while (token.kind == LBRACKET) {
+            while (token.kind == LBRACKET
+                    || token.kind == MONKEYS_AT) {
+                List<JCAnnotation> maybeDimAnnos = typeAnnotationsOpt();
                 int pos = token.pos;
                 nextToken();
                 if (token.kind == RBRACKET) {
-                    elemtype = bracketsOptCont(elemtype, pos);
+                    elemtype = bracketsOptCont(elemtype, pos, maybeDimAnnos);
                 } else {
-                    dims.append(parseExpression());
-                    accept(RBRACKET);
+                    if (token.kind == RBRACKET) { // no dimension
+                        elemtype = bracketsOptCont(elemtype, pos, maybeDimAnnos);
+                    } else {
+                        dimAnnotations.append(maybeDimAnnos);
+                        dims.append(parseExpression());
+                        accept(RBRACKET);
+                    }
                 }
             }
-            return toP(F.at(newpos).NewArray(elemtype, dims.toList(), null));
+
+            JCNewArray na = toP(F.at(newpos).NewArray(elemtype, dims.toList(), null));
+            na.dimAnnotations = dimAnnotations.toList();
+            return na;
         }
     }
 
@@ -2026,10 +2372,7 @@
                 nextToken();
                 JCStatement stat = parseStatement();
                 return List.<JCStatement>of(F.at(pos).Labelled(prevToken.name(), stat));
-            } else if ((lastmode & TYPE) != 0 &&
-                       (token.kind == IDENTIFIER ||
-                        token.kind == ASSERT ||
-                        token.kind == ENUM)) {
+            } else if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
                 pos = token.pos;
                 JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
                 F.at(pos);
@@ -2183,14 +2526,14 @@
         }
         case BREAK: {
             nextToken();
-            Name label = (token.kind == IDENTIFIER || token.kind == ASSERT || token.kind == ENUM) ? ident() : null;
+            Name label = LAX_IDENTIFIER.accepts(token.kind) ? ident() : null;
             JCBreak t = to(F.at(pos).Break(label));
             accept(SEMI);
             return t;
         }
         case CONTINUE: {
             nextToken();
-            Name label = (token.kind == IDENTIFIER || token.kind == ASSERT || token.kind == ENUM) ? ident() : null;
+            Name label = LAX_IDENTIFIER.accepts(token.kind) ? ident() : null;
             JCContinue t =  to(F.at(pos).Continue(label));
             accept(SEMI);
             return t;
@@ -2248,6 +2591,7 @@
     }
 
     /** CatchClause     = CATCH "(" FormalParameter ")" Block
+     * TODO: the "FormalParameter" is not correct, it uses the special "catchTypes" rule below.
      */
     protected JCCatch catchClause() {
         int pos = token.pos;
@@ -2270,7 +2614,9 @@
         while (token.kind == BAR) {
             checkMulticatch();
             nextToken();
-            catchTypes.add(qualident());
+            // Instead of qualident this is now parseType.
+            // But would that allow too much, e.g. arrays or generics?
+            catchTypes.add(parseType());
         }
         return catchTypes.toList();
     }
@@ -2351,9 +2697,7 @@
             return variableDeclarators(optFinal(0), parseType(), stats).toList();
         } else {
             JCExpression t = term(EXPR | TYPE);
-            if ((lastmode & TYPE) != 0 &&
-                (token.kind == IDENTIFIER || token.kind == ASSERT ||
-                 token.kind == ENUM)) {
+            if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
                 return variableDeclarators(modifiersOpt(), t, stats).toList();
             } else if ((lastmode & TYPE) != 0 && token.kind == COLON) {
                 error(pos, "bad.initializer", "for-loop");
@@ -2373,16 +2717,28 @@
     }
 
     /** AnnotationsOpt = { '@' Annotation }
+     *
+     * @param kind Whether to parse an ANNOTATION or TYPE_ANNOTATION
      */
-    List<JCAnnotation> annotationsOpt() {
+    List<JCAnnotation> annotationsOpt(Tag kind) {
         if (token.kind != MONKEYS_AT) return List.nil(); // optimization
         ListBuffer<JCAnnotation> buf = new ListBuffer<JCAnnotation>();
+        int prevmode = mode;
         while (token.kind == MONKEYS_AT) {
             int pos = token.pos;
             nextToken();
-            buf.append(annotation(pos));
+            buf.append(annotation(pos, kind));
         }
-        return buf.toList();
+        lastmode = mode;
+        mode = prevmode;
+        List<JCAnnotation> annotations = buf.toList();
+
+        return annotations;
+    }
+
+    List<JCAnnotation> typeAnnotationsOpt() {
+        List<JCAnnotation> annotations = annotationsOpt(Tag.TYPE_ANNOTATION);
+        return annotations;
     }
 
     /** ModifiersOpt = { Modifier }
@@ -2408,7 +2764,7 @@
         if (token.deprecatedFlag()) {
             flags |= Flags.DEPRECATED;
         }
-        int lastPos = Position.NOPOS;
+        int lastPos;
     loop:
         while (true) {
             long flag;
@@ -2435,12 +2791,11 @@
             if (flag == Flags.ANNOTATION) {
                 checkAnnotations();
                 if (token.kind != INTERFACE) {
-                    JCAnnotation ann = annotation(lastPos);
+                    JCAnnotation ann = annotation(lastPos, Tag.ANNOTATION);
                     // if first modifier is an annotation, set pos to annotation's.
                     if (flags == 0 && annotations.isEmpty())
                         pos = ann.pos;
                     annotations.append(ann);
-                    lastPos = ann.pos;
                     flag = 0;
                 }
             }
@@ -2464,14 +2819,27 @@
     }
 
     /** Annotation              = "@" Qualident [ "(" AnnotationFieldValues ")" ]
+     *
      * @param pos position of "@" token
+     * @param kind Whether to parse an ANNOTATION or TYPE_ANNOTATION
      */
-    JCAnnotation annotation(int pos) {
+    JCAnnotation annotation(int pos, Tag kind) {
         // accept(AT); // AT consumed by caller
         checkAnnotations();
-        JCTree ident = qualident();
+        if (kind == Tag.TYPE_ANNOTATION) {
+            checkTypeAnnotations();
+        }
+        JCTree ident = qualident(false);
         List<JCExpression> fieldValues = annotationFieldValuesOpt();
-        JCAnnotation ann = F.at(pos).Annotation(ident, fieldValues);
+        JCAnnotation ann;
+        if (kind == Tag.ANNOTATION) {
+            ann = F.at(pos).Annotation(ident, fieldValues);
+        } else if (kind == Tag.TYPE_ANNOTATION) {
+            ann = F.at(pos).TypeAnnotation(ident, fieldValues);
+        } else {
+            throw new AssertionError("Unhandled annotation kind: " + kind);
+        }
+
         storeEnd(ann, S.prevToken().endPos);
         return ann;
     }
@@ -2499,7 +2867,7 @@
      *                          | Identifier "=" AnnotationValue
      */
     JCExpression annotationFieldValue() {
-        if (token.kind == IDENTIFIER) {
+        if (LAX_IDENTIFIER.accepts(token.kind)) {
             mode = EXPR;
             JCExpression t1 = term1();
             if (t1.hasTag(IDENT) && token.kind == EQ) {
@@ -2524,7 +2892,7 @@
         case MONKEYS_AT:
             pos = token.pos;
             nextToken();
-            return annotation(pos);
+            return annotation(pos, Tag.ANNOTATION);
         case LBRACE:
             pos = token.pos;
             accept(LBRACE);
@@ -2609,8 +2977,18 @@
     /** VariableDeclaratorId = Ident BracketsOpt
      */
     JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type) {
+        return variableDeclaratorId(mods, type, false);
+    }
+    //where
+    JCVariableDecl variableDeclaratorId(JCModifiers mods, JCExpression type, boolean lambdaParameter) {
         int pos = token.pos;
-        Name name = ident();
+        Name name;
+        if (lambdaParameter && token.kind == UNDERSCORE) {
+            syntaxError(pos, "expected", IDENTIFIER);
+            name = token.name();
+        } else {
+            name = ident();
+        }
         if ((mods.flags & Flags.VARARGS) != 0 &&
                 token.kind == LBRACKET) {
             log.error(token.pos, "varargs.and.old.array.syntax");
@@ -2669,14 +3047,14 @@
                 mods = null;
             }
             nextToken();
-            pid = qualident();
+            pid = qualident(false);
             accept(SEMI);
         }
         ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
         boolean checkForImports = true;
         boolean firstTypeDecl = true;
         while (token.kind != EOF) {
-            if (token.pos <= endPosTable.errorEndPos) {
+            if (token.pos > 0 && token.pos <= endPosTable.errorEndPos) {
                 // error recovery
                 skip(checkForImports, false, false, false);
                 if (token.kind == EOF)
@@ -2770,7 +3148,7 @@
             } else {
                 int pos = token.pos;
                 List<JCTree> errs;
-                if (token.kind == IDENTIFIER) {
+                if (LAX_IDENTIFIER.accepts(token.kind)) {
                     errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
                     setErrorEndPos(token.pos);
                 } else {
@@ -2787,7 +3165,7 @@
             }
             int pos = token.pos;
             List<JCTree> errs;
-            if (token.kind == IDENTIFIER) {
+            if (LAX_IDENTIFIER.accepts(token.kind)) {
                 errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
                 setErrorEndPos(token.pos);
             } else {
@@ -2920,7 +3298,7 @@
             flags |= Flags.DEPRECATED;
         }
         int pos = token.pos;
-        List<JCAnnotation> annotations = annotationsOpt();
+        List<JCAnnotation> annotations = annotationsOpt(Tag.ANNOTATION);
         JCModifiers mods = F.at(annotations.isEmpty() ? Position.NOPOS : pos).Modifiers(flags, annotations);
         List<JCExpression> typeArgs = typeArgumentsOpt();
         int identPos = token.pos;
@@ -3023,15 +3401,25 @@
                     mods.pos = pos;
                     storeEnd(mods, pos);
                 }
+                List<JCAnnotation> annosAfterParams = annotationsOpt(Tag.ANNOTATION);
+
                 Token tk = token;
                 pos = token.pos;
                 JCExpression type;
                 boolean isVoid = token.kind == VOID;
                 if (isVoid) {
+                    if (annosAfterParams.nonEmpty())
+                        illegal(annosAfterParams.head.pos);
                     type = to(F.at(pos).TypeIdent(TypeTag.VOID));
                     nextToken();
                 } else {
-                    type = parseType();
+                    if (annosAfterParams.nonEmpty()) {
+                        mods.annotations = mods.annotations.appendList(annosAfterParams);
+                        if (mods.pos == Position.NOPOS)
+                            mods.pos = mods.annotations.head.pos;
+                    }
+                    // method returns types are un-annotated types
+                    type = unannotatedType();
                 }
                 if (token.kind == LPAREN && !isInterface && type.hasTag(IDENT)) {
                     if (isInterface || tk.name() != className)
@@ -3084,51 +3472,71 @@
                               List<JCTypeParameter> typarams,
                               boolean isInterface, boolean isVoid,
                               Comment dc) {
-        List<JCVariableDecl> params = formalParameters();
-        if (!isVoid) type = bracketsOpt(type);
-        List<JCExpression> thrown = List.nil();
-        if (token.kind == THROWS) {
-            nextToken();
-            thrown = qualidentList();
+        if (isInterface && (mods.flags & Flags.STATIC) != 0) {
+            checkStaticInterfaceMethods();
         }
-        JCBlock body = null;
-        JCExpression defaultValue;
-        if (token.kind == LBRACE) {
-            body = block();
-            defaultValue = null;
-        } else {
-            if (token.kind == DEFAULT) {
-                accept(DEFAULT);
-                defaultValue = annotationValue();
+        JCVariableDecl prevReceiverParam = this.receiverParam;
+        try {
+            this.receiverParam = null;
+            // Parsing formalParameters sets the receiverParam, if present
+            List<JCVariableDecl> params = formalParameters();
+            if (!isVoid) type = bracketsOpt(type);
+            List<JCExpression> thrown = List.nil();
+            if (token.kind == THROWS) {
+                nextToken();
+                thrown = qualidentList();
+            }
+            JCBlock body = null;
+            JCExpression defaultValue;
+            if (token.kind == LBRACE) {
+                body = block();
+                defaultValue = null;
             } else {
-                defaultValue = null;
-            }
-            accept(SEMI);
-            if (token.pos <= endPosTable.errorEndPos) {
-                // error recovery
-                skip(false, true, false, false);
-                if (token.kind == LBRACE) {
-                    body = block();
+                if (token.kind == DEFAULT) {
+                    accept(DEFAULT);
+                    defaultValue = annotationValue();
+                } else {
+                    defaultValue = null;
+                }
+                accept(SEMI);
+                if (token.pos <= endPosTable.errorEndPos) {
+                    // error recovery
+                    skip(false, true, false, false);
+                    if (token.kind == LBRACE) {
+                        body = block();
+                    }
                 }
             }
+
+            JCMethodDecl result =
+                    toP(F.at(pos).MethodDef(mods, name, type, typarams,
+                                            receiverParam, params, thrown,
+                                            body, defaultValue));
+            attach(result, dc);
+            return result;
+        } finally {
+            this.receiverParam = prevReceiverParam;
         }
-
-        JCMethodDecl result =
-            toP(F.at(pos).MethodDef(mods, name, type, typarams,
-                                    params, thrown,
-                                    body, defaultValue));
-        attach(result, dc);
-        return result;
     }
 
-    /** QualidentList = Qualident {"," Qualident}
+    /** QualidentList = [Annotations] Qualident {"," [Annotations] Qualident}
      */
     List<JCExpression> qualidentList() {
         ListBuffer<JCExpression> ts = new ListBuffer<JCExpression>();
-        ts.append(qualident());
+
+        List<JCAnnotation> typeAnnos = typeAnnotationsOpt();
+        if (!typeAnnos.isEmpty())
+            ts.append(toP(F.at(typeAnnos.head.pos).AnnotatedType(typeAnnos, qualident(true))));
+        else
+            ts.append(qualident(true));
         while (token.kind == COMMA) {
             nextToken();
-            ts.append(qualident());
+
+            typeAnnos = typeAnnotationsOpt();
+            if (!typeAnnos.isEmpty())
+                ts.append(toP(F.at(typeAnnos.head.pos).AnnotatedType(typeAnnos, qualident(true))));
+            else
+                ts.append(qualident(true));
         }
         return ts.toList();
     }
@@ -3157,13 +3565,14 @@
 
     /**
      *  {@literal
-     *  TypeParameter = TypeVariable [TypeParameterBound]
+     *  TypeParameter = [Annotations] TypeVariable [TypeParameterBound]
      *  TypeParameterBound = EXTENDS Type {"&" Type}
      *  TypeVariable = Ident
      *  }
      */
     JCTypeParameter typeParameter() {
         int pos = token.pos;
+        List<JCAnnotation> annos = typeAnnotationsOpt();
         Name name = ident();
         ListBuffer<JCExpression> bounds = new ListBuffer<JCExpression>();
         if (token.kind == EXTENDS) {
@@ -3174,7 +3583,7 @@
                 bounds.append(parseType());
             }
         }
-        return toP(F.at(pos).TypeParameter(name, bounds.toList()));
+        return toP(F.at(pos).TypeParameter(name, bounds.toList(), annos));
     }
 
     /** FormalParameters = "(" [ FormalParameterList ] ")"
@@ -3182,14 +3591,24 @@
      *  FormalParameterListNovarargs = [ FormalParameterListNovarargs , ] FormalParameter
      */
     List<JCVariableDecl> formalParameters() {
+        return formalParameters(false);
+    }
+    List<JCVariableDecl> formalParameters(boolean lambdaParameters) {
         ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
-        JCVariableDecl lastParam = null;
+        JCVariableDecl lastParam;
         accept(LPAREN);
         if (token.kind != RPAREN) {
-            params.append(lastParam = formalParameter());
+            this.allowThisIdent = true;
+            lastParam = formalParameter(lambdaParameters);
+            if (lastParam.name.contentEquals(TokenKind.THIS.name)) {
+                this.receiverParam = lastParam;
+            } else {
+                params.append(lastParam);
+            }
+            this.allowThisIdent = false;
             while ((lastParam.mods.flags & Flags.VARARGS) == 0 && token.kind == COMMA) {
                 nextToken();
-                params.append(lastParam = formalParameter());
+                params.append(lastParam = formalParameter(lambdaParameters));
             }
         }
         accept(RPAREN);
@@ -3221,24 +3640,113 @@
         return mods;
     }
 
+    /**
+     * Inserts the annotations (and possibly a new array level)
+     * to the left-most type in an array or nested type.
+     *
+     * When parsing a type like {@code @B Outer.Inner @A []}, the
+     * {@code @A} annotation should target the array itself, while
+     * {@code @B} targets the nested type {@code Outer}.
+     *
+     * Currently the parser parses the annotation first, then
+     * the array, and then inserts the annotation to the left-most
+     * nested type.
+     *
+     * When {@code createNewLevel} is true, then a new array
+     * level is inserted as the most inner type, and have the
+     * annotations target it.  This is useful in the case of
+     * varargs, e.g. {@code String @A [] @B ...}, as the parser
+     * first parses the type {@code String @A []} then inserts
+     * a new array level with {@code @B} annotation.
+     */
+    private JCExpression insertAnnotationsToMostInner(
+            JCExpression type, List<JCAnnotation> annos,
+            boolean createNewLevel) {
+        int origEndPos = getEndPos(type);
+        JCExpression mostInnerType = type;
+        JCArrayTypeTree mostInnerArrayType = null;
+        while (TreeInfo.typeIn(mostInnerType).hasTag(TYPEARRAY)) {
+            mostInnerArrayType = (JCArrayTypeTree) TreeInfo.typeIn(mostInnerType);
+            mostInnerType = mostInnerArrayType.elemtype;
+        }
+
+        if (createNewLevel) {
+            mostInnerType = to(F.at(token.pos).TypeArray(mostInnerType));
+        }
+
+        JCExpression mostInnerTypeToReturn = mostInnerType;
+        if (annos.nonEmpty()) {
+            JCExpression lastToModify = mostInnerType;
+
+            while (TreeInfo.typeIn(mostInnerType).hasTag(SELECT) ||
+                    TreeInfo.typeIn(mostInnerType).hasTag(TYPEAPPLY)) {
+                while (TreeInfo.typeIn(mostInnerType).hasTag(SELECT)) {
+                    lastToModify = mostInnerType;
+                    mostInnerType = ((JCFieldAccess) TreeInfo.typeIn(mostInnerType)).getExpression();
+                }
+                while (TreeInfo.typeIn(mostInnerType).hasTag(TYPEAPPLY)) {
+                    lastToModify = mostInnerType;
+                    mostInnerType = ((JCTypeApply) TreeInfo.typeIn(mostInnerType)).clazz;
+                }
+            }
+
+            mostInnerType = F.at(annos.head.pos).AnnotatedType(annos, mostInnerType);
+
+            if (TreeInfo.typeIn(lastToModify).hasTag(TYPEAPPLY)) {
+                ((JCTypeApply) TreeInfo.typeIn(lastToModify)).clazz = mostInnerType;
+            } else if (TreeInfo.typeIn(lastToModify).hasTag(SELECT)) {
+                ((JCFieldAccess) TreeInfo.typeIn(lastToModify)).selected = mostInnerType;
+            } else {
+                // We never saw a SELECT or TYPEAPPLY, return the annotated type.
+                mostInnerTypeToReturn = mostInnerType;
+            }
+        }
+
+        if (mostInnerArrayType == null) {
+            return mostInnerTypeToReturn;
+        } else {
+            mostInnerArrayType.elemtype = mostInnerTypeToReturn;
+            storeEnd(type, origEndPos);
+            return type;
+        }
+    }
+
     /** FormalParameter = { FINAL | '@' Annotation } Type VariableDeclaratorId
      *  LastFormalParameter = { FINAL | '@' Annotation } Type '...' Ident | FormalParameter
      */
     protected JCVariableDecl formalParameter() {
+        return formalParameter(false);
+    }
+    protected JCVariableDecl formalParameter(boolean lambdaParameter) {
         JCModifiers mods = optFinal(Flags.PARAMETER);
+        // need to distinguish between vararg annos and array annos
+        // look at typeAnnotationsPushedBack comment
+        this.permitTypeAnnotationsPushBack = true;
         JCExpression type = parseType();
+        this.permitTypeAnnotationsPushBack = false;
+
         if (token.kind == ELLIPSIS) {
+            List<JCAnnotation> varargsAnnos = typeAnnotationsPushedBack;
+            typeAnnotationsPushedBack = List.nil();
             checkVarargs();
             mods.flags |= Flags.VARARGS;
-            type = to(F.at(token.pos).TypeArray(type));
+            // insert var arg type annotations
+            type = insertAnnotationsToMostInner(type, varargsAnnos, true);
             nextToken();
+        } else {
+            // if not a var arg, then typeAnnotationsPushedBack should be null
+            if (typeAnnotationsPushedBack.nonEmpty()) {
+                reportSyntaxError(typeAnnotationsPushedBack.head.pos,
+                        "illegal.start.of.type");
+            }
+            typeAnnotationsPushedBack = List.nil();
         }
-        return variableDeclaratorId(mods, type);
+        return variableDeclaratorId(mods, type, lambdaParameter);
     }
 
     protected JCVariableDecl implicitParameter() {
         JCModifiers mods = F.at(token.pos).Modifiers(Flags.PARAMETER);
-        return variableDeclaratorId(mods, null);
+        return variableDeclaratorId(mods, null, true);
     }
 
 /* ---------- auxiliary methods -------------- */
@@ -3479,6 +3987,18 @@
             allowIntersectionTypesInCast = true;
         }
     }
+    void checkStaticInterfaceMethods() {
+        if (!allowStaticInterfaceMethods) {
+            log.error(token.pos, "static.intf.methods.not.supported.in.source", source.name);
+            allowStaticInterfaceMethods = true;
+        }
+    }
+    void checkTypeAnnotations() {
+        if (!allowTypeAnnotations) {
+            log.error(token.pos, "type.annotations.not.supported.in.source", source.name);
+            allowTypeAnnotations = true;
+        }
+    }
 
     /*
      * a functional source tree and end position mappings
--- a/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -236,7 +236,7 @@
             // relative to the best match found in the array.
             if (pos == Position.NOPOS)
                 return Position.NOPOS;
-            if (pos < 0 || pos >= docComment.length())
+            if (pos < 0 || pos > docComment.length())
                 throw new StringIndexOutOfBoundsException(String.valueOf(pos));
             if (docPosns == null)
                 return Position.NOPOS;
--- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -59,6 +59,7 @@
     private List<Token> savedTokens = new ArrayList<Token>();
 
     private JavaTokenizer tokenizer;
+
     /**
      * Create a scanner from the input array.  This method might
      * modify the array.  To avoid copying the input array, ensure
--- a/src/share/classes/com/sun/tools/javac/parser/Tokens.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/Tokens.java	Tue Jul 02 10:13:00 2013 +0100
@@ -33,6 +33,7 @@
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Filter;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Names;
 
@@ -74,7 +75,6 @@
     protected Tokens(Context context) {
         context.put(tokensKey, this);
         names = Names.instance(context);
-
         for (TokenKind t : TokenKind.values()) {
             if (t.name != null)
                 enterKeyword(t.name, t);
@@ -113,7 +113,7 @@
      * This enum defines all tokens used by the javac scanner. A token is
      * optionally associated with a name.
      */
-    public enum TokenKind implements Formattable {
+    public enum TokenKind implements Formattable, Filter<TokenKind> {
         EOF(),
         ERROR(),
         IDENTIFIER(Tag.NAMED),
@@ -176,6 +176,7 @@
         TRUE("true", Tag.NAMED),
         FALSE("false", Tag.NAMED),
         NULL("null", Tag.NAMED),
+        UNDERSCORE("_", Tag.NAMED),
         ARROW("->"),
         COLCOL("::"),
         LPAREN("("),
@@ -283,6 +284,11 @@
         public String toString(Locale locale, Messages messages) {
             return name != null ? toString() : messages.getLocalizedString(locale, "compiler.misc." + toString());
         }
+
+        @Override
+        public boolean accepts(TokenKind that) {
+            return this == that;
+        }
     }
 
     public interface Comment {
--- a/src/share/classes/com/sun/tools/javac/parser/UnicodeReader.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/parser/UnicodeReader.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -38,7 +38,7 @@
 
 /** The char reader used by the javac lexer/tokenizer. Returns the sequence of
  * characters contained in the input stream, handling unicode escape accordingly.
- * Additionally, it provide features for saving chars into a buffer and to retrieve
+ * Additionally, it provides features for saving chars into a buffer and to retrieve
  * them at a later stage.
  *
  *  <p><b>This is NOT part of any supported API.
--- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -817,9 +817,6 @@
         /** The set of package-info files to be processed this round. */
         List<PackageSymbol> packageInfoFiles;
 
-        /** The number of Messager errors generated in this round. */
-        int nMessagerErrors;
-
         /** Create a round (common code). */
         private Round(Context context, int number, int priorErrors, int priorWarnings,
                 Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
@@ -829,7 +826,7 @@
             compiler = JavaCompiler.instance(context);
             log = Log.instance(context);
             log.nerrors = priorErrors;
-            log.nwarnings += priorWarnings;
+            log.nwarnings = priorWarnings;
             if (number == 1) {
                 Assert.checkNonNull(deferredDiagnosticHandler);
                 this.deferredDiagnosticHandler = deferredDiagnosticHandler;
@@ -870,7 +867,7 @@
                 Set<JavaFileObject> newSourceFiles, Map<String,JavaFileObject> newClassFiles) {
             this(prev.nextContext(),
                     prev.number+1,
-                    prev.nMessagerErrors,
+                    prev.compiler.log.nerrors,
                     prev.compiler.log.nwarnings,
                     null);
             this.genClassFiles = prev.genClassFiles;
@@ -911,15 +908,12 @@
         }
 
         /** Create the compiler to be used for the final compilation. */
-        JavaCompiler finalCompiler(boolean errorStatus) {
+        JavaCompiler finalCompiler() {
             try {
                 Context nextCtx = nextContext();
                 JavacProcessingEnvironment.this.context = nextCtx;
                 JavaCompiler c = JavaCompiler.instance(nextCtx);
-                c.log.nwarnings += compiler.log.nwarnings;
-                if (errorStatus) {
-                    c.log.nerrors += compiler.log.nerrors;
-                }
+                c.log.initRound(compiler.log);
                 return c;
             } finally {
                 compiler.close(false);
@@ -1027,8 +1021,6 @@
                 if (!taskListener.isEmpty())
                     taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING_ROUND));
             }
-
-            nMessagerErrors = messager.errorCount();
         }
 
         void showDiagnostics(boolean showAll) {
@@ -1107,9 +1099,7 @@
             next.put(Tokens.tokensKey, tokens);
 
             Log nextLog = Log.instance(next);
-            // propogate the log's writers directly, instead of going through context
-            nextLog.setWriters(log);
-            nextLog.setSourceMap(log);
+            nextLog.initRound(log);
 
             JavaCompiler oldCompiler = JavaCompiler.instance(context);
             JavaCompiler nextCompiler = JavaCompiler.instance(next);
@@ -1206,7 +1196,7 @@
                 new LinkedHashSet<JavaFileObject>(filer.getGeneratedSourceFileObjects());
         roots = cleanTrees(round.roots);
 
-        JavaCompiler compiler = round.finalCompiler(errorStatus);
+        JavaCompiler compiler = round.finalCompiler();
 
         if (newSourceFiles.size() > 0)
             roots = roots.appendList(compiler.parseFiles(newSourceFiles));
@@ -1311,7 +1301,6 @@
         if (procNames != null)
             return true;
 
-        String procPath;
         URL[] urls = new URL[1];
         for(File pathElement : workingpath) {
             try {
@@ -1382,6 +1371,10 @@
                 node.sym = null;
                 super.visitIdent(node);
             }
+            public void visitAnnotation(JCAnnotation node) {
+                node.attribute = null;
+                super.visitAnnotation(node);
+            }
         };
 
 
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -178,13 +178,22 @@
 compiler.misc.incompatible.abstracts=\
     multiple non-overriding abstract methods found in {0} {1}
 
-compiler.misc.not.a.functional.intf=\
-    the target type must be a functional interface
+compiler.err.bad.functional.intf.anno=\
+    Unexpected @FunctionalInterface annotation
 
 # 0: message segment
+compiler.err.bad.functional.intf.anno.1=\
+    Unexpected @FunctionalInterface annotation\n\
+    {0}
+
+# 0: symbol
+compiler.misc.not.a.functional.intf=\
+    {0} is not a functional interface
+
+# 0: symbol, 1: message segment
 compiler.misc.not.a.functional.intf.1=\
-    the target type must be a functional interface\n\
-    {0}
+    {0} is not a functional interface\n\
+    {1}
 
 # 0: symbol, 1: symbol kind, 2: symbol
 compiler.misc.invalid.generic.lambda.target=\
@@ -319,64 +328,48 @@
 compiler.err.duplicate.annotation.missing.container=\
     duplicate annotation, the declaration of {0} does not have a valid {1} annotation
 
-# 0: type, 1: type
-compiler.err.invalid.container.no.containedby=\
-    invalid contained repeatable annotation, {0} is not annotated with {1}
-
-# 0: type, 1: type
-compiler.err.invalid.container.wrong.containedby=\
-    invalid contained repeatable annotation, {0} does not match {1}
-
-# 0: type, 1: type
-compiler.err.invalid.container.no.containerfor=\
-    invalid container for repeating annotations, {0} is not annotated with {1}
-
-# 0: type, 1: type
-compiler.err.invalid.container.wrong.containerfor=\
-    invalid container for repeating annotations, {0} does not match {1}
+# 0: type
+compiler.err.invalid.repeatable.annotation=\
+    duplicate annotation, {0} is annotated with an invalid Repeatable annotation
 
 # 0: type
-compiler.err.invalid.containedby.annotation=\
-    duplicate annotation, {0} is annotated with an invalid ContainedBy annotation
-
-# 0: type
-compiler.err.invalid.containedby.annotation.no.value=\
-    duplicate annotation, {0} is not a valid ContainedBy, no value element method declared
+compiler.err.invalid.repeatable.annotation.no.value=\
+    duplicate annotation, {0} is not a valid Repeatable, no value element method declared
 
 # 0: type, 1: number
-compiler.err.invalid.containedby.annotation.multiple.values=\
-    duplicate annotation, {0} is not a valid ContainedBy, {1} value element methods declared
+compiler.err.invalid.repeatable.annotation.multiple.values=\
+    duplicate annotation, {0} is not a valid Repeatable, {1} value element methods declared
 
 # 0: type
-compiler.err.invalid.containedby.annotation.invalid.value=\
-    duplicate annotation, {0} is not a valid ContainedBy, invalid value element, need a method
+compiler.err.invalid.repeatable.annotation.invalid.value=\
+    duplicate annotation, {0} is not a valid Repeatable, invalid value element, need a method
 
 # 0: type, 1: type, 2: type
-compiler.err.invalid.containedby.annotation.value.return=\
+compiler.err.invalid.repeatable.annotation.value.return=\
     duplicate annotation, value element of containing annotation {0} should have type {2}, found {1}
 
 # 0: type, 1: symbol
-compiler.err.invalid.containedby.annotation.elem.nondefault=\
+compiler.err.invalid.repeatable.annotation.elem.nondefault=\
     containing annotation {0} does not have a default value for element {1}
 
 # 0: symbol, 1: type, 2: symbol, 3: type
-compiler.err.invalid.containedby.annotation.retention=\
+compiler.err.invalid.repeatable.annotation.retention=\
     containing annotation {0} has shorter retention ({1}) than the contained annotation {2} with retention {3}
 
 # 0: symbol, 1: symbol
-compiler.err.invalid.containedby.annotation.not.documented=\
+compiler.err.invalid.repeatable.annotation.not.documented=\
     containing annotation type, {0}, is not @Documented while repeated annotation type, {1}, is
 
 # 0: symbol, 1: symbol
-compiler.err.invalid.containedby.annotation.not.inherited=\
+compiler.err.invalid.repeatable.annotation.not.inherited=\
     containing annotation type, {0}, is not @Inherited while repeated annotation type, {1}, is
 
 # 0: symbol, 1: symbol
-compiler.err.invalid.containedby.annotation.incompatible.target=\
+compiler.err.invalid.repeatable.annotation.incompatible.target=\
     target of container annotation {0} is not a subset of target of repeated annotation {1}
 
 # 0: symbol
-compiler.err.invalid.containedby.annotation.repeated.and.container.present=\
+compiler.err.invalid.repeatable.annotation.repeated.and.container.present=\
     container {0} must not be present at the same time as the element it contains
 
 # 0: name
@@ -492,6 +485,10 @@
 compiler.err.illegal.forward.ref=\
     illegal forward reference
 
+# 0: symbol, 1: string
+compiler.err.not.in.profile=\
+    {0} is not available in profile ''{1}''
+
 # 0: symbol
 compiler.warn.forward.ref=\
     reference to variable ''{0}'' before it has been initialized
@@ -731,6 +728,9 @@
 compiler.misc.incompatible.arg.types.in.lambda=\
     incompatible parameter types in lambda expression
 
+compiler.misc.incompatible.arg.types.in.mref=\
+    incompatible parameter types in method reference
+
 compiler.err.new.not.allowed.in.annotation=\
     ''new'' not allowed in an annotation
 
@@ -766,6 +766,10 @@
 compiler.err.not.def.public.cant.access=\
     {0} is not public in {1}; cannot be accessed from outside package
 
+# 0: symbol, 1: symbol
+compiler.misc.not.def.public.cant.access=\
+    {0} is not public in {1}; cannot be accessed from outside package
+
 # 0: name
 compiler.err.not.loop.label=\
     not a loop label: {0}
@@ -955,6 +959,11 @@
 compiler.err.default.overrides.object.member=\
     default method {0} in {1} {2} overrides a member of java.lang.Object
 
+# 0: type
+compiler.err.illegal.static.intf.meth.call=\
+    illegal static interface method call\n\
+    the receiver expression should be replaced with the type qualifier ''{0}''
+
 # 0: type, 1: message segment
 compiler.err.illegal.default.super.call=\
     bad type qualifier {0} in default super call\n\
@@ -1668,6 +1677,9 @@
 compiler.misc.bad.signature=\
     bad signature: {0}
 
+compiler.misc.bad.type.annotation.value=\
+    bad type annotation target type value: {0}
+
 compiler.misc.class.file.wrong.class=\
     class file contains wrong class: {0}
 
@@ -1893,6 +1905,10 @@
 compiler.misc.non-static.cant.be.ref=\
     non-static {0} {1} cannot be referenced from a static context
 
+# 0: symbol kind, 1: symbol
+compiler.misc.static.method.in.unbound.lookup=\
+    static {0} {1} found in unbound lookup
+
 ## Both arguments ({0}, {1}) are "kindname"s.  {0} is a comma-separated list
 ## of kindnames (the list should be identical to that provided in source.
 compiler.err.unexpected.type=\
@@ -2061,6 +2077,10 @@
     {0}\n\
     overridden method does not throw {1}
 
+# 0: symbol
+compiler.warn.override.equals.but.not.hashcode=\
+    Class {0} overrides equals, but neither it nor any superclass overrides hashCode method
+
 ## The following are all possible strings for the first argument ({0}) of the
 ## above strings.
 # 0: symbol, 1: symbol, 2: symbol, 3: symbol
@@ -2139,6 +2159,10 @@
     as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
     (use -source 1.4 or higher to use ''assert'' as a keyword)
 
+compiler.warn.underscore.as.identifier=\
+    ''_'' used as an identifier\n\
+    (use of ''_'' as an identifier might not be supported in future releases)
+
 compiler.err.enum.as.identifier=\
     as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
     (use -source 1.4 or lower to use ''enum'' as an identifier)
@@ -2147,6 +2171,23 @@
     as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
     (use -source 1.3 or lower to use ''assert'' as an identifier)
 
+# TODO 308: make a better error message
+compiler.err.this.as.identifier=\
+    as of release 8, ''this'' is allowed as the parameter name for the receiver type only, which has to be the first parameter
+
+# TODO 308: make a better error message
+compiler.err.cant.annotate.static.class=\
+    enclosing static nested class cannot be annotated
+# TODO 308: make a better error message
+compiler.err.cant.annotate.nested.type=\
+    nested type cannot be annotated
+
+compiler.err.incorrect.receiver.type=\
+    the receiver type does not match the enclosing class type
+
+compiler.err.no.annotations.on.dot.class=\
+    no annotations are allowed in the type of a class literal
+
 # 0: string
 compiler.err.generics.not.supported.in.source=\
     generics are not supported in -source {0}\n\
@@ -2162,9 +2203,10 @@
     annotations are not supported in -source {0}\n\
     (use -source 5 or higher to enable annotations)
 
-#308 compiler.err.type.annotations.not.supported.in.source=\
-#308     type annotations are not supported in -source {0}\n\
-#308 (use -source 7 or higher to enable type annotations)
+# 0: string
+compiler.err.type.annotations.not.supported.in.source=\
+    type annotations are not supported in -source {0}\n\
+(use -source 8 or higher to enable type annotations)
 
 # 0: string
 compiler.err.foreach.not.supported.in.source=\
@@ -2216,6 +2258,11 @@
     intersection types in cast are not supported in -source {0}\n\
     (use -source 8 or higher to enable default methods)
 
+# 0: string
+compiler.err.static.intf.methods.not.supported.in.source=\
+    static interface methods are not supported in -source {0}\n\
+    (use -source 8 or higher to enable static interface methods)
+
 ########################################
 # Diagnostics for verbose resolution
 # used by Resolve (debug only)
--- a/src/share/classes/com/sun/tools/javac/resources/compiler_ja.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler_ja.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -65,8 +65,11 @@
 
 compiler.err.already.annotated={0} {1}\u306F\u6CE8\u91C8\u304C\u4ED8\u3044\u3066\u3044\u307E\u3059
 
-# 0: symbol, 1: symbol
-compiler.err.already.defined={0}\u306F{1}\u3067\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059
+# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol
+compiler.err.already.defined={0} {1}\u306F\u3059\u3067\u306B{2} {3}\u3067\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059
+
+# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol kind, 4: symbol
+compiler.err.already.defined.in.clinit={0} {1}\u306F\u3059\u3067\u306B{3} {4}\u306E{2}\u3067\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059
 
 # 0: string
 compiler.err.already.defined.single.import={0}\u306F\u5358\u4E00\u306E\u578B\u30A4\u30F3\u30DD\u30FC\u30C8\u5BA3\u8A00\u3067\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059
@@ -109,28 +112,84 @@
 # 0: type
 compiler.err.array.req.but.found=\u914D\u5217\u304C\u8981\u6C42\u3055\u308C\u307E\u3057\u305F\u304C\u3001{0}\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F
 
-compiler.err.assignment.from.super-bound=\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9{0}\u304B\u3089\u4EE3\u5165\u3057\u3066\u3044\u307E\u3059
-
-compiler.err.assignment.to.extends-bound=\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9{0}\u3078\u4EE3\u5165\u3057\u3066\u3044\u307E\u3059
-
 compiler.err.attribute.value.must.be.constant=\u5C5E\u6027\u306E\u5024\u306F\u5B9A\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
 
+# 0: statement type
+compiler.err.bad.initializer={0}\u306E\u4E0D\u6B63\u306A\u521D\u671F\u5316\u5B50
+
 compiler.err.break.outside.switch.loop=break\u304Cswitch\u6587\u307E\u305F\u306F\u30EB\u30FC\u30D7\u306E\u5916\u306B\u3042\u308A\u307E\u3059
 
 # 0: name
 compiler.err.call.must.be.first.stmt.in.ctor={0}\u306E\u547C\u51FA\u3057\u306F\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u5148\u982D\u6587\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
 
-compiler.err.cant.apply.symbol={4} {5}\u306E{0} {1}\u306F\u6307\u5B9A\u3055\u308C\u305F\u578B\u306B\u9069\u7528\u3067\u304D\u307E\u305B\u3093\n\u671F\u5F85\u5024: {2}\n\u691C\u51FA\u5024: {3}
-
 # 0: symbol kind, 1: name, 2: list of type or message segment, 3: list of type or message segment, 4: symbol kind, 5: type, 6: message segment
-compiler.err.cant.apply.symbol.1={4} {5}\u306E{0} {1}\u306F\u6307\u5B9A\u3055\u308C\u305F\u578B\u306B\u9069\u7528\u3067\u304D\u307E\u305B\u3093\u3002\n\u671F\u5F85\u5024: {2}\n\u691C\u51FA\u5024: {3}\n\u7406\u7531: {6}
+compiler.err.cant.apply.symbol={4} {5}\u306E{0} {1}\u306F\u6307\u5B9A\u3055\u308C\u305F\u578B\u306B\u9069\u7528\u3067\u304D\u307E\u305B\u3093\u3002\n\u671F\u5F85\u5024: {2}\n\u691C\u51FA\u5024: {3}\n\u7406\u7531: {6}
 
 # 0: symbol kind, 1: name, 2: list of type
 compiler.err.cant.apply.symbols={1}\u306B\u9069\u5207\u306A{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093({2})
 
+# 0: symbol kind, 1: name, 2: list of type or message segment, 3: list of type or message segment, 4: symbol kind, 5: type, 6: message segment
+compiler.misc.cant.apply.symbol={4} {5}\u306E{0} {1}\u306F\u6307\u5B9A\u3055\u308C\u305F\u578B\u306B\u9069\u7528\u3067\u304D\u307E\u305B\u3093\n\u671F\u5F85\u5024: {2}\n\u691C\u51FA\u5024: {3}\n\u7406\u7531: {6}
+
+# 0: symbol kind, 1: name, 2: list of type
+compiler.misc.cant.apply.symbols={1}\u306B\u9069\u5207\u306A{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093({2})
+
+# 0: symbol kind, 1: symbol
+compiler.misc.no.abstracts={0} {1}\u3067\u62BD\u8C61\u30E1\u30BD\u30C3\u30C9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+
+# 0: symbol kind, 1: symbol
+compiler.misc.incompatible.abstracts={0} {1}\u3067\u8907\u6570\u306E\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u306A\u3044\u62BD\u8C61\u30E1\u30BD\u30C3\u30C9\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F
+
+compiler.err.bad.functional.intf.anno=\u4E88\u671F\u3057\u306A\u3044@FunctionalInterface\u6CE8\u91C8
+
+# 0: message segment
+compiler.err.bad.functional.intf.anno.1=\u4E88\u671F\u3057\u306A\u3044@FunctionalInterface\u6CE8\u91C8\n{0}
+
+# 0: symbol
+compiler.misc.not.a.functional.intf={0}\u306F\u6A5F\u80FD\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
+
+# 0: symbol, 1: message segment
+compiler.misc.not.a.functional.intf.1={0}\u306F\u6A5F\u80FD\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\n{1}
+
+# 0: symbol, 1: symbol kind, 2: symbol
+compiler.misc.invalid.generic.lambda.target=\u30E9\u30E0\u30C0\u5F0F\u306E\u6A5F\u80FD\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u304C\u7121\u52B9\u3067\u3059\n{1} {2}\u306E\u30E1\u30BD\u30C3\u30C9{0}\u306F\u6C4E\u7528\u3067\u3059
+
+# 0: symbol kind, 1: symbol
+compiler.misc.incompatible.descs.in.functional.intf={0} {1}\u3067\u4E0D\u9069\u5408\u306A\u6A5F\u80FD\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F
+
+# 0: name, 1: list of type, 2: type, 3: list of type
+compiler.misc.descriptor=\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF: {2} {0}({1})
+
+# 0: name, 1: list of type, 2: type, 3: list of type
+compiler.misc.descriptor.throws=\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF: {2} {0}({1})\u3067{3}\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3059
+
+# 0: type
+compiler.misc.no.suitable.functional.intf.inst={0}\u306E\u6A5F\u80FD\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u30FB\u30C7\u30A3\u30B9\u30AF\u30EA\u30D7\u30BF\u3092\u63A8\u8AD6\u3067\u304D\u307E\u305B\u3093
+
+# 0: type
+compiler.misc.secondary.bound.must.be.marker.intf=\u30BB\u30AB\u30F3\u30C0\u30EA\u30FB\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0{0}\u306F\u30DE\u30FC\u30AB\u30FC\u30FB\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+
+# 0: symbol kind, 1: message segment
+compiler.err.invalid.mref={0}\u53C2\u7167\u304C\u7121\u52B9\u3067\u3059\u3002{1}
+
+# 0: symbol kind, 1: message segment
+compiler.misc.invalid.mref={0}\u53C2\u7167\u304C\u7121\u52B9\u3067\u3059\u3002{1}
+
+compiler.misc.static.mref.with.targs=static\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u5316\u3055\u308C\u305F\u4FEE\u98FE\u5B50
+
+compiler.misc.static.bound.mref=static\u306E\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u3055\u308C\u305F\u30E1\u30BD\u30C3\u30C9\u53C2\u7167
+
 # 0: symbol
 compiler.err.cant.assign.val.to.final.var=final\u5909\u6570{0}\u306B\u5024\u3092\u4EE3\u5165\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
 
+# 0: symbol, 1: message segment
+compiler.err.cant.ref.non.effectively.final.var={1}\u304B\u3089\u53C2\u7167\u3055\u308C\u308B\u30ED\u30FC\u30AB\u30EB\u5909\u6570\u306F\u3001final\u307E\u305F\u306F\u4E8B\u5B9F\u4E0A\u306Efinal\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+
+
+compiler.misc.lambda=\u30E9\u30E0\u30C0\u5F0F
+
+compiler.misc.inner.cls=\u5185\u90E8\u30AF\u30E9\u30B9
+
 # 0: type
 compiler.err.cant.deref={0}\u306F\u9593\u63A5\u53C2\u7167\u3067\u304D\u307E\u305B\u3093
 
@@ -142,8 +201,6 @@
 # 0: symbol
 compiler.err.cant.ref.before.ctor.called=\u30B9\u30FC\u30D1\u30FC\u30BF\u30A4\u30D7\u306E\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u547C\u51FA\u3057\u524D\u306F{0}\u3092\u53C2\u7167\u3067\u304D\u307E\u305B\u3093
 
-compiler.err.cant.ret.val.from.meth.decl.void=\u623B\u308A\u5024\u306E\u578B\u304Cvoid\u306E\u30E1\u30BD\u30C3\u30C9\u304B\u3089\u306F\u5024\u3092\u8FD4\u305B\u307E\u305B\u3093
-
 compiler.err.cant.select.static.class.from.param.type=\u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3055\u308C\u305F\u578B\u304B\u3089static\u30AF\u30E9\u30B9\u3092\u9078\u629E\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
 
 # 0: symbol, 1: string, 2: string
@@ -154,6 +211,8 @@
 # 0: symbol kind, 1: symbol
 compiler.err.clash.with.pkg.of.same.name={0} {1}\u306F\u540C\u540D\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u3068\u7AF6\u5408\u3057\u307E\u3059
 
+compiler.err.class.not.allowed=\u30AF\u30E9\u30B9\u3001\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u307E\u305F\u306F\u5217\u6319\u578B\u306E\u5BA3\u8A00\u3092\u3053\u3053\u3067\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
+
 compiler.err.const.expr.req=\u5B9A\u6570\u5F0F\u304C\u5FC5\u8981\u3067\u3059
 
 compiler.err.cont.outside.loop=continue\u304C\u30EB\u30FC\u30D7\u306E\u5916\u306B\u3042\u308A\u307E\u3059
@@ -169,10 +228,8 @@
 # 0: type
 compiler.err.no.superclass={0}\u306B\u306F\u30B9\u30FC\u30D1\u30FC\u30AF\u30E9\u30B9\u304C\u3042\u308A\u307E\u305B\u3093
 
-compiler.err.wrong.target.for.polymorphic.signature.definition=MethodHandle API\u306E\u4F5C\u6210\u306B\u306F-target 7\u30E9\u30F3\u30BF\u30A4\u30E0\u4EE5\u4E0A\u304C\u5FC5\u8981\u3067\u3059\u3002\u73FE\u5728\u306F-target {0}\u3067\u3059
-
 # 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
-compiler.err.concrete.inheritance.conflict={1}\u306E\u30E1\u30BD\u30C3\u30C9{0}\u3068{3}\u306E{2}\u306F\u540C\u3058\u30B7\u30B0\u30CB\u30C1\u30E3\u304B\u3089\u7D99\u627F\u3055\u308C\u3066\u3044\u307E\u3059
+compiler.err.concrete.inheritance.conflict={1}\u306E\u30E1\u30BD\u30C3\u30C9{0}\u3068{3}\u306E{2}\u306F\u540C\u3058\u30B7\u30B0\u30CD\u30C1\u30E3\u304B\u3089\u7D99\u627F\u3055\u308C\u3066\u3044\u307E\u3059
 
 compiler.err.default.allowed.in.intf.annotation.member=\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u306F@interface\u30E1\u30F3\u30D0\u30FC\u5185\u3067\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059
 
@@ -181,9 +238,48 @@
 
 compiler.err.duplicate.annotation=\u6CE8\u91C8\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059
 
+# 0: type
+compiler.err.duplicate.annotation.invalid.repeated=\u6CE8\u91C8{0}\u3092\u7E70\u308A\u8FD4\u305B\u307E\u305B\u3093\n\u6709\u52B9\u306A\u5305\u542B\u3059\u308B\u6CE8\u91C8\u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+
 # 0: name, 1: type
 compiler.err.duplicate.annotation.member.value={1}\u306E\u6CE8\u91C8\u30E1\u30F3\u30D0\u30FC\u306E\u5024{0}\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059
 
+# 0: type, 1: type
+compiler.err.duplicate.annotation.missing.container=\u6CE8\u91C8\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002{0}\u306E\u5BA3\u8A00\u306B\u306F\u6709\u52B9\u306A{1}\u6CE8\u91C8\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+
+# 0: type
+compiler.err.invalid.repeatable.annotation=\u6CE8\u91C8\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002{0}\u306F\u7121\u52B9\u306A\u7E70\u8FD4\u3057\u53EF\u80FD\u6CE8\u91C8\u3067\u6CE8\u91C8\u4ED8\u3051\u3055\u308C\u3066\u3044\u307E\u3059
+
+# 0: type
+compiler.err.invalid.repeatable.annotation.no.value=\u6CE8\u91C8\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002{0}\u306F\u6709\u52B9\u306A\u7E70\u8FD4\u3057\u53EF\u80FD\u306A\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u5024\u8981\u7D20\u30E1\u30BD\u30C3\u30C9\u304C\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+
+# 0: type, 1: number
+compiler.err.invalid.repeatable.annotation.multiple.values=\u6CE8\u91C8\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002{0}\u306F\u6709\u52B9\u306A\u7E70\u8FD4\u3057\u53EF\u80FD\u306A\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002{1}\u5024\u8981\u7D20\u30E1\u30BD\u30C3\u30C9\u304C\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059
+
+# 0: type
+compiler.err.invalid.repeatable.annotation.invalid.value=\u6CE8\u91C8\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002{0}\u306F\u6709\u52B9\u306A\u7E70\u8FD4\u3057\u53EF\u80FD\u306A\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u5024\u8981\u7D20\u304C\u7121\u52B9\u3067\u3059\u3002\u30E1\u30BD\u30C3\u30C9\u304C\u5FC5\u8981\u3067\u3059
+
+# 0: type, 1: type, 2: type
+compiler.err.invalid.repeatable.annotation.value.return=\u6CE8\u91C8\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002\u5305\u542B\u3059\u308B\u6CE8\u91C8{0}\u306E\u5024\u8981\u7D20\u306B\u306F\u578B{2}\u3092\u6307\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002{1}\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F
+
+# 0: type, 1: symbol
+compiler.err.invalid.repeatable.annotation.elem.nondefault=\u5305\u542B\u3059\u308B\u6CE8\u91C8{0}\u306B\u306F\u8981\u7D20{1}\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+
+# 0: symbol, 1: type, 2: symbol, 3: type
+compiler.err.invalid.repeatable.annotation.retention=\u5305\u542B\u3059\u308B\u6CE8\u91C8{0}\u306B\u306F\u3001\u4FDD\u6709{3}\u3092\u542B\u3080\u5305\u542B\u3055\u308C\u305F\u6CE8\u91C8{2}\u3088\u308A\u77ED\u3044\u4FDD\u6709({1})\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059
+
+# 0: symbol, 1: symbol
+compiler.err.invalid.repeatable.annotation.not.documented=\u7E70\u308A\u8FD4\u3055\u308C\u305F\u6CE8\u91C8{1}\u306F@Documented\u3067\u3059\u304C\u3001\u5305\u542B\u3059\u308B\u6CE8\u91C8\u30BF\u30A4\u30D7{0}\u306F\u9055\u3044\u307E\u3059
+
+# 0: symbol, 1: symbol
+compiler.err.invalid.repeatable.annotation.not.inherited=\u308A\u8FD4\u3055\u308C\u305F\u6CE8\u91C8\u30BF\u30A4\u30D7{1}\u306F@Inherited\u3067\u3059\u304C\u3001\u5305\u542B\u3059\u308B\u6CE8\u91C8\u30BF\u30A4\u30D7{0}\u306F\u9055\u3044\u307E\u3059
+
+# 0: symbol, 1: symbol
+compiler.err.invalid.repeatable.annotation.incompatible.target=\u30B3\u30F3\u30C6\u30CA\u6CE8\u91C8{0}\u306E\u30BF\u30FC\u30B2\u30C3\u30C8\u306F\u3001\u7E70\u308A\u8FD4\u3055\u308C\u305F\u6CE8\u91C8{1}\u306E\u30BF\u30FC\u30B2\u30C3\u30C8\u306E\u30B5\u30D6\u30BB\u30C3\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+
+# 0: symbol
+compiler.err.invalid.repeatable.annotation.repeated.and.container.present=\u30B3\u30F3\u30C6\u30CA{0}\u306F\u542B\u307E\u308C\u3066\u3044\u308B\u8981\u7D20\u3068\u540C\u6642\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093
+
 # 0: name
 compiler.err.duplicate.class=\u30AF\u30E9\u30B9{0}\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059
 
@@ -245,10 +341,10 @@
 compiler.err.generic.throwable=\u6C4E\u7528\u30AF\u30E9\u30B9\u306Fjava.lang.Throwable\u3092\u62E1\u5F35\u3067\u304D\u307E\u305B\u3093
 
 # 0: symbol
-compiler.err.icls.cant.have.static.decl=\u5185\u90E8\u30AF\u30E9\u30B9{0}\u306E\u9759\u7684\u5BA3\u8A00\u304C\u4E0D\u6B63\u3067\u3059\n\u4FEE\u98FE\u5B50\''static\''\u306F\u5B9A\u6570\u304A\u3088\u3073\u5909\u6570\u306E\u5BA3\u8A00\u3067\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059
+compiler.err.icls.cant.have.static.decl=\u5185\u90E8\u30AF\u30E9\u30B9{0}\u306E\u9759\u7684\u5BA3\u8A00\u304C\u4E0D\u6B63\u3067\u3059\n\u4FEE\u98FE\u5B50''static''\u306F\u5B9A\u6570\u304A\u3088\u3073\u5909\u6570\u306E\u5BA3\u8A00\u3067\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059
 
 # 0: string
-compiler.err.illegal.char=\\{0}\u306F\u4E0D\u6B63\u306A\u6587\u5B57\u3067\u3059
+compiler.err.illegal.char=''{0}''\u306F\u4E0D\u6B63\u306A\u6587\u5B57\u3067\u3059
 
 compiler.err.illegal.char.for.encoding=\u3053\u306E\u6587\u5B57\u306F\u3001\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0{0}\u306B\u30DE\u30C3\u30D7\u3067\u304D\u307E\u305B\u3093
 
@@ -280,11 +376,15 @@
 
 compiler.err.illegal.underscore=\u4E0D\u6B63\u306A\u30A2\u30F3\u30C0\u30FC\u30B9\u30B3\u30A2\u3067\u3059
 
+compiler.err.illegal.dot=\u4E0D\u6B63\u306A''.''\u3067\u3059
+
 # 0: symbol
 compiler.err.illegal.qual.not.icls=\u4FEE\u98FE\u5B50\u304C\u4E0D\u6B63\u3067\u3059\u3002{0}\u306F\u5185\u90E8\u30AF\u30E9\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093
 
 compiler.err.illegal.start.of.expr=\u5F0F\u306E\u958B\u59CB\u304C\u4E0D\u6B63\u3067\u3059
 
+compiler.err.illegal.start.of.stmt=\u6587\u306E\u958B\u59CB\u304C\u4E0D\u6B63\u3067\u3059
+
 compiler.err.illegal.start.of.type=\u578B\u306E\u958B\u59CB\u304C\u4E0D\u6B63\u3067\u3059
 
 compiler.err.illegal.unicode.esc=Unicode\u30A8\u30B9\u30B1\u30FC\u30D7\u304C\u4E0D\u6B63\u3067\u3059
@@ -302,8 +402,6 @@
 # 0: number
 compiler.err.int.number.too.large=\u6574\u6570{0}\u304C\u5927\u304D\u3059\u304E\u307E\u3059
 
-compiler.err.internal.error.cant.instantiate=\u5185\u90E8\u30A8\u30E9\u30FC\u3067\u3059\u3002{0}\u3092{1}\u3067({2})\u306B\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u751F\u6210\u3067\u304D\u307E\u305B\u3093
-
 compiler.err.intf.annotation.members.cant.have.params=@interface\u30E1\u30F3\u30D0\u30FC\u304C\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6301\u3064\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
 
 compiler.err.intf.annotation.cant.have.type.params=@interface\u304C\u578B\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6301\u3064\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
@@ -315,7 +413,7 @@
 
 compiler.err.intf.expected.here=\u3053\u3053\u306B\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u304C\u5FC5\u8981\u3067\u3059
 
-compiler.err.intf.meth.cant.have.body=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u672C\u4F53\u3092\u6301\u3064\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
+compiler.err.intf.meth.cant.have.body=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u62BD\u8C61\u30E1\u30BD\u30C3\u30C9\u304C\u672C\u4F53\u3092\u6301\u3064\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
 
 compiler.err.invalid.annotation.member.type=\u6CE8\u91C8\u30E1\u30F3\u30D0\u30FC\u306E\u578B\u304C\u4E0D\u6B63\u3067\u3059
 
@@ -327,6 +425,8 @@
 
 compiler.err.varargs.and.old.array.syntax=\u65E7\u5F0F\u306E\u914D\u5217\u8868\u8A18\u6CD5\u306F\u53EF\u5909\u5F15\u6570\u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
 
+compiler.err.variable.not.allowed=\u5909\u6570\u306E\u5BA3\u8A00\u3092\u3053\u3053\u3067\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
+
 # 0: name
 compiler.err.label.already.in.use=\u30E9\u30D9\u30EB{0}\u306F\u3059\u3067\u306B\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059
 
@@ -337,6 +437,8 @@
 
 compiler.err.cannot.create.array.with.type.arguments=\u578B\u5F15\u6570\u3092\u6301\u3064\u914D\u5217\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093
 
+compiler.err.cannot.create.array.with.diamond=''<>''\u3092\u6301\u3064\u914D\u5217\u306F\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093
+
 #
 # limits.  We don't give the limits in the diagnostic because we expect
 # them to change, yet we want to use the same diagnostic.  These are all
@@ -360,7 +462,7 @@
 
 compiler.err.limit.string=\u5B9A\u6570\u6587\u5B57\u5217\u304C\u9577\u3059\u304E\u307E\u3059
 
-compiler.err.limit.string.overflow=\u6587\u5B57\u5217\"{0}...\"\u306EUTF8\u8868\u73FE\u304C\u3001\u5B9A\u6570\u30D7\u30FC\u30EB\u306B\u5BFE\u3057\u3066\u9577\u3059\u304E\u307E\u3059
+compiler.err.limit.string.overflow=\u6587\u5B57\u5217"{0}..."\u306EUTF8\u8868\u73FE\u304C\u3001\u5B9A\u6570\u30D7\u30FC\u30EB\u306B\u5BFE\u3057\u3066\u9577\u3059\u304E\u307E\u3059
 
 compiler.err.malformed.fp.lit=\u6D6E\u52D5\u5C0F\u6570\u70B9\u30EA\u30C6\u30E9\u30EB\u304C\u4E0D\u6B63\u3067\u3059
 
@@ -370,7 +472,9 @@
 
 compiler.err.missing.ret.stmt=return\u6587\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093
 
-compiler.err.missing.ret.val=\u623B\u308A\u5024\u304C\u3042\u308A\u307E\u305B\u3093
+compiler.misc.missing.ret.val=\u623B\u308A\u5024\u304C\u3042\u308A\u307E\u305B\u3093
+
+compiler.misc.unexpected.ret.val=\u4E88\u671F\u3057\u306A\u3044\u623B\u308A\u5024
 
 # 0: set of modifier
 compiler.err.mod.not.allowed.here=\u4FEE\u98FE\u5B50{0}\u3092\u3053\u3053\u3067\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
@@ -396,7 +500,26 @@
 compiler.err.native.meth.cant.have.body=native\u30E1\u30BD\u30C3\u30C9\u304C\u672C\u4F53\u3092\u6301\u3064\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
 
 # 0: type, 1: type
-compiler.err.neither.conditional.subtype=?\u306B\u5BFE\u3059\u308B\u4E92\u63DB\u6027\u306E\u306A\u3044\u578B : \u3069\u3061\u3089\u3082\u4ED6\u65B9\u306E\u30B5\u30D6\u30BF\u30A4\u30D7\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n2\u756A\u76EE\u306E\u30AA\u30DA\u30E9\u30F3\u30C9 : {0}\n3\u756A\u76EE\u306E\u30AA\u30DA\u30E9\u30F3\u30C9 : {1}
+compiler.err.neither.conditional.subtype=?\u306B\u5BFE\u3059\u308B\u4E0D\u9069\u5408\u306A\u578B : \u3069\u3061\u3089\u3082\u4ED6\u65B9\u306E\u30B5\u30D6\u30BF\u30A4\u30D7\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n2\u756A\u76EE\u306E\u30AA\u30DA\u30E9\u30F3\u30C9 : {0}\n3\u756A\u76EE\u306E\u30AA\u30DA\u30E9\u30F3\u30C9 : {1}
+
+# 0: message segment
+compiler.misc.incompatible.type.in.conditional=\u6761\u4EF6\u5F0F\u306E\u578B\u304C\u4E0D\u6B63\u3067\u3059\u3002{0}
+
+compiler.misc.conditional.target.cant.be.void=\u6761\u4EF6\u5F0F\u306E\u30BF\u30FC\u30B2\u30C3\u30C8\u578B\u306Fvoid\u306B\u3067\u304D\u307E\u305B\u3093
+
+# 0: type
+compiler.misc.incompatible.ret.type.in.lambda=\u30E9\u30E0\u30C0\u5F0F\u306E\u623B\u308A\u578B\u304C\u4E0D\u6B63\u3067\u3059\n{0}
+
+# 0: type
+compiler.misc.incompatible.ret.type.in.mref=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u623B\u308A\u578B\u304C\u4E0D\u6B63\u3067\u3059\n{0}
+
+# 0: list of type
+compiler.err.incompatible.thrown.types.in.lambda=\u30E9\u30E0\u30C0\u5F0F\u3067\u30B9\u30ED\u30FC\u3055\u308C\u305F\u30BF\u30A4\u30D7{0}\u306F\u4E0D\u9069\u5408\u3067\u3059
+
+# 0: list of type
+compiler.err.incompatible.thrown.types.in.mref=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306E\u30B9\u30ED\u30FC\u3055\u308C\u305F\u30BF\u30A4\u30D7{0}\u306F\u4E0D\u9069\u5408\u3067\u3059
+
+compiler.misc.incompatible.arg.types.in.lambda=\u30E9\u30E0\u30C0\u5F0F\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u578B\u306F\u4E0D\u9069\u5408\u3067\u3059
 
 compiler.err.new.not.allowed.in.annotation=''new''\u306F\u6CE8\u91C8\u306B\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
 
@@ -414,6 +537,12 @@
 compiler.err.not.def.access.class.intf.cant.access={1}\u306E{0}\u304C\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u306A\u3044\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059
 
 # 0: symbol, 1: symbol
+compiler.misc.not.def.access.class.intf.cant.access={1}\u306E{0}\u304C\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u306A\u3044\u30AF\u30E9\u30B9\u307E\u305F\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059
+
+# 0: symbol, 1: list of type, 2: type
+compiler.misc.cant.access.inner.cls.constr=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF{0}({1})\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\n\u5185\u90E8\u30AF\u30E9\u30B9\u3092\u56F2\u3080\u578B{2}\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u304C\u30B9\u30B3\u30FC\u30D7\u5185\u306B\u3042\u308A\u307E\u305B\u3093
+
+# 0: symbol, 1: symbol
 compiler.err.not.def.public.cant.access={1}\u306E{0}\u306Fpublic\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30D1\u30C3\u30B1\u30FC\u30B8\u5916\u304B\u3089\u306F\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093
 
 # 0: name
@@ -440,7 +569,7 @@
 # Errors related to annotation processing
 
 # 0: symbol, 1: string, 2: stack-trace
-compiler.err.proc.cant.access={0}\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\n{1}\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n{2}
+compiler.err.proc.cant.access={0}\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\n{1}\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n{2}
 
 # 0: symbol, 1: string
 compiler.err.proc.cant.access.1={0}\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\n{1}
@@ -455,15 +584,13 @@
 # 0: list of string
 compiler.err.proc.no.explicit.annotation.processing.requested=\u30AF\u30E9\u30B9\u540D''{0}''\u304C\u53D7\u3051\u5165\u308C\u3089\u308C\u308B\u306E\u306F\u3001\u6CE8\u91C8\u51E6\u7406\u304C\u660E\u793A\u7684\u306B\u30EA\u30AF\u30A8\u30B9\u30C8\u3055\u308C\u305F\u5834\u5408\u306E\u307F\u3067\u3059
 
-compiler.err.proc.no.service=\u30B5\u30FC\u30D3\u30B9\u30FB\u30ED\u30FC\u30C0\u30FC\u30FB\u30AF\u30E9\u30B9\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\njava.util.ServiceLoader\u304Bsun.misc.Service\u304C\u4F7F\u7528\u3067\u304D\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+compiler.err.proc.no.service=\u30B5\u30FC\u30D3\u30B9\u30FB\u30ED\u30FC\u30C0\u30FC\u304C\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u304C\u3001\u6CE8\u91C8\u51E6\u7406\u306B\u5FC5\u8981\u3067\u3059\u3002
 
 compiler.err.proc.processor.bad.option.name=\u30D7\u30ED\u30BB\u30C3\u30B5''{1}''\u306B\u3088\u3063\u3066\u6307\u5B9A\u3055\u308C\u305F\u30AA\u30D7\u30B7\u30E7\u30F3\u540D''{0}''\u304C\u4E0D\u6B63\u3067\u3059
 
 # 0: string
 compiler.err.proc.processor.cant.instantiate=\u30D7\u30ED\u30BB\u30C3\u30B5''{0}''\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F
 
-compiler.err.proc.processor.constructor.error=\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u69CB\u7BC9\u4E2D\u306B\u4F8B\u5916\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F: {0}
-
 # 0: string
 compiler.err.proc.processor.not.found=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5''{0}''\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
 
@@ -482,7 +609,10 @@
 compiler.err.recursive.ctor.invocation=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u547C\u51FA\u3057\u304C\u518D\u5E30\u7684\u3067\u3059
 
 # 0: name, 1: symbol kind, 2: symbol, 3: symbol, 4: symbol kind, 5: symbol, 6: symbol
-compiler.err.ref.ambiguous={0}\u306E\u53C2\u7167\u306F\u3042\u3044\u307E\u3044\u3067\u3059\u3002{3}\u306E{1} {2}\u3068{6}\u306E{4} {5}\u304C\u4E21\u65B9\u9069\u5408\u3057\u307E\u3059
+compiler.err.ref.ambiguous={0}\u306E\u53C2\u7167\u306F\u3042\u3044\u307E\u3044\u3067\u3059\n{3}\u306E{1} {2}\u3068{6}\u306E{4} {5}\u306E\u4E21\u65B9\u304C\u4E00\u81F4\u3057\u307E\u3059
+
+# 0: name, 1: symbol kind, 2: symbol, 3: symbol, 4: symbol kind, 5: symbol, 6: symbol
+compiler.misc.ref.ambiguous={0}\u306E\u53C2\u7167\u306F\u3042\u3044\u307E\u3044\u3067\u3059\n{3}\u306E{1} {2}\u3068{6}\u306E{4} {5}\u306E\u4E21\u65B9\u304C\u4E00\u81F4\u3057\u307E\u3059
 
 compiler.err.repeated.annotation.target=\u6CE8\u91C8\u30BF\u30FC\u30B2\u30C3\u30C8\u304C\u7E70\u308A\u8FD4\u3055\u308C\u3066\u3044\u307E\u3059
 
@@ -495,9 +625,9 @@
 
 compiler.err.ret.outside.meth=\u30E1\u30BD\u30C3\u30C9\u306E\u5916\u306Ereturn\u6587\u3067\u3059
 
-compiler.err.signature.doesnt.match.supertype=\u30B7\u30B0\u30CB\u30C1\u30E3\u304C{0}\u306B\u9069\u5408\u3057\u307E\u305B\u3093\u3002\u4E92\u63DB\u6027\u306E\u306A\u3044\u30B9\u30FC\u30D1\u30FC\u30BF\u30A4\u30D7\u3067\u3059
-
-compiler.err.signature.doesnt.match.intf=\u30B7\u30B0\u30CB\u30C1\u30E3\u304C{0}\u306B\u9069\u5408\u3057\u307E\u305B\u3093\u3002\u4E92\u63DB\u6027\u306E\u306A\u3044\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3067\u3059
+compiler.err.signature.doesnt.match.supertype=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C{0}\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002\u4E0D\u9069\u5408\u306A\u30B9\u30FC\u30D1\u30FC\u30BF\u30A4\u30D7\u3067\u3059
+
+compiler.err.signature.doesnt.match.intf=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C{0}\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002\u4E0D\u9069\u5408\u306A\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3067\u3059
 
 # 0: symbol, 1: symbol, 2: symbol
 compiler.err.does.not.override.abstract={0}\u306Fabstract\u3067\u306A\u304F\u3001{2}\u5185\u306Eabstract\u30E1\u30BD\u30C3\u30C9{1}\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u305B\u3093
@@ -534,7 +664,28 @@
 compiler.err.type.var.more.than.once.in.result=\u578B\u5909\u6570{0}\u306F{1}\u306E\u578B\u30672\u56DE\u4EE5\u4E0A\u51FA\u73FE\u3057\u307E\u3059\u3002\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u751F\u6210\u3055\u308C\u306A\u3044\u307E\u307E\u306B\u306F\u3067\u304D\u307E\u305B\u3093
 
 # 0: type, 1: type, 2: string
-compiler.err.types.incompatible.diff.ret=\u578B{0}\u3068\u578B{1}\u306E\u4E92\u63DB\u6027\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u4E21\u65B9\u3068\u3082{2}\u3092\u5B9A\u7FA9\u3057\u3066\u3044\u307E\u3059\u304C\u3001\u623B\u308A\u5024\u306E\u578B\u304C\u7121\u95A2\u4FC2\u3067\u3059
+compiler.err.types.incompatible.diff.ret=\u578B{0}\u3068\u578B{1}\u304C\u9069\u5408\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u4E21\u65B9\u3068\u3082{2}\u3092\u5B9A\u7FA9\u3057\u3066\u3044\u307E\u3059\u304C\u3001\u623B\u308A\u5024\u306E\u578B\u304C\u7121\u95A2\u4FC2\u3067\u3059
+
+# 0: kind, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
+compiler.err.types.incompatible.unrelated.defaults={0} {1}\u306F\u578B{4}\u3068{5}\u304B\u3089{2}({3})\u306E\u95A2\u9023\u3057\u306A\u3044\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u7D99\u627F\u3057\u307E\u3059
+
+# 0: kind, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
+compiler.err.types.incompatible.abstract.default={0} {1}\u306F\u578B{4}\u3068{5}\u304B\u3089{2}({3})\u306E\u62BD\u8C61\u3068\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u7D99\u627F\u3057\u307E\u3059
+
+# 0: name, 1: kind, 2: symbol
+compiler.err.default.overrides.object.member={1} {2}\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30E1\u30BD\u30C3\u30C9{0}\u306Fjava.lang.Object\u306E\u30E1\u30F3\u30D0\u30FC\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u3059
+
+# 0: type
+compiler.err.illegal.static.intf.meth.call=static\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u30FB\u30E1\u30BD\u30C3\u30C9\u30FB\u30B3\u30FC\u30EB\u304C\u4E0D\u6B63\u3067\u3059\n\u53D7\u4FE1\u5F0F\u306F\u578B\u4FEE\u98FE\u5B50''{0}''\u3067\u7F6E\u63DB\u3055\u308C\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+
+# 0: type, 1: message segment
+compiler.err.illegal.default.super.call=\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u30B9\u30FC\u30D1\u30FC\u30FB\u30B3\u30FC\u30EB\u306E\u578B\u4FEE\u98FE\u5B50{0}\u304C\u4E0D\u6B63\u3067\u3059\n{1}
+
+# 0: symbol, 1: type
+compiler.misc.overridden.default={1}\u306E\u30E1\u30BD\u30C3\u30C9{0}\u306F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3055\u308C\u307E\u3059
+
+# 0: symbol, 1: symbol
+compiler.misc.redundant.supertype=\u5197\u9577\u306A\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9{0}\u306F{1}\u306B\u3088\u3063\u3066\u62E1\u5F35\u3055\u308C\u307E\u3057\u305F
 
 compiler.err.unclosed.char.lit=\u6587\u5B57\u30EA\u30C6\u30E9\u30EB\u304C\u9589\u3058\u3089\u308C\u3066\u3044\u307E\u305B\u3093
 
@@ -550,19 +701,14 @@
 # 0: name
 compiler.err.undef.label=\u30E9\u30D9\u30EB{0}\u306F\u672A\u5B9A\u7FA9\u3067\u3059
 
-compiler.err.undetermined.type={0}\u306E\u578B\u5F15\u6570\u3092\u63A8\u5B9A\u3067\u304D\u307E\u305B\u3093
-
-# 0: type, 1: message segment
-compiler.err.undetermined.type.1={0}\u306E\u578B\u5F15\u6570\u3092\u63A8\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002\n\u7406\u7531: {1}
-
-# 0: list of type, 1: message segment
-compiler.err.invalid.inferred.types={0}\u306E\u63A8\u5B9A\u578B\u304C\u7121\u52B9\u3067\u3059\u3002{1}
-
 # 0: message segment, 1: unused
-compiler.err.cant.apply.diamond={0}\u306E\u578B\u5F15\u6570\u3092\u63A8\u5B9A\u3067\u304D\u307E\u305B\u3093
-
-# 0: message segment, 1: message segment
-compiler.err.cant.apply.diamond.1={0}\u306E\u578B\u5F15\u6570\u3092\u63A8\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002\n\u7406\u7531: {1}
+compiler.err.cant.apply.diamond={0}\u306E\u578B\u5F15\u6570\u3092\u63A8\u8AD6\u3067\u304D\u307E\u305B\u3093
+
+# 0: message segment or type, 1: message segment
+compiler.err.cant.apply.diamond.1={0}\u306E\u578B\u5F15\u6570\u3092\u63A8\u8AD6\u3067\u304D\u307E\u305B\u3093\n\u7406\u7531: {1}
+
+# 0: message segment or type, 1: message segment
+compiler.misc.cant.apply.diamond.1={0}\u306E\u578B\u5F15\u6570\u3092\u63A8\u8AD6\u3067\u304D\u307E\u305B\u3093\n\u7406\u7531: {1}
 
 compiler.err.unreachable.stmt=\u3053\u306E\u6587\u306B\u5236\u5FA1\u304C\u79FB\u308B\u3053\u3068\u306F\u3042\u308A\u307E\u305B\u3093
 
@@ -605,7 +751,7 @@
 # 0: symbol
 compiler.misc.varargs.trustme.on.virtual.varargs=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u30FB\u30E1\u30BD\u30C3\u30C9{0}\u306Ffinal\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
 
-# 0: type, 1: kind, 2: symbol
+# 0: type, 1: symbol kind, 2: symbol
 compiler.misc.inaccessible.varargs.type=\u4EEE\u53EF\u5909\u5F15\u6570\u8981\u7D20\u578B{0}\u306F{1} {2}\u304B\u3089\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093
 
 # In the following string, {1} will always be the detail message from
@@ -620,7 +766,7 @@
 
 ## All errors which do not refer to a particular line in the source code are
 ## preceded by this string.
-compiler.err.error=\u30A8\u30E9\u30FC:\u0020
+compiler.err.error=\u30A8\u30E9\u30FC: 
 
 # The following error messages do not refer to a line in the source code.
 compiler.err.cant.read.file={0}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093
@@ -637,7 +783,7 @@
 
 compiler.misc.fatal.err.cant.locate.ctor=\u81F4\u547D\u7684\u30A8\u30E9\u30FC: {0}\u306E\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u3092\u691C\u51FA\u3067\u304D\u307E\u305B\u3093
 
-compiler.misc.fatal.err.cant.close.loader=\u81F4\u547D\u7684\u30A8\u30E9\u30FC: \u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u306E\u30AF\u30E9\u30B9\u30FB\u30ED\u30FC\u30C0\u30FC\u3092\u9589\u3058\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
+compiler.misc.fatal.err.cant.close=\u81F4\u547D\u7684\u30A8\u30E9\u30FC: \u30B3\u30F3\u30D1\u30A4\u30E9\u30FB\u30EA\u30BD\u30FC\u30B9\u3092\u9589\u3058\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093
 
 #####
 
@@ -659,21 +805,24 @@
 
 ## The following string will appear before all messages keyed as:
 ## "compiler.note".
+
+compiler.note.potential.lambda.found=\u3053\u306E\u533F\u540D\u5185\u90E8\u30AF\u30E9\u30B9\u3092\u30E9\u30E0\u30C0\u5F0F\u306B\u5909\u63DB\u3067\u304D\u307E\u3059\u3002
+
 compiler.note.note=\u6CE8\u610F:
 
 # 0: file name
-compiler.note.deprecated.filename={0}\u306F\u63A8\u5968\u3055\u308C\u306A\u3044API\u3092\u4F7F\u7528\u307E\u305F\u306F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u3066\u3044\u307E\u3059\u3002
-
-compiler.note.deprecated.plural=\u4E00\u90E8\u306E\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306F\u63A8\u5968\u3055\u308C\u306A\u3044API\u3092\u4F7F\u7528\u307E\u305F\u306F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u3066\u3044\u307E\u3059\u3002
+compiler.note.deprecated.filename={0}\u306F\u975E\u63A8\u5968\u306EAPI\u3092\u4F7F\u7528\u307E\u305F\u306F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u3066\u3044\u307E\u3059\u3002
+
+compiler.note.deprecated.plural=\u4E00\u90E8\u306E\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306F\u975E\u63A8\u5968\u306EAPI\u3092\u4F7F\u7528\u307E\u305F\u306F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u3066\u3044\u307E\u3059\u3002
 
 # The following string may appear after one of the above deprecation
 # messages.
 compiler.note.deprecated.recompile=\u8A73\u7D30\u306F\u3001-Xlint:deprecation\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u6307\u5B9A\u3057\u3066\u518D\u30B3\u30F3\u30D1\u30A4\u30EB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 
 # 0: file name
-compiler.note.deprecated.filename.additional={0}\u306B\u63A8\u5968\u3055\u308C\u306A\u3044API\u306E\u8FFD\u52A0\u4F7F\u7528\u307E\u305F\u306F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u304C\u3042\u308A\u307E\u3059\u3002
-
-compiler.note.deprecated.plural.additional=\u4E00\u90E8\u306E\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306F\u63A8\u5968\u3055\u308C\u306A\u3044API\u3092\u8FFD\u52A0\u4F7F\u7528\u307E\u305F\u306F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u3066\u3044\u307E\u3059\u3002
+compiler.note.deprecated.filename.additional={0}\u306B\u975E\u63A8\u5968\u306EAPI\u306E\u8FFD\u52A0\u4F7F\u7528\u307E\u305F\u306F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u304C\u3042\u308A\u307E\u3059\u3002
+
+compiler.note.deprecated.plural.additional=\u4E00\u90E8\u306E\u5165\u529B\u30D5\u30A1\u30A4\u30EB\u306F\u975E\u63A8\u5968\u306EAPI\u3092\u8FFD\u52A0\u4F7F\u7528\u307E\u305F\u306F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u3066\u3044\u307E\u3059\u3002
 
 # 0: file name
 compiler.note.unchecked.filename={0}\u306E\u64CD\u4F5C\u306F\u3001\u672A\u30C1\u30A7\u30C3\u30AF\u307E\u305F\u306F\u5B89\u5168\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
@@ -773,12 +922,12 @@
 ##
 
 ## All warning messages are preceded by the following string.
-compiler.warn.warning=\u8B66\u544A:
+compiler.warn.warning=\u8B66\u544A: 
 
 ## Warning messages may also include the following prefix to identify a
 ## lint option
 # 0: option name
-compiler.warn.lintOption=[{0}]\u0020
+compiler.warn.lintOption=[{0}] 
 
 # 0: symbol
 compiler.warn.constant.SVUID=serialVersionUID\u306F\u30AF\u30E9\u30B9{0}\u306E\u5B9A\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
@@ -789,7 +938,7 @@
 compiler.warn.finally.cannot.complete=finally\u7BC0\u304C\u6B63\u5E38\u306B\u5B8C\u4E86\u3067\u304D\u307E\u305B\u3093
 
 # 0: symbol, 1: symbol
-compiler.warn.has.been.deprecated={1}\u306E{0}\u306F\u63A8\u5968\u3055\u308C\u307E\u305B\u3093
+compiler.warn.has.been.deprecated={1}\u306E{0}\u306F\u975E\u63A8\u5968\u306B\u306A\u308A\u307E\u3057\u305F
 
 # 0: symbol
 compiler.warn.sun.proprietary={0}\u306F\u5185\u90E8\u6240\u6709\u306EAPI\u3067\u3042\u308A\u3001\u4ECA\u5F8C\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u524A\u9664\u3055\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059
@@ -925,7 +1074,7 @@
 # 0: symbol
 compiler.warn.varargs.unsafe.use.varargs.param=\u53EF\u5909\u5F15\u6570\u30E1\u30BD\u30C3\u30C9\u306F\u3001\u578B\u60C5\u5831\u4FDD\u6301\u53EF\u80FD\u3067\u306A\u3044\u53EF\u5909\u5F15\u6570\u30D1\u30E9\u30E1\u30FC\u30BF{0}\u304B\u3089\u306E\u30D2\u30FC\u30D7\u6C5A\u67D3\u306E\u539F\u56E0\u3068\u306A\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059
 
-compiler.warn.missing.deprecated.annotation=\u63A8\u5968\u3055\u308C\u306A\u3044\u9805\u76EE\u306F@Deprecated\u3067\u6CE8\u91C8\u304C\u4ED8\u3051\u3089\u308C\u3066\u3044\u307E\u305B\u3093
+compiler.warn.missing.deprecated.annotation=\u975E\u63A8\u5968\u306E\u9805\u76EE\u306F@Deprecated\u3067\u6CE8\u91C8\u304C\u4ED8\u3051\u3089\u308C\u3066\u3044\u307E\u305B\u3093
 
 compiler.warn.invalid.archive.file=\u30D1\u30B9\u4E0A\u306E\u4E88\u671F\u3057\u306A\u3044\u30D5\u30A1\u30A4\u30EB: {0}
 
@@ -952,7 +1101,7 @@
 compiler.warn.diamond.redundant.args=\u65B0\u3057\u3044\u5F0F\u306E\u578B\u5F15\u6570\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059(\u304B\u308F\u308A\u306B\u30C0\u30A4\u30E4\u30E2\u30F3\u30C9\u6F14\u7B97\u5B50\u3092\u4F7F\u7528\u3057\u307E\u3059)\u3002
 
 # 0: type, 1: type
-compiler.warn.diamond.redundant.args.1=\u65B0\u3057\u3044\u5F0F\u306E\u578B\u5F15\u6570\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059(\u304B\u308F\u308A\u306B\u30C0\u30A4\u30E4\u30E2\u30F3\u30C9\u6F14\u7B97\u5B50\u3092\u4F7F\u7528\u3057\u307E\u3059)\u3002\n\u660E\u793A\u7684: {0}\n\u63A8\u5B9A: {1}
+compiler.warn.diamond.redundant.args.1=\u65B0\u3057\u3044\u5F0F\u306E\u578B\u5F15\u6570\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059(\u304B\u308F\u308A\u306B\u30C0\u30A4\u30E4\u30E2\u30F3\u30C9\u6F14\u7B97\u5B50\u3092\u4F7F\u7528\u3057\u307E\u3059)\u3002\n\u660E\u793A\u7684: {0}\n\u63A8\u8AD6: {1}
 
 # 0: symbol, 1: message segment
 compiler.warn.varargs.redundant.trustme.anno={0}\u6CE8\u91C8\u304C\u5197\u9577\u3067\u3059\u3002{1}
@@ -1030,7 +1179,7 @@
 
 ## The following are all possible strings for the second argument ({1}) of the
 ## above strings.
-compiler.misc.bad.class.signature=\u30AF\u30E9\u30B9{0}\u306E\u30B7\u30B0\u30CB\u30C1\u30E3\u304C\u4E0D\u6B63\u3067\u3059
+compiler.misc.bad.class.signature=\u30AF\u30E9\u30B9{0}\u306E\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u4E0D\u6B63\u3067\u3059
 
 #0: symbol, 1: symbol
 compiler.misc.bad.enclosing.class={0}\u306E\u5185\u90E8\u30AF\u30E9\u30B9\u304C\u4E0D\u6B63\u3067\u3059: {1}
@@ -1044,7 +1193,9 @@
 
 compiler.misc.bad.const.pool.tag.at=\u5B9A\u6570\u30D7\u30FC\u30EB\u30FB\u30BF\u30B0{1}\u3067\u306E{0}\u304C\u4E0D\u6B63\u3067\u3059
 
-compiler.misc.bad.signature=\u30B7\u30B0\u30CB\u30C1\u30E3{0}\u304C\u4E0D\u6B63\u3067\u3059
+compiler.misc.bad.signature=\u30B7\u30B0\u30CD\u30C1\u30E3{0}\u304C\u4E0D\u6B63\u3067\u3059
+
+compiler.misc.bad.type.annotation.value=\u6CE8\u91C8\u30BF\u30FC\u30B2\u30C3\u30C8\u578B\u306E\u5024\u306E\u578B\u304C\u4E0D\u6B63\u3067\u3059: {0}
 
 compiler.misc.class.file.wrong.class=\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB{0}\u306B\u4E0D\u6B63\u306A\u30AF\u30E9\u30B9\u304C\u3042\u308A\u307E\u3059
 
@@ -1077,24 +1228,17 @@
 
 #####
 
-# 0: message segment, 1: type, 2: type
-compiler.err.prob.found.req={0}\n\u671F\u5F85\u5024: {2}\n\u691C\u51FA\u5024:    {1}
+# 0: message segment
+compiler.err.prob.found.req=\u4E0D\u9069\u5408\u306A\u578B: {0}
 
 # 0: message segment, 1: type, 2: type
 compiler.warn.prob.found.req={0}\n\u671F\u5F85\u5024: {2}\n\u691C\u51FA\u5024:    {1}
 
-compiler.err.prob.found.req.1={0} {3}\n\u671F\u5F85\u5024: {2}\n\u691C\u51FA\u5024:    {1}
-
-## The following are all possible strings for the first argument ({0}) of the
-## above strings.
-compiler.misc.incompatible.types=\u4E92\u63DB\u6027\u306E\u306A\u3044\u578B
-
-# 0: message segment
-compiler.misc.incompatible.types.1=\u4E92\u63DB\u6027\u306E\u306A\u3044\u578B\u3002{0}
-
-compiler.misc.inconvertible.types=\u5909\u63DB\u3067\u304D\u306A\u3044\u578B
-
-compiler.misc.possible.loss.of.precision=\u7CBE\u5EA6\u304C\u4F4E\u4E0B\u3057\u3066\u3044\u308B\u53EF\u80FD\u6027
+# 0: type, 1: type
+compiler.misc.inconvertible.types={0}\u3092{1}\u306B\u5909\u63DB\u3067\u304D\u307E\u305B\u3093:
+
+# 0: type, 1: type
+compiler.misc.possible.loss.of.precision=\u7CBE\u5EA6\u304C\u5931\u308F\u308C\u308B\u53EF\u80FD\u6027\u304C\u3042\u308B{0}\u304B\u3089{1}\u3078\u306E\u5909\u63DB
 
 compiler.misc.unchecked.assign=\u7121\u691C\u67FB\u5909\u63DB
 
@@ -1104,16 +1248,13 @@
 #     assigned array cannot dynamically check its stores
 compiler.misc.unchecked.cast.to.type=\u7121\u691C\u67FB\u30AD\u30E3\u30B9\u30C8
 
-compiler.misc.assignment.from.super-bound=\u30B9\u30FC\u30D1\u30FC\u30D0\u30A6\u30F3\u30C9\u578B{0}\u304B\u3089\u306E\u4EE3\u5165
-
-compiler.misc.assignment.to.extends-bound=\u62E1\u5F35\u30D0\u30A6\u30F3\u30C9\u578B{0}\u3078\u306E\u4EE3\u5165
-
 # compiler.err.star.expected=\
 #     ''*'' expected
 # compiler.err.no.elem.type=\
 #     \[\*\] cannot have a type
 
-compiler.misc.try.not.applicable.to.type=try-with-resource\u306F\u5909\u6570\u578B\u306B\u9069\u7528\u3055\u308C\u307E\u305B\u3093
+# 0: type
+compiler.misc.try.not.applicable.to.type=try-with-resource\u306F\u5909\u6570\u578B\u306B\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\n({0})
 
 #####
 
@@ -1139,25 +1280,44 @@
 
 ## The following are all possible strings for the last argument of all those
 ## diagnostics whose key ends in ".1"
-compiler.misc.undetermined.type=\u672A\u5B9A\u578B
-
-compiler.misc.type.variable.has.undetermined.type=\u578B\u5909\u6570{0}\u306F\u672A\u5B9A\u578B\u3067\u3059
 
 # 0: type, 1: list of type
 compiler.misc.no.unique.maximal.instance.exists=\u578B\u5909\u6570{0}(\u4E0A\u9650{1})\u306E\u56FA\u6709\u306E\u6700\u5927\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u304C\u5B58\u5728\u3057\u307E\u305B\u3093
 
 compiler.misc.no.unique.minimal.instance.exists=\u578B\u5909\u6570{0}(\u4E0B\u9650{1})\u306E\u56FA\u6709\u306E\u6700\u5C0F\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u304C\u5B58\u5728\u3057\u307E\u305B\u3093
 
-# 0: list of type, 1: type, 2: type
-compiler.misc.infer.no.conforming.instance.exists=\u578B\u5909\u6570{0}\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u304C\u5B58\u5728\u3057\u306A\u3044\u306E\u3067\u3001{1}\u306F{2}\u306B\u9069\u5408\u3057\u307E\u305B\u3093
+# 0: type, 1: list of type
+compiler.misc.incompatible.upper.bounds=\u63A8\u8AD6\u5909\u6570{0}\u306B\u306F\u3001\u4E0D\u9069\u5408\u306A\u4E0A\u9650{1}\u304C\u3042\u308A\u307E\u3059
+
+# 0: type, 1: list of type, 2: list of type
+compiler.misc.incompatible.eq.upper.bounds=\u63A8\u8AD6\u5909\u6570{0}\u306B\u306F\u3001\u4E0D\u9069\u5408\u306A\u5883\u754C\u304C\u3042\u308A\u307E\u3059\n\u7B49\u4FA1\u5236\u7D04: {1}\n\u4E0A\u9650: {2}
+
+# 0: type, 1: list of type, 2: list of type
+compiler.misc.incompatible.eq.lower.bounds=\u63A8\u8AD6\u5909\u6570{0}\u306B\u306F\u3001\u4E0D\u9069\u5408\u306A\u5883\u754C\u304C\u3042\u308A\u307E\u3059\n\u7B49\u4FA1\u5236\u7D04: {1}\n\u4E0B\u9650: {2}
 
 # 0: list of type, 1: type, 2: type
-compiler.misc.infer.no.conforming.assignment.exists=\u578B\u5909\u6570{0}\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u304C\u5B58\u5728\u3057\u306A\u3044\u306E\u3067\u3001\u5F15\u6570\u578B{1}\u306F\u4EEE\u30D1\u30E9\u30E1\u30FC\u30BF\u578B{2}\u306B\u9069\u5408\u3057\u307E\u305B\u3093
-
-compiler.misc.infer.arg.length.mismatch=\u5B9F\u5F15\u6570\u30EA\u30B9\u30C8\u3068\u4EEE\u5F15\u6570\u30EA\u30B9\u30C8\u306E\u9577\u3055\u304C\u7570\u306A\u308B\u305F\u3081\u3001\u5F15\u6570\u304B\u3089\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093
+compiler.misc.infer.no.conforming.instance.exists=\u578B\u5909\u6570{0}\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u304C\u5B58\u5728\u3057\u306A\u3044\u306E\u3067\u3001{1}\u306F{2}\u306B\u9069\u5408\u3057\u307E\u305B\u3093
+
+# 0: list of type, 1: message segment
+compiler.misc.infer.no.conforming.assignment.exists=\u578B\u5909\u6570{0}\u3092\u63A8\u8AD6\u3067\u304D\u307E\u305B\u3093\n(\u5F15\u6570\u306E\u4E0D\u4E00\u81F4: {1})
+
+# 0: list of type
+compiler.misc.infer.arg.length.mismatch=\u578B\u5909\u6570{0}\u3092\u63A8\u8AD6\u3067\u304D\u307E\u305B\u3093\n(\u5B9F\u5F15\u6570\u30EA\u30B9\u30C8\u3068\u4EEE\u5F15\u6570\u30EA\u30B9\u30C8\u306E\u9577\u3055\u304C\u7570\u306A\u308A\u307E\u3059)
+
+# 0: list of type, 1: message segment
+compiler.misc.infer.varargs.argument.mismatch=\u578B\u5909\u6570{0}\u3092\u63A8\u8AD6\u3067\u304D\u307E\u305B\u3093\n(\u53EF\u5909\u5F15\u6570\u306E\u4E0D\u4E00\u81F4: {1})
 
 # 0: type, 1: list of type
-compiler.misc.inferred.do.not.conform.to.bounds=\u63A8\u5B9A\u578B\u306F\u5BA3\u8A00\u3055\u308C\u305F\u5883\u754C\u306B\u9069\u5408\u3057\u307E\u305B\u3093\n\u63A8\u5B9A: {0}\n\u5883\u754C: {1}
+compiler.misc.inferred.do.not.conform.to.upper.bounds=\u63A8\u8AD6\u578B\u304C\u4E0A\u9650\u306B\u9069\u5408\u3057\u307E\u305B\u3093\n\u63A8\u8AD6: {0}\n\u4E0A\u9650: {1}
+
+# 0: type, 1: list of type
+compiler.misc.inferred.do.not.conform.to.lower.bounds=\u63A8\u8AD6\u578B\u304C\u4E0B\u9650\u306B\u9069\u5408\u3057\u307E\u305B\u3093\n\u63A8\u8AD6: {0}\n\u4E0B\u9650: {1}
+
+# 0: type, 1: list of type
+compiler.misc.inferred.do.not.conform.to.eq.bounds=\u63A8\u8AD6\u578B\u304C\u7B49\u4FA1\u5236\u7D04\u306B\u9069\u5408\u3057\u307E\u305B\u3093\n\u63A8\u8AD6: {0}\n\u7B49\u4FA1\u5236\u7D04: {1}
+
+# 0: list of type
+compiler.misc.cyclic.inference=\u63A8\u8AD6\u306E\u30EB\u30FC\u30D7\u306E\u305F\u3081\u3001\u63A8\u8AD6\u5909\u6570{0}\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u751F\u6210\u3067\u304D\u307E\u305B\u3093
 
 # 0: symbol
 compiler.misc.diamond={0}<>
@@ -1165,6 +1325,7 @@
 # 0: type
 compiler.misc.diamond.non.generic=\u975E\u6C4E\u7528\u30AF\u30E9\u30B9{0}\u3067''<>''\u3092\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
 
+# 0: unused
 compiler.misc.diamond.and.explicit.params=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u306E\u660E\u793A\u7684\u306A\u578B\u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u306F''<>''\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
 
 # 0: type, 1: list of type
@@ -1172,14 +1333,18 @@
 
 compiler.misc.arg.length.mismatch=\u5B9F\u5F15\u6570\u30EA\u30B9\u30C8\u3068\u4EEE\u5F15\u6570\u30EA\u30B9\u30C8\u306E\u9577\u3055\u304C\u7570\u306A\u308A\u307E\u3059
 
-# 0: type, 1: type
-compiler.misc.no.conforming.assignment.exists=\u5B9F\u5F15\u6570{0}\u306F\u30E1\u30BD\u30C3\u30C9\u547C\u51FA\u5909\u63DB\u306B\u3088\u3063\u3066{1}\u306B\u5909\u63DB\u3067\u304D\u307E\u305B\u3093
-
-# 0: type, 1: type
-compiler.misc.varargs.argument.mismatch=\u5F15\u6570\u578B{0}\u306F\u53EF\u5909\u5F15\u6570\u8981\u7D20\u578B{1}\u306B\u9069\u5408\u3057\u307E\u305B\u3093
+# 0: message segment
+compiler.misc.no.conforming.assignment.exists=\u5F15\u6570\u306E\u4E0D\u4E00\u81F4: {0}
+
+# 0: message segment
+compiler.misc.varargs.argument.mismatch=\u53EF\u5909\u5F15\u6570\u306E\u4E0D\u4E00\u81F4: {0}
 
 #####
 
+# 0: type, 1: file name
+compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file={1}\u306E\u88DC\u52A9\u30AF\u30E9\u30B9{0}\u306B\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u5916\u304B\u3089\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093
+
+
 ## The first argument ({0}) is a "kindname".
 # 0: symbol kind, 1: symbol, 2: symbol
 compiler.err.abstract.cant.be.accessed.directly=\u62BD\u8C61{0}\u3067\u3042\u308B{1}({2}\u5185)\u306B\u76F4\u63A5\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
@@ -1188,10 +1353,17 @@
 # 0: symbol kind, 1: symbol
 compiler.err.non-static.cant.be.ref=static\u3067\u306A\u3044{0} {1}\u3092static\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u304B\u3089\u53C2\u7167\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
 
+# 0: symbol kind, 1: symbol
+compiler.misc.non-static.cant.be.ref=static\u3067\u306A\u3044{0} {1}\u3092static\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u304B\u3089\u53C2\u7167\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
+
 ## Both arguments ({0}, {1}) are "kindname"s.  {0} is a comma-separated list
 ## of kindnames (the list should be identical to that provided in source.
 compiler.err.unexpected.type=\u4E88\u671F\u3057\u306A\u3044\u578B\n\u671F\u5F85\u5024: {0}\n\u691C\u51FA\u5024:    {1}
 
+compiler.err.unexpected.lambda=\u3053\u3053\u3067\u306F\u30E9\u30E0\u30C0\u5F0F\u306F\u4E88\u671F\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+
+compiler.err.unexpected.mref=\u3053\u3053\u3067\u306F\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306F\u4E88\u671F\u3055\u308C\u3066\u3044\u307E\u305B\u3093
+
 ## The first argument {0} is a "kindname" (e.g. 'constructor', 'field', etc.)
 ## The second argument {1} is the non-resolved symbol
 ## The third argument {2} is a list of type parameters (non-empty if {1} is a method)
@@ -1216,12 +1388,20 @@
 # 0: symbol kind, 1: name, 2: list of type, 3: list, 4: message segment
 compiler.err.cant.resolve.location.args.params=\u30B7\u30F3\u30DC\u30EB\u3092\u898B\u3064\u3051\u3089\u308C\u307E\u305B\u3093\n\u30B7\u30F3\u30DC\u30EB:   {0} <{2}>{1}({3})\n\u5834\u6240: {4}
 
+### Following are replicated/used for method reference diagnostics
+
+# 0: symbol kind, 1: name, 2: unused, 3: list of type, 4: message segment
+compiler.misc.cant.resolve.location.args=\u30B7\u30F3\u30DC\u30EB\u3092\u898B\u3064\u3051\u3089\u308C\u307E\u305B\u3093\n\u30B7\u30F3\u30DC\u30EB:   {0} {1}({3})\n\u5834\u6240: {4}
+
+# 0: symbol kind, 1: name, 2: list of type, 3: list, 4: message segment
+compiler.misc.cant.resolve.location.args.params=\u30B7\u30F3\u30DC\u30EB\u3092\u898B\u3064\u3051\u3089\u308C\u307E\u305B\u3093\n\u30B7\u30F3\u30DC\u30EB:   {0} <{2}>{1}({3})\n\u5834\u6240: {4}
+
 ##a location subdiagnostic is composed as follows:
 ## The first argument {0} is the location "kindname" (e.g. 'constructor', 'field', etc.)
 ## The second argument {1} is the location name
 ## The third argument {2} is the location type (only when {1} is a variable name)
 
-# 0: symbol kind, 1: symbol, 2: unused
+# 0: symbol kind, 1: type or symbol, 2: unused
 compiler.misc.location={0} {1}
 
 # 0: symbol kind, 1: symbol, 2: type
@@ -1236,7 +1416,7 @@
 
 compiler.misc.kindname.constructor=\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF
 
-compiler.misc.kindname.enum=\u5217\u6319
+compiler.misc.kindname.enum=\u5217\u6319\u578B
 
 compiler.misc.kindname.interface=\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9
 
@@ -1256,6 +1436,10 @@
 
 compiler.misc.kindname.package=\u30D1\u30C3\u30B1\u30FC\u30B8
 
+compiler.misc.kindname.static.init=static\u521D\u671F\u5316\u5B50
+
+compiler.misc.kindname.instance.init=\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u521D\u671F\u5316\u5B50
+
 #####
 
 compiler.misc.no.args=\u5F15\u6570\u304C\u3042\u308A\u307E\u305B\u3093
@@ -1312,6 +1496,7 @@
 # 0: symbol, 1: symbol, 2: symbol, 3: symbol
 compiler.misc.varargs.clash.with={1}\u306E{0}\u306F{3}\u306E{2}\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u3059
 
+# 0: unused
 compiler.misc.diamond.and.anon.class=\u533F\u540D\u5185\u90E8\u30AF\u30E9\u30B9\u3067\u306F''<>''\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093
 
 # 0: symbol kind, 1: symbol, 2: symbol, 3: message segment
@@ -1336,10 +1521,24 @@
 
 compiler.warn.assert.as.identifier=\u30EA\u30EA\u30FC\u30B91.4\u304B\u3089''assert''\u306F\u30AD\u30FC\u30EF\u30FC\u30C9\u306A\u306E\u3067\u3001\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\n(''assert''\u3092\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u306B\u306F\u3001-source 1.4\u4EE5\u964D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
 
+compiler.warn.underscore.as.identifier=\u8B58\u5225\u5B50\u3068\u3057\u3066''_''\u304C\u4F7F\u7528\u3055\u308C\u307E\u3057\u305F\n(\u8B58\u5225\u5B50\u3068\u3057\u3066\u306E''_''\u306E\u4F7F\u7528\u306F\u3001\u5C06\u6765\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059)
+
 compiler.err.enum.as.identifier=\u30EA\u30EA\u30FC\u30B95\u304B\u3089''enum''\u306F\u30AD\u30FC\u30EF\u30FC\u30C9\u306A\u306E\u3067\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\n(''enum''\u3092\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u306B\u306F-source 1.4\u4EE5\u524D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
 
 compiler.err.assert.as.identifier=\u30EA\u30EA\u30FC\u30B91.4\u304B\u3089''assert''\u306F\u30AD\u30FC\u30EF\u30FC\u30C9\u306A\u306E\u3067\u3001\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\n(''assert''\u3092\u8B58\u5225\u5B50\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u306B\u306F\u3001-source 1.3\u4EE5\u524D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
 
+# TODO 308: make a better error message
+compiler.err.this.as.identifier=\u30EA\u30EA\u30FC\u30B98\u304B\u3089''this''\u306F\u53D7\u4FE1\u30BF\u30A4\u30D7\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u540D\u3068\u3057\u3066\u306E\u307F\u8A31\u53EF\u3055\u308C\u3001\u6700\u521D\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+
+# TODO 308: make a better error message
+compiler.err.cant.annotate.static.class=\u5305\u542B\u3059\u308Bstatic\u306E\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30AF\u30E9\u30B9\u306F\u6CE8\u91C8\u4ED8\u3051\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
+# TODO 308: make a better error message
+compiler.err.cant.annotate.nested.type=\u30CD\u30B9\u30C8\u3055\u308C\u305F\u30BF\u30A4\u30D7\u306F\u6CE8\u91C8\u4ED8\u3051\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
+
+compiler.err.incorrect.receiver.type=\u53D7\u4FE1\u30BF\u30A4\u30D7\u304C\u3001\u5305\u542B\u3059\u308B\u30AF\u30E9\u30B9\u30FB\u30BF\u30A4\u30D7\u3068\u4E00\u81F4\u3057\u307E\u305B\u3093
+
+compiler.err.no.annotations.on.dot.class=\u6CE8\u91C8\u306F\u30AF\u30E9\u30B9\u30FB\u30EA\u30C6\u30E9\u30EB\u306E\u30BF\u30A4\u30D7\u3067\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093
+
 # 0: string
 compiler.err.generics.not.supported.in.source=\u7DCF\u79F0\u578B\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(\u7DCF\u79F0\u578B\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 5\u4EE5\u964D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
 
@@ -1349,9 +1548,8 @@
 # 0: string
 compiler.err.annotations.not.supported.in.source=\u6CE8\u91C8\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(\u6CE8\u91C8\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 5\u4EE5\u964D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
 
-#308 compiler.err.type.annotations.not.supported.in.source=\
-#308     type annotations are not supported in -source {0}\n\
-#308 (use -source 7 or higher to enable type annotations)
+# 0: string
+compiler.err.type.annotations.not.supported.in.source=\u30BF\u30A4\u30D7\u6CE8\u91C8\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(\u30BF\u30A4\u30D7\u6CE8\u91C8\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 8\u4EE5\u4E0A\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
 
 # 0: string
 compiler.err.foreach.not.supported.in.source=for-each\u30EB\u30FC\u30D7\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(for-each\u30EB\u30FC\u30D7\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 5\u4EE5\u964D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
@@ -1371,6 +1569,47 @@
 # 0: string
 compiler.err.string.switch.not.supported.in.source=switch\u5185\u306E\u6587\u5B57\u5217\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(switch\u5185\u306E\u6587\u5B57\u5217\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 7\u4EE5\u964D\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
 
+# 0: string
+compiler.err.lambda.not.supported.in.source=\u30E9\u30E0\u30C0\u5F0F\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(\u30E9\u30E0\u30C0\u5F0F\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 8\u4EE5\u4E0A\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
+
+# 0: string
+compiler.err.method.references.not.supported.in.source=\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(\u30E1\u30BD\u30C3\u30C9\u53C2\u7167\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 8\u4EE5\u4E0A\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
+
+# 0: string
+compiler.err.default.methods.not.supported.in.source=\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30E1\u30BD\u30C3\u30C9\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 8\u4EE5\u4E0A\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
+
+# 0: string
+compiler.err.intersection.types.in.cast.not.supported.in.source=\u30AD\u30E3\u30B9\u30C8\u5185\u306Eintersection\u578B\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30E1\u30BD\u30C3\u30C9\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 8\u4EE5\u4E0A\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
+
+# 0: string
+compiler.err.static.intf.methods.not.supported.in.source=static\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306F-source {0}\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\n(static\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3092\u4F7F\u7528\u53EF\u80FD\u306B\u3059\u308B\u306B\u306F\u3001-source 8\u4EE5\u4E0A\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044)
+
+########################################
+# Diagnostics for verbose resolution
+# used by Resolve (debug only)
+########################################
+
+# 0: number, 1: symbol, 2: unused
+compiler.misc.applicable.method.found=#{0}\u500B\u306E\u4F7F\u7528\u53EF\u80FD\u30E1\u30BD\u30C3\u30C9\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F: {1}
+
+# 0: number, 1: symbol, 2: message segment
+compiler.misc.applicable.method.found.1=#{0}\u500B\u306E\u4F7F\u7528\u53EF\u80FD\u30E1\u30BD\u30C3\u30C9\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F: {1}\n({2})
+
+# 0: number, 1: symbol, 2: message segment
+compiler.misc.not.applicable.method.found=#{0}\u500B\u306E\u4F7F\u7528\u3067\u304D\u306A\u3044\u30E1\u30BD\u30C3\u30C9\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F: {1}\n({2})
+
+# 0: type
+compiler.misc.partial.inst.sig=\u90E8\u5206\u7684\u306B\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3055\u308C\u307E\u3057\u305F: {0}
+
+# 0: name, 1: symbol, 2: number, 3: MethodResolutionPhase, 4: list of type or message segment, 5: list of type or message segment
+compiler.note.verbose.resolve.multi=\u578B{1}\u306E\u30E1\u30BD\u30C3\u30C9{0}\u3092\u5019\u88DC{2}\u306B\u89E3\u6C7A\u3057\u3066\u3044\u307E\u3059\n\u30D5\u30A7\u30FC\u30BA: {3}\n\u5B9F\u969B\u306E\u578B: {4}\n\u578B\u5F15\u6570: {5}\n\u5019\u88DC:
+
+# 0: name, 1: symbol, 2: unused, 3: MethodResolutionPhase, 4: list of type or message segment, 5: list of type or message segment
+compiler.note.verbose.resolve.multi.1=\u578B{1}\u306E\u30E1\u30BD\u30C3\u30C9{0}\u306E\u89E3\u6C7A\u306B\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3059\n\u30D5\u30A7\u30FC\u30BA: {3}\n\u5B9F\u969B\u306E\u578B: {4}\n\u578B\u5F15\u6570: {5}\n\u5019\u88DC:
+
+# 0: symbol, 1: type, 2: type
+compiler.note.deferred.method.inst=\u30E1\u30BD\u30C3\u30C9{0}\u306E\u9045\u5EF6\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\n\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u5316\u3055\u308C\u305F\u30B7\u30B0\u30CD\u30C1\u30E3: {1}\n\u30BF\u30FC\u30B2\u30C3\u30C8\u578B: {2}
+
 ########################################
 # Diagnostics for where clause implementation
 # used by the RichDiagnosticFormatter.
@@ -1393,26 +1632,32 @@
 # where clause for captured type: contains upper ('extends {1}') and lower
 # ('super {2}') bound along with the wildcard that generated this captured type ({3})
 # 0: type, 1: type, 2: type, 3: type
-compiler.misc.where.captured={3}\u306E\u30AD\u30E3\u30D7\u30C1\u30E3\u304B\u3089\u306E{0} extends {1} super: {2}
+compiler.misc.where.captured={0}\u306F{3}\u306E\u30AD\u30E3\u30D7\u30C1\u30E3\u304B\u3089{1}\u3092\u62E1\u5F35\u3057{2}\u3092\u30B9\u30FC\u30D1\u30FC\u3057\u307E\u3059
 
 # compact where clause for captured type: contains upper ('extends {1}') along
 # with the wildcard that generated this captured type ({3})
 # 0: type, 1: type, 2: unused, 3: type
-compiler.misc.where.captured.1={3}\u306E\u30AD\u30E3\u30D7\u30C1\u30E3\u304B\u3089\u306E{0} extends {1}
+compiler.misc.where.captured.1={0}\u306F{3}\u306E\u30AD\u30E3\u30D7\u30C1\u30E3\u304B\u3089{1}\u3092\u62E1\u5F35\u3057\u307E\u3059
 
 # where clause for type variable: contains upper bound(s) ('extends {1}') along with
 # the kindname ({2}) and location ({3}) in which the typevar has been declared
 # 0: type, 1: list of type, 2: symbol kind, 3: symbol
-compiler.misc.where.typevar={2} {3}\u3067\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B{0} extends {1}
+compiler.misc.where.typevar={2} {3}\u3067\u5BA3\u8A00\u3055\u308C\u3066\u3044\u308B{0}\u306F{1}\u3092\u62E1\u5F35\u3057\u307E\u3059
 
 # compact where clause for type variable: contains the kindname ({2}) and location ({3})
 # in which the typevar has been declared
+# 0: type, 1: list of type, 2: symbol kind, 3: symbol
 compiler.misc.where.typevar.1={2} {3}\u3067\u5BA3\u8A00\u3055\u308C\u305F{0}
 
+# where clause for fresh type variable: contains upper bound(s) ('extends {1}').
+# Since a fresh type-variable is synthetic - there's no location/kindname here.
+# 0: type, 1: list of type
+compiler.misc.where.fresh.typevar={0}\u306F{1}\u3092\u62E1\u5F35\u3057\u307E\u3059
+
 # where clause for type variable: contains all the upper bound(s) ('extends {1}')
 # of this intersection type
 # 0: type, 1: list of type
-compiler.misc.where.intersection={0} extends {1}
+compiler.misc.where.intersection={0}\u306F{1}\u3092\u62E1\u5F35\u3057\u307E\u3059
 
 ### Where clause headers ###
 compiler.misc.where.description.captured={0}\u304C\u65B0\u3057\u3044\u578B\u5909\u6570\u306E\u5834\u5408:
@@ -1431,4 +1676,39 @@
 
 compiler.misc.where.description.intersection.1={0}\u304Cintersection\u578B\u306E\u5834\u5408:
 
-
+###
+# errors related to doc comments
+
+compiler.err.dc.bad.entity=HTML\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u304C\u4E0D\u6B63\u3067\u3059
+
+compiler.err.dc.bad.gt=''>''\u306E\u4F7F\u7528\u304C\u4E0D\u6B63\u3067\u3059
+
+compiler.err.dc.bad.inline.tag=\u30A4\u30F3\u30E9\u30A4\u30F3\u30FB\u30BF\u30B0\u306E\u4F7F\u7528\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093
+
+compiler.err.dc.identifier.expected=\u8B58\u5225\u5B50\u304C\u5FC5\u8981\u3067\u3059
+
+compiler.err.dc.malformed.html=HTML\u304C\u4E0D\u6B63\u3067\u3059
+
+compiler.err.dc.missing.semicolon=\u30BB\u30DF\u30B3\u30ED\u30F3\u304C\u3042\u308A\u307E\u305B\u3093
+
+compiler.err.dc.no.content=\u30B3\u30F3\u30C6\u30F3\u30C4\u306A\u3057
+
+compiler.err.dc.no.tag.name='@'\u306E\u5F8C\u306B\u30BF\u30B0\u540D\u304C\u3042\u308A\u307E\u305B\u3093
+
+compiler.err.dc.gt.expected=''>''\u304C\u5FC5\u8981\u3067\u3059
+
+compiler.err.dc.ref.bad.parens=\u53C2\u7167\u306B'')''\u304C\u3042\u308A\u307E\u305B\u3093
+
+compiler.err.dc.ref.syntax.error=\u53C2\u7167\u306B\u69CB\u6587\u30A8\u30E9\u30FC\u304C\u3042\u308A\u307E\u3059
+
+compiler.err.dc.ref.unexpected.input=\u4E88\u671F\u3057\u306A\u3044\u30C6\u30AD\u30B9\u30C8\u3067\u3059
+
+compiler.err.dc.unexpected.content=\u4E88\u671F\u3057\u306A\u3044\u30B3\u30F3\u30C6\u30F3\u30C4\u3067\u3059
+
+compiler.err.dc.unterminated.inline.tag=\u30A4\u30F3\u30E9\u30A4\u30F3\u30FB\u30BF\u30B0\u304C\u7D42\u4E86\u3057\u3066\u3044\u307E\u305B\u3093
+
+compiler.err.dc.unterminated.signature=\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u7D42\u4E86\u3057\u3066\u3044\u307E\u305B\u3093
+
+compiler.err.dc.unterminated.string=\u6587\u5B57\u5217\u304C\u7D42\u4E86\u3057\u3066\u3044\u307E\u305B\u3093
+
+
--- a/src/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -65,8 +65,11 @@
 
 compiler.err.already.annotated={0} {1}\u5DF2\u8FDB\u884C\u6CE8\u91CA
 
-# 0: symbol, 1: symbol
-compiler.err.already.defined=\u5DF2\u5728{1}\u4E2D\u5B9A\u4E49{0}
+# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol
+compiler.err.already.defined=\u5DF2\u5728{2} {3}\u4E2D\u5B9A\u4E49\u4E86{0} {1}
+
+# 0: symbol kind, 1: symbol, 2: symbol kind, 3: symbol kind, 4: symbol
+compiler.err.already.defined.in.clinit=\u5DF2\u5728{3} {4}\u7684{2}\u4E2D\u5B9A\u4E49\u4E86{0} {1}
 
 # 0: string
 compiler.err.already.defined.single.import=\u5DF2\u5728 single-type \u5BFC\u5165\u4E2D\u5B9A\u4E49{0}
@@ -109,28 +112,84 @@
 # 0: type
 compiler.err.array.req.but.found=\u9700\u8981\u6570\u7EC4, \u4F46\u627E\u5230{0}
 
-compiler.err.assignment.from.super-bound=\u901A\u8FC7\u901A\u914D\u7B26 {0} \u5206\u914D
-
-compiler.err.assignment.to.extends-bound=\u5206\u914D\u7ED9\u901A\u914D\u7B26 {0}
-
 compiler.err.attribute.value.must.be.constant=\u5C5E\u6027\u503C\u5FC5\u987B\u4E3A\u5E38\u91CF
 
+# 0: statement type
+compiler.err.bad.initializer={0}\u7684\u521D\u59CB\u5316\u7A0B\u5E8F\u9519\u8BEF
+
 compiler.err.break.outside.switch.loop=\u5728 switch \u6216 loop \u5916\u90E8\u4E2D\u65AD
 
 # 0: name
 compiler.err.call.must.be.first.stmt.in.ctor=\u5BF9{0}\u7684\u8C03\u7528\u5FC5\u987B\u662F\u6784\u9020\u5668\u4E2D\u7684\u7B2C\u4E00\u4E2A\u8BED\u53E5
 
-compiler.err.cant.apply.symbol=\u65E0\u6CD5\u5C06{4} {5}\u4E2D\u7684{0} {1}\u5E94\u7528\u5230\u7ED9\u5B9A\u7C7B\u578B\n\u9700\u8981: {2}\n\u627E\u5230: {3}
-
 # 0: symbol kind, 1: name, 2: list of type or message segment, 3: list of type or message segment, 4: symbol kind, 5: type, 6: message segment
-compiler.err.cant.apply.symbol.1=\u65E0\u6CD5\u5C06{4} {5}\u4E2D\u7684{0} {1}\u5E94\u7528\u5230\u7ED9\u5B9A\u7C7B\u578B;\n\u9700\u8981: {2}\n\u627E\u5230: {3}\n\u539F\u56E0: {6}
+compiler.err.cant.apply.symbol=\u65E0\u6CD5\u5C06{4} {5}\u4E2D\u7684{0} {1}\u5E94\u7528\u5230\u7ED9\u5B9A\u7C7B\u578B;\n\u9700\u8981: {2}\n\u627E\u5230: {3}\n\u539F\u56E0: {6}
 
 # 0: symbol kind, 1: name, 2: list of type
 compiler.err.cant.apply.symbols=\u5BF9\u4E8E{1}({2}), \u627E\u4E0D\u5230\u5408\u9002\u7684{0}
 
+# 0: symbol kind, 1: name, 2: list of type or message segment, 3: list of type or message segment, 4: symbol kind, 5: type, 6: message segment
+compiler.misc.cant.apply.symbol=\u65E0\u6CD5\u5C06 {4} {5}\u4E2D\u7684 {0} {1}\u5E94\u7528\u5230\u7ED9\u5B9A\u7C7B\u578B\n\u9700\u8981: {2}\n\u627E\u5230: {3}\n\u539F\u56E0: {6}
+
+# 0: symbol kind, 1: name, 2: list of type
+compiler.misc.cant.apply.symbols=\u5BF9\u4E8E{1}({2}), \u627E\u4E0D\u5230\u5408\u9002\u7684{0}
+
+# 0: symbol kind, 1: symbol
+compiler.misc.no.abstracts=\u5728 {0} {1} \u4E2D\u627E\u4E0D\u5230\u62BD\u8C61\u65B9\u6CD5
+
+# 0: symbol kind, 1: symbol
+compiler.misc.incompatible.abstracts=\u5728 {0} {1} \u4E2D\u627E\u5230\u591A\u4E2A\u975E\u8986\u76D6\u62BD\u8C61\u65B9\u6CD5
+
+compiler.err.bad.functional.intf.anno=\u610F\u5916\u7684 @FunctionalInterface \u6CE8\u91CA
+
+# 0: message segment
+compiler.err.bad.functional.intf.anno.1=\u610F\u5916\u7684 @FunctionalInterface \u6CE8\u91CA\n{0}
+
+# 0: symbol
+compiler.misc.not.a.functional.intf={0} \u4E0D\u662F\u51FD\u6570\u63A5\u53E3
+
+# 0: symbol, 1: message segment
+compiler.misc.not.a.functional.intf.1={0} \u4E0D\u662F\u51FD\u6570\u63A5\u53E3\n{1}
+
+# 0: symbol, 1: symbol kind, 2: symbol
+compiler.misc.invalid.generic.lambda.target=lambda \u8868\u8FBE\u5F0F\u7684\u51FD\u6570\u63CF\u8FF0\u7B26\u65E0\u6548\n{1} {2} \u4E2D\u7684\u65B9\u6CD5 {0} \u4E3A\u6CDB\u578B\u65B9\u6CD5
+
+# 0: symbol kind, 1: symbol
+compiler.misc.incompatible.descs.in.functional.intf=\u5728 {0} {1} \u4E2D\u627E\u5230\u4E0D\u517C\u5BB9\u7684\u51FD\u6570\u63CF\u8FF0\u7B26
+
+# 0: name, 1: list of type, 2: type, 3: list of type
+compiler.misc.descriptor=\u63CF\u8FF0\u7B26: {2} {0}({1})
+
+# 0: name, 1: list of type, 2: type, 3: list of type
+compiler.misc.descriptor.throws=\u63CF\u8FF0\u7B26: {2} {0}({1}) \u629B\u51FA{3}
+
+# 0: type
+compiler.misc.no.suitable.functional.intf.inst=\u65E0\u6CD5\u63A8\u65AD{0}\u7684\u51FD\u6570\u63A5\u53E3\u63CF\u8FF0\u7B26
+
+# 0: type
+compiler.misc.secondary.bound.must.be.marker.intf=\u6B21\u7EA7\u9650\u5236\u8303\u56F4{0}\u5FC5\u987B\u4E3A\u6807\u8BB0\u63A5\u53E3
+
+# 0: symbol kind, 1: message segment
+compiler.err.invalid.mref={0} \u5F15\u7528\u65E0\u6548; {1}
+
+# 0: symbol kind, 1: message segment
+compiler.misc.invalid.mref={0} \u5F15\u7528\u65E0\u6548; {1}
+
+compiler.misc.static.mref.with.targs=\u6709\u5173\u9759\u6001\u65B9\u6CD5\u5F15\u7528\u7684\u53C2\u6570\u5316\u9650\u5B9A\u7B26
+
+compiler.misc.static.bound.mref=\u9759\u6001\u9650\u5236\u8303\u56F4\u65B9\u6CD5\u5F15\u7528
+
 # 0: symbol
 compiler.err.cant.assign.val.to.final.var=\u65E0\u6CD5\u4E3A\u6700\u7EC8\u53D8\u91CF{0}\u5206\u914D\u503C
 
+# 0: symbol, 1: message segment
+compiler.err.cant.ref.non.effectively.final.var=\u4ECE{1}\u5F15\u7528\u7684\u672C\u5730\u53D8\u91CF\u5FC5\u987B\u662F\u6700\u7EC8\u53D8\u91CF\u6216\u5B9E\u9645\u4E0A\u7684\u6700\u7EC8\u53D8\u91CF
+
+
+compiler.misc.lambda=lambda \u8868\u8FBE\u5F0F
+
+compiler.misc.inner.cls=\u5185\u90E8\u7C7B
+
 # 0: type
 compiler.err.cant.deref=\u65E0\u6CD5\u53D6\u6D88\u5F15\u7528{0}
 
@@ -142,8 +201,6 @@
 # 0: symbol
 compiler.err.cant.ref.before.ctor.called=\u65E0\u6CD5\u5728\u8C03\u7528\u8D85\u7C7B\u578B\u6784\u9020\u5668\u4E4B\u524D\u5F15\u7528{0}
 
-compiler.err.cant.ret.val.from.meth.decl.void=\u5BF9\u4E8E\u7ED3\u679C\u7C7B\u578B\u4E3A\u7A7A\u7684\u65B9\u6CD5, \u65E0\u6CD5\u8FD4\u56DE\u503C
-
 compiler.err.cant.select.static.class.from.param.type=\u65E0\u6CD5\u4ECE\u53C2\u6570\u5316\u7684\u7C7B\u578B\u4E2D\u9009\u62E9\u9759\u6001\u7C7B
 
 # 0: symbol, 1: string, 2: string
@@ -154,6 +211,8 @@
 # 0: symbol kind, 1: symbol
 compiler.err.clash.with.pkg.of.same.name={0} {1}\u4E0E\u5E26\u6709\u76F8\u540C\u540D\u79F0\u7684\u7A0B\u5E8F\u5305\u51B2\u7A81
 
+compiler.err.class.not.allowed=\u6B64\u5904\u4E0D\u5141\u8BB8\u4F7F\u7528\u7C7B, \u63A5\u53E3\u6216\u679A\u4E3E\u58F0\u660E
+
 compiler.err.const.expr.req=\u9700\u8981\u5E38\u91CF\u8868\u8FBE\u5F0F
 
 compiler.err.cont.outside.loop=continue \u5728 loop \u5916\u90E8
@@ -169,8 +228,6 @@
 # 0: type
 compiler.err.no.superclass={0}\u4E0D\u5177\u6709\u8D85\u7C7B
 
-compiler.err.wrong.target.for.polymorphic.signature.definition=MethodHandle API \u6784\u5EFA\u9700\u8981 -target 7 \u8FD0\u884C\u65F6\u6216\u66F4\u9AD8; \u5F53\u524D\u4E3A -target {0}
-
 # 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
 compiler.err.concrete.inheritance.conflict={1}\u4E2D\u7684\u65B9\u6CD5{0}\u548C{3}\u4E2D\u7684\u65B9\u6CD5{2}\u662F\u4F7F\u7528\u76F8\u540C\u7684\u7B7E\u540D\u7EE7\u627F\u7684
 
@@ -181,9 +238,48 @@
 
 compiler.err.duplicate.annotation=\u6CE8\u91CA\u91CD\u590D
 
+# 0: type
+compiler.err.duplicate.annotation.invalid.repeated=\u65E0\u6CD5\u91CD\u590D\u6CE8\u91CA{0}\n\u5B83\u6CA1\u6709\u5B9A\u4E49\u6709\u6548\u7684\u5305\u542B\u6CE8\u91CA\u3002
+
 # 0: name, 1: type
 compiler.err.duplicate.annotation.member.value={1}\u4E2D\u7684\u6CE8\u91CA\u6210\u5458\u503C{0}\u91CD\u590D
 
+# 0: type, 1: type
+compiler.err.duplicate.annotation.missing.container=\u6CE8\u91CA\u91CD\u590D, {0}\u7684\u58F0\u660E\u6CA1\u6709\u6709\u6548\u7684{1}\u6CE8\u91CA
+
+# 0: type
+compiler.err.invalid.repeatable.annotation=\u6CE8\u91CA\u91CD\u590D, \u4F7F\u7528\u65E0\u6548\u7684\u53EF\u91CD\u590D\u6CE8\u91CA\u5BF9{0}\u8FDB\u884C\u4E86\u6CE8\u91CA
+
+# 0: type
+compiler.err.invalid.repeatable.annotation.no.value=\u6CE8\u91CA\u91CD\u590D, {0}\u4E0D\u662F\u6709\u6548\u7684\u53EF\u91CD\u590D\u7C7B\u578B, \u672A\u58F0\u660E\u4EFB\u4F55\u503C\u5143\u7D20\u65B9\u6CD5
+
+# 0: type, 1: number
+compiler.err.invalid.repeatable.annotation.multiple.values=\u6CE8\u91CA\u91CD\u590D, {0}\u4E0D\u662F\u6709\u6548\u7684\u53EF\u91CD\u590D\u7C7B\u578B, \u5DF2\u58F0\u660E {1} \u4E2A\u503C\u5143\u7D20\u65B9\u6CD5
+
+# 0: type
+compiler.err.invalid.repeatable.annotation.invalid.value=\u6CE8\u91CA\u91CD\u590D, {0}\u4E0D\u662F\u6709\u6548\u7684\u53EF\u91CD\u590D\u7C7B\u578B, \u503C\u5143\u7D20\u65E0\u6548, \u9700\u8981\u65B9\u6CD5
+
+# 0: type, 1: type, 2: type
+compiler.err.invalid.repeatable.annotation.value.return=\u6CE8\u91CA\u91CD\u590D, \u5305\u542B\u6CE8\u91CA{0}\u7684\u503C\u5143\u7D20\u5E94\u5177\u6709\u7C7B\u578B{2}, \u4F46\u627E\u5230\u7684\u662F{1}
+
+# 0: type, 1: symbol
+compiler.err.invalid.repeatable.annotation.elem.nondefault=\u5305\u542B\u6CE8\u91CA{0}\u6CA1\u6709\u5143\u7D20 {1} \u7684\u9ED8\u8BA4\u503C
+
+# 0: symbol, 1: type, 2: symbol, 3: type
+compiler.err.invalid.repeatable.annotation.retention=\u5305\u542B\u6CE8\u91CA {0} \u7684\u4FDD\u7559\u671F ({1}) \u77ED\u4E8E\u5DF2\u5305\u542B\u6CE8\u91CA {2} \u7684\u4FDD\u7559\u671F ({3})
+
+# 0: symbol, 1: symbol
+compiler.err.invalid.repeatable.annotation.not.documented=\u5305\u542B\u6CE8\u91CA\u7C7B\u578B {0} \u4E0D\u662F @Documented, \u800C\u91CD\u590D\u7684\u6CE8\u91CA\u7C7B\u578B {1} \u4E3A
+
+# 0: symbol, 1: symbol
+compiler.err.invalid.repeatable.annotation.not.inherited=\u5305\u542B\u6CE8\u91CA\u7C7B\u578B {0} \u4E0D\u662F @Inherited, \u800C\u91CD\u590D\u7684\u6CE8\u91CA\u7C7B\u578B {1} \u4E3A
+
+# 0: symbol, 1: symbol
+compiler.err.invalid.repeatable.annotation.incompatible.target=\u5BB9\u5668\u6CE8\u91CA {0} \u7684\u76EE\u6807\u4E0D\u662F\u91CD\u590D\u6CE8\u91CA {1} \u7684\u76EE\u6807\u5B50\u96C6
+
+# 0: symbol
+compiler.err.invalid.repeatable.annotation.repeated.and.container.present=\u5BB9\u5668 {0} \u4E0D\u5F97\u4E0E\u5176\u5305\u542B\u7684\u5143\u7D20\u540C\u65F6\u5B58\u5728
+
 # 0: name
 compiler.err.duplicate.class=\u7C7B\u91CD\u590D: {0}
 
@@ -245,10 +341,10 @@
 compiler.err.generic.throwable=\u6CDB\u578B\u7C7B\u4E0D\u80FD\u6269\u5C55 java.lang.Throwable
 
 # 0: symbol
-compiler.err.icls.cant.have.static.decl=\u5185\u90E8\u7C7B{0}\u4E2D\u7684\u9759\u6001\u58F0\u660E\u975E\u6CD5\n\u4FEE\u9970\u7B26 \''static\'' \u4EC5\u5141\u8BB8\u5728\u5E38\u91CF\u53D8\u91CF\u58F0\u660E\u4E2D\u4F7F\u7528
+compiler.err.icls.cant.have.static.decl=\u5185\u90E8\u7C7B{0}\u4E2D\u7684\u9759\u6001\u58F0\u660E\u975E\u6CD5\n\u4FEE\u9970\u7B26 ''static'' \u4EC5\u5141\u8BB8\u5728\u5E38\u91CF\u53D8\u91CF\u58F0\u660E\u4E2D\u4F7F\u7528
 
 # 0: string
-compiler.err.illegal.char=\u975E\u6CD5\u5B57\u7B26: \\{0}
+compiler.err.illegal.char=\u975E\u6CD5\u5B57\u7B26: ''{0}''
 
 compiler.err.illegal.char.for.encoding=\u7F16\u7801{0}\u7684\u4E0D\u53EF\u6620\u5C04\u5B57\u7B26
 
@@ -280,11 +376,15 @@
 
 compiler.err.illegal.underscore=\u975E\u6CD5\u4E0B\u5212\u7EBF
 
+compiler.err.illegal.dot=\u975E\u6CD5 ''.''
+
 # 0: symbol
 compiler.err.illegal.qual.not.icls=\u975E\u6CD5\u9650\u5B9A\u7B26; {0}\u4E0D\u662F\u5185\u90E8\u7C7B
 
 compiler.err.illegal.start.of.expr=\u975E\u6CD5\u7684\u8868\u8FBE\u5F0F\u5F00\u59CB
 
+compiler.err.illegal.start.of.stmt=\u975E\u6CD5\u7684\u8BED\u53E5\u5F00\u59CB
+
 compiler.err.illegal.start.of.type=\u975E\u6CD5\u7684\u7C7B\u578B\u5F00\u59CB
 
 compiler.err.illegal.unicode.esc=\u975E\u6CD5\u7684 Unicode \u8F6C\u4E49
@@ -302,8 +402,6 @@
 # 0: number
 compiler.err.int.number.too.large=\u8FC7\u5927\u7684\u6574\u6570: {0}
 
-compiler.err.internal.error.cant.instantiate=\u5185\u90E8\u9519\u8BEF; \u65E0\u6CD5\u5C06\u4F4D\u4E8E{1}\u7684{0}\u5B9E\u4F8B\u5316\u4E3A ({2})
-
 compiler.err.intf.annotation.members.cant.have.params=@interface \u6210\u5458\u4E0D\u80FD\u5E26\u6709\u53C2\u6570
 
 compiler.err.intf.annotation.cant.have.type.params=@interface \u4E0D\u80FD\u5E26\u6709\u7C7B\u578B\u53C2\u6570
@@ -315,7 +413,7 @@
 
 compiler.err.intf.expected.here=\u6B64\u5904\u9700\u8981\u63A5\u53E3
 
-compiler.err.intf.meth.cant.have.body=\u63A5\u53E3\u65B9\u6CD5\u4E0D\u80FD\u5E26\u6709\u4E3B\u4F53
+compiler.err.intf.meth.cant.have.body=\u63A5\u53E3\u62BD\u8C61\u65B9\u6CD5\u4E0D\u80FD\u5E26\u6709\u4E3B\u4F53
 
 compiler.err.invalid.annotation.member.type=\u6CE8\u91CA\u6210\u5458\u7684\u7C7B\u578B\u65E0\u6548
 
@@ -327,6 +425,8 @@
 
 compiler.err.varargs.and.old.array.syntax=variable-arity \u53C2\u6570\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u4F20\u7EDF\u6570\u7EC4\u8BB0\u53F7
 
+compiler.err.variable.not.allowed=\u6B64\u5904\u4E0D\u5141\u8BB8\u4F7F\u7528\u53D8\u91CF\u58F0\u660E
+
 # 0: name
 compiler.err.label.already.in.use=\u6807\u7B7E{0}\u5DF2\u4F7F\u7528
 
@@ -337,6 +437,8 @@
 
 compiler.err.cannot.create.array.with.type.arguments=\u65E0\u6CD5\u521B\u5EFA\u5177\u6709\u7C7B\u578B\u53D8\u91CF\u7684\u6570\u7EC4
 
+compiler.err.cannot.create.array.with.diamond=\u65E0\u6CD5\u521B\u5EFA\u5177\u6709 ''<>'' \u7684\u6570\u7EC4
+
 #
 # limits.  We don't give the limits in the diagnostic because we expect
 # them to change, yet we want to use the same diagnostic.  These are all
@@ -360,7 +462,7 @@
 
 compiler.err.limit.string=\u5E38\u91CF\u5B57\u7B26\u4E32\u8FC7\u957F
 
-compiler.err.limit.string.overflow=\u5BF9\u4E8E\u5E38\u91CF\u6C60\u6765\u8BF4, \u5B57\u7B26\u4E32 \"{0}...\" \u7684 UTF8 \u8868\u793A\u8FC7\u957F
+compiler.err.limit.string.overflow=\u5BF9\u4E8E\u5E38\u91CF\u6C60\u6765\u8BF4, \u5B57\u7B26\u4E32 "{0}..." \u7684 UTF8 \u8868\u793A\u8FC7\u957F
 
 compiler.err.malformed.fp.lit=\u6D6E\u70B9\u6587\u5B57\u7684\u683C\u5F0F\u9519\u8BEF
 
@@ -370,7 +472,9 @@
 
 compiler.err.missing.ret.stmt=\u7F3A\u5C11\u8FD4\u56DE\u8BED\u53E5
 
-compiler.err.missing.ret.val=\u7F3A\u5C11\u8FD4\u56DE\u503C
+compiler.misc.missing.ret.val=\u7F3A\u5C11\u8FD4\u56DE\u503C
+
+compiler.misc.unexpected.ret.val=\u610F\u5916\u7684\u8FD4\u56DE\u503C
 
 # 0: set of modifier
 compiler.err.mod.not.allowed.here=\u6B64\u5904\u4E0D\u5141\u8BB8\u4F7F\u7528\u4FEE\u9970\u7B26{0}
@@ -398,6 +502,25 @@
 # 0: type, 1: type
 compiler.err.neither.conditional.subtype=? \u7684\u4E0D\u517C\u5BB9\u7C7B\u578B: \u4E24\u8005\u90FD\u4E0D\u662F\u5BF9\u65B9\u7684\u5B50\u7C7B\u578B\n\u7B2C\u4E8C\u4E2A\u64CD\u4F5C\u6570: {0}\n\u7B2C\u4E09\u4E2A\u64CD\u4F5C\u6570: {1}
 
+# 0: message segment
+compiler.misc.incompatible.type.in.conditional=\u6761\u4EF6\u8868\u8FBE\u5F0F\u4E2D\u7684\u7C7B\u578B\u9519\u8BEF; {0}
+
+compiler.misc.conditional.target.cant.be.void=\u6761\u4EF6\u8868\u8FBE\u5F0F\u7684\u76EE\u6807\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A
+
+# 0: type
+compiler.misc.incompatible.ret.type.in.lambda=lambda \u8868\u8FBE\u5F0F\u4E2D\u7684\u8FD4\u56DE\u7C7B\u578B\u9519\u8BEF\n{0}
+
+# 0: type
+compiler.misc.incompatible.ret.type.in.mref=\u65B9\u6CD5\u5F15\u7528\u4E2D\u7684\u8FD4\u56DE\u7C7B\u578B\u9519\u8BEF\n{0}
+
+# 0: list of type
+compiler.err.incompatible.thrown.types.in.lambda=lambda \u8868\u8FBE\u5F0F\u4E2D\u629B\u51FA\u7684\u7C7B\u578B{0}\u4E0D\u517C\u5BB9
+
+# 0: list of type
+compiler.err.incompatible.thrown.types.in.mref=\u65B9\u6CD5\u5F15\u7528\u4E2D\u629B\u51FA\u7684\u7C7B\u578B{0}\u4E0D\u517C\u5BB9
+
+compiler.misc.incompatible.arg.types.in.lambda=lambda \u8868\u8FBE\u5F0F\u4E2D\u7684\u53C2\u6570\u7C7B\u578B\u4E0D\u517C\u5BB9
+
 compiler.err.new.not.allowed.in.annotation=\u6CE8\u91CA\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528 ''new''
 
 compiler.err.no.annotation.member={1}\u4E2D\u6CA1\u6709\u6CE8\u91CA\u6210\u5458{0}
@@ -414,6 +537,12 @@
 compiler.err.not.def.access.class.intf.cant.access={1}\u4E2D\u7684{0}\u662F\u5728\u4E0D\u53EF\u8BBF\u95EE\u7684\u7C7B\u6216\u63A5\u53E3\u4E2D\u5B9A\u4E49\u7684
 
 # 0: symbol, 1: symbol
+compiler.misc.not.def.access.class.intf.cant.access={1}\u4E2D\u7684{0}\u662F\u5728\u4E0D\u53EF\u8BBF\u95EE\u7684\u7C7B\u6216\u63A5\u53E3\u4E2D\u5B9A\u4E49\u7684
+
+# 0: symbol, 1: list of type, 2: type
+compiler.misc.cant.access.inner.cls.constr=\u65E0\u6CD5\u8BBF\u95EE\u6784\u9020\u5668 {0}({1})\n\u4F5C\u7528\u57DF\u4E2D\u6CA1\u6709\u7C7B\u578B\u4E3A{2}\u7684\u5C01\u95ED\u5B9E\u4F8B
+
+# 0: symbol, 1: symbol
 compiler.err.not.def.public.cant.access={0}\u5728{1}\u4E2D\u4E0D\u662F\u516C\u5171\u7684; \u65E0\u6CD5\u4ECE\u5916\u90E8\u7A0B\u5E8F\u5305\u4E2D\u5BF9\u5176\u8FDB\u884C\u8BBF\u95EE
 
 # 0: name
@@ -455,15 +584,13 @@
 # 0: list of string
 compiler.err.proc.no.explicit.annotation.processing.requested=\u4EC5\u5F53\u663E\u5F0F\u8BF7\u6C42\u6CE8\u91CA\u5904\u7406\u65F6\u624D\u63A5\u53D7\u7C7B\u540D\u79F0 ''{0}''
 
-compiler.err.proc.no.service=\u627E\u4E0D\u5230\u670D\u52A1\u52A0\u8F7D\u5668\u7C7B\u3002\njava.util.ServiceLoader \u6216 sun.misc.Service \u5FC5\u987B\u53EF\u7528\u3002
+compiler.err.proc.no.service=ServiceLoader \u4E0D\u53EF\u7528, \u4F46\u5B83\u662F\u6CE8\u91CA\u5904\u7406\u6240\u5FC5\u9700\u7684\u3002
 
 compiler.err.proc.processor.bad.option.name=\u5904\u7406\u7A0B\u5E8F ''{1}'' \u63D0\u4F9B\u7684\u9009\u9879\u540D\u79F0 ''{0}'' \u9519\u8BEF
 
 # 0: string
 compiler.err.proc.processor.cant.instantiate=\u65E0\u6CD5\u5B9E\u4F8B\u5316\u5904\u7406\u7A0B\u5E8F ''{0}'' \u7684\u5B9E\u4F8B
 
-compiler.err.proc.processor.constructor.error=\u6784\u9020\u5904\u7406\u7A0B\u5E8F\u5BF9\u8C61{0}\u65F6\u629B\u51FA\u5F02\u5E38\u9519\u8BEF
-
 # 0: string
 compiler.err.proc.processor.not.found=\u627E\u4E0D\u5230\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F ''{0}''
 
@@ -482,7 +609,10 @@
 compiler.err.recursive.ctor.invocation=\u9012\u5F52\u6784\u9020\u5668\u8C03\u7528
 
 # 0: name, 1: symbol kind, 2: symbol, 3: symbol, 4: symbol kind, 5: symbol, 6: symbol
-compiler.err.ref.ambiguous=\u5BF9{0}\u7684\u5F15\u7528\u4E0D\u660E\u786E, {3}\u4E2D\u7684{1} {2}\u548C{6}\u4E2D\u7684{4} {5}\u90FD\u5339\u914D
+compiler.err.ref.ambiguous=\u5BF9{0}\u7684\u5F15\u7528\u4E0D\u660E\u786E\n{3} \u4E2D\u7684{1} {2} \u548C {6} \u4E2D\u7684{4} {5} \u90FD\u5339\u914D
+
+# 0: name, 1: symbol kind, 2: symbol, 3: symbol, 4: symbol kind, 5: symbol, 6: symbol
+compiler.misc.ref.ambiguous=\u5BF9{0}\u7684\u5F15\u7528\u4E0D\u660E\u786E\n{3} \u4E2D\u7684{1} {2} \u548C {6} \u4E2D\u7684{4} {5} \u90FD\u5339\u914D
 
 compiler.err.repeated.annotation.target=\u6CE8\u91CA\u76EE\u6807\u91CD\u590D
 
@@ -536,6 +666,27 @@
 # 0: type, 1: type, 2: string
 compiler.err.types.incompatible.diff.ret=\u7C7B\u578B{0}\u548C{1}\u4E0D\u517C\u5BB9; \u4E24\u8005\u90FD\u5B9A\u4E49\u4E86{2}, \u4F46\u5374\u5E26\u6709\u4E0D\u76F8\u5173\u7684\u8FD4\u56DE\u7C7B\u578B
 
+# 0: kind, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
+compiler.err.types.incompatible.unrelated.defaults={0} {1}\u4ECE\u7C7B\u578B {4} \u548C {5} \u4E2D\u7EE7\u627F\u4E86{2}({3}) \u7684\u4E0D\u76F8\u5173\u9ED8\u8BA4\u503C
+
+# 0: kind, 1: type, 2: name, 3: list of type, 4: symbol, 5: symbol
+compiler.err.types.incompatible.abstract.default={0} {1}\u4ECE\u7C7B\u578B {4} \u548C {5} \u4E2D\u7EE7\u627F\u4E86{2}({3}) \u7684\u62BD\u8C61\u548C\u9ED8\u8BA4\u503C
+
+# 0: name, 1: kind, 2: symbol
+compiler.err.default.overrides.object.member={1} {2} \u4E2D\u7684\u9ED8\u8BA4\u65B9\u6CD5{0}\u8986\u76D6\u4E86 java.lang.Object \u7684\u6210\u5458
+
+# 0: type
+compiler.err.illegal.static.intf.meth.call=\u9759\u6001\u63A5\u53E3\u65B9\u6CD5\u8C03\u7528\u975E\u6CD5\n\u5E94\u5C06\u63A5\u6536\u65B9\u8868\u8FBE\u5F0F\u66FF\u6362\u4E3A\u7C7B\u578B\u9650\u5B9A\u7B26 ''{0}''
+
+# 0: type, 1: message segment
+compiler.err.illegal.default.super.call=\u9ED8\u8BA4\u8D85\u7EA7\u8C03\u7528\u4E2D\u7684\u7C7B\u578B\u9650\u5B9A\u7B26{0}\u9519\u8BEF\n{1}
+
+# 0: symbol, 1: type
+compiler.misc.overridden.default=\u8986\u76D6\u4E86{1}\u4E2D\u7684\u65B9\u6CD5 {0}
+
+# 0: symbol, 1: symbol
+compiler.misc.redundant.supertype=\u5197\u4F59\u63A5\u53E3 {0} \u5DF2\u7531 {1} \u6269\u5C55
+
 compiler.err.unclosed.char.lit=\u672A\u7ED3\u675F\u7684\u5B57\u7B26\u6587\u5B57
 
 compiler.err.unclosed.comment=\u672A\u7ED3\u675F\u7684\u6CE8\u91CA
@@ -550,19 +701,14 @@
 # 0: name
 compiler.err.undef.label=\u672A\u5B9A\u4E49\u7684\u6807\u7B7E: {0}
 
-compiler.err.undetermined.type=\u65E0\u6CD5\u63A8\u65AD{0}\u7684\u7C7B\u578B\u53C2\u6570
-
-# 0: type, 1: message segment
-compiler.err.undetermined.type.1=\u65E0\u6CD5\u63A8\u65AD{0}\u7684\u7C7B\u578B\u53C2\u6570;\n\u539F\u56E0: {1}
-
-# 0: list of type, 1: message segment
-compiler.err.invalid.inferred.types={0}\u7684\u63A8\u65AD\u7C7B\u578B\u65E0\u6548; {1}
-
 # 0: message segment, 1: unused
 compiler.err.cant.apply.diamond=\u65E0\u6CD5\u63A8\u65AD{0}\u7684\u7C7B\u578B\u53C2\u6570
 
-# 0: message segment, 1: message segment
-compiler.err.cant.apply.diamond.1=\u65E0\u6CD5\u63A8\u65AD{0}\u7684\u7C7B\u578B\u53C2\u6570;\n\u539F\u56E0: {1}
+# 0: message segment or type, 1: message segment
+compiler.err.cant.apply.diamond.1=\u65E0\u6CD5\u63A8\u65AD{0}\u7684\u7C7B\u578B\u53C2\u6570\n\u539F\u56E0: {1}
+
+# 0: message segment or type, 1: message segment
+compiler.misc.cant.apply.diamond.1=\u65E0\u6CD5\u63A8\u65AD{0}\u7684\u7C7B\u578B\u53C2\u6570\n\u539F\u56E0: {1}
 
 compiler.err.unreachable.stmt=\u65E0\u6CD5\u8BBF\u95EE\u7684\u8BED\u53E5
 
@@ -605,7 +751,7 @@
 # 0: symbol
 compiler.misc.varargs.trustme.on.virtual.varargs=\u5B9E\u4F8B\u65B9\u6CD5 {0} \u4E0D\u662F\u6700\u7EC8\u7684\u3002
 
-# 0: type, 1: kind, 2: symbol
+# 0: type, 1: symbol kind, 2: symbol
 compiler.misc.inaccessible.varargs.type=\u5F62\u5F0F varargs \u5143\u7D20\u7C7B\u578B{0}\u65E0\u6CD5\u4ECE {1} {2} \u8FDB\u884C\u8BBF\u95EE
 
 # In the following string, {1} will always be the detail message from
@@ -620,7 +766,7 @@
 
 ## All errors which do not refer to a particular line in the source code are
 ## preceded by this string.
-compiler.err.error=\u9519\u8BEF:\u0020
+compiler.err.error=\u9519\u8BEF: 
 
 # The following error messages do not refer to a line in the source code.
 compiler.err.cant.read.file=\u65E0\u6CD5\u8BFB\u53D6: {0}
@@ -637,7 +783,7 @@
 
 compiler.misc.fatal.err.cant.locate.ctor=\u81F4\u547D\u9519\u8BEF: \u627E\u4E0D\u5230{0}\u7684\u6784\u9020\u5668
 
-compiler.misc.fatal.err.cant.close.loader=\u81F4\u547D\u9519\u8BEF: \u65E0\u6CD5\u5173\u95ED\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u7684\u7C7B\u52A0\u8F7D\u5668
+compiler.misc.fatal.err.cant.close=\u81F4\u547D\u9519\u8BEF: \u65E0\u6CD5\u5173\u95ED\u7F16\u8BD1\u5668\u8D44\u6E90
 
 #####
 
@@ -659,7 +805,10 @@
 
 ## The following string will appear before all messages keyed as:
 ## "compiler.note".
-compiler.note.note=\u6CE8:\u0020
+
+compiler.note.potential.lambda.found=\u53EF\u5C06\u6B64\u533F\u540D\u5185\u90E8\u7C7B\u521B\u5EFA\u8F6C\u6362\u4E3A lambda \u8868\u8FBE\u5F0F\u3002
+
+compiler.note.note=\u6CE8: 
 
 # 0: file name
 compiler.note.deprecated.filename={0}\u4F7F\u7528\u6216\u8986\u76D6\u4E86\u5DF2\u8FC7\u65F6\u7684 API\u3002
@@ -773,12 +922,12 @@
 ##
 
 ## All warning messages are preceded by the following string.
-compiler.warn.warning=\u8B66\u544A:\u0020
+compiler.warn.warning=\u8B66\u544A: 
 
 ## Warning messages may also include the following prefix to identify a
 ## lint option
 # 0: option name
-compiler.warn.lintOption=[{0}]\u0020
+compiler.warn.lintOption=[{0}] 
 
 # 0: symbol
 compiler.warn.constant.SVUID=serialVersionUID \u5728\u7C7B{0}\u4E2D\u5FC5\u987B\u662F\u5E38\u91CF
@@ -1046,6 +1195,8 @@
 
 compiler.misc.bad.signature=\u9519\u8BEF\u7684\u7B7E\u540D: {0}
 
+compiler.misc.bad.type.annotation.value=\u9519\u8BEF\u7684\u7C7B\u578B\u6CE8\u91CA\u76EE\u6807\u7C7B\u578B\u503C: {0}
+
 compiler.misc.class.file.wrong.class=\u7C7B\u6587\u4EF6\u5305\u542B\u9519\u8BEF\u7684\u7C7B: {0}
 
 compiler.misc.class.file.not.found=\u627E\u4E0D\u5230{0}\u7684\u7C7B\u6587\u4EF6
@@ -1077,24 +1228,17 @@
 
 #####
 
-# 0: message segment, 1: type, 2: type
-compiler.err.prob.found.req={0}\n\u9700\u8981: {2}\n\u627E\u5230:    {1}
+# 0: message segment
+compiler.err.prob.found.req=\u4E0D\u517C\u5BB9\u7684\u7C7B\u578B: {0}
 
 # 0: message segment, 1: type, 2: type
 compiler.warn.prob.found.req={0}\n\u9700\u8981: {2}\n\u627E\u5230:    {1}
 
-compiler.err.prob.found.req.1={0} {3}\n\u9700\u8981: {2}\n\u627E\u5230:    {1}
-
-## The following are all possible strings for the first argument ({0}) of the
-## above strings.
-compiler.misc.incompatible.types=\u4E0D\u517C\u5BB9\u7684\u7C7B\u578B
-
-# 0: message segment
-compiler.misc.incompatible.types.1=\u4E0D\u517C\u5BB9\u7684\u7C7B\u578B; {0}
-
-compiler.misc.inconvertible.types=\u4E0D\u53EF\u8F6C\u6362\u7684\u7C7B\u578B
-
-compiler.misc.possible.loss.of.precision=\u53EF\u80FD\u635F\u5931\u7CBE\u5EA6
+# 0: type, 1: type
+compiler.misc.inconvertible.types={0}\u65E0\u6CD5\u8F6C\u6362\u4E3A{1}
+
+# 0: type, 1: type
+compiler.misc.possible.loss.of.precision=\u4ECE{0}\u8F6C\u6362\u5230{1}\u53EF\u80FD\u4F1A\u6709\u635F\u5931
 
 compiler.misc.unchecked.assign=\u672A\u7ECF\u68C0\u67E5\u7684\u8F6C\u6362
 
@@ -1104,16 +1248,13 @@
 #     assigned array cannot dynamically check its stores
 compiler.misc.unchecked.cast.to.type=\u672A\u7ECF\u68C0\u67E5\u7684\u8F6C\u6362
 
-compiler.misc.assignment.from.super-bound=\u4ECE super-bound \u7C7B\u578B{0}\u8FDB\u884C\u5206\u914D
-
-compiler.misc.assignment.to.extends-bound=\u5230 extends-bound \u7C7B\u578B{0}\u7684\u5206\u914D
-
 # compiler.err.star.expected=\
 #     ''*'' expected
 # compiler.err.no.elem.type=\
 #     \[\*\] cannot have a type
 
-compiler.misc.try.not.applicable.to.type=try-with-resources \u4E0D\u9002\u7528\u4E8E\u53D8\u91CF\u7C7B\u578B
+# 0: type
+compiler.misc.try.not.applicable.to.type=try-with-resources \u4E0D\u9002\u7528\u4E8E\u53D8\u91CF\u7C7B\u578B\n({0})
 
 #####
 
@@ -1139,25 +1280,44 @@
 
 ## The following are all possible strings for the last argument of all those
 ## diagnostics whose key ends in ".1"
-compiler.misc.undetermined.type=\u672A\u786E\u5B9A\u7684\u7C7B\u578B
-
-compiler.misc.type.variable.has.undetermined.type=\u7C7B\u578B\u53D8\u91CF{0}\u5E26\u6709\u672A\u786E\u5B9A\u7684\u7C7B\u578B
 
 # 0: type, 1: list of type
 compiler.misc.no.unique.maximal.instance.exists=\u5BF9\u4E8E\u4E0A\u9650\u4E3A{1}\u7684\u7C7B\u578B\u53D8\u91CF{0}, \u4E0D\u5B58\u5728\u552F\u4E00\u6700\u5927\u5B9E\u4F8B
 
 compiler.misc.no.unique.minimal.instance.exists=\u5BF9\u4E8E\u4E0B\u9650\u4E3A{1}\u7684\u7C7B\u578B\u53D8\u91CF{0}, \u4E0D\u5B58\u5728\u552F\u4E00\u6700\u5C0F\u5B9E\u4F8B
 
-# 0: list of type, 1: type, 2: type
-compiler.misc.infer.no.conforming.instance.exists=\u4E0D\u5B58\u5728\u7C7B\u578B\u53D8\u91CF{0}\u7684\u5B9E\u4F8B, \u4EE5\u4F7F{1}\u4E0E{2}\u4E00\u81F4
+# 0: type, 1: list of type
+compiler.misc.incompatible.upper.bounds=\u63A8\u8BBA\u53D8\u91CF {0} \u5177\u6709\u4E0D\u517C\u5BB9\u7684\u4E0A\u9650 {1}
+
+# 0: type, 1: list of type, 2: list of type
+compiler.misc.incompatible.eq.upper.bounds=\u63A8\u8BBA\u53D8\u91CF {0} \u5177\u6709\u4E0D\u517C\u5BB9\u7684\u9650\u5236\u8303\u56F4\n\u7B49\u5F0F\u7EA6\u675F\u6761\u4EF6: {1}\n\u4E0A\u9650: {2}
+
+# 0: type, 1: list of type, 2: list of type
+compiler.misc.incompatible.eq.lower.bounds=\u63A8\u8BBA\u53D8\u91CF{0}\u5177\u6709\u4E0D\u517C\u5BB9\u7684\u9650\u5236\u8303\u56F4\n\u7B49\u5F0F\u7EA6\u675F\u6761\u4EF6: {1}\n\u4E0B\u9650: {2}
 
 # 0: list of type, 1: type, 2: type
-compiler.misc.infer.no.conforming.assignment.exists=\u4E0D\u5B58\u5728\u7C7B\u578B\u53D8\u91CF{0}\u7684\u5B9E\u4F8B, \u4EE5\u4F7F\u53C2\u6570\u7C7B\u578B{1}\u4E0E\u5F62\u5F0F\u53C2\u6570\u7C7B\u578B{2}\u4E00\u81F4
-
-compiler.misc.infer.arg.length.mismatch=\u65E0\u6CD5\u4ECE\u53C2\u6570\u8FDB\u884C\u5B9E\u4F8B\u5316, \u56E0\u4E3A\u5B9E\u9645\u53C2\u6570\u5217\u8868\u548C\u5F62\u5F0F\u53C2\u6570\u5217\u8868\u957F\u5EA6\u4E0D\u540C
+compiler.misc.infer.no.conforming.instance.exists=\u4E0D\u5B58\u5728\u7C7B\u578B\u53D8\u91CF{0}\u7684\u5B9E\u4F8B, \u4EE5\u4F7F{1}\u4E0E{2}\u4E00\u81F4
+
+# 0: list of type, 1: message segment
+compiler.misc.infer.no.conforming.assignment.exists=\u65E0\u6CD5\u63A8\u65AD\u7C7B\u578B\u53D8\u91CF {0}\n(\u53C2\u6570\u4E0D\u5339\u914D; {1})
+
+# 0: list of type
+compiler.misc.infer.arg.length.mismatch=\u65E0\u6CD5\u63A8\u65AD\u7C7B\u578B\u53D8\u91CF {0}\n(\u5B9E\u9645\u53C2\u6570\u5217\u8868\u548C\u5F62\u5F0F\u53C2\u6570\u5217\u8868\u957F\u5EA6\u4E0D\u540C)
+
+# 0: list of type, 1: message segment
+compiler.misc.infer.varargs.argument.mismatch=\u65E0\u6CD5\u63A8\u65AD\u7C7B\u578B\u53D8\u91CF {0}\n(varargs \u4E0D\u5339\u914D; {1})
 
 # 0: type, 1: list of type
-compiler.misc.inferred.do.not.conform.to.bounds=\u63A8\u65AD\u7C7B\u578B\u4E0D\u7B26\u5408\u58F0\u660E\u7684\u8303\u56F4\n\u63A8\u65AD: {0}\n\u8303\u56F4: {1}
+compiler.misc.inferred.do.not.conform.to.upper.bounds=\u63A8\u65AD\u7C7B\u578B\u4E0D\u7B26\u5408\u4E0A\u9650\n\u63A8\u65AD: {0}\n\u4E0A\u9650: {1}
+
+# 0: type, 1: list of type
+compiler.misc.inferred.do.not.conform.to.lower.bounds=\u63A8\u65AD\u7C7B\u578B\u4E0D\u7B26\u5408\u4E0B\u9650\n\u63A8\u65AD: {0}\n\u4E0B\u9650: {1}
+
+# 0: type, 1: list of type
+compiler.misc.inferred.do.not.conform.to.eq.bounds=\u63A8\u65AD\u7C7B\u578B\u4E0D\u7B26\u5408\u7B49\u5F0F\u7EA6\u675F\u6761\u4EF6\n\u63A8\u65AD: {0}\n\u7B49\u5F0F\u7EA6\u675F\u6761\u4EF6: {1}
+
+# 0: list of type
+compiler.misc.cyclic.inference=\u7531\u4E8E\u63A8\u8BBA\u5FAA\u73AF, \u65E0\u6CD5\u5B9E\u4F8B\u5316\u63A8\u8BBA\u53D8\u91CF{0}
 
 # 0: symbol
 compiler.misc.diamond={0}<>
@@ -1165,6 +1325,7 @@
 # 0: type
 compiler.misc.diamond.non.generic=\u65E0\u6CD5\u5C06 ''<>'' \u4E0E\u975E\u6CDB\u578B\u7C7B{0}\u4E00\u8D77\u4F7F\u7528
 
+# 0: unused
 compiler.misc.diamond.and.explicit.params=\u4E0D\u80FD\u5C06 ''<>'' \u4E0E\u6784\u9020\u5668\u7684\u663E\u5F0F\u7C7B\u578B\u53C2\u6570\u4E00\u8D77\u4F7F\u7528
 
 # 0: type, 1: list of type
@@ -1172,14 +1333,18 @@
 
 compiler.misc.arg.length.mismatch=\u5B9E\u9645\u53C2\u6570\u5217\u8868\u548C\u5F62\u5F0F\u53C2\u6570\u5217\u8868\u957F\u5EA6\u4E0D\u540C
 
-# 0: type, 1: type
-compiler.misc.no.conforming.assignment.exists=\u65E0\u6CD5\u901A\u8FC7\u65B9\u6CD5\u8C03\u7528\u8F6C\u6362\u5C06\u5B9E\u9645\u53C2\u6570{0}\u8F6C\u6362\u4E3A{1}
-
-# 0: type, 1: type
-compiler.misc.varargs.argument.mismatch=\u53C2\u6570\u7C7B\u578B{0}\u4E0D\u7B26\u5408 vararg \u5143\u7D20\u7C7B\u578B{1}
+# 0: message segment
+compiler.misc.no.conforming.assignment.exists=\u53C2\u6570\u4E0D\u5339\u914D; {0}
+
+# 0: message segment
+compiler.misc.varargs.argument.mismatch=varargs \u4E0D\u5339\u914D; {0}
 
 #####
 
+# 0: type, 1: file name
+compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file={1} \u4E2D\u7684\u8F85\u52A9\u7C7B{0}\u4E0D\u5E94\u4ECE\u5176\u81EA\u8EAB\u7684\u6E90\u6587\u4EF6\u4EE5\u5916\u8BBF\u95EE
+
+
 ## The first argument ({0}) is a "kindname".
 # 0: symbol kind, 1: symbol, 2: symbol
 compiler.err.abstract.cant.be.accessed.directly=\u65E0\u6CD5\u76F4\u63A5\u8BBF\u95EE{2}\u4E2D\u7684\u62BD\u8C61{0} {1}
@@ -1188,10 +1353,17 @@
 # 0: symbol kind, 1: symbol
 compiler.err.non-static.cant.be.ref=\u65E0\u6CD5\u4ECE\u9759\u6001\u4E0A\u4E0B\u6587\u4E2D\u5F15\u7528\u975E\u9759\u6001 {0} {1}
 
+# 0: symbol kind, 1: symbol
+compiler.misc.non-static.cant.be.ref=\u65E0\u6CD5\u4ECE\u9759\u6001\u4E0A\u4E0B\u6587\u4E2D\u5F15\u7528\u975E\u9759\u6001 {0} {1}
+
 ## Both arguments ({0}, {1}) are "kindname"s.  {0} is a comma-separated list
 ## of kindnames (the list should be identical to that provided in source.
 compiler.err.unexpected.type=\u610F\u5916\u7684\u7C7B\u578B\n\u9700\u8981: {0}\n\u627E\u5230:    {1}
 
+compiler.err.unexpected.lambda=\u6B64\u5904\u4E0D\u5E94\u4E3A lambda \u8868\u8FBE\u5F0F
+
+compiler.err.unexpected.mref=\u6B64\u5904\u4E0D\u5E94\u4E3A\u65B9\u6CD5\u5F15\u7528
+
 ## The first argument {0} is a "kindname" (e.g. 'constructor', 'field', etc.)
 ## The second argument {1} is the non-resolved symbol
 ## The third argument {2} is a list of type parameters (non-empty if {1} is a method)
@@ -1216,12 +1388,20 @@
 # 0: symbol kind, 1: name, 2: list of type, 3: list, 4: message segment
 compiler.err.cant.resolve.location.args.params=\u627E\u4E0D\u5230\u7B26\u53F7\n\u7B26\u53F7:   {0} <{2}>{1}({3})\n\u4F4D\u7F6E: {4}
 
+### Following are replicated/used for method reference diagnostics
+
+# 0: symbol kind, 1: name, 2: unused, 3: list of type, 4: message segment
+compiler.misc.cant.resolve.location.args=\u627E\u4E0D\u5230\u7B26\u53F7\n\u7B26\u53F7:   {0} {1}({3})\n\u4F4D\u7F6E: {4}
+
+# 0: symbol kind, 1: name, 2: list of type, 3: list, 4: message segment
+compiler.misc.cant.resolve.location.args.params=\u627E\u4E0D\u5230\u7B26\u53F7\n\u7B26\u53F7:   {0} <{2}>{1}({3})\n\u4F4D\u7F6E: {4}
+
 ##a location subdiagnostic is composed as follows:
 ## The first argument {0} is the location "kindname" (e.g. 'constructor', 'field', etc.)
 ## The second argument {1} is the location name
 ## The third argument {2} is the location type (only when {1} is a variable name)
 
-# 0: symbol kind, 1: symbol, 2: unused
+# 0: symbol kind, 1: type or symbol, 2: unused
 compiler.misc.location={0} {1}
 
 # 0: symbol kind, 1: symbol, 2: type
@@ -1256,6 +1436,10 @@
 
 compiler.misc.kindname.package=\u7A0B\u5E8F\u5305
 
+compiler.misc.kindname.static.init=\u9759\u6001\u521D\u59CB\u5316\u7A0B\u5E8F
+
+compiler.misc.kindname.instance.init=\u5B9E\u4F8B\u521D\u59CB\u5316\u7A0B\u5E8F
+
 #####
 
 compiler.misc.no.args=\u6CA1\u6709\u53C2\u6570
@@ -1312,6 +1496,7 @@
 # 0: symbol, 1: symbol, 2: symbol, 3: symbol
 compiler.misc.varargs.clash.with={1}\u4E2D\u7684{0}\u8986\u76D6\u4E86{3}\u4E2D\u7684{2}
 
+# 0: unused
 compiler.misc.diamond.and.anon.class=\u65E0\u6CD5\u5C06 ''<>'' \u4E0E\u533F\u540D\u5185\u90E8\u7C7B\u4E00\u8D77\u4F7F\u7528
 
 # 0: symbol kind, 1: symbol, 2: symbol, 3: message segment
@@ -1336,10 +1521,24 @@
 
 compiler.warn.assert.as.identifier=\u4ECE\u53D1\u884C\u7248 1.4 \u5F00\u59CB, ''assert'' \u662F\u4E00\u4E2A\u5173\u952E\u5B57, \u4F46\u4E0D\u80FD\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u8BF7\u4F7F\u7528 -source 1.4 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u5C06 ''assert'' \u7528\u4F5C\u5173\u952E\u5B57)
 
+compiler.warn.underscore.as.identifier=''_'' \u5DF2\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u4EE5\u540E\u7684\u53D1\u884C\u7248\u53EF\u80FD\u4E0D\u652F\u6301\u5C06 ''_'' \u7528\u4F5C\u6807\u8BC6\u7B26)
+
 compiler.err.enum.as.identifier=\u4ECE\u53D1\u884C\u7248 5 \u5F00\u59CB, ''enum'' \u4E3A\u5173\u952E\u5B57, \u800C\u4E0D\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u8BF7\u4F7F\u7528 -source 1.4 \u6216\u66F4\u4F4E\u7248\u672C\u4EE5\u5C06 ''enum'' \u7528\u4F5C\u6807\u8BC6\u7B26)
 
 compiler.err.assert.as.identifier=\u4ECE\u53D1\u884C\u7248 1.4 \u5F00\u59CB, ''assert'' \u662F\u4E00\u4E2A\u5173\u952E\u5B57, \u4F46\u4E0D\u80FD\u7528\u4F5C\u6807\u8BC6\u7B26\n(\u8BF7\u4F7F\u7528 -source 1.3 \u6216\u66F4\u4F4E\u7248\u672C\u4EE5\u5C06 ''assert'' \u7528\u4F5C\u6807\u8BC6\u7B26)
 
+# TODO 308: make a better error message
+compiler.err.this.as.identifier=\u4ECE\u53D1\u884C\u7248 8 \u5F00\u59CB, ''this'' \u53EA\u80FD\u4F5C\u4E3A\u63A5\u6536\u65B9\u7C7B\u578B\u7684\u53C2\u6570\u540D, \u8BE5\u53C2\u6570\u5FC5\u987B\u4E3A\u7B2C\u4E00\u4E2A\u53C2\u6570
+
+# TODO 308: make a better error message
+compiler.err.cant.annotate.static.class=\u65E0\u6CD5\u5BF9\u5C01\u95ED\u9759\u6001\u5D4C\u5957\u7C7B\u8FDB\u884C\u6CE8\u91CA
+# TODO 308: make a better error message
+compiler.err.cant.annotate.nested.type=\u65E0\u6CD5\u5BF9\u5D4C\u5957\u7C7B\u578B\u8FDB\u884C\u6CE8\u91CA
+
+compiler.err.incorrect.receiver.type=\u63A5\u6536\u65B9\u7C7B\u578B\u4E0E\u5C01\u95ED\u7C7B\u7C7B\u578B\u4E0D\u5339\u914D
+
+compiler.err.no.annotations.on.dot.class=\u7C7B\u6587\u5B57\u7C7B\u578B\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u4EFB\u4F55\u6CE8\u91CA
+
 # 0: string
 compiler.err.generics.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301\u6CDB\u578B\n(\u8BF7\u4F7F\u7528 -source 5 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u542F\u7528\u6CDB\u578B)
 
@@ -1349,9 +1548,8 @@
 # 0: string
 compiler.err.annotations.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301\u6CE8\u91CA\n(\u8BF7\u4F7F\u7528 -source 5 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u542F\u7528\u6CE8\u91CA)
 
-#308 compiler.err.type.annotations.not.supported.in.source=\
-#308     type annotations are not supported in -source {0}\n\
-#308 (use -source 7 or higher to enable type annotations)
+# 0: string
+compiler.err.type.annotations.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301\u7C7B\u578B\u6CE8\u91CA\n(\u8BF7\u4F7F\u7528 -source 8 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u542F\u7528\u7C7B\u578B\u6CE8\u91CA)
 
 # 0: string
 compiler.err.foreach.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301 for-each \u5FAA\u73AF\n(\u8BF7\u4F7F\u7528 -source 5 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u542F\u7528 for-each \u5FAA\u73AF)
@@ -1371,6 +1569,47 @@
 # 0: string
 compiler.err.string.switch.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301 switch \u4E2D\u5B58\u5728\u5B57\u7B26\u4E32\n(\u8BF7\u4F7F\u7528 -source 7 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u5141\u8BB8 switch \u4E2D\u5B58\u5728\u5B57\u7B26\u4E32)
 
+# 0: string
+compiler.err.lambda.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301 lambda \u8868\u8FBE\u5F0F\n(\u8BF7\u4F7F\u7528 -source 8 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u542F\u7528 lambda \u8868\u8FBE\u5F0F)
+
+# 0: string
+compiler.err.method.references.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301\u65B9\u6CD5\u5F15\u7528\n(\u8BF7\u4F7F\u7528 -source 8 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u542F\u7528\u65B9\u6CD5\u5F15\u7528)
+
+# 0: string
+compiler.err.default.methods.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301\u9ED8\u8BA4\u65B9\u6CD5\n(\u8BF7\u4F7F\u7528 -source 8 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u542F\u7528\u9ED8\u8BA4\u65B9\u6CD5)
+
+# 0: string
+compiler.err.intersection.types.in.cast.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301\u8F6C\u6362\u4E2D\u7684\u4EA4\u53C9\u7C7B\u578B\n(\u8BF7\u4F7F\u7528 -source 8 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u542F\u7528\u9ED8\u8BA4\u65B9\u6CD5)
+
+# 0: string
+compiler.err.static.intf.methods.not.supported.in.source=-source {0} \u4E2D\u4E0D\u652F\u6301\u9759\u6001\u63A5\u53E3\u65B9\u6CD5\n(\u8BF7\u4F7F\u7528 -source 8 \u6216\u66F4\u9AD8\u7248\u672C\u4EE5\u542F\u7528\u9759\u6001\u63A5\u53E3\u65B9\u6CD5)
+
+########################################
+# Diagnostics for verbose resolution
+# used by Resolve (debug only)
+########################################
+
+# 0: number, 1: symbol, 2: unused
+compiler.misc.applicable.method.found=\u627E\u5230\u7B2C {0} \u4E2A\u9002\u7528\u65B9\u6CD5: {1}
+
+# 0: number, 1: symbol, 2: message segment
+compiler.misc.applicable.method.found.1=\u627E\u5230\u7B2C {0} \u4E2A\u9002\u7528\u65B9\u6CD5: {1}\n({2})
+
+# 0: number, 1: symbol, 2: message segment
+compiler.misc.not.applicable.method.found=\u627E\u5230\u7B2C {0} \u4E2A\u4E0D\u9002\u7528\u7684\u65B9\u6CD5: {1}\n({2})
+
+# 0: type
+compiler.misc.partial.inst.sig=\u90E8\u5206\u5B9E\u4F8B\u5316\u4E3A: {0}
+
+# 0: name, 1: symbol, 2: number, 3: MethodResolutionPhase, 4: list of type or message segment, 5: list of type or message segment
+compiler.note.verbose.resolve.multi=\u5C06\u7C7B\u578B {1} \u7684\u65B9\u6CD5 {0} \u89E3\u6790\u4E3A\u5019\u9009\u9879 {2}\n\u9636\u6BB5: {3}\n\u5177\u6709\u5B9E\u9645\u503C: {4}\n\u5177\u6709\u7C7B\u578B\u53C2\u6570: {5}\n\u5019\u9009\u9879:
+
+# 0: name, 1: symbol, 2: unused, 3: MethodResolutionPhase, 4: list of type or message segment, 5: list of type or message segment
+compiler.note.verbose.resolve.multi.1=\u7C7B\u578B {1} \u7684\u65B9\u6CD5 {0} \u89E3\u6790\u9519\u8BEF\n\u9636\u6BB5: {3}\n\u5177\u6709\u5B9E\u9645\u503C: {4}\n\u5177\u6709\u7C7B\u578B\u53C2\u6570: {5}\n\u5019\u9009\u9879:
+
+# 0: symbol, 1: type, 2: type
+compiler.note.deferred.method.inst=\u65B9\u6CD5 {0} \u7684\u5EF6\u8FDF\u5B9E\u4F8B\u5316\n\u5B9E\u4F8B\u5316\u7B7E\u540D: {1}\n\u76EE\u6807\u7C7B\u578B: {2}
+
 ########################################
 # Diagnostics for where clause implementation
 # used by the RichDiagnosticFormatter.
@@ -1407,8 +1646,14 @@
 
 # compact where clause for type variable: contains the kindname ({2}) and location ({3})
 # in which the typevar has been declared
+# 0: type, 1: list of type, 2: symbol kind, 3: symbol
 compiler.misc.where.typevar.1={0}\u5DF2\u5728{2} {3}\u4E2D\u58F0\u660E
 
+# where clause for fresh type variable: contains upper bound(s) ('extends {1}').
+# Since a fresh type-variable is synthetic - there's no location/kindname here.
+# 0: type, 1: list of type
+compiler.misc.where.fresh.typevar={0}\u6269\u5C55{1}
+
 # where clause for type variable: contains all the upper bound(s) ('extends {1}')
 # of this intersection type
 # 0: type, 1: list of type
@@ -1431,4 +1676,39 @@
 
 compiler.misc.where.description.intersection.1=\u5176\u4E2D, {0}\u662F\u4EA4\u53C9\u7C7B\u578B:
 
-
+###
+# errors related to doc comments
+
+compiler.err.dc.bad.entity=HTML \u5B9E\u4F53\u9519\u8BEF
+
+compiler.err.dc.bad.gt=''>'' \u7684\u7528\u6CD5\u9519\u8BEF
+
+compiler.err.dc.bad.inline.tag=\u5185\u5D4C\u6807\u8BB0\u7684\u7528\u6CD5\u4E0D\u6B63\u786E
+
+compiler.err.dc.identifier.expected=\u9700\u8981\u6807\u8BC6\u7B26
+
+compiler.err.dc.malformed.html=\u683C\u5F0F\u9519\u8BEF\u7684 HTML
+
+compiler.err.dc.missing.semicolon=\u7F3A\u5C11\u5206\u53F7
+
+compiler.err.dc.no.content=\u65E0\u5185\u5BB9
+
+compiler.err.dc.no.tag.name='@' \u540E\u6CA1\u6709\u6807\u8BB0\u540D
+
+compiler.err.dc.gt.expected=\u9700\u8981 ''>''
+
+compiler.err.dc.ref.bad.parens=\u5F15\u7528\u4E2D\u7F3A\u5C11 '')''
+
+compiler.err.dc.ref.syntax.error=\u5F15\u7528\u4E2D\u51FA\u73B0\u8BED\u6CD5\u9519\u8BEF
+
+compiler.err.dc.ref.unexpected.input=\u610F\u5916\u7684\u6587\u672C
+
+compiler.err.dc.unexpected.content=\u610F\u5916\u7684\u5185\u5BB9
+
+compiler.err.dc.unterminated.inline.tag=\u672A\u7EC8\u6B62\u7684\u5185\u5D4C\u6807\u8BB0
+
+compiler.err.dc.unterminated.signature=\u672A\u7EC8\u6B62\u7684\u7B7E\u540D
+
+compiler.err.dc.unterminated.string=\u672A\u7EC8\u6B62\u7684\u5B57\u7B26\u4E32
+
+
--- a/src/share/classes/com/sun/tools/javac/resources/javac.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/javac.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -55,6 +55,8 @@
     Specify where to find annotation processors
 javac.opt.processor=\
     Names of the annotation processors to run; bypasses default discovery process
+javac.opt.parameters=\
+    Generate metadata for reflection on method parameters
 javac.opt.proc.none.only=\
     Control whether annotation processing and/or compilation is done.
 javac.opt.d=\
@@ -67,6 +69,8 @@
     Pass <flag> directly to the runtime system
 javac.opt.encoding=\
     Specify character encoding used by source files
+javac.opt.profile=\
+    Check that API used is available in the specified profile
 javac.opt.target=\
     Generate class files for specific VM version
 javac.opt.source=\
@@ -95,6 +99,8 @@
     <directory>
 javac.opt.arg.encoding=\
     <encoding>
+javac.opt.arg.profile=\
+    <profile>
 javac.opt.arg.release=\
     <release>
 javac.opt.arg.number=\
@@ -173,6 +179,8 @@
      key in annotation processor option ''{0}'' is not a dot-separated sequence of identifiers
 javac.err.invalid.flag=\
     invalid flag: {0}
+javac.err.invalid.profile=\
+    invalid profile: {0}
 javac.err.invalid.target=\
     invalid target release: {0}
 javac.err.no.source.files=\
@@ -189,6 +197,8 @@
     source release {0} requires target release {1}
 javac.warn.target.default.source.conflict=\
     target release {0} conflicts with default source release {1}
+javac.warn.profile.target.conflict=\
+    profile {0} is not valid for target release {1}
 javac.err.dir.not.found=\
     directory not found: {0}
 javac.err.file.not.found=\
--- a/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -30,7 +30,7 @@
 javac.opt.g.lines.vars.source=\u3044\u304F\u3064\u304B\u306E\u30C7\u30D0\u30C3\u30B0\u60C5\u5831\u306E\u307F\u3092\u751F\u6210\u3059\u308B
 javac.opt.nowarn=\u8B66\u544A\u3092\u767A\u751F\u3055\u305B\u306A\u3044
 javac.opt.verbose=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u52D5\u4F5C\u306B\u3064\u3044\u3066\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u51FA\u529B\u3059\u308B
-javac.opt.deprecation=\u63A8\u5968\u3055\u308C\u306A\u3044API\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u308B\u30BD\u30FC\u30B9\u306E\u4F4D\u7F6E\u3092\u51FA\u529B\u3059\u308B
+javac.opt.deprecation=\u975E\u63A8\u5968\u306EAPI\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u308B\u30BD\u30FC\u30B9\u306E\u4F4D\u7F6E\u3092\u51FA\u529B\u3059\u308B
 javac.opt.classpath=\u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304A\u3088\u3073\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
 javac.opt.sourcepath=\u5165\u529B\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
 javac.opt.bootclasspath=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
@@ -40,9 +40,11 @@
 javac.opt.extdirs=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u6E08\u307F\u62E1\u5F35\u6A5F\u80FD\u306E\u4F4D\u7F6E\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
 javac.opt.processorpath=\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
 javac.opt.processor=\u5B9F\u884C\u3059\u308B\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u306E\u540D\u524D\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u691C\u51FA\u51E6\u7406\u3092\u30D0\u30A4\u30D1\u30B9
+javac.opt.parameters=\u30E1\u30BD\u30C3\u30C9\u30FB\u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u30EA\u30D5\u30EC\u30AF\u30B7\u30E7\u30F3\u7528\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u751F\u6210\u3057\u307E\u3059
 javac.opt.proc.none.only=\u6CE8\u91C8\u51E6\u7406\u3084\u30B3\u30F3\u30D1\u30A4\u30EB\u3092\u5B9F\u884C\u3059\u308B\u304B\u3069\u3046\u304B\u3092\u5236\u5FA1\u3057\u307E\u3059\u3002
 javac.opt.d=\u751F\u6210\u3055\u308C\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u683C\u7D0D\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
 javac.opt.sourceDest=\u751F\u6210\u3055\u308C\u305F\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u683C\u7D0D\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
+javac.opt.headerDest=\u751F\u6210\u3055\u308C\u305F\u30CD\u30A4\u30C6\u30A3\u30D6\u30FB\u30D8\u30C3\u30C0\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u683C\u7D0D\u3059\u308B\u5834\u6240\u3092\u6307\u5B9A\u3059\u308B
 javac.opt.J=<flag>\u3092\u5B9F\u884C\u30B7\u30B9\u30C6\u30E0\u306B\u76F4\u63A5\u6E21\u3059
 javac.opt.encoding=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u4F7F\u7528\u3059\u308B\u6587\u5B57\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3059\u308B
 javac.opt.target=\u7279\u5B9A\u306EVM\u30D0\u30FC\u30B8\u30E7\u30F3\u7528\u306E\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3059\u308B
@@ -61,6 +63,8 @@
 javac.opt.arg.encoding=<encoding>
 javac.opt.arg.release=<release>
 javac.opt.arg.number=<number>
+javac.opt.plugin=\u5B9F\u884C\u3055\u308C\u308B\u30D7\u30E9\u30B0\u30A4\u30F3\u306E\u540D\u524D\u3068\u30AA\u30D7\u30B7\u30E7\u30F3\u5F15\u6570
+javac.opt.arg.plugin="name args"
 
 ## extended options
 
@@ -80,6 +84,9 @@
 javac.opt.arg.file=<filename>
 javac.opt.Xlint=\u63A8\u5968\u306E\u8B66\u544A\u3092\u6709\u52B9\u306B\u3059\u308B
 javac.opt.Xlint.suboptlist=\u7279\u5B9A\u306E\u8B66\u544A\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3059\u308B
+javac.opt.Xdoclint=javadoc\u30B3\u30E1\u30F3\u30C8\u306E\u554F\u984C\u306B\u95A2\u3059\u308B\u63A8\u5968\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u306B\u3059\u308B
+javac.opt.Xdoclint.subopts = (all|[-]<group>)[/<access>]
+javac.opt.Xdoclint.custom=\n        javadoc\u30B3\u30E1\u30F3\u30C8\u306E\u554F\u984C\u306B\u95A2\u3059\u308B\u7279\u5B9A\u306E\u30C1\u30A7\u30C3\u30AF\u3092\u6709\u52B9\u307E\u305F\u306F\u7121\u52B9\u306B\u3057\u307E\u3059\u3002\n        \u3053\u3053\u3067\u3001<group>\u306Faccessibility\u3001html\u3001reference\u307E\u305F\u306Fsyntax\u306E\u3044\u305A\u308C\u304B\u3067\u3001\n        <access>\u306Fpublic\u3001protected\u3001package\u307E\u305F\u306Fprivate\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002
 javac.opt.Xstdout=\u6A19\u6E96\u51FA\u529B\u3092\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3059\u308B
 javac.opt.X=\u975E\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3059\u308B
 javac.opt.help=\u6A19\u6E96\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u6982\u8981\u3092\u51FA\u529B\u3059\u308B
@@ -107,6 +114,7 @@
 javac.err.file.not.found=\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
 javac.err.file.not.directory=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3067\u306F\u3042\u308A\u307E\u305B\u3093: {0}
 javac.err.file.not.file=\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u3042\u308A\u307E\u305B\u3093: {0}
+javac.msg.plugin.not.found=\u30D7\u30E9\u30B0\u30A4\u30F3\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: {0}
 ## messages
 
 javac.msg.usage.header=\u4F7F\u7528\u65B9\u6CD5: {0} <options> <source files>\n\u4F7F\u7528\u53EF\u80FD\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002
@@ -117,11 +125,13 @@
 
 javac.msg.bug=\u30B3\u30F3\u30D1\u30A4\u30E9\u3067\u4F8B\u5916\u304C\u767A\u751F\u3057\u307E\u3057\u305F({0})\u3002Bug Parade\u306B\u540C\u3058\u30D0\u30B0\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u306A\u3044\u3053\u3068\u3092\u3054\u78BA\u8A8D\u306E\u4E0A\u3001Java Developer Connection(http://java.sun.com/webapps/bugreport)\u3067\u30D0\u30B0\u306E\u767B\u9332\u3092\u304A\u9858\u3044\u3044\u305F\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306B\u306F\u3001\u305D\u306E\u30D7\u30ED\u30B0\u30E9\u30E0\u3068\u4E0B\u8A18\u306E\u8A3A\u65AD\u5185\u5BB9\u3092\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002\u3054\u5354\u529B\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3059\u3002
 
-javac.msg.io=\n\n\u5165\u51FA\u529B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
+javac.msg.io=\n\n\u5165\u51FA\u529B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
+
+javac.msg.proc.annotation.uncaught.exception=\n\n\u6CE8\u91C8\u51E6\u7406\u3067\u6355\u6349\u3055\u308C\u306A\u3044\u4F8B\u5916\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F\u3002\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
 
-javac.msg.proc.annotation.uncaught.exception=\n\n\u6CE8\u91C8\u51E6\u7406\u3067\u6355\u6349\u3055\u308C\u306A\u3044\u4F8B\u5916\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F\u3002\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
+javac.msg.plugin.uncaught.exception=\n\n\u30D7\u30E9\u30B0\u30A4\u30F3\u3067\u6355\u6349\u3055\u308C\u306A\u3044\u4F8B\u5916\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3057\u305F\u3002\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
 
-javac.msg.resource=\n\n\u30B7\u30B9\u30C6\u30E0\u30FB\u30EA\u30BD\u30FC\u30B9\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u307E\u3059\u3002\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
+javac.msg.resource=\n\n\u30B7\u30B9\u30C6\u30E0\u30FB\u30EA\u30BD\u30FC\u30B9\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u307E\u3059\u3002\n\u8A73\u7D30\u306F\u6B21\u306E\u30B9\u30BF\u30C3\u30AF\u30FB\u30C8\u30EC\u30FC\u30B9\u3067\u8ABF\u67FB\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n
 
 javac.version={0} {1}
 javac.fullVersion={0}\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"{1}"
--- a/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -40,9 +40,11 @@
 javac.opt.extdirs=\u8986\u76D6\u6240\u5B89\u88C5\u6269\u5C55\u7684\u4F4D\u7F6E
 javac.opt.processorpath=\u6307\u5B9A\u67E5\u627E\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u7684\u4F4D\u7F6E
 javac.opt.processor=\u8981\u8FD0\u884C\u7684\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u7684\u540D\u79F0; \u7ED5\u8FC7\u9ED8\u8BA4\u7684\u641C\u7D22\u8FDB\u7A0B
+javac.opt.parameters=\u751F\u6210\u5143\u6570\u636E\u4EE5\u7528\u4E8E\u65B9\u6CD5\u53C2\u6570\u7684\u53CD\u5C04
 javac.opt.proc.none.only=\u63A7\u5236\u662F\u5426\u6267\u884C\u6CE8\u91CA\u5904\u7406\u548C/\u6216\u7F16\u8BD1\u3002
 javac.opt.d=\u6307\u5B9A\u653E\u7F6E\u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E
 javac.opt.sourceDest=\u6307\u5B9A\u653E\u7F6E\u751F\u6210\u7684\u6E90\u6587\u4EF6\u7684\u4F4D\u7F6E
+javac.opt.headerDest=\u6307\u5B9A\u653E\u7F6E\u751F\u6210\u7684\u672C\u673A\u6807\u5934\u6587\u4EF6\u7684\u4F4D\u7F6E
 javac.opt.J=\u76F4\u63A5\u5C06 <\u6807\u8BB0> \u4F20\u9012\u7ED9\u8FD0\u884C\u65F6\u7CFB\u7EDF
 javac.opt.encoding=\u6307\u5B9A\u6E90\u6587\u4EF6\u4F7F\u7528\u7684\u5B57\u7B26\u7F16\u7801
 javac.opt.target=\u751F\u6210\u7279\u5B9A VM \u7248\u672C\u7684\u7C7B\u6587\u4EF6
@@ -61,6 +63,8 @@
 javac.opt.arg.encoding=<\u7F16\u7801>
 javac.opt.arg.release=<\u53D1\u884C\u7248>
 javac.opt.arg.number=<\u7F16\u53F7>
+javac.opt.plugin=\u8981\u8FD0\u884C\u7684\u63D2\u4EF6\u7684\u540D\u79F0\u548C\u53EF\u9009\u53C2\u6570
+javac.opt.arg.plugin="\u540D\u79F0\u53C2\u6570"
 
 ## extended options
 
@@ -80,6 +84,9 @@
 javac.opt.arg.file=<\u6587\u4EF6\u540D>
 javac.opt.Xlint=\u542F\u7528\u5EFA\u8BAE\u7684\u8B66\u544A
 javac.opt.Xlint.suboptlist=\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u7684\u8B66\u544A
+javac.opt.Xdoclint=\u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u5EFA\u8BAE\u7684\u68C0\u67E5
+javac.opt.Xdoclint.subopts = (all|[-]<group>)[/<access>]
+javac.opt.Xdoclint.custom=\n        \u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5,\n        \u5176\u4E2D <group> \u4E3A\u53EF\u8BBF\u95EE\u6027, html, \u5F15\u7528\u6216\u8BED\u6CD5\u4E4B\u4E00,\n        <access> \u4E3A public, protected, package \u6216 private \u4E4B\u4E00\u3002
 javac.opt.Xstdout=\u91CD\u5B9A\u5411\u6807\u51C6\u8F93\u51FA
 javac.opt.X=\u8F93\u51FA\u975E\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981
 javac.opt.help=\u8F93\u51FA\u6807\u51C6\u9009\u9879\u7684\u63D0\u8981
@@ -107,6 +114,7 @@
 javac.err.file.not.found=\u627E\u4E0D\u5230\u6587\u4EF6: {0}
 javac.err.file.not.directory=\u4E0D\u662F\u76EE\u5F55: {0}
 javac.err.file.not.file=\u4E0D\u662F\u6587\u4EF6: {0}
+javac.msg.plugin.not.found=\u627E\u4E0D\u5230\u63D2\u4EF6: {0}
 ## messages
 
 javac.msg.usage.header=\u7528\u6CD5: {0} <options> <source files>\n\u5176\u4E2D, \u53EF\u80FD\u7684\u9009\u9879\u5305\u62EC:
@@ -121,6 +129,8 @@
 
 javac.msg.proc.annotation.uncaught.exception=\n\n\u6CE8\u91CA\u5904\u7406\u7A0B\u5E8F\u629B\u51FA\u672A\u6355\u83B7\u7684\u5F02\u5E38\u9519\u8BEF\u3002\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605\u4EE5\u4E0B\u5806\u6808\u8DDF\u8E2A\u3002\n
 
+javac.msg.plugin.uncaught.exception=\n\n\u63D2\u4EF6\u629B\u51FA\u672A\u6355\u83B7\u7684\u5F02\u5E38\u9519\u8BEF\u3002\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605\u4EE5\u4E0B\u5806\u6808\u8DDF\u8E2A\u3002\n
+
 javac.msg.resource=\n\n\u7CFB\u7EDF\u8D44\u6E90\u4E0D\u8DB3\u3002\n\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F, \u8BF7\u53C2\u9605\u4EE5\u4E0B\u5806\u6808\u8DDF\u8E2A\u3002\n
 
 javac.version={0} {1}
--- a/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Tue Jul 02 10:13:00 2013 +0100
@@ -34,11 +34,11 @@
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Types;
-import com.sun.tools.javac.jvm.ClassReader;
 import com.sun.tools.javac.jvm.ClassWriter;
 import com.sun.tools.javac.jvm.Pool;
 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
 import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Pair;
 
 import java.io.File;
@@ -47,6 +47,7 @@
 import java.util.EnumSet;
 import java.util.Enumeration;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.Set;
 
@@ -85,7 +86,10 @@
  *
  * @author Peter von der Ah\u00e9
  */
-@SupportedOptions({"com.sun.tools.javac.sym.Jar","com.sun.tools.javac.sym.Dest"})
+@SupportedOptions({
+    "com.sun.tools.javac.sym.Jar",
+    "com.sun.tools.javac.sym.Dest",
+    "com.sun.tools.javac.sym.Profiles"})
 @SupportedAnnotationTypes("*")
 public class CreateSymbols extends AbstractProcessor {
 
@@ -106,6 +110,7 @@
             processingEnv.getMessager()
                 .printMessage(Diagnostic.Kind.ERROR, e.getLocalizedMessage());
         } catch (Throwable t) {
+            t.printStackTrace();
             Throwable cause = t.getCause();
             if (cause == null)
                 cause = t;
@@ -121,12 +126,17 @@
         Set<String> documented = new HashSet<String>();
         Set<PackageSymbol> packages =
             ((JavacProcessingEnvironment)processingEnv).getSpecifiedPackages();
-        String jarName = processingEnv.getOptions().get("com.sun.tools.javac.sym.Jar");
+        Map<String,String> pOptions = processingEnv.getOptions();
+        String jarName = pOptions.get("com.sun.tools.javac.sym.Jar");
         if (jarName == null)
             throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Jar=LOCATION_OF_JAR");
-        String destName = processingEnv.getOptions().get("com.sun.tools.javac.sym.Dest");
+        String destName = pOptions.get("com.sun.tools.javac.sym.Dest");
         if (destName == null)
             throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Dest=LOCATION_OF_JAR");
+        String profileSpec=pOptions.get("com.sun.tools.javac.sym.Profiles");
+        if (profileSpec == null)
+            throw new RuntimeException("Must use -Acom.sun.tools.javac.sym.Profiles=PROFILES_SPEC");
+        Profiles profiles = Profiles.read(new File(profileSpec));
 
         for (PackageSymbol psym : packages) {
             String name = psym.getQualifiedName().toString();
@@ -166,12 +176,19 @@
             tool.getTask(null, fm, null, options, null, null);
         com.sun.tools.javac.main.JavaCompiler compiler =
             com.sun.tools.javac.main.JavaCompiler.instance(task.getContext());
-        ClassReader reader = ClassReader.instance(task.getContext());
         ClassWriter writer = ClassWriter.instance(task.getContext());
         Symtab syms = Symtab.instance(task.getContext());
-        Attribute.Compound proprietary =
+        Names names = Names.instance(task.getContext());
+        Attribute.Compound proprietaryAnno =
             new Attribute.Compound(syms.proprietaryType,
                                    List.<Pair<Symbol.MethodSymbol,Attribute>>nil());
+        Attribute.Compound[] profileAnnos = new Attribute.Compound[profiles.getProfileCount() + 1];
+        Symbol.MethodSymbol profileValue = (MethodSymbol) syms.profileType.tsym.members().lookup(names.value).sym;
+        for (int i = 1; i < profileAnnos.length; i++) {
+            profileAnnos[i] = new Attribute.Compound(syms.profileType,
+                    List.<Pair<Symbol.MethodSymbol, Attribute>>of(
+                    new Pair<Symbol.MethodSymbol, Attribute>(profileValue, new Attribute.Constant(syms.intType, i))));
+        }
 
         Type.moreInfo = true;
         Types types = Types.instance(task.getContext());
@@ -208,8 +225,11 @@
             }
             ClassSymbol cs = (ClassSymbol) sym;
             if (addLegacyAnnotation) {
-                cs.annotations.prepend(List.of(proprietary));
+                cs.annotations.prepend(List.of(proprietaryAnno));
             }
+            int p = profiles.getProfile(cs.fullname.toString().replace(".", "/"));
+            if (0 < p && p < profileAnnos.length)
+                cs.annotations.prepend(List.of(profileAnnos[p]));
             writeClass(pool, cs, writer);
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2006, 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.sym;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import com.sun.tools.javac.util.Assert;
+
+/**
+ * Provide details about profile contents.
+ *
+ * <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 Profiles {
+    // for debugging
+    public static void main(String[] args) throws IOException {
+        Profiles p = Profiles.read(new File(args[0]));
+        if (args.length >= 2) {
+            Map<Integer,Set<String>> lists = new TreeMap<Integer,Set<String>>();
+            for (int i = 1; i <= 4; i++)
+                lists.put(i, new TreeSet<String>());
+
+            File rt_jar_lst = new File(args[1]);
+            for (String line: Files.readAllLines(rt_jar_lst.toPath(), Charset.defaultCharset())) {
+                if (line.endsWith(".class")) {
+                    String type = line.substring(0, line.length() - 6);
+                    int profile = p.getProfile(type);
+                    for (int i = profile; i <= 4; i++)
+                        lists.get(i).add(type);
+                }
+            }
+
+            for (int i = 1; i <= 4; i++) {
+                BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"));
+                try {
+                    for (String type: lists.get(i)) {
+                        out.write(type);
+                        out.newLine();
+                    }
+                } finally {
+                    out.close();
+                }
+            }
+        }
+    }
+
+    public static Profiles read(File file) throws IOException {
+        BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
+        try {
+            Properties p = new Properties();
+            p.load(in);
+            if (p.containsKey("java/lang/Object"))
+                return new SimpleProfiles(p);
+            else
+                return new MakefileProfiles(p);
+        } finally {
+            in.close();
+        }
+    }
+
+    public abstract int getProfileCount();
+
+    public abstract int getProfile(String typeName);
+
+    public abstract Set<String> getPackages(int profile);
+
+    private static class MakefileProfiles extends Profiles {
+        static class Package {
+            final Package parent;
+            final String name;
+
+            Map<String, Package> subpackages = new TreeMap<String, Package>();
+
+            int profile;
+            Map<String, Integer> includedTypes = new TreeMap<String,Integer>();
+            Map<String, Integer> excludedTypes = new TreeMap<String,Integer>();
+
+            Package(Package parent, String name) {
+                this.parent = parent;
+                this.name = name;
+            }
+
+            int getProfile() {
+                return (parent == null) ? profile : Math.max(parent.getProfile(), profile);
+            }
+
+            int getProfile(String simpleTypeName) {
+                Integer i;
+                if ((i = includedTypes.get(simpleTypeName)) != null)
+                    return i;
+                if ((i = includedTypes.get("*")) != null)
+                    return i;
+                if ((i = excludedTypes.get(simpleTypeName)) != null)
+                    return i + 1;
+                if ((i = excludedTypes.get("*")) != null)
+                    return i + 1;
+                return getProfile();
+            }
+
+            String getName() {
+                return (parent == null) ? name : (parent.getName() + "/" + name);
+            }
+
+            void getPackages(int profile, Set<String> results) {
+                int prf = getProfile();
+                if (prf != 0 && profile >= prf)
+                    results.add(getName());
+                for (Package pkg: subpackages.values())
+                    pkg.getPackages(profile, results);
+            }
+        }
+
+        final static Map<String, Package> packages = new TreeMap<String, Package>();
+
+        final int maxProfile = 4;  // Three compact profiles plus full JRE
+
+        MakefileProfiles(Properties p) {
+            for (int profile = 1; profile <= maxProfile; profile++) {
+                String prefix = (profile < maxProfile ? "PROFILE_" + profile : "FULL_JRE");
+                String inclPackages = p.getProperty(prefix + "_RTJAR_INCLUDE_PACKAGES");
+                if (inclPackages == null)
+                    break;
+                for (String pkg: inclPackages.substring(1).trim().split("\\s+")) {
+                    if (pkg.endsWith("/"))
+                        pkg = pkg.substring(0, pkg.length() - 1);
+                    includePackage(profile, pkg);
+                }
+                String inclTypes =  p.getProperty(prefix + "_RTJAR_INCLUDE_TYPES");
+                if (inclTypes != null) {
+                    for (String type: inclTypes.replace("$$", "$").split("\\s+")) {
+                        if (type.endsWith(".class"))
+                            includeType(profile, type.substring(0, type.length() - 6));
+                    }
+                }
+                String exclTypes =  p.getProperty(prefix + "_RTJAR_EXCLUDE_TYPES");
+                if (exclTypes != null) {
+                    for (String type: exclTypes.replace("$$", "$").split("\\s+")) {
+                        if (type.endsWith(".class"))
+                            excludeType(profile, type.substring(0, type.length() - 6));
+                    }
+                }
+            }
+        }
+
+        @Override
+        public int getProfileCount() {
+            return maxProfile;
+        }
+
+        @Override
+        public int getProfile(String typeName) {
+            int sep = typeName.lastIndexOf("/");
+            String packageName = typeName.substring(0, sep);
+            String simpleName = typeName.substring(sep + 1);
+
+            Package p = getPackage(packageName);
+            return p.getProfile(simpleName);
+        }
+
+        @Override
+        public Set<String> getPackages(int profile) {
+            Set<String> results = new TreeSet<String>();
+            for (Package p: packages.values())
+                p.getPackages(profile, results);
+            return results;
+        }
+
+        private void includePackage(int profile, String packageName) {
+//            System.err.println("include package " + packageName);
+            Package p = getPackage(packageName);
+            Assert.check(p.profile == 0);
+            p.profile = profile;
+        }
+
+        private void includeType(int profile, String typeName) {
+//            System.err.println("include type " + typeName);
+            int sep = typeName.lastIndexOf("/");
+            String packageName = typeName.substring(0, sep);
+            String simpleName = typeName.substring(sep + 1);
+
+            Package p = getPackage(packageName);
+            Assert.check(!p.includedTypes.containsKey(simpleName));
+            p.includedTypes.put(simpleName, profile);
+        }
+
+        private void excludeType(int profile, String typeName) {
+//            System.err.println("exclude type " + typeName);
+            int sep = typeName.lastIndexOf("/");
+            String packageName = typeName.substring(0, sep);
+            String simpleName = typeName.substring(sep + 1);
+
+            Package p = getPackage(packageName);
+            Assert.check(!p.excludedTypes.containsKey(simpleName));
+            p.excludedTypes.put(simpleName, profile);
+        }
+
+        private Package getPackage(String packageName) {
+            int sep = packageName.lastIndexOf("/");
+            Package parent;
+            Map<String, Package> parentSubpackages;
+            String simpleName;
+            if (sep == -1) {
+                parent = null;
+                parentSubpackages = packages;
+                simpleName = packageName;
+            } else {
+                parent = getPackage(packageName.substring(0, sep));
+                parentSubpackages = parent.subpackages;
+                simpleName = packageName.substring(sep + 1);
+            }
+
+            Package p = parentSubpackages.get(simpleName);
+            if (p == null) {
+                parentSubpackages.put(simpleName, p = new Package(parent, simpleName));
+            }
+            return p;
+        }
+    }
+
+    private static class SimpleProfiles extends Profiles {
+        private final Map<String, Integer> map;
+        private final int profileCount;
+
+        SimpleProfiles(Properties p) {
+            int max = 0;
+            map = new HashMap<String, Integer>();
+            for (Map.Entry<Object,Object> e: p.entrySet()) {
+                String typeName = (String) e.getKey();
+                int profile = Integer.valueOf((String) e.getValue());
+                map.put(typeName, profile);
+                max = Math.max(max, profile);
+            }
+            profileCount = max;
+        }
+
+        @Override
+        public int getProfileCount() {
+            return profileCount;
+        }
+
+        @Override
+        public int getProfile(String typeName) {
+            return map.get(typeName);
+        }
+
+        @Override
+        public Set<String> getPackages(int profile) {
+            Set<String> results = new TreeSet<String>();
+            for (Map.Entry<String,Integer> e: map.entrySet()) {
+                String tn = e.getKey();
+                int prf = e.getValue();
+                int sep = tn.lastIndexOf("/");
+                if (sep > 0 && profile >= prf)
+                    results.add(tn);
+            }
+            return results;
+        }
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/tree/DCTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/DCTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -119,7 +119,7 @@
 
     }
 
-    public static abstract class DCBlockTag extends DCTree implements InlineTagTree {
+    public static abstract class DCBlockTag extends DCTree implements BlockTagTree {
         public String getTagName() {
             return getKind().tagName;
         }
@@ -169,7 +169,7 @@
         }
     }
 
-    public static class DCAuthor extends DCInlineTag implements AuthorTree {
+    public static class DCAuthor extends DCBlockTag implements AuthorTree {
         public final List<DCTree> name;
 
         DCAuthor(List<DCTree> name) {
@@ -640,7 +640,7 @@
         }
     }
 
-    public static class DCSince extends DCInlineTag implements SinceTree {
+    public static class DCSince extends DCBlockTag implements SinceTree {
         public final List<DCTree> body;
 
         DCSince(List<DCTree> body) {
--- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -250,11 +250,11 @@
          */
         TYPEAPPLY,
 
-        /** Union types, of type TypeUnion
+        /** Union types, of type TypeUnion.
          */
         TYPEUNION,
 
-        /** Intersection types, of type TypeIntersection
+        /** Intersection types, of type TypeIntersection.
          */
         TYPEINTERSECTION,
 
@@ -274,10 +274,16 @@
          */
         ANNOTATION,
 
+        /** metadata: Type annotation.
+         */
+        TYPE_ANNOTATION,
+
         /** metadata: Modifiers
          */
         MODIFIERS,
 
+        /** An annotated type tree.
+         */
         ANNOTATED_TYPE,
 
         /** Error trees, of type Erroneous.
@@ -607,6 +613,42 @@
     }
 
     /**
+     * Common supertype for all poly expression trees (lambda, method references,
+     * conditionals, method and constructor calls)
+     */
+    public static abstract class JCPolyExpression extends JCExpression {
+
+        /**
+         * A poly expression can only be truly 'poly' in certain contexts
+         */
+        public enum PolyKind {
+            /** poly expression to be treated as a standalone expression */
+            STANDALONE,
+            /** true poly expression */
+            POLY;
+        }
+
+        /** is this poly expression a 'true' poly expression? */
+        public PolyKind polyKind;
+    }
+
+    /**
+     * Common supertype for all functional expression trees (lambda and method references)
+     */
+    public static abstract class JCFunctionalExpression extends JCPolyExpression {
+
+        public JCFunctionalExpression() {
+            //a functional expression is always a 'true' poly
+            polyKind = PolyKind.POLY;
+        }
+
+        /** target descriptor inferred for this functional expression. */
+        public Type descriptorType;
+        /** list of target types inferred for this functional expression. */
+        public List<TypeSymbol> targets;
+    }
+
+    /**
      * A class definition.
      */
     public static class JCClassDecl extends JCStatement implements ClassTree {
@@ -689,6 +731,8 @@
         public JCExpression restype;
         /** type parameters */
         public List<JCTypeParameter> typarams;
+        /** receiver parameter */
+        public JCVariableDecl recvparam;
         /** value parameters */
         public List<JCVariableDecl> params;
         /** exceptions thrown by this method */
@@ -703,6 +747,7 @@
                             Name name,
                             JCExpression restype,
                             List<JCTypeParameter> typarams,
+                            JCVariableDecl recvparam,
                             List<JCVariableDecl> params,
                             List<JCExpression> thrown,
                             JCBlock body,
@@ -714,6 +759,9 @@
             this.restype = restype;
             this.typarams = typarams;
             this.params = params;
+            this.recvparam = recvparam;
+            // TODO: do something special if the given type is null?
+            // receiver != null ? receiver : List.<JCTypeAnnotation>nil());
             this.thrown = thrown;
             this.body = body;
             this.defaultValue = defaultValue;
@@ -732,6 +780,7 @@
         public List<JCVariableDecl> getParameters() {
             return params;
         }
+        public JCVariableDecl getReceiverParameter() { return recvparam; }
         public List<JCExpression> getThrows() {
             return thrown;
         }
@@ -1147,7 +1196,7 @@
     /**
      * A ( ) ? ( ) : ( ) conditional expression
      */
-    public static class JCConditional extends JCExpression implements ConditionalExpressionTree {
+    public static class JCConditional extends JCPolyExpression implements ConditionalExpressionTree {
         public JCExpression cond;
         public JCExpression truepart;
         public JCExpression falsepart;
@@ -1373,7 +1422,7 @@
     /**
      * A method invocation
      */
-    public static class JCMethodInvocation extends JCExpression implements MethodInvocationTree {
+    public static class JCMethodInvocation extends JCPolyExpression implements MethodInvocationTree {
         public List<JCExpression> typeargs;
         public JCExpression meth;
         public List<JCExpression> args;
@@ -1416,7 +1465,7 @@
     /**
      * A new(...) operation.
      */
-    public static class JCNewClass extends JCExpression implements NewClassTree {
+    public static class JCNewClass extends JCPolyExpression implements NewClassTree {
         public JCExpression encl;
         public List<JCExpression> typeargs;
         public JCExpression clazz;
@@ -1469,6 +1518,10 @@
     public static class JCNewArray extends JCExpression implements NewArrayTree {
         public JCExpression elemtype;
         public List<JCExpression> dims;
+        // type annotations on inner-most component
+        public List<JCAnnotation> annotations;
+        // type annotations on dimensions
+        public List<List<JCAnnotation>> dimAnnotations;
         public List<JCExpression> elems;
         protected JCNewArray(JCExpression elemtype,
                            List<JCExpression> dims,
@@ -1476,6 +1529,8 @@
         {
             this.elemtype = elemtype;
             this.dims = dims;
+            this.annotations = List.nil();
+            this.dimAnnotations = List.nil();
             this.elems = elems;
         }
         @Override
@@ -1502,18 +1557,29 @@
     /**
      * A lambda expression.
      */
-    public static class JCLambda extends JCExpression implements LambdaExpressionTree {
+    public static class JCLambda extends JCFunctionalExpression implements LambdaExpressionTree {
+
+        public enum ParameterKind {
+            IMPLICIT,
+            EXPLICIT;
+        }
 
         public List<JCVariableDecl> params;
         public JCTree body;
-        public Type targetType;
         public boolean canCompleteNormally = true;
         public List<Type> inferredThrownTypes;
+        public ParameterKind paramKind;
 
         public JCLambda(List<JCVariableDecl> params,
                         JCTree body) {
             this.params = params;
             this.body = body;
+            if (params.isEmpty() ||
+                params.head.vartype != null) {
+                paramKind = ParameterKind.EXPLICIT;
+            } else {
+                paramKind = ParameterKind.IMPLICIT;
+            }
         }
         @Override
         public Tag getTag() {
@@ -1812,15 +1878,16 @@
     /**
      * Selects a member expression.
      */
-    public static class JCMemberReference extends JCExpression implements MemberReferenceTree {
+    public static class JCMemberReference extends JCFunctionalExpression implements MemberReferenceTree {
         public ReferenceMode mode;
         public ReferenceKind kind;
         public Name name;
         public JCExpression expr;
         public List<JCExpression> typeargs;
-        public Type targetType;
         public Symbol sym;
         public Type varargsElement;
+        public PolyKind refPolyKind;
+        public boolean ownerAccessible;
 
         /**
          * Javac-dependent classification for member references, based
@@ -1838,7 +1905,9 @@
             /** Inner # new */
             IMPLICIT_INNER(ReferenceMode.NEW, false),
             /** Toplevel # new */
-            TOPLEVEL(ReferenceMode.NEW, false);
+            TOPLEVEL(ReferenceMode.NEW, false),
+            /** ArrayType # new */
+            ARRAY_CTOR(ReferenceMode.NEW, false);
 
             final ReferenceMode mode;
             final boolean unbound;
@@ -2103,9 +2172,12 @@
         public Name name;
         /** bounds */
         public List<JCExpression> bounds;
-        protected JCTypeParameter(Name name, List<JCExpression> bounds) {
+        /** type annotations on type parameter */
+        public List<JCAnnotation> annotations;
+        protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCAnnotation> annotations) {
             this.name = name;
             this.bounds = bounds;
+            this.annotations = annotations;
         }
         @Override
         public void accept(Visitor v) { v.visitTypeParameter(this); }
@@ -2115,6 +2187,9 @@
         public List<JCExpression> getBounds() {
             return bounds;
         }
+        public List<JCAnnotation> getAnnotations() {
+            return annotations;
+        }
         @Override
         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
             return v.visitTypeParameter(this, d);
@@ -2181,16 +2256,27 @@
     }
 
     public static class JCAnnotation extends JCExpression implements AnnotationTree {
+        // Either Tag.ANNOTATION or Tag.TYPE_ANNOTATION
+        private Tag tag;
+
         public JCTree annotationType;
         public List<JCExpression> args;
-        protected JCAnnotation(JCTree annotationType, List<JCExpression> args) {
+
+        // Attribute.Compound if tag is ANNOTATION
+        // Attribute.TypeCompound if tag is TYPE_ANNOTATION
+        public Attribute.Compound attribute;
+
+        protected JCAnnotation(Tag tag, JCTree annotationType, List<JCExpression> args) {
+            this.tag = tag;
             this.annotationType = annotationType;
             this.args = args;
         }
+
         @Override
         public void accept(Visitor v) { v.visitAnnotation(this); }
 
-        public Kind getKind() { return Kind.ANNOTATION; }
+        public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
+
         public JCTree getAnnotationType() { return annotationType; }
         public List<JCExpression> getArguments() {
             return args;
@@ -2201,7 +2287,7 @@
         }
         @Override
         public Tag getTag() {
-            return ANNOTATION;
+            return tag;
         }
     }
 
@@ -2232,6 +2318,35 @@
         }
     }
 
+    public static class JCAnnotatedType extends JCExpression implements com.sun.source.tree.AnnotatedTypeTree {
+        // type annotations
+        public List<JCAnnotation> annotations;
+        public JCExpression underlyingType;
+
+        protected JCAnnotatedType(List<JCAnnotation> annotations, JCExpression underlyingType) {
+            this.annotations = annotations;
+            this.underlyingType = underlyingType;
+        }
+        @Override
+        public void accept(Visitor v) { v.visitAnnotatedType(this); }
+
+        public Kind getKind() { return Kind.ANNOTATED_TYPE; }
+        public List<JCAnnotation> getAnnotations() {
+            return annotations;
+        }
+        public JCExpression getUnderlyingType() {
+            return underlyingType;
+        }
+        @Override
+        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
+            return v.visitAnnotatedType(this, d);
+        }
+        @Override
+        public Tag getTag() {
+            return ANNOTATED_TYPE;
+        }
+    }
+
     public static class JCErroneous extends JCExpression
             implements com.sun.source.tree.ErroneousTree {
         public List<? extends JCTree> errs;
@@ -2298,6 +2413,7 @@
                             Name name,
                             JCExpression restype,
                             List<JCTypeParameter> typarams,
+                            JCVariableDecl recvparam,
                             List<JCVariableDecl> params,
                             List<JCExpression> thrown,
                             JCBlock body,
@@ -2423,6 +2539,7 @@
         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
         public void visitModifiers(JCModifiers that)         { visitTree(that); }
+        public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
         public void visitErroneous(JCErroneous that)         { visitTree(that); }
         public void visitLetExpr(LetExpr that)               { visitTree(that); }
 
--- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -29,7 +29,6 @@
 
 import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
 import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.List;
@@ -154,12 +153,13 @@
         }
         //we need to (i) replace all line terminators with a space and (ii) remove
         //occurrences of 'missing' in the Pretty output (generated when types are missing)
-        String res = s.toString().replaceAll("\\s+", " ").replaceAll("/\\*missing\\*/", "");
+        String res = s.toString().trim().replaceAll("\\s+", " ").replaceAll("/\\*missing\\*/", "");
         if (res.length() < maxLength) {
             return res;
         } else {
-            int split = (maxLength - trimSequence.length()) * 2 / 3;
-            return res.substring(0, split) + trimSequence + res.substring(split);
+            int head = (maxLength - trimSequence.length()) * 2 / 3;
+            int tail = maxLength - trimSequence.length() - head;
+            return res.substring(0, head) + trimSequence + res.substring(res.length() - tail);
         }
     }
 
@@ -260,6 +260,15 @@
         }
     }
 
+    public void printTypeAnnotations(List<JCAnnotation> trees) throws IOException {
+        if (trees.nonEmpty())
+            print(" ");
+        for (List<JCAnnotation> l = trees; l.nonEmpty(); l = l.tail) {
+            printExpr(l.head);
+            print(" ");
+        }
+    }
+
     /** Print documentation comment, if it exists
      *  @param tree    The tree for which a documentation comment should be printed.
      */
@@ -490,6 +499,12 @@
                 print(" " + tree.name);
             }
             print("(");
+            if (tree.recvparam!=null) {
+                printExpr(tree.recvparam);
+                if (tree.params.size() > 0) {
+                    print(", ");
+                }
+            }
             printExprs(tree.params);
             print(")");
             if (tree.thrown.nonEmpty()) {
@@ -542,7 +557,15 @@
             } else {
                 printExpr(tree.mods);
                 if ((tree.mods.flags & VARARGS) != 0) {
-                    printExpr(((JCArrayTypeTree) tree.vartype).elemtype);
+                    JCTree vartype = tree.vartype;
+                    List<JCAnnotation> tas = null;
+                    if (vartype instanceof JCAnnotatedType) {
+                        tas = ((JCAnnotatedType)vartype).annotations;
+                        vartype = ((JCAnnotatedType)vartype).underlyingType;
+                    }
+                    printExpr(((JCArrayTypeTree) vartype).elemtype);
+                    if (tas != null)
+                        printTypeAnnotations(tas);
                     print("... " + tree.name);
                 } else {
                     printExpr(tree.vartype);
@@ -918,16 +941,29 @@
         try {
             if (tree.elemtype != null) {
                 print("new ");
+                printTypeAnnotations(tree.annotations);
                 JCTree elem = tree.elemtype;
-                if (elem.hasTag(TYPEARRAY))
-                    printBaseElementType((JCArrayTypeTree) elem);
-                else
-                    printExpr(elem);
+                printBaseElementType(elem);
+                boolean isElemAnnoType = elem instanceof JCAnnotatedType;
+                int i = 0;
+                List<List<JCAnnotation>> da = tree.dimAnnotations;
                 for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
+                    if (da.size() > i) {
+                        printTypeAnnotations(da.get(i));
+                    }
                     print("[");
+                    i++;
                     printExpr(l.head);
                     print("]");
                 }
+                if (tree.elems != null) {
+                    if (isElemAnnoType) {
+                        printTypeAnnotations(((JCAnnotatedType)tree.elemtype).annotations);
+                    }
+                    print("[]");
+                }
+                if (isElemAnnoType)
+                    elem = ((JCAnnotatedType)elem).underlyingType;
                 if (elem instanceof JCArrayTypeTree)
                     printBrackets((JCArrayTypeTree) elem);
             }
@@ -945,7 +981,7 @@
     public void visitLambda(JCLambda tree) {
         try {
             print("(");
-            if (TreeInfo.isExplicitLambda(tree)) {
+            if (tree.paramKind == JCLambda.ParameterKind.EXPLICIT) {
                 printExprs(tree.params);
             } else {
                 String sep = "";
@@ -1224,6 +1260,12 @@
         JCTree elem;
         while (true) {
             elem = tree.elemtype;
+            if (elem.hasTag(ANNOTATED_TYPE)) {
+                JCAnnotatedType atype = (JCAnnotatedType) elem;
+                elem = atype.underlyingType;
+                if (!elem.hasTag(TYPEARRAY)) break;
+                printTypeAnnotations(atype.annotations);
+            }
             print("[]");
             if (!elem.hasTag(TYPEARRAY)) break;
             tree = (JCArrayTypeTree) elem;
@@ -1326,6 +1368,32 @@
         }
     }
 
+    public void visitAnnotatedType(JCAnnotatedType tree) {
+        try {
+            if (tree.underlyingType.getKind() == JCTree.Kind.MEMBER_SELECT) {
+                JCFieldAccess access = (JCFieldAccess) tree.underlyingType;
+                printExpr(access.selected, TreeInfo.postfixPrec);
+                print(".");
+                printTypeAnnotations(tree.annotations);
+                print(access.name);
+            } else if (tree.underlyingType.getKind() == JCTree.Kind.ARRAY_TYPE) {
+                JCArrayTypeTree array = (JCArrayTypeTree) tree.underlyingType;
+                printBaseElementType(tree);
+                printTypeAnnotations(tree.annotations);
+                print("[]");
+                JCExpression elem = array.elemtype;
+                if (elem.hasTag(TYPEARRAY)) {
+                    printBrackets((JCArrayTypeTree) elem);
+                }
+            } else {
+                printTypeAnnotations(tree.annotations);
+                printExpr(tree.underlyingType);
+            }
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
     public void visitTree(JCTree tree) {
         try {
             print("(UNKNOWN: " + tree + ")");
--- a/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeCopier.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -71,11 +71,26 @@
         return lb.toList();
     }
 
+    public JCTree visitAnnotatedType(AnnotatedTypeTree node, P p) {
+        JCAnnotatedType t = (JCAnnotatedType) node;
+        List<JCAnnotation> annotations = copy(t.annotations, p);
+        JCExpression underlyingType = copy(t.underlyingType, p);
+        return M.at(t.pos).AnnotatedType(annotations, underlyingType);
+    }
+
     public JCTree visitAnnotation(AnnotationTree node, P p) {
         JCAnnotation t = (JCAnnotation) node;
         JCTree annotationType = copy(t.annotationType, p);
         List<JCExpression> args = copy(t.args, p);
-        return M.at(t.pos).Annotation(annotationType, args);
+        if (t.getKind() == Tree.Kind.TYPE_ANNOTATION) {
+            JCAnnotation newTA = M.at(t.pos).TypeAnnotation(annotationType, args);
+            newTA.attribute = t.attribute;
+            return newTA;
+        } else {
+            JCAnnotation newT = M.at(t.pos).Annotation(annotationType, args);
+            newT.attribute = t.attribute;
+            return newT;
+        }
     }
 
     public JCTree visitAssert(AssertTree node, P p) {
@@ -233,10 +248,11 @@
         JCExpression restype = copy(t.restype, p);
         List<JCTypeParameter> typarams = copy(t.typarams, p);
         List<JCVariableDecl> params = copy(t.params, p);
+        JCVariableDecl recvparam = copy(t.recvparam, p);
         List<JCExpression> thrown = copy(t.thrown, p);
         JCBlock body = copy(t.body, p);
         JCExpression defaultValue = copy(t.defaultValue, p);
-        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, params, thrown, body, defaultValue);
+        return M.at(t.pos).MethodDef(mods, t.name, restype, typarams, recvparam, params, thrown, body, defaultValue);
     }
 
     public JCTree visitMethodInvocation(MethodInvocationTree node, P p) {
@@ -384,8 +400,9 @@
 
     public JCTree visitTypeParameter(TypeParameterTree node, P p) {
         JCTypeParameter t = (JCTypeParameter) node;
+        List<JCAnnotation> annos = copy(t.annotations, p);
         List<JCExpression> bounds = copy(t.bounds, p);
-        return M.at(t.pos).TypeParameter(t.name, bounds);
+        return M.at(t.pos).TypeParameter(t.name, bounds, annos);
     }
 
     public JCTree visitInstanceOf(InstanceOfTree node, P p) {
--- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -32,6 +32,7 @@
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import static com.sun.tools.javac.code.Flags.*;
@@ -234,6 +235,7 @@
         switch(tree.getTag()) {
             case TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty();
             case NEWCLASS: return isDiamond(((JCNewClass)tree).clazz);
+            case ANNOTATED_TYPE: return isDiamond(((JCAnnotatedType)tree).underlyingType);
             default: return false;
         }
     }
@@ -264,9 +266,38 @@
         }
     }
 
-    public static boolean isExplicitLambda(JCLambda lambda) {
-        return lambda.params.isEmpty() ||
-                lambda.params.head.vartype != null;
+    /** set 'polyKind' on given tree */
+    public static void setPolyKind(JCTree tree, PolyKind pkind) {
+        switch (tree.getTag()) {
+            case APPLY:
+                ((JCMethodInvocation)tree).polyKind = pkind;
+                break;
+            case NEWCLASS:
+                ((JCNewClass)tree).polyKind = pkind;
+                break;
+            case REFERENCE:
+                ((JCMemberReference)tree).refPolyKind = pkind;
+                break;
+            default:
+                throw new AssertionError("Unexpected tree: " + tree);
+        }
+    }
+
+    /** set 'varargsElement' on given tree */
+    public static void setVarargsElement(JCTree tree, Type varargsElement) {
+        switch (tree.getTag()) {
+            case APPLY:
+                ((JCMethodInvocation)tree).varargsElement = varargsElement;
+                break;
+            case NEWCLASS:
+                ((JCNewClass)tree).varargsElement = varargsElement;
+                break;
+            case REFERENCE:
+                ((JCMemberReference)tree).varargsElement = varargsElement;
+                break;
+            default:
+                throw new AssertionError("Unexpected tree: " + tree);
+        }
     }
 
     /** Return true if the tree corresponds to an expression statement */
@@ -305,6 +336,8 @@
             case TYPEAPPLY:
             case TYPEARRAY:
                 return true;
+            case ANNOTATED_TYPE:
+                return isStaticSelector(((JCAnnotatedType)base).underlyingType, names);
             default:
                 return false;
         }
@@ -423,6 +456,19 @@
             case POSTINC:
             case POSTDEC:
                 return getStartPos(((JCUnary) tree).arg);
+            case ANNOTATED_TYPE: {
+                JCAnnotatedType node = (JCAnnotatedType) tree;
+                if (node.annotations.nonEmpty()) {
+                    if (node.underlyingType.hasTag(TYPEARRAY) ||
+                            node.underlyingType.hasTag(SELECT)) {
+                        return getStartPos(node.underlyingType);
+                    } else {
+                        return getStartPos(node.annotations.head);
+                    }
+                } else {
+                    return getStartPos(node.underlyingType);
+                }
+            }
             case NEWCLASS: {
                 JCNewClass node = (JCNewClass)tree;
                 if (node.encl != null)
@@ -530,6 +576,8 @@
                 return getEndPos(((JCUnary) tree).arg, endPosTable);
             case WHILELOOP:
                 return getEndPos(((JCWhileLoop) tree).body, endPosTable);
+            case ANNOTATED_TYPE:
+                return getEndPos(((JCAnnotatedType) tree).underlyingType, endPosTable);
             case ERRONEOUS: {
                 JCErroneous node = (JCErroneous)tree;
                 if (node.errs != null && node.errs.nonEmpty())
@@ -769,6 +817,8 @@
             return ((JCFieldAccess) tree).sym;
         case TYPEAPPLY:
             return symbol(((JCTypeApply) tree).clazz);
+        case ANNOTATED_TYPE:
+            return symbol(((JCAnnotatedType) tree).underlyingType);
         default:
             return null;
         }
@@ -1006,17 +1056,24 @@
         case NULLCHK:
             return Tree.Kind.OTHER;
 
+        case ANNOTATION:
+            return Tree.Kind.ANNOTATION;
+        case TYPE_ANNOTATION:
+            return Tree.Kind.TYPE_ANNOTATION;
+
         default:
             return null;
         }
     }
 
     /**
-     * Returns the underlying type of the tree if it is annotated type,
-     * or the tree itself otherwise
+     * Returns the underlying type of the tree if it is an annotated type,
+     * or the tree itself otherwise.
      */
     public static JCExpression typeIn(JCExpression tree) {
         switch (tree.getTag()) {
+        case ANNOTATED_TYPE:
+            return ((JCAnnotatedType)tree).underlyingType;
         case IDENT: /* simple names */
         case TYPEIDENT: /* primitive name */
         case SELECT: /* qualified name */
@@ -1024,20 +1081,55 @@
         case WILDCARD: /* wild cards */
         case TYPEPARAMETER: /* type parameters */
         case TYPEAPPLY: /* parameterized types */
+        case ERRONEOUS: /* error tree TODO: needed for BadCast JSR308 test case. Better way? */
             return tree;
         default:
             throw new AssertionError("Unexpected type tree: " + tree);
         }
     }
 
+    /* Return the inner-most type of a type tree.
+     * For an array that contains an annotated type, return that annotated type.
+     * TODO: currently only used by Pretty. Describe behavior better.
+     */
     public static JCTree innermostType(JCTree type) {
-        switch (type.getTag()) {
-        case TYPEARRAY:
-            return innermostType(((JCArrayTypeTree)type).elemtype);
-        case WILDCARD:
-            return innermostType(((JCWildcard)type).inner);
-        default:
-            return type;
+        JCTree lastAnnotatedType = null;
+        JCTree cur = type;
+        loop: while (true) {
+            switch (cur.getTag()) {
+            case TYPEARRAY:
+                lastAnnotatedType = null;
+                cur = ((JCArrayTypeTree)cur).elemtype;
+                break;
+            case WILDCARD:
+                lastAnnotatedType = null;
+                cur = ((JCWildcard)cur).inner;
+                break;
+            case ANNOTATED_TYPE:
+                lastAnnotatedType = cur;
+                cur = ((JCAnnotatedType)cur).underlyingType;
+                break;
+            default:
+                break loop;
+            }
+        }
+        if (lastAnnotatedType!=null) {
+            return lastAnnotatedType;
+        } else {
+            return cur;
         }
     }
+
+    private static class TypeAnnotationFinder extends TreeScanner {
+        public boolean foundTypeAnno = false;
+        public void visitAnnotation(JCAnnotation tree) {
+            foundTypeAnno = foundTypeAnno || tree.hasTag(TYPE_ANNOTATION);
+        }
+    }
+
+    public static boolean containsTypeAnnotation(JCTree e) {
+        TypeAnnotationFinder finder = new TypeAnnotationFinder();
+        finder.scan(e);
+        return finder.foundTypeAnno;
+    }
 }
--- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -169,10 +169,26 @@
                                List<JCExpression> thrown,
                                JCBlock body,
                                JCExpression defaultValue) {
+        return MethodDef(
+                mods, name, restype, typarams, null, params,
+                thrown, body, defaultValue);
+    }
+
+    public JCMethodDecl MethodDef(JCModifiers mods,
+                               Name name,
+                               JCExpression restype,
+                               List<JCTypeParameter> typarams,
+                               JCVariableDecl recvparam,
+                               List<JCVariableDecl> params,
+                               List<JCExpression> thrown,
+                               JCBlock body,
+                               JCExpression defaultValue)
+    {
         JCMethodDecl tree = new JCMethodDecl(mods,
                                        name,
                                        restype,
                                        typarams,
+                                       recvparam,
                                        params,
                                        thrown,
                                        body,
@@ -463,7 +479,11 @@
     }
 
     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
-        JCTypeParameter tree = new JCTypeParameter(name, bounds);
+        return TypeParameter(name, bounds, List.<JCAnnotation>nil());
+    }
+
+    public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCAnnotation> annos) {
+        JCTypeParameter tree = new JCTypeParameter(name, bounds, annos);
         tree.pos = pos;
         return tree;
     }
@@ -481,7 +501,13 @@
     }
 
     public JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args) {
-        JCAnnotation tree = new JCAnnotation(annotationType, args);
+        JCAnnotation tree = new JCAnnotation(Tag.ANNOTATION, annotationType, args);
+        tree.pos = pos;
+        return tree;
+    }
+
+    public JCAnnotation TypeAnnotation(JCTree annotationType, List<JCExpression> args) {
+        JCAnnotation tree = new JCAnnotation(Tag.TYPE_ANNOTATION, annotationType, args);
         tree.pos = pos;
         return tree;
     }
@@ -497,6 +523,12 @@
         return Modifiers(flags, List.<JCAnnotation>nil());
     }
 
+    public JCAnnotatedType AnnotatedType(List<JCAnnotation> annotations, JCExpression underlyingType) {
+        JCAnnotatedType tree = new JCAnnotatedType(annotations, underlyingType);
+        tree.pos = pos;
+        return tree;
+    }
+
     public JCErroneous Erroneous() {
         return Erroneous(List.<JCTree>nil());
     }
@@ -755,7 +787,11 @@
             result = Erroneous();
         }
         public void visitCompound(Attribute.Compound compound) {
-            result = visitCompoundInternal(compound);
+            if (compound instanceof Attribute.TypeCompound) {
+                result = visitTypeCompoundInternal((Attribute.TypeCompound) compound);
+            } else {
+                result = visitCompoundInternal(compound);
+            }
         }
         public JCAnnotation visitCompoundInternal(Attribute.Compound compound) {
             ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
@@ -766,6 +802,15 @@
             }
             return Annotation(Type(compound.type), args.toList());
         }
+        public JCAnnotation visitTypeCompoundInternal(Attribute.TypeCompound compound) {
+            ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
+            for (List<Pair<Symbol.MethodSymbol,Attribute>> values = compound.values; values.nonEmpty(); values=values.tail) {
+                Pair<MethodSymbol,Attribute> pair = values.head;
+                JCExpression valueTree = translate(pair.snd);
+                args.append(Assign(Ident(pair.fst), valueTree).setType(valueTree.type));
+            }
+            return TypeAnnotation(Type(compound.type), args.toList());
+        }
         public void visitArray(Attribute.Array array) {
             ListBuffer<JCExpression> elems = new ListBuffer<JCExpression>();
             for (int i = 0; i < array.values.length; i++)
@@ -779,7 +824,11 @@
         JCAnnotation translate(Attribute.Compound a) {
             return visitCompoundInternal(a);
         }
+        JCAnnotation translate(Attribute.TypeCompound a) {
+            return visitTypeCompoundInternal(a);
+        }
     }
+
     AnnotationBuilder annotationBuilder = new AnnotationBuilder();
 
     /** Create an annotation tree from an attribute.
@@ -788,6 +837,10 @@
         return annotationBuilder.translate((Attribute.Compound)a);
     }
 
+    public JCAnnotation TypeAnnotation(Attribute a) {
+        return annotationBuilder.translate((Attribute.TypeCompound) a);
+    }
+
     /** Create a method definition from a method symbol and a method body.
      */
     public JCMethodDecl MethodDef(MethodSymbol m, JCBlock body) {
@@ -804,6 +857,7 @@
                 m.name,
                 Type(mtype.getReturnType()),
                 TypeParams(mtype.getTypeArguments()),
+                null, // receiver type
                 Params(mtype.getParameterTypes(), m),
                 Types(mtype.getThrownTypes()),
                 body,
@@ -822,7 +876,6 @@
      */
     public List<JCTypeParameter> TypeParams(List<Type> typarams) {
         ListBuffer<JCTypeParameter> tparams = new ListBuffer<JCTypeParameter>();
-        int i = 0;
         for (List<Type> l = typarams; l.nonEmpty(); l = l.tail)
             tparams.append(TypeParam(l.head.tsym.name, (TypeVar)l.head));
         return tparams.toList();
--- a/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeScanner.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -84,6 +84,7 @@
         scan(tree.mods);
         scan(tree.restype);
         scan(tree.typarams);
+        scan(tree.recvparam);
         scan(tree.params);
         scan(tree.thrown);
         scan(tree.defaultValue);
@@ -200,15 +201,18 @@
 
     public void visitNewClass(JCNewClass tree) {
         scan(tree.encl);
+        scan(tree.typeargs);
         scan(tree.clazz);
-        scan(tree.typeargs);
         scan(tree.args);
         scan(tree.def);
     }
 
     public void visitNewArray(JCNewArray tree) {
+        scan(tree.annotations);
         scan(tree.elemtype);
         scan(tree.dims);
+        for (List<JCAnnotation> annos : tree.dimAnnotations)
+            scan(annos);
         scan(tree.elems);
     }
 
@@ -291,6 +295,7 @@
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {
+        scan(tree.annotations);
         scan(tree.bounds);
     }
 
@@ -314,6 +319,11 @@
         scan(tree.args);
     }
 
+    public void visitAnnotatedType(JCAnnotatedType tree) {
+        scan(tree.annotations);
+        scan(tree.underlyingType);
+    }
+
     public void visitErroneous(JCErroneous tree) {
     }
 
--- a/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/tree/TreeTranslator.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -139,6 +139,7 @@
         tree.mods = translate(tree.mods);
         tree.restype = translate(tree.restype);
         tree.typarams = translateTypeParams(tree.typarams);
+        tree.recvparam = translate(tree.recvparam);
         tree.params = translateVarDefs(tree.params);
         tree.thrown = translate(tree.thrown);
         tree.body = translate(tree.body);
@@ -289,6 +290,11 @@
     }
 
     public void visitNewArray(JCNewArray tree) {
+        tree.annotations = translate(tree.annotations);
+        List<List<JCAnnotation>> dimAnnos = List.nil();
+        for (List<JCAnnotation> origDimAnnos : tree.dimAnnotations)
+            dimAnnos = dimAnnos.append(translate(origDimAnnos));
+        tree.dimAnnotations = dimAnnos;
         tree.elemtype = translate(tree.elemtype);
         tree.dims = translate(tree.dims);
         tree.elems = translate(tree.elems);
@@ -385,6 +391,7 @@
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {
+        tree.annotations = translate(tree.annotations);
         tree.bounds = translate(tree.bounds);
         result = tree;
     }
@@ -422,6 +429,12 @@
         result = tree;
     }
 
+    public void visitAnnotatedType(JCAnnotatedType tree) {
+        tree.annotations = translate(tree.annotations);
+        tree.underlyingType = translate(tree.underlyingType);
+        result = tree;
+    }
+
     public void visitTree(JCTree tree) {
         throw new AssertionError(tree);
     }
--- a/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -45,6 +45,7 @@
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.CapturedType;
 import com.sun.tools.javac.file.BaseFileObject;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.tree.Pretty;
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
@@ -197,6 +198,9 @@
         else if (arg instanceof JavaFileObject) {
             return ((JavaFileObject)arg).getName();
         }
+        else if (arg instanceof Profile) {
+            return ((Profile)arg).name;
+        }
         else if (arg instanceof Formattable) {
             return ((Formattable)arg).toString(l, messages);
         }
--- a/src/share/classes/com/sun/tools/javac/util/ArrayUtils.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/ArrayUtils.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -84,4 +84,5 @@
             return result;
         }
     }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/util/GraphUtils.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1999, 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.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>
+ */
+public class GraphUtils {
+
+    /**
+     * This class is a basic abstract class for representing a node.
+     * A node is associated with a given data.
+     */
+    public static abstract class Node<D> {
+        public final D data;
+
+        public Node(D data) {
+            this.data = data;
+        }
+
+        public abstract Iterable<? extends Node<D>> getDependencies();
+
+        public abstract String printDependency(Node<D> to);
+
+        @Override
+        public String toString() {
+            return data.toString();
+        }
+    }
+
+    /**
+     * This class specialized Node, by adding elements that are required in order
+     * to perform Tarjan computation of strongly connected components.
+     */
+    public static abstract class TarjanNode<D> extends Node<D> implements Comparable<TarjanNode<D>> {
+        int index = -1;
+        int lowlink;
+        boolean active;
+
+        public TarjanNode(D data) {
+            super(data);
+        }
+
+        public abstract Iterable<? extends TarjanNode<D>> getDependencies();
+
+        public int compareTo(TarjanNode<D> o) {
+            return (index < o.index) ? -1 : (index == o.index) ? 0 : 1;
+        }
+    }
+
+    /**
+     * Tarjan's algorithm to determine strongly connected components of a
+     * directed graph in linear time. Works on TarjanNode.
+     */
+    public static <D, N extends TarjanNode<D>> List<? extends List<? extends N>> tarjan(Iterable<? extends N> nodes) {
+        ListBuffer<List<N>> cycles = ListBuffer.lb();
+        ListBuffer<N> stack = ListBuffer.lb();
+        int index = 0;
+        for (N node: nodes) {
+            if (node.index == -1) {
+                index += tarjan(node, index, stack, cycles);
+            }
+        }
+        return cycles.toList();
+    }
+
+    private static <D, N extends TarjanNode<D>> int tarjan(N v, int index, ListBuffer<N> stack, ListBuffer<List<N>> cycles) {
+        v.index = index;
+        v.lowlink = index;
+        index++;
+        stack.prepend(v);
+        v.active = true;
+        for (TarjanNode<D> nd: v.getDependencies()) {
+            @SuppressWarnings("unchecked")
+            N n = (N)nd;
+            if (n.index == -1) {
+                tarjan(n, index, stack, cycles);
+                v.lowlink = Math.min(v.lowlink, n.lowlink);
+            } else if (stack.contains(n)) {
+                v.lowlink = Math.min(v.lowlink, n.index);
+            }
+        }
+        if (v.lowlink == v.index) {
+            N n;
+            ListBuffer<N> cycle = ListBuffer.lb();
+            do {
+                n = stack.remove();
+                n.active = false;
+                cycle.add(n);
+            } while (n != v);
+            cycles.add(cycle.toList());
+        }
+        return index;
+    }
+
+    /**
+     * Debugging: dot representation of a set of connected nodes. The resulting
+     * dot representation will use {@code Node.toString} to display node labels
+     * and {@code Node.printDependency} to display edge labels. The resulting
+     * representation is also customizable with a graph name and a header.
+     */
+    public static <D> String toDot(Iterable<? extends TarjanNode<D>> nodes, String name, String header) {
+        StringBuilder buf = new StringBuilder();
+        buf.append(String.format("digraph %s {\n", name));
+        buf.append(String.format("label = \"%s\";\n", header));
+        //dump nodes
+        for (TarjanNode<D> n : nodes) {
+            buf.append(String.format("%s [label = \"%s\"];\n", n.hashCode(), n.toString()));
+        }
+        //dump arcs
+        for (TarjanNode<D> from : nodes) {
+            for (TarjanNode<D> to : from.getDependencies()) {
+                buf.append(String.format("%s -> %s [label = \" %s \"];\n",
+                        from.hashCode(), to.hashCode(), from.printDependency(to)));
+            }
+        }
+        buf.append("}\n");
+        return buf.toString();
+    }
+}
--- a/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -347,7 +347,8 @@
         MANDATORY,
         RESOLVE_ERROR,
         SYNTAX,
-        RECOVERABLE
+        RECOVERABLE,
+        NON_DEFERRABLE,
     }
 
     private final DiagnosticType type;
@@ -388,7 +389,7 @@
         this.source = source;
         this.position = pos;
         this.key = key;
-            this.args = args;
+        this.args = args;
 
         int n = (pos == null ? Position.NOPOS : pos.getPreferredPosition());
         if (n == Position.NOPOS || source == null)
@@ -484,6 +485,10 @@
         return getIntEndPosition();
     }
 
+    public DiagnosticPosition getDiagnosticPosition() {
+        return position;
+    }
+
     /**
      * Get the line number within the source referred to by this diagnostic.
      * @return  the line number within the source referred to by this diagnostic
--- a/src/share/classes/com/sun/tools/javac/util/List.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/List.java	Tue Jul 02 10:13:00 2013 +0100
@@ -96,6 +96,26 @@
         return res.reverse();
     }
 
+    public List<A> intersect(List<A> that) {
+        ListBuffer<A> buf = ListBuffer.lb();
+        for (A el : this) {
+            if (that.contains(el)) {
+                buf.append(el);
+            }
+        }
+        return buf.toList();
+    }
+
+    public List<A> diff(List<A> that) {
+        ListBuffer<A> buf = ListBuffer.lb();
+        for (A el : this) {
+            if (!that.contains(el)) {
+                buf.append(el);
+            }
+        }
+        return buf.toList();
+    }
+
     /** Construct a list consisting of given element.
      */
     public static <A> List<A> of(A x1) {
--- a/src/share/classes/com/sun/tools/javac/util/Log.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/Log.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -136,10 +136,12 @@
         }
 
         public void report(JCDiagnostic diag) {
-            if (filter == null || filter.accepts(diag))
+            if (!diag.isFlagSet(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE) &&
+                (filter == null || filter.accepts(diag))) {
                 deferred.add(diag);
-            else
+            } else {
                 prev.report(diag);
+            }
         }
 
         public Queue<JCDiagnostic> getDiagnostics() {
@@ -217,7 +219,7 @@
     private JavacMessages messages;
 
     /**
-+     * Handler for initial dispatch of diagnostics.
+     * Handler for initial dispatch of diagnostics.
      */
     private DiagnosticHandler diagnosticHandler;
 
@@ -385,14 +387,17 @@
         noticeWriter = warnWriter = errWriter = pw;
     }
 
-    public void setWriters(Log other) {
+    /**
+     * Propagate the previous log's information.
+     */
+    public void initRound(Log other) {
         this.noticeWriter = other.noticeWriter;
         this.warnWriter = other.warnWriter;
         this.errWriter = other.errWriter;
-    }
-
-    public void setSourceMap(Log other) {
         this.sourceMap = other.sourceMap;
+        this.recorded = other.recorded;
+        this.nerrors = other.nerrors;
+        this.nwarnings = other.nwarnings;
     }
 
     /**
--- a/src/share/classes/com/sun/tools/javac/util/Names.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/Names.java	Tue Jul 02 10:13:00 2013 +0100
@@ -73,6 +73,7 @@
     public final Name clone;
     public final Name close;
     public final Name compareTo;
+    public final Name deserializeLambda;
     public final Name desiredAssertionStatus;
     public final Name equals;
     public final Name error;
@@ -132,6 +133,7 @@
     public final Name LineNumberTable;
     public final Name LocalVariableTable;
     public final Name LocalVariableTypeTable;
+    public final Name MethodParameters;
     public final Name RuntimeInvisibleAnnotations;
     public final Name RuntimeInvisibleParameterAnnotations;
     public final Name RuntimeInvisibleTypeAnnotations;
@@ -173,6 +175,7 @@
     //lambda-related
     public final Name lambda;
     public final Name metaFactory;
+    public final Name altMetaFactory;
 
     public final Name.Table table;
 
@@ -206,6 +209,7 @@
         clone = fromString("clone");
         close = fromString("close");
         compareTo = fromString("compareTo");
+        deserializeLambda = fromString("$deserializeLambda$");
         desiredAssertionStatus = fromString("desiredAssertionStatus");
         equals = fromString("equals");
         error = fromString("<error>");
@@ -265,6 +269,7 @@
         LineNumberTable = fromString("LineNumberTable");
         LocalVariableTable = fromString("LocalVariableTable");
         LocalVariableTypeTable = fromString("LocalVariableTypeTable");
+        MethodParameters = fromString("MethodParameters");
         RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
         RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
         RuntimeInvisibleTypeAnnotations = fromString("RuntimeInvisibleTypeAnnotations");
@@ -304,8 +309,9 @@
         package_info = fromString("package-info");
 
         //lambda-related
-        lambda = fromString("lambda");
+        lambda = fromString("lambda$");
         metaFactory = fromString("metaFactory");
+        altMetaFactory = fromString("altMetaFactory");
     }
 
     protected Name.Table createTable(Options options) {
--- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -24,6 +24,7 @@
  */
 package com.sun.tools.javac.util;
 
+import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -96,7 +97,7 @@
         this.diags = JCDiagnostic.Factory.instance(context);
         this.types = Types.instance(context);
         this.messages = JavacMessages.instance(context);
-        whereClauses = new LinkedHashMap<WhereClauseKind, Map<Type, JCDiagnostic>>();
+        whereClauses = new EnumMap<WhereClauseKind, Map<Type, JCDiagnostic>>(WhereClauseKind.class);
         configuration = new RichConfiguration(Options.instance(context), formatter);
         for (WhereClauseKind kind : WhereClauseKind.values())
             whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>());
@@ -288,7 +289,7 @@
 
         public String simplify(Symbol s) {
             String name = s.getQualifiedName().toString();
-            if (!s.type.isCompound()) {
+            if (!s.type.isCompound() && !s.type.isPrimitive()) {
                 List<Symbol> conflicts = nameClashes.get(s.getSimpleName());
                 if (conflicts == null ||
                     (conflicts.size() == 1 &&
@@ -508,6 +509,16 @@
                     visit(supertype);
                     visit(interfaces);
                 }
+            } else if (t.tsym.name.isEmpty()) {
+                //anon class
+                ClassType norm = (ClassType) t.tsym.type;
+                if (norm != null) {
+                    if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
+                        visit(norm.interfaces_field.head);
+                    } else {
+                        visit(norm.supertype_field);
+                    }
+                }
             }
             nameSimplifier.addUsage(t.tsym);
             visit(t.getTypeArguments());
@@ -561,7 +572,7 @@
     // <editor-fold defaultstate="collapsed" desc="symbol scanner">
     /**
      * Preprocess a given symbol looking for (i) additional info (where clauses) to be
-     * asdded to the main diagnostic (ii) names to be compacted
+     * added to the main diagnostic (ii) names to be compacted
      */
     protected void preprocessSymbol(Symbol s) {
         symbolPreprocessor.visit(s, null);
--- a/src/share/classes/com/sun/tools/javadoc/AbstractTypeImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/AbstractTypeImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -104,4 +104,8 @@
     public AnnotationTypeDoc asAnnotationTypeDoc() {
         return null;
     }
+
+    public AnnotatedType asAnnotatedType() {
+        return null;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.javadoc;
+
+import com.sun.javadoc.*;
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Attribute.TypeCompound;
+import com.sun.tools.javac.util.List;
+
+/**
+ * Implementation of <code>AnnotatedType</code>, which
+ * represents an annotated type.
+ *
+ * @author Mahmood Ali
+ * @since 1.8
+ */
+public class AnnotatedTypeImpl
+        extends AbstractTypeImpl implements AnnotatedType {
+
+    AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type.AnnotatedType type) {
+        super(env, type);
+    }
+
+    /**
+     * Get the annotations of this program element.
+     * Return an empty array if there are none.
+     */
+    @Override
+    public AnnotationDesc[] annotations() {
+        List<TypeCompound> tas = ((com.sun.tools.javac.code.Type.AnnotatedType)type).typeAnnotations;
+        if (tas == null ||
+                tas.isEmpty()) {
+            return new AnnotationDesc[0];
+        }
+        AnnotationDesc res[] = new AnnotationDesc[tas.length()];
+        int i = 0;
+        for (Attribute.Compound a : tas) {
+            res[i++] = new AnnotationDescImpl(env, a);
+        }
+        return res;
+    }
+
+    @Override
+    public com.sun.javadoc.Type underlyingType() {
+        return TypeMaker.getType(env, ((com.sun.tools.javac.code.Type.AnnotatedType)type).underlyingType, true, false);
+    }
+
+    @Override
+    public AnnotatedType asAnnotatedType() {
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return typeName();
+    }
+
+    @Override
+    public String typeName() {
+        return this.underlyingType().typeName();
+    }
+
+    @Override
+    public String qualifiedTypeName() {
+        return this.underlyingType().qualifiedTypeName();
+    }
+
+    @Override
+    public String simpleTypeName() {
+        return this.underlyingType().simpleTypeName();
+    }
+
+    @Override
+    public String dimension() {
+        return this.underlyingType().dimension();
+    }
+
+    @Override
+    public boolean isPrimitive() {
+        return this.underlyingType().isPrimitive();
+    }
+
+    @Override
+    public ClassDoc asClassDoc() {
+        return this.underlyingType().asClassDoc();
+    }
+
+    @Override
+    public TypeVariable asTypeVariable() {
+        return this.underlyingType().asTypeVariable();
+    }
+
+    @Override
+    public WildcardType asWildcardType() {
+        return this.underlyingType().asWildcardType();
+    }
+
+    @Override
+    public ParameterizedType asParameterizedType() {
+        return this.underlyingType().asParameterizedType();
+    }
+}
--- a/src/share/classes/com/sun/tools/javadoc/AnnotationDescImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/AnnotationDescImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -89,6 +89,15 @@
     }
 
     /**
+     * Check for the synthesized bit on the annotation.
+     *
+     * @return true if the annotation is synthesized.
+     */
+    public boolean isSynthesized() {
+        return annotation.isSynthesized();
+    }
+
+    /**
      * Returns a string representation of this annotation.
      * String is of one of the forms:
      *     @com.example.foo(name1=val1, name2=val2)
--- a/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1186,6 +1186,13 @@
     }
 
     /**
+     * Returns null, as this is not an annotated type.
+     */
+    public AnnotatedType asAnnotatedType() {
+        return null;
+    }
+
+    /**
      * Return false, as this is not a primitive type.
      */
     public boolean isPrimitive() {
--- a/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/DocEnv.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -31,8 +31,10 @@
 import javax.tools.JavaFileManager;
 
 import com.sun.javadoc.*;
+import com.sun.source.util.JavacTask;
 import com.sun.source.util.TreePath;
-import com.sun.tools.javac.api.JavacTrees;
+import com.sun.tools.doclint.DocLint;
+import com.sun.tools.javac.api.BasicJavacTask;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.ClassType;
@@ -105,6 +107,7 @@
     Types types;
     JavaFileManager fileManager;
     Context context;
+    DocLint doclint;
 
     WeakHashMap<JCTree, TreePath> treePaths = new WeakHashMap<JCTree, TreePath>();
 
@@ -400,6 +403,9 @@
     public void warning(DocImpl doc, String key, String a1) {
         if (silent)
             return;
+        // suppress messages that have (probably) been covered by doclint
+        if (doclint != null && doc != null && key.startsWith("tag"))
+            return;
         messager.warning(doc==null ? null : doc.position(), key, a1);
     }
 
@@ -732,9 +738,15 @@
         return p;
     }
 
-    TreePath getTreePath(JCCompilationUnit toplevel, JCTree tree) {
-        // don't bother to cache paths for classes and members
-        return new TreePath(getTreePath(toplevel), tree);
+    TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl tree) {
+        TreePath p = treePaths.get(tree);
+        if (p == null)
+            treePaths.put(tree, p = new TreePath(getTreePath(toplevel), tree));
+        return p;
+    }
+
+    TreePath getTreePath(JCCompilationUnit toplevel, JCClassDecl cdecl, JCTree tree) {
+        return new TreePath(getTreePath(toplevel, cdecl), tree);
     }
 
     /**
@@ -781,4 +793,27 @@
             result |= Modifier.VOLATILE;
         return result;
     }
+
+    void initDoclint(Collection<String> opts) {
+        ArrayList<String> doclintOpts = new ArrayList<String>();
+
+        for (String opt: opts) {
+            doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
+        }
+
+        if (doclintOpts.isEmpty()) {
+            doclintOpts.add(DocLint.XMSGS_OPTION);
+        } else if (doclintOpts.size() == 1
+                && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
+            return;
+        }
+
+        JavacTask t = BasicJavacTask.instance(context);
+        doclint = new DocLint();
+        doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
+    }
+
+    boolean showTagMessages() {
+        return (doclint == null);
+    }
 }
--- a/src/share/classes/com/sun/tools/javadoc/DocImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/DocImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -126,7 +126,13 @@
      */
     Comment comment() {
         if (comment == null) {
-            comment = new Comment(this, documentation());
+            String d = documentation();
+            if (env.doclint != null
+                    && treePath != null
+                    && d.equals(getCommentText(treePath))) {
+                env.doclint.scan(treePath);
+            }
+            comment = new Comment(this, d);
         }
         return comment;
     }
--- a/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/ExecutableMemberDocImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -28,10 +28,14 @@
 import java.lang.reflect.Modifier;
 import java.text.CollationKey;
 
+import javax.lang.model.type.TypeKind;
+
 import com.sun.javadoc.*;
 
 import com.sun.source.util.TreePath;
+import com.sun.tools.javac.code.Attribute;
 import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Attribute.Compound;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.util.List;
@@ -195,6 +199,24 @@
         return result;
     }
 
+    public AnnotationDesc[] receiverAnnotations() {
+        // TODO: change how receiver annotations are output!
+        Type recvtype = sym.type.asMethodType().recvtype;
+        if (recvtype == null) {
+            return new AnnotationDesc[0];
+        }
+        if (!recvtype.isAnnotated()) {
+            return new AnnotationDesc[0];
+        }
+        List<? extends Compound> typeAnnos = ((com.sun.tools.javac.code.Type.AnnotatedType)recvtype).typeAnnotations;
+        AnnotationDesc result[] = new AnnotationDesc[typeAnnos.length()];
+        int i = 0;
+        for (Attribute.Compound a : typeAnnos) {
+            result[i++] = new AnnotationDescImpl(env, a);
+        }
+        return result;
+    }
+
     /**
      * Return the formal type parameters of this method or constructor.
      * Return an empty array if there are none.
--- a/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -72,7 +72,7 @@
         super.visitMethodDef(tree);
         MethodSymbol meth = tree.sym;
         if (meth == null || meth.kind != Kinds.MTH) return;
-        TreePath treePath = docenv.getTreePath(env.toplevel, tree);
+        TreePath treePath = docenv.getTreePath(env.toplevel, env.enclClass, tree);
         if (meth.isConstructor())
             docenv.makeConstructorDoc(meth, treePath);
         else if (isAnnotationTypeElement(meth))
@@ -90,7 +90,7 @@
         if (tree.sym != null &&
                 tree.sym.kind == Kinds.VAR &&
                 !isParameter(tree.sym)) {
-            docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, tree));
+            docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
         }
     }
 
--- a/src/share/classes/com/sun/tools/javadoc/Messager.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/Messager.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -133,16 +133,6 @@
         this.programName = programName;
     }
 
-    @Override
-    protected int getDefaultMaxErrors() {
-        return Integer.MAX_VALUE;
-    }
-
-    @Override
-    protected int getDefaultMaxWarnings() {
-        return Integer.MAX_VALUE;
-    }
-
     public void setLocale(Locale locale) {
         this.locale = locale;
     }
--- a/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -86,16 +86,7 @@
      * Return true if this method is abstract
      */
     public boolean isAbstract() {
-        //### This is dubious, but old 'javadoc' apparently does it.
-        //### I regard this as a bug and an obstacle to treating the
-        //### doclet API as a proper compile-time reflection facility.
-        //### (maddox 09/26/2000)
-        if (containingClass().isInterface()) {
-            //### Don't force creation of ClassDocImpl for super here.
-            // Abstract modifier is implicit.  Strip/canonicalize it.
-            return false;
-        }
-        return Modifier.isAbstract(getModifiers());
+        return (Modifier.isAbstract(getModifiers()) && !isDefault());
     }
 
     /**
--- a/src/share/classes/com/sun/tools/javadoc/PrimitiveType.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/PrimitiveType.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -121,13 +121,20 @@
     }
 
     /**
-     * Return null, as this is not a wildcard type;
+     * Return null, as this is not a wildcard type.
      */
     public WildcardType asWildcardType() {
         return null;
     }
 
     /**
+     * Return null, as this is not an annotated type.
+     */
+    public AnnotatedType asAnnotatedType() {
+        return null;
+    }
+
+    /**
      * Returns a string representation of the type.
      *
      * Return name of type including any dimension information.
--- a/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/RootDocImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -26,13 +26,14 @@
 package com.sun.tools.javadoc;
 
 import java.io.IOException;
+import java.util.Collection;
 import java.util.Locale;
+
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 
 import com.sun.javadoc.*;
-
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
@@ -375,4 +376,12 @@
     public JavaFileManager getFileManager() {
         return env.fileManager;
     }
+
+    public void initDocLint(Collection<String> opts) {
+        env.initDoclint(opts);
+    }
+
+    public boolean showTagMessages() {
+        return env.showTagMessages();
+    }
 }
--- a/src/share/classes/com/sun/tools/javadoc/TypeMaker.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/TypeMaker.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,6 +25,8 @@
 
 package com.sun.tools.javadoc;
 
+import javax.lang.model.type.TypeKind;
+
 import com.sun.javadoc.*;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
@@ -51,12 +53,27 @@
      * @param errToClassDoc  if true, ERROR type results in a ClassDoc;
      *          false preserves legacy behavior
      */
+    public static com.sun.javadoc.Type getType(DocEnv env, Type t,
+            boolean errorToClassDoc) {
+        return getType(env, t, errorToClassDoc, true);
+    }
+
     @SuppressWarnings("fallthrough")
     public static com.sun.javadoc.Type getType(DocEnv env, Type t,
-                                               boolean errToClassDoc) {
+            boolean errToClassDoc, boolean considerAnnotations) {
         if (env.legacyDoclet) {
             t = env.types.erasure(t);
         }
+        if (considerAnnotations
+                && t.isAnnotated()) {
+            return new AnnotatedTypeImpl(env, (com.sun.tools.javac.code.Type.AnnotatedType) t);
+        }
+
+        if (t.isAnnotated()) {
+            Type.AnnotatedType at = (Type.AnnotatedType) t;
+            return new AnnotatedTypeImpl(env, at);
+        }
+
         switch (t.getTag()) {
         case CLASS:
             if (ClassDocImpl.isGeneric((ClassSymbol)t.tsym)) {
@@ -129,6 +146,11 @@
      * Class names are qualified if "full" is true.
      */
     static String getTypeString(DocEnv env, Type t, boolean full) {
+        // TODO: should annotations be included here?
+        if (t.isAnnotated()) {
+            Type.AnnotatedType at = (Type.AnnotatedType)t;
+            t = at.underlyingType;
+        }
         switch (t.getTag()) {
         case ARRAY:
             StringBuilder s = new StringBuilder();
@@ -282,6 +304,13 @@
         }
 
         /**
+         * Return null, as there are no annotations of the type
+         */
+        public AnnotatedType asAnnotatedType() {
+            return null;
+        }
+
+        /**
          * Return this type as an <code>AnnotationTypeDoc</code> if it
          * represents an annotation type.  Array dimensions are ignored.
          */
--- a/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -25,8 +25,12 @@
 
 package com.sun.tools.javadoc;
 
+import javax.lang.model.type.TypeKind;
+
 import com.sun.javadoc.*;
 
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Attribute.TypeCompound;
 import com.sun.tools.javac.code.Kinds;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
@@ -120,11 +124,30 @@
      * Get the bounds of a type variable as listed in the "extends" clause.
      */
     private static List<Type> getBounds(TypeVar v, DocEnv env) {
-        Name boundname = v.getUpperBound().tsym.getQualifiedName();
-        if (boundname == boundname.table.names.java_lang_Object) {
+        final Type upperBound = v.getUpperBound();
+        Name boundname = upperBound.tsym.getQualifiedName();
+        if (boundname == boundname.table.names.java_lang_Object
+            && !upperBound.isAnnotated()) {
             return List.nil();
         } else {
             return env.types.getBounds(v);
         }
     }
+
+    /**
+     * Get the annotations of this program element.
+     * Return an empty array if there are none.
+     */
+    public AnnotationDesc[] annotations() {
+        if (!type.isAnnotated()) {
+            return new AnnotationDesc[0];
+        }
+        List<TypeCompound> tas = ((com.sun.tools.javac.code.Type.AnnotatedType) type).typeAnnotations;
+        AnnotationDesc res[] = new AnnotationDesc[tas.length()];
+        int i = 0;
+        for (Attribute.Compound a : tas) {
+            res[i++] = new AnnotationDescImpl(env, a);
+        }
+        return res;
+    }
 }
--- a/src/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/api/JavadocTool.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -139,12 +139,13 @@
 
     @Override
     public int run(InputStream in, OutputStream out, OutputStream err, String... arguments) {
-        PrintWriter err_pw = new PrintWriter(err, true);
-        PrintWriter out_pw = new PrintWriter(out);
+        PrintWriter err_pw = new PrintWriter(err == null ? System.err : err, true);
+        PrintWriter out_pw = new PrintWriter(out == null ? System.out : out);
         try {
             String standardDocletName = "com.sun.tools.doclets.standard.Standard";
+            ClassLoader cl = getClass().getClassLoader();
             return com.sun.tools.javadoc.Main.execute(
-                    "javadoc", err_pw, err_pw, out_pw, standardDocletName, arguments);
+                    "javadoc", err_pw, err_pw, out_pw, standardDocletName, cl, arguments);
         } finally {
             err_pw.flush();
             out_pw.flush();
--- a/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/resources/javadoc_ja.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -37,7 +37,6 @@
 main.incompatible.access.flags=-public\u3001-private\u3001-package\u307E\u305F\u306F-protected\u306E\u3046\u3061\u306E2\u3064\u4EE5\u4E0A\u3092\u6307\u5B9A\u3057\u307E\u3057\u305F\u3002
 main.cant.read={0}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093
 main.Loading_source_files_for_package=\u30D1\u30C3\u30B1\u30FC\u30B8{0}\u306E\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059...
-main.Loading_source_file_for_class=\u30AF\u30E9\u30B9{0}\u306E\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059...
 main.Loading_source_file=\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB{0}\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059...
 main.Building_tree=Javadoc\u60C5\u5831\u3092\u69CB\u7BC9\u3057\u3066\u3044\u307E\u3059...
 main.no_source_files_for_package=\u30D1\u30C3\u30B1\u30FC\u30B8{0}\u306E\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093
@@ -67,13 +66,12 @@
 tag.see.can_not_find_member=\u30BF\u30B0{0}: {2}\u3067{1}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
 tag.see.no_close_bracket_on_url=\u30BF\u30B0{0}: \u9589\u3058\u30BF\u30B0''>''\u304C\u3042\u308A\u307E\u305B\u3093: "{1}"
 tag.see.no_close_quote=\u30BF\u30B0{0}: \u9589\u3058\u5F15\u7528\u7B26\u304C\u3042\u308A\u307E\u305B\u3093: "{1}"
-tag.see.class_not_found=@see\u30BF\u30B0\u7528\u306E\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: "{1}"
 tag.see.class_not_specified=\u30BF\u30B0{0}: \u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093: "{1}"
 tag.see.illegal_character=\u30BF\u30B0{0}: "{2}"\u306B\u4E0D\u6B63\u306A\u6587\u5B57"{1}"\u304C\u3042\u308A\u307E\u3059
 tag.see.malformed_see_tag=\u30BF\u30B0{0}: \u66F8\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: "{1}"
-tag.throws.exception_not_found={0}\u30BF\u30B0\u3001\u30AF\u30E9\u30B9{1}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
 tag.End_delimiter_missing_for_possible_SeeTag=\u30B3\u30E1\u30F3\u30C8\u6587\u5B57\u5217"{0}"\u3067\u3001\u6709\u52B9\u306Asee\u30BF\u30B0\u306B\u7D42\u7AEF\u30C7\u30EA\u30DF\u30BF}\u304C\u3042\u308A\u307E\u305B\u3093
 tag.Improper_Use_Of_Link_Tag=\u30A4\u30F3\u30E9\u30A4\u30F3\u30FB\u30BF\u30B0"{0}"\u306B\u7D42\u4E86\u6587\u5B57''}''\u304C\u3042\u308A\u307E\u305B\u3093
+tag.serialField.illegal_character=@serialField\u30BF\u30B0\u306B\u4E0D\u6B63\u306A\u6587\u5B57{0}\u304C\u3042\u308A\u307E\u3059: {1}\u3002
 javadoc.File_Read_Error=\u30D5\u30A1\u30A4\u30EB{0}\u306E\u8AAD\u8FBC\u307F\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F
 javadoc.Body_missing_from_html_file=HTML\u306Bbody\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093
 javadoc.End_body_missing_from_html_file=HTML\u30D5\u30A1\u30A4\u30EB\u306Bbody\u306E\u9589\u3058\u30BF\u30B0\u304C\u3042\u308A\u307E\u305B\u3093
@@ -81,4 +79,8 @@
 javadoc.class_not_found=\u30AF\u30E9\u30B9{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
 javadoc.error=\u30A8\u30E9\u30FC
 javadoc.warning=\u8B66\u544A
-tag.serialField.illegal_character=@serialField\u30BF\u30B0\u306B\u4E0D\u6B63\u306A\u6587\u5B57{0}\u304C\u3042\u308A\u307E\u3059: {1}\u3002
+
+javadoc.error.msg={0}: \u30A8\u30E9\u30FC - {1}
+javadoc.warning.msg={0}: \u8B66\u544A - {1}
+javadoc.note.msg = {1}
+javadoc.note.pos.msg= {0}: {1}
--- a/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javadoc/resources/javadoc_zh_CN.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -37,7 +37,6 @@
 main.incompatible.access.flags=\u6307\u5B9A\u4E86\u591A\u4E2A -public, -private, -package \u6216 -protected\u3002
 main.cant.read=\u65E0\u6CD5\u8BFB\u53D6{0}
 main.Loading_source_files_for_package=\u6B63\u5728\u52A0\u8F7D\u7A0B\u5E8F\u5305{0}\u7684\u6E90\u6587\u4EF6...
-main.Loading_source_file_for_class=\u6B63\u5728\u52A0\u8F7D\u7C7B{0}\u7684\u6E90\u6587\u4EF6...
 main.Loading_source_file=\u6B63\u5728\u52A0\u8F7D\u6E90\u6587\u4EF6{0}...
 main.Building_tree=\u6B63\u5728\u6784\u9020 Javadoc \u4FE1\u606F...
 main.no_source_files_for_package=\u6CA1\u6709\u7A0B\u5E8F\u5305{0}\u7684\u6E90\u6587\u4EF6
@@ -67,13 +66,12 @@
 tag.see.can_not_find_member=\u6807\u8BB0{0}: \u5728{2}\u4E2D\u627E\u4E0D\u5230{1}
 tag.see.no_close_bracket_on_url=\u6807\u8BB0{0}: \u7F3A\u5C11\u6700\u540E\u7684 ''>'': "{1}"
 tag.see.no_close_quote=\u6807\u8BB0{0}: \u65E0\u53F3\u5F15\u53F7: "{1}"
-tag.see.class_not_found=\u627E\u4E0D\u5230 @see \u6807\u8BB0\u7684\u7C7B{0}: "{1}"
 tag.see.class_not_specified=\u6807\u8BB0{0}: \u672A\u6307\u5B9A\u7C7B: "{1}"
 tag.see.illegal_character=\u6807\u8BB0{0}: "{2}" \u4E2D\u7684 "{1}" \u4E3A\u975E\u6CD5\u5B57\u7B26
 tag.see.malformed_see_tag=\u6807\u8BB0{0}: \u683C\u5F0F\u9519\u8BEF: "{1}"
-tag.throws.exception_not_found=\u6807\u8BB0{0}: \u627E\u4E0D\u5230\u7C7B{1}\u3002
 tag.End_delimiter_missing_for_possible_SeeTag=\u6CE8\u91CA\u5B57\u7B26\u4E32\u4E2D\u53EF\u80FD\u51FA\u73B0\u7684 See \u6807\u8BB0\u7F3A\u5C11\u7ED3\u675F\u5206\u9694\u7B26 }: "{0}"
 tag.Improper_Use_Of_Link_Tag=\u5185\u5D4C\u6807\u8BB0\u7F3A\u5C11\u7ED3\u675F ''}'' \u5B57\u7B26: "{0}"
+tag.serialField.illegal_character=@serialField \u6807\u8BB0\u4E2D\u7684\u975E\u6CD5\u5B57\u7B26 {0}: {1}\u3002
 javadoc.File_Read_Error=\u8BFB\u53D6\u6587\u4EF6{0}\u65F6\u51FA\u9519
 javadoc.Body_missing_from_html_file=HTML \u6587\u4EF6\u4E2D\u7F3A\u5C11\u4E3B\u4F53\u6807\u8BB0
 javadoc.End_body_missing_from_html_file=HTML \u6587\u4EF6\u4E2D\u7F3A\u5C11\u4E3B\u4F53\u7ED3\u675F\u6807\u8BB0
@@ -81,4 +79,8 @@
 javadoc.class_not_found=\u627E\u4E0D\u5230\u7C7B{0}\u3002
 javadoc.error=\u9519\u8BEF
 javadoc.warning=\u8B66\u544A
-tag.serialField.illegal_character=@serialField \u6807\u8BB0\u4E2D\u7684\u975E\u6CD5\u5B57\u7B26 {0}: {1}\u3002
+
+javadoc.error.msg={0}: \u9519\u8BEF - {1}
+javadoc.warning.msg={0}: \u8B66\u544A - {1}
+javadoc.note.msg = {1}
+javadoc.note.pos.msg= {0}: {1}
--- a/src/share/classes/com/sun/tools/javah/Util.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javah/Util.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -144,10 +144,6 @@
         throw new Exit(15);
     }
 
-    private void fatal(String msg) throws Exit {
-        fatal(msg, null);
-    }
-
     private void fatal(String msg, Exception e) throws Exit {
         dl.report(createDiagnostic(Diagnostic.Kind.ERROR, "", msg));
         throw new Exit(10, e);
--- a/src/share/classes/com/sun/tools/javah/resources/l10n_ja.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javah/resources/l10n_ja.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -33,10 +33,10 @@
 old.jni.mixed=\u30AA\u30D7\u30B7\u30E7\u30F3-jni\u3068-old\u3092\u540C\u6642\u306B\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 old.llni.mixed=\u30AA\u30D7\u30B7\u30E7\u30F3-old\u3068-llni\u3092\u540C\u6642\u306B\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 old.not.supported=\u3053\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306Ejavah\u3067\u306F\u30AA\u30D7\u30B7\u30E7\u30F3-old\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
-invalid.method.signature=\u7121\u52B9\u306A\u30E1\u30BD\u30C3\u30C9\u30FB\u30B7\u30B0\u30CB\u30C1\u30E3: {0}
+invalid.method.signature=\u7121\u52B9\u306A\u30E1\u30BD\u30C3\u30C9\u30FB\u30B7\u30B0\u30CD\u30C1\u30E3: {0}
 jni.llni.mixed=\u30AA\u30D7\u30B7\u30E7\u30F3-jni\u3068-llni\u3092\u540C\u6642\u306B\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 jni.no.stubs=JNI\u306F\u30B9\u30BF\u30D6\u3092\u5FC5\u8981\u3068\u3057\u307E\u305B\u3093\u3002JNI\u306E\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-jni.sigerror={0}\u306E\u7F72\u540D\u3092\u5224\u5B9A\u3067\u304D\u307E\u305B\u3093
+jni.sigerror={0}\u306E\u30B7\u30B0\u30CD\u30C1\u30E3\u3092\u5224\u5225\u3067\u304D\u307E\u305B\u3093
 dir.file.mixed=\u30AA\u30D7\u30B7\u30E7\u30F3-d\u3068-o\u3092\u540C\u6642\u306B\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 no.classes.specified=\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u3067\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 no.outputfile.specified=\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u3067\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002-help\u3067\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002
@@ -51,7 +51,7 @@
 #
 usage=\u4F7F\u7528\u65B9\u6CD5: javah [options] <classes>\n\n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n\n\t-help           \u30D8\u30EB\u30D7\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3059\u308B\n\t-classpath <path>   \u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-bootclasspath <path> \u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u3092\u30ED\u30FC\u30C9\u3059\u308B\u30D1\u30B9\n\t-d<dir>         \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\n\t-o <file>         \u51FA\u529B\u30D5\u30A1\u30A4\u30EB(-d\u304B-o\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u4F7F\u7528\u3059\u308B)\n\t-jni           JNI\u5F62\u5F0F\u306E\u30D8\u30C3\u30C0\u30FC\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3059\u308B(\u30C7\u30D5\u30A9\u30EB\u30C8)\n\t-version         \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3059\u308B\n\t-verbose         \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046\n\t-force          \u5E38\u306B\u51FA\u529B\u30D5\u30A1\u30A4\u30EB\u3092\u66F8\u304D\u8FBC\u3080\n\n<classes> \u306F\u5B8C\u5168\u6307\u5B9A\u306E\u540D\u524D\u3067\u6307\u5B9A\u3057\u307E\u3059\n(java.lang.Object\u306A\u3069)\u3002\n
 
-main.usage=\u4F7F\u7528\u65B9\u6CD5: \n\  javah [options] <classes>\n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002
+main.usage=\u4F7F\u7528\u65B9\u6CD5: \n  javah [options] <classes>\n[options]\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002
 main.opt.o=\  -o <file>                \u51FA\u529B\u30D5\u30A1\u30A4\u30EB(-d\u304B-o\u306E\u3069\u3061\u3089\u304B\u4E00\u65B9\u3092\u4F7F\u7528\u3059\u308B)
 main.opt.d=\  -d <dir>                 \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA
 main.opt.v=\  -v  -verbose             \u8A73\u7D30\u306A\u51FA\u529B\u3092\u884C\u3046
--- a/src/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javah/resources/l10n_zh_CN.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
 #
 usage=\u7528\u6CD5: javah [options] <classes>\n\n\u5176\u4E2D, [options] \u5305\u62EC:\n\n\t-help                 \u8F93\u51FA\u6B64\u5E2E\u52A9\u6D88\u606F\u5E76\u9000\u51FA\n\t-classpath <path>     \u4ECE\u4E2D\u52A0\u8F7D\u7C7B\u7684\u8DEF\u5F84\n\t-bootclasspath <path> \u4ECE\u4E2D\u52A0\u8F7D\u5F15\u5BFC\u7C7B\u7684\u8DEF\u5F84\n\t-d <dir>              \u8F93\u51FA\u76EE\u5F55\n\t-o <file>             \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00)\n\t-jni                  \u751F\u6210 JNI \u6837\u5F0F\u7684\u6807\u5934\u6587\u4EF6 (\u9ED8\u8BA4\u503C)\n\t-version              \u8F93\u51FA\u7248\u672C\u4FE1\u606F\n\t-verbose              \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA\n\t-force                \u59CB\u7EC8\u5199\u5165\u8F93\u51FA\u6587\u4EF6\n\n<classes> \u662F\u4F7F\u7528\u5176\u5168\u9650\u5B9A\u540D\u79F0\u6307\u5B9A\u7684,\n(\u4F8B\u5982 java.lang.Object)\u3002\n
 
-main.usage=\u7528\u6CD5: \n\  javah [options] <classes>\n\u5176\u4E2D, [options] \u5305\u62EC:
+main.usage=\u7528\u6CD5: \n  javah [options] <classes>\n\u5176\u4E2D, [options] \u5305\u62EC:
 main.opt.o=\  -o <file>                \u8F93\u51FA\u6587\u4EF6 (\u53EA\u80FD\u4F7F\u7528 -d \u6216 -o \u4E4B\u4E00)
 main.opt.d=\  -d <dir>                 \u8F93\u51FA\u76EE\u5F55
 main.opt.v=\  -v  -verbose             \u542F\u7528\u8BE6\u7EC6\u8F93\u51FA
--- a/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, 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
@@ -26,6 +26,7 @@
 package com.sun.tools.javap;
 
 import com.sun.tools.classfile.Annotation;
+import com.sun.tools.classfile.TypeAnnotation;
 import com.sun.tools.classfile.Annotation.Annotation_element_value;
 import com.sun.tools.classfile.Annotation.Array_element_value;
 import com.sun.tools.classfile.Annotation.Class_element_value;
@@ -76,6 +77,123 @@
             print(")");
     }
 
+    public void write(TypeAnnotation annot) {
+        write(annot, true, false);
+    }
+
+    public void write(TypeAnnotation annot, boolean showOffsets, boolean resolveIndices) {
+        write(annot.annotation, resolveIndices);
+        print(": ");
+        write(annot.position, showOffsets);
+    }
+
+    public void write(TypeAnnotation.Position pos, boolean showOffsets) {
+        print(pos.type);
+
+        switch (pos.type) {
+        // instanceof
+        case INSTANCEOF:
+        // new expression
+        case NEW:
+        // constructor/method reference receiver
+        case CONSTRUCTOR_REFERENCE:
+        case METHOD_REFERENCE:
+            if (showOffsets) {
+                print(", offset=");
+                print(pos.offset);
+            }
+            break;
+        // local variable
+        case LOCAL_VARIABLE:
+        // resource variable
+        case RESOURCE_VARIABLE:
+            if (pos.lvarOffset == null) {
+                print(", lvarOffset is Null!");
+                break;
+            }
+            print(", {");
+            for (int i = 0; i < pos.lvarOffset.length; ++i) {
+                if (i != 0) print("; ");
+                if (showOffsets) {
+                    print("start_pc=");
+                    print(pos.lvarOffset[i]);
+                }
+                print(", length=");
+                print(pos.lvarLength[i]);
+                print(", index=");
+                print(pos.lvarIndex[i]);
+            }
+            print("}");
+            break;
+        // exception parameter
+        case EXCEPTION_PARAMETER:
+            print(", exception_index=");
+            print(pos.exception_index);
+            break;
+        // method receiver
+        case METHOD_RECEIVER:
+            // Do nothing
+            break;
+        // type parameter
+        case CLASS_TYPE_PARAMETER:
+        case METHOD_TYPE_PARAMETER:
+            print(", param_index=");
+            print(pos.parameter_index);
+            break;
+        // type parameter bound
+        case CLASS_TYPE_PARAMETER_BOUND:
+        case METHOD_TYPE_PARAMETER_BOUND:
+            print(", param_index=");
+            print(pos.parameter_index);
+            print(", bound_index=");
+            print(pos.bound_index);
+            break;
+        // class extends or implements clause
+        case CLASS_EXTENDS:
+            print(", type_index=");
+            print(pos.type_index);
+            break;
+        // throws
+        case THROWS:
+            print(", type_index=");
+            print(pos.type_index);
+            break;
+        // method parameter
+        case METHOD_FORMAL_PARAMETER:
+            print(", param_index=");
+            print(pos.parameter_index);
+            break;
+        // type cast
+        case CAST:
+        // method/constructor/reference type argument
+        case CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
+        case METHOD_INVOCATION_TYPE_ARGUMENT:
+        case CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
+        case METHOD_REFERENCE_TYPE_ARGUMENT:
+            if (showOffsets) {
+                print(", offset=");
+                print(pos.offset);
+            }
+            print(", type_index=");
+            print(pos.type_index);
+            break;
+        // We don't need to worry about these
+        case METHOD_RETURN:
+        case FIELD:
+            break;
+        case UNKNOWN:
+            throw new AssertionError("AnnotationWriter: UNKNOWN target type should never occur!");
+        default:
+            throw new AssertionError("AnnotationWriter: Unknown target type for position: " + pos);
+        }
+
+        // Append location data for generics/arrays.
+        if (!pos.location.isEmpty()) {
+            print(", location=");
+            print(pos.location);
+        }
+    }
+
     public void write(Annotation.element_value_pair pair) {
         write(pair, false);
     }
--- a/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javap/AttributeWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, 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
@@ -46,10 +46,13 @@
 import com.sun.tools.classfile.LineNumberTable_attribute;
 import com.sun.tools.classfile.LocalVariableTable_attribute;
 import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
+import com.sun.tools.classfile.MethodParameters_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeVisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeVisibleParameterAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
 import com.sun.tools.classfile.Signature_attribute;
 import com.sun.tools.classfile.SourceDebugExtension_attribute;
 import com.sun.tools.classfile.SourceFile_attribute;
@@ -386,6 +389,30 @@
         return null;
     }
 
+    private static final String format = "%-31s%s";
+
+    public Void visitMethodParameters(MethodParameters_attribute attr,
+                                      Void ignore) {
+
+        final String header = String.format(format, "Name", "Flags");
+        println("MethodParameters:");
+        indent(+1);
+        println(header);
+        for (MethodParameters_attribute.Entry entry :
+                 attr.method_parameter_table) {
+            String namestr =
+                entry.name_index != 0 ?
+                constantWriter.stringValue(entry.name_index) : "<no name>";
+            String flagstr =
+                (0 != (entry.flags & ACC_FINAL) ? "final " : "") +
+                (0 != (entry.flags & ACC_MANDATED) ? "mandated " : "") +
+                (0 != (entry.flags & ACC_SYNTHETIC) ? "synthetic" : "");
+            println(String.format(format, namestr, flagstr));
+        }
+        indent(-1);
+        return null;
+    }
+
     public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, Void ignore) {
         println("RuntimeVisibleAnnotations:");
         indent(+1);
@@ -410,6 +437,30 @@
         return null;
     }
 
+    public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, Void ignore) {
+        println("RuntimeVisibleTypeAnnotations:");
+        indent(+1);
+        for (int i = 0; i < attr.annotations.length; i++) {
+            print(i + ": ");
+            annotationWriter.write(attr.annotations[i]);
+            println();
+        }
+        indent(-1);
+        return null;
+    }
+
+    public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, Void ignore) {
+        println("RuntimeInvisibleTypeAnnotations:");
+        indent(+1);
+        for (int i = 0; i < attr.annotations.length; i++) {
+            print(i + ": ");
+            annotationWriter.write(attr.annotations[i]);
+            println();
+        }
+        indent(-1);
+        return null;
+    }
+
     public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, Void ignore) {
         println("RuntimeVisibleParameterAnnotations:");
         indent(+1);
--- a/src/share/classes/com/sun/tools/javap/ClassWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javap/ClassWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, 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
@@ -206,7 +206,7 @@
             println("minor version: " + cf.minor_version);
             println("major version: " + cf.major_version);
             if (!options.compat)
-              writeList("flags: ", flags.getClassFlags(), NEWLINE);
+              writeList("flags: ", flags.getClassFlags(), "\n");
             indent(-1);
             constantWriter.writeConstantPool();
         } else {
@@ -379,11 +379,11 @@
 
         indent(+1);
 
-        if (options.showInternalSignatures)
-            println("Signature: " + getValue(f.descriptor));
+        if (options.showDescriptors)
+            println("descriptor: " + getValue(f.descriptor));
 
         if (options.verbose && !options.compat)
-            writeList("flags: ", flags.getFieldFlags(), NEWLINE);
+            writeList("flags: ", flags.getFieldFlags(), "\n");
 
         if (options.showAllAttrs) {
             for (Attribute attr: f.attributes)
@@ -475,12 +475,12 @@
 
         indent(+1);
 
-        if (options.showInternalSignatures) {
-            println("Signature: " + getValue(m.descriptor));
+        if (options.showDescriptors) {
+            println("descriptor: " + getValue(m.descriptor));
         }
 
         if (options.verbose && !options.compat) {
-            writeList("flags: ", flags.getMethodFlags(), NEWLINE);
+            writeList("flags: ", flags.getMethodFlags(), "\n");
         }
 
         Code_attribute code = null;
@@ -520,7 +520,7 @@
         setPendingNewline(
                 options.showDisassembled ||
                 options.showAllAttrs ||
-                options.showInternalSignatures ||
+                options.showDescriptors ||
                 options.showLineAndLocalVariableTables ||
                 options.verbose);
     }
@@ -749,5 +749,4 @@
     private int size;
     private ConstantPool constant_pool;
     private Method method;
-    private static final String NEWLINE = System.getProperty("line.separator", "\n");
 }
--- a/src/share/classes/com/sun/tools/javap/CodeWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javap/CodeWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -64,6 +64,7 @@
         stackMapWriter = StackMapWriter.instance(context);
         localVariableTableWriter = LocalVariableTableWriter.instance(context);
         localVariableTypeTableWriter = LocalVariableTypeTableWriter.instance(context);
+        typeAnnotationWriter = TypeAnnotationWriter.instance(context);
         options = Options.instance(context);
     }
 
@@ -265,6 +266,11 @@
             detailWriters.add(tryBlockWriter);
         }
 
+        if (options.details.contains(InstructionDetailWriter.Kind.TYPE_ANNOS)) {
+            typeAnnotationWriter.reset(attr);
+            detailWriters.add(typeAnnotationWriter);
+        }
+
         return detailWriters;
     }
 
@@ -273,6 +279,7 @@
     private ConstantWriter constantWriter;
     private LocalVariableTableWriter localVariableTableWriter;
     private LocalVariableTypeTableWriter localVariableTypeTableWriter;
+    private TypeAnnotationWriter typeAnnotationWriter;
     private SourceWriter sourceWriter;
     private StackMapWriter stackMapWriter;
     private TryBlockWriter tryBlockWriter;
--- a/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javap/InstructionDetailWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2011, 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
@@ -42,10 +42,13 @@
         LOCAL_VAR_TYPES("localVariableTypes"),
         SOURCE("source"),
         STACKMAPS("stackMaps"),
-        TRY_BLOCKS("tryBlocks");
+        TRY_BLOCKS("tryBlocks"),
+        TYPE_ANNOS("typeAnnotations");
+
         Kind(String option) {
             this.option = option;
         }
+
         final String option;
     }
 
--- a/src/share/classes/com/sun/tools/javap/JavapTask.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javap/JavapTask.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -140,6 +140,7 @@
         new Option(false, "-v", "-verbose", "-all") {
             void process(JavapTask task, String opt, String arg) {
                 task.options.verbose = true;
+                task.options.showDescriptors = true;
                 task.options.showFlags = true;
                 task.options.showAllAttrs = true;
             }
@@ -190,7 +191,7 @@
 
         new Option(false, "-s") {
             void process(JavapTask task, String opt, String arg) {
-                task.options.showInternalSignatures = true;
+                task.options.showDescriptors = true;
             }
         },
 
@@ -362,7 +363,8 @@
         }
 
         try {
-            handleOptions(options, false);
+            if (options != null)
+                handleOptions(options, false);
         } catch (BadArgs e) {
             throw new IllegalArgumentException(e.getMessage());
         }
--- a/src/share/classes/com/sun/tools/javap/Options.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javap/Options.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, 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
@@ -81,7 +81,7 @@
     public Set<String> accessOptions = new HashSet<String>();
     public Set<InstructionDetailWriter.Kind> details = EnumSet.noneOf(InstructionDetailWriter.Kind.class);
     public boolean showDisassembled;
-    public boolean showInternalSignatures;
+    public boolean showDescriptors;
     public boolean showAllAttrs;
     public boolean showConstants;
     public boolean sysInfo;
--- a/src/share/classes/com/sun/tools/javap/StackMapWriter.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/com/sun/tools/javap/StackMapWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, 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
@@ -269,7 +269,7 @@
 
     }
 
-    class StackMap {
+    static class StackMap {
         StackMap(verification_type_info[] locals, verification_type_info[] stack) {
             this.locals = locals;
             this.stack = stack;
@@ -279,7 +279,7 @@
         private final verification_type_info[] stack;
     }
 
-    class CustomVerificationTypeInfo extends verification_type_info {
+    static class CustomVerificationTypeInfo extends verification_type_info {
         public CustomVerificationTypeInfo(String text) {
             super(-1);
             this.text = text;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javap/TypeAnnotationWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,126 @@
+/*
+ * 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.  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.javap;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.TypeAnnotation;
+import com.sun.tools.classfile.TypeAnnotation.Position;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeTypeAnnotations_attribute;
+import com.sun.tools.classfile.RuntimeVisibleTypeAnnotations_attribute;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Annotate instructions with details about type annotations.
+ *
+ *  <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>
+ */
+public class TypeAnnotationWriter extends InstructionDetailWriter {
+    public enum NoteKind { VISIBLE, INVISIBLE };
+    public static class Note {
+        Note(NoteKind kind, TypeAnnotation anno) {
+            this.kind = kind;
+            this.anno = anno;
+        }
+        public final NoteKind kind;
+        public final TypeAnnotation anno;
+    }
+
+    static TypeAnnotationWriter instance(Context context) {
+        TypeAnnotationWriter instance = context.get(TypeAnnotationWriter.class);
+        if (instance == null)
+            instance = new TypeAnnotationWriter(context);
+        return instance;
+    }
+
+    protected TypeAnnotationWriter(Context context) {
+        super(context);
+        context.put(TypeAnnotationWriter.class, this);
+        annotationWriter = AnnotationWriter.instance(context);
+        classWriter = ClassWriter.instance(context);
+    }
+
+    public void reset(Code_attribute attr) {
+        Method m = classWriter.getMethod();
+        pcMap = new HashMap<Integer, List<Note>>();
+        check(NoteKind.VISIBLE, (RuntimeVisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeVisibleTypeAnnotations));
+        check(NoteKind.INVISIBLE, (RuntimeInvisibleTypeAnnotations_attribute) m.attributes.get(Attribute.RuntimeInvisibleTypeAnnotations));
+    }
+
+    private void check(NoteKind kind, RuntimeTypeAnnotations_attribute attr) {
+        if (attr == null)
+            return;
+
+        for (TypeAnnotation anno: attr.annotations) {
+            Position p = anno.position;
+            Note note = null;
+            if (p.offset != -1)
+                addNote(p.offset, note = new Note(kind, anno));
+            if (p.lvarOffset != null) {
+                for (int i = 0; i < p.lvarOffset.length; i++) {
+                    if (note == null)
+                        note = new Note(kind, anno);
+                    addNote(p.lvarOffset[i], note);
+                }
+            }
+        }
+    }
+
+    private void addNote(int pc, Note note) {
+        List<Note> list = pcMap.get(pc);
+        if (list == null)
+            pcMap.put(pc, list = new ArrayList<Note>());
+        list.add(note);
+    }
+
+    @Override
+    void writeDetails(Instruction instr) {
+        String indent = space(2); // get from Options?
+        int pc = instr.getPC();
+        List<Note> notes = pcMap.get(pc);
+        if (notes != null) {
+            for (Note n: notes) {
+                print(indent);
+                print("@");
+                annotationWriter.write(n.anno, false, true);
+                print(", ");
+                println(n.kind.toString().toLowerCase());
+            }
+        }
+    }
+
+    private AnnotationWriter annotationWriter;
+    private ClassWriter classWriter;
+    private Map<Integer, List<Note>> pcMap;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdeps/Analyzer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,238 @@
+/*
+ * 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.Dependency.Location;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+/**
+ * Dependency Analyzer.
+ */
+public class Analyzer {
+    /**
+     * Type of the dependency analysis.  Appropriate level of data
+     * will be stored.
+     */
+    public enum Type {
+        SUMMARY,
+        PACKAGE,
+        CLASS,
+        VERBOSE
+    };
+
+    private final Type type;
+    private final List<ArchiveDeps> results = new ArrayList<ArchiveDeps>();
+    private final Map<String, Archive> map = new HashMap<String, Archive>();
+    private final Archive NOT_FOUND
+        = new Archive(JdepsTask.getMessage("artifact.not.found"));
+
+    /**
+     * Constructs an Analyzer instance.
+     *
+     * @param type Type of the dependency analysis
+     */
+    public Analyzer(Type type) {
+        this.type = type;
+    }
+
+    /**
+     * Performs the dependency analysis on the given archives.
+     */
+    public void run(List<Archive> archives) {
+        for (Archive archive : archives) {
+            ArchiveDeps deps;
+            if (type == Type.CLASS || type == Type.VERBOSE) {
+                deps = new ClassVisitor(archive);
+            } else {
+                deps = new PackageVisitor(archive);
+            }
+            archive.visit(deps);
+            results.add(deps);
+        }
+
+        // set the required dependencies
+        for (ArchiveDeps result: results) {
+            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);
+                        }
+                        // 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);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    public interface Visitor {
+        /**
+         * 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);
+    }
+
+    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 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 Archive getArchive(String name) {
+        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 SortedMap<String, SortedSet<String>> deps;
+
+        ArchiveDeps(Archive archive) {
+            this.archive = archive;
+            this.requiredArchives = new HashSet<Archive>();
+            this.targetNames = new TreeSet<String>();
+            this.deps = new TreeMap<String, SortedSet<String>>();
+        }
+
+        void add(String loc) {
+            Archive a = map.get(loc);
+            if (a == null) {
+                map.put(loc, archive);
+            } else if (a != archive) {
+                // duplicated class warning?
+            }
+        }
+
+        void add(String origin, String target) {
+            SortedSet<String> set = deps.get(origin);
+            if (set == null) {
+                set = new TreeSet<String>();
+                deps.put(origin, set);
+            }
+            if (!set.contains(target)) {
+                set.add(target);
+            }
+        }
+
+        public abstract void visit(Location o, Location t);
+        public abstract String getTargetProfile(String target);
+
+    }
+
+    private class ClassVisitor extends ArchiveDeps {
+        ClassVisitor(Archive archive) {
+            super(archive);
+        }
+        public void visit(Location l) {
+            add(l.getClassName());
+        }
+        public void visit(Location o, Location t) {
+            add(o.getClassName(), t.getClassName());
+        }
+        public String getTargetProfile(String target) {
+            int i = target.lastIndexOf('.');
+            return (i > 0) ? Profiles.getProfileName(target.substring(0, i)) : "";
+        }
+    }
+
+    private class PackageVisitor extends ArchiveDeps {
+        PackageVisitor(Archive archive) {
+            super(archive);
+        }
+        public void visit(Location o, Location t) {
+            add(packageOf(o), packageOf(t));
+        }
+        public void visit(Location l) {
+            add(packageOf(l));
+        }
+        private String packageOf(Location loc) {
+            String pkg = loc.getPackageName();
+            return pkg.isEmpty() ? "<unnamed>" : pkg;
+        }
+        public String getTargetProfile(String target) {
+            return Profiles.getProfileName(target);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdeps/Archive.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,97 @@
+/*
+ * 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.  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.Dependency.Location;
+import java.io.File;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Represents the source of the class files.
+ */
+public class Archive {
+    private final File file;
+    private final String filename;
+    private final ClassFileReader reader;
+    private final Map<Location, Set<Location>> deps
+        = new HashMap<Location, Set<Location>>();
+
+    public Archive(String name) {
+        this.file = null;
+        this.filename = name;
+        this.reader = null;
+    }
+
+    public Archive(File f, ClassFileReader reader) {
+        this.file = f;
+        this.filename = f.getName();
+        this.reader = reader;
+    }
+
+    public ClassFileReader reader() {
+        return reader;
+    }
+
+    public String getFileName() {
+        return filename;
+    }
+
+    public void addClass(Location origin) {
+        Set<Location> set = deps.get(origin);
+        if (set == null) {
+            set = new HashSet<Location>();
+            deps.put(origin, set);
+        }
+    }
+    public void addClass(Location origin, Location target) {
+        Set<Location> set = deps.get(origin);
+        if (set == null) {
+            set = new HashSet<Location>();
+            deps.put(origin, set);
+        }
+        set.add(target);
+    }
+
+    public void visit(Visitor v) {
+        for (Map.Entry<Location,Set<Location>> e: deps.entrySet()) {
+            v.visit(e.getKey());
+            for (Location target : e.getValue()) {
+                v.visit(e.getKey(), target);
+            }
+        }
+    }
+
+    public String toString() {
+        return file != null ? file.getPath() : filename;
+    }
+
+    interface Visitor {
+        void visit(Location loc);
+        void visit(Location origin, Location target);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,336 @@
+/*
+ * 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.  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.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Dependencies.ClassFileError;
+import java.io.*;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.*;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * ClassFileReader reads ClassFile(s) of a given path that can be
+ * a .class file, a directory, or a JAR file.
+ */
+public class ClassFileReader {
+    /**
+     * Returns a ClassFileReader instance of a given path.
+     */
+    public static ClassFileReader newInstance(File path) throws IOException {
+        if (!path.exists()) {
+            throw new FileNotFoundException(path.getAbsolutePath());
+        }
+
+        if (path.isDirectory()) {
+            return new DirectoryReader(path.toPath());
+        } else if (path.getName().endsWith(".jar")) {
+            return new JarFileReader(path.toPath());
+        } else {
+            return new ClassFileReader(path.toPath());
+        }
+    }
+
+    /**
+     * Returns a ClassFileReader instance of a given JarFile.
+     */
+    public static ClassFileReader newInstance(Path path, JarFile jf) throws IOException {
+        return new JarFileReader(path, jf);
+    }
+
+    protected final Path path;
+    protected final String baseFileName;
+    private ClassFileReader(Path path) {
+        this.path = path;
+        this.baseFileName = path.getFileName() != null
+                                ? path.getFileName().toString()
+                                : path.toString();
+    }
+
+    public String getFileName() {
+        return baseFileName;
+    }
+
+    /**
+     * Returns the ClassFile matching the given binary name
+     * or a fully-qualified class name.
+     */
+    public ClassFile getClassFile(String name) throws IOException {
+        if (name.indexOf('.') > 0) {
+            int i = name.lastIndexOf('.');
+            String pathname = name.replace('.', File.separatorChar) + ".class";
+            if (baseFileName.equals(pathname) ||
+                    baseFileName.equals(pathname.substring(0, i) + "$" +
+                                        pathname.substring(i+1, pathname.length()))) {
+                return readClassFile(path);
+            }
+        } else {
+            if (baseFileName.equals(name.replace('/', File.separatorChar) + ".class")) {
+                return readClassFile(path);
+            }
+        }
+        return null;
+    }
+
+    public Iterable<ClassFile> getClassFiles() throws IOException {
+        return new Iterable<ClassFile>() {
+            public Iterator<ClassFile> iterator() {
+                return new FileIterator();
+            }
+        };
+    }
+
+    protected ClassFile readClassFile(Path p) throws IOException {
+        InputStream is = null;
+        try {
+            is = Files.newInputStream(p);
+            return ClassFile.read(is);
+        } catch (ConstantPoolException e) {
+            throw new ClassFileError(e);
+        } finally {
+            if (is != null) {
+                is.close();
+            }
+        }
+    }
+
+    class FileIterator implements Iterator<ClassFile> {
+        int count;
+        FileIterator() {
+            this.count = 0;
+        }
+        public boolean hasNext() {
+            return count == 0 && baseFileName.endsWith(".class");
+        }
+
+        public ClassFile next() {
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
+            try {
+                ClassFile cf = readClassFile(path);
+                count++;
+                return cf;
+            } catch (IOException e) {
+                throw new ClassFileError(e);
+            }
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+    }
+
+    public String toString() {
+        return path.toString();
+    }
+
+    private static class DirectoryReader extends ClassFileReader {
+        DirectoryReader(Path path) throws IOException {
+            super(path);
+        }
+
+        public ClassFile getClassFile(String name) throws IOException {
+            if (name.indexOf('.') > 0) {
+                int i = name.lastIndexOf('.');
+                String pathname = name.replace('.', File.separatorChar) + ".class";
+                Path p = path.resolve(pathname);
+                if (!p.toFile().exists()) {
+                    p = path.resolve(pathname.substring(0, i) + "$" +
+                                     pathname.substring(i+1, pathname.length()));
+                }
+                if (p.toFile().exists()) {
+                    return readClassFile(p);
+                }
+            } else {
+                Path p = path.resolve(name + ".class");
+                if (p.toFile().exists()) {
+                    return readClassFile(p);
+                }
+            }
+            return null;
+        }
+
+        public Iterable<ClassFile> getClassFiles() throws IOException {
+            final Iterator<ClassFile> iter = new DirectoryIterator();
+            return new Iterable<ClassFile>() {
+                public Iterator<ClassFile> iterator() {
+                    return iter;
+                }
+            };
+        }
+
+        private List<Path> walkTree(Path dir) throws IOException {
+            final List<Path> files = new ArrayList<Path>();
+            Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
+                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
+                        throws IOException {
+                    if (file.toFile().getName().endsWith(".class")) {
+                        files.add(file);
+                    }
+                    return FileVisitResult.CONTINUE;
+                }
+            });
+            return files;
+        }
+
+        class DirectoryIterator implements Iterator<ClassFile> {
+            private List<Path> entries;
+            private int index = 0;
+            DirectoryIterator() throws IOException {
+                entries = walkTree(path);
+                index = 0;
+            }
+
+            public boolean hasNext() {
+                return index != entries.size();
+            }
+
+            public ClassFile next() {
+                if (!hasNext()) {
+                    throw new NoSuchElementException();
+                }
+                Path path = entries.get(index++);
+                try {
+                    return readClassFile(path);
+                } catch (IOException e) {
+                    throw new ClassFileError(e);
+                }
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+        }
+    }
+
+    private static class JarFileReader extends ClassFileReader {
+        final JarFile jarfile;
+        JarFileReader(Path path) throws IOException {
+            this(path, new JarFile(path.toFile()));
+        }
+        JarFileReader(Path path, JarFile jf) throws IOException {
+            super(path);
+            this.jarfile = jf;
+        }
+
+        public ClassFile getClassFile(String name) throws IOException {
+            if (name.indexOf('.') > 0) {
+                int i = name.lastIndexOf('.');
+                String entryName = name.replace('.', '/') + ".class";
+                JarEntry e = jarfile.getJarEntry(entryName);
+                if (e == null) {
+                    e = jarfile.getJarEntry(entryName.substring(0, i) + "$"
+                            + entryName.substring(i + 1, entryName.length()));
+                }
+                if (e != null) {
+                    return readClassFile(e);
+                }
+            } else {
+                JarEntry e = jarfile.getJarEntry(name + ".class");
+                if (e != null) {
+                    return readClassFile(e);
+                }
+            }
+            return null;
+        }
+
+        private ClassFile readClassFile(JarEntry e) throws IOException {
+            InputStream is = null;
+            try {
+                is = jarfile.getInputStream(e);
+                return ClassFile.read(is);
+            } catch (ConstantPoolException ex) {
+                throw new ClassFileError(ex);
+            } finally {
+                if (is != null)
+                    is.close();
+            }
+        }
+
+        public Iterable<ClassFile> getClassFiles() throws IOException {
+            final Iterator<ClassFile> iter = new JarFileIterator();
+            return new Iterable<ClassFile>() {
+                public Iterator<ClassFile> iterator() {
+                    return iter;
+                }
+            };
+        }
+
+        class JarFileIterator implements Iterator<ClassFile> {
+            private Enumeration<JarEntry> entries;
+            private JarEntry nextEntry;
+            JarFileIterator() {
+                this.entries = jarfile.entries();
+                while (entries.hasMoreElements()) {
+                    JarEntry e = entries.nextElement();
+                    String name = e.getName();
+                    if (name.endsWith(".class")) {
+                        this.nextEntry = e;
+                        break;
+                    }
+                }
+            }
+
+            public boolean hasNext() {
+                return nextEntry != null;
+            }
+
+            public ClassFile next() {
+                if (!hasNext()) {
+                    throw new NoSuchElementException();
+                }
+
+                ClassFile cf;
+                try {
+                    cf = readClassFile(nextEntry);
+                } catch (IOException ex) {
+                    throw new ClassFileError(ex);
+                }
+                JarEntry entry = nextEntry;
+                nextEntry = null;
+                while (entries.hasMoreElements()) {
+                    JarEntry e = entries.nextElement();
+                    String name = e.getName();
+                    if (name.endsWith(".class")) {
+                        nextEntry = e;
+                        break;
+                    }
+                }
+                return cf;
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdeps/JdepsTask.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,575 @@
+/*
+ * 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
+ * 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.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 java.io.*;
+import java.text.MessageFormat;
+import java.util.*;
+import java.util.regex.Pattern;
+
+/**
+ * Implementation for the jdeps tool for static class dependency analysis.
+ */
+class JdepsTask {
+    static class BadArgs extends Exception {
+        static final long serialVersionUID = 8765093759964640721L;
+        BadArgs(String key, Object... args) {
+            super(JdepsTask.getMessage(key, args));
+            this.key = key;
+            this.args = args;
+        }
+
+        BadArgs showUsage(boolean b) {
+            showUsage = b;
+            return this;
+        }
+        final String key;
+        final Object[] args;
+        boolean showUsage;
+    }
+
+    static abstract class Option {
+        Option(boolean hasArg, String... aliases) {
+            this.hasArg = hasArg;
+            this.aliases = aliases;
+        }
+
+        boolean isHidden() {
+            return false;
+        }
+
+        boolean matches(String opt) {
+            for (String a : aliases) {
+                if (a.equals(opt)) {
+                    return true;
+                } else if (opt.startsWith("--") && hasArg && opt.startsWith(a + "=")) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        boolean ignoreRest() {
+            return false;
+        }
+
+        abstract void process(JdepsTask task, String opt, String arg) throws BadArgs;
+        final boolean hasArg;
+        final String[] aliases;
+    }
+
+    static abstract class HiddenOption extends Option {
+        HiddenOption(boolean hasArg, String... aliases) {
+            super(hasArg, aliases);
+        }
+
+        boolean isHidden() {
+            return true;
+        }
+    }
+
+    static Option[] recognizedOptions = {
+        new Option(false, "-h", "-?", "--help") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.help = true;
+            }
+        },
+        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") {
+            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);
+                }
+            }
+        },
+        new Option(true, "-c", "--classpath") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.classpath = arg;
+            }
+        },
+        new Option(true, "-p", "--package") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.packageNames.add(arg);
+            }
+        },
+        new Option(true, "-e", "--regex") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.regex = arg;
+            }
+        },
+        new Option(false, "-P", "--profile") {
+            void process(JdepsTask task, String opt, String arg) throws BadArgs {
+                task.options.showProfile = true;
+                if (Profiles.getProfileCount() == 0) {
+                    throw new BadArgs("err.option.unsupported", opt, getMessage("err.profiles.msg"));
+                }
+            }
+        },
+        new Option(false, "-R", "--recursive") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.depth = 0;
+            }
+        },
+        new HiddenOption(true, "-d", "--depth") {
+            void process(JdepsTask task, String opt, String arg) throws BadArgs {
+                try {
+                    task.options.depth = Integer.parseInt(arg);
+                } catch (NumberFormatException e) {
+                    throw new BadArgs("err.invalid.arg.for.option", opt);
+                }
+            }
+        },
+        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";
+    private final Options options = new Options();
+    private final List<String> classes = new ArrayList<String>();
+
+    private PrintWriter log;
+    void setLog(PrintWriter out) {
+        log = out;
+    }
+
+    /**
+     * Result codes.
+     */
+    static final int EXIT_OK = 0, // Completed with no errors.
+                     EXIT_ERROR = 1, // Completed but reported errors.
+                     EXIT_CMDERR = 2, // Bad command-line arguments
+                     EXIT_SYSERR = 3, // System error or resource exhaustion.
+                     EXIT_ABNORMAL = 4;// terminated abnormally
+
+    int run(String[] args) {
+        if (log == null) {
+            log = new PrintWriter(System.out);
+        }
+        try {
+            handleOptions(args);
+            if (options.help) {
+                showHelp();
+            }
+            if (options.version || options.fullVersion) {
+                showVersion(options.fullVersion);
+            }
+            if (classes.isEmpty() && !options.wildcard) {
+                if (options.help || options.version || options.fullVersion) {
+                    return EXIT_OK;
+                } else {
+                    showHelp();
+                    return EXIT_CMDERR;
+                }
+            }
+            if (options.regex != null && options.packageNames.size() > 0) {
+                showHelp();
+                return EXIT_CMDERR;
+            }
+            if (options.showSummary && options.verbose != Analyzer.Type.SUMMARY) {
+                showHelp();
+                return EXIT_CMDERR;
+            }
+            boolean ok = run();
+            return ok ? EXIT_OK : EXIT_ERROR;
+        } catch (BadArgs e) {
+            reportError(e.key, e.args);
+            if (e.showUsage) {
+                log.println(getMessage("main.usage.summary", PROGNAME));
+            }
+            return EXIT_CMDERR;
+        } catch (IOException e) {
+            return EXIT_ABNORMAL;
+        } finally {
+            log.flush();
+        }
+    }
+
+    private final List<Archive> sourceLocations = new ArrayList<Archive>();
+    private boolean run() throws IOException {
+        findDependencies();
+        Analyzer analyzer = new Analyzer(options.verbose);
+        analyzer.run(sourceLocations);
+        if (options.verbose == Analyzer.Type.SUMMARY) {
+            printSummary(log, analyzer);
+        } else {
+            printDependencies(log, analyzer);
+        }
+        return true;
+    }
+
+    private boolean isValidClassName(String name) {
+        if (!Character.isJavaIdentifierStart(name.charAt(0))) {
+            return false;
+        }
+        for (int i=1; i < name.length(); i++) {
+            char c = name.charAt(i);
+            if (c != '.'  && !Character.isJavaIdentifierPart(c)) {
+                return false;
+            }
+        }
+        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));
+        } else if (options.packageNames.size() > 0) {
+            filter = Dependencies.getPackageFilter(options.packageNames, false);
+        } else {
+            filter = new Dependency.Filter() {
+                public boolean accepts(Dependency dependency) {
+                    return !dependency.getOrigin().equals(dependency.getTarget());
+                }
+            };
+        }
+
+        List<Archive> archives = new ArrayList<Archive>();
+        Deque<String> roots = new LinkedList<String>();
+        for (String s : classes) {
+            File f = new File(s);
+            if (f.exists()) {
+                archives.add(new Archive(f, ClassFileReader.newInstance(f)));
+            } else {
+                if (isValidClassName(s)) {
+                    roots.add(s);
+                } else {
+                    warning("warn.invalid.arg", s);
+                }
+            }
+        }
+
+        List<Archive> classpaths = new ArrayList<Archive>(); // for class file lookup
+        if (options.wildcard) {
+            // include all archives from classpath to the initial list
+            archives.addAll(getClassPathArchives(options.classpath));
+        } else {
+            classpaths.addAll(getClassPathArchives(options.classpath));
+        }
+        classpaths.addAll(PlatformClassPath.getArchives());
+
+        // add all archives to the source locations for reporting
+        sourceLocations.addAll(archives);
+        sourceLocations.addAll(classpaths);
+
+        // 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>();
+
+        // get the immediate dependencies of the input files
+        for (Archive a : archives) {
+            for (ClassFile cf : a.reader().getClassFiles()) {
+                String classFileName;
+                try {
+                    classFileName = cf.getName();
+                } catch (ConstantPoolException e) {
+                    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);
+                        }
+                        a.addClass(d.getOrigin(), d.getTarget());
+                    }
+                }
+            }
+        }
+
+        // add Archive for looking up classes from the classpath
+        // for transitive dependency analysis
+        Deque<String> unresolved = roots;
+        int depth = options.depth > 0 ? options.depth : Integer.MAX_VALUE;
+        do {
+            String name;
+            while ((name = unresolved.poll()) != null) {
+                if (doneClasses.contains(name)) {
+                    continue;
+                }
+                ClassFile cf = null;
+                for (Archive a : classpaths) {
+                    cf = a.reader().getClassFile(name);
+                    if (cf != null) {
+                        String classFileName;
+                        try {
+                            classFileName = cf.getName();
+                        } catch (ConstantPoolException e) {
+                            throw new ClassFileError(e);
+                        }
+                        if (!doneClasses.contains(classFileName)) {
+                            // if name is a fully-qualified class name specified
+                            // from command-line, this class might already be parsed
+                            doneClasses.add(classFileName);
+                            for (Dependency d : finder.findDependencies(cf)) {
+                                if (depth == 0) {
+                                    // ignore the dependency
+                                    a.addClass(d.getOrigin());
+                                    break;
+                                } else if (filter.accepts(d)) {
+                                    a.addClass(d.getOrigin(), d.getTarget());
+                                    String cn = d.getTarget().getName();
+                                    if (!doneClasses.contains(cn) && !deque.contains(cn)) {
+                                        deque.add(cn);
+                                    }
+                                }
+                            }
+                        }
+                        break;
+                    }
+                }
+                if (cf == null) {
+                    doneClasses.add(name);
+                }
+            }
+            unresolved = deque;
+            deque = new LinkedList<String>();
+        } 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++) {
+            if (args[i].charAt(0) == '-') {
+                String name = args[i];
+                Option option = getOption(name);
+                String param = null;
+                if (option.hasArg) {
+                    if (name.startsWith("--") && name.indexOf('=') > 0) {
+                        param = name.substring(name.indexOf('=') + 1, name.length());
+                    } else if (i + 1 < args.length) {
+                        param = args[++i];
+                    }
+                    if (param == null || param.isEmpty() || param.charAt(0) == '-') {
+                        throw new BadArgs("err.missing.arg", name).showUsage(true);
+                    }
+                }
+                option.process(this, name, param);
+                if (option.ignoreRest()) {
+                    i = args.length;
+                }
+            } else {
+                // process rest of the input arguments
+                for (; i < args.length; i++) {
+                    String name = args[i];
+                    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);
+                    }
+                }
+            }
+        }
+    }
+
+    private Option getOption(String name) throws BadArgs {
+        for (Option o : recognizedOptions) {
+            if (o.matches(name)) {
+                return o;
+            }
+        }
+        throw new BadArgs("err.unknown.option", name).showUsage(true);
+    }
+
+    private void reportError(String key, Object... args) {
+        log.println(getMessage("error.prefix") + " " + getMessage(key, args));
+    }
+
+    private void warning(String key, Object... args) {
+        log.println(getMessage("warn.prefix") + " " + getMessage(key, args));
+    }
+
+    private void showHelp() {
+        log.println(getMessage("main.usage", PROGNAME));
+        for (Option o : recognizedOptions) {
+            String name = o.aliases[0].substring(1); // there must always be at least one name
+            name = name.charAt(0) == '-' ? name.substring(1) : name;
+            if (o.isHidden() || name.equals("h")) {
+                continue;
+            }
+            log.println(getMessage("main.opt." + name));
+        }
+    }
+
+    private void showVersion(boolean full) {
+        log.println(version(full ? "full" : "release"));
+    }
+
+    private String version(String key) {
+        // key=version:  mm.nn.oo[-milestone]
+        // key=full:     mm.mm.oo[-milestone]-build
+        if (ResourceBundleHelper.versionRB == null) {
+            return System.getProperty("java.version");
+        }
+        try {
+            return ResourceBundleHelper.versionRB.getString(key);
+        } catch (MissingResourceException e) {
+            return getMessage("version.unknown", System.getProperty("java.version"));
+        }
+    }
+
+    static String getMessage(String key, Object... args) {
+        try {
+            return MessageFormat.format(ResourceBundleHelper.bundle.getString(key), args);
+        } catch (MissingResourceException e) {
+            throw new InternalError("Missing message: " + key);
+        }
+    }
+
+    private static class Options {
+        boolean help;
+        boolean version;
+        boolean fullVersion;
+        boolean showProfile;
+        boolean showSummary;
+        boolean wildcard;
+        String regex;
+        String classpath = "";
+        int depth = 1;
+        Analyzer.Type verbose = Analyzer.Type.PACKAGE;
+        Set<String> packageNames = new HashSet<String>();
+    }
+
+    private static class ResourceBundleHelper {
+        static final ResourceBundle versionRB;
+        static final ResourceBundle bundle;
+
+        static {
+            Locale locale = Locale.getDefault();
+            try {
+                bundle = ResourceBundle.getBundle("com.sun.tools.jdeps.resources.jdeps", locale);
+            } catch (MissingResourceException e) {
+                throw new InternalError("Cannot find jdeps resource bundle for locale " + locale);
+            }
+            try {
+                versionRB = ResourceBundle.getBundle("com.sun.tools.jdeps.resources.version");
+            } catch (MissingResourceException e) {
+                throw new InternalError("version.resource.missing");
+            }
+        }
+    }
+
+    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)));
+            } else {
+                warning("warn.file.not.exist", s);
+            }
+        }
+        return result;
+    }
+
+    private List<Archive> getClassPathArchives(String paths) throws IOException {
+        List<Archive> result = new ArrayList<Archive>();
+        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)));
+                }
+            }
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdeps/Main.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,66 @@
+/*
+ * 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.  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 java.io.*;
+
+/**
+ *
+ * Usage:
+ *    jdeps [options] files ...
+ * where options include:
+ *    -p package-name   restrict analysis to classes in this package
+ *                      (may be given multiple times)
+ *    -e regex          restrict analysis to packages matching pattern
+ *                      (-p and -e are exclusive)
+ *    -v                show class-level dependencies
+ *                      default: package-level dependencies
+ *    -r --recursive    transitive dependencies analysis
+ *    -classpath paths  Classpath to locate class files
+ *    -all              process all class files in the given classpath
+ */
+public class Main {
+    public static void main(String... args) throws Exception {
+        JdepsTask t = new JdepsTask();
+        int rc = t.run(args);
+        System.exit(rc);
+    }
+
+
+    /**
+     * Entry point that does <i>not</i> call System.exit.
+     *
+     * @param args command line arguments
+     * @param out output stream
+     * @return an exit code. 0 means success, non-zero means an error occurred.
+     */
+    public static int run(String[] args, PrintWriter out) {
+        JdepsTask t = new JdepsTask();
+        t.setLog(out);
+        return t.run(args);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,107 @@
+/*
+ * 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
+ * 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 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.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.*;
+
+/**
+ * ClassPath for Java SE and JDK
+ */
+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");
+
+        try {
+            if (jre.exists() && jre.isDirectory()) {
+                result.addAll(addJarFiles(new File(jre, "lib")));
+                result.addAll(addJarFiles(lib));
+            } else if (lib.exists() && lib.isDirectory()) {
+                // either a JRE or a jdk build image
+                File classes = new File(javaHome, "classes");
+                if (classes.exists() && classes.isDirectory()) {
+                    // jdk build outputdir
+                    result.add(new Archive(classes, ClassFileReader.newInstance(classes)));
+                }
+                // add other JAR files
+                result.addAll(addJarFiles(lib));
+            } else {
+                throw new RuntimeException("\"" + javaHome + "\" not a JDK home");
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return result;
+    }
+
+    private static List<Archive> addJarFiles(File f) throws IOException {
+        final List<Archive> result = new ArrayList<Archive>();
+        final Path root = f.toPath();
+        final Path ext = root.resolve("ext");
+        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
+                throws IOException
+            {
+                if (dir.equals(root) || dir.equals(ext)) {
+                    return FileVisitResult.CONTINUE;
+                } else {
+                    // skip other cobundled JAR files
+                    return FileVisitResult.SKIP_SUBTREE;
+                }
+            }
+            @Override
+            public FileVisitResult visitFile(Path file, 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)));
+                }
+                return FileVisitResult.CONTINUE;
+            }
+        });
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdeps/Profiles.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,241 @@
+/*
+ * 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));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,59 @@
+main.usage.summary=\
+Usage: {0} <options> <classes...>\n\
+use -h, -? or --help for a list of possible options
+
+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:
+
+error.prefix=Error:
+warn.prefix=Warning:
+
+main.opt.h=\
+\  -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"
+
+main.opt.v=\
+\  -v         --verbose                 Print additional information
+
+main.opt.s=\
+\  -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)
+
+main.opt.e=\
+\  -e <regex> --regex=<regex>           Restrict analysis to packages matching pattern\n\
+\                                       (-p and -e are exclusive)
+
+main.opt.P=\
+\  -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.R=\
+\  -R         --recursive               Recursively traverse all dependencies
+
+main.opt.d=\
+\  -d <depth> --depth=<depth>           Specify the depth of the transitive dependency analysis
+
+err.unknown.option=unknown option: {0}
+err.missing.arg=no value given for {0}
+err.internal.error=internal error: {0} {1} {2}
+err.invalid.arg.for.option=invalid argument for option: {0}
+err.option.after.class=option must be specified before classes: {0}
+err.option.unsupported={0} not supported: {1}
+err.profiles.msg=No profile information
+warn.invalid.arg=Invalid classname or pathname not exist: {0}
+warn.split.package=package {0} defined in {1} {2}
+
+artifact.not.found=not found
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdeps/resources/version.properties-template	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+#
+# 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.  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.
+#
+
+jdk=$(JDK_VERSION)
+full=$(FULL_VERSION)
+release=$(RELEASE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/BuildState.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,275 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The build state class captures the source code and generated artifacts
+ * from a build. There are usually two build states, the previous one (prev),
+ * loaded from the javac_state file, and the current one (now).
+ *
+ * <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 BuildState {
+    private Map<String,Module> modules = new HashMap<String,Module>();
+    private Map<String,Package> packages = new HashMap<String,Package>();
+    private Map<String,Source> sources = new HashMap<String,Source>();
+    private Map<String,File> artifacts = new HashMap<String,File>();
+    // Map from package to a set of packages that depend on said package.
+    private Map<String,Set<String>> dependents = new HashMap<String,Set<String>>();
+
+    public  Map<String,Module> modules() { return modules; }
+    public  Map<String,Package> packages() { return packages; }
+    public  Map<String,Source> sources() { return sources; }
+    public  Map<String,File> artifacts() { return artifacts; }
+    public  Map<String,Set<String>> dependents() { return dependents; }
+
+    /**
+     * Lookup a module from a name. Create the module if it does
+     * not exist yet.
+     */
+    public Module lookupModule(String mod) {
+        Module m = modules.get(mod);
+        if (m == null) {
+            m = new Module(mod, "???");
+            modules.put(mod, m);
+        }
+        return m;
+    }
+
+    /**
+     * Find a module from a given package name. For example:
+     * The package name "base:java.lang" will fetch the module named "base".
+     * The package name ":java.net" will fetch the default module.
+     */
+    Module findModuleFromPackageName(String pkg) {
+        int cp = pkg.indexOf(':');
+        assert(cp != -1);
+        String mod = pkg.substring(0, cp);
+        return lookupModule(mod);
+    }
+
+    /**
+     * Collect all packages, sources and artifacts for all modules
+     * into the build state.
+     *
+     * @param m The set of modules.
+     */
+    public void collectPackagesSourcesAndArtifacts(Map<String,Module> m) {
+        modules = m;
+        // Extract all the found packages.
+        for (Module i : modules.values()) {
+            for (Map.Entry<String,Package> j : i.packages().entrySet()) {
+                Package p = packages.get(j.getKey());
+                // Check that no two different packages are stored under same name.
+                assert(p == null || p == j.getValue());
+                if (p == null) {
+                    p = j.getValue();
+                    packages.put(j.getKey(),j.getValue());
+                }
+                for (Map.Entry<String,Source> k : p.sources().entrySet()) {
+                    Source s = sources.get(k.getKey());
+                    // Check that no two different sources are stored under same name.
+                    assert(s == null || s == k.getValue());
+                    if (s == null) {
+                        s = k.getValue();
+                        sources.put(k.getKey(), k.getValue());
+                    }
+                }
+                for (Map.Entry<String,File> g : p.artifacts().entrySet()) {
+                    File f = artifacts.get(g.getKey());
+                    // Check that no two artifacts are stored under the same file.
+                    assert(f == null || f == g.getValue());
+                    if (f == null) {
+                        f = g.getValue();
+                        artifacts.put(g.getKey(), g.getValue());
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Collect all the artifacts of all modules and packages.
+     *
+     * @param m The set of modules.
+     */
+    public void collectArtifacts(Map<String,Module> m) {
+        modules = m;
+        // Extract all the found packages.
+        for (Module i : modules.values()) {
+            for (Map.Entry<String,Package> j : i.packages().entrySet()) {
+                Package p = packages.get(j.getKey());
+                // Check that no two different packages are stored under same name.
+                assert(p == null || p == j.getValue());
+                p = j.getValue();
+                packages.put(j.getKey(),j.getValue());
+                for (Map.Entry<String,File> g : p.artifacts().entrySet()) {
+                    File f = artifacts.get(g.getKey());
+                    // Check that no two artifacts are stored under the same file.
+                    assert(f == null || f == g.getValue());
+                    artifacts.put(g.getKey(), g.getValue());
+                }
+            }
+        }
+    }
+
+    /**
+     * Calculate the package dependents (ie the reverse of the dependencies).
+     */
+    public void calculateDependents() {
+        dependents = new HashMap<String,Set<String>>();
+        for (String s : packages.keySet()) {
+            Package p = packages.get(s);
+            for (String d : p.dependencies()) {
+                Set<String> ss = dependents.get(d);
+                if (ss == null) {
+                    ss = new HashSet<String>();
+                    dependents.put(d, ss);
+                }
+                // Add the dependent information to the global dependent map.
+                ss.add(s);
+                Package dp = packages.get(d);
+                // Also add the dependent information to the package specific map.
+                // Normally, you do not compile java.lang et al. Therefore
+                // there are several packages that p depends upon that you
+                // do not have in your state database. This is perfectly fine.
+                if (dp != null) {
+                    // But this package did exist in the state database.
+                    dp.addDependent(p.name());
+                }
+            }
+        }
+    }
+
+    /**
+     * Verify that the setModules method above did the right thing when
+     * running through the module->package->source structure.
+     */
+    public void checkInternalState(String msg, boolean linkedOnly, Map<String,Source> srcs) {
+        boolean baad = false;
+        Map<String,Source> original = new HashMap<String,Source>();
+        Map<String,Source> calculated = new HashMap<String,Source>();
+
+        for (String s : sources.keySet()) {
+            Source ss = sources.get(s);
+            if (ss.isLinkedOnly() == linkedOnly) {
+                calculated.put(s,ss);
+            }
+        }
+        for (String s : srcs.keySet()) {
+            Source ss = srcs.get(s);
+            if (ss.isLinkedOnly() == linkedOnly) {
+                original.put(s,ss);
+            }
+        }
+        if (original.size() != calculated.size()) {
+            Log.error("INTERNAL ERROR "+msg+" original and calculated are not the same size!");
+            baad = true;
+        }
+        if (!original.keySet().equals(calculated.keySet())) {
+            Log.error("INTERNAL ERROR "+msg+" original and calculated do not have the same domain!");
+            baad = true;
+        }
+        if (!baad) {
+            for (String s : original.keySet()) {
+                Source s1 = original.get(s);
+                Source s2 = calculated.get(s);
+                if (s1 == null || s2 == null || !s1.equals(s2)) {
+                    Log.error("INTERNAL ERROR "+msg+" original and calculated have differing elements for "+s);
+                }
+                baad = true;
+            }
+        }
+        if (baad) {
+            for (String s : original.keySet()) {
+                Source ss = original.get(s);
+                Source sss = calculated.get(s);
+                if (sss == null) {
+                    Log.error("The file "+s+" does not exist in calculated tree of sources.");
+                }
+            }
+            for (String s : calculated.keySet()) {
+                Source ss = calculated.get(s);
+                Source sss = original.get(s);
+                if (sss == null) {
+                    Log.error("The file "+s+" does not exist in original set of found sources.");
+                }
+            }
+        }
+    }
+
+    /**
+     * Load a module from the javac state file.
+     */
+    public Module loadModule(String l) {
+        Module m = Module.load(l);
+        modules.put(m.name(), m);
+        return m;
+    }
+
+    /**
+     * Load a package from the javac state file.
+     */
+    public Package loadPackage(Module lastModule, String l) {
+        Package p = Package.load(lastModule, l);
+        lastModule.addPackage(p);
+        packages.put(p.name(), p);
+        return p;
+    }
+
+    /**
+     * Load a source from the javac state file.
+     */
+    public Source loadSource(Package lastPackage, String l, boolean is_generated) {
+        Source s = Source.load(lastPackage, l, is_generated);
+        lastPackage.addSource(s);
+        sources.put(s.name(), s);
+        return s;
+    }
+
+    /**
+     * During an incremental compile we need to copy the old javac state
+     * information about packages that were not recompiled.
+     */
+    public void copyPackagesExcept(BuildState prev, Set<String> recompiled, Set<String> removed) {
+        for (String pkg : prev.packages().keySet()) {
+            // Do not copy recompiled or removed packages.
+            if (recompiled.contains(pkg) || removed.contains(pkg)) continue;
+            Module mnew = findModuleFromPackageName(pkg);
+            Package pprev = prev.packages().get(pkg);
+            mnew.addPackage(pprev);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/CleanProperties.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2001, 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.
+ */
+
+package com.sun.tools.sjavac;
+
+import java.io.*;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * The clean properties transform should not be necessary.
+ * Eventually we will cleanup the property file sources in the OpenJDK instead.
+ *
+ * <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 CleanProperties implements Transformer
+{
+    public void setExtra(String e) {
+        // Any extra information is ignored for clean properties.
+    }
+
+    public void setExtra(String[] a) {
+        // Any extra information is ignored for clean properties.
+    }
+
+    public boolean transform(Map<String,Set<URI>> pkgSrcs,
+                             Set<URI>             visibleSrcs,
+                             Map<URI,Set<String>> visibleClasses,
+                             Map<String,Set<String>> oldPackageDependencies,
+                             URI destRoot,
+                             Map<String,Set<URI>>    packageArtifacts,
+                             Map<String,Set<String>> packageDependencies,
+                             Map<String,String>      packagePublicApis,
+                             int debugLevel,
+                             boolean incremental,
+                             int numCores,
+                             PrintStream out,
+                             PrintStream err)
+    {
+        boolean rc = true;
+        for (String pkgName : pkgSrcs.keySet()) {
+            String pkgNameF = pkgName.replace('.',File.separatorChar);
+            for (URI u : pkgSrcs.get(pkgName)) {
+                File src = new File(u);
+                boolean r = clean(pkgName, pkgNameF, src, new File(destRoot), debugLevel,
+                                  packageArtifacts);
+                if (r == false) {
+                    rc = false;
+                }
+            }
+        }
+        return rc;
+    }
+
+    boolean clean(String pkgName, String pkgNameF, File src, File destRoot, int debugLevel,
+                  Map<String,Set<URI>> packageArtifacts)
+    {
+        // Load the properties file.
+        Properties p = new Properties();
+        try {
+            p.load(new FileInputStream(src));
+        } catch (IOException e) {
+            Log.error("Error reading file "+src.getPath());
+            return false;
+        }
+
+        // Sort the properties in increasing key order.
+        List<String> sortedKeys = new ArrayList<String>();
+        for (Object key : p.keySet()) {
+            sortedKeys.add((String)key);
+        }
+        Collections.sort(sortedKeys);
+        Iterator<String> keys = sortedKeys.iterator();
+
+        // Collect the properties into a string buffer.
+        StringBuilder data = new StringBuilder();
+        while (keys.hasNext()) {
+            String key = keys.next();
+            data.append(CompileProperties.escape(key)+":"+CompileProperties.escape((String)p.get(key))+"\n");
+        }
+
+        String destFilename = destRoot.getPath()+File.separator+pkgNameF+File.separator+src.getName();
+        File dest = new File(destFilename);
+
+        // Make sure the dest directories exist.
+        if (!dest.getParentFile().isDirectory()) {
+            if (!dest.getParentFile().mkdirs()) {
+                Log.error("Could not create the directory "+dest.getParentFile().getPath());
+                return false;
+            }
+        }
+
+        Set<URI> as = packageArtifacts.get(pkgName);
+        if (as == null) {
+            as = new HashSet<URI>();
+            packageArtifacts.put(pkgName, as);
+        }
+        as.add(dest.toURI());
+
+        if (dest.exists() && dest.lastModified() > src.lastModified()) {
+            // A cleaned property file exists, and its timestamp is newer than the source.
+            // Assume that we do not need to clean!
+            // Thus we are done.
+            return true;
+        }
+
+        Log.info("Cleaning property file "+pkgNameF+File.separator+src.getName());
+        try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dest)))) {
+            writer.write(data.toString());
+        } catch ( IOException e ) {
+            Log.error("Could not write file "+dest.getPath());
+            return false;
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/CompileChunk.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,57 @@
+/*
+ * 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.  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.sjavac;
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A compile chunk is a list of sources/packages to be compiled. Possibly a subset of
+ * the total number of sources/packages to be compiled for this sjavac invocation.
+ *
+ * <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 CompileChunk implements Comparable<CompileChunk> {
+    public int numPackages;
+    public int numDependents;
+    public Set<URI> srcs = new HashSet<URI>();
+    public StringBuilder pkgNames = new StringBuilder();
+    public String pkgFromTos = "";
+
+    public int compareTo(CompileChunk c) {
+        if (numDependents == c.numDependents) return 0;
+        if (numDependents > c.numDependents) return -1;
+        return -1;
+    }
+
+    boolean equal(CompileChunk c) {
+        return numDependents == c.numDependents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,344 @@
+/*
+ * 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.  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.sjavac;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Random;
+import java.util.Set;
+import java.util.Map;
+
+import com.sun.tools.sjavac.server.JavacServer;
+import com.sun.tools.sjavac.server.SysInfo;
+import java.io.PrintStream;
+
+/**
+ * This transform compiles a set of packages containing Java sources.
+ * The compile request is divided into separate sets of source files.
+ * For each set a separate request thread is dispatched to a javac server
+ * and the meta data is accumulated. The number of sets correspond more or
+ * less to the number of cores. Less so now, than it will in the future.
+ *
+ * <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 CompileJavaPackages implements Transformer {
+
+    // The current limited sharing of data between concurrent JavaCompilers
+    // in the server will not give speedups above 3 cores. Thus this limit.
+    // We hope to improve this in the future.
+    final static int limitOnConcurrency = 3;
+
+    String serverSettings;
+    public void setExtra(String e) {
+        serverSettings = e;
+    }
+
+    String[] args;
+    public void setExtra(String[] a) {
+        args = a;
+    }
+
+    public boolean transform(Map<String,Set<URI>> pkgSrcs,
+                             Set<URI>             visibleSources,
+                             Map<URI,Set<String>> visibleClasses,
+                             Map<String,Set<String>> oldPackageDependents,
+                             URI destRoot,
+                             final Map<String,Set<URI>>    packageArtifacts,
+                             final Map<String,Set<String>> packageDependencies,
+                             final Map<String,String>      packagePubapis,
+                             int debugLevel,
+                             boolean incremental,
+                             int numCores,
+                             PrintStream out,
+                             PrintStream err)
+    {
+        boolean rc = true;
+        boolean concurrentCompiles = true;
+
+        // Fetch the id.
+        String id = Util.extractStringOption("id", serverSettings);
+        if (id == null || id.equals("")) {
+            // No explicit id set. Create a random id so that the requests can be
+            // grouped properly in the server.
+            id = "id"+(((new Random()).nextLong())&Long.MAX_VALUE);
+        }
+        // Only keep portfile and sjavac settings..
+        String psServerSettings = Util.cleanSubOptions("--server:", Util.set("portfile","sjavac","background","keepalive"), serverSettings);
+
+        // Get maximum heap size from the server!
+        SysInfo sysinfo = JavacServer.connectGetSysInfo(psServerSettings, out, err);
+        if (sysinfo.numCores == -1) {
+            Log.error("Could not query server for sysinfo!");
+            return false;
+        }
+        int numMBytes = (int)(sysinfo.maxMemory / ((long)(1024*1024)));
+        Log.debug("Server reports "+numMBytes+"MiB of memory and "+sysinfo.numCores+" cores");
+
+        if (numCores <= 0) {
+            // Set the requested number of cores to the number of cores on the server.
+            numCores = sysinfo.numCores;
+            Log.debug("Number of jobs not explicitly set, defaulting to "+sysinfo.numCores);
+        } else if (sysinfo.numCores < numCores) {
+            // Set the requested number of cores to the number of cores on the server.
+            Log.debug("Limiting jobs from explicitly set "+numCores+" to cores available on server: "+sysinfo.numCores);
+            numCores = sysinfo.numCores;
+        } else {
+            Log.debug("Number of jobs explicitly set to "+numCores);
+        }
+        // More than three concurrent cores does not currently give a speedup, at least for compiling the jdk
+        // in the OpenJDK. This will change in the future.
+        int numCompiles = numCores;
+        if (numCores > limitOnConcurrency) numCompiles = limitOnConcurrency;
+        // Split the work up in chunks to compiled.
+
+        int numSources = 0;
+        for (String s : pkgSrcs.keySet()) {
+            Set<URI> ss = pkgSrcs.get(s);
+            numSources += ss.size();
+        }
+
+        int sourcesPerCompile = numSources / numCompiles;
+
+        // For 64 bit Java, it seems we can compile the OpenJDK 8800 files with a 1500M of heap
+        // in a single chunk, with reasonable performance.
+        // For 32 bit java, it seems we need 1G of heap.
+        // Number experimentally determined when compiling the OpenJDK.
+        // Includes space for reasonably efficient garbage collection etc,
+        // Calculating backwards gives us a requirement of
+        // 1500M/8800 = 175 KiB for 64 bit platforms
+        // and 1G/8800 = 119 KiB for 32 bit platform
+        // for each compile.....
+        int kbPerFile = 175;
+        String osarch = System.getProperty("os.arch");
+        if (osarch.equals("i386")) {
+            // For 32 bit platforms, assume it is slightly smaller
+            // because of smaller object headers and pointers.
+            kbPerFile = 119;
+        }
+        int numRequiredMBytes = (kbPerFile*numSources)/1024;
+        Log.debug("For os.arch "+osarch+" the empirically determined heap required per file is "+kbPerFile+"KiB");
+        Log.debug("Server has "+numMBytes+"MiB of heap.");
+        Log.debug("Heuristics say that we need "+numRequiredMBytes+"MiB of heap for all source files.");
+        // Perform heuristics to see how many cores we can use,
+        // or if we have to the work serially in smaller chunks.
+        if (numMBytes < numRequiredMBytes) {
+            // Ouch, cannot fit even a single compile into the heap.
+            // Split it up into several serial chunks.
+            concurrentCompiles = false;
+            // Limit the number of sources for each compile to 500.
+            if (numSources < 500) {
+                numCompiles = 1;
+                sourcesPerCompile = numSources;
+                Log.debug("Compiling as a single source code chunk to stay within heap size limitations!");
+            } else if (sourcesPerCompile > 500) {
+                // This number is very low, and tuned to dealing with the OpenJDK
+                // where the source is >very< circular! In normal application,
+                // with less circularity the number could perhaps be increased.
+                numCompiles = numSources / 500;
+                sourcesPerCompile = numSources/numCompiles;
+                Log.debug("Compiling source as "+numCompiles+" code chunks serially to stay within heap size limitations!");
+            }
+        } else {
+            if (numCompiles > 1) {
+                // Ok, we can fit at least one full compilation on the heap.
+                float usagePerCompile = (float)numRequiredMBytes / ((float)numCompiles * (float)0.7);
+                int usage = (int)(usagePerCompile * (float)numCompiles);
+                Log.debug("Heuristics say that for "+numCompiles+" concurrent compiles we need "+usage+"MiB");
+                if (usage > numMBytes) {
+                    // Ouch it does not fit. Reduce to a single chunk.
+                    numCompiles = 1;
+                    sourcesPerCompile = numSources;
+                    // What if the relationship betweem number of compile_chunks and num_required_mbytes
+                    // is not linear? Then perhaps 2 chunks would fit where 3 does not. Well, this is
+                    // something to experiment upon in the future.
+                    Log.debug("Limiting compile to a single thread to stay within heap size limitations!");
+                }
+            }
+        }
+
+        Log.debug("Compiling sources in "+numCompiles+" chunk(s)");
+
+        // Create the chunks to be compiled.
+        final CompileChunk[] compileChunks = createCompileChunks(pkgSrcs, oldPackageDependents,
+                numCompiles, sourcesPerCompile);
+
+        if (Log.isDebugging()) {
+            int cn = 1;
+            for (CompileChunk cc : compileChunks) {
+                Log.debug("Chunk "+cn+" for "+id+" ---------------");
+                cn++;
+                for (URI u : cc.srcs) {
+                    Log.debug(""+u);
+                }
+            }
+        }
+
+        // The return values for each chunked compile.
+        final int[] rn = new int[numCompiles];
+        // The requets, might or might not run as a background thread.
+        final Thread[] requests  = new Thread[numCompiles];
+
+        final Set<URI>             fvisible_sources = visibleSources;
+        final Map<URI,Set<String>> fvisible_classes = visibleClasses;
+
+        long start = System.currentTimeMillis();
+
+        for (int i=0; i<numCompiles; ++i) {
+            final int ii = i;
+            final CompileChunk cc = compileChunks[i];
+
+            // Pass the num_cores and the id (appended with the chunk number) to the server.
+            final String cleanedServerSettings = psServerSettings+",poolsize="+numCores+",id="+id+"-"+ii;
+            final PrintStream fout = out;
+            final PrintStream ferr = err;
+
+            requests[ii] = new Thread() {
+                @Override
+                public void run() {
+                                        rn[ii] = JavacServer.useServer(cleanedServerSettings,
+                                                           Main.removeWrapperArgs(args),
+                                                               cc.srcs,
+                                                           fvisible_sources,
+                                                           fvisible_classes,
+                                                           packageArtifacts,
+                                                           packageDependencies,
+                                                           packagePubapis,
+                                                           null,
+                                                           fout, ferr);
+                }
+            };
+
+            if (cc.srcs.size() > 0) {
+                String numdeps = "";
+                if (cc.numDependents > 0) numdeps = "(with "+cc.numDependents+" dependents) ";
+                if (!incremental || cc.numPackages > 16) {
+                    String info = "("+cc.pkgFromTos+")";
+                    if (info.equals("( to )")) {
+                        info = "";
+                    }
+                    Log.info("Compiling "+cc.srcs.size()+" files "+numdeps+"in "+cc.numPackages+" packages "+info);
+                } else {
+                    Log.info("Compiling "+cc.pkgNames+numdeps);
+                }
+                if (concurrentCompiles) {
+                    requests[ii].start();
+                }
+                else {
+                    requests[ii].run();
+                    // If there was an error, then stop early when running single threaded.
+                    if (rn[i] != 0) {
+                        return false;
+                    }
+                }
+            }
+        }
+        if (concurrentCompiles) {
+            // If there are background threads for the concurrent compiles, then join them.
+            for (int i=0; i<numCompiles; ++i) {
+                try { requests[i].join(); } catch (InterruptedException e) { }
+            }
+        }
+
+        // Check the return values.
+        for (int i=0; i<numCompiles; ++i) {
+            if (compileChunks[i].srcs.size() > 0) {
+                if (rn[i] != 0) {
+                    rc = false;
+                }
+            }
+        }
+        long duration = System.currentTimeMillis() - start;
+        long minutes = duration/60000;
+        long seconds = (duration-minutes*60000)/1000;
+        Log.debug("Compilation of "+numSources+" source files took "+minutes+"m "+seconds+"s");
+
+        return rc;
+    }
+
+
+    /**
+     * Split up the sources into compile chunks. If old package dependents information
+     * is available, sort the order of the chunks into the most dependent first!
+     * (Typically that chunk contains the java.lang package.) In the future
+     * we could perhaps improve the heuristics to put the sources into even more sensible chunks.
+     * Now the package are simple sorted in alphabetical order and chunked, then the chunks
+     * are sorted on how dependent they are.
+     *
+     * @param pkgSrcs The sources to compile.
+     * @param oldPackageDependents Old package dependents, if non-empty, used to sort the chunks.
+     * @param numCompiles The number of chunks.
+     * @param sourcesPerCompile The number of sources per chunk.
+     * @return
+     */
+    CompileChunk[] createCompileChunks(Map<String,Set<URI>> pkgSrcs,
+                                 Map<String,Set<String>> oldPackageDependents,
+                                 int numCompiles,
+                                 int sourcesPerCompile) {
+
+        CompileChunk[] compileChunks = new CompileChunk[numCompiles];
+        for (int i=0; i<compileChunks.length; ++i) {
+            compileChunks[i] = new CompileChunk();
+        }
+
+        // Now go through the packages and spread out the source on the different chunks.
+        int ci = 0;
+        // Sort the packages
+        String[] packageNames = pkgSrcs.keySet().toArray(new String[0]);
+        Arrays.sort(packageNames);
+        String from = null;
+        for (String pkgName : packageNames) {
+            CompileChunk cc = compileChunks[ci];
+            Set<URI> s = pkgSrcs.get(pkgName);
+            if (cc.srcs.size()+s.size() > sourcesPerCompile && ci < numCompiles-1) {
+                from = null;
+                ci++;
+                cc = compileChunks[ci];
+            }
+            cc.numPackages++;
+            cc.srcs.addAll(s);
+
+            // Calculate nice package names to use as information when compiling.
+            String justPkgName = Util.justPackageName(pkgName);
+            // Fetch how many packages depend on this package from the old build state.
+            Set<String> ss = oldPackageDependents.get(pkgName);
+            if (ss != null) {
+                // Accumulate this information onto this chunk.
+                cc.numDependents += ss.size();
+            }
+            if (from == null || from.trim().equals("")) from = justPkgName;
+            cc.pkgNames.append(justPkgName+"("+s.size()+") ");
+            cc.pkgFromTos = from+" to "+justPkgName;
+        }
+        // If we are compiling serially, sort the chunks, so that the chunk (with the most dependents) (usually the chunk
+        // containing java.lang.Object, is to be compiled first!
+        // For concurrent compilation, this does not matter.
+        Arrays.sort(compileChunks);
+        return compileChunks;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/CompileProperties.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,221 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.*;
+import java.net.URI;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * Compile properties transform a properties file into a Java source file.
+ * Java has built in support for reading properties from either a text file
+ * in the source or a compiled java source file.
+ *
+ * <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 CompileProperties implements Transformer
+{
+    // Any extra information passed from the command line, for example if:
+    // -tr .proppp=com.sun.tools.javac.smart.CompileProperties,sun.util.resources.LocaleNamesBundle
+    // then extra will be "sun.util.resources.LocaleNamesBundle"
+    String extra;
+
+    public void setExtra(String e) {
+        extra = e;
+    }
+
+    public void setExtra(String[] a) {
+    }
+
+    public boolean transform(Map<String,Set<URI>> pkgSrcs,
+                             Set<URI>             visibleSrcs,
+                             Map<URI,Set<String>> visibleClasses,
+                             Map<String,Set<String>> oldPackageDependents,
+                             URI destRoot,
+                             Map<String,Set<URI>>    packageArtifacts,
+                             Map<String,Set<String>> packageDependencies,
+                             Map<String,String>      packagePublicApis,
+                             int debugLevel,
+                             boolean incremental,
+                             int numCores,
+                             PrintStream out,
+                             PrintStream err) {
+        boolean rc = true;
+        for (String pkgName : pkgSrcs.keySet()) {
+            String pkgNameF = Util.toFileSystemPath(pkgName);
+            for (URI u : pkgSrcs.get(pkgName)) {
+                File src = new File(u);
+                boolean r = compile(pkgName, pkgNameF, src, new File(destRoot), debugLevel,
+                                    packageArtifacts);
+                if (r == false) {
+                    rc = false;
+                }
+            }
+        }
+        return rc;
+    }
+
+    boolean compile(String pkgName, String pkgNameF, File src, File destRoot, int debugLevel,
+                    Map<String,Set<URI>> packageArtifacts)
+    {
+        String superClass = "java.util.ListResourceBundle";
+
+        if (extra != null) {
+            superClass = extra;
+        }
+        // Load the properties file.
+        Properties p = new Properties();
+        try {
+            p.load(new FileInputStream(src));
+        } catch (IOException e) {
+            Log.error("Error reading file "+src.getPath());
+            return false;
+        }
+
+        // Calculate the name of the Java source file to be generated.
+        int dp = src.getName().lastIndexOf(".");
+        String classname = src.getName().substring(0,dp);
+
+        // Sort the properties in increasing key order.
+        List<String> sortedKeys = new ArrayList<String>();
+        for (Object key : p.keySet()) {
+            sortedKeys.add((String)key);
+        }
+        Collections.sort(sortedKeys);
+        Iterator<String> keys = sortedKeys.iterator();
+
+        // Collect the properties into a string buffer.
+        StringBuilder data = new StringBuilder();
+        while (keys.hasNext()) {
+            String key = keys.next();
+            data.append("            { \"" + escape(key) + "\", \"" +
+                        escape((String)p.get(key)) + "\" },\n");
+        }
+
+        // Create dest file name. It is derived from the properties file name.
+        String destFilename = destRoot.getPath()+File.separator+pkgNameF+File.separator+classname+".java";
+        File dest = new File(destFilename);
+
+        // Make sure the dest directories exist.
+        if (!dest.getParentFile().isDirectory()) {
+            if (!dest.getParentFile().mkdirs()) {
+                Log.error("Could not create the directory "+dest.getParentFile().getPath());
+                return false;
+            }
+        }
+
+        Set<URI> as = packageArtifacts.get(pkgName);
+        if (as == null) {
+            as = new HashSet<URI>();
+            packageArtifacts.put(pkgName, as);
+        }
+        as.add(dest.toURI());
+
+        if (dest.exists() && dest.lastModified() > src.lastModified()) {
+            // A generated file exists, and its timestamp is newer than the source.
+            // Assume that we do not need to regenerate the dest file!
+            // Thus we are done.
+            return true;
+        }
+
+        String packageString = "package " + pkgNameF.replace(File.separatorChar,'.') + ";\n\n";
+
+        Log.info("Compiling property file "+pkgNameF+File.separator+src.getName());
+        try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dest)))) {
+            MessageFormat format = new MessageFormat(FORMAT);
+            writer.write(format.format(new Object[] { packageString, classname, superClass, data }));
+        } catch ( IOException e ) {
+            Log.error("Could not write file "+dest.getPath());
+            return false;
+        }
+        return true;
+    }
+
+    private static final String FORMAT =
+            "{0}" +
+            "public final class {1} extends {2} '{'\n" +
+            "    protected final Object[][] getContents() '{'\n" +
+            "        return new Object[][] '{'\n" +
+            "{3}" +
+            "        };\n" +
+            "    }\n" +
+            "}\n";
+
+    public static String escape(String theString) {
+        int len = theString.length();
+        StringBuilder outBuffer = new StringBuilder(len*2);
+
+        for(int x=0; x<len; x++) {
+            char aChar = theString.charAt(x);
+            switch(aChar) {
+                case '\\':outBuffer.append('\\'); outBuffer.append('\\');
+                break;
+                case '\t':outBuffer.append('\\'); outBuffer.append('t');
+                break;
+                case '\n':outBuffer.append('\\'); outBuffer.append('n');
+                break;
+                case '\r':outBuffer.append('\\'); outBuffer.append('r');
+                break;
+                case '\f':outBuffer.append('\\'); outBuffer.append('f');
+                break;
+                default:
+                    if ((aChar < 0x0020) || (aChar > 0x007e)) {
+                        outBuffer.append('\\');
+                        outBuffer.append('u');
+                        outBuffer.append(toHex((aChar >> 12) & 0xF));
+                        outBuffer.append(toHex((aChar >>  8) & 0xF));
+                        outBuffer.append(toHex((aChar >>  4) & 0xF));
+                        outBuffer.append(toHex( aChar        & 0xF));
+                    } else {
+                        if (aChar == '"') {
+                            outBuffer.append('\\');
+                        }
+                        outBuffer.append(aChar);
+                    }
+            }
+        }
+        return outBuffer.toString();
+    }
+
+    private static char toHex(int nibble) {
+        return hexDigit[(nibble & 0xF)];
+    }
+
+    private static final char[] hexDigit = {
+        '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/CopyFile.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,116 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.*;
+import java.net.URI;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * The copy file transform simply copies a matching file from -src to -d .
+ * Such files are typically images, xml documents and other data files.
+ *
+ * <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 CopyFile implements Transformer {
+
+    public void setExtra(String e) {
+    }
+
+    public void setExtra(String[] a) {
+    }
+
+    public boolean transform(Map<String,Set<URI>> pkgSrcs,
+                             Set<URI> visibleSrcs,
+                             Map<URI,Set<String>> visibleClasses,
+                             Map<String,Set<String>> oldPackageDependents,
+                             URI destRoot,
+                             Map<String,Set<URI>>    packageArtifacts,
+                             Map<String,Set<String>> packageDependencies,
+                             Map<String,String>      packagePubapis,
+                             int debugLevel,
+                             boolean incremental,
+                             int numCores,
+                             PrintStream out,
+                             PrintStream err)
+    {
+        boolean rc = true;
+        String dest_filename;
+        File dest;
+
+        for (String pkgName : pkgSrcs.keySet()) {
+            String pkgNameF = Util.toFileSystemPath(pkgName);
+            for (URI u : pkgSrcs.get(pkgName)) {
+                File src = new File(u);
+                File destDir;
+                destDir = new File(destRoot.getPath()+File.separator+pkgNameF);
+                dest_filename = destRoot.getPath()+File.separator+pkgNameF+File.separator+src.getName();
+                dest = new File(dest_filename);
+
+                if (!destDir.isDirectory()) {
+                    if (!destDir.mkdirs()) {
+                       Log.error("Error: The copier could not create the directory "+
+                                           destDir.getPath());
+                        return false;
+                    }
+                }
+
+                Set<URI> as = packageArtifacts.get(pkgName);
+                if (as == null) {
+                    as = new HashSet<URI>();
+                    packageArtifacts.put(pkgName, as);
+                }
+                as.add(dest.toURI());
+
+                if (dest.exists() && dest.lastModified() > src.lastModified()) {
+                    // A copied file exists, and its timestamp is newer than the source.
+                    continue;
+                }
+
+                Log.info("Copying "+pkgNameF+File.separator+src.getName());
+
+                try (InputStream fin = new FileInputStream(src);
+                     OutputStream fout = new FileOutputStream(dest)) {
+                    byte[] buf = new byte[1024];
+                    int len;
+                    while ((len = fin.read(buf)) > 0){
+                        fout.write(buf, 0, len);
+                    }
+                }
+                catch(IOException e){
+                    Log.error("Could not copy the file "+src.getPath()+" to "+dest.getPath());
+                    rc = false;
+                }
+            }
+        }
+        return rc;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/JavacState.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,857 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.*;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.text.SimpleDateFormat;
+import java.net.URI;
+import java.util.*;
+
+/**
+ * The javac state class maintains the previous (prev) and the current (now)
+ * build states and everything else that goes into the javac_state file.
+ *
+ * <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 JavacState
+{
+    // The arguments to the compile. If not identical, then it cannot
+    // be an incremental build!
+    String theArgs;
+    // The number of cores limits how many threads are used for heavy concurrent work.
+    int numCores;
+
+    // The bin_dir/javac_state
+    private String javacStateFilename;
+    private File javacState;
+
+    // The previous build state is loaded from javac_state
+    private BuildState prev;
+    // The current build state is constructed during the build,
+    // then saved as the new javac_state.
+    private BuildState now;
+
+    // Something has changed in the javac_state. It needs to be saved!
+    private boolean needsSaving;
+    // If this is a new javac_state file, then do not print unnecessary messages.
+    private boolean newJavacState;
+
+    // These are packages where something has changed and the package
+    // needs to be recompiled. Actions that trigger recompilation:
+    // * source belonging to the package has changed
+    // * artifact belonging to the package is lost, or its timestamp has been changed.
+    // * an unknown artifact has appeared, we simply delete it, but we also trigger a recompilation.
+    // * a package that is tainted, taints all packages that depend on it.
+    private Set<String> taintedPackages;
+    // After a compile, the pubapis are compared with the pubapis stored in the javac state file.
+    // Any packages where the pubapi differ are added to this set.
+    // Later we use this set and the dependency information to taint dependent packages.
+    private Set<String> packagesWithChangedPublicApis;
+    // When a module-info.java file is changed, taint the module,
+    // then taint all modules that depend on that that module.
+    // A module dependency can occur directly through a require, or
+    // indirectly through a module that does a public export for the first tainted module.
+    // When all modules are tainted, then taint all packages belonging to these modules.
+    // Then rebuild. It is perhaps possible (and valuable?) to do a more finegrained examination of the
+    // change in module-info.java, but that will have to wait.
+    private Set<String> taintedModules;
+    // The set of all packages that has been recompiled.
+    // Copy over the javac_state for the packages that did not need recompilation,
+    // verbatim from the previous (prev) to the new (now) build state.
+    private Set<String> recompiledPackages;
+
+    // The output directories filled with tasty artifacts.
+    private File binDir, gensrcDir, headerDir;
+
+    // The current status of the file system.
+    private Set<File> binArtifacts;
+    private Set<File> gensrcArtifacts;
+    private Set<File> headerArtifacts;
+
+    // The status of the sources.
+    Set<Source> removedSources = null;
+    Set<Source> addedSources = null;
+    Set<Source> modifiedSources = null;
+
+    // Visible sources for linking. These are the only
+    // ones that -sourcepath is allowed to see.
+    Set<URI> visibleSrcs;
+
+    // Visible classes for linking. These are the only
+    // ones that -classpath is allowed to see.
+    // It maps from a classpath root to the set of visible classes for that root.
+    // If the set is empty, then all classes are visible for that root.
+    // It can also map from a jar file to the set of visible classes for that jar file.
+    Map<URI,Set<String>> visibleClasses;
+
+    // Setup two transforms that always exist.
+    private CopyFile            copyFiles = new CopyFile();
+    private CompileJavaPackages compileJavaPackages = new CompileJavaPackages();
+
+    // Where to send stdout and stderr.
+    private PrintStream out, err;
+
+    JavacState(String[] args, File bd, File gd, File hd, boolean permitUnidentifiedArtifacts, boolean removeJavacState,
+            PrintStream o, PrintStream e) {
+        out = o;
+        err = e;
+        numCores = Main.findNumberOption(args, "-j");
+        theArgs = "";
+        for (String a : removeArgsNotAffectingState(args)) {
+            theArgs = theArgs+a+" ";
+        }
+        binDir = bd;
+        gensrcDir = gd;
+        headerDir = hd;
+        javacStateFilename = binDir.getPath()+File.separator+"javac_state";
+        javacState = new File(javacStateFilename);
+        if (removeJavacState && javacState.exists()) {
+            javacState.delete();
+        }
+        newJavacState = false;
+        if (!javacState.exists()) {
+            newJavacState = true;
+            // If there is no javac_state then delete the contents of all the artifact dirs!
+            // We do not want to risk building a broken incremental build.
+            // BUT since the makefiles still copy things straight into the bin_dir et al,
+            // we avoid deleting files here, if the option --permit-unidentified-classes was supplied.
+            if (!permitUnidentifiedArtifacts) {
+                deleteContents(binDir);
+                deleteContents(gensrcDir);
+                deleteContents(headerDir);
+            }
+            needsSaving = true;
+        }
+        prev = new BuildState();
+        now = new BuildState();
+        taintedPackages = new HashSet<String>();
+        recompiledPackages = new HashSet<String>();
+        packagesWithChangedPublicApis = new HashSet<String>();
+    }
+
+    public BuildState prev() { return prev; }
+    public BuildState now() { return now; }
+
+    /**
+     * Remove args not affecting the state.
+     */
+    static String[] removeArgsNotAffectingState(String[] args) {
+        String[] out = new String[args.length];
+        int j = 0;
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals("-j")) {
+                // Just skip it and skip following value
+                i++;
+            } else if (args[i].startsWith("--server:")) {
+                // Just skip it.
+            } else if (args[i].startsWith("--log=")) {
+                // Just skip it.
+            } else if (args[i].equals("--compare-found-sources")) {
+                // Just skip it and skip verify file name
+                i++;
+            } else {
+                // Copy argument.
+                out[j] = args[i];
+                j++;
+            }
+        }
+        String[] ret = new String[j];
+        System.arraycopy(out, 0, ret, 0, j);
+        return ret;
+    }
+
+    /**
+     * Specify which sources are visible to the compiler through -sourcepath.
+     */
+    public void setVisibleSources(Map<String,Source> vs) {
+        visibleSrcs = new HashSet<URI>();
+        for (String s : vs.keySet()) {
+            Source src = vs.get(s);
+            visibleSrcs.add(src.file().toURI());
+        }
+    }
+
+    /**
+     * Specify which classes are visible to the compiler through -classpath.
+     */
+    public void setVisibleClasses(Map<String,Source> vs) {
+        visibleSrcs = new HashSet<URI>();
+        for (String s : vs.keySet()) {
+            Source src = vs.get(s);
+            visibleSrcs.add(src.file().toURI());
+        }
+    }
+    /**
+     * Returns true if this is an incremental build.
+     */
+    public boolean isIncremental() {
+        return !prev.sources().isEmpty();
+    }
+
+    /**
+     * Find all artifacts that exists on disk.
+     */
+    public void findAllArtifacts() {
+        binArtifacts = findAllFiles(binDir);
+        gensrcArtifacts = findAllFiles(gensrcDir);
+        headerArtifacts = findAllFiles(headerDir);
+    }
+
+    /**
+     * Lookup the artifacts generated for this package in the previous build.
+     */
+    private Map<String,File> fetchPrevArtifacts(String pkg) {
+        Package p = prev.packages().get(pkg);
+        if (p != null) {
+            return p.artifacts();
+        }
+        return new HashMap<String,File>();
+    }
+
+    /**
+     * Delete all prev artifacts in the currently tainted packages.
+     */
+    public void deleteClassArtifactsInTaintedPackages() {
+        for (String pkg : taintedPackages) {
+            Map<String,File> arts = fetchPrevArtifacts(pkg);
+            for (File f : arts.values()) {
+                if (f.exists() && f.getName().endsWith(".class")) {
+                    f.delete();
+                }
+            }
+        }
+    }
+
+    /**
+     * Mark the javac_state file to be in need of saving and as a side effect,
+     * it gets a new timestamp.
+     */
+    private void needsSaving() {
+        needsSaving = true;
+    }
+
+    /**
+     * Save the javac_state file.
+     */
+    public void save() throws IOException {
+        if (!needsSaving) return;
+        try (FileWriter out = new FileWriter(javacStateFilename)) {
+            StringBuilder b = new StringBuilder();
+            long millisNow = System.currentTimeMillis();
+            Date d = new Date(millisNow);
+            SimpleDateFormat df =
+                new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
+            b.append("# javac_state ver 0.3 generated "+millisNow+" "+df.format(d)+"\n");
+            b.append("# This format might change at any time. Please do not depend on it.\n");
+            b.append("# M module\n");
+            b.append("# P package\n");
+            b.append("# S C source_tobe_compiled timestamp\n");
+            b.append("# S L link_only_source timestamp\n");
+            b.append("# G C generated_source timestamp\n");
+            b.append("# A artifact timestamp\n");
+            b.append("# D dependency\n");
+            b.append("# I pubapi\n");
+            b.append("# R arguments\n");
+            b.append("R ").append(theArgs).append("\n");
+
+            // Copy over the javac_state for the packages that did not need recompilation.
+            now.copyPackagesExcept(prev, recompiledPackages, new HashSet<String>());
+            // Save the packages, ie package names, dependencies, pubapis and artifacts!
+            // I.e. the lot.
+            Module.saveModules(now.modules(), b);
+
+            String s = b.toString();
+            out.write(s, 0, s.length());
+        }
+    }
+
+    /**
+     * Load a javac_state file.
+     */
+    public static JavacState load(String[] args, File binDir, File gensrcDir, File headerDir,
+            boolean permitUnidentifiedArtifacts, PrintStream out, PrintStream err) {
+        JavacState db = new JavacState(args, binDir, gensrcDir, headerDir, permitUnidentifiedArtifacts, false, out, err);
+        Module  lastModule = null;
+        Package lastPackage = null;
+        Source  lastSource = null;
+        boolean noFileFound = false;
+        boolean foundCorrectVerNr = false;
+        boolean newCommandLine = false;
+        boolean syntaxError = false;
+
+        try (BufferedReader in = new BufferedReader(new FileReader(db.javacStateFilename))) {
+            for (;;) {
+                String l = in.readLine();
+                if (l==null) break;
+                if (l.length()>=3 && l.charAt(1) == ' ') {
+                    char c = l.charAt(0);
+                    if (c == 'M') {
+                        lastModule = db.prev.loadModule(l);
+                    } else
+                    if (c == 'P') {
+                        if (lastModule == null) { syntaxError = true; break; }
+                        lastPackage = db.prev.loadPackage(lastModule, l);
+                    } else
+                    if (c == 'D') {
+                        if (lastModule == null || lastPackage == null) { syntaxError = true; break; }
+                        lastPackage.loadDependency(l);
+                    } else
+                    if (c == 'I') {
+                        if (lastModule == null || lastPackage == null) { syntaxError = true; break; }
+                        lastPackage.loadPubapi(l);
+                    } else
+                    if (c == 'A') {
+                        if (lastModule == null || lastPackage == null) { syntaxError = true; break; }
+                        lastPackage.loadArtifact(l);
+                    } else
+                    if (c == 'S') {
+                        if (lastModule == null || lastPackage == null) { syntaxError = true; break; }
+                        lastSource = db.prev.loadSource(lastPackage, l, false);
+                    } else
+                    if (c == 'G') {
+                        if (lastModule == null || lastPackage == null) { syntaxError = true; break; }
+                        lastSource = db.prev.loadSource(lastPackage, l, true);
+                    } else
+                    if (c == 'R') {
+                        String ncmdl = "R "+db.theArgs;
+                        if (!l.equals(ncmdl)) {
+                            newCommandLine = true;
+                        }
+                    } else
+                         if (c == '#') {
+                        if (l.startsWith("# javac_state ver ")) {
+                            int sp = l.indexOf(" ", 18);
+                            if (sp != -1) {
+                                String ver = l.substring(18,sp);
+                                if (!ver.equals("0.3")) {
+                    break;
+                                 }
+                foundCorrectVerNr = true;
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (FileNotFoundException e) {
+            // Silently create a new javac_state file.
+            noFileFound = true;
+        } catch (IOException e) {
+            Log.info("Dropping old javac_state because of errors when reading it.");
+            db = new JavacState(args, binDir, gensrcDir, headerDir, permitUnidentifiedArtifacts, true, out, err);
+            foundCorrectVerNr = true;
+            newCommandLine = false;
+            syntaxError = false;
+    }
+        if (foundCorrectVerNr == false && !noFileFound) {
+            Log.info("Dropping old javac_state since it is of an old version.");
+            db = new JavacState(args, binDir, gensrcDir, headerDir, permitUnidentifiedArtifacts, true, out, err);
+        } else
+        if (newCommandLine == true && !noFileFound) {
+            Log.info("Dropping old javac_state since a new command line is used!");
+            db = new JavacState(args, binDir, gensrcDir, headerDir, permitUnidentifiedArtifacts, true, out, err);
+        } else
+        if (syntaxError == true) {
+            Log.info("Dropping old javac_state since it contains syntax errors.");
+            db = new JavacState(args, binDir, gensrcDir, headerDir, permitUnidentifiedArtifacts, true, out, err);
+        }
+        db.prev.calculateDependents();
+        return db;
+    }
+
+    /**
+     * Mark a java package as tainted, ie it needs recompilation.
+     */
+    public void taintPackage(String name, String because) {
+        if (!taintedPackages.contains(name)) {
+            if (because != null) Log.debug("Tainting "+Util.justPackageName(name)+" because "+because);
+            // It has not been tainted before.
+            taintedPackages.add(name);
+            needsSaving();
+            Package nowp = now.packages().get(name);
+            if (nowp != null) {
+                for (String d : nowp.dependents()) {
+                    taintPackage(d, because);
+                }
+            }
+        }
+    }
+
+    /**
+     * This packages need recompilation.
+     */
+    public Set<String> taintedPackages() {
+        return taintedPackages;
+    }
+
+    /**
+     * Clean out the tainted package set, used after the first round of compiles,
+     * prior to propagating dependencies.
+     */
+    public void clearTaintedPackages() {
+        taintedPackages = new HashSet<String>();
+    }
+
+    /**
+     * Go through all sources and check which have been removed, added or modified
+     * and taint the corresponding packages.
+     */
+    public void checkSourceStatus(boolean check_gensrc) {
+        removedSources = calculateRemovedSources();
+        for (Source s : removedSources) {
+            if (!s.isGenerated() || check_gensrc) {
+                taintPackage(s.pkg().name(), "source "+s.name()+" was removed");
+            }
+        }
+
+        addedSources = calculateAddedSources();
+        for (Source s : addedSources) {
+            String msg = null;
+            if (isIncremental()) {
+                // When building from scratch, there is no point
+                // printing "was added" for every file since all files are added.
+                // However for an incremental build it makes sense.
+                msg = "source "+s.name()+" was added";
+            }
+            if (!s.isGenerated() || check_gensrc) {
+                taintPackage(s.pkg().name(), msg);
+            }
+        }
+
+        modifiedSources = calculateModifiedSources();
+        for (Source s : modifiedSources) {
+            if (!s.isGenerated() || check_gensrc) {
+                taintPackage(s.pkg().name(), "source "+s.name()+" was modified");
+            }
+        }
+    }
+
+    /**
+     * Acquire the compile_java_packages suffix rule for .java files.
+     */
+    public Map<String,Transformer> getJavaSuffixRule() {
+        Map<String,Transformer> sr = new HashMap<String,Transformer>();
+        sr.put(".java", compileJavaPackages);
+        return sr;
+    }
+
+    /**
+     * Acquire the copying transform.
+     */
+    public Transformer getCopier() {
+        return copyFiles;
+    }
+
+    /**
+     * If artifacts have gone missing, force a recompile of the packages
+     * they belong to.
+     */
+    public void taintPackagesThatMissArtifacts() {
+        for (Package pkg : prev.packages().values()) {
+            for (File f : pkg.artifacts().values()) {
+                if (!f.exists()) {
+                    // Hmm, the artifact on disk does not exist! Someone has removed it....
+                    // Lets rebuild the package.
+                    taintPackage(pkg.name(), ""+f+" is missing.");
+                }
+            }
+        }
+    }
+
+    /**
+     * Propagate recompilation through the dependency chains.
+     * Avoid re-tainting packages that have already been compiled.
+     */
+    public void taintPackagesDependingOnChangedPackages(Set<String> pkgs, Set<String> recentlyCompiled) {
+        for (Package pkg : prev.packages().values()) {
+            for (String dep : pkg.dependencies()) {
+                if (pkgs.contains(dep) && !recentlyCompiled.contains(pkg.name())) {
+                    taintPackage(pkg.name(), " its depending on "+dep);
+                }
+            }
+        }
+    }
+
+    /**
+     * Scan all output dirs for artifacts and remove those files (artifacts?)
+     * that are not recognized as such, in the javac_state file.
+     */
+    public void removeUnidentifiedArtifacts() {
+        Set<File> allKnownArtifacts = new HashSet<File>();
+        for (Package pkg : prev.packages().values()) {
+            for (File f : pkg.artifacts().values()) {
+                allKnownArtifacts.add(f);
+            }
+        }
+        // Do not forget about javac_state....
+        allKnownArtifacts.add(javacState);
+
+        for (File f : binArtifacts) {
+            if (!allKnownArtifacts.contains(f)) {
+                Log.debug("Removing "+f.getPath()+" since it is unknown to the javac_state.");
+                f.delete();
+            }
+        }
+        for (File f : headerArtifacts) {
+            if (!allKnownArtifacts.contains(f)) {
+                Log.debug("Removing "+f.getPath()+" since it is unknown to the javac_state.");
+                f.delete();
+            }
+        }
+        for (File f : gensrcArtifacts) {
+            if (!allKnownArtifacts.contains(f)) {
+                Log.debug("Removing "+f.getPath()+" since it is unknown to the javac_state.");
+                f.delete();
+            }
+        }
+    }
+
+    /**
+     * Remove artifacts that are no longer produced when compiling!
+     */
+    public void removeSuperfluousArtifacts(Set<String> recentlyCompiled) {
+        // Nothing to do, if nothing was recompiled.
+        if (recentlyCompiled.size() == 0) return;
+
+        for (String pkg : now.packages().keySet()) {
+            // If this package has not been recompiled, skip the check.
+            if (!recentlyCompiled.contains(pkg)) continue;
+            Collection<File> arts = now.artifacts().values();
+            for (File f : fetchPrevArtifacts(pkg).values()) {
+                if (!arts.contains(f)) {
+                    Log.debug("Removing "+f.getPath()+" since it is now superfluous!");
+                    if (f.exists()) f.delete();
+                }
+            }
+        }
+    }
+
+    /**
+     * Return those files belonging to prev, but not now.
+     */
+    private Set<Source> calculateRemovedSources() {
+        Set<Source> removed = new HashSet<Source>();
+        for (String src : prev.sources().keySet()) {
+            if (now.sources().get(src) == null) {
+                removed.add(prev.sources().get(src));
+            }
+        }
+        return removed;
+    }
+
+    /**
+     * Return those files belonging to now, but not prev.
+     */
+    private Set<Source> calculateAddedSources() {
+        Set<Source> added = new HashSet<Source>();
+        for (String src : now.sources().keySet()) {
+            if (prev.sources().get(src) == null) {
+                added.add(now.sources().get(src));
+            }
+        }
+        return added;
+    }
+
+    /**
+     * Return those files where the timestamp is newer.
+     * If a source file timestamp suddenly is older than what is known
+     * about it in javac_state, then consider it modified, but print
+     * a warning!
+     */
+    private Set<Source> calculateModifiedSources() {
+        Set<Source> modified = new HashSet<Source>();
+        for (String src : now.sources().keySet()) {
+            Source n = now.sources().get(src);
+            Source t = prev.sources().get(src);
+            if (prev.sources().get(src) != null) {
+                if (t != null) {
+                    if (n.lastModified() > t.lastModified()) {
+                        modified.add(n);
+                    } else if (n.lastModified() < t.lastModified()) {
+                        modified.add(n);
+                        Log.warn("The source file "+n.name()+" timestamp has moved backwards in time.");
+                    }
+                }
+            }
+        }
+        return modified;
+    }
+
+    /**
+     * Recursively delete a directory and all its contents.
+     */
+    private static void deleteContents(File dir) {
+        if (dir != null && dir.exists()) {
+            for (File f : dir.listFiles()) {
+                if (f.isDirectory()) {
+                    deleteContents(f);
+                }
+                f.delete();
+            }
+        }
+    }
+
+    /**
+     * Run the copy translator only.
+     */
+    public void performCopying(File binDir, Map<String,Transformer> suffixRules) {
+        Map<String,Transformer> sr = new HashMap<String,Transformer>();
+        for (Map.Entry<String,Transformer> e : suffixRules.entrySet()) {
+            if (e.getValue() == copyFiles) {
+                sr.put(e.getKey(), e.getValue());
+            }
+        }
+        perform(binDir, sr);
+    }
+
+    /**
+     * Run all the translators that translate into java source code.
+     * I.e. all translators that are not copy nor compile_java_source.
+     */
+    public void performTranslation(File gensrcDir, Map<String,Transformer> suffixRules) {
+        Map<String,Transformer> sr = new HashMap<String,Transformer>();
+        for (Map.Entry<String,Transformer> e : suffixRules.entrySet()) {
+            if (e.getValue() != copyFiles &&
+                e.getValue() != compileJavaPackages) {
+                sr.put(e.getKey(), e.getValue());
+            }
+        }
+        perform(gensrcDir, sr);
+    }
+
+    /**
+     * Compile all the java sources. Return true, if it needs to be called again!
+     */
+    public boolean performJavaCompilations(File binDir,
+                                           String serverSettings,
+                                           String[] args,
+                                           Set<String> recentlyCompiled,
+                                           boolean[] rcValue) {
+        Map<String,Transformer> suffixRules = new HashMap<String,Transformer>();
+        suffixRules.put(".java", compileJavaPackages);
+        compileJavaPackages.setExtra(serverSettings);
+        compileJavaPackages.setExtra(args);
+
+        rcValue[0] = perform(binDir, suffixRules);
+        recentlyCompiled.addAll(taintedPackages());
+        clearTaintedPackages();
+        boolean again = !packagesWithChangedPublicApis.isEmpty();
+        taintPackagesDependingOnChangedPackages(packagesWithChangedPublicApis, recentlyCompiled);
+        packagesWithChangedPublicApis = new HashSet<String>();
+        return again && rcValue[0];
+    }
+
+    /**
+     * Store the source into the set of sources belonging to the given transform.
+     */
+    private void addFileToTransform(Map<Transformer,Map<String,Set<URI>>> gs, Transformer t, Source s) {
+        Map<String,Set<URI>> fs = gs.get(t);
+        if (fs == null) {
+            fs = new HashMap<String,Set<URI>>();
+            gs.put(t, fs);
+        }
+        Set<URI> ss = fs.get(s.pkg().name());
+        if (ss == null) {
+            ss = new HashSet<URI>();
+            fs.put(s.pkg().name(), ss);
+        }
+        ss.add(s.file().toURI());
+    }
+
+    /**
+     * For all packages, find all sources belonging to the package, group the sources
+     * based on their transformers and apply the transformers on each source code group.
+     */
+    private boolean perform(File outputDir, Map<String,Transformer> suffixRules)
+    {
+        boolean rc = true;
+        // Group sources based on transforms. A source file can only belong to a single transform.
+        Map<Transformer,Map<String,Set<URI>>> groupedSources = new HashMap<Transformer,Map<String,Set<URI>>>();
+        for (Source src : now.sources().values()) {
+            Transformer t = suffixRules.get(src.suffix());
+               if (t != null) {
+                if (taintedPackages.contains(src.pkg().name()) && !src.isLinkedOnly()) {
+                    addFileToTransform(groupedSources, t, src);
+                }
+            }
+        }
+        // Go through the transforms and transform them.
+        for (Map.Entry<Transformer,Map<String,Set<URI>>> e : groupedSources.entrySet()) {
+            Transformer t = e.getKey();
+            Map<String,Set<URI>> srcs = e.getValue();
+            // These maps need to be synchronized since multiple threads will be writing results into them.
+            Map<String,Set<URI>> packageArtifacts = Collections.synchronizedMap(new HashMap<String,Set<URI>>());
+            Map<String,Set<String>> packageDependencies = Collections.synchronizedMap(new HashMap<String,Set<String>>());
+            Map<String,String> packagePublicApis = Collections.synchronizedMap(new HashMap<String,String>());
+
+            boolean  r = t.transform(srcs,
+                                     visibleSrcs,
+                                     visibleClasses,
+                                     prev.dependents(),
+                                     outputDir.toURI(),
+                                     packageArtifacts,
+                                     packageDependencies,
+                                     packagePublicApis,
+                                     0,
+                                     isIncremental(),
+                                     numCores,
+                                     out,
+                                     err);
+            if (!r) rc = false;
+
+            for (String p : srcs.keySet()) {
+                recompiledPackages.add(p);
+            }
+            // The transform is done! Extract all the artifacts and store the info into the Package objects.
+            for (Map.Entry<String,Set<URI>> a : packageArtifacts.entrySet()) {
+                Module mnow = now.findModuleFromPackageName(a.getKey());
+                mnow.addArtifacts(a.getKey(), a.getValue());
+            }
+            // Extract all the dependencies and store the info into the Package objects.
+            for (Map.Entry<String,Set<String>> a : packageDependencies.entrySet()) {
+                Set<String> deps = a.getValue();
+                Module mnow = now.findModuleFromPackageName(a.getKey());
+                mnow.setDependencies(a.getKey(), deps);
+            }
+            // Extract all the pubapis and store the info into the Package objects.
+            for (Map.Entry<String,String> a : packagePublicApis.entrySet()) {
+                Module mprev = prev.findModuleFromPackageName(a.getKey());
+                List<String> pubapi = Package.pubapiToList(a.getValue());
+                Module mnow = now.findModuleFromPackageName(a.getKey());
+                mnow.setPubapi(a.getKey(), pubapi);
+                if (mprev.hasPubapiChanged(a.getKey(), pubapi)) {
+                    // Aha! The pubapi of this package has changed!
+                    // It can also be a new compile from scratch.
+                    if (mprev.lookupPackage(a.getKey()).existsInJavacState()) {
+                        // This is an incremental compile! The pubapi
+                        // did change. Trigger recompilation of dependents.
+                        packagesWithChangedPublicApis.add(a.getKey());
+                        Log.info("The pubapi of "+Util.justPackageName(a.getKey())+" has changed!");
+                    }
+                }
+            }
+        }
+        return rc;
+    }
+
+    /**
+     * Utility method to recursively find all files below a directory.
+     */
+    private static Set<File> findAllFiles(File dir) {
+        Set<File> foundFiles = new HashSet<File>();
+        if (dir == null) {
+            return foundFiles;
+        }
+        recurse(dir, foundFiles);
+        return foundFiles;
+    }
+
+    private static void recurse(File dir, Set<File> foundFiles) {
+        for (File f : dir.listFiles()) {
+            if (f.isFile()) {
+                foundFiles.add(f);
+            } else if (f.isDirectory()) {
+                recurse(f, foundFiles);
+            }
+        }
+    }
+
+    /**
+     * Compare the calculate source list, with an explicit list, usually supplied from the makefile.
+     * Used to detect bugs where the makefile and sjavac have different opinions on which files
+     * should be compiled.
+     */
+    public void compareWithMakefileList(File makefileSourceList)
+            throws ProblemException
+    {
+        // If we are building on win32 using for example cygwin the paths in the makefile source list
+        // might be /cygdrive/c/.... which does not match c:\....
+        // We need to adjust our calculated sources to be identical, if necessary.
+        boolean mightNeedRewriting = File.pathSeparatorChar == ';';
+
+        if (makefileSourceList == null) return;
+
+        Set<String> calculatedSources = new HashSet<String>();
+        Set<String> listedSources = new HashSet<String>();
+
+        // Create a set of filenames with full paths.
+        for (Source s : now.sources().values()) {
+            calculatedSources.add(s.file().getPath());
+        }
+        // Read in the file and create another set of filenames with full paths.
+        try {
+            BufferedReader in = new BufferedReader(new FileReader(makefileSourceList));
+            for (;;) {
+                String l = in.readLine();
+                if (l==null) break;
+                l = l.trim();
+                if (mightNeedRewriting) {
+                    if (l.indexOf(":") == 1 && l.indexOf("\\") == 2) {
+                        // Everything a-ok, the format is already C:\foo\bar
+                    } else if (l.indexOf(":") == 1 && l.indexOf("/") == 2) {
+                        // The format is C:/foo/bar, rewrite into the above format.
+                        l = l.replaceAll("/","\\\\");
+                    } else if (l.charAt(0) == '/' && l.indexOf("/",1) != -1) {
+                        // The format might be: /cygdrive/c/foo/bar, rewrite into the above format.
+                        // Do not hardcode the name cygdrive here.
+                        int slash = l.indexOf("/",1);
+                        l = l.replaceAll("/","\\\\");
+                        l = ""+l.charAt(slash+1)+":"+l.substring(slash+2);
+                    }
+                    if (Character.isLowerCase(l.charAt(0))) {
+                        l = Character.toUpperCase(l.charAt(0))+l.substring(1);
+                    }
+                }
+                listedSources.add(l);
+            }
+        } catch (FileNotFoundException e) {
+            throw new ProblemException("Could not open "+makefileSourceList.getPath()+" since it does not exist!");
+        } catch (IOException e) {
+            throw new ProblemException("Could not read "+makefileSourceList.getPath());
+        }
+
+        for (String s : listedSources) {
+            if (!calculatedSources.contains(s)) {
+                 throw new ProblemException("The makefile listed source "+s+" was not calculated by the smart javac wrapper!");
+            }
+        }
+
+        for (String s : calculatedSources) {
+            if (!listedSources.contains(s)) {
+                throw new ProblemException("The smart javac wrapper calculated source "+s+" was not listed by the makefiles!");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/Log.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,92 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.PrintStream;
+
+/**
+ * Utility class only for sjavac logging.
+ * The log level can be set using for example --log=DEBUG on the sjavac command line.
+ *
+ * <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 Log {
+    private static PrintStream out, err;
+
+    public final static int WARN = 1;
+    public final static int INFO = 2;
+    public final static int DEBUG = 3;
+    public final static int TRACE = 4;
+    private static int level = WARN;
+
+    static public void trace(String msg) {
+        if (level >= TRACE) {
+            out.println(msg);
+        }
+    }
+
+    static public void debug(String msg) {
+        if (level >= DEBUG) {
+            out.println(msg);
+        }
+    }
+
+    static public void info(String msg) {
+        if (level >= INFO) {
+            out.println(msg);
+        }
+    }
+
+    static public void warn(String msg) {
+        err.println(msg);
+    }
+
+    static public void error(String msg) {
+        err.println(msg);
+    }
+
+    static public void setLogLevel(String l, PrintStream o, PrintStream e)
+        throws ProblemException {
+        out = o;
+        err = e;
+        if (l.equals("warn")) level = WARN;
+        else if (l.equals("info")) level = INFO;
+        else if (l.equals("debug")) level = DEBUG;
+        else if (l.equals("trace")) level = TRACE;
+        else throw new ProblemException("No such log level \""+l+"\"");
+    }
+
+    static public boolean isTracing() {
+        return level >= TRACE;
+    }
+
+    static public boolean isDebugging() {
+        return level >= DEBUG;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/Main.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,966 @@
+/*
+ * 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
+ * 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.sjavac;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.sun.tools.sjavac.server.JavacServer;
+
+/**
+ * The main class of the smart javac wrapper tool.
+ *
+ * <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 Main {
+
+    /*  This is a smart javac wrapper primarily used when building the OpenJDK,
+        though other projects are welcome to use it too. But please be aware
+        that it is not an official api and will change in the future.
+        (We really mean it!)
+
+        Goals:
+
+        ** Create a state file, containing information about the build, so
+           that incremental builds only rebuild what is necessary. Also the
+           state file can be used by make/ant to detect when to trigger
+           a call to the smart javac wrapper.
+
+           This file is called bin/javac_state (assuming that you specified "-d bin")
+           Thus the simplest makefile is:
+
+           SJAVAC=java -cp .../tools.jar com.sun.tools.sjavac.Main
+           SRCS=$(shell find src -name "*.java")
+           bin/javac_state : $(SRCS)
+                  $(SJAVAC) src -d bin
+
+           This makefile will run very fast and detect properly when Java code needs to
+           be recompiled. The smart javac wrapper will then use the information in java_state
+           to do an efficient incremental compile.
+
+           Previously it was near enough impossible to write an efficient makefile for Java
+           with support for incremental builds and dependency tracking.
+
+        ** Separate java sources to be compiled from java
+           sources used >only< for linking. The options:
+
+           "dir" points to root dir with sources to be compiled
+           "-sourcepath dir" points to root dir with sources used only for linking
+           "-classpath dir" points to dir with classes used only for linking (as before)
+
+        ** Use all cores for compilation by default.
+           "-j 4" limit the number of cores to 4.
+           For the moment, the sjavac server additionally limits the number of cores to three.
+           This will improve in the future when more sharing is performed between concurrent JavaCompilers.
+
+        ** Basic translation support from other sources to java, and then compilation of the generated java.
+           This functionality might be moved into annotation processors instead.
+           Again this is driven by the OpenJDK sources where properties and a few other types of files
+           are converted into Java sources regularily. The javac_state embraces copy and tr, and perform
+           incremental recompiles and copying for these as well. META-INF will be a special copy rule
+           that will copy any files found below any META-INF dir in src to the bin/META-INF dir.
+           "-copy .gif"
+           "-copy META-INF"
+           "-tr .prop=com.sun.tools.javac.smart.CompileProperties
+           "-tr .propp=com.sun.tools.javac.smart.CompileProperties,java.util.ListResourceBundle
+           "-tr .proppp=com.sun.tools.javac.smart.CompileProperties,sun.util.resources.LocaleNamesBundle
+
+        ** Control which classes in the src,sourcepath and classpath that javac is allowed to see.
+           Again, this is necessary to deal with the source code structure of the OpenJDK which is
+           intricate (read messy).
+
+           "-i tools.*" to include the tools package and all its subpackages in the build.
+           "-x tools.net.aviancarrier.*" to exclude the aviancarrier package and all its sources and subpackages.
+           "-x tools.net.drums" to exclude the drums package only, keep its subpackages.
+           "-xf tools/net/Bar.java" // Do not compile this file...
+           "-xf *Bor.java" // Do not compile Bor.java wherever it is found, BUT do compile ABor.java!
+           "-if tools/net/Bor.java" // Only compile this file...odd, but sometimes used.
+
+        ** The smart javac wrapper is driven by the modification time on the source files and compared
+           to the modification times written into the javac_state file.
+
+           It does not compare the modification time of the source with the modification time of the artifact.
+           However it will detect if the modification time of an artifact has changed compared to the java_state,
+           and this will trigger a delete of the artifact and a subsequent recompile of the source.
+
+           The smart javac wrapper is not a generic makefile/ant system. Its purpose is to compile java source
+           as the final step before the output dir is finalized and immediately jared, or jmodded. The output
+           dir should be considered opaque. Do not write into the outputdir yourself!
+           Any artifacts found in the outputdir that javac_state does not know of, will be deleted!
+           This can however be prevented, using the switch --permit-unidentified-artifacts
+           This switch is necessary when build the OpenJDK because its makefiles still write directly to
+           the output classes dirs.
+
+           Any makefile/ant rules that want to put contents into the outputdir should put the content
+           in one of several source roots. Static content that is under version control, can be put in the same source
+           code tree as the Java sources. Dynamic content that is generated by make/ant on the fly, should
+           be put in a separate gensrc_stuff root. The smart javac wrapper call will then take the arguments:
+           "gensrc_stuff src -d bin"
+
+        The command line:
+        java -cp tools.jar com.sun.tools.sjavac.Main \
+             -i "com.bar.*" -x "com.bar.foo.*" \
+             first_root \
+             -i "com.bar.foo.*" \
+             second_root \
+             -x "org.net.*" \
+             -sourcepath link_root_sources \
+             -classpath link_root_classes \
+             -d bin
+
+        Will compile all sources for package com.bar and its subpackages, found below first_root,
+        except the package com.bar.foo (and its subpackages), for which the sources are picked
+        from second_root instead. It will link against classes in link_root_classes and against
+        sources in link_root_sources, but will not see (try to link against) sources matching org.net.*
+        but will link against org.net* classes (if they exist) in link_root_classes.
+
+        (If you want a set of complex filter rules to be applied to several source directories, without
+         having to repeat the the filter rules for each root. You can use the explicit -src option. For example:
+         sjavac -x "com.foo.*" -src root1:root2:root3  )
+
+        The resulting classes are written into bin.
+    */
+
+    // This is the final destination for classes and copied files.
+    private File bin_dir;
+    // This is where the annotation process will put generated sources.
+    private File gensrc_dir;
+    // This is where javac -h puts the generated c-header files.
+    private File header_dir;
+
+    // This file contains the list of sources genereated by the makefile.
+    // We double check that our calculated list of sources matches this list,
+    // if not, then we terminate with an error!
+    private File makefile_source_list;
+    // The challenging task to manage an incremental build is done by javac_state.
+    private JavacState javac_state;
+
+    // The suffix rules tells you for example, that .java files should be compiled,
+    // and .html files should be copied and .properties files be translated.
+    Map<String,Transformer> suffix_rules;
+
+    public static void main(String... args)  {
+        if (args.length > 0 && args[0].startsWith("--startserver:")) {
+            if (args.length>1) {
+                Log.error("When spawning a background server, only a single --startserver argument is allowed.");
+                return;
+            }
+            // Spawn a background server.
+            int rc = JavacServer.startServer(args[0], System.err);
+            System.exit(rc);
+        }
+        Main main = new Main();
+        int rc = main.go(args, System.out, System.err);
+        // Remove the portfile, but only if this background=false was used.
+        JavacServer.cleanup(args);
+        System.exit(rc);
+    }
+
+    private void printHelp() {
+        System.out.println("Usage: sjavac <options>\n"+
+                           "where required options are:\n"+
+                           "dir                        Compile all sources in dir recursively\n"+
+                           "-d dir                     Store generated classes here and the javac_state file\n"+
+                           "--server:portfile=/tmp/abc Use a background sjavac server\n\n"+
+                           "All other arguments as javac, except -implicit:none which is forced by default.\n"+
+                           "No java source files can be supplied on the command line, nor can an @file be supplied.\n\n"+
+                           "Warning!\n"+
+                           "This tool might disappear at any time, and its command line options might change at any time!");
+    }
+
+    public int go(String[] args, PrintStream out, PrintStream err) {
+        try {
+            if (args.length == 0 || findJavaSourceFiles(args) || findAtFile(args) || null==Util.findServerSettings(args)) {
+                printHelp();
+                return 0;
+            }
+
+            Log.setLogLevel(findLogLevel(args), out, err);
+            String server_settings = Util.findServerSettings(args);
+            args = verifyImplicitOption(args);
+            // Find the source root directories, and add the -src option before these, if not there already.
+            args = addSrcBeforeDirectories(args);
+            // Check that there is at least one -src supplied.
+            checkSrcOption(args);
+            // Check that there is one -d supplied.
+            bin_dir = findDirectoryOption(args,"-d","output", true, false, true);
+            gensrc_dir = findDirectoryOption(args,"-s","gensrc", false, false, true);
+            header_dir = findDirectoryOption(args,"-h","headers", false, false, true);
+            makefile_source_list = findFileOption(args,"--compare-found-sources","makefile source list", false);
+
+            // Load the prev build state database.
+            javac_state = JavacState.load(args, bin_dir, gensrc_dir, header_dir,
+                    findBooleanOption(args, "--permit-unidentified-artifacts"), out, err);
+
+            // Setup the suffix rules from the command line.
+            suffix_rules = javac_state.getJavaSuffixRule();
+            findTranslateOptions(args, suffix_rules);
+            if (suffix_rules.keySet().size() > 1 && gensrc_dir == null) {
+                Log.error("You have translators but no gensrc dir (-s) specified!");
+                return -1;
+            }
+            findCopyOptions(args, suffix_rules);
+
+            // All found modules are put here.
+            Map<String,Module> modules = new HashMap<String,Module>();
+            // We start out in the legacy empty no-name module.
+            // As soon as we stumble on a module-info.java file we change to that module.
+            Module current_module = new Module("", "");
+            modules.put("", current_module);
+
+            // Find all sources, use the suffix rules to know which files are sources.
+            Map<String,Source> sources = new HashMap<String,Source>();
+            // Find the files, this will automatically populate the found modules
+            // with found packages where the sources are found!
+            findFiles(args, "-src", suffix_rules.keySet(), sources, modules, current_module, false);
+
+            if (sources.isEmpty()) {
+                Log.error("Found nothing to compile!");
+                return -1;
+            }
+
+            // Find all source files allowable for linking.
+            // We might find more modules here as well.
+            Map<String,Source> sources_to_link_to = new HashMap<String,Source>();
+            // Always reuse -src for linking as well! This means that we might
+            // get two -sourcepath on the commandline after the rewrite, which is
+            // fine. We can have as many as we like. You need to have separate -src/-sourcepath/-classpath
+            // if you need different filtering rules for different roots. If you have the same filtering
+            // rules for all sourcepath roots, you can concatenate them using :(;) as before.
+              rewriteOptions(args, "-src", "-sourcepath");
+            findFiles(args, "-sourcepath", Util.set(".java"), sources_to_link_to, modules, current_module, true);
+
+            // Find all class files allowable for linking.
+            // And pickup knowledge of all modules found here.
+            // This cannot currently filter classes inside jar files.
+//          Map<String,Source> classes_to_link_to = new HashMap<String,Source>();
+//          findFiles(args, "-classpath", Util.set(".class"), classes_to_link_to, modules, current_module, true);
+
+            // Find all module sources allowable for linking.
+//          Map<String,Source> modules_to_link_to = new HashMap<String,Source>();
+//          findFiles(args, "-modulepath", Util.set(".class"), modules_to_link_to, modules, current_module, true);
+
+            // Add the set of sources to the build database.
+            javac_state.now().collectPackagesSourcesAndArtifacts(modules);
+            javac_state.now().checkInternalState("checking sources", false, sources);
+            javac_state.now().checkInternalState("checking linked sources", true, sources_to_link_to);
+            javac_state.setVisibleSources(sources_to_link_to);
+
+            // If there is any change in the source files, taint packages
+            // and mark the database in need of saving.
+            javac_state.checkSourceStatus(false);
+
+            // Find all existing artifacts. Their timestamp will match the last modified timestamps stored
+            // in javac_state, simply because loading of the JavacState will clean out all artifacts
+            // that do not match the javac_state database.
+            javac_state.findAllArtifacts();
+
+            // Remove unidentified artifacts from the bin, gensrc and header dirs.
+            // (Unless we allow them to be there.)
+            // I.e. artifacts that are not known according to the build database (javac_state).
+            // For examples, files that have been manually copied into these dirs.
+            // Artifacts with bad timestamps (ie the on disk timestamp does not match the timestamp
+            // in javac_state) have already been removed when the javac_state was loaded.
+            if (!findBooleanOption(args, "--permit-unidentified-artifacts")) {
+                javac_state.removeUnidentifiedArtifacts();
+            }
+            // Go through all sources and taint all packages that miss artifacts.
+            javac_state.taintPackagesThatMissArtifacts();
+
+            // Now clean out all known artifacts belonging to tainted packages.
+            javac_state.deleteClassArtifactsInTaintedPackages();
+            // Copy files, for example property files, images files, xml files etc etc.
+            javac_state.performCopying(bin_dir, suffix_rules);
+            // Translate files, for example compile properties or compile idls.
+            javac_state.performTranslation(gensrc_dir, suffix_rules);
+            // Add any potentially generated java sources to the tobe compiled list.
+            // (Generated sources must always have a package.)
+            Map<String,Source> generated_sources = new HashMap<String,Source>();
+            Source.scanRoot(gensrc_dir, Util.set(".java"), null, null, null, null,
+                   generated_sources, modules, current_module, false, true, false);
+            javac_state.now().collectPackagesSourcesAndArtifacts(modules);
+            // Recheck the the source files and their timestamps again.
+            javac_state.checkSourceStatus(true);
+
+            // Now do a safety check that the list of source files is identical
+            // to the list Make believes we are compiling. If we do not get this
+            // right, then incremental builds will fail with subtility.
+            // If any difference is detected, then we will fail hard here.
+            // This is an important safety net.
+            javac_state.compareWithMakefileList(makefile_source_list);
+
+            // Do the compilations, repeatedly until no tainted packages exist.
+            boolean again;
+            // Collect the name of all compiled packages.
+            Set<String> recently_compiled = new HashSet<String>();
+            boolean[] rc = new boolean[1];
+            do {
+                // Clean out artifacts in tainted packages.
+                javac_state.deleteClassArtifactsInTaintedPackages();
+                again = javac_state.performJavaCompilations(bin_dir, server_settings, args, recently_compiled, rc);
+                if (!rc[0]) break;
+            } while (again);
+            // Only update the state if the compile went well.
+            if (rc[0]) {
+                javac_state.save();
+                // Collect all the artifacts.
+                javac_state.now().collectArtifacts(modules);
+                // Remove artifacts that were generated during the last compile, but not this one.
+                javac_state.removeSuperfluousArtifacts(recently_compiled);
+            }
+            return rc[0] ? 0 : -1;
+        } catch (ProblemException e) {
+            Log.error(e.getMessage());
+            return -1;
+        } catch (Exception e) {
+            e.printStackTrace(err);
+            return -1;
+        }
+    }
+
+    /**
+     * Are java source files passed on the command line?
+     */
+    private boolean findJavaSourceFiles(String[] args) {
+        String prev = "";
+        for (String s : args) {
+            if (s.endsWith(".java") && !prev.equals("-xf") && !prev.equals("-if")) {
+                return true;
+            }
+            prev = s;
+        }
+        return false;
+    }
+
+    /**
+     * Is an at file passed on the command line?
+     */
+    private boolean findAtFile(String[] args) {
+        for (String s : args) {
+            if (s.startsWith("@")) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Find the log level setting.
+     */
+    private String findLogLevel(String[] args) {
+        for (String s : args) {
+            if (s.startsWith("--log=") && s.length()>6) {
+                return s.substring(6);
+            }
+            if (s.equals("-verbose")) {
+                return "info";
+            }
+        }
+        return "info";
+    }
+
+    /**
+     * Remove smart javac wrapper arguments, before feeding
+     * the args to the plain javac.
+     */
+    static String[] removeWrapperArgs(String[] args) {
+        String[] out = new String[args.length];
+        // The first source path index is remembered
+        // here. So that all following can be concatenated to it.
+        int source_path = -1;
+        // The same for class path.
+        int class_path = -1;
+        // And module path.
+        int module_path = -1;
+        int j = 0;
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals("-src") ||
+                args[i].equals("-x") ||
+                args[i].equals("-i") ||
+                args[i].equals("-xf") ||
+                args[i].equals("-if") ||
+                args[i].equals("-copy") ||
+                args[i].equals("-tr") ||
+                args[i].equals("-j")) {
+                // Just skip it and skip following value
+                i++;
+            } else if (args[i].startsWith("--server:")) {
+                // Just skip it.
+            } else if (args[i].startsWith("--log=")) {
+                // Just skip it.
+            } else if (args[i].equals("--permit-unidentified-artifacts")) {
+                // Just skip it.
+            } else if (args[i].equals("--permit-sources-without-package")) {
+                // Just skip it.
+            } else if (args[i].equals("--compare-found-sources")) {
+                // Just skip it and skip verify file name
+                i++;
+            } else if (args[i].equals("-sourcepath")) {
+                if (source_path == -1) {
+                    source_path = j;
+                    out[j] = args[i];
+                    out[j+1] = args[i+1];
+                    j+=2;
+                    i++;
+                } else {
+                    // Skip this and its argument, but
+                    // append argument to found sourcepath.
+                    out[source_path+1] = out[source_path+1]+File.pathSeparatorChar+args[i+1];
+                    i++;
+                }
+            } else if (args[i].equals("-classpath") || args[i].equals("-cp")) {
+                if (class_path == -1) {
+                    class_path = j;
+                    out[j] = args[i];
+                    out[j+1] = args[i+1];
+                    j+=2;
+                    i++;
+                } else {
+                    // Skip this and its argument, but
+                    // append argument to found sourcepath.
+                    out[class_path+1] = out[class_path+1]+File.pathSeparatorChar+args[i+1];
+                    i++;
+                }
+            } else if (args[i].equals("-modulepath")) {
+                if (module_path == -1) {
+                    module_path = j;
+                    out[j] = args[i];
+                    out[j+1] = args[i+1];
+                    j+=2;
+                    i++;
+                } else {
+                    // Skip this and its argument, but
+                    // append argument to found sourcepath.
+                    out[module_path+1] = out[module_path+1]+File.pathSeparatorChar+args[i+1];
+                    i++;
+                }
+             } else {
+                // Copy argument.
+                out[j] = args[i];
+                j++;
+            }
+        }
+        String[] ret = new String[j];
+        System.arraycopy(out, 0, ret, 0, j);
+        return ret;
+    }
+
+    /**
+     * Make sure directory exist, create it if not.
+     */
+    private static boolean makeSureExists(File dir) {
+        // Make sure the dest directories exist.
+        if (!dir.exists()) {
+            if (!dir.mkdirs()) {
+                Log.error("Could not create the directory "+dir.getPath());
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Verify that a package pattern is valid.
+     */
+    private static void checkPattern(String s) throws ProblemException {
+        // Package names like foo.bar.gamma are allowed, and
+        // package names suffixed with .* like foo.bar.* are
+        // also allowed.
+        Pattern p = Pattern.compile("[a-zA-Z_]{1}[a-zA-Z0-9_]*(\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*)*(\\.\\*)?+");
+        Matcher m = p.matcher(s);
+        if (!m.matches()) {
+            throw new ProblemException("The string \""+s+"\" is not a proper package name pattern.");
+        }
+    }
+
+    /**
+     * Verify that a translate pattern is valid.
+     */
+    private static void checkTranslatePattern(String s) throws ProblemException {
+        // .prop=com.sun.tools.javac.smart.CompileProperties
+        // .idl=com.sun.corba.CompileIdl
+        // .g3=antlr.CompileGrammar,debug=true
+        Pattern p = Pattern.compile(
+            "\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*=[a-z_]{1}[a-z0-9_]*(\\.[a-z_]{1}[a-z0-9_]*)*"+
+            "(\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*)(,.*)?");
+        Matcher m = p.matcher(s);
+        if (!m.matches()) {
+            throw new ProblemException("The string \""+s+"\" is not a proper translate pattern.");
+        }
+    }
+
+    /**
+     * Verify that a copy pattern is valid.
+     */
+    private static void checkCopyPattern(String s) throws ProblemException {
+        // .gif
+        // .html
+        Pattern p = Pattern.compile(
+            "\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*");
+        Matcher m = p.matcher(s);
+        if (!m.matches()) {
+            throw new ProblemException("The string \""+s+"\" is not a proper suffix.");
+        }
+    }
+
+    /**
+     * Verify that a source file name is valid.
+     */
+    private static void checkFilePattern(String s) throws ProblemException {
+        // File names like foo/bar/gamma/Bar.java are allowed,
+        // as well as /bar/jndi.properties as well as,
+        // */bar/Foo.java
+        Pattern p = null;
+        if (File.separatorChar == '\\') {
+            p = Pattern.compile("\\*?(.+\\\\)*.+");
+        }
+        else if (File.separatorChar == '/') {
+            p = Pattern.compile("\\*?(.+/)*.+");
+        } else {
+            throw new ProblemException("This platform uses the unsupported "+File.separatorChar+
+                                      " as file separator character. Please add support for it!");
+        }
+        Matcher m = p.matcher(s);
+        if (!m.matches()) {
+            throw new ProblemException("The string \""+s+"\" is not a proper file name.");
+        }
+    }
+
+    /**
+     * Scan the arguments to find an option is used.
+     */
+    private static boolean hasOption(String[] args, String option) {
+        for (String a : args) {
+            if (a.equals(option)) return true;
+        }
+        return false;
+    }
+
+    /**
+     * Check if -implicit is supplied, if so check that it is none.
+     * If -implicit is not supplied, supply -implicit:none
+     * Only implicit:none is allowed because otherwise the multicore compilations
+     * and dependency tracking will be tangled up.
+     */
+    private static String[] verifyImplicitOption(String[] args)
+        throws ProblemException {
+
+        boolean foundImplicit = false;
+        for (String a : args) {
+            if (a.startsWith("-implicit:")) {
+                foundImplicit = true;
+                if (!a.equals("-implicit:none")) {
+                    throw new ProblemException("The only allowed setting for sjavac is -implicit:none, it is also the default.");
+                }
+            }
+        }
+        if (foundImplicit) {
+            return args;
+        }
+        // -implicit:none not found lets add it.
+        String[] newargs = new String[args.length+1];
+        System.arraycopy(args,0, newargs, 0, args.length);
+        newargs[args.length] = "-implicit:none";
+        return newargs;
+    }
+
+    /**
+     * Rewrite a single option into something else.
+     */
+    private static void rewriteOptions(String[] args, String option, String new_option) {
+        for (int i=0; i<args.length; ++i) {
+            if (args[i].equals(option)) {
+                args[i] = new_option;
+            }
+        }
+    }
+
+    /**
+     * Scan the arguments to find an option that specifies a directory.
+     * Create the directory if necessary.
+     */
+    private static File findDirectoryOption(String[] args, String option, String name, boolean needed, boolean allow_dups, boolean create)
+        throws ProblemException, ProblemException {
+        File dir = null;
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals(option)) {
+                if (dir != null) {
+                    throw new ProblemException("You have already specified the "+name+" dir!");
+                }
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a directory following "+option+".");
+                }
+                if (args[i+1].indexOf(File.pathSeparatorChar) != -1) {
+                    throw new ProblemException("You must only specify a single directory for "+option+".");
+                }
+                dir = new File(args[i+1]);
+                if (!dir.exists()) {
+                    if (!create) {
+                         throw new ProblemException("This directory does not exist: "+dir.getPath());
+                    } else
+                    if (!makeSureExists(dir)) {
+                        throw new ProblemException("Cannot create directory "+dir.getPath());
+                    }
+                }
+                if (!dir.isDirectory()) {
+                    throw new ProblemException("\""+args[i+1]+"\" is not a directory.");
+                }
+            }
+        }
+        if (dir == null && needed) {
+            throw new ProblemException("You have to specify "+option);
+        }
+        try {
+            if (dir != null)
+                return dir.getCanonicalFile();
+        } catch (IOException e) {
+            throw new ProblemException(""+e);
+        }
+        return null;
+    }
+
+    /**
+     * Option is followed by path.
+     */
+    private static boolean shouldBeFollowedByPath(String o) {
+        return o.equals("-s") ||
+               o.equals("-h") ||
+               o.equals("-d") ||
+               o.equals("-sourcepath") ||
+               o.equals("-classpath") ||
+               o.equals("-cp") ||
+               o.equals("-bootclasspath") ||
+               o.equals("-src");
+    }
+
+    /**
+     * Add -src before source root directories if not already there.
+     */
+    private static String[] addSrcBeforeDirectories(String[] args) {
+        List<String> newargs = new ArrayList<String>();
+        for (int i = 0; i<args.length; ++i) {
+            File dir = new File(args[i]);
+            if (dir.exists() && dir.isDirectory()) {
+                if (i == 0 || !shouldBeFollowedByPath(args[i-1])) {
+                    newargs.add("-src");
+                }
+            }
+            newargs.add(args[i]);
+        }
+        return newargs.toArray(new String[0]);
+    }
+
+    /**
+     * Check the -src options.
+     */
+    private static void checkSrcOption(String[] args)
+        throws ProblemException {
+        Set<File> dirs = new HashSet<File>();
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals("-src")) {
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a directory following -src.");
+                }
+                StringTokenizer st = new StringTokenizer(args[i+1], File.pathSeparator);
+                while (st.hasMoreElements()) {
+                    File dir = new File(st.nextToken());
+                    if (!dir.exists()) {
+                        throw new ProblemException("This directory does not exist: "+dir.getPath());
+                    }
+                    if (!dir.isDirectory()) {
+                        throw new ProblemException("\""+dir.getPath()+"\" is not a directory.");
+                    }
+                    if (dirs.contains(dir)) {
+                        throw new ProblemException("The src directory \""+dir.getPath()+"\" is specified more than once!");
+                    }
+                    dirs.add(dir);
+                }
+            }
+        }
+        if (dirs.isEmpty()) {
+            throw new ProblemException("You have to specify -src.");
+        }
+    }
+
+    /**
+     * Scan the arguments to find an option that specifies a file.
+     */
+    private static File findFileOption(String[] args, String option, String name, boolean needed)
+        throws ProblemException, ProblemException {
+        File file = null;
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals(option)) {
+                if (file != null) {
+                    throw new ProblemException("You have already specified the "+name+" file!");
+                }
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a file following "+option+".");
+                }
+                file = new File(args[i+1]);
+                if (file.isDirectory()) {
+                    throw new ProblemException("\""+args[i+1]+"\" is not a file.");
+                }
+                if (!file.exists() && needed) {
+                    throw new ProblemException("The file \""+args[i+1]+"\" does not exist.");
+                }
+
+            }
+        }
+        if (file == null && needed) {
+            throw new ProblemException("You have to specify "+option);
+        }
+        return file;
+    }
+
+    /**
+     * Look for a specific switch, return true if found.
+     */
+    public static boolean findBooleanOption(String[] args, String option) {
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals(option)) return true;
+        }
+        return false;
+    }
+
+    /**
+     * Scan the arguments to find an option that specifies a number.
+     */
+    public static int findNumberOption(String[] args, String option) {
+        int rc = 0;
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals(option)) {
+                if (args.length > i+1) {
+                    rc = Integer.parseInt(args[i+1]);
+                }
+            }
+        }
+        return rc;
+    }
+
+    /**
+     * Scan the arguments to find the option (-tr) that setup translation rules to java source
+     * from different sources. For example: .properties are translated using CompileProperties
+     * The found translators are stored as suffix rules.
+     */
+    private static void findTranslateOptions(String[] args, Map<String,Transformer> suffix_rules)
+        throws ProblemException, ProblemException {
+
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals("-tr")) {
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a translate rule following -tr.");
+                }
+                String s = args[i+1];
+                checkTranslatePattern(s);
+                int ep = s.indexOf("=");
+                String suffix = s.substring(0,ep);
+                String classname = s.substring(ep+1);
+                if (suffix_rules.get(suffix) != null) {
+                    throw new ProblemException("You have already specified a "+
+                                              "rule for the suffix "+suffix);
+                }
+                if (s.equals(".class")) {
+                    throw new ProblemException("You cannot have a translator for .class files!");
+                }
+                if (s.equals(".java")) {
+                    throw new ProblemException("You cannot have a translator for .java files!");
+                }
+                String extra = null;
+                int exp = classname.indexOf(",");
+                if (exp != -1) {
+                    extra = classname.substring(exp+1);
+                    classname = classname.substring(0,exp);
+                }
+                try {
+                    Class<?> cl = Class.forName(classname);
+                    Transformer t = (Transformer)cl.newInstance();
+                    t.setExtra(extra);
+                    suffix_rules.put(suffix, t);
+                }
+                catch (Exception e) {
+                    throw new ProblemException("Cannot use "+classname+" as a translator!");
+                }
+            }
+        }
+    }
+
+    /**
+     * Scan the arguments to find the option (-copy) that setup copying rules into the bin dir.
+     * For example: -copy .html
+     * The found copiers are stored as suffix rules as well. No translation is done, just copying.
+     */
+    private void findCopyOptions(String[] args, Map<String,Transformer> suffix_rules)
+        throws ProblemException, ProblemException {
+
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals("-copy")) {
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a translate rule following -tr.");
+                }
+                String s = args[i+1];
+                checkCopyPattern(s);
+                if (suffix_rules.get(s) != null) {
+                    throw new ProblemException("You have already specified a "+
+                                              "rule for the suffix "+s);
+                }
+                if (s.equals(".class")) {
+                    throw new ProblemException("You cannot have a copy rule for .class files!");
+                }
+                if (s.equals(".java")) {
+                    throw new ProblemException("You cannot have a copy rule for .java files!");
+                }
+                suffix_rules.put(s, javac_state.getCopier());
+            }
+        }
+    }
+
+    /**
+     * Rewrite a / separated path into \ separated, but only
+     * if we are running on a platform were File.separatorChar=='\', ie winapi.
+     */
+    private String fixupSeparator(String p) {
+        if (File.separatorChar == '/') return p;
+        return p.replaceAll("/", "\\\\");
+    }
+
+    /**
+     * Scan the arguments for -i -x -xf -if followed by the option
+     * -src, -sourcepath, -modulepath or -classpath and produce a map of all the
+     * files to referenced for that particular option.
+     *
+     * Store the found sources and the found modules in the supplied maps.
+     */
+    private boolean findFiles(String[] args, String option, Set<String> suffixes,
+                              Map<String,Source> found_files, Map<String, Module> found_modules,
+                              Module current_module, boolean inLinksrc)
+        throws ProblemException, ProblemException
+    {
+        // Track which source roots, source path roots and class path roots have been added.
+        Set<File> roots = new HashSet<File>();
+        // Track the current set of package includes,excludes as well as excluded source files,
+        // to be used in the next -src/-sourcepath/-classpath
+        List<String> includes = new LinkedList<String>();
+        List<String> excludes = new LinkedList<String>();
+        List<String> excludefiles = new LinkedList<String>();
+        List<String> includefiles = new LinkedList<String>();
+        // This include is used to find all modules in the source.
+        List<String> moduleinfo = new LinkedList<String>();
+        moduleinfo.add("module-info.java");
+
+        for (int i = 0; i<args.length; ++i) {
+            if (args[i].equals("-i")) {
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a package pattern following -i");
+                }
+                String incl = args[i+1];
+                checkPattern(incl);
+                includes.add(incl);
+            }
+            if (args[i].equals("-x")) {
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a package pattern following -x");
+                }
+                String excl = args[i+1];
+                checkPattern(excl);
+                excludes.add(excl);
+            }
+            if (args[i].equals("-xf")) {
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a file following -xf");
+                }
+                String exclf = args[i+1];
+                checkFilePattern(exclf);
+                exclf = Util.normalizeDriveLetter(exclf);
+                excludefiles.add(fixupSeparator(exclf));
+            }
+            if (args[i].equals("-if")) {
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a file following -xf");
+                }
+                String inclf = args[i+1];
+                checkFilePattern(inclf);
+                inclf = Util.normalizeDriveLetter(inclf);
+                includefiles.add(fixupSeparator(inclf));
+            }
+            if (args[i].equals(option)) {
+                if (i+1 >= args.length) {
+                    throw new ProblemException("You have to specify a directory following "+option);
+                }
+                String[] root_dirs = args[i+1].split(File.pathSeparator);
+                for (String r : root_dirs) {
+                    File root = new File(r);
+                    if (!root.isDirectory()) {
+                        throw new ProblemException("\""+r+"\" is not a directory.");
+                    }
+                    try {
+                        root = root.getCanonicalFile();
+                    } catch (IOException e) {
+                        throw new ProblemException(""+e);
+                    }
+                    if (roots.contains(root)) {
+                        throw new ProblemException("\""+r+"\" has already been used for "+option);
+                    }
+                    if (root.equals(bin_dir)) {
+                        throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -d");
+                    }
+                    if (root.equals(gensrc_dir)) {
+                        throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -s");
+                    }
+                    if (root.equals(header_dir)) {
+                        throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -h");
+                    }
+                    roots.add(root);
+                    Source.scanRoot(root, suffixes, excludes, includes, excludefiles, includefiles,
+                                    found_files, found_modules, current_module,
+                                    findBooleanOption(args, "--permit-sources-without-package"),
+                                    false, inLinksrc);
+                }
+            }
+            if (args[i].equals("-src") ||
+                args[i].equals("-sourcepath") ||
+                args[i].equals("-modulepath") ||
+                args[i].equals("-classpath") ||
+                args[i].equals("-cp"))
+            {
+                // Reset the includes,excludes and excludefiles after they have been used.
+                includes = new LinkedList<String>();
+                excludes = new LinkedList<String>();
+                excludefiles = new LinkedList<String>();
+                includefiles = new LinkedList<String>();
+            }
+        }
+        return true;
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/Module.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,141 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.File;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The module is the root of a set of packages/sources/artifacts.
+ * At the moment there is only one module in use, the empty/no-name/default module.
+ *
+ * <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 Module implements Comparable<Module> {
+    private String name;
+    private String dirname;
+    private Map<String,Package> packages = new HashMap<String,Package>();
+    private Map<String,Source> sources = new HashMap<String,Source>();
+    private Map<String,File> artifacts = new HashMap<String,File>();
+
+    public Module(String n, String dn) {
+        name = n;
+        dirname = n;
+    }
+
+    public String name() { return name; }
+    public String dirname() { return dirname; }
+    public Map<String,Package> packages() { return packages; }
+    public Map<String,Source> sources() { return sources; }
+    public Map<String,File> artifacts() { return artifacts; }
+
+    @Override
+    public boolean equals(Object o) {
+        return (o instanceof Module) && name.equals(((Module)o).name);
+    }
+
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    @Override
+    public int compareTo(Module o) {
+        return name.compareTo(o.name);
+    }
+
+    public void save(StringBuilder b) {
+        b.append("M ").append(name).append(":").append("\n");
+        Package.savePackages(packages, b);
+    }
+
+    public static Module load(String l) {
+        int cp = l.indexOf(':',2);
+        if (cp == -1) return null;
+        String name = l.substring(2,cp);
+        return new Module(name, "");
+    }
+
+    public static void saveModules(Map<String,Module> ms, StringBuilder b)
+    {
+        for (Module m : ms.values()) {
+            m.save(b);
+        }
+    }
+
+    public void addPackage(Package p) {
+        packages.put(p.name(), p);
+    }
+
+    public Package lookupPackage(String pkg) {
+        Package p = packages.get(pkg);
+        if (p == null) {
+            p = new Package(this, pkg);
+            packages.put(pkg, p);
+        }
+        return p;
+    }
+
+    public void addSource(String pkg, Source src) {
+        Package p = lookupPackage(pkg);
+        src.setPackage(p);
+        p.addSource(src);
+        sources.put(src.file().getPath(), src);
+    }
+
+    public Source lookupSource(String path) {
+        return sources.get(path);
+    }
+
+    public void addArtifacts(String pkg, Set<URI> as) {
+        Package p = lookupPackage(pkg);
+        for (URI u : as) {
+            p.addArtifact(new File(u));
+        }
+    }
+
+    public void setDependencies(String pkg, Set<String> deps) {
+        Package p = lookupPackage(pkg);
+        p.setDependencies(deps);
+    }
+
+    public void setPubapi(String pkg, List<String> ps) {
+        Package p = lookupPackage(pkg);
+        p.setPubapi(ps);
+    }
+
+    public boolean hasPubapiChanged(String pkg, List<String> ps) {
+        Package p = lookupPackage(pkg);
+        return p.hasPubapiChanged(ps);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/Package.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,307 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The Package class maintains meta information about a package.
+ * For example its sources, dependents,its pubapi and its artifacts.
+ *
+ * It might look odd that we track dependents/pubapi/artifacts on
+ * a package level, but it makes sense since recompiling a full package
+ * takes as long as recompiling a single java file in that package,
+ * if you take into account the startup time of the jvm.
+ *
+ * Also the dependency information will be much smaller (good for the javac_state file size)
+ * and it simplifies tracking artifact generation, you do not always know from which
+ * source a class file was generated, but you always know which package it belongs to.
+ *
+ * It is also educational to see package dependencies triggering recompilation of
+ * other packages. Even though the recompilation was perhaps not necessary,
+ * the visible recompilation of the dependent packages indicates how much circular
+ * dependencies your code has.
+ *
+ * <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 Package implements Comparable<Package> {
+    // The module this package belongs to. (There is a legacy module with an empty string name,
+    // used for all legacy sources.)
+    private Module mod;
+    // Name of this package, module:pkg
+    // ex1 jdk.base:java.lang
+    // ex2 :java.lang (when in legacy mode)
+    private String name;
+    // The directory path to the package. If the package belongs to a module,
+    // then that module's file system name is part of the path.
+    private String dirname;
+    // This package depends on these packages.
+    private Set<String> dependencies = new HashSet<String>();
+    // This package has the following dependents, that depend on this package.
+    private Set<String> dependents = new HashSet<String>();
+    // This is the public api of this package.
+    private List<String> pubapi = new ArrayList<String>();
+    // Map from source file name to Source info object.
+    private Map<String,Source> sources = new HashMap<String,Source>();
+    // This package generated these artifacts.
+    private Map<String,File> artifacts = new HashMap<String,File>();
+
+    public Package(Module m, String n) {
+        int c = n.indexOf(":");
+        assert(c != -1);
+        String mn = n.substring(0,c);
+        assert(m.name().equals(m.name()));
+        name = n;
+        dirname = n.replace('.', File.separatorChar);
+        if (m.name().length() > 0) {
+            // There is a module here, prefix the module dir name to the path.
+            dirname = m.dirname()+File.separatorChar+dirname;
+        }
+    }
+
+    public Module mod() { return mod; }
+    public String name() { return name; }
+    public String dirname() { return dirname; }
+    public Map<String,Source> sources() { return sources; }
+    public Map<String,File> artifacts() { return artifacts; }
+    public List<String> pubapi() { return pubapi; }
+
+    public Set<String> dependencies() { return dependencies; }
+    public Set<String> dependents() { return dependents; }
+
+    @Override
+    public boolean equals(Object o) {
+        return (o instanceof Package) && name.equals(((Package)o).name);
+    }
+
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    @Override
+    public int compareTo(Package o) {
+        return name.compareTo(o.name);
+    }
+
+    public void addSource(Source s) {
+        sources.put(s.file().getPath(), s);
+    }
+
+    public void addDependency(String d) {
+        dependencies.add(d);
+    }
+
+    public void addDependent(String d) {
+        dependents.add(d);
+    }
+
+    public void addPubapi(String p) {
+        pubapi.add(p);
+    }
+
+    /**
+     * Check if we have knowledge in the javac state that
+     * describe the results of compiling this package before.
+     */
+    public boolean existsInJavacState() {
+        return artifacts.size() > 0 || pubapi.size() > 0;
+    }
+
+    public static List<String> pubapiToList(String ps)
+    {
+        String[] lines = ps.split("\n");
+        List<String> r = new ArrayList<String>();
+        for (String l : lines) {
+            r.add(l);
+        }
+        return r;
+    }
+
+    public boolean hasPubapiChanged(List<String> ps) {
+        Iterator<String> i = ps.iterator();
+        Iterator<String> j = pubapi.iterator();
+        int line = 0;
+        while (i.hasNext() && j.hasNext()) {
+            String is = i.next();
+            String js = j.next();
+            if (!is.equals(js)) {
+                Log.debug("Change in pubapi for package "+name+" line "+line);
+                Log.debug("Old: "+js);
+                Log.debug("New: "+is);
+                return true;
+            }
+            line++;
+        }
+        if ((i.hasNext() && !j.hasNext() ) ||
+            (!i.hasNext() && j.hasNext())) {
+            Log.debug("Change in pubapi for package "+name);
+            if (i.hasNext()) {
+                Log.debug("New has more lines!");
+            } else {
+                Log.debug("Old has more lines!");
+            }
+            return true;
+        }
+        return false;
+    }
+
+    public void setPubapi(List<String> ps) {
+        pubapi = ps;
+    }
+
+    public void setDependencies(Set<String> ds) {
+        dependencies = ds;
+    }
+
+    public void save(StringBuilder b) {
+        b.append("P ").append(name).append("\n");
+        Source.saveSources(sources, b);
+        saveDependencies(b);
+        savePubapi(b);
+        saveArtifacts(b);
+    }
+
+    static public Package load(Module module, String l) {
+        String name = l.substring(2);
+        return new Package(module, name);
+    }
+
+    public void loadDependency(String l) {
+        String n = l.substring(2);
+        addDependency(n);
+    }
+
+    public void loadPubapi(String l) {
+        String pi = l.substring(2);
+        addPubapi(pi);
+    }
+
+    public void saveDependencies(StringBuilder b) {
+        List<String> sorted_dependencies = new ArrayList<String>();
+        for (String key : dependencies) {
+            sorted_dependencies.add(key);
+        }
+        Collections.sort(sorted_dependencies);
+        for (String a : sorted_dependencies) {
+            b.append("D "+a+"\n");
+        }
+    }
+
+    public void savePubapi(StringBuilder b) {
+        for (String l : pubapi) {
+            b.append("I "+l+"\n");
+        }
+    }
+
+    public static void savePackages(Map<String,Package> packages, StringBuilder b) {
+        List<String> sorted_packages = new ArrayList<String>();
+        for (String key : packages.keySet() ) {
+            sorted_packages.add(key);
+        }
+        Collections.sort(sorted_packages);
+        for (String s : sorted_packages) {
+            Package p = packages.get(s);
+            p.save(b);
+        }
+    }
+
+    public void addArtifact(String a) {
+        artifacts.put(a, new File(a));
+    }
+
+    public void addArtifact(File f) {
+        artifacts.put(f.getPath(), f);
+    }
+
+    public void addArtifacts(Set<URI> as) {
+        for (URI u : as) {
+            addArtifact(new File(u));
+        }
+    }
+
+    public void setArtifacts(Set<URI> as) {
+        assert(!artifacts.isEmpty());
+        artifacts = new HashMap<String,File>();
+        addArtifacts(as);
+    }
+
+    public void loadArtifact(String l) {
+        // Find next space after "A ".
+        int dp = l.indexOf(' ',2);
+        String fn = l.substring(2,dp);
+        long last_modified = Long.parseLong(l.substring(dp+1));
+        File f = new File(fn);
+        if (f.exists() && f.lastModified() != last_modified) {
+            // Hmm, the artifact on disk does not have the same last modified
+            // timestamp as the information from the build database.
+            // We no longer trust the artifact on disk. Delete it.
+            // The smart javac wrapper will then rebuild the artifact.
+            Log.debug("Removing "+f.getPath()+" since its timestamp does not match javac_state.");
+            f.delete();
+        }
+        artifacts.put(f.getPath(), f);
+    }
+
+    public void saveArtifacts(StringBuilder b) {
+        List<File> sorted_artifacts = new ArrayList<File>();
+        for (File f : artifacts.values()) {
+            sorted_artifacts.add(f);
+        }
+        Collections.sort(sorted_artifacts);
+        for (File f : sorted_artifacts) {
+            // The last modified information is only used
+            // to detect tampering with the output dir.
+            // If the outputdir has been modified, not by javac,
+            // then a mismatch will be detected in the last modified
+            // timestamps stored in the build database compared
+            // to the timestamps on disk and the artifact will be deleted.
+
+            b.append("A "+f.getPath()+" "+f.lastModified()+"\n");
+        }
+    }
+
+    /**
+     * Always clean out a tainted package before it is recompiled.
+     */
+    public void deleteArtifacts() {
+        for (File a : artifacts.values()) {
+            a.delete();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/ProblemException.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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.  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.sjavac;
+
+/**
+ * Used to signal serious problems when running sjavac.
+ *
+ * <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 ProblemException extends Exception {
+    static final long serialVersionUID = -3387516993124229949L;
+    public ProblemException(String s) {
+        super(s);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/Source.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,400 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.File;
+import java.util.Set;
+import java.util.Collections;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+
+/** A Source object maintains information about a source file.
+ * For example which package it belongs to and kind of source it is.
+ * The class also knows how to find source files (scanRoot) given include/exclude
+ * patterns and a root.
+ *
+ * <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 Source implements Comparable<Source> {
+    // The package the source belongs to.
+   private Package pkg;
+    // Name of this source file, relative its source root.
+    // For example: java/lang/Object.java
+    // Or if the source file is inside a module:
+    // jdk.base/java/lang/Object.java
+    private String name;
+    // What kind of file is this.
+    private String suffix;
+    // When this source file was last_modified
+    private long lastModified;
+    // The source File.
+    private File file;
+    // The source root under which file resides.
+    private File root;
+    // If the source is generated.
+    private boolean isGenerated;
+    // If the source is only linked to, not compiled.
+    private boolean linkedOnly;
+
+    @Override
+    public boolean equals(Object o) {
+        return (o instanceof Source) && name.equals(((Source)o).name);
+    }
+
+    @Override
+    public int compareTo(Source o) {
+        return name.compareTo(o.name);
+    }
+
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    public Source(Module m, String n, File f, File r) {
+        name = n;
+        int dp = n.lastIndexOf(".");
+        if (dp != -1) {
+            suffix = n.substring(dp);
+        } else {
+            suffix = "";
+        }
+        file = f;
+        root = r;
+        lastModified = f.lastModified();
+        linkedOnly = false;
+    }
+
+    public Source(Package p, String n, long lm) {
+        pkg = p;
+        name = n;
+        int dp = n.lastIndexOf(".");
+        if (dp != -1) {
+            suffix = n.substring(dp);
+        } else {
+            suffix = "";
+        }
+        file = null;
+        root = null;
+        lastModified = lm;
+        linkedOnly = false;
+        int ls = n.lastIndexOf('/');
+    }
+
+    public String name() { return name; }
+    public String suffix() { return suffix; }
+    public Package pkg() { return pkg; }
+    public File   file() { return file; }
+    public File   root() { return root; }
+    public long lastModified() {
+        return lastModified;
+    }
+
+    public void setPackage(Package p) {
+        pkg = p;
+    }
+
+    public void markAsGenerated() {
+        isGenerated = true;
+    }
+
+    public boolean isGenerated() {
+        return isGenerated;
+    }
+
+    public void markAsLinkedOnly() {
+        linkedOnly = true;
+    }
+
+    public boolean isLinkedOnly() {
+        return linkedOnly;
+    }
+
+    private void save(StringBuilder b) {
+        String CL = linkedOnly?"L":"C";
+        String GS = isGenerated?"G":"S";
+        b.append(GS+" "+CL+" "+name+" "+file.lastModified()+"\n");
+    }
+    // Parse a line that looks like this:
+    // S C /code/alfa/A.java 1357631228000
+    static public Source load(Package lastPackage, String l, boolean isGenerated) {
+        int sp = l.indexOf(' ',4);
+        if (sp == -1) return null;
+        String name = l.substring(4,sp);
+        long last_modified = Long.parseLong(l.substring(sp+1));
+
+        boolean isLinkedOnly = false;
+        if (l.charAt(2) == 'L') {
+            isLinkedOnly = true;
+        } else if (l.charAt(2) == 'C') {
+            isLinkedOnly = false;
+        } else return null;
+
+        Source s = new Source(lastPackage, name, last_modified);
+        s.file = new File(name);
+        if (isGenerated) s.markAsGenerated();
+        if (isLinkedOnly) s.markAsLinkedOnly();
+        return s;
+    }
+
+    public static void saveSources(Map<String,Source> sources, StringBuilder b) {
+        List<String> sorted_sources = new ArrayList<String>();
+        for (String key : sources.keySet()) {
+            sorted_sources.add(key);
+        }
+        Collections.sort(sorted_sources);
+        for (String key : sorted_sources) {
+            Source s = sources.get(key);
+            s.save(b);
+        }
+    }
+
+    /**
+     * Recurse into the directory root and find all files matchine the excl/incl/exclfiles/inclfiles rules.
+     * Detects the existence of module-info.java files and presumes that the directory it resides in
+     * is the name of the current module.
+     */
+    static public void scanRoot(File root,
+                                Set<String> suffixes,
+                                List<String> excludes, List<String> includes,
+                                List<String> excludeFiles, List<String> includeFiles,
+                                Map<String,Source> foundFiles,
+                                Map<String,Module> foundModules,
+                                Module currentModule,
+                                boolean permitSourcesWithoutPackage,
+                                boolean inGensrc,
+                                boolean inLinksrc)
+        throws ProblemException {
+
+        if (root == null) return;
+        int root_prefix = root.getPath().length()+1;
+        // This is the root source directory, it must not contain any Java sources files
+        // because we do not allow Java source files without a package.
+        // (Unless of course --permit-sources-without-package has been specified.)
+        // It might contain other source files however, (for -tr and -copy) these will
+        // always be included, since no package pattern can match the root directory.
+        currentModule = addFilesInDir(root, root_prefix, root, suffixes, permitSourcesWithoutPackage,
+                                       excludeFiles, includeFiles, false,
+                                       foundFiles, foundModules, currentModule,
+                                       inGensrc, inLinksrc);
+
+        File[] dirfiles = root.listFiles();
+        for (File d : dirfiles) {
+            if (d.isDirectory()) {
+                // Descend into the directory structure.
+                scanDirectory(d, root_prefix, root, suffixes,
+                              excludes, includes, excludeFiles, includeFiles,
+                              false, foundFiles, foundModules, currentModule, inGensrc, inLinksrc);
+            }
+        }
+    }
+
+    /**
+     * Test if a path matches any of the patterns given.
+     * The pattern foo.bar matches only foo.bar
+     * The pattern foo.* matches foo.bar and foo.bar.zoo etc
+     */
+    static private boolean hasMatch(String path, List<String> patterns) {
+        for (String p : patterns) {
+            // Exact match
+            if (p.equals(path)) {
+                return true;
+            }
+            // Single dot the end matches this package and all its subpackages.
+            if (p.endsWith(".*")) {
+                // Remove the wildcard
+                String patprefix = p.substring(0,p.length()-2);
+                // Does the path start with the pattern prefix?
+                if (path.startsWith(patprefix)) {
+                    // If the path has the same length as the pattern prefix, then it is a match.
+                    // If the path is longer, then make sure that
+                    // the next part of the path starts with a dot (.) to prevent
+                    // wildcard matching in the middle of a package name.
+                    if (path.length()==patprefix.length() || path.charAt(patprefix.length())=='.') {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Matches patterns with the asterisk first. */
+     // The pattern foo/bar.java only matches foo/bar.java
+     // The pattern */bar.java matches foo/bar.java and zoo/bar.java etc
+    static private boolean hasFileMatch(String path, List<String> patterns) {
+        path = Util.normalizeDriveLetter(path);
+        for (String p : patterns) {
+            // Exact match
+            if (p.equals(path)) {
+                return true;
+            }
+            // Single dot the end matches this package and all its subpackages.
+            if (p.startsWith("*")) {
+                // Remove the wildcard
+                String patsuffix = p.substring(1);
+                // Does the path start with the pattern prefix?
+                if (path.endsWith(patsuffix)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Add the files in the directory, assuming that the file has not been excluded.
+     * Returns a fresh Module object, if this was a dir with a module-info.java file.
+     */
+    static private Module addFilesInDir(File dir, int rootPrefix, File root,
+                                        Set<String> suffixes, boolean allow_javas,
+                                        List<String> excludeFiles, List<String> includeFiles, boolean all,
+                                        Map<String,Source> foundFiles,
+                                        Map<String,Module> foundModules,
+                                        Module currentModule,
+                                        boolean inGensrc,
+                                        boolean inLinksrc)
+        throws ProblemException
+    {
+        for (File f : dir.listFiles()) {
+            if (f.isFile()) {
+                boolean should_add =
+                    (excludeFiles == null || excludeFiles.isEmpty() || !hasFileMatch(f.getPath(), excludeFiles))
+                    && (includeFiles == null || includeFiles.isEmpty() || hasFileMatch(f.getPath(), includeFiles));
+
+                if (should_add) {
+                    if (!allow_javas && f.getName().endsWith(".java")) {
+                        throw new ProblemException("No .java files are allowed in the source root "+dir.getPath()+
+                                                   ", please remove "+f.getName());
+                    }
+                    // Extract the file name relative the root.
+                    String fn = f.getPath().substring(rootPrefix);
+                    // Extract the package name.
+                    int sp = fn.lastIndexOf(File.separatorChar);
+                    String pkg = "";
+                    if (sp != -1) {
+                        pkg = fn.substring(0,sp).replace(File.separatorChar,'.');
+                    }
+                    // Is this a module-info.java file?
+                    if (fn.endsWith("module-info.java")) {
+                        // Aha! We have recursed into a module!
+                        if (!currentModule.name().equals("")) {
+                            throw new ProblemException("You have an extra module-info.java inside a module! Please remove "+fn);
+                        }
+                        String module_name = fn.substring(0,fn.length()-16);
+                        currentModule = new Module(module_name, f.getPath());
+                        foundModules.put(module_name, currentModule);
+                    }
+                    // Extract the suffix.
+                    int dp = fn.lastIndexOf(".");
+                    String suffix = "";
+                    if (dp > 0) {
+                        suffix = fn.substring(dp);
+                    }
+                    // Should the file be added?
+                    if (all || suffixes.contains(suffix)) {
+                        Source of = foundFiles.get(f.getPath());
+                        if (of != null) {
+                            throw new ProblemException("You have already added the file "+fn+" from "+of.file().getPath());
+                        }
+                        of = currentModule.lookupSource(f.getPath());
+                        if (of != null) {
+                            // Oups, the source is already added, could be ok, could be not, lets check.
+                            if (inLinksrc) {
+                                // So we are collecting sources for linking only.
+                                if (of.isLinkedOnly()) {
+                                    // Ouch, this one is also for linking only. Bad.
+                                    throw new ProblemException("You have already added the link only file "+fn+" from "+of.file().getPath());
+                                }
+                                // Ok, the existing source is to be compiled. Thus this link only is redundant
+                                // since all compiled are also linked to. Continue to the next source.
+                                // But we need to add the source, so that it will be visible to linking,
+                                // if not the multi core compile will fail because a JavaCompiler cannot
+                                // find the necessary dependencies for its part of the source.
+                                foundFiles.put(f.getPath(), of);
+                                continue;
+                            } else {
+                                // We are looking for sources to compile, if we find an existing to be compiled
+                                // source with the same name, it is an internal error, since we must
+                                // find the sources to be compiled before we find the sources to be linked to.
+                                throw new ProblemException("Internal error: Double add of file "+fn+" from "+of.file().getPath());
+                            }
+                        }
+                        Source s = new Source(currentModule, f.getPath(), f, root);
+                        if (inGensrc) s.markAsGenerated();
+                        if (inLinksrc) {
+                            s.markAsLinkedOnly();
+                        }
+                        pkg = currentModule.name()+":"+pkg;
+                        foundFiles.put(f.getPath(), s);
+                        currentModule.addSource(pkg, s);
+                    }
+                }
+            }
+        }
+        return currentModule;
+    }
+
+    private static boolean gurka = false;
+
+    static private void scanDirectory(File dir, int rootPrefix, File root,
+                                      Set<String> suffixes,
+                                      List<String> excludes, List<String> includes,
+                                      List<String> excludeFiles, List<String> includeFiles, boolean all,
+                                      Map<String,Source> foundFiles,
+                                      Map<String,Module> foundModules,
+                                      Module currentModule, boolean inGensrc, boolean inLinksrc)
+        throws ProblemException {
+
+        String pkg_name = "";
+        // Remove the root prefix from the dir path, and replace file separator with dots
+        // to get the package name.
+        if (dir.getPath().length() > rootPrefix) {
+            pkg_name = dir.getPath().substring(rootPrefix).replace(File.separatorChar,'.');
+        }
+        // Should this package directory be included and not excluded?
+        if (all || ((includes==null || includes.isEmpty() || hasMatch(pkg_name, includes)) &&
+                    (excludes==null || excludes.isEmpty() || !hasMatch(pkg_name, excludes)))) {
+            // Add the source files.
+            currentModule = addFilesInDir(dir, rootPrefix, root, suffixes, true, excludeFiles, includeFiles, all,
+                                          foundFiles, foundModules, currentModule, inGensrc, inLinksrc);
+        }
+
+        for (File d : dir.listFiles()) {
+            if (d.isDirectory()) {
+                // Descend into the directory structure.
+                scanDirectory(d, rootPrefix, root, suffixes,
+                              excludes, includes, excludeFiles, includeFiles, all,
+                              foundFiles, foundModules, currentModule, inGensrc, inLinksrc);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/Transformer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,99 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.PrintStream;
+import java.net.URI;
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * The transform interface is used to transform content inside a package, from one form to another.
+ * Usually the output form is an unpredictable number of output files. (eg class files)
+ * but can also be an unpredictable number of generated source files (eg idl2java)
+ * or a single predictable output file (eg when copying,cleaning or compiling a properties file).
+ *
+ * <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 interface Transformer
+{
+    /**
+     * The transform method takes a set of package names, mapped to their source files and to the
+     * pubapis of the packages.
+     *
+     * The transform implementation must:
+     *    store the names of the generated artifacts for each package into package_artifacts
+     *    store found dependencies to other packages into the supplied set package_dependencies
+     *    store the public api for a package into the supplied set package_pubapis
+     *
+     * Any benign messages as a result of running the transform
+     * are written into stdout, and errors are written to stderr.
+     *
+     * The debug_level can be 0=silent (only warnings and errors) 1=normal 2=verbose 3 or greater=debug
+     * setExtra is used to set the extra information information that can be passed on
+     * the command line to the smart javac wrapper.
+     *
+     * If sjavac is building incrementally from an existing javac_state, the var incremental is true.
+     *
+     * The transformer will only be called if some source in the package (or dependency) has
+     * a modified timestamp. Thus the transformer might get called with many sources, of which
+     * only one has changed. The transformer is allowed to regenerate all artifacts but
+     * a better transformer will only write those artifacts that need updating.
+     *
+     * However the transformer must verify that the existing artifacts really are there!
+     * and it must always update package_artifacts, package_dependencies, and package_pubapis correctly.
+     * This means that at least for Java source, it will always have to recompile the sources.
+     *
+     * The transformer is allowed to put files anywhere in the dest_root.
+     * An example of this is, can be the META-INF transformer that copy files
+     * below META-INF directories to the single META-INF directory below dest_root.
+     *
+     * False is returned if there was an error that prevented the transform.
+     * I.e. something was printed on stderr.
+     *
+     * If num_cores is set to a non-zero value. The transform should attempt to use no more than these
+     * number of threads for heavy work.
+     */
+    boolean transform(Map<String,Set<URI>> pkgSrcs,
+                      Set<URI>             visibleSources,
+                      Map<URI,Set<String>> visibleClasses,
+                      Map<String,Set<String>> oldPackageDependencies,
+                      URI destRoot,
+                      Map<String,Set<URI>>    packageArtifacts,
+                      Map<String,Set<String>> packageDependencies,
+                      Map<String,String>      packagePublicApis,
+                      int debugLevel,
+                      boolean incremental,
+                      int numCores,
+                      PrintStream out,
+                      PrintStream err);
+
+    void setExtra(String e);
+    void setExtra(String[] args);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/Util.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,160 @@
+/*
+ * 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.  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.sjavac;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+/**
+ * Utilities.
+ *
+ * <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 Util {
+
+    public static String toFileSystemPath(String pkgId) {
+        if (pkgId == null || pkgId.length()==0) return null;
+        String pn;
+        if (pkgId.charAt(0) == ':') {
+            // When the module is the default empty module.
+            // Do not prepend the module directory, because there is none.
+            // Thus :java.foo.bar translates to java/foo/bar (or \)
+            pn = pkgId.substring(1).replace('.',File.separatorChar);
+        } else {
+            // There is a module. Thus jdk.base:java.foo.bar translates
+            // into jdk.base/java/foo/bar
+            int cp = pkgId.indexOf(':');
+            String mn = pkgId.substring(0,cp);
+            pn = mn+File.separatorChar+pkgId.substring(cp+1).replace('.',File.separatorChar);
+        }
+        return pn;
+    }
+
+    public static String justPackageName(String pkgName) {
+        int c = pkgName.indexOf(":");
+        assert(c != -1);
+        return pkgName.substring(c+1);
+    }
+
+    public static String extractStringOption(String opName, String s) {
+        int p = s.indexOf(opName+"=");
+        if (p == -1) return null;
+        p+=opName.length()+1;
+        int pe = s.indexOf(',', p);
+        if (pe == -1) pe = s.length();
+        return s.substring(p, pe);
+    }
+
+    public static int extractIntOption(String opName, String s) {
+        int p = s.indexOf(opName+"=");
+        if (p == -1) return 0;
+        p+=opName.length()+1;
+        int pe = s.indexOf(',', p);
+        if (pe == -1) pe = s.length();
+        int v = 0;
+        try {
+            v = Integer.parseInt(s.substring(p, pe));
+        } catch (Exception e) {}
+        return v;
+    }
+
+    /**
+     * Clean out unwanted sub options supplied inside a primary option.
+     * For example to only had portfile remaining from:
+     *    settings="--server:id=foo,portfile=bar"
+     * do settings = cleanOptions("--server:",Util.set("-portfile"),settings);
+     *    now settings equals "--server:portfile=bar"
+     *
+     * @param optionPrefix The option name, including colon, eg --server:
+     * @param allowsSubOptions A set of the allowed sub options, id portfile etc.
+     * @param s The option settings string.
+     */
+    public static String cleanSubOptions(String optionPrefix, Set<String> allowedSubOptions, String s) {
+        StringBuilder sb = new StringBuilder();
+        if (!s.startsWith(optionPrefix)) return "";
+        StringTokenizer st = new StringTokenizer(s.substring(optionPrefix.length()), ",");
+        while (st.hasMoreTokens()) {
+            String o = st.nextToken();
+            int p = o.indexOf('=');
+            if (p>0) {
+                String key = o.substring(0,p);
+                String val = o.substring(p+1);
+                if (allowedSubOptions.contains(key)) {
+                    if (sb.length() > 0) sb.append(',');
+                    sb.append(key+"="+val);
+                }
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Convenience method to create a set with strings.
+     */
+    public static Set<String> set(String... ss) {
+        Set<String> set = new HashSet<String>();
+        set.addAll(Arrays.asList(ss));
+        return set;
+    }
+
+    /**
+     * Normalize windows drive letter paths to upper case to enable string
+     * comparison.
+     *
+     * @param file File name to normalize
+     * @return The normalized string if file has a drive letter at the beginning,
+     *         otherwise the original string.
+     */
+    public static String normalizeDriveLetter(String file) {
+        if (file.length() > 2 && file.charAt(1) == ':') {
+            return Character.toUpperCase(file.charAt(0)) + file.substring(1);
+        } else if (file.length() > 3 && file.charAt(0) == '*'
+                   && file.charAt(2) == ':') {
+            // Handle a wildcard * at the beginning of the string.
+            return file.substring(0, 1) + Character.toUpperCase(file.charAt(1))
+                   + file.substring(2);
+        }
+        return file;
+    }
+
+    /**
+     * Locate the setting for the server properties.
+     */
+    public static String findServerSettings(String[] args) {
+        for (String s : args) {
+            if (s.startsWith("--server:")) {
+                return s;
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/comp/Dependencies.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 1999, 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.sjavac.comp;
+
+import javax.lang.model.element.Element;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Name;
+
+/** Utility class containing dependency information between packages
+ *  and the pubapi for a package.
+ *
+ * <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 Dependencies {
+    protected static final Context.Key<Dependencies> dependenciesKey =
+        new Context.Key<Dependencies>();
+
+    // The log to be used for error reporting.
+    protected Log log;
+    // Map from package name to packages that the package depends upon.
+    protected Map<Name,Set<Name>> deps;
+    // This is the set of all packages that are supplied
+    // through the java files at the command line.
+    protected Set<Name> explicitPackages;
+
+    // Map from a package name to its public api.
+    // Will the Name encode the module in the future?
+    // If not, this will have to change to map from Module+Name to public api.
+    protected Map<Name,StringBuffer> publicApiPerClass;
+
+    public static Dependencies instance(Context context) {
+        Dependencies instance = context.get(dependenciesKey);
+        if (instance == null)
+            instance = new Dependencies(context);
+        return instance;
+    }
+
+    private Dependencies(Context context) {
+        context.put(dependenciesKey, this);
+        log = Log.instance(context);
+    }
+
+    public void reset()
+    {
+        deps = new HashMap<Name, Set<Name>>();
+        explicitPackages = new HashSet<Name>();
+        publicApiPerClass = new HashMap<Name,StringBuffer>();
+    }
+
+    /**
+     * Fetch the set of dependencies that are relevant to the compile
+     * that has just been performed. I.e. we are only interested in
+     * dependencies for classes that were explicitly compiled.
+     * @return
+     */
+    public Map<String,Set<String>> getDependencies() {
+        Map<String,Set<String>> new_deps = new HashMap<String,Set<String>>();
+        if (explicitPackages == null) return new_deps;
+        for (Name pkg : explicitPackages) {
+            Set<Name> set = deps.get(pkg);
+            if (set != null) {
+                Set<String> new_set = new_deps.get(pkg.toString());
+                if (new_set == null) {
+                    new_set = new HashSet<String>();
+                    // Modules beware....
+                    new_deps.put(":"+pkg.toString(), new_set);
+                }
+                for (Name d : set) {
+                    new_set.add(":"+d.toString());
+                }
+            }
+        }
+        return new_deps;
+    }
+
+    static class CompareNames implements Comparator<Name> {
+         public int compare(Name a, Name b) {
+             return a.toString().compareTo(b.toString());
+         }
+
+    }
+
+    /**
+     * Convert the map from class names to their pubapi to a map
+     * from package names to their pubapi (which is the sorted concatenation
+     * of all the class pubapis)
+     */
+    public Map<String,String> getPubapis() {
+        Map<String,String> publicApiPerPackage = new HashMap<String,String>();
+        if (publicApiPerClass == null) return publicApiPerPackage;
+        Name[] keys = publicApiPerClass.keySet().toArray(new Name[0]);
+        Arrays.sort(keys, new CompareNames());
+        StringBuffer newPublicApi = new StringBuffer();
+        int i=0;
+        String prevPkg = "";
+        for (Name k : keys) {
+            String cn = k.toString();
+            String pn = "";
+            int dp = cn.lastIndexOf('.');
+            if (dp != -1) {
+                pn = cn.substring(0,dp);
+            }
+            if (!pn.equals(prevPkg)) {
+                if (!prevPkg.equals("")) {
+                    // Add default module name ":"
+                    publicApiPerPackage.put(":"+prevPkg, newPublicApi.toString());
+                }
+                newPublicApi = new StringBuffer();
+                prevPkg = pn;
+            }
+            newPublicApi.append(publicApiPerClass.get(k));
+            i++;
+        }
+        if (!prevPkg.equals(""))
+            publicApiPerPackage.put(":"+prevPkg, newPublicApi.toString());
+        return publicApiPerPackage;
+    }
+
+    /**
+     * Visit the api of a class and construct a pubapi string and
+     * store it into the pubapi_perclass map.
+     */
+    public void visitPubapi(Element e) {
+        Name n = ((ClassSymbol)e).fullname;
+        Name p = ((ClassSymbol)e).packge().fullname;
+        StringBuffer sb = publicApiPerClass.get(n);
+        assert(sb == null);
+        sb = new StringBuffer();
+        PubapiVisitor v = new PubapiVisitor(sb);
+        v.visit(e);
+        if (sb.length()>0) {
+            publicApiPerClass.put(n, sb);
+        }
+        explicitPackages.add(p);
+     }
+
+    /**
+     * Collect a dependency. curr_pkg is marked as depending on dep_pkg.
+     */
+    public void collect(Name currPkg, Name depPkg) {
+        if (!currPkg.equals(depPkg)) {
+            Set<Name> theset = deps.get(currPkg);
+            if (theset==null) {
+                theset = new HashSet<Name>();
+                deps.put(currPkg, theset);
+            }
+            theset.add(depPkg);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/comp/JavaCompilerWithDeps.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,109 @@
+/*
+ * 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.  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.sjavac.comp;
+
+import java.util.StringTokenizer;
+
+import com.sun.tools.javac.main.JavaCompiler;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.sjavac.server.CompilerThread;
+import java.io.File;
+
+/** Subclass to Resolve that overrides collect.
+ *
+ * <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 JavaCompilerWithDeps extends JavaCompiler {
+
+    /** The dependency database
+     */
+    protected Dependencies deps;
+    protected CompilerThread compilerThread;
+
+    public JavaCompilerWithDeps(Context context, CompilerThread t) {
+        super(context);
+        deps = Dependencies.instance(context);
+        compilerThread = t;
+        needRootClasses = true;
+    }
+
+    public static void preRegister(Context context, final CompilerThread t) {
+        context.put(compilerKey, new Context.Factory<JavaCompiler>() {
+            public JavaCompiler make(Context c) {
+                JavaCompiler instance = new JavaCompilerWithDeps(c, t);
+                c.put(JavaCompiler.class, instance);
+                return instance;
+            }
+        });
+    }
+
+    /** Collect the public apis of classes supplied explicitly for compilation.
+     * @param sym The class to visit.
+     */
+    @Override
+    public void reportPublicApi(ClassSymbol sym) {
+        // The next test will catch when source files are located in the wrong directory!
+        // This ought to be moved into javac as a new warning, or perhaps as part
+        // of the auxiliary class warning.
+
+        // For example if sun.swing.BeanInfoUtils
+        // is in fact stored in: /mybuild/jdk/gensrc/javax/swing/beaninfo/BeanInfoUtils.java
+
+        // We do not need to test that BeanInfoUtils is stored in a file named BeanInfoUtils
+        // since this is checked earlier.
+        if (sym.sourcefile != null) {
+            // Rewrite sun.swing.BeanInfoUtils into /sun/swing/
+            StringBuilder pathb = new StringBuilder();
+            StringTokenizer qn = new StringTokenizer(sym.packge().toString(), ".");
+            boolean first = true;
+            while (qn.hasMoreTokens()) {
+                String o = qn.nextToken();
+                pathb.append("/");
+                pathb.append(o);
+                first = false;
+            }
+            pathb.append("/");
+            String path = pathb.toString();
+
+            // Now cut the uri to be: file:///mybuild/jdk/gensrc/javax/swing/beaninfo/
+            String p = sym.sourcefile.toUri().getPath();
+            // Do not use File.separatorChar here, a URI always uses slashes /.
+            int i = p.lastIndexOf("/");
+            String pp = p.substring(0,i+1);
+
+            // Now check if the truncated uri ends with the path. (It does not == failure!)
+            if (path.length() > 0 && !path.equals("/unnamed package/") && !pp.endsWith(path)) {
+                compilerThread.logError("Error: The source file "+sym.sourcefile.getName()+
+                                        " is located in the wrong package directory, because it contains the class "+
+                                        sym.getQualifiedName());
+            }
+        }
+        deps.visitPubapi(sym);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.sjavac.comp;
+
+import java.util.Iterator;
+import java.util.List;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.ElementScanner6;
+
+/** Utility class that constructs a textual representation
+ * of the public api of a class.
+ *
+ * <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 PubapiVisitor extends ElementScanner6<Void, Void> {
+
+    StringBuffer sb;
+    // Important that it is 1! Part of protocol over wire, silly yes.
+    // Fix please.
+    int indent = 1;
+
+    public PubapiVisitor(StringBuffer sb) {
+        this.sb = sb;
+    }
+
+    String depth(int l) {
+        return "                                              ".substring(0, l);
+    }
+
+    @Override
+    public Void visitType(TypeElement e, Void p) {
+        if (e.getModifiers().contains(Modifier.PUBLIC)
+            || e.getModifiers().contains(Modifier.PROTECTED))
+        {
+            sb.append(depth(indent) + "TYPE " + e.getQualifiedName() + "\n");
+            indent += 2;
+            Void v = super.visitType(e, p);
+            indent -= 2;
+            return v;
+        }
+        return null;
+    }
+
+    @Override
+    public Void visitVariable(VariableElement e, Void p) {
+        if (e.getModifiers().contains(Modifier.PUBLIC)
+            || e.getModifiers().contains(Modifier.PROTECTED)) {
+            sb.append(depth(indent)).append("VAR ")
+                    .append(makeVariableString(e)).append("\n");
+        }
+        // Safe to not recurse here, because the only thing
+        // to visit here is the constructor of a variable declaration.
+        // If it happens to contain an anonymous inner class (which it might)
+        // then this class is never visible outside of the package anyway, so
+        // we are allowed to ignore it here.
+        return null;
+    }
+
+    @Override
+    public Void visitExecutable(ExecutableElement e, Void p) {
+        if (e.getModifiers().contains(Modifier.PUBLIC)
+            || e.getModifiers().contains(Modifier.PROTECTED)) {
+            sb.append(depth(indent)).append("METHOD ")
+                    .append(makeMethodString(e)).append("\n");
+        }
+        return null;
+    }
+
+    /**
+     * Creates a String representation of a method element with everything
+     * necessary to track all public aspects of it in an API.
+     * @param e Element to create String for.
+     * @return String representation of element.
+     */
+    protected String makeMethodString(ExecutableElement e) {
+        StringBuilder result = new StringBuilder();
+        for (Modifier modifier : e.getModifiers()) {
+            result.append(modifier.toString());
+            result.append(" ");
+        }
+        result.append(e.getReturnType().toString());
+        result.append(" ");
+        result.append(e.toString());
+
+        List<? extends TypeMirror> thrownTypes = e.getThrownTypes();
+        if (!thrownTypes.isEmpty()) {
+            result.append(" throws ");
+            for (Iterator<? extends TypeMirror> iterator = thrownTypes
+                    .iterator(); iterator.hasNext();) {
+                TypeMirror typeMirror = iterator.next();
+                result.append(typeMirror.toString());
+                if (iterator.hasNext()) {
+                    result.append(", ");
+                }
+            }
+        }
+        return result.toString();
+    }
+
+    /**
+     * Creates a String representation of a variable element with everything
+     * necessary to track all public aspects of it in an API.
+     * @param e Element to create String for.
+     * @return String representation of element.
+     */
+    protected String makeVariableString(VariableElement e) {
+        StringBuilder result = new StringBuilder();
+        for (Modifier modifier : e.getModifiers()) {
+            result.append(modifier.toString());
+            result.append(" ");
+        }
+        result.append(e.asType().toString());
+        result.append(" ");
+        result.append(e.toString());
+        Object value = e.getConstantValue();
+        if (value != null) {
+            result.append(" = ");
+            if (e.asType().toString().equals("char")) {
+                int v = (int)value.toString().charAt(0);
+                result.append("'\\u"+Integer.toString(v,16)+"'");
+            } else {
+                result.append(value.toString());
+            }
+        }
+        return result.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/comp/ResolveWithDeps.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,67 @@
+/*
+ * 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.  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.sjavac.comp;
+
+import com.sun.tools.javac.comp.Resolve;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.code.Symbol;
+
+/** Subclass to Resolve that overrides collect.
+ *
+ * <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 ResolveWithDeps extends Resolve {
+
+    /** The dependency database
+     */
+    protected Dependencies deps;
+
+    protected ResolveWithDeps(Context context) {
+        super(context);
+        deps = Dependencies.instance(context);
+    }
+
+    public static void preRegister(Context context) {
+        context.put(resolveKey, new Context.Factory<Resolve>() {
+            public Resolve make(Context c) {
+                Resolve instance = new ResolveWithDeps(c);
+                c.put(Resolve.class, instance);
+                return instance;
+            }
+        });
+    }
+    /** Collect dependencies in the enclosing class
+     * @param from The enclosing class sym
+     * @param to   The enclosing classes references this sym.
+     * */
+    @Override
+    public void reportDependence(Symbol from, Symbol to) {
+        // Capture dependencies between the packages.
+        deps.collect(from.packge().fullname, to.packge().fullname);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,221 @@
+/*
+ * 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.  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.sjavac.comp;
+
+import com.sun.tools.javac.util.ListBuffer;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+import javax.tools.*;
+import javax.tools.JavaFileObject.Kind;
+
+/**
+ * Intercepts reads and writes to the file system to gather
+ * information about what artifacts are generated.
+ *
+ * Traps writes to certain files, if the content written is identical
+ * to the existing file.
+ *
+ * Can also blind out the filemanager from seeing certain files in the file system.
+ * Necessary to prevent javac from seeing some sources where the source path points.
+ *
+ * <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 SmartFileManager extends ForwardingJavaFileManager<JavaFileManager> {
+
+    // Set of sources that can be seen by javac.
+    Set<URI> visibleSources = new HashSet<URI>();
+    // Map from modulename:packagename to artifacts.
+    Map<String,Set<URI>> packageArtifacts = new HashMap<String,Set<URI>>();
+    // Where to print informational messages.
+    PrintWriter stdout;
+
+    public SmartFileManager(JavaFileManager fileManager) {
+        super(fileManager);
+    }
+
+    public void setVisibleSources(Set<URI> s) {
+        visibleSources = s;
+    }
+
+    public void cleanArtifacts() {
+        packageArtifacts = new HashMap<String,Set<URI>>();
+    }
+
+    public void setLog(PrintWriter pw) {
+        stdout = pw;
+    }
+
+    public Map<String,Set<URI>> getPackageArtifacts() {
+        return packageArtifacts;
+    }
+
+    @Override
+    public Iterable<JavaFileObject> list(Location location,
+                                         String packageName,
+                                         Set<Kind> kinds,
+                                         boolean recurse)
+        throws IOException
+    {
+        // Acquire the list of files.
+        Iterable<JavaFileObject> files = super.list(location, packageName, kinds, recurse);
+        if (visibleSources.isEmpty()) {
+            return files;
+        }
+        // Now filter!
+        ListBuffer<JavaFileObject> filteredFiles = new ListBuffer<JavaFileObject>();
+        for (JavaFileObject f : files) {
+            URI uri = f.toUri();
+            String t = uri.toString();
+            if (t.startsWith("jar:")
+                || t.endsWith(".class")
+                || visibleSources.contains(uri))
+            {
+                filteredFiles.add(f);
+            }
+        }
+        return filteredFiles;
+    }
+
+    @Override
+    public boolean hasLocation(Location location) {
+        return super.hasLocation(location);
+    }
+
+    @Override
+    public JavaFileObject getJavaFileForInput(Location location,
+                                              String className,
+                                              Kind kind)
+        throws IOException
+    {
+        JavaFileObject file = super.getJavaFileForInput(location, className, kind);
+        if (file == null || visibleSources.isEmpty()) {
+            return file;
+        }
+
+        if (visibleSources.contains(file.toUri())) {
+            return file;
+        }
+        return null;
+    }
+
+    @Override
+    public JavaFileObject getJavaFileForOutput(Location location,
+                                               String className,
+                                               Kind kind,
+                                               FileObject sibling)
+        throws IOException
+    {
+        JavaFileObject file = super.getJavaFileForOutput(location, className, kind, sibling);
+        if (file == null) return file;
+        int dp = className.lastIndexOf('.');
+        String pkg_name = "";
+        if (dp != -1) {
+            pkg_name = className.substring(0, dp);
+        }
+        // When modules are in use, then the mod_name might be something like "jdk_base"
+        String mod_name = "";
+        addArtifact(mod_name+":"+pkg_name, file.toUri());
+        return file;
+    }
+
+    @Override
+    public FileObject getFileForInput(Location location,
+                                      String packageName,
+                                      String relativeName)
+        throws IOException
+    {
+        FileObject file =  super.getFileForInput(location, packageName, relativeName);
+        if (file == null || visibleSources.isEmpty()) {
+            return file;
+        }
+
+        if (visibleSources.contains(file.toUri())) {
+            return file;
+        }
+        return null;
+    }
+
+    @Override
+    public FileObject getFileForOutput(Location location,
+                                       String packageName,
+                                       String relativeName,
+                                       FileObject sibling)
+        throws IOException
+    {
+        FileObject file = super.getFileForOutput(location, packageName, relativeName, sibling);
+        if (file == null) return file;
+        if (location.equals(StandardLocation.NATIVE_HEADER_OUTPUT) &&
+                file instanceof JavaFileObject) {
+           file = new SmartFileObject((JavaFileObject)file, stdout);
+           packageName = ":" + packageNameFromFileName(relativeName);
+        }
+        if (packageName.equals("")) {
+            packageName = ":";
+        }
+        addArtifact(packageName, file.toUri());
+        return file;
+    }
+
+    private String packageNameFromFileName(String fn) {
+        StringBuilder sb = new StringBuilder();
+        int p = fn.indexOf('_'), pp = 0;
+        while (p != -1) {
+            if (sb.length() > 0) sb.append('.');
+            sb.append(fn.substring(pp,p));
+            if (p == fn.length()-1) break;
+            pp = p+1;
+            p = fn.indexOf('_',pp);
+        }
+        return sb.toString();
+    }
+
+    @Override
+    public void flush() throws IOException {
+        super.flush();
+    }
+
+    @Override
+    public void close() throws IOException {
+        super.close();
+    }
+
+    void addArtifact(String pkgName, URI art) {
+        Set<URI> s = packageArtifacts.get(pkgName);
+        if (s == null) {
+            s = new HashSet<URI>();
+            packageArtifacts.put(pkgName, s);
+        }
+        s.add(art);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/comp/SmartFileObject.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,126 @@
+/*
+ * 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.  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.sjavac.comp;
+
+import java.io.*;
+import java.net.URI;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.NestingKind;
+import javax.tools.JavaFileObject;
+
+/**
+ * The SmartFileObject will return an outputstream that cache the written data
+ * and compare the new content with the old content on disk. Only if they differ,
+ * will the file be updated.
+ *
+ * <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 SmartFileObject implements JavaFileObject {
+
+    JavaFileObject file;
+    PrintWriter stdout;
+
+    public SmartFileObject(JavaFileObject r, PrintWriter pw) {
+        file = r;
+        stdout = pw;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return file.equals(other);
+    }
+
+    @Override
+    public int hashCode() {
+        return file.hashCode();
+    }
+
+    public Kind getKind() {
+        return file.getKind();
+    }
+
+    public boolean isNameCompatible(String simpleName, Kind kind) {
+        return file.isNameCompatible(simpleName, kind);
+    }
+
+    public URI toUri() {
+        return file.toUri();
+    }
+
+    public String getName() {
+        return file.getName();
+    }
+
+    public InputStream openInputStream() throws IOException {
+        return file.openInputStream();
+    }
+
+    public OutputStream openOutputStream() throws IOException {
+        return file.openOutputStream();
+    }
+
+    public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+        return file.getCharContent(ignoreEncodingErrors);
+    }
+
+    static String lineseparator = System.getProperty("line.separator");
+
+    public Writer openWriter() throws IOException {
+        StringBuilder s = new StringBuilder();
+        try (BufferedReader r = new BufferedReader(file.openReader(true))) {
+            while (r.ready()) {
+                s.append(r.readLine()+lineseparator);
+            }
+        } catch (FileNotFoundException e) {
+            // Perfectly ok.
+        }
+        return new SmartWriter(file, s.toString(), file.getName(), stdout);
+    }
+
+    public long getLastModified() {
+        return file.getLastModified();
+    }
+
+    public boolean delete() {
+        return file.delete();
+    }
+
+    public Modifier getAccessLevel() {
+        return file.getAccessLevel();
+    }
+
+    public NestingKind getNestingKind() {
+        return file.getNestingKind();
+    }
+
+    public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
+        return file.openReader(ignoreEncodingErrors);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/comp/SmartWriter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,78 @@
+/*
+ * 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.  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.sjavac.comp;
+
+import java.io.*;
+import javax.tools.JavaFileObject;
+
+/**
+ * The SmartWriter will cache the written data and when the writer is closed,
+ * then it will compare the cached data with the old_content string.
+ * If different, then it will write all the new content to the file.
+ * If not, the file is not touched.
+ *
+ *  <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 SmartWriter extends Writer {
+
+    String name;
+    JavaFileObject file;
+    String oldContent;
+    StringWriter newContent = new StringWriter();
+    PrintWriter stdout;
+    boolean closed;
+    public SmartWriter(JavaFileObject f, String s, String n, PrintWriter pw) {
+        name = n;
+        file = f;
+        oldContent = s;
+        newContent = new StringWriter();
+        stdout = pw;
+        closed = false;
+    }
+
+    public void write(char[] chars, int i, int i1)
+    {
+        newContent.write(chars, i, i1);
+    }
+
+    public void close() throws IOException {
+        if (closed) return;
+        closed = true;
+        String s = newContent.toString();
+        if (!oldContent.equals(s)) {
+            int p = file.getName().lastIndexOf(File.separatorChar);
+            try (Writer writer = file.openWriter()) {
+                writer.write(s);
+            }
+            stdout.println("Writing "+file.getName().substring(p+1));
+        }
+    }
+
+    public void flush() throws IOException {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/server/CompilerPool.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,163 @@
+/*
+ * 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.  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.sjavac.server;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Semaphore;
+import java.util.Stack;
+import java.util.concurrent.Future;
+
+/** The compiler pool maintains compiler threads.
+ *
+ * <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 CompilerPool {
+    // The javac server that created this pool.
+    private JavacServer javacServer;
+    // A semaphore protecting the poolsize number of threads.
+    private Semaphore available;
+    // The stack of compiler threads.
+    private Stack<CompilerThread> compilers = new Stack<CompilerThread>();
+    // And the executor server to spawn threads.
+    private final ExecutorService executorPool;
+    // How many requests are active right now?
+    private int concurrentRequests = 0;
+    // When was the last request finished?
+    private long lastRequestFinished = 0;
+    // The total number of requests to this pool.
+    private int numRequests = 0;
+    // Protect access to the three above values.
+    private static final Object conc = new Object();
+
+    /**
+     * Return the javac server that this pool belongs to.
+     */
+    public JavacServer getJavacServer() {
+        return javacServer;
+    }
+
+    /**
+     * Return how many threads are running at this very moment.
+     */
+    public int numActiveRequests()
+    {
+        synchronized (conc) {
+            return concurrentRequests;
+        }
+    }
+
+    /**
+     * Return when the last request was finished.
+     * I.e. the pool has been idle since.
+     */
+    public long lastRequestFinished()
+    {
+        synchronized (conc) {
+            return lastRequestFinished;
+        }
+    }
+
+    /**
+     * Up the number of active requests.
+     */
+    public int startRequest() {
+        int n;
+        synchronized (conc) {
+            concurrentRequests++;
+            numRequests++;
+            n = numRequests;
+        }
+        return n;
+    }
+
+    /**
+     * Down the number of active requests. Return the current time.
+     */
+    public long stopRequest() {
+        synchronized (conc) {
+            concurrentRequests--;
+            lastRequestFinished = System.currentTimeMillis();
+        }
+        return lastRequestFinished;
+    }
+
+    /**
+     * Create a new compiler pool.
+     */
+    CompilerPool(int poolsize, JavacServer server) {
+        available = new Semaphore(poolsize, true);
+        javacServer = server;
+        executorPool = Executors.newFixedThreadPool(poolsize);
+        lastRequestFinished = System.currentTimeMillis();
+    }
+
+    /**
+     * Execute a compiler thread.
+     */
+    public void execute(CompilerThread ct) {
+        executorPool.execute(ct);
+    }
+
+    /**
+     * Execute a minor task, for example generating bytecodes and writing them to disk,
+     * that belong to a major compiler thread task.
+     */
+    public Future<?> executeSubtask(CompilerThread t, Runnable r) {
+        return executorPool.submit(r);
+    }
+
+    /**
+     * Shutdown the pool.
+     */
+    public void shutdown() {
+        executorPool.shutdown();
+    }
+
+    /**
+     * Acquire a compiler thread from the pool, or block until a thread is available.
+     * If the pools is empty, create a new thread, but never more than is "available".
+     */
+    public CompilerThread grabCompilerThread() throws InterruptedException {
+        available.acquire();
+        if (compilers.empty()) {
+            return new CompilerThread(this);
+        }
+        return compilers.pop();
+    }
+
+    /**
+     * Return the specified compiler thread to the pool.
+     */
+    public void returnCompilerThread(CompilerThread h) {
+        compilers.push(h);
+        available.release();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,419 @@
+/*
+ * 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.  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.sjavac.server;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.Socket;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Map;
+import java.util.concurrent.Future;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.BaseFileManager;
+import com.sun.tools.sjavac.comp.Dependencies;
+import com.sun.tools.sjavac.comp.JavaCompilerWithDeps;
+import com.sun.tools.sjavac.comp.SmartFileManager;
+import com.sun.tools.sjavac.comp.ResolveWithDeps;
+
+/**
+ * The compiler thread maintains a JavaCompiler instance and
+ * can receive a request from the client, perform the compilation
+ * requested and report back the results.
+ *
+ *  * <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 CompilerThread implements Runnable {
+    private JavacServer javacServer;
+    private CompilerPool compilerPool;
+    private List<Future<?>> subTasks;
+
+    // Communicating over this socket.
+    private Socket socket;
+
+    // The necessary classes to do a compilation.
+    private com.sun.tools.javac.api.JavacTool compiler;
+    private StandardJavaFileManager fileManager;
+    private BaseFileManager fileManagerBase;
+    private SmartFileManager smartFileManager;
+    private Context context;
+
+    // If true, then this thread is serving a request.
+    private boolean inUse = false;
+
+    CompilerThread(CompilerPool cp) {
+        compilerPool = cp;
+        javacServer = cp.getJavacServer();
+    }
+
+    /**
+     * Execute a minor task, for example generating bytecodes and writing them to disk,
+     * that belong to a major compiler thread task.
+     */
+    public synchronized void executeSubtask(Runnable r) {
+        subTasks.add(compilerPool.executeSubtask(this, r));
+    }
+
+    /**
+     * Count the number of active sub tasks.
+     */
+    public synchronized int numActiveSubTasks() {
+        int c = 0;
+        for (Future<?> f : subTasks) {
+            if (!f.isDone() && !f.isCancelled()) {
+                c++;
+            }
+        }
+        return c;
+    }
+
+    /**
+     * Use this socket for the upcoming request.
+     */
+    public void setSocket(Socket s) {
+        socket = s;
+    }
+
+    /**
+     * Prepare the compiler thread for use. It is not yet started.
+     * It will be started by the executor service.
+     */
+    public synchronized void use() {
+        assert(!inUse);
+        inUse = true;
+        compiler = com.sun.tools.javac.api.JavacTool.create();
+        fileManager = compiler.getStandardFileManager(null, null, null);
+        fileManagerBase = (BaseFileManager)fileManager;
+        smartFileManager = new SmartFileManager(fileManager);
+        context = new Context();
+        context.put(JavaFileManager.class, smartFileManager);
+        ResolveWithDeps.preRegister(context);
+        JavaCompilerWithDeps.preRegister(context, this);
+        subTasks = new ArrayList<Future<?>>();
+    }
+
+    /**
+     * Prepare the compiler thread for idleness.
+     */
+    public synchronized void unuse() {
+        assert(inUse);
+        inUse = false;
+        compiler = null;
+        fileManager = null;
+        fileManagerBase = null;
+        smartFileManager = null;
+        context = null;
+        subTasks = null;
+    }
+
+    /**
+     * Expect this key on the next line read from the reader.
+     */
+    private static boolean expect(BufferedReader in, String key) throws IOException {
+        String s = in.readLine();
+        if (s != null && s.equals(key)) {
+            return true;
+        }
+        return false;
+    }
+
+    // The request identifier, for example GENERATE_NEWBYTECODE
+    String id = "";
+
+    public String currentRequestId() {
+        return id;
+    }
+
+    PrintWriter stdout;
+    PrintWriter stderr;
+    int forcedExitCode = 0;
+
+    public void logError(String msg) {
+        stderr.println(msg);
+        forcedExitCode = -1;
+    }
+
+    /**
+     * Invoked by the executor service.
+     */
+    public void run() {
+        // Unique nr that identifies this request.
+        int thisRequest = compilerPool.startRequest();
+        long start = System.currentTimeMillis();
+        int numClasses = 0;
+        StringBuilder compiledPkgs = new StringBuilder();
+        use();
+
+        PrintWriter out = null;
+        try {
+            javacServer.log("<"+thisRequest+"> Connect from "+socket.getRemoteSocketAddress()+" activethreads="+compilerPool.numActiveRequests());
+            BufferedReader in = new BufferedReader(new InputStreamReader(
+                                                       socket.getInputStream()));
+            out = new PrintWriter(new OutputStreamWriter(
+                                                  socket.getOutputStream()));
+            if (!expect(in, JavacServer.PROTOCOL_COOKIE_VERSION)) {
+                javacServer.log("<"+thisRequest+"> Bad protocol from ip "+socket.getRemoteSocketAddress());
+                return;
+            }
+
+            String cookie = in.readLine();
+            if (cookie == null || !cookie.equals(""+javacServer.getCookie())) {
+                javacServer.log("<"+thisRequest+"> Bad cookie from ip "+socket.getRemoteSocketAddress());
+                return;
+            }
+            if (!expect(in, JavacServer.PROTOCOL_CWD)) {
+                return;
+            }
+            String cwd = in.readLine();
+            if (cwd == null)
+                return;
+            if (!expect(in, JavacServer.PROTOCOL_ID)) {
+                return;
+            }
+            id = in.readLine();
+            if (id == null)
+                return;
+            if (!expect(in, JavacServer.PROTOCOL_ARGS)) {
+                return;
+            }
+            ArrayList<String> the_options = new ArrayList<String>();
+            ArrayList<File> the_classes = new ArrayList<File>();
+            Iterable<File> path = Arrays.<File> asList(new File(cwd));
+
+            for (;;) {
+                String l = in.readLine();
+                if (l == null)
+                    return;
+                if (l.equals(JavacServer.PROTOCOL_SOURCES_TO_COMPILE))
+                    break;
+                if (l.startsWith("--server:"))
+                    continue;
+                if (!l.startsWith("-") && l.endsWith(".java")) {
+                    the_classes.add(new File(l));
+                    numClasses++;
+                } else {
+                    the_options.add(l);
+                }
+                continue;
+            }
+
+            // Load sources to compile
+            Set<URI> sourcesToCompile = new HashSet<URI>();
+            for (;;) {
+                String l = in.readLine();
+                if (l == null)
+                    return;
+                if (l.equals(JavacServer.PROTOCOL_VISIBLE_SOURCES))
+                    break;
+                try {
+                    sourcesToCompile.add(new URI(l));
+                    numClasses++;
+                } catch (URISyntaxException e) {
+                    return;
+                }
+            }
+            // Load visible sources
+            Set<URI> visibleSources = new HashSet<URI>();
+            boolean fix_drive_letter_case = System.getProperty("os.name").toLowerCase().equals("windows");
+            for (;;) {
+                String l = in.readLine();
+                if (l == null)
+                    return;
+                if (l.equals(JavacServer.PROTOCOL_END))
+                    break;
+                try {
+                    URI u = new URI(l);
+                    if (fix_drive_letter_case) {
+                        // Make sure the driver letter is lower case.
+                        String s = u.toString();
+                        if (s.startsWith("file:/") &&
+                            Character.isUpperCase(s.charAt(6))) {
+                            u = new URI("file:/"+Character.toLowerCase(s.charAt(6))+s.substring(7));
+                        }
+                    }
+                    visibleSources.add(u);
+                } catch (URISyntaxException e) {
+                    return;
+                }
+            }
+
+            // A completed request has been received.
+
+            // Now setup the actual compilation....
+            // First deal with explicit source files on cmdline and in at file.
+            com.sun.tools.javac.util.ListBuffer<JavaFileObject> compilationUnits =
+                new com.sun.tools.javac.util.ListBuffer<JavaFileObject>();
+            for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(the_classes)) {
+                compilationUnits.append(i);
+            }
+            // Now deal with sources supplied as source_to_compile.
+            com.sun.tools.javac.util.ListBuffer<File> sourcesToCompileFiles =
+                new com.sun.tools.javac.util.ListBuffer<File>();
+            for (URI u : sourcesToCompile) {
+                sourcesToCompileFiles.append(new File(u));
+            }
+            for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(sourcesToCompileFiles)) {
+                compilationUnits.append(i);
+            }
+            // Log the options to be used.
+            StringBuilder options = new StringBuilder();
+            for (String s : the_options) {
+                options.append(">").append(s).append("< ");
+            }
+            javacServer.log(id+" <"+thisRequest+"> options "+options.toString());
+
+            forcedExitCode = 0;
+            // Create a new logger.
+            StringWriter stdoutLog = new StringWriter();
+            StringWriter stderrLog = new StringWriter();
+            stdout = new PrintWriter(stdoutLog);
+            stderr = new PrintWriter(stderrLog);
+            com.sun.tools.javac.main.Main.Result rc = com.sun.tools.javac.main.Main.Result.OK;
+            try {
+                if (compilationUnits.size() > 0) {
+                    // Bind the new logger to the existing context.
+                    context.put(Log.outKey, stderr);
+                    Log.instance(context).setWriter(Log.WriterKind.NOTICE, stdout);
+                    Log.instance(context).setWriter(Log.WriterKind.WARNING, stderr);
+                    Log.instance(context).setWriter(Log.WriterKind.ERROR, stderr);
+                    // Process the options.
+                    com.sun.tools.javac.api.JavacTool.processOptions(context, smartFileManager, the_options);
+                    fileManagerBase.setContext(context);
+                    smartFileManager.setVisibleSources(visibleSources);
+                    smartFileManager.cleanArtifacts();
+                    smartFileManager.setLog(stdout);
+                    Dependencies.instance(context).reset();
+
+                    com.sun.tools.javac.main.Main ccompiler = new com.sun.tools.javac.main.Main("javacTask", stderr);
+                    String[] aa = the_options.toArray(new String[0]);
+
+                    // Do the compilation!
+                    rc = ccompiler.compile(aa, context, compilationUnits.toList(), null);
+
+                    while (numActiveSubTasks()>0) {
+                        try { Thread.sleep(1000); } catch (InterruptedException e) { }
+                    }
+
+                    smartFileManager.flush();
+                }
+            } catch (Exception e) {
+                stderr.println(e.getMessage());
+                forcedExitCode = -1;
+            }
+
+            // Send the response..
+            out.println(JavacServer.PROTOCOL_STDOUT);
+            out.print(stdoutLog);
+            out.println(JavacServer.PROTOCOL_STDERR);
+            out.print(stderrLog);
+            // The compilation is complete! And errors will have already been printed on out!
+            out.println(JavacServer.PROTOCOL_PACKAGE_ARTIFACTS);
+            Map<String,Set<URI>> pa = smartFileManager.getPackageArtifacts();
+            for (String aPkgName : pa.keySet()) {
+                out.println("+"+aPkgName);
+                Set<URI> as = pa.get(aPkgName);
+                for (URI a : as) {
+                    out.println(" "+a.toString());
+                }
+            }
+            Dependencies deps = Dependencies.instance(context);
+            out.println(JavacServer.PROTOCOL_PACKAGE_DEPENDENCIES);
+            Map<String,Set<String>> pd = deps.getDependencies();
+            for (String aPkgName : pd.keySet()) {
+                out.println("+"+aPkgName);
+                Set<String> ds = pd.get(aPkgName);
+                    // Everything depends on java.lang
+                    if (!ds.contains(":java.lang")) ds.add(":java.lang");
+                for (String d : ds) {
+                    out.println(" "+d);
+                }
+            }
+            out.println(JavacServer.PROTOCOL_PACKAGE_PUBLIC_APIS);
+            Map<String,String> pp = deps.getPubapis();
+            for (String aPkgName : pp.keySet()) {
+                out.println("+"+aPkgName);
+                String ps = pp.get(aPkgName);
+                // getPubapis added a space to each line!
+                out.println(ps);
+                compiledPkgs.append(aPkgName+" ");
+            }
+            out.println(JavacServer.PROTOCOL_SYSINFO);
+            out.println("num_cores=" + Runtime.getRuntime().availableProcessors());
+            out.println("max_memory=" + Runtime.getRuntime().maxMemory());
+            out.println(JavacServer.PROTOCOL_RETURN_CODE);
+
+            // Errors from sjavac that affect compilation status!
+            int rcv = rc.exitCode;
+            if (rcv == 0 && forcedExitCode != 0) {
+                rcv = forcedExitCode;
+            }
+            out.println("" + rcv);
+            out.println(JavacServer.PROTOCOL_END);
+            out.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (out != null) out.close();
+                if (!socket.isClosed()) {
+                    socket.close();
+                }
+                socket = null;
+            } catch (Exception e) {
+                javacServer.log("ERROR "+e);
+                e.printStackTrace();
+            }
+            compilerPool.stopRequest();
+            long duration = System.currentTimeMillis()-start;
+            javacServer.addBuildTime(duration);
+            float classpersec = ((float)numClasses)*(((float)1000.0)/((float)duration));
+            javacServer.log(id+" <"+thisRequest+"> "+compiledPkgs+" duration " + duration+ " ms    num_classes="+numClasses+
+                             "     classpersec="+classpersec+" subtasks="+subTasks.size());
+            javacServer.flushLog();
+            unuse();
+            compilerPool.returnCompilerThread(this);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,751 @@
+/*
+ * Copyright (c) 2011-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.
+ */
+package com.sun.tools.sjavac.server;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.FileNotFoundException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.HashMap;
+import java.util.Map;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.util.ArrayList;
+import java.util.Random;
+
+import com.sun.tools.sjavac.Util;
+import com.sun.tools.sjavac.ProblemException;
+import java.io.*;
+import java.util.*;
+
+/**
+ * The JavacServer class contains methods both to setup a server that responds to requests and methods to connect to this server.
+ *
+ * <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 JavacServer {
+    // Responding to this tcp/ip port on localhost.
+
+    private final ServerSocket serverSocket;
+    // The secret cookie shared between server and client through the port file.
+    private final long myCookie;
+    // When the server was started.
+    private long serverStart;
+    // Accumulated build time for all requests, not counting idle time.
+    private long totalBuildTime;
+    // The javac server specific log file.
+    PrintWriter theLog;
+    // The compiler pool that maintains the compiler threads.
+    CompilerPool compilerPool;
+    // For the client, all port files fetched, one per started javac server.
+    // Though usually only one javac server is started by a client.
+    private static Map<String, PortFile> allPortFiles;
+    private static Map<String, Long> maxServerMemory;
+    final static int ERROR_FATAL = -1;
+    final static int ERROR_BUT_TRY_AGAIN = -4712;
+    final static String PROTOCOL_COOKIE_VERSION = "----THE-COOKIE-V2----";
+    final static String PROTOCOL_CWD = "----THE-CWD----";
+    final static String PROTOCOL_ID = "----THE-ID----";
+    final static String PROTOCOL_ARGS = "----THE-ARGS----";
+    final static String PROTOCOL_SOURCES_TO_COMPILE = "----THE-SOURCES-TO-COMPILE----";
+    final static String PROTOCOL_VISIBLE_SOURCES = "----THE-VISIBLE-SOURCES----";
+    final static String PROTOCOL_END = "----THE-END----";
+    final static String PROTOCOL_STDOUT = "----THE-STDOUT----";
+    final static String PROTOCOL_STDERR = "----THE-STDERR----";
+    final static String PROTOCOL_PACKAGE_ARTIFACTS = "----THE-PACKAGE_ARTIFACTS----";
+    final static String PROTOCOL_PACKAGE_DEPENDENCIES = "----THE-PACKAGE_DEPENDENCIES----";
+    final static String PROTOCOL_PACKAGE_PUBLIC_APIS = "----THE-PACKAGE-PUBLIC-APIS----";
+    final static String PROTOCOL_SYSINFO = "----THE-SYSINFO----";
+    final static String PROTOCOL_RETURN_CODE = "----THE-RETURN-CODE----";
+    // Check if the portfile is gone, every 5 seconds.
+    static int CHECK_PORTFILE_INTERVAL = 5;
+    // Wait 2 seconds for response, before giving up on javac server.
+    static int CONNECTION_TIMEOUT = 2;
+    static int WAIT_BETWEEN_CONNECT_ATTEMPTS = 1;
+    static int MAX_NUM_CONNECT_ATTEMPTS = 3;
+
+    /**
+     * Acquire the port file. Synchronized since several threads inside an smart javac wrapper client acquires the same port file at the same time.
+     */
+    private static synchronized PortFile getPortFile(String filename) throws FileNotFoundException {
+        if (allPortFiles == null) {
+            allPortFiles = new HashMap<String, PortFile>();
+        }
+        PortFile pf = allPortFiles.get(filename);
+        if (pf == null) {
+            pf = new PortFile(filename);
+            allPortFiles.put(filename, pf);
+        }
+        return pf;
+    }
+
+    /**
+     * Get the cookie used for this server.
+     */
+    long getCookie() {
+        return myCookie;
+    }
+
+    /**
+     * Get the port used for this server.
+     */
+    int getPort() {
+        return serverSocket.getLocalPort();
+    }
+
+    /**
+     * Sum up the total build time for this javac server.
+     */
+    public void addBuildTime(long inc) {
+        totalBuildTime += inc;
+    }
+
+    /**
+     * Log this message.
+     */
+    public void log(String msg) {
+        if (theLog != null) {
+            theLog.println(msg);
+        } else {
+            System.err.println(msg);
+        }
+    }
+
+    /**
+     * Make sure the log is flushed.
+     */
+    public void flushLog() {
+        if (theLog != null) {
+            theLog.flush();
+        }
+    }
+
+    /**
+     * Start a server using a settings string. Typically: "--startserver:portfile=/tmp/myserver,poolsize=3" and the string "portfile=/tmp/myserver,poolsize=3"
+     * is sent as the settings parameter. Returns 0 on success, -1 on failure.
+     */
+    public static int startServer(String settings, PrintStream err) {
+        try {
+            String portfile = Util.extractStringOption("portfile", settings);
+            // The log file collects more javac server specific log information.
+            String logfile = Util.extractStringOption("logfile", settings);
+            // The stdouterr file collects all the System.out and System.err writes to disk.
+            String stdouterrfile = Util.extractStringOption("stdouterrfile", settings);
+            // We could perhaps use System.setOut and setErr here.
+            // But for the moment we rely on the client to spawn a shell where stdout
+            // and stderr are redirected already.
+            // The pool size is a limit the number of concurrent compiler threads used.
+            // The server might use less than these to avoid memory problems.
+            int poolsize = Util.extractIntOption("poolsize", settings);
+            if (poolsize <= 0) {
+                // If not set, default to the number of cores.
+                poolsize = Runtime.getRuntime().availableProcessors();
+            }
+
+            // How many seconds of inactivity will the server accept before quitting?
+            int keepalive = Util.extractIntOption("keepalive", settings);
+            if (keepalive <= 0) {
+                keepalive = 120;
+            }
+            // The port file is locked and the server port and cookie is written into it.
+            PortFile portFile = getPortFile(portfile);
+            JavacServer s;
+
+            synchronized (portFile) {
+                portFile.lock();
+                portFile.getValues();
+                if (portFile.containsPortInfo()) {
+                    err.println("Javac server not started because portfile exists!");
+                    portFile.unlock();
+                    return -1;
+                }
+                s = new JavacServer(poolsize, logfile);
+                portFile.setValues(s.getPort(), s.getCookie());
+                portFile.unlock();
+            }
+
+            // Run the server. Will delete the port file when shutting down.
+            // It will shut down automatically when no new requests have come in
+            // during the last 125 seconds.
+            s.run(portFile, err, keepalive);
+            // The run loop for the server has exited.
+            return 0;
+        } catch (Exception e) {
+            e.printStackTrace(err);
+            return -1;
+        }
+    }
+
+    /**
+     * Dispatch a compilation request to a javac server.
+     *
+     * @param args are the command line args to javac and is allowed to contain source files, @file and other command line options to javac.
+     *
+     * The generated classes, h files and other artifacts from the javac invocation are stored by the javac server to disk.
+     *
+     * @param sources_to_compile The sources to compile.
+     *
+     * @param visibleSources If visible sources has a non zero size, then visible_sources are the only files in the file system that the javac server can see!
+     * (Sources to compile are always visible.) The visible sources are those supplied by the (filtered) -sourcepath
+     *
+     * @param visibleClasses If visible classes for a specific root/jar has a non zero size, then visible_classes are the only class files that the javac server
+     * can see, in that root/jar. It maps from a classpath root or a jar file to the set of visible classes for that root/jar.
+     *
+     * The server return meta data about the build in the following parameters.
+     * @param package_artifacts, map from package name to set of created artifacts for that package.
+     * @param package_dependencies, map from package name to set of packages that it depends upon.
+     * @param package_pubapis, map from package name to unique string identifying its pub api.
+     */
+    public static int useServer(String settings, String[] args,
+            Set<URI> sourcesToCompile,
+            Set<URI> visibleSources,
+            Map<URI, Set<String>> visibleClasses,
+            Map<String, Set<URI>> packageArtifacts,
+            Map<String, Set<String>> packageDependencies,
+            Map<String, String> packagePubapis,
+            SysInfo sysinfo,
+            PrintStream out,
+            PrintStream err) {
+        try {
+            // The id can perhaps be used in the future by the javac server to reuse the
+            // JavaCompiler instance for several compiles using the same id.
+            String id = Util.extractStringOption("id", settings);
+            String portfile = Util.extractStringOption("portfile", settings);
+            String logfile = Util.extractStringOption("logfile", settings);
+            String stdouterrfile = Util.extractStringOption("stdouterrfile", settings);
+            String background = Util.extractStringOption("background", settings);
+            if (background == null || !background.equals("false")) {
+                background = "true";
+            }
+            // The sjavac option specifies how the server part of sjavac is spawned.
+            // If you have the experimental sjavac in your path, you are done. If not, you have
+            // to point to a com.sun.tools.sjavac.Main that supports --startserver
+            // for example by setting: sjavac=java%20-jar%20...javac.jar%com.sun.tools.sjavac.Main
+            String sjavac = Util.extractStringOption("sjavac", settings);
+            int poolsize = Util.extractIntOption("poolsize", settings);
+            int keepalive = Util.extractIntOption("keepalive", settings);
+
+            if (keepalive <= 0) {
+                // Default keepalive for server is 120 seconds.
+                // I.e. it will accept 120 seconds of inactivity before quitting.
+                keepalive = 120;
+            }
+            if (portfile == null) {
+                err.println("No portfile was specified!");
+                return -1;
+            }
+            if (logfile == null) {
+                logfile = portfile + ".javaclog";
+            }
+            if (stdouterrfile == null) {
+                stdouterrfile = portfile + ".stdouterr";
+            }
+            // Default to sjavac and hope it is in the path.
+            if (sjavac == null) {
+                sjavac = "sjavac";
+            }
+
+            int attempts = 0;
+            int rc = -1;
+            do {
+                PortFile port_file = getPortFile(portfile);
+                synchronized (port_file) {
+                    port_file.lock();
+                    port_file.getValues();
+                    port_file.unlock();
+                }
+                if (!port_file.containsPortInfo()) {
+                    String cmd = fork(sjavac, port_file.getFilename(), logfile, poolsize, keepalive, err, stdouterrfile, background);
+
+                    if (background.equals("true") && !port_file.waitForValidValues()) {
+                        // Ouch the server did not start! Lets print its stdouterrfile and the command used.
+                        printFailedAttempt(cmd, stdouterrfile, err);
+                        // And give up.
+                        return -1;
+                    }
+                }
+                rc = connectAndCompile(port_file, id, args, sourcesToCompile, visibleSources,
+                        packageArtifacts, packageDependencies, packagePubapis, sysinfo,
+                        out, err);
+                // Try again until we manage to connect. Any error after that
+                // will cause the compilation to fail.
+                if (rc == ERROR_BUT_TRY_AGAIN) {
+                    // We could not connect to the server. Try again.
+                    attempts++;
+                    try {
+                        Thread.sleep(WAIT_BETWEEN_CONNECT_ATTEMPTS);
+                    } catch (InterruptedException e) {
+                    }
+                }
+            } while (rc == ERROR_BUT_TRY_AGAIN && attempts < MAX_NUM_CONNECT_ATTEMPTS);
+            return rc;
+        } catch (Exception e) {
+            e.printStackTrace(err);
+            return -1;
+        }
+    }
+
+    private static void printFailedAttempt(String cmd, String f, PrintStream err) {
+        err.println("---- Failed to start javac server with this command -----");
+        err.println(cmd);
+        try {
+            BufferedReader in = new BufferedReader(new FileReader(f));
+            err.println("---- stdout/stderr output from attempt to start javac server -----");
+            for (;;) {
+                String l = in.readLine();
+                if (l == null) {
+                    break;
+                }
+                err.println(l);
+            }
+            err.println("------------------------------------------------------------------");
+        } catch (Exception e) {
+            err.println("The stdout/stderr output in file " + f + " does not exist and the server did not start.");
+        }
+    }
+
+    /**
+     * Spawn the server instance.
+     */
+
+    private JavacServer(int poolSize, String logfile) throws IOException {
+        serverStart = System.currentTimeMillis();
+        // Create a server socket on a random port that is bound to the localhost/127.0.0.1 interface.
+        // I.e only local processes can connect to this port.
+        serverSocket = new ServerSocket(0, 128, InetAddress.getByName(null));
+        compilerPool = new CompilerPool(poolSize, this);
+        Random rnd = new Random();
+        myCookie = rnd.nextLong();
+        theLog = new PrintWriter(logfile);
+        log("Javac server started. port=" + getPort() + " date=" + (new java.util.Date()) + " with poolsize=" + poolSize);
+        flushLog();
+    }
+
+    /**
+     * Fork a background process. Returns the command line used that can be printed if something failed.
+     */
+    private static String fork(String sjavac, String portfile, String logfile, int poolsize, int keepalive,
+            final PrintStream err, String stdouterrfile, String background)
+            throws IOException, ProblemException {
+        if (stdouterrfile != null && stdouterrfile.trim().equals("")) {
+            stdouterrfile = null;
+        }
+        final String startserver = "--startserver:portfile=" + portfile + ",logfile=" + logfile + ",stdouterrfile=" + stdouterrfile + ",poolsize=" + poolsize + ",keepalive="+ keepalive;
+
+        if (background.equals("true")) {
+            sjavac += "%20" + startserver;
+            sjavac = sjavac.replaceAll("%20", " ");
+            sjavac = sjavac.replaceAll("%2C", ",");
+            // If the java/sh/cmd launcher fails the failure will be captured by stdouterr because of the redirection here.
+            String[] cmd = {"/bin/sh", "-c", sjavac + " >> " + stdouterrfile + " 2>&1"};
+            if (!(new File("/bin/sh")).canExecute()) {
+                ArrayList<String> wincmd = new ArrayList<String>();
+                wincmd.add("cmd");
+                wincmd.add("/c");
+                wincmd.add("start");
+                wincmd.add("cmd");
+                wincmd.add("/c");
+                wincmd.add(sjavac + " >> " + stdouterrfile + " 2>&1");
+                cmd = wincmd.toArray(new String[wincmd.size()]);
+            }
+            Process pp = null;
+            try {
+                pp = Runtime.getRuntime().exec(cmd);
+            } catch (Exception e) {
+                e.printStackTrace(err);
+                e.printStackTrace(new PrintWriter(stdouterrfile));
+            }
+            StringBuilder rs = new StringBuilder();
+            for (String s : cmd) {
+                rs.append(s + " ");
+            }
+            return rs.toString();
+        }
+
+        // Do not spawn a background server, instead run it within the same JVM.
+        Thread t = new Thread() {
+            @Override
+            public void run() {
+                try {
+                    JavacServer.startServer(startserver, err);
+                } catch (Throwable t) {
+                    t.printStackTrace(err);
+                }
+            }
+        };
+        t.start();
+        return "";
+    }
+
+    /**
+     * Expect this key on the next line read from the reader.
+     */
+    private static boolean expect(BufferedReader in, String key) throws IOException {
+        String s = in.readLine();
+        if (s != null && s.equals(key)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Make a request to the server only to get the maximum possible heap size to use for compilations.
+     *
+     * @param port_file The port file used to synchronize creation of this server.
+     * @param id The identify of the compilation.
+     * @param out Standard out information.
+     * @param err Standard err information.
+     * @return The maximum heap size in bytes.
+     */
+    public static SysInfo connectGetSysInfo(String serverSettings, PrintStream out, PrintStream err) {
+        SysInfo sysinfo = new SysInfo(-1, -1);
+        String id = Util.extractStringOption("id", serverSettings);
+        String portfile = Util.extractStringOption("portfile", serverSettings);
+        try {
+            PortFile pf = getPortFile(portfile);
+            useServer(serverSettings, new String[0],
+                    new HashSet<URI>(),
+                    new HashSet<URI>(),
+                    new HashMap<URI, Set<String>>(),
+                    new HashMap<String, Set<URI>>(),
+                    new HashMap<String, Set<String>>(),
+                    new HashMap<String, String>(),
+                    sysinfo, out, err);
+        } catch (Exception e) {
+            e.printStackTrace(err);
+        }
+        return sysinfo;
+    }
+
+    /**
+     * Connect and compile using the javac server settings and the args. When using more advanced features, the sources_to_compile and visible_sources are
+     * supplied to the server and meta data is returned in package_artifacts, package_dependencies and package_pubapis.
+     */
+    private static int connectAndCompile(PortFile portFile, String id, String[] args,
+            Set<URI> sourcesToCompile,
+            Set<URI> visibleSources,
+            Map<String, Set<URI>> packageArtifacts,
+            Map<String, Set<String>> packageDependencies,
+            Map<String, String> packagePublicApis,
+            SysInfo sysinfo,
+            PrintStream out,
+            PrintStream err) {
+        int rc = -3;
+        try {
+            int port = portFile.getPort();
+            if (port == 0) {
+                return ERROR_BUT_TRY_AGAIN;
+            }
+            long cookie = portFile.getCookie();
+
+            // Acquire the localhost/127.0.0.1 address.
+            InetAddress addr = InetAddress.getByName(null);
+            SocketAddress sockaddr = new InetSocketAddress(addr, port);
+            Socket sock = new Socket();
+            int timeoutMs = CONNECTION_TIMEOUT * 1000;
+            try {
+                sock.connect(sockaddr, timeoutMs);
+            } catch (java.net.ConnectException e) {
+                err.println("Could not connect to javac server found in portfile: " + portFile.getFilename() + " " + e);
+                return ERROR_BUT_TRY_AGAIN;
+            }
+            if (!sock.isConnected()) {
+                err.println("Could not connect to javac server found in portfile: " + portFile.getFilename());
+                return ERROR_BUT_TRY_AGAIN;
+            }
+            BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
+            PrintWriter sockout = new PrintWriter(sock.getOutputStream());
+
+            sockout.println(PROTOCOL_COOKIE_VERSION);
+            sockout.println("" + cookie);
+            sockout.println(PROTOCOL_CWD);
+            sockout.println(System.getProperty("user.dir"));
+            sockout.println(PROTOCOL_ID);
+            sockout.println(id);
+            sockout.println(PROTOCOL_ARGS);
+            for (String s : args) {
+                StringBuffer buf = new StringBuffer();
+                String[] paths = s.split(File.pathSeparator);
+                int c = 0;
+                for (String path : paths) {
+                    File f = new File(path);
+                    if (f.isFile() || f.isDirectory()) {
+                        buf.append(f.getAbsolutePath());
+                        c++;
+                        if (c < paths.length) {
+                            buf.append(File.pathSeparator);
+                        }
+                    } else {
+                        buf = new StringBuffer(s);
+                        break;
+                    }
+                }
+                sockout.println(buf.toString());
+            }
+            sockout.println(PROTOCOL_SOURCES_TO_COMPILE);
+            for (URI uri : sourcesToCompile) {
+                sockout.println(uri.toString());
+            }
+            sockout.println(PROTOCOL_VISIBLE_SOURCES);
+            for (URI uri : visibleSources) {
+                sockout.println(uri.toString());
+            }
+            sockout.println(PROTOCOL_END);
+            sockout.flush();
+
+            StringBuffer stdout = new StringBuffer();
+            StringBuffer stderr = new StringBuffer();
+
+            if (!expect(in, PROTOCOL_STDOUT)) {
+                return ERROR_FATAL;
+            }
+            // Load stdout
+            for (;;) {
+                String l = in.readLine();
+                if (l == null) {
+                    return ERROR_FATAL;
+                }
+                if (l.equals(PROTOCOL_STDERR)) {
+                    break;
+                }
+                stdout.append(l);
+                stdout.append('\n');
+            }
+            // Load stderr
+            for (;;) {
+                String l = in.readLine();
+                if (l == null) {
+                    return ERROR_FATAL;
+                }
+                if (l.equals(PROTOCOL_PACKAGE_ARTIFACTS)) {
+                    break;
+                }
+                stderr.append(l);
+                stderr.append('\n');
+            }
+            // Load the package artifacts
+            Set<URI> lastUriSet = null;
+            for (;;) {
+                String l = in.readLine();
+                if (l == null) {
+                    return ERROR_FATAL;
+                }
+                if (l.equals(PROTOCOL_PACKAGE_DEPENDENCIES)) {
+                    break;
+                }
+                if (l.length() > 1 && l.charAt(0) == '+') {
+                    String pkg = l.substring(1);
+                    lastUriSet = new HashSet<URI>();
+                    packageArtifacts.put(pkg, lastUriSet);
+                } else if (l.length() > 1 && lastUriSet != null) {
+                    lastUriSet.add(new URI(l.substring(1)));
+                }
+            }
+            // Load package dependencies
+            Set<String> lastPackageSet = null;
+            for (;;) {
+                String l = in.readLine();
+                if (l == null) {
+                    return ERROR_FATAL;
+                }
+                if (l.equals(PROTOCOL_PACKAGE_PUBLIC_APIS)) {
+                    break;
+                }
+                if (l.length() > 1 && l.charAt(0) == '+') {
+                    String pkg = l.substring(1);
+                    lastPackageSet = new HashSet<String>();
+                    packageDependencies.put(pkg, lastPackageSet);
+                } else if (l.length() > 1 && lastPackageSet != null) {
+                    lastPackageSet.add(l.substring(1));
+                }
+            }
+            // Load package pubapis
+            Map<String, StringBuffer> tmp = new HashMap<String, StringBuffer>();
+            StringBuffer lastPublicApi = null;
+            for (;;) {
+                String l = in.readLine();
+                if (l == null) {
+                    return ERROR_FATAL;
+                }
+                if (l.equals(PROTOCOL_SYSINFO)) {
+                    break;
+                }
+                if (l.length() > 1 && l.charAt(0) == '+') {
+                    String pkg = l.substring(1);
+                    lastPublicApi = new StringBuffer();
+                    tmp.put(pkg, lastPublicApi);
+                } else if (l.length() > 1 && lastPublicApi != null) {
+                    lastPublicApi.append(l.substring(1));
+                    lastPublicApi.append("\n");
+                }
+            }
+            for (String p : tmp.keySet()) {
+                assert (packagePublicApis.get(p) == null);
+                String api = tmp.get(p).toString();
+                packagePublicApis.put(p, api);
+            }
+            // Now reading the max memory possible.
+            for (;;) {
+                String l = in.readLine();
+                if (l == null) {
+                    return ERROR_FATAL;
+                }
+                if (l.equals(PROTOCOL_RETURN_CODE)) {
+                    break;
+                }
+                if (l.startsWith("num_cores=") && sysinfo != null) {
+                    sysinfo.numCores = Integer.parseInt(l.substring(10));
+                }
+                if (l.startsWith("max_memory=") && sysinfo != null) {
+                    sysinfo.maxMemory = Long.parseLong(l.substring(11));
+                }
+            }
+            String l = in.readLine();
+            if (l == null) {
+                err.println("No return value from the server!");
+                return ERROR_FATAL;
+            }
+            rc = Integer.parseInt(l);
+            out.print(stdout);
+            err.print(stderr);
+        } catch (Exception e) {
+            e.printStackTrace(err);
+        }
+        return rc;
+    }
+
+    /**
+     * Run the server thread until it exits. Either because of inactivity or because the port file has been deleted by someone else, or overtaken by some other
+     * javac server.
+     */
+    private void run(PortFile portFile, PrintStream err, int keepalive) {
+        boolean fileDeleted = false;
+        long timeSinceLastCompile;
+        try {
+            // Every 5 second (check_portfile_interval) we test if the portfile has disappeared => quit
+            // Or if the last request was finished more than 125 seconds ago => quit
+            // 125 = seconds_of_inactivity_before_shutdown+check_portfile_interval
+            serverSocket.setSoTimeout(CHECK_PORTFILE_INTERVAL*1000);
+            for (;;) {
+                try {
+                    Socket s = serverSocket.accept();
+                    CompilerThread ct = compilerPool.grabCompilerThread();
+                    ct.setSocket(s);
+                    compilerPool.execute(ct);
+                    flushLog();
+                } catch (java.net.SocketTimeoutException e) {
+                    if (compilerPool.numActiveRequests() > 0) {
+                        // Never quit while there are active requests!
+                        continue;
+                    }
+                    // If this is the timeout after the portfile
+                    // has been deleted by us. Then we truly stop.
+                    if (fileDeleted) {
+                        log("Quitting because of "+(keepalive+CHECK_PORTFILE_INTERVAL)+" seconds of inactivity!");
+                        break;
+                    }
+                    // Check if the portfile is still there.
+                    if (!portFile.exists()) {
+                        // Time to quit because the portfile was deleted by another
+                        // process, probably by the makefile that is done building.
+                        log("Quitting because portfile was deleted!");
+                        flushLog();
+                        break;
+                    }
+                    // Check if portfile.stop is still there.
+                    if (portFile.markedForStop()) {
+                        // Time to quit because another process touched the file
+                        // server.port.stop to signal that the server should stop.
+                        // This is necessary on some operating systems that lock
+                        // the port file hard!
+                        log("Quitting because a portfile.stop file was found!");
+                        portFile.delete();
+                        flushLog();
+                        break;
+                    }
+                    // Does the portfile still point to me?
+                    if (!portFile.stillMyValues()) {
+                        // Time to quit because another build has started.
+                        log("Quitting because portfile is now owned by another javac server!");
+                        flushLog();
+                        break;
+                    }
+
+                    // Check how long since the last request finished.
+                    long diff = System.currentTimeMillis() - compilerPool.lastRequestFinished();
+                    if (diff < keepalive * 1000) {
+                        // Do not quit if we have waited less than 120 seconds.
+                        continue;
+                    }
+                    // Ok, time to quit because of inactivity. Perhaps the build
+                    // was killed and the portfile not cleaned up properly.
+                    portFile.delete();
+                    fileDeleted = true;
+                    log("" + keepalive + " seconds of inactivity quitting in "
+                        + CHECK_PORTFILE_INTERVAL + " seconds!");
+                    flushLog();
+                    // Now we have a second 5 second grace
+                    // period where javac remote requests
+                    // that have loaded the data from the
+                    // recently deleted portfile can connect
+                    // and complete their requests.
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace(err);
+            e.printStackTrace(theLog);
+            flushLog();
+        } finally {
+            compilerPool.shutdown();
+        }
+        long realTime = System.currentTimeMillis() - serverStart;
+        log("Shutting down.");
+        log("Total wall clock time " + realTime + "ms build time " + totalBuildTime + "ms");
+        flushLog();
+    }
+
+    public static void cleanup(String... args) {
+        String settings = Util.findServerSettings(args);
+        if (settings == null) return;
+        String portfile = Util.extractStringOption("portfile", settings);
+        String background = Util.extractStringOption("background", settings);
+        if (background != null && background.equals("false")) {
+            // If the server runs within this jvm, then delete the portfile,
+            // since this jvm is about to exit soon.
+            File f = new File(portfile);
+            f.delete();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/server/PortFile.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,259 @@
+/*
+ * 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.  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.sjavac.server;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.channels.FileLockInterruptionException;
+import com.sun.tools.sjavac.Log;
+
+/**
+ * The PortFile class mediates access to a short binary file containing the tcp/ip port (for the localhost)
+ * and a cookie necessary for the server answering on that port. The file can be locked using file system
+ * primitives to avoid race conditions when several javac clients are started at the same. Note that file
+ * system locking is not always supported on a all operating systems and/or file systems.
+ *
+ * <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>
+ */
+class PortFile {
+
+    // Port file format:
+    // byte ordering: high byte first = big endian
+    // Magic nr, 4 byte int, first in file.
+    private final static int magicNr = 0x1174;
+    // Followed by a 4 byte int, with the port nr.
+    // Followed by a 8 byte long, with cookie nr.
+
+    private String filename;
+    private File file;
+    private File stopFile;
+    private RandomAccessFile rwfile;
+    private FileChannel channel;
+    private FileLock lock;
+
+    private boolean containsPortInfo;
+    private int serverPort;
+    private long serverCookie;
+    private int myServerPort;
+    private long myServerCookie;
+
+    /**
+     * Create a new portfile.
+     * @param filename is the path to the file.
+     */
+    public PortFile(String fn) throws FileNotFoundException
+    {
+        filename = fn;
+        file = new File(filename);
+        stopFile = new File(filename+".stop");
+        rwfile = new RandomAccessFile(file, "rw");
+        // The rwfile should only be readable by the owner of the process
+        // and no other! How do we do that on a RandomAccessFile?
+        channel = rwfile.getChannel();
+        containsPortInfo = false;
+        lock = null;
+    }
+
+    /**
+     * Lock the port file.
+     */
+    void lock() throws IOException {
+        lock = channel.lock();
+    }
+
+    /**
+     * Read the values from the port file in the file system.
+     * Expects the port file to be locked.
+     */
+    public void getValues()  {
+        containsPortInfo = false;
+        if (lock == null) {
+            // Not locked, remain ignorant about port file contents.
+            return;
+        }
+        try {
+            if (rwfile.length()>0) {
+                rwfile.seek(0);
+                int nr = rwfile.readInt();
+                serverPort = rwfile.readInt();
+                serverCookie = rwfile.readLong();
+
+                if (nr == magicNr) {
+                    containsPortInfo = true;
+                } else {
+                    containsPortInfo = false;
+                }
+            }
+        } catch (Exception e) {
+            containsPortInfo = false;
+        }
+    }
+
+    /**
+     * Did the locking and getValues succeed?
+     */
+    public boolean containsPortInfo() {
+        return containsPortInfo;
+    }
+
+    /**
+     * If so, then we can acquire the tcp/ip port on localhost.
+     */
+    public int getPort() {
+        assert(containsPortInfo);
+        return serverPort;
+    }
+
+    /**
+     * If so, then we can acquire the server cookie.
+     */
+    public long getCookie() {
+        assert(containsPortInfo);
+        return serverCookie;
+    }
+
+    /**
+     * Store the values into the locked port file.
+     */
+    public void setValues(int port, long cookie) throws IOException {
+        assert(lock != null);
+        rwfile.seek(0);
+        // Write the magic nr that identifes a port file.
+        rwfile.writeInt(magicNr);
+        rwfile.writeInt(port);
+        rwfile.writeLong(cookie);
+        myServerPort = port;
+        myServerCookie = cookie;
+    }
+
+    /**
+     * Delete the port file.
+     */
+    public void delete() throws IOException {
+        // Access to file must be closed before deleting.
+        rwfile.close();
+        // Now delete.
+        file.delete();
+    }
+
+    /**
+     * Is the port file still there?
+     */
+    public boolean exists() throws IOException {
+        return file.exists();
+    }
+
+    /**
+     * Is a stop file there?
+     */
+    public boolean markedForStop() throws IOException {
+        if (stopFile.exists()) {
+            try {
+                stopFile.delete();
+            } catch (Exception e)
+            {}
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Unlock the port file.
+     */
+    public void unlock() throws IOException {
+        assert(lock != null);
+        lock.release();
+        lock = null;
+    }
+
+    /**
+     * Wait for the port file to contain values that look valid.
+     * Return true, if a-ok, false if the valid values did not materialize within 5 seconds.
+     */
+    public synchronized boolean waitForValidValues() throws IOException, FileNotFoundException {
+        for (int tries = 0; tries < 50; tries++) {
+            lock();
+            getValues();
+            unlock();
+            if (containsPortInfo) {
+                Log.debug("Found valid values in port file after waiting "+(tries*100)+"ms");
+                return true;
+            }
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e)
+            {}
+        }
+        Log.debug("Gave up waiting for valid values in port file");
+        return false;
+    }
+
+    /**
+     * Check if the portfile still contains my values, assuming that I am the server.
+     */
+    public synchronized boolean stillMyValues() throws IOException, FileNotFoundException {
+        for (;;) {
+            try {
+                lock();
+                getValues();
+                unlock();
+                if (containsPortInfo) {
+                    if (serverPort == myServerPort &&
+                        serverCookie == myServerCookie) {
+                        // Everything is ok.
+                        return true;
+                    }
+                    // Someone has overwritten the port file.
+                    // Probably another javac server, lets quit.
+                    return false;
+                }
+                // Something else is wrong with the portfile. Lets quit.
+                return false;
+            } catch (FileLockInterruptionException e) {
+                continue;
+            }
+            catch (ClosedChannelException e) {
+                // The channel has been closed since sjavac is exiting.
+                return false;
+            }
+        }
+    }
+
+    /**
+     * Return the name of the port file.
+     */
+    public String getFilename() {
+        return filename;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/sjavac/server/SysInfo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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.  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 utility class used to report information about the system
+ * where the javac server is running.
+ *
+ * <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>
+ */
+package com.sun.tools.sjavac.server;
+
+public class SysInfo {
+    public int numCores;
+    public long maxMemory;
+
+    public SysInfo(int nc, long mm) {
+        numCores = nc;
+        maxMemory = mm;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/lang/model/AnnotatedConstruct.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,190 @@
+/*
+ * 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 javax.lang.model;
+
+import java.lang.annotation.*;
+import java.util.List;
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+
+/**
+ * Represents a construct that can be annotated.
+ *
+ * A construct is either an {@linkplain
+ * javax.lang.model.element.Element element} or a {@linkplain
+ * javax.lang.model.type.TypeMirror type}.  Annotations on an element
+ * are on a <em>declaration</em>, whereas annotations on a type are on
+ * a specific <em>use</em> of a type name.
+ *
+ * The terms <em>directly present</em> and <em>present</em> are used
+ * throughout this interface to describe precisely which annotations
+ * are returned by methods:
+ *
+ * <p>An annotation <i>A</i> is <em>directly present</em> on a
+ * construct <i>E</i> if <i>E</i> is annotated, and:
+ *
+ * <ul>
+ *
+ * <li> for an invocation of {@code getAnnotation(Class<T>)} or
+ * {@code getAnnotationMirrors()}, <i>E</i>'s annotations contain <i>A</i>.
+ *
+ * <li> for an invocation of getAnnotationsByType(Class<T>),
+ * <i>E</i>'s annotations either contain <i>A</i> or, if the type of
+ * <i>A</i> is repeatable, contain exactly one annotation whose value
+ * element contains <i>A</i> and whose type is the containing
+ * annotation type of <i>A</i>'s type.
+ *
+ * </ul>
+ *
+ * <p>An annotation A is <em>present</em> on a construct E if either:
+ *
+ * <ul>
+ *  <li> <i>A</i> is <em>directly present</em> on <i>E</i>; or
+ *
+ *  <li> <i>A</i> is not <em>directly present</em> on <i>E</i>, and
+ *  <i>E</i> is an element representing a class, and <i>A</i>'s type
+ *  is inheritable, and <i>A</i> is <em>present</em> on the element
+ *  representing the superclass of <i>E</i>.
+ *
+ * </ul>
+ *
+ * @since 1.8
+ * @jls 9.6 Annotation Types
+ * @jls 9.6.3.3 @Inherited
+ */
+public interface AnnotatedConstruct {
+    /**
+     * Returns the annotations that are <em>directly present</em> on
+     * this construct.
+     *
+     * @return the annotations <em>directly present</em> on this
+     * construct; an empty list if there are none
+     */
+    List<? extends AnnotationMirror> getAnnotationMirrors();
+
+    /**
+     * Returns this construct's annotation of the
+     * specified type if such an annotation is <em>present</em>, else {@code
+     * null}.
+     *
+     * <p> The annotation returned by this method could contain an element
+     * whose value is of type {@code Class}.
+     * This value cannot be returned directly:  information necessary to
+     * locate and load a class (such as the class loader to use) is
+     * not available, and the class might not be loadable at all.
+     * Attempting to read a {@code Class} object by invoking the relevant
+     * method on the returned annotation
+     * will result in a {@link MirroredTypeException},
+     * from which the corresponding {@link TypeMirror} may be extracted.
+     * Similarly, attempting to read a {@code Class[]}-valued element
+     * will result in a {@link MirroredTypesException}.
+     *
+     * <blockquote>
+     * <i>Note:</i> This method is unlike others in this and related
+     * interfaces.  It operates on runtime reflective information &mdash;
+     * representations of annotation types currently loaded into the
+     * VM &mdash; rather than on the representations defined by and used
+     * throughout these interfaces.  Consequently, calling methods on
+     * the returned annotation object can throw many of the exceptions
+     * that can be thrown when calling methods on an annotation object
+     * returned by core reflection.  This method is intended for
+     * callers that are written to operate on a known, fixed set of
+     * annotation types.
+     * </blockquote>
+     *
+     * @param <A>  the annotation type
+     * @param annotationType  the {@code Class} object corresponding to
+     *          the annotation type
+     * @return this element's or type use's annotation for the
+     * specified annotation type if present on this element, else
+     * {@code null}
+     *
+     * @see #getAnnotationMirrors()
+     * @see java.lang.reflect.AnnotatedElement#getAnnotation
+     * @see EnumConstantNotPresentException
+     * @see AnnotationTypeMismatchException
+     * @see IncompleteAnnotationException
+     * @see MirroredTypeException
+     * @see MirroredTypesException
+     * @jls 9.6.1 Annotation Type Elements
+     */
+    <A extends Annotation> A getAnnotation(Class<A> annotationType);
+
+    /**
+     * Returns annotations that are <em>present</em> on this construct.
+     *
+     * If there are no annotations <em>present</em> on this construct,
+     * the return value is an array of length 0.
+     *
+     * The difference between this method and {@link #getAnnotation(Class)}
+     * is that this method detects if its argument is a <em>repeatable
+     * annotation type</em>, and if so, attempts to find one or more
+     * annotations of that type by "looking through" a container annotation.
+     *
+     * <p> The annotations returned by this method could contain an element
+     * whose value is of type {@code Class}.
+     * This value cannot be returned directly:  information necessary to
+     * locate and load a class (such as the class loader to use) is
+     * not available, and the class might not be loadable at all.
+     * Attempting to read a {@code Class} object by invoking the relevant
+     * method on the returned annotation
+     * will result in a {@link MirroredTypeException},
+     * from which the corresponding {@link TypeMirror} may be extracted.
+     * Similarly, attempting to read a {@code Class[]}-valued element
+     * will result in a {@link MirroredTypesException}.
+     *
+     * <blockquote>
+     * <i>Note:</i> This method is unlike others in this and related
+     * interfaces.  It operates on runtime reflective information &mdash;
+     * representations of annotation types currently loaded into the
+     * VM &mdash; rather than on the representations defined by and used
+     * throughout these interfaces.  Consequently, calling methods on
+     * the returned annotation object can throw many of the exceptions
+     * that can be thrown when calling methods on an annotation object
+     * returned by core reflection.  This method is intended for
+     * callers that are written to operate on a known, fixed set of
+     * annotation types.
+     * </blockquote>
+     *
+     * @param <A>  the annotation type
+     * @param annotationType  the {@code Class} object corresponding to
+     *          the annotation type
+     * @return this element's annotations for the specified annotation
+     *         type if present on this element, else an empty array
+     *
+     * @see #getAnnotationMirrors()
+     * @see #getAnnotation(java.lang.Class)
+     * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType
+     * @see EnumConstantNotPresentException
+     * @see AnnotationTypeMismatchException
+     * @see IncompleteAnnotationException
+     * @see MirroredTypeException
+     * @see MirroredTypesException
+     * @jls 9.6 Annotation Types
+     * @jls 9.6.1 Annotation Type Elements
+     */
+    <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType);
+}
--- a/src/share/classes/javax/lang/model/SourceVersion.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/SourceVersion.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -46,7 +46,7 @@
  */
 public enum SourceVersion {
     /*
-     * Summary of language evoluation
+     * Summary of language evolution
      * 1.1: nested classes
      * 1.2: strictfp
      * 1.3: no changes
--- a/src/share/classes/javax/lang/model/element/AnnotationValueVisitor.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/element/AnnotationValueVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -61,6 +61,18 @@
  * parameters, return type, etc. rather than one of the abstract
  * classes.
  *
+ * <p>Note that methods to accommodate new language constructs could
+ * be added in a source <em>compatible</em> way if they were added as
+ * <em>default methods</em>.  However, default methods are only
+ * available on Java SE 8 and higher releases and the {@code
+ * javax.lang.model.*} packages bundled in Java SE 8 are required to
+ * also be runnable on Java SE 7.  Therefore, default methods
+ * <em>cannot</em> be used when extending {@code javax.lang.model.*}
+ * to cover Java SE 8 language features.  However, default methods may
+ * be used in subsequent revisions of the {@code javax.lang.model.*}
+ * packages that are only required to run on Java SE 8 and higher
+ * platform versions.
+ *
  * @param <R> the return type of this visitor's methods
  * @param <P> the type of the additional parameter to this visitor's methods.
  * @author Joseph D. Darcy
--- a/src/share/classes/javax/lang/model/element/Element.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/element/Element.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -60,8 +60,7 @@
  * @see TypeMirror
  * @since 1.6
  */
-public interface Element {
-
+public interface Element extends javax.lang.model.AnnotatedConstruct {
     /**
      * Returns the type defined by this element.
      *
@@ -89,66 +88,6 @@
     ElementKind getKind();
 
     /**
-     * Returns the annotations that are directly present on this element.
-     *
-     * <p> To get inherited annotations as well, use
-     * {@link Elements#getAllAnnotationMirrors(Element) getAllAnnotationMirrors}.
-     *
-     * @see ElementFilter
-     *
-     * @return the annotations directly present on this element;
-     *          an empty list if there are none
-     */
-    List<? extends AnnotationMirror> getAnnotationMirrors();
-
-    /**
-     * Returns this element's annotation for the specified type if
-     * such an annotation is present, else {@code null}.  The
-     * annotation may be either inherited or directly present on this
-     * element.
-     *
-     * <p> The annotation returned by this method could contain an element
-     * whose value is of type {@code Class}.
-     * This value cannot be returned directly:  information necessary to
-     * locate and load a class (such as the class loader to use) is
-     * not available, and the class might not be loadable at all.
-     * Attempting to read a {@code Class} object by invoking the relevant
-     * method on the returned annotation
-     * will result in a {@link MirroredTypeException},
-     * from which the corresponding {@link TypeMirror} may be extracted.
-     * Similarly, attempting to read a {@code Class[]}-valued element
-     * will result in a {@link MirroredTypesException}.
-     *
-     * <blockquote>
-     * <i>Note:</i> This method is unlike others in this and related
-     * interfaces.  It operates on runtime reflective information &mdash;
-     * representations of annotation types currently loaded into the
-     * VM &mdash; rather than on the representations defined by and used
-     * throughout these interfaces.  Consequently, calling methods on
-     * the returned annotation object can throw many of the exceptions
-     * that can be thrown when calling methods on an annotation object
-     * returned by core reflection.  This method is intended for
-     * callers that are written to operate on a known, fixed set of
-     * annotation types.
-     * </blockquote>
-     *
-     * @param <A>  the annotation type
-     * @param annotationType  the {@code Class} object corresponding to
-     *          the annotation type
-     * @return this element's annotation for the specified annotation
-     *         type if present on this element, else {@code null}
-     *
-     * @see #getAnnotationMirrors()
-     * @see java.lang.reflect.AnnotatedElement#getAnnotation
-     * @see EnumConstantNotPresentException
-     * @see AnnotationTypeMismatchException
-     * @see IncompleteAnnotationException
-     * @see MirroredTypeException
-     * @see MirroredTypesException
-     */
-    <A extends Annotation> A getAnnotation(Class<A> annotationType);
-
-    /**
      * Returns the modifiers of this element, excluding annotations.
      * Implicit modifiers, such as the {@code public} and {@code static}
      * modifiers of interface members, are included.
@@ -179,6 +118,10 @@
      * instance initializer}, an empty name is returned.
      *
      * @return the simple name of this element
+     * @see PackageElement#getSimpleName
+     * @see ExecutableElement#getSimpleName
+     * @see TypeElement#getSimpleName
+     * @see VariableElement#getSimpleName
      */
     Name getSimpleName();
 
@@ -202,6 +145,11 @@
      * {@linkplain TypeParameterElement#getGenericElement the
      * generic element} of the type parameter is returned.
      *
+     * <li> If this is a {@linkplain
+     * VariableElement#getEnclosingElement method or constructor
+     * parameter}, {@linkplain ExecutableElement the executable
+     * element} which declares the parameter is returned.
+     *
      * </ul>
      *
      * @return the enclosing element, or {@code null} if there is none
@@ -263,6 +211,19 @@
      */
     int hashCode();
 
+
+    /**
+     * {@inheritDoc}
+     *
+     * <p> To get inherited annotations as well, use {@link
+     * Elements#getAllAnnotationMirrors(Element)
+     * getAllAnnotationMirrors}.
+     *
+     * @see ElementFilter
+     * @since 1.6
+     */
+    @Override
+    List<? extends AnnotationMirror> getAnnotationMirrors();
     /**
      * Applies a visitor to this element.
      *
--- a/src/share/classes/javax/lang/model/element/ElementVisitor.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/element/ElementVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
@@ -52,6 +52,18 @@
  * parameters, return type, etc. rather than one of the abstract
  * classes.
  *
+ * <p>Note that methods to accommodate new language constructs could
+ * be added in a source <em>compatible</em> way if they were added as
+ * <em>default methods</em>.  However, default methods are only
+ * available on Java SE 8 and higher releases and the {@code
+ * javax.lang.model.*} packages bundled in Java SE 8 are required to
+ * also be runnable on Java SE 7.  Therefore, default methods
+ * <em>cannot</em> be used when extending {@code javax.lang.model.*}
+ * to cover Java SE 8 language features.  However, default methods may
+ * be used in subsequent revisions of the {@code javax.lang.model.*}
+ * packages that are only required to run on Java SE 8 and higher
+ * platform versions.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/element/ExecutableElement.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/element/ExecutableElement.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -69,6 +69,25 @@
     List<? extends VariableElement> getParameters();
 
     /**
+     * Returns the receiver type of this executable,
+     * or {@link javax.lang.model.type.NoType NoType} with
+     * kind {@link javax.lang.model.type.TypeKind#NONE NONE}
+     * if the executable has no receiver type.
+     *
+     * An executable which is an instance method, or a constructor of an
+     * inner class, has a receiver type derived from the {@linkplain
+     * #getEnclosingElement declaring type}.
+     *
+     * An executable which is a static method, or a constructor of a
+     * non-inner class, or an initializer (static or instance), has no
+     * receiver type.
+     *
+     * @return the receiver type of this executable
+     * @since 1.8
+     */
+    TypeMirror getReceiverType();
+
+    /**
      * Returns {@code true} if this method or constructor accepts a variable
      * number of arguments and returns {@code false} otherwise.
      *
--- a/src/share/classes/javax/lang/model/element/TypeElement.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/element/TypeElement.java	Tue Jul 02 10:13:00 2013 +0100
@@ -111,7 +111,6 @@
      */
     Name getQualifiedName();
 
-
     /**
      * Returns the simple name of this type element.
      *
@@ -152,7 +151,6 @@
      */
     List<? extends TypeParameterElement> getTypeParameters();
 
-
     /**
      * Returns the package of a top-level type and returns the
      * immediately lexically enclosing element for a {@linkplain
--- a/src/share/classes/javax/lang/model/element/VariableElement.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/element/VariableElement.java	Tue Jul 02 10:13:00 2013 +0100
@@ -62,4 +62,29 @@
      * @jls 4.12.4 final Variables
      */
     Object getConstantValue();
+
+    /**
+     * Returns the simple name of this variable element.
+     *
+     * <p>For method and constructor parameters, the name of each
+     * parameter must be distinct from the names of all other
+     * parameters of the same executable.  If the original source
+     * names are not available, an implementation may synthesize names
+     * subject to the distinctness requirement above.
+     *
+     * @return the simple name of this variable element
+     */
+    @Override
+    Name getSimpleName();
+
+    /**
+     * Returns the enclosing element of this variable.
+     *
+     * The enclosing element of a method or constructor parameter is
+     * the executable declaring the parameter.
+     *
+     * @return the enclosing element of this variable
+     */
+    @Override
+    Element getEnclosingElement();
 }
--- a/src/share/classes/javax/lang/model/element/package-info.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/element/package-info.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -48,9 +48,12 @@
  * {@linkplain java.lang.annotation.RetentionPolicy#SOURCE source}
  * {@linkplain java.lang.annotation.Retention retention} cannot be
  * recovered from class files and class files might not be able to
- * provide source position information.  The {@linkplain
- * javax.lang.model.element.Modifier modifiers} on an element may
- * differ in some cases including
+ * provide source position information.
+ *
+ * Names of parameters may not be recoverable from class files.
+ *
+ * The {@linkplain javax.lang.model.element.Modifier modifiers} on an
+ * element may differ in some cases including:
  *
  * <ul>
  * <li> {@code strictfp} on a class or interface
--- a/src/share/classes/javax/lang/model/type/ExecutableType.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/type/ExecutableType.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -30,7 +30,6 @@
 
 import javax.lang.model.element.ExecutableElement;
 
-
 /**
  * Represents the type of an executable.  An <i>executable</i>
  * is a method, constructor, or initializer.
@@ -78,6 +77,25 @@
     List<? extends TypeMirror> getParameterTypes();
 
     /**
+     * Returns the receiver type of this executable,
+     * or {@link javax.lang.model.type.NoType NoType} with
+     * kind {@link javax.lang.model.type.TypeKind#NONE NONE}
+     * if the executable has no receiver type.
+     *
+     * An executable which is an instance method, or a constructor of an
+     * inner class, has a receiver type derived from the {@linkplain
+     * ExecutableElement#getEnclosingElement declaring type}.
+     *
+     * An executable which is a static method, or a constructor of a
+     * non-inner class, or an initializer (static or instance), has no
+     * receiver type.
+     *
+     * @return the receiver type of this executable
+     * @since 1.8
+     */
+    TypeMirror getReceiverType();
+
+    /**
      * Returns the exceptions and other throwables listed in this
      * executable's {@code throws} clause.
      *
--- a/src/share/classes/javax/lang/model/type/TypeKind.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/type/TypeKind.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
--- a/src/share/classes/javax/lang/model/type/TypeMirror.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/type/TypeMirror.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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,6 +25,8 @@
 
 package javax.lang.model.type;
 
+import java.lang.annotation.Annotation;
+import java.util.List;
 import javax.lang.model.element.*;
 import javax.lang.model.util.Types;
 
@@ -55,7 +57,7 @@
  * @see Types
  * @since 1.6
  */
-public interface TypeMirror {
+public interface TypeMirror extends javax.lang.model.AnnotatedConstruct {
 
     /**
      * Returns the {@code kind} of this type.
--- a/src/share/classes/javax/lang/model/type/TypeVisitor.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/type/TypeVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -52,6 +52,18 @@
  * parameters, return type, etc. rather than one of the abstract
  * classes.
  *
+ * <p>Note that methods to accommodate new language constructs could
+ * be added in a source <em>compatible</em> way if they were added as
+ * <em>default methods</em>.  However, default methods are only
+ * available on Java SE 8 and higher releases and the {@code
+ * javax.lang.model.*} packages bundled in Java SE 8 are required to
+ * also be runnable on Java SE 7.  Therefore, default methods
+ * <em>cannot</em> be used when extending {@code javax.lang.model.*}
+ * to cover Java SE 8 language features.  However, default methods may
+ * be used in subsequent revisions of the {@code javax.lang.model.*}
+ * packages that are only required to run on Java SE 8 and higher
+ * platform versions.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java	Tue Jul 02 10:13:00 2013 +0100
@@ -54,6 +54,15 @@
  * behavior for the visit method in question.  When the new visitor is
  * introduced, all or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods
  * @param <P> the type of the additional parameter to this visitor's methods.
  *
--- a/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor7.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor7.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -51,6 +51,15 @@
  * behavior for the visit method in question.  When the new visitor is
  * introduced, all or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods
  * @param <P> the type of the additional parameter to this visitor's methods.
  *
--- a/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor8.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor8.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -51,6 +51,15 @@
  * behavior for the visit method in question.  When the new visitor is
  * introduced, all or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods
  * @param <P> the type of the additional parameter to this visitor's methods.
  *
--- a/src/share/classes/javax/lang/model/util/AbstractElementVisitor6.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractElementVisitor6.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -53,6 +53,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/AbstractElementVisitor7.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractElementVisitor7.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -52,6 +52,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/AbstractElementVisitor8.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractElementVisitor8.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -52,6 +52,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -49,6 +49,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -49,6 +49,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/AbstractTypeVisitor8.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/AbstractTypeVisitor8.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -49,6 +49,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/ElementKindVisitor6.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -67,6 +67,15 @@
  * for the visit method in question.  When the new visitor is
  * introduced, all or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/ElementKindVisitor7.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/ElementKindVisitor7.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -65,6 +65,15 @@
  * for the visit method in question.  When the new visitor is
  * introduced, all or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/ElementKindVisitor8.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/ElementKindVisitor8.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -65,6 +65,15 @@
  * for the visit method in question.  When the new visitor is
  * introduced, all or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/Elements.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/Elements.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -249,4 +249,14 @@
      * @param cs the character sequence to return as a name
      */
     Name getName(CharSequence cs);
+
+    /**
+     * Returns {@code true} if the type element is a functional interface, {@code false} otherwise.
+     *
+     * @param type the type element being examined
+     * @return {@code true} if the element is a functional interface, {@code false} otherwise
+     * @jls 9.8 Functional Interfaces
+     * @since 1.8
+     */
+    boolean isFunctionalInterface(TypeElement type);
 }
--- a/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -63,6 +63,15 @@
  * behavior for the visit method in question.  When the new visitor is
  * introduced, all or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods
  * @param <P> the type of the additional parameter to this visitor's methods.
  *
--- a/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -58,6 +58,15 @@
  * behavior for the visit method in question.  When the new visitor is
  * introduced, all or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods
  * @param <P> the type of the additional parameter to this visitor's methods.
  *
--- a/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor8.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor8.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -58,6 +58,15 @@
  * behavior for the visit method in question.  When the new visitor is
  * introduced, all or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods
  * @param <P> the type of the additional parameter to this visitor's methods.
  *
--- a/src/share/classes/javax/lang/model/util/SimpleElementVisitor6.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleElementVisitor6.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -65,6 +65,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@code Void}
  *             for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's methods.  Use {@code Void}
--- a/src/share/classes/javax/lang/model/util/SimpleElementVisitor7.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleElementVisitor7.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -62,6 +62,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@code Void}
  *             for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's methods.  Use {@code Void}
--- a/src/share/classes/javax/lang/model/util/SimpleElementVisitor8.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleElementVisitor8.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -61,6 +61,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@code Void}
  *             for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's methods.  Use {@code Void}
--- a/src/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -64,6 +64,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -61,6 +61,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/SimpleTypeVisitor8.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/SimpleTypeVisitor8.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -60,6 +60,15 @@
  * visit method in question.  When the new visitor is introduced, all
  * or portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/TypeKindVisitor6.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -63,6 +63,15 @@
  * method in question.  When the new visitor is introduced, all or
  * portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/TypeKindVisitor7.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/TypeKindVisitor7.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -63,6 +63,15 @@
  * method in question.  When the new visitor is introduced, all or
  * portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/TypeKindVisitor8.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/TypeKindVisitor8.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -63,6 +63,15 @@
  * method in question.  When the new visitor is introduced, all or
  * portions of this visitor may be deprecated.
  *
+ * <p>Note that adding a default implementation of a new visit method
+ * in a visitor class will occur instead of adding a <em>default
+ * method</em> directly in the visitor interface since a Java SE 8
+ * language feature cannot be used to this version of the API since
+ * this version is required to be runnable on Java SE 7
+ * implementations.  Future versions of the API that are only required
+ * to run on Java SE 8 and later may take advantage of default methods
+ * in this situation.
+ *
  * @param <R> the return type of this visitor's methods.  Use {@link
  *            Void} for visitors that do not need to return results.
  * @param <P> the type of the additional parameter to this visitor's
--- a/src/share/classes/javax/lang/model/util/Types.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/src/share/classes/javax/lang/model/util/Types.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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,6 +25,9 @@
 
 package javax.lang.model.util;
 
+import java.lang.annotation.Annotation;
+import java.lang.annotation.AnnotationTypeMismatchException;
+import java.lang.annotation.IncompleteAnnotationException;
 import java.util.List;
 import javax.lang.model.element.*;
 import javax.lang.model.type.*;
@@ -56,6 +59,13 @@
     /**
      * Tests whether two {@code TypeMirror} objects represent the same type.
      *
+     * <p>Since annotations are only meta-data associated with a type,
+     * the set of annotations on either argument is <em>not</em> taken
+     * into account when computing whether or not two {@code
+     * TypeMirror} objects are the same type. In particular, two
+     * {@code TypeMirror} objects can have different annotations and
+     * still be considered the same.
+     *
      * <p>Caveat: if either of the arguments to this method represents a
      * wildcard, this method will return false.  As a consequence, a wildcard
      * is not the same type as itself.  This might be surprising at first,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/jdk/Supported.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,53 @@
+/*
+ * 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 jdk;
+
+import java.lang.annotation.*;
+
+/**
+  * Indicates whether or not a JDK specific type or package is a
+  * supported part of the JDK.
+  *
+  * This annotation should only be applied to types and packages
+  * <em>outside</em> of the Java SE namespaces of {@code java.*} and
+  * {@code javax.*} packages.  For example, certain portions of {@code
+  * com.sun.*} are official parts of the JDK meant to be generally
+  * usable while other portions of {@code com.sun.*} are not.  This
+  * annotation type allows those portions to be easily and
+  * programmaticly distinguished.
+  *
+  * @since 1.8
+  */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.PACKAGE})
+@Supported
+public @interface Supported {
+    /**
+     * Whether or not this package or type is a supported part of the JDK.
+     */
+    boolean value() default true;
+}
--- a/test/Makefile	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/Makefile	Tue Jul 02 10:13:00 2013 +0100
@@ -229,7 +229,7 @@
 all: $(JPRT_CLEAN) jtreg-tests jck-compiler-tests jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) all-summary
 	@echo "Testing completed successfully"
 
-jtreg apt javac javadoc javah javap: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary
+jtreg apt javac javadoc javah javap jdeps: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary
 	@echo "Testing completed successfully"
 
 jck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary
@@ -246,6 +246,7 @@
 javadoc:	JTREG_TESTDIRS = tools/javadoc com/sun/javadoc
 javah:		JTREG_TESTDIRS = tools/javah
 javap:		JTREG_TESTDIRS = tools/javap
+jdeps:		JTREG_TESTDIRS = tools/jdeps
 
 # Run jtreg tests
 #
@@ -271,6 +272,7 @@
 	@mkdir -p $(JTREG_OUTPUT_DIR)
 	JT_JAVA=$(JT_JAVA) $(JTREG) \
 	  -J-Xmx512m \
+	  -vmoption:-Xmx768m \
 	  -a -ignore:quiet -v:fail,error,nopass \
           -r:$(JTREG_OUTPUT_DIR)/JTreport \
           -w:$(JTREG_OUTPUT_DIR)/JTwork \
@@ -426,7 +428,7 @@
 
 # Phony targets (e.g. these are not filenames)
 .PHONY: all clean \
-	jtreg javac javadoc javah javap jtreg-tests jtreg-summary check-jtreg \
+	jtreg javac javadoc javah javap jdeps jtreg-tests jtreg-summary check-jtreg \
 	jck-compiler jck-compiler-tests jck-compiler-summary \
 	jck-runtime jck-runtime-tests jck-runtime-summary check-jck
 
--- a/test/com/sun/javadoc/5093723/T5093723.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/5093723/T5093723.java	Tue Jul 02 10:13:00 2013 +0100
@@ -36,7 +36,7 @@
     private static final String BUG_ID = "5093723";
 
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID + ".out", "-source", "5",
+        "-d", BUG_ID + ".out", "-source", "5", "-Xdoclint:none",
         SRC_DIR + "/DocumentedClass.java",
         SRC_DIR + "/UndocumentedClass.java"
     };
--- a/test/com/sun/javadoc/DocRootSlash/DocRootSlash.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/DocRootSlash/DocRootSlash.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -60,6 +60,7 @@
         String srcdir = System.getProperty("test.src", ".");
 
         runJavadoc(new String[] {"-d", TMPDIR_STRING1,
+                                 "-Xdoclint:none",
                                  "-overview", (srcdir + FS + "overview.html"),
                                  "-header", "<A HREF=\"{@docroot}/package-list\">{&#064;docroot}</A> <A HREF=\"{@docRoot}/help-doc\">{&#064;docRoot}</A>",
                                  "-sourcepath", srcdir,
--- a/test/com/sun/javadoc/T6735320/T6735320.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/T6735320/T6735320.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -47,8 +47,8 @@
 
     public static void main(String... args) {
         T6735320 tester = new T6735320();
-        if (tester.runJavadoc(ARGS) != 0) {
-            throw new AssertionError("non-zero return code from javadoc");
+        if (tester.runJavadoc(ARGS) == 0) {
+            throw new AssertionError("zero return code from javadoc");
         }
         if (tester.getErrorOutput().contains("StringIndexOutOfBoundsException")) {
             throw new AssertionError("javadoc threw StringIndexOutOfBoundsException");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testAbstractMethod/TestAbstractMethod.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,121 @@
+/*
+ * 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      8004891
+ * @summary  Make sure that the abstract method is identified correctly
+ *           if the abstract modifier is present explicitly or implicitly.
+ * @author   bpatel
+ * @library  ../lib/
+ * @build    JavadocTester TestAbstractMethod
+ * @run main TestAbstractMethod
+ */
+
+public class TestAbstractMethod extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "8004891";
+
+    //Javadoc arguments.
+    private static final String[] ARGS = new String[] {
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
+    };
+
+    //Input for string search tests.
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg" + FS + "A.html",
+            "<td class=\"colFirst\"><code>default void</code></td>"},
+        {BUG_ID + FS + "pkg" + FS + "A.html",
+            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
+            "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t2\" class=\"tableTab\"><span>" +
+            "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
+            "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
+            "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
+            "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>" +
+            "</span><span id=\"t5\" class=\"tableTab\"><span>" +
+            "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
+            "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
+        {BUG_ID + FS + "pkg" + FS + "B.html",
+            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
+            "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t2\" class=\"tableTab\"><span>" +
+            "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
+            "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
+            "class=\"tableTab\"><span><a href=\"javascript:show(4);\">Abstract " +
+            "Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t4\" class=\"tableTab\"><span>" +
+            "<a href=\"javascript:show(8);\">Concrete Methods</a></span>" +
+            "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
+        {BUG_ID + FS + "pkg" + FS + "B.html",
+            "<td class=\"colFirst\"><code>abstract void</code></td>"},
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
+            "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t2\" class=\"tableTab\"><span>" +
+            "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
+            "<span class=\"tabEnd\">&nbsp;</span></span>" +
+            "<span id=\"t5\" class=\"tableTab\"><span>" +
+            "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
+            "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<td class=\"colFirst\"><code>default void</code></td>"}
+    };
+    private static final String[][] NEGATED_TEST = {
+        {BUG_ID + FS + "pkg" + FS + "A.html",
+            "<td class=\"colFirst\"><code>abstract void</code></td>"},
+        {BUG_ID + FS + "pkg" + FS + "B.html",
+            "<span><a href=\"javascript:show(16);\">Default Methods</a></span>" +
+            "<span class=\"tabEnd\">&nbsp;</span>"},
+        {BUG_ID + FS + "pkg" + FS + "B.html",
+            "<td class=\"colFirst\"><code>default void</code></td>"},
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>" +
+            "<span class=\"tabEnd\">&nbsp;</span>"}
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestAbstractMethod tester = new TestAbstractMethod();
+        run(tester, ARGS, TEST, NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testAbstractMethod/pkg/A.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public interface A {
+
+    public void method1();
+
+    public default void defaultMethod() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testAbstractMethod/pkg/B.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public abstract class B {
+
+    public abstract void method1();
+
+    public void method2() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testAbstractMethod/pkg/C.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public interface C {
+
+    public default void onlyMethod() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2009 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary  Make sure that annotations types with optional elements has
+ *           element headers
+ * @author   Mahmood Ali
+ * @library  ../lib/
+ * @build    JavadocTester
+ * @build    TestAnnotationOptional
+ * @run main TestAnnotationOptional
+ */
+
+public class TestAnnotationOptional extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "NO_BUG_ID_YET";
+
+    //Javadoc arguments.
+    private static final String[] ARGS = new String[] {
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-source", "1.5", "pkg"
+    };
+
+    //Input for string search tests.
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg" + FS + "AnnotationOptional.html",
+            "<a name=\"annotation_type_element_detail\">"
+        }
+    };
+
+    private static final String[][] NEGATED_TEST = NO_TEST;
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestAnnotationOptional tester = new TestAnnotationOptional();
+        run(tester, ARGS, TEST, NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testAnnotationOptional/pkg/AnnotationOptional.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2009 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 pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This is just a test annotation type with optional value element.
+ *
+ * @author Mahmood Ali
+ * @since 1.5
+ */
+@Documented public @interface AnnotationOptional {
+    String value() default "";
+}
--- a/test/com/sun/javadoc/testBadSourceFile/TestBadSourceFile.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testBadSourceFile/TestBadSourceFile.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 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
@@ -40,7 +40,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, SRC_DIR + FS + "C2.java"
+        "-Xdoclint:none", "-d", BUG_ID, SRC_DIR + FS + "C2.java"
     };
 
     //Input for string search tests.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testDocFiles/TestDocFiles.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,67 @@
+/*
+ * 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 8008949
+ * @summary verify that doc-files get copied
+ * @library ../lib/
+ * @build JavadocTester
+ * @build TestDocFiles
+ * @run main TestDocFiles
+ */
+
+public class TestDocFiles extends JavadocTester {
+
+    private static final String BUG_ID = "8008949";
+    private static final String[][] TEST = {
+        {"tmp" + FS + "pkg" + FS + "doc-files" + FS + "test.txt", "test file"}};
+
+    private static final String[] ARGS =
+        new String[] {
+            "-d", "tmp", "-sourcepath", SRC_DIR, "pkg"};
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestDocFiles tester = new TestDocFiles();
+        run(tester, ARGS, TEST, NO_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testDocFiles/pkg/Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2002, 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 pkg;
+
+public class Test { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testDocFiles/pkg/doc-files/test.txt	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+this is a test file
+
--- a/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2011, 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
@@ -222,19 +222,19 @@
 
     private static final String[] ARGS1 =
         new String[] {
-            "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
+            "-Xdoclint:none", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
 
     private static final String[] ARGS2 =
         new String[] {
-            "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
+            "-Xdoclint:none", "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
 
     private static final String[] ARGS3 =
         new String[] {
-            "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
+            "-Xdoclint:none", "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
 
     private static final String[] ARGS4 =
         new String[] {
-            "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
+            "-Xdoclint:none", "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
 
     /**
      * The entry point of the test.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testJavaFX/C.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,103 @@
+/*
+ * 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
+ * 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.
+ */
+
+/**
+ * @expert Expert tag text
+ */
+
+public class C {
+
+    /**
+     * @propertySetter Property
+     * @propertyDescription PropertyDescription
+     */
+    public void CC() {}
+
+    /**
+     * @propertyGetter Property
+     * @expert Expert tag text
+     *
+     */
+    public void B() {}
+
+    /**
+     * Method A documentation
+     * @treatAsPrivate
+     */
+    public void A() {}
+
+    /**
+     * Field i
+     * @defaultValue 1.0
+     */
+    public int i;
+
+
+    /**
+     * Defines the direction/speed at which the {@code Timeline} is expected to
+     * be played.
+     * @defaultValue 11
+     */
+    private DoubleProperty rate;
+
+    public final void setRate(double value) {}
+
+    public final double getRate() {}
+
+    public final DoubleProperty rateProperty() {}
+
+    private BooleanProperty paused;
+
+    public final void setPaused(boolean value) {}
+
+    public final double isPaused() {}
+
+    /**
+     * Defines if paused
+     * @defaultValue false
+     */
+    public final BooleanProperty pausedProperty() {}
+
+    class DoubleProperty {}
+
+    class BooleanProperty {}
+
+    public final BooleanProperty setTestMethodProperty() {}
+
+    private class Inner {
+        private BooleanProperty testMethodProperty() {}
+
+        /**
+         * Defines the direction/speed at which the {@code Timeline} is expected to
+         * be played.
+         * @defaultValue 11
+         */
+        private DoubleProperty rate;
+
+        public final void setRate(double value) {}
+
+        public final double getRate() {}
+
+        public final DoubleProperty rateProperty() {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testJavaFX/D.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+/*
+ * 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
+ * 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.
+ */
+
+/**
+ * @expert Expert tag text
+ */
+
+public class D extends C {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testJavaFX/TestJavaFX.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,109 @@
+/*
+ * 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
+ * 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 7112427
+ * @summary Test of the JavaFX doclet features.
+ * @author jvalenta
+ * @library ../lib/
+ * @build JavadocTester TestJavaFX
+ * @run main TestJavaFX
+ */
+
+public class TestJavaFX extends JavadocTester {
+
+    private static final String BUG_ID = "7112427";
+
+    private static final String[][] TEST =
+        new String[][] {
+            {"./" + BUG_ID + "/C.html",
+                "<dt><span class=\"strong\">See Also:</span></dt><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 +
+                "<dl><dt><span class=\"strong\">Property description:</span></dt>" },
+            {"./" + BUG_ID + "/C.html",
+                "<pre>public final&nbsp;double&nbsp;getRate()</pre>" + NL +
+                "<div class=\"block\">Gets the value of the property rate.</div>" + NL +
+                "<dl><dt><span class=\"strong\">Property description:</span></dt>" },
+            {"./" + BUG_ID + "/C.html",
+                "<td class=\"colLast\"><code><strong><a href=\"C.html#rateProperty\">rate</a></strong></code>" + NL +
+                "<div class=\"block\">Defines the direction/speed at which the <code>Timeline</code> is expected to"},
+            {"./" + BUG_ID + "/C.html",
+                "<sub id=\"expert\">Expert tag text</sub>"},
+            {"./" + BUG_ID + "/C.html",
+                "<span class=\"strong\">Default value:</span>"},
+            {"./" + BUG_ID + "/C.html",
+                "<P>Sets the value of the property <CODE>Property</CODE>"},
+            {"./" + BUG_ID + "/C.html",
+                "<P>Gets the value of the property <CODE>Property</CODE>"},
+            {"./" + BUG_ID + "/C.html",
+                "<span class=\"strong\">Property description:</span>"},
+            {"./" + BUG_ID + "/C.html",
+                "<td class=\"colLast\"><code><strong><a href=\"C.html#setTestMethodProperty()\">setTestMethodProperty</a></strong>()</code>&nbsp;</td>" },
+            {"./" + BUG_ID + "/C.html",
+                "<h4>isPaused</h4>" + NL +
+                "<pre>public final&nbsp;double&nbsp;isPaused()</pre>" + NL +
+                "<div class=\"block\">Gets the value of the property paused.</div>" },
+            {"./" + BUG_ID + "/D.html",
+                "<h3>Properties inherited from class&nbsp;<a href=\"C.html\" title=\"class in &lt;Unnamed&gt;\">C</a></h3>" + NL +
+                "<code><a href=\"C.html#pausedProperty\">paused</a>, <a href=\"C.html#rateProperty\">rate</a></code></li>" },
+        };
+    private static final String[][] NO_TEST =
+        new String[][] {
+            {"./" + BUG_ID + "/C.html",
+                "A()"},
+        };
+
+
+    private static final String[] ARGS = new String[] {
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-private", "-javafx",
+        SRC_DIR + FS + "C.java", SRC_DIR + FS + "D.java"
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestJavaFX tester = new TestJavaFX();
+        run(tester, ARGS, TEST, NO_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- a/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java	Tue Jul 02 10:13:00 2013 +0100
@@ -63,7 +63,7 @@
             "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL +
             "<dd>This is a functional interface and can therefore be used as " +
             "the assignment target for a lambda expression or method " +
-            "reference. </dd>" + NL + "</dl>"}
+            "reference.</dd>" + NL + "</dl>"}
     };
     private static final String[][] NEGATED_TEST = {
         {BUG_ID + FS + "pkg" + FS + "A.html",
--- a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, 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
@@ -40,7 +40,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR, "pkg", "pkg1", "pkg2"
+        "-Xdoclint:none", "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR, "pkg", "pkg1", "pkg2"
     };
 
     //Input for string search tests.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/TestProfiles.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,190 @@
+/*
+ * 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      8006124 8009684
+ * @summary  Test javadoc support for profiles.
+ * @author   Bhavesh Patel
+ * @library  ../lib/
+ * @build    JavadocTester TestProfiles
+ * @run main TestProfiles
+ */
+public class TestProfiles extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "8006124-8009684";
+    private static final String PROFILE_BUG_ID = BUG_ID + "-1";
+    private static final String PACKAGE_BUG_ID = BUG_ID + "-2";
+    //Javadoc arguments.
+    private static final String[] ARGS1 = new String[]{
+        "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath", SRC_DIR + FS
+        + "profile-rtjar-includes.txt", "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
+    };
+    private static final String[] ARGS2 = new String[]{
+        "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
+    };
+    //Input for string tests for profiles.
+    private static final String[][] PROFILES_TEST = {
+        // Tests for profile-overview-frame.html listing all profiles.
+        {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
+            "<span><a href=\"overview-frame.html\" "
+            + "target=\"packageListFrame\">All Packages</a></span>"
+        },
+        {PROFILE_BUG_ID + FS + "profile-overview-frame.html",
+            "<li><a href=\"compact1-frame.html\" target=\"packageListFrame\">"
+            + "compact1</a></li>"
+        },
+        // Tests for profileName-frame.html listing all packages in a profile.
+        {PROFILE_BUG_ID + FS + "compact2-frame.html",
+            "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">"
+            + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
+            + "target=\"packageListFrame\">All Profiles</a></span>"
+        },
+        {PROFILE_BUG_ID + FS + "compact2-frame.html",
+            "<li><a href=\"pkg4/compact2-package-frame.html\" "
+            + "target=\"packageFrame\">pkg4</a></li>"
+        },
+        // Test for profileName-package-frame.html listing all types in a
+        // package of a profile.
+        {PROFILE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
+            "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
+            + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
+            + "target=\"classFrame\">pkg2</a>"
+        },
+        // Tests for profileName-summary.html listing the summary for a profile.
+        {PROFILE_BUG_ID + FS + "compact2-summary.html",
+            "<li><a href=\"compact1-summary.html\">Prev Profile</a></li>" + NL
+            + "<li><a href=\"compact3-summary.html\">Next Profile</a></li>"
+        },
+        {PROFILE_BUG_ID + FS + "compact2-summary.html",
+            "<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
+        },
+        {PROFILE_BUG_ID + FS + "compact2-summary.html",
+            "<h3><a href=\"pkg2/compact2-package-summary.html\" "
+            + "target=\"classFrame\">pkg2</a></h3>"
+        },
+        // Tests for profileName-package-summary.html listing the summary for a
+        // package in a profile.
+        {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+            "<li><a href=\"../pkg4/compact3-package-summary.html\">Prev Package"
+            + "</a></li>"
+        },
+        {PROFILE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+            "<div class=\"subTitle\">compact3</div>"
+        },
+        //Test for "overview-frame.html" showing the "All Profiles" link.
+        {PROFILE_BUG_ID + FS + "overview-frame.html",
+            "<span><a href=\"profile-overview-frame.html\" "
+            + "target=\"packageListFrame\">All Profiles</a></span>"
+        },
+        //Test for "className.html" showing the profile information for the type.
+        {PROFILE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
+            "<div class=\"subTitle\">compact1, compact2, compact3</div>"
+        },
+        {PROFILE_BUG_ID + FS + "index.html",
+            "<frame src=\"overview-frame.html\" name=\"packageListFrame\" " +
+            "title=\"All Packages\">"
+        }
+    };
+    private static final String[][] PROFILES_NEGATED_TEST = {
+        {PROFILE_BUG_ID + FS + "pkg3" + FS + "Class2Pkg3.html",
+            "<div class=\"subTitle\">compact1"
+        },
+        {PROFILE_BUG_ID + FS + "pkg3" + FS + "Interface1Pkg3.html",
+            "<div class=\"subTitle\">compact1"
+        },
+        {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html",
+            "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
+            + "target=\"classFrame\">Anno1Pkg4</a></li>"
+        }
+    };
+    private static final String[][] PACKAGES_TEST = {
+        {PACKAGE_BUG_ID + FS + "overview-frame.html",
+            "<h2 title=\"Packages\">Packages</h2>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-frame.html",
+            "<h1 class=\"bar\"><a href=\"../pkg4/package-summary.html\" "
+            + "target=\"classFrame\">pkg4</a></h1>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg4" + FS + "package-summary.html",
+            "<div class=\"header\">" + NL + "<h1 title=\"Package\" "
+            + "class=\"title\">Package&nbsp;pkg4</h1>" + NL + "</div>"
+        }
+    };
+    private static final String[][] PACKAGES_NEGATED_TEST = {
+        {PACKAGE_BUG_ID + FS + "profile-overview-frame.html",
+            "<span><a href=\"overview-frame.html\" "
+            + "target=\"packageListFrame\">All Packages</a></span>"
+        },
+        {PACKAGE_BUG_ID + FS + "compact2-frame.html",
+            "<span><a href=\"overview-frame.html\" target=\"packageListFrame\">"
+            + "All Packages</a></span><span><a href=\"profile-overview-frame.html\" "
+            + "target=\"packageListFrame\">All Profiles</a></span>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg2" + FS + "compact2-package-frame.html",
+            "<a href=\"../compact2-summary.html\" target=\"classFrame\">"
+            + "compact2</a> - <a href=\"../pkg2/compact2-package-summary.html\" "
+            + "target=\"classFrame\">pkg2</a>"
+        },
+        {PACKAGE_BUG_ID + FS + "compact2-summary.html",
+            "<h1 title=\"Profile\" class=\"title\">Profile&nbsp;compact2</h1>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg5" + FS + "compact3-package-summary.html",
+            "<div class=\"subTitle\">compact3</div>"
+        },
+        {PACKAGE_BUG_ID + FS + "overview-frame.html",
+            "<span><a href=\"profile-overview-frame.html\" "
+            + "target=\"packageListFrame\">All Profiles</a></span>"
+        },
+        {PACKAGE_BUG_ID + FS + "pkg2" + FS + "Class1Pkg2.html",
+            "<div class=\"subTitle\">compact1, compact2, compact3</div>"
+        }
+    };
+
+    /**
+     * The entry point of the test.
+     *
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestProfiles tester = new TestProfiles();
+        run(tester, ARGS1, PROFILES_TEST, PROFILES_NEGATED_TEST);
+        run(tester, ARGS2, PACKAGES_TEST, PACKAGES_NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg1/Class1Pkg1.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg1/Class2Pkg1.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class2Pkg1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg1/Class3Pkg1.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class3Pkg1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg1/Interface1Pkg1.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,48 @@
+/*
+ * 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;
+
+/**
+ * A sample interface.
+ *
+ * @author Bhavesh Patel
+ */
+public interface Interface1Pkg1 {
+
+    /**
+     * A test method.
+     *
+     * @param a blah.
+     * @param b blah.
+     */
+    void method1(int a, int b);
+
+    /**
+     * Another test method.
+     *
+     * @param c blah.
+     */
+    void method2(int c);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg2/Anno1Pkg2.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 pkg2;
+
+import java.lang.annotation.*;
+
+/**
+ * Test Annotation class.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface Anno1Pkg2 {
+    /**
+     * Comment.
+     */
+    String[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg2/Anno2Pkg2.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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 pkg2;
+
+import java.lang.annotation.*;
+
+/*
+ * A sample interface.
+ */
+public @interface Anno2Pkg2 {
+    boolean value() default true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg2/Class1Pkg2.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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 pkg2;
+
+/**
+ * Another test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg2 {
+
+    /**
+     * A sample enum.
+     */
+    public static enum ModalExclusionType {
+        /**
+         * Test comment.
+         */
+        NO_EXCLUDE,
+        /**
+         * Another comment.
+         */
+        APPLICATION_EXCLUDE
+    };
+
+    /**
+     * A string constant.
+     */
+    public static final String CONSTANT1 = "C2";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg3/Class1Pkg3.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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 pkg3;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg3 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg3/Class2Pkg3.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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 pkg3;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class2Pkg3 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg3/Interface1Pkg3.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,48 @@
+/*
+ * 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 pkg3;
+
+/**
+ * A sample interface.
+ *
+ * @author Bhavesh Patel
+ */
+public interface Interface1Pkg3 {
+
+    /**
+     * A test method.
+     *
+     * @param a blah.
+     * @param b blah.
+     */
+    void method1(int a, int b);
+
+    /**
+     * Another test method.
+     *
+     * @param c blah.
+     */
+    void method2(int c);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg4/Anno1Pkg4.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 pkg4;
+
+import java.lang.annotation.*;
+
+/**
+ * Test Annotation class.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface Anno1Pkg4 {
+    /**
+     * Comment.
+     */
+    String[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg4/Class1Pkg4.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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 pkg4;
+
+/**
+ * Another test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg4 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg5/Class1Pkg5.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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 pkg5;
+
+/**
+ * A test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class Class1Pkg5 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/pkg5/Interface1Pkg5.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 pkg5;
+
+/**
+ * A sample interface.
+ *
+ * @author Bhavesh Patel
+ */
+public interface Interface1Pkg5 {
+
+    /**
+     * A test method.
+     *
+     * @param a blah.
+     * @param b blah.
+     */
+    void method1(int a, int b);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testProfiles/profile-rtjar-includes.txt	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,42 @@
+PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
+    pkg2 
+
+PROFILE_1_RTJAR_INCLUDE_TYPES := \
+    pkg3/Class1Pkg3.class
+
+PROFILE_1_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_1_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
+    pkg4 
+
+PROFILE_2_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_2_RTJAR_EXCLUDE_TYPES := \
+    pkg4/Anno1Pkg4.class 
+
+PROFILE_2_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
+    pkg5 
+
+PROFILE_3_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_3_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_3_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_4_RTJAR_INCLUDE_PACKAGES := \
+    pkg1 
+
+PROFILE_4_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_4_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_4_INCLUDE_METAINF_SERVICES :=  
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,187 @@
+/*
+ * 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      8005092
+ * @summary  Test repeated annotations output.
+ * @author   bpatel
+ * @library  ../lib/
+ * @build    JavadocTester TestRepeatedAnnotations
+ * @run main TestRepeatedAnnotations
+ */
+
+public class TestRepeatedAnnotations extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "8005092";
+
+    //Javadoc arguments.
+    private static final String[] ARGS = new String[] {
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "pkg1"
+    };
+
+    //Input for string search tests.
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeSynthDoc</a> " +
+            "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeSynthDoc</a>"},
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<a href=\"../pkg/ContaineeRegDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeRegDoc</a> " +
+            "<a href=\"../pkg/ContaineeRegDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeRegDoc</a>"},
+        {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/RegContaineeNotDoc.html\" " +
+            "title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
+            "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
+            "title=\"annotation in pkg\">@RegContaineeNotDoc</a>})"},
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeSynthDoc</a> " +
+            "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeSynthDoc</a> " +
+            "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeSynthDoc</a>"},
+        {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/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeSynthDoc</a>)"},
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeSynthDoc</a> " +
+            "<a href=\"../pkg/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg\">@ContaineeSynthDoc</a>"},
+
+        {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)"},
+        {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)"},
+        {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})"},
+        {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/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/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)"},
+        {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/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)"}
+    };
+
+    private static final String[][] NEGATED_TEST = {
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<a href=\"../pkg/RegContaineeDoc.html\" " +
+            "title=\"annotation in pkg\">@RegContaineeDoc</a> " +
+            "<a href=\"../pkg/RegContaineeDoc.html\" " +
+            "title=\"annotation in pkg\">@RegContaineeDoc</a>"},
+        {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/RegContaineeNotDoc.html\" " +
+            "title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
+            "<a href=\"../pkg/RegContaineeNotDoc.html\" " +
+            "title=\"annotation in pkg\">@RegContaineeNotDoc</a>})"},
+
+        {BUG_ID + FS + "pkg1" + FS + "C.html",
+            "<a href=\"../pkg1/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg1\">@ContaineeSynthDoc</a> " +
+            "<a href=\"../pkg1/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg1\">@ContaineeSynthDoc</a>"},
+        {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/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)"},
+        {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/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)"},
+        {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/ContaineeSynthDoc.html\" " +
+            "title=\"annotation in pkg1\">@ContaineeSynthDoc</a>)"}
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestRepeatedAnnotations tester = new TestRepeatedAnnotations();
+        run(tester, ARGS, TEST, NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/C.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+@ContainerSynthDoc(value={@ContaineeSynthDoc,@ContaineeSynthDoc})
+@ContainerRegDoc(value={@ContaineeRegDoc,@ContaineeRegDoc})
+@RegContainerDoc(value={@RegContaineeNotDoc,@RegContaineeNotDoc})
+@ContainerRegNotDoc(value={@RegContaineeDoc,@RegContaineeDoc})
+@RegContainerNotDoc(value={@RegContaineeNotDoc,@RegContaineeNotDoc})
+@ContaineeSynthDoc @ContaineeSynthDoc @ContaineeSynthDoc
+public class C {
+
+    @ContainerSynthDoc(value={@ContaineeSynthDoc})
+    public void test1() {}
+
+    @ContaineeSynthDoc @ContaineeSynthDoc
+    public void test2() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/ContaineeRegDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation contained by ContainerRegDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface ContaineeRegDoc {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/ContaineeSynthDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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
+ * 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 pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented synthesized annotation contained by ContainerSynthDoc.
+ * It will be used to annotate Class C and a method in the class using a synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+@Repeatable(ContainerSynthDoc.class)
+public @interface ContaineeSynthDoc {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/ContainerRegDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation container for ContaineeRegDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface ContainerRegDoc {
+
+    ContaineeRegDoc[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/ContainerRegNotDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a non-documented annotation container for RegContaineeDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface ContainerRegNotDoc {
+
+    RegContaineeDoc[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/ContainerSynthDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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
+ * 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 pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented synthesized annotation container for ContaineeSynthDoc.
+ * It will be used to annotate Class C and a method in the class using a synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface ContainerSynthDoc {
+
+    ContaineeSynthDoc[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/D.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+@RegDoc(x=1)
+public class D {
+
+    @RegArryDoc(y={1})
+    public void test1() {}
+
+    @RegArryDoc(y={1,2})
+    public void test2() {}
+
+    @NonSynthDocContainer(value={@RegArryDoc})
+    public void test3() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/NonSynthDocContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation.
+ * It will be used to annotate methods in class D.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface NonSynthDocContainer {
+
+    RegArryDoc[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/RegArryDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation.
+ * It will be used to annotate methods in Class D.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface RegArryDoc {
+
+    int[] y();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/RegContaineeDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation contained by ContainerRegNotDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface RegContaineeDoc {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/RegContaineeNotDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a non-documented annotation contained by RegContainerNotDoc
+ * and RegContainerDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface RegContaineeNotDoc {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/RegContainerDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation container for RegContainerDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface RegContainerDoc {
+
+    RegContaineeNotDoc[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/RegContainerNotDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a non-documented annotation container for RegContaineeNotDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface RegContainerNotDoc {
+
+    RegContaineeNotDoc[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg/RegDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation.
+ * It will be used to annotate Class D.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface RegDoc {
+
+    int x();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/C.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+package pkg1;
+
+@ContainerSynthNotDoc(value={@ContaineeSynthDoc,@ContaineeSynthDoc})
+@RegContainerValDoc(value={@RegContaineeNotDoc,@RegContaineeNotDoc},y=3)
+@ContainerValDoc(value={@ContaineeNotDoc,@ContaineeNotDoc},x=1)
+@RegContainerValNotDoc(value={@RegContaineeDoc,@RegContaineeDoc},y=4)
+@ContainerValNotDoc(value={@ContaineeNotDoc,@ContaineeNotDoc},x=2)
+public class C {
+
+    @ContainerSynthNotDoc(value={@ContaineeSynthDoc})
+    public void test1() {}
+
+    @ContaineeSynthDoc @ContaineeSynthDoc
+    public void test2() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/ContaineeNotDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package pkg1;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a non-documented annotation contained by ContainerValNotDoc
+ * and ContainerValDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface ContaineeNotDoc {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/ContaineeSynthDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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
+ * 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.lang.annotation.*;
+
+/**
+ * This annotation is a documented synthesized annotation contained by ContainerSynthNotDoc.
+ * It will be used to annotate Class C and methods in the class using a synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+@Repeatable(ContainerSynthNotDoc.class)
+public @interface ContaineeSynthDoc {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/ContainerSynthNotDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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
+ * 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.lang.annotation.*;
+
+/**
+ * This annotation is a non-documented synthesized annotation container for ContaineeSynthDoc.
+ * It will be used to annotate Class C and methods in the class using a synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface ContainerSynthNotDoc {
+
+    ContaineeSynthDoc[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/ContainerValDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package pkg1;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation container for ContaineeNotDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface ContainerValDoc {
+
+    ContaineeNotDoc[] value();
+
+    int x();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/ContainerValNotDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package pkg1;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a non-documented annotation container for ContaineeNotDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface ContainerValNotDoc {
+
+    ContaineeNotDoc[] value();
+
+    int x();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/RegContaineeDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package pkg1;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation contained by RegContainerValNotDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface RegContaineeDoc {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/RegContaineeNotDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package pkg1;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a non-documented annotation contained by RegContainerValDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface RegContaineeNotDoc {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/RegContainerValDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package pkg1;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a documented annotation container for RegContaineeNotDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+@Documented
+public @interface RegContainerValDoc {
+
+    RegContaineeNotDoc[] value();
+
+    int y();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testRepeatedAnnotations/pkg1/RegContainerValNotDoc.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package pkg1;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation is a non-documented annotation container for RegContaineeDoc.
+ * It will be used to annotate Class C using a non-synthesized form.
+ *
+ * @author Bhavesh Patel
+ */
+public @interface RegContainerValNotDoc {
+
+    RegContaineeDoc[] value();
+
+    int y();
+}
--- a/test/com/sun/javadoc/testReturnTag/TestReturnTag.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testReturnTag/TestReturnTag.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 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
@@ -39,7 +39,7 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-sourcepath", SRC_DIR, SRC_DIR + FS + "TestReturnTag.java"
+        "-Xdoclint:none", "-d", BUG_ID, "-sourcepath", SRC_DIR, SRC_DIR + FS + "TestReturnTag.java"
     };
 
     //Input for string search tests.
--- a/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -36,7 +36,7 @@
 
     private static final String BUG_ID = "4496223-4496270-4618686-4720974-4812240-6253614-6253604";
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "firstSentence", "firstSentence2"
+        "-Xdoclint:none", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "firstSentence", "firstSentence2"
     };
 
     /**
--- a/test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -42,7 +42,7 @@
     };
     private static final String[][] NEGATED_TEST = NO_TEST;
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, SRC_DIR + FS + "TestTagMisuse.java"
+        "-Xdoclint:none", "-d", BUG_ID, SRC_DIR + FS + "TestTagMisuse.java"
     };
 
     /**
--- a/test/com/sun/javadoc/testValueTag/TestValueTag.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testValueTag/TestValueTag.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -41,6 +41,7 @@
     //Javadoc arguments.
     private static final String[] ARGS =
         new String[] {
+            "-Xdoclint:none",
             "-d", BUG_ID, "-sourcepath", SRC_DIR, "-tag",
             "todo", "pkg1", "pkg2"
         };
--- a/test/com/sun/javadoc/testWarnBadParamNames/TestWarnBadParamNames.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testWarnBadParamNames/TestWarnBadParamNames.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -43,7 +43,7 @@
     };
     private static final String[][] NEGATED_TEST = NO_TEST;
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, SRC_DIR + FS + "C.java"
+        "-Xdoclint:none", "-d", BUG_ID, SRC_DIR + FS + "C.java"
     };
 
     /**
--- a/test/com/sun/javadoc/testWarnings/TestWarnings.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/com/sun/javadoc/testWarnings/TestWarnings.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -43,11 +43,11 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
+        "-Xdoclint:none", "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
     };
 
     private static final String[] ARGS2 = new String[] {
-        "-d", BUG_ID, "-private", "-sourcepath", SRC_DIR, "pkg"
+        "-Xdoclint:none", "-d", BUG_ID, "-private", "-sourcepath", SRC_DIR, "pkg"
     };
 
     //Input for string search tests.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8006735
+ * @ignore
+ * @summary  Smoke test for ensuring that annotations are emited to javadoc
+ *
+ * @author   Mahmood Ali <mali>
+ * @library  ../../lib/
+ * @build    JavadocTester
+ * @build    TestSmoke
+ * @run main TestSmoke
+ */
+
+public class TestSmoke extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "NOT_SPECIFIED_YET";
+
+    //Javadoc arguments.
+    private static final String[] ARGS = new String[] {
+        "-d", BUG_ID, "-private", "-sourcepath", SRC_DIR, "pkg"
+    };
+
+    //Input for string search tests.
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg" + FS + "T0x1C.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x1D.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x0D.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x06.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x0B.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x0F.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x20.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x22.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x10.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x10A.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x12.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x11.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x13.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x15.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x14.html", "@DA"},
+        {BUG_ID + FS + "pkg" + FS + "T0x16.html", "@DA"}
+    };
+
+    private static final String[][] NEGATED_TEST = {
+        {BUG_ID + FS + "pkg" + FS + "T0x1C.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x1D.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x00.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x01.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x02.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x04.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x08.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x0D.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x06.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x0B.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x0F.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x20.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x22.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x10.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x10A.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x12.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x11.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x13.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x15.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x14.html", "@A"},
+        {BUG_ID + FS + "pkg" + FS + "T0x16.html", "@A"}
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestSmoke tester = new TestSmoke();
+        run(tester, ARGS, TEST, NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/typeAnnotations/smoke/pkg/TargetTypes.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.util.*;
+import java.io.*;
+
+/*
+ * @summary compiler accepts all values
+ * @author Mahmood Ali
+ * @author Yuri Gaevsky
+ */
+
+@Target({TYPE_USE})
+@Retention(RetentionPolicy.RUNTIME)
+@interface A {}
+
+@Target({TYPE_USE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+@interface DA {}
+
+/** wildcard bound */
+class T0x1C {
+    void m0x1C(List<? extends @A @DA String> lst) {}
+}
+
+/** wildcard bound generic/array */
+class T0x1D<T> {
+    void m0x1D(List<? extends @A @DA List<int[]>> lst) {}
+}
+
+/** typecast */
+class T0x00 {
+    void m0x00(Long l1) {
+        Object l2 = (@A @DA Long) l1;
+    }
+}
+
+/** typecast generic/array */
+class T0x01<T> {
+    void m0x01(List<T> list) {
+        List<T> l = (List<@A @DA T>) list;
+    }
+}
+
+/** instanceof */
+class T0x02 {
+    boolean m0x02(String s) {
+        return (s instanceof @A @DA String);
+    }
+}
+
+/** object creation (new) */
+class T0x04 {
+    void m0x04() {
+        new @A @DA ArrayList<String>();
+    }
+}
+
+/** local variable */
+class T0x08 {
+    void m0x08() {
+      @A @DA String s = null;
+    }
+}
+
+/** method parameter generic/array */
+class T0x0D {
+    void m0x0D(HashMap<@A @DA Object, List<@A @DA List<@A @DA Class>>> s1) {}
+}
+
+/** method receiver */
+class T0x06 {
+    void m0x06(@A @DA T0x06 this) {}
+}
+
+/** method return type generic/array */
+class T0x0B {
+    Class<@A @DA Object> m0x0B() { return null; }
+}
+
+/** field generic/array */
+class T0x0F {
+    HashMap<@A @DA Object, @A @DA Object> c1;
+}
+
+/** method type parameter */
+class T0x20<T, U> {
+    <@A @DA T, @A @DA U> void m0x20() {}
+}
+
+/** class type parameter */
+class T0x22<@A @DA T, @A @DA U> {
+}
+
+/** class type parameter bound */
+class T0x10<T extends @A @DA Cloneable> {
+}
+
+class T0x10A<T extends @A @DA Object> {
+}
+
+/** method type parameter bound */
+class T0x12<T> {
+    <T extends @A @DA Cloneable> void m0x12() {}
+}
+
+/** class type parameter bound generic/array */
+class T0x11<T extends List<@A @DA T>> {
+}
+
+/** method type parameter bound generic/array */
+class T0x13 {
+    static <T extends Comparable<@A @DA T>> T m0x13() {
+        return null;
+    }
+}
+
+/** class extends/implements generic/array */
+class T0x15<T> extends ArrayList<@A @DA T> {
+}
+
+/** type test (instanceof) generic/array */
+class T0x03<T> {
+    void m0x03(T typeObj, Object obj) {
+        boolean ok = obj instanceof String @A @DA [];
+    }
+}
+
+/** object creation (new) generic/array */
+class T0x05<T> {
+    void m0x05() {
+        new ArrayList<@A @DA T>();
+    }
+}
+
+/** local variable generic/array */
+class T0x09<T> {
+    void g() {
+        List<@A @DA String> l = null;
+    }
+
+    void a() {
+        String @A @DA [] as = null;
+    }
+}
+
+/** type argument in constructor call generic/array */
+class T0x19 {
+    <T> T0x19() {}
+
+    void g() {
+       new <List<@A @DA String>> T0x19();
+    }
+}
+
+/** type argument in method call generic/array */
+class T0x1B<T> {
+    void m0x1B() {
+        Collections.<T @A @DA []>emptyList();
+    }
+}
+
+/** type argument in constructor call */
+class T0x18<T> {
+    <T> T0x18() {}
+
+    void m() {
+        new <@A @DA Integer> T0x18();
+    }
+}
+
+/** type argument in method call */
+class T0x1A<T,U> {
+    public static <T, U> T m() { return null; }
+    static void m0x1A() {
+        T0x1A.<@A @DA Integer, @A @DA Short>m();
+    }
+}
+
+/** class extends/implements */
+class T0x14 extends @A @DA Thread implements @A @DA Serializable, @A @DA Cloneable {
+}
+
+/** exception type in throws */
+class T0x16 {
+    void m0x16() throws @A @DA Exception {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/apt/Basics/CheckAptIsRemovedTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,96 @@
+/*
+ * 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 4908512 5024825 4957203 4993280 4996963 6174696 6177059 7041249
+ * @summary Make sure apt is removed and doesn't come back
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main CheckAptIsRemovedTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+//original test: test/tools/apt/Basics/apt.sh
+public class CheckAptIsRemovedTest {
+    //I think this class can be let with the imports only and that should be enough for as test's purpose
+    private static final String NullAPFSrc =
+        "import com.sun.mirror.apt.*;\n" +
+        "import com.sun.mirror.declaration.*;\n" +
+        "import com.sun.mirror.type.*;\n" +
+        "import com.sun.mirror.util.*;\n" +
+        "import java.util.Collection;\n" +
+        "import java.util.Set;\n\n" +
+
+        "public class NullAPF implements AnnotationProcessorFactory {\n" +
+        "    static class NullAP implements AnnotationProcessor {\n" +
+        "        NullAP(AnnotationProcessorEnvironment ape) {}\n" +
+        "        public void process() {return;}\n" +
+        "    }\n\n" +
+
+        "    static Collection<String> supportedTypes;\n\n" +
+        "    static {\n" +
+        "        String types[] = {\"*\"};\n" +
+        "        supportedTypes = java.util.Arrays.asList(types);\n" +
+        "    }\n\n" +
+
+        "    public Collection<String> supportedOptions() {\n" +
+        "        return java.util.Collections.emptySet();\n" +
+        "    }\n\n" +
+
+        "    public Collection<String> supportedAnnotationTypes() {\n" +
+        "        return supportedTypes;\n" +
+        "    }\n\n" +
+
+        "    public AnnotationProcessor getProcessorFor(" +
+        "        Set<AnnotationTypeDeclaration> atds,\n" +
+        "        AnnotationProcessorEnvironment env) {\n" +
+        "        return new NullAP(env);\n" +
+        "    }\n" +
+        "}";
+
+    public static void main(String[] args) throws Exception {
+        String testJDK = System.getProperty("test.jdk");
+        Path aptLin = Paths.get(testJDK, "bin", "apt");
+        Path aptWin = Paths.get(testJDK, "bin", "apt.exe");
+
+//        if [ -f "${TESTJAVA}/bin/apt" -o -f "${TESTJAVA}/bin/apt.exe" ];then
+        if (Files.exists(aptLin) || Files.exists(aptWin)) {
+            throw new AssertionError("apt executable should not exist");
+        }
+
+//        JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
+//        $JAVAC ${TESTSRC}/NullAPF.java
+        Path classpath = Paths.get(testJDK, "lib", "tools.jar");
+        ToolBox.JavaToolArgs javacArgs =
+                new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
+                .setOptions("-source", "1.5", "-sourcepath", ".",
+                    "-classpath", classpath.toString())
+                .setSources(NullAPFSrc);
+        ToolBox.javac(javacArgs);
+    }
+
+}
--- a/test/tools/apt/Basics/NullAPF.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2004, 2007, 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.mirror.apt.*;
-import com.sun.mirror.declaration.*;
-import com.sun.mirror.type.*;
-import com.sun.mirror.util.*;
-
-import java.util.Collection;
-import java.util.Set;
-
-public class NullAPF implements AnnotationProcessorFactory {
-    static class NullAP implements AnnotationProcessor {
-        NullAP(AnnotationProcessorEnvironment ape) {
-        }
-
-        public void process() {
-            return;
-        }
-    }
-
-    static Collection<String> supportedTypes;
-
-    static {
-        String types[] = {"*"};
-        supportedTypes = java.util.Arrays.asList(types);
-    }
-
-    /*
-     * Processor doesn't examine any options.
-     */
-    public Collection<String> supportedOptions() {
-        return java.util.Collections.emptySet();
-    }
-
-    /*
-     * All annotation types are supported.
-     */
-    public Collection<String> supportedAnnotationTypes() {
-        return supportedTypes;
-    }
-
-    /*
-     * Return the same processor independent of what annotations are
-     * present, if any.
-     */
-    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
-                                        AnnotationProcessorEnvironment env) {
-        return new NullAP(env);
-    }
-}
--- a/test/tools/apt/Basics/apt.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 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 4908512 5024825 4957203 4993280 4996963 6174696 6177059 7041249
-# @run shell ../verifyVariables.sh
-# @run shell apt.sh
-# @summary Make sure apt is removed and doesn't come back
-# @author Joseph D. Darcy
-
-OS=`uname -s`;
-case "${OS}" in
-        CYGWIN* )
-                DIFFOPTS="--strip-trailing-cr"
-        ;;
-
-	* )
-	;;
-esac
-
-# Verify apt executable does not exist
-if [ -f "${TESTJAVA}/bin/apt" -o -f "${TESTJAVA}/bin/apt.exe" ];then
-    echo "apt executable should not exist."
-    exit 1
-fi
-
-# Construct path to javac executable
-JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
-
-$JAVAC ${TESTSRC}/NullAPF.java
-RESULT=$?
-
-case "${RESULT}" in
-        0  )
-        echo "Compilation of apt-using source passed improperly."
-        exit 1
-	;;
-
-        * )
-	;;
-esac
--- a/test/tools/apt/verifyVariables.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 1999, 2002, 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.
-#
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/AnchorTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,93 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8004832
+ * @summary Add new doclint package
+ * @build DocLintTester
+ * @run main DocLintTester -ref AnchorTest.out AnchorTest.java
+ */
+
+/** */
+public class AnchorTest {
+    // tests for <a name=value>
+
+    /**
+     * <a name=foo></a>
+     */
+    public void a_name_foo() { }
+
+    /**
+     * <a name=foo></a>
+     */
+    public void a_name_already_defined() { }
+
+    /**
+     * <a name=></a>
+     */
+    public void a_name_empty() { }
+
+    /**
+     * <a name=123 ></a>
+     */
+    public void a_name_invalid() { }
+
+    /**
+     * <a name ></a>
+     */
+    public void a_name_missing() { }
+
+    // tests for <a id=value>
+
+    /**
+     * <a id=a_id_foo></a>
+     */
+    public void a_id_foo() { }
+
+    /**
+     * <a id=foo></a>
+     */
+    public void a_id_already_defined() { }
+
+    /**
+     * <a id=></a>
+     */
+    public void a_id_empty() { }
+
+    /**
+     * <a id=123 ></a>
+     */
+    public void a_id_invalid() { }
+
+    /**
+     * <a id ></a>
+     */
+    public void a_id_missing() { }
+
+    // tests for id=value on non-<a> tags
+
+    /**
+     * <p id=p_id_foo>text</p>
+     */
+    public void p_id_foo() { }
+
+    /**
+     * <p id=foo>text</p>
+     */
+    public void p_id_already_defined() { }
+
+    /**
+     * <p id=>text</p>
+     */
+    public void p_id_empty() { }
+
+    /**
+     * <p id=123 >text</p>
+     */
+    public void p_id_invalid() { }
+
+    /**
+     * <p id >text</p>
+     */
+    public void p_id_missing() { }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/AnchorTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+AnchorTest.java:19: error: anchor already defined: foo
+     * <a name=foo></a>
+          ^
+AnchorTest.java:24: error: invalid name for anchor: ""
+     * <a name=></a>
+          ^
+AnchorTest.java:29: error: invalid name for anchor: "123"
+     * <a name=123 ></a>
+          ^
+AnchorTest.java:34: error: no value given for anchor
+     * <a name ></a>
+          ^
+AnchorTest.java:46: error: anchor already defined: foo
+     * <a id=foo></a>
+          ^
+AnchorTest.java:51: error: invalid name for anchor: ""
+     * <a id=></a>
+          ^
+AnchorTest.java:56: error: invalid name for anchor: "123"
+     * <a id=123 ></a>
+          ^
+AnchorTest.java:61: error: no value given for anchor
+     * <a id ></a>
+          ^
+AnchorTest.java:73: error: anchor already defined: foo
+     * <p id=foo>text</p>
+          ^
+AnchorTest.java:78: error: invalid name for anchor: ""
+     * <p id=>text</p>
+          ^
+AnchorTest.java:83: error: invalid name for anchor: "123"
+     * <p id=123 >text</p>
+          ^
+AnchorTest.java:88: error: no value given for anchor
+     * <p id >text</p>
+          ^
+12 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/CoverageExtras.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,71 @@
+/*
+ * 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 8006263
+ * @summary Supplementary test cases needed for doclint
+ */
+
+import com.sun.tools.doclint.Checker;
+import com.sun.tools.doclint.Entity;
+import com.sun.tools.doclint.HtmlTag;
+import com.sun.tools.doclint.Messages;
+import java.util.Objects;
+
+public class CoverageExtras {
+    public static void main(String... args) {
+        new CoverageExtras().run();
+    }
+
+    void run() {
+        check(HtmlTag.A, HtmlTag.valueOf("A"), HtmlTag.values());
+        check(HtmlTag.Attr.ABBR, HtmlTag.Attr.valueOf("ABBR"), HtmlTag.Attr.values());
+        check(HtmlTag.AttrKind.INVALID, HtmlTag.AttrKind.valueOf("INVALID"), HtmlTag.AttrKind.values());
+        check(HtmlTag.BlockType.BLOCK, HtmlTag.BlockType.valueOf("BLOCK"), HtmlTag.BlockType.values());
+        check(HtmlTag.EndKind.NONE, HtmlTag.EndKind.valueOf("NONE"), HtmlTag.EndKind.values());
+        check(HtmlTag.Flag.EXPECT_CONTENT, HtmlTag.Flag.valueOf("EXPECT_CONTENT"), HtmlTag.Flag.values());
+
+        check(Checker.Flag.TABLE_HAS_CAPTION, Checker.Flag.valueOf("TABLE_HAS_CAPTION"), Checker.Flag.values());
+
+        check(Entity.nbsp, Entity.valueOf("nbsp"), Entity.values());
+
+        check(Messages.Group.ACCESSIBILITY, Messages.Group.valueOf("ACCESSIBILITY"), Messages.Group.values());
+    }
+
+    <T extends Enum<T>> void check(T expect, T value, T[] values) {
+        if (!Objects.equals(expect, value)) {
+            error("Mismatch: '" + expect + "', '" + value + "'");
+        }
+        if (!Objects.equals(expect, values[0])) {
+            error("Mismatch: '" + expect + "', '" + values[0] + "'");
+        }
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- a/test/tools/doclint/DocLintTester.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/doclint/DocLintTester.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -26,6 +26,7 @@
 import java.util.List;
 
 import com.sun.tools.doclint.DocLint;
+import com.sun.tools.doclint.DocLint.BadArgs;
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
@@ -45,6 +46,7 @@
     public void run(String... args) throws Exception {
         String testSrc = System.getProperty("test.src");
 
+        boolean badArgs = false;
         File refFile = null;
         List<String> opts = new ArrayList<String>();
         List<File> files = new ArrayList<File>();
@@ -52,19 +54,25 @@
             String arg = args[i];
             if (arg.equals("-ref")) {
                 refFile = new File(testSrc, args[++i]);
+            } else if (arg.equals("-badargs")) {
+                badArgs = true;
             } else if (arg.startsWith("-Xmsgs")) {
                 opts.add(arg);
+            } else if (arg.startsWith("-")) {
+                opts.add(arg);
+                if (i < args.length - 1 && !args[i+1].startsWith("-"))
+                    opts.add(args[++i]);
             } else
                 files.add(new File(testSrc, arg));
         }
 
-        check(opts, files, refFile);
+        check(opts, files, badArgs, refFile);
 
         if (errors > 0)
             throw new Exception(errors + " errors occurred");
     }
 
-    void check(List<String> opts, List<File> files, File refFile) throws Exception {
+    void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception {
         List<String> args = new ArrayList<String>();
         args.addAll(opts);
         for (File file: files)
@@ -72,7 +80,14 @@
 
         StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
-        new DocLint().run(pw, args.toArray(new String[args.size()]));
+        try {
+            new DocLint().run(pw, args.toArray(new String[args.size()]));
+            if (expectBadArgs)
+                error("expected exception not thrown");
+        } catch (BadArgs e) {
+            if (!expectBadArgs)
+                error("unexpected exception caught: " + e);
+        }
         pw.flush();
         String out = normalizeNewlines(removeFileNames(sw.toString())).trim();
         if (out != null)
@@ -107,7 +122,7 @@
 
     private static final Pattern dirFileLine = Pattern.compile(
             "(?m)"                          // multi-line mode
-            + "^([^: ]+?)"                  // directory part of file name
+            + "^(.*?)"                      // directory part of file name
             + "([A-Za-z0-9.]+:[0-9]+:)");   // file name and line number
 
     String removeFileNames(String s) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/EmptyPreTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * 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
+ * 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 8010317
+ * @summary DocLint incorrectly reports some <pre> tags as empty
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs:html EmptyPreTest.java
+ */
+
+public class EmptyPreTest {
+    /** <pre> {@code xyzzy} </pre> */
+    public void m1() { }
+
+    /** <pre> {@docRoot} </pre> */
+    public void m2() { }
+
+    /** <pre> {@link java.lang.String} </pre> */
+    public void m3() { }
+
+    /** <pre> {@value} </pre> */
+    public static final int v1 = 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/EndTagsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006236
+ * @summary doclint: structural issue hidden
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs:-html EndTagsTest.java
+ * @run main DocLintTester -ref EndTagsTest.out EndTagsTest.java
+ */
+
+/** */
+public class EndTagsTest {
+    /** <p>  <a name="a1"> text <img alt="image" src="image.png"> </a> </p> */
+    public void valid_all() { }
+
+    /** <p>  <a name="a2"> text <img alt="image" src="image.png"> </a> */
+    public void valid_omit_optional_close() { }
+
+    /** </a> */
+    public void invalid_missing_start() { }
+
+    /** <p> </a> */
+    public void invalid_missing_start_2() { }
+
+    /** <p> text </p> </a> */
+    public void invalid_missing_start_3() { }
+
+    /** <img alt="image" src="image.png"> </img> */
+    public void invalid_end() { }
+
+    /** <invalid> </invalid> */
+    public void unknown_start_end() { }
+
+    /** <invalid> */
+    public void unknown_start() { }
+
+    /** </invalid> */
+    public void unknown_end() { }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/EndTagsTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,25 @@
+EndTagsTest.java:18: error: unexpected end tag: </a>
+    /** </a> */
+        ^
+EndTagsTest.java:21: error: unexpected end tag: </a>
+    /** <p> </a> */
+            ^
+EndTagsTest.java:24: error: unexpected end tag: </a>
+    /** <p> text </p> </a> */
+                      ^
+EndTagsTest.java:27: error: invalid end tag: </img>
+    /** <img alt="image" src="image.png"> </img> */
+                                          ^
+EndTagsTest.java:30: error: unknown tag: invalid
+    /** <invalid> </invalid> */
+        ^
+EndTagsTest.java:30: error: unknown tag: invalid
+    /** <invalid> </invalid> */
+                  ^
+EndTagsTest.java:33: error: unknown tag: invalid
+    /** <invalid> */
+        ^
+EndTagsTest.java:36: error: unknown tag: invalid
+    /** </invalid> */
+        ^
+8 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/EndWithIdentifierTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8007096
+ * @summary DocLint parsing problems with some comments
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs:-html EndWithIdentifierTest.java
+ * @run main DocLintTester -Xmsgs -ref EndWithIdentifierTest.out EndWithIdentifierTest.java
+ * @author jlahoda
+ */
+
+/**@deprecated*/
+public class EndWithIdentifierTest {
+
+    /**{@link*/
+    private void unfinishedInlineTagName() {}
+
+    /**@see List*/
+    private void endsWithIdentifier() {}
+
+    /**&amp*/
+    private void entityName() {}
+
+    /**<a*/
+    private void tag() {}
+
+    /**</a*/
+    private void tagEnd() {}
+
+    /**<a name*/
+    private void attribute() {}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/EndWithIdentifierTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,20 @@
+EndWithIdentifierTest.java:14: error: syntax error in reference
+    /**{@link*/
+       ^
+EndWithIdentifierTest.java:17: error: reference not found
+    /**@see List*/
+            ^
+EndWithIdentifierTest.java:20: error: semicolon missing
+    /**&amp*/
+       ^
+EndWithIdentifierTest.java:23: error: malformed HTML
+    /**<a*/
+       ^
+EndWithIdentifierTest.java:26: error: malformed HTML
+    /**</a*/
+       ^
+EndWithIdentifierTest.java:29: error: malformed HTML
+    /**<a name*/
+       ^
+6 errors
+
--- a/test/tools/doclint/HtmlTagsTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/doclint/HtmlTagsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -54,5 +54,17 @@
      * <i> </b> </i>
      */
     public void end_unexpected() { }
+
+    /**
+     * <ul> text <li> ... </li> </ul>
+     */
+    public void text_not_allowed() { }
+
+    /**
+     * <ul> <b>text</b> <li> ... </li> </ul>
+     */
+    public void inline_not_allowed() { }
+
+
 }
 
--- a/test/tools/doclint/HtmlTagsTest.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/doclint/HtmlTagsTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -34,5 +34,11 @@
 HtmlTagsTest.java:54: warning: empty <i> tag
      * <i> </b> </i>
                 ^
-11 errors
+HtmlTagsTest.java:59: error: text not allowed in <ul> element
+     * <ul> text <li> ... </li> </ul>
+           ^
+HtmlTagsTest.java:64: error: tag not allowed here: <b>
+     * <ul> <b>text</b> <li> ... </li> </ul>
+            ^
+13 errors
 1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/LiteralTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006228
+ * @summary Doclint doesn't detect <code> {@code nested inline} </code>
+ * @build DocLintTester
+ * @run main DocLintTester -ref LiteralTest.out LiteralTest.java
+ */
+
+/** */
+public class LiteralTest {
+    /** <code> abc {@literal < & > } def </code> */
+    public void ok_literal_in_code() { }
+
+    /** <code> abc {@code < & > } def </code> */
+    public void bad_code_in_code() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/LiteralTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,4 @@
+LiteralTest.java:14: warning: {@code} within <code>
+    /** <code> abc {@code < & > } def </code> */
+                   ^
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/ParaTagTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 8007566
+ * @summary DocLint too aggressive with not allowed here: <p>
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs ParaTagTest.java
+ */
+
+/**
+ * First line.
+ * <p> Para c1.</p>
+ * <p> Para c2.
+ * <p> Para c3.</p>
+ */
+public class ParaTagTest {
+    /**
+     * m1 <code>code </code>.
+     * <p> Para m1.
+     * <p> Para m2.
+     */
+    public void m() {}
+
+    /**
+     * m2.
+     * <p> Para z1.
+     * <p> Para z2.
+     * <pre>
+     *    Preformat 1.
+     * </pre>
+     */
+    public void z() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/UnfinishedInlineTagTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8007096
+ * @summary DocLint parsing problems with some comments
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs:-html UnfinishedInlineTagTest.java
+ * @run main DocLintTester -Xmsgs -ref UnfinishedInlineTagTest.out UnfinishedInlineTagTest.java
+ * @author jlahoda
+ */
+
+import java.util.List;
+
+/**{@link List
+ */
+public class UnfinishedInlineTagTest {
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/UnfinishedInlineTagTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,5 @@
+UnfinishedInlineTagTest.java:14: error: unterminated inline tag
+ */
+^
+1 error
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/AAA.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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 8006728
+ * @summary temporarily workaround jtreg problems for doclint tests in othervm
+ */
+
+// dummy test/class to be compiled before other tests in this directory
+// see JDK-8006730
+public class AAA {
+    public static void main(String... args) { }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/BlockTagsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 8006251
+ * @summary test block tags
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs BlockTagsTest.java
+ */
+
+/** */
+public class BlockTagsTest {
+    /**
+     *  <blockquote> abc </blockquote>
+     *  <center> abc </center>
+     *  <div> abc </div>
+     *  <dl> <dt> abc <dd> def </dl>
+     *  <div> abc </div>
+     *  <h1> abc </h1>
+     *  <h2> abc </h2>
+     *  <h3> abc </h3>
+     *  <h4> abc </h4>
+     *  <h5> abc </h5>
+     *  <h6> abc </h6>
+     *  <hr>
+     *  <menu> <li> abc </menu>
+     *  <noscript> </noscript>
+     *  <ol> <li> abc </ol>
+     *  <p> abc </p>
+     *  <pre> abc </pre>
+     *  <table summary="abc"> <tr> <td> </table>
+     *  <ul> <li> abc </ul>
+     */
+    public void supportedTags() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/EntitiesTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,317 @@
+/*
+ * 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 8006263
+ * @summary Supplementary test cases needed for doclint
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs:-html EntitiesTest.java
+ * @run main DocLintTester -Xmsgs:html -ref EntitiesTest.out EntitiesTest.java
+ */
+
+/** */
+class EntitiesTest {
+
+    /**
+     * &#32;  &#x20;
+     * &#2126; &#x84e; &#x84E;
+     */
+    void range_test() { }
+
+    /**
+    * &nbsp; &#160;
+    * &iexcl; &#161;
+    * &cent; &#162;
+    * &pound; &#163;
+    * &curren; &#164;
+    * &yen; &#165;
+    * &brvbar; &#166;
+    * &sect; &#167;
+    * &uml; &#168;
+    * &copy; &#169;
+    * &ordf; &#170;
+    * &laquo; &#171;
+    * &not; &#172;
+    * &shy; &#173;
+    * &reg; &#174;
+    * &macr; &#175;
+    * &deg; &#176;
+    * &plusmn; &#177;
+    * &sup2; &#178;
+    * &sup3; &#179;
+    * &acute; &#180;
+    * &micro; &#181;
+    * &para; &#182;
+    * &middot; &#183;
+    * &cedil; &#184;
+    * &sup1; &#185;
+    * &ordm; &#186;
+    * &raquo; &#187;
+    * &frac14; &#188;
+    * &frac12; &#189;
+    * &frac34; &#190;
+    * &iquest; &#191;
+    * &Agrave; &#192;
+    * &Aacute; &#193;
+    * &Acirc; &#194;
+    * &Atilde; &#195;
+    * &Auml; &#196;
+    * &Aring; &#197;
+    * &AElig; &#198;
+    * &Ccedil; &#199;
+    * &Egrave; &#200;
+    * &Eacute; &#201;
+    * &Ecirc; &#202;
+    * &Euml; &#203;
+    * &Igrave; &#204;
+    * &Iacute; &#205;
+    * &Icirc; &#206;
+    * &Iuml; &#207;
+    * &ETH; &#208;
+    * &Ntilde; &#209;
+    * &Ograve; &#210;
+    * &Oacute; &#211;
+    * &Ocirc; &#212;
+    * &Otilde; &#213;
+    * &Ouml; &#214;
+    * &times; &#215;
+    * &Oslash; &#216;
+    * &Ugrave; &#217;
+    * &Uacute; &#218;
+    * &Ucirc; &#219;
+    * &Uuml; &#220;
+    * &Yacute; &#221;
+    * &THORN; &#222;
+    * &szlig; &#223;
+    * &agrave; &#224;
+    * &aacute; &#225;
+    * &acirc; &#226;
+    * &atilde; &#227;
+    * &auml; &#228;
+    * &aring; &#229;
+    * &aelig; &#230;
+    * &ccedil; &#231;
+    * &egrave; &#232;
+    * &eacute; &#233;
+    * &ecirc; &#234;
+    * &euml; &#235;
+    * &igrave; &#236;
+    * &iacute; &#237;
+    * &icirc; &#238;
+    * &iuml; &#239;
+    * &eth; &#240;
+    * &ntilde; &#241;
+    * &ograve; &#242;
+    * &oacute; &#243;
+    * &ocirc; &#244;
+    * &otilde; &#245;
+    * &ouml; &#246;
+    * &divide; &#247;
+    * &oslash; &#248;
+    * &ugrave; &#249;
+    * &uacute; &#250;
+    * &ucirc; &#251;
+    * &uuml; &#252;
+    * &yacute; &#253;
+    * &thorn; &#254;
+    * &yuml; &#255;
+    * &fnof; &#402;
+    * &Alpha; &#913;
+    * &Beta; &#914;
+    * &Gamma; &#915;
+    * &Delta; &#916;
+    * &Epsilon; &#917;
+    * &Zeta; &#918;
+    * &Eta; &#919;
+    * &Theta; &#920;
+    * &Iota; &#921;
+    * &Kappa; &#922;
+    * &Lambda; &#923;
+    * &Mu; &#924;
+    * &Nu; &#925;
+    * &Xi; &#926;
+    * &Omicron; &#927;
+    * &Pi; &#928;
+    * &Rho; &#929;
+    * &Sigma; &#931;
+    * &Tau; &#932;
+    * &Upsilon; &#933;
+    * &Phi; &#934;
+    * &Chi; &#935;
+    * &Psi; &#936;
+    * &Omega; &#937;
+    * &alpha; &#945;
+    * &beta; &#946;
+    * &gamma; &#947;
+    * &delta; &#948;
+    * &epsilon; &#949;
+    * &zeta; &#950;
+    * &eta; &#951;
+    * &theta; &#952;
+    * &iota; &#953;
+    * &kappa; &#954;
+    * &lambda; &#955;
+    * &mu; &#956;
+    * &nu; &#957;
+    * &xi; &#958;
+    * &omicron; &#959;
+    * &pi; &#960;
+    * &rho; &#961;
+    * &sigmaf; &#962;
+    * &sigma; &#963;
+    * &tau; &#964;
+    * &upsilon; &#965;
+    * &phi; &#966;
+    * &chi; &#967;
+    * &psi; &#968;
+    * &omega; &#969;
+    * &thetasym; &#977;
+    * &upsih; &#978;
+    * &piv; &#982;
+    * &bull; &#8226;
+    * &hellip; &#8230;
+    * &prime; &#8242;
+    * &Prime; &#8243;
+    * &oline; &#8254;
+    * &frasl; &#8260;
+    * &weierp; &#8472;
+    * &image; &#8465;
+    * &real; &#8476;
+    * &trade; &#8482;
+    * &alefsym; &#8501;
+    * &larr; &#8592;
+    * &uarr; &#8593;
+    * &rarr; &#8594;
+    * &darr; &#8595;
+    * &harr; &#8596;
+    * &crarr; &#8629;
+    * &lArr; &#8656;
+    * &uArr; &#8657;
+    * &rArr; &#8658;
+    * &dArr; &#8659;
+    * &hArr; &#8660;
+    * &forall; &#8704;
+    * &part; &#8706;
+    * &exist; &#8707;
+    * &empty; &#8709;
+    * &nabla; &#8711;
+    * &isin; &#8712;
+    * &notin; &#8713;
+    * &ni; &#8715;
+    * &prod; &#8719;
+    * &sum; &#8721;
+    * &minus; &#8722;
+    * &lowast; &#8727;
+    * &radic; &#8730;
+    * &prop; &#8733;
+    * &infin; &#8734;
+    * &ang; &#8736;
+    * &and; &#8743;
+    * &or; &#8744;
+    * &cap; &#8745;
+    * &cup; &#8746;
+    * &_int; &#8747;
+    * &there4; &#8756;
+    * &sim; &#8764;
+    * &cong; &#8773;
+    * &asymp; &#8776;
+    * &ne; &#8800;
+    * &equiv; &#8801;
+    * &le; &#8804;
+    * &ge; &#8805;
+    * &sub; &#8834;
+    * &sup; &#8835;
+    * &nsub; &#8836;
+    * &sube; &#8838;
+    * &supe; &#8839;
+    * &oplus; &#8853;
+    * &otimes; &#8855;
+    * &perp; &#8869;
+    * &sdot; &#8901;
+    * &lceil; &#8968;
+    * &rceil; &#8969;
+    * &lfloor; &#8970;
+    * &rfloor; &#8971;
+    * &lang; &#9001;
+    * &rang; &#9002;
+    * &loz; &#9674;
+    * &spades; &#9824;
+    * &clubs; &#9827;
+    * &hearts; &#9829;
+    * &diams; &#9830;
+    * &quot; &#34;
+    * &amp; &#38;
+    * &lt; &#60;
+    * &gt; &#62;
+    * &OElig; &#338;
+    * &oelig; &#339;
+    * &Scaron; &#352;
+    * &scaron; &#353;
+    * &Yuml; &#376;
+    * &circ; &#710;
+    * &tilde; &#732;
+    * &ensp; &#8194;
+    * &emsp; &#8195;
+    * &thinsp; &#8201;
+    * &zwnj; &#8204;
+    * &zwj; &#8205;
+    * &lrm; &#8206;
+    * &rlm; &#8207;
+    * &ndash; &#8211;
+    * &mdash; &#8212;
+    * &lsquo; &#8216;
+    * &rsquo; &#8217;
+    * &sbquo; &#8218;
+    * &ldquo; &#8220;
+    * &rdquo; &#8221;
+    * &bdquo; &#8222;
+    * &dagger; &#8224;
+    * &Dagger; &#8225;
+    * &permil; &#8240;
+    * &lsaquo; &#8249;
+    * &rsaquo; &#8250;
+    * &euro; &#8364;
+    */
+    void symbolic_entities() { }
+
+    /**
+     * &bad;
+     */
+    void bad_name() { }
+
+    /**
+     * &#31;
+     * &#2127;
+     */
+    void out_of_range() { }
+
+    /**
+     * &#8213;
+     * &#9003;
+     * &#xffff;
+     */
+    void sparse_negative() { }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/EntitiesTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,19 @@
+EntitiesTest.java:300: error: invalid entity &bad;
+     * &bad;
+       ^
+EntitiesTest.java:305: error: invalid entity &#31;
+     * &#31;
+       ^
+EntitiesTest.java:306: error: invalid entity &#2127;
+     * &#2127;
+       ^
+EntitiesTest.java:311: error: invalid entity &#8213;
+     * &#8213;
+       ^
+EntitiesTest.java:312: error: invalid entity &#9003;
+     * &#9003;
+       ^
+EntitiesTest.java:313: error: invalid entity &#xffff;
+     * &#xffff;
+       ^
+6 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/InlineTagsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 8006251
+ * @summary test inline tags
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs InlineTagsTest.java
+ */
+
+/** */
+public class InlineTagsTest {
+    /**
+     *  <a href="#abc"> abc </a>
+     *  <b> abc </b>
+     *  <big> abc </big>
+     *  <br>
+     *  <cite> abc </cite>
+     *  <code> abc </code>
+     *  <em> abc </em>
+     *  <font> abc </font>
+     *  <i> abc </i>
+     *  <img alt="image" src="image.png">
+     *  <small> abc </small>
+     *  <span> abc </span>
+     *  <strong> abc </strong>
+     *  <sub> abc </sub>
+     *  <sup> abc </sup>
+     *  <tt> abc </tt>
+     *  <u> abc </u>
+     *  <var> abc </var>
+     */
+    public void supportedTags() { }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/ListTagsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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 8006251
+ * @summary test list tags
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs ListTagsTest.java
+ */
+
+/** */
+public class ListTagsTest {
+    /**
+     *  <dl> <dt> abc <dd> def </dl>
+     *  <ol> <li> abc </ol>
+     *  <ul> <li> abc </ul>
+     */
+    public void supportedTags() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/OtherTagsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,24 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006251
+ * @summary test other tags
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs -ref OtherTagsTest.out OtherTagsTest.java
+ */
+
+/** */
+public class OtherTagsTest {
+    /**
+     *  <body> <p> abc </body>
+     *  <frame>
+     *  <frameset> </frameset>
+     *  <head> </head>
+     *  <link>
+     *  <meta>
+     *  <noframes> </noframes>
+     *  <script> </script>
+     *  <title> </title>
+     */
+    public void knownInvalidTags() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/OtherTagsTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+OtherTagsTest.java:13: error: element not allowed in documentation comments: <body>
+     *  <body> <p> abc </body>
+        ^
+OtherTagsTest.java:14: error: element not allowed in documentation comments: <frame>
+     *  <frame>
+        ^
+OtherTagsTest.java:15: error: element not allowed in documentation comments: <frameset>
+     *  <frameset> </frameset>
+        ^
+OtherTagsTest.java:16: error: element not allowed in documentation comments: <head>
+     *  <head> </head>
+        ^
+OtherTagsTest.java:17: error: element not allowed in documentation comments: <link>
+     *  <link>
+        ^
+OtherTagsTest.java:18: error: element not allowed in documentation comments: <meta>
+     *  <meta>
+        ^
+OtherTagsTest.java:19: error: element not allowed in documentation comments: <noframes>
+     *  <noframes> </noframes>
+        ^
+OtherTagsTest.java:20: error: element not allowed in documentation comments: <script>
+     *  <script> </script>
+        ^
+OtherTagsTest.java:21: error: element not allowed in documentation comments: <title>
+     *  <title> </title>
+        ^
+9 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/TableTagsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * 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 8006251
+ * @summary test table tags
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -Xmsgs TableTagsTest.java
+ */
+
+/** */
+public class TableTagsTest {
+    /**
+     *  <table summary="abc"> <tr> <td> </table>
+     *  <table summary="abc"> <tr> <th> </table>
+     *  <table> <caption> abc </caption> <tr> <td> </table>
+     *  <table summary="abc"> <thead> <tr> </thead> <tr> <td> </table>
+     *  <table summary="abc"> <tbody> <tr> <td> </tbody> </table>
+     *  <table summary="abc"> <tr> <td> <tfoot> <tr> </tfoot></table>
+     */
+    public void supportedTags() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/TagNotAllowed.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,30 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8004832
+ * @summary Add new doclint package
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -ref TagNotAllowed.out TagNotAllowed.java
+ */
+
+/**
+ * <dl> <b>abc</b> <dt> term </dt> <b>def</b> <dd> description </dd> <b>ghi</b> </dl>
+ * <ol> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ol>
+ * <ul> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ul>
+ *
+ * <table summary=description> <b>abc</b> </table>
+ * <table summary=description> <thead> <b>abc</b> </thead> </table>
+ * <table summary=description> <tbody> <b>abc</b> </tbody> </table>
+ * <table summary=description> <tfoot> <b>abc</b> </tfoot> </table>
+ * <table summary=description> <tr> <b>abc</b> </tr> </table>
+ *
+ * <pre>
+ *   <img alt="image" src="image.png">
+ *   <p> para </p>
+ *   <big> text </big>
+ *   <small> text </small>
+ *   <sub> text </sub>
+ *   <sup> text </sup>
+ * </pre>
+ */
+public class TagNotAllowed { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/TagNotAllowed.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,61 @@
+TagNotAllowed.java:11: error: tag not allowed here: <b>
+ * <dl> <b>abc</b> <dt> term </dt> <b>def</b> <dd> description </dd> <b>ghi</b> </dl>
+        ^
+TagNotAllowed.java:11: error: tag not allowed here: <b>
+ * <dl> <b>abc</b> <dt> term </dt> <b>def</b> <dd> description </dd> <b>ghi</b> </dl>
+                                   ^
+TagNotAllowed.java:11: error: tag not allowed here: <b>
+ * <dl> <b>abc</b> <dt> term </dt> <b>def</b> <dd> description </dd> <b>ghi</b> </dl>
+                                                                     ^
+TagNotAllowed.java:12: error: tag not allowed here: <b>
+ * <ol> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ol>
+        ^
+TagNotAllowed.java:12: error: tag not allowed here: <b>
+ * <ol> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ol>
+                                   ^
+TagNotAllowed.java:12: error: tag not allowed here: <b>
+ * <ol> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ol>
+                                                              ^
+TagNotAllowed.java:13: error: tag not allowed here: <b>
+ * <ul> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ul>
+        ^
+TagNotAllowed.java:13: error: tag not allowed here: <b>
+ * <ul> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ul>
+                                   ^
+TagNotAllowed.java:13: error: tag not allowed here: <b>
+ * <ul> <b>abc</b> <li> item </li> <b>def</b> <li> item </li> <b>ghi</b> </ul>
+                                                              ^
+TagNotAllowed.java:15: error: tag not allowed here: <b>
+ * <table summary=description> <b>abc</b> </table>
+                               ^
+TagNotAllowed.java:16: error: tag not allowed here: <b>
+ * <table summary=description> <thead> <b>abc</b> </thead> </table>
+                                       ^
+TagNotAllowed.java:17: error: tag not allowed here: <b>
+ * <table summary=description> <tbody> <b>abc</b> </tbody> </table>
+                                       ^
+TagNotAllowed.java:18: error: tag not allowed here: <b>
+ * <table summary=description> <tfoot> <b>abc</b> </tfoot> </table>
+                                       ^
+TagNotAllowed.java:19: error: tag not allowed here: <b>
+ * <table summary=description> <tr> <b>abc</b> </tr> </table>
+                                    ^
+TagNotAllowed.java:22: error: tag not allowed here: <img>
+ *   <img alt="image" src="image.png">
+     ^
+TagNotAllowed.java:23: error: tag not allowed here: <p>
+ *   <p> para </p>
+     ^
+TagNotAllowed.java:24: error: tag not allowed here: <big>
+ *   <big> text </big>
+     ^
+TagNotAllowed.java:25: error: tag not allowed here: <small>
+ *   <small> text </small>
+     ^
+TagNotAllowed.java:26: error: tag not allowed here: <sub>
+ *   <sub> text </sub>
+     ^
+TagNotAllowed.java:27: error: tag not allowed here: <sup>
+ *   <sup> text </sup>
+     ^
+20 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/TextNotAllowed.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8004832
+ * @summary Add new doclint package
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -ref TextNotAllowed.out TextNotAllowed.java
+ */
+
+/**
+ * <dl> abc <dt> term </dt> def <dd> description </dd> ghi </dl>
+ * <ol> abc <li> item </li> def <li> item </li> ghi </ol>
+ * <ul> abc <li> item </li> def <li> item </li> ghi </ul>
+ *
+ * <table summary=description> abc </table>
+ * <table summary=description> <thead> abc </thead> </table>
+ * <table summary=description> <tbody> abc </tbody> </table>
+ * <table summary=description> <tfoot> abc </tfoot> </table>
+ * <table summary=description> <tr> abc </tr> </table>
+ *
+ * <dl> &amp; <dt> term </dt> &lt; <dd> description </dd> &gt; </dl>
+ * <ol> &amp; <li> item </li> &lt; <li> item </li> &gt; </ol>
+ * <ul> &amp; <li> item </li> &lt; <li> item </li> &gt; </ul>
+ *
+ * <table summary=description> &amp; </table>
+ * <table summary=description> <thead> &amp; </thead> </table>
+ * <table summary=description> <tbody> &amp; </tbody> </table>
+ * <table summary=description> <tfoot> &amp; </tfoot> </table>
+ * <table summary=description> <tr> &amp; </tr> </table>
+ *
+ */
+public class TextNotAllowed { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/html/TextNotAllowed.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,85 @@
+TextNotAllowed.java:11: error: text not allowed in <dl> element
+ * <dl> abc <dt> term </dt> def <dd> description </dd> ghi </dl>
+       ^
+TextNotAllowed.java:11: error: text not allowed in <dl> element
+ * <dl> abc <dt> term </dt> def <dd> description </dd> ghi </dl>
+                           ^
+TextNotAllowed.java:11: error: text not allowed in <dl> element
+ * <dl> abc <dt> term </dt> def <dd> description </dd> ghi </dl>
+                                                      ^
+TextNotAllowed.java:12: error: text not allowed in <ol> element
+ * <ol> abc <li> item </li> def <li> item </li> ghi </ol>
+       ^
+TextNotAllowed.java:12: error: text not allowed in <ol> element
+ * <ol> abc <li> item </li> def <li> item </li> ghi </ol>
+                           ^
+TextNotAllowed.java:12: error: text not allowed in <ol> element
+ * <ol> abc <li> item </li> def <li> item </li> ghi </ol>
+                                               ^
+TextNotAllowed.java:13: error: text not allowed in <ul> element
+ * <ul> abc <li> item </li> def <li> item </li> ghi </ul>
+       ^
+TextNotAllowed.java:13: error: text not allowed in <ul> element
+ * <ul> abc <li> item </li> def <li> item </li> ghi </ul>
+                           ^
+TextNotAllowed.java:13: error: text not allowed in <ul> element
+ * <ul> abc <li> item </li> def <li> item </li> ghi </ul>
+                                               ^
+TextNotAllowed.java:15: error: text not allowed in <table> element
+ * <table summary=description> abc </table>
+                              ^
+TextNotAllowed.java:16: error: text not allowed in <thead> element
+ * <table summary=description> <thead> abc </thead> </table>
+                                      ^
+TextNotAllowed.java:17: error: text not allowed in <tbody> element
+ * <table summary=description> <tbody> abc </tbody> </table>
+                                      ^
+TextNotAllowed.java:18: error: text not allowed in <tfoot> element
+ * <table summary=description> <tfoot> abc </tfoot> </table>
+                                      ^
+TextNotAllowed.java:19: error: text not allowed in <tr> element
+ * <table summary=description> <tr> abc </tr> </table>
+                                   ^
+TextNotAllowed.java:21: error: text not allowed in <dl> element
+ * <dl> &amp; <dt> term </dt> &lt; <dd> description </dd> &gt; </dl>
+        ^
+TextNotAllowed.java:21: error: text not allowed in <dl> element
+ * <dl> &amp; <dt> term </dt> &lt; <dd> description </dd> &gt; </dl>
+                              ^
+TextNotAllowed.java:21: error: text not allowed in <dl> element
+ * <dl> &amp; <dt> term </dt> &lt; <dd> description </dd> &gt; </dl>
+                                                          ^
+TextNotAllowed.java:22: error: text not allowed in <ol> element
+ * <ol> &amp; <li> item </li> &lt; <li> item </li> &gt; </ol>
+        ^
+TextNotAllowed.java:22: error: text not allowed in <ol> element
+ * <ol> &amp; <li> item </li> &lt; <li> item </li> &gt; </ol>
+                              ^
+TextNotAllowed.java:22: error: text not allowed in <ol> element
+ * <ol> &amp; <li> item </li> &lt; <li> item </li> &gt; </ol>
+                                                   ^
+TextNotAllowed.java:23: error: text not allowed in <ul> element
+ * <ul> &amp; <li> item </li> &lt; <li> item </li> &gt; </ul>
+        ^
+TextNotAllowed.java:23: error: text not allowed in <ul> element
+ * <ul> &amp; <li> item </li> &lt; <li> item </li> &gt; </ul>
+                              ^
+TextNotAllowed.java:23: error: text not allowed in <ul> element
+ * <ul> &amp; <li> item </li> &lt; <li> item </li> &gt; </ul>
+                                                   ^
+TextNotAllowed.java:25: error: text not allowed in <table> element
+ * <table summary=description> &amp; </table>
+                               ^
+TextNotAllowed.java:26: error: text not allowed in <thead> element
+ * <table summary=description> <thead> &amp; </thead> </table>
+                                       ^
+TextNotAllowed.java:27: error: text not allowed in <tbody> element
+ * <table summary=description> <tbody> &amp; </tbody> </table>
+                                       ^
+TextNotAllowed.java:28: error: text not allowed in <tfoot> element
+ * <table summary=description> <tfoot> &amp; </tfoot> </table>
+                                       ^
+TextNotAllowed.java:29: error: text not allowed in <tr> element
+ * <table summary=description> <tr> &amp; </tr> </table>
+                                    ^
+28 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tidy/AAA.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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 8006728
+ * @summary temporarily workaround jtreg problems for doclint tests in othervm
+ */
+
+// dummy test/class to be compiled before other tests in this directory
+// see JDK-8006730
+public class AAA {
+    public static void main(String... args) { }
+}
+
--- a/test/tools/doclint/tidy/ParaInPre.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/doclint/tidy/ParaInPre.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,4 +1,4 @@
-ParaInPre.java:16: warning: unexpected use of <p> inside <pre> element
+ParaInPre.java:16: error: tag not allowed here: <p>
  *     <p>
        ^
-1 warning
+1 error
--- a/test/tools/doclint/tidy/TextNotAllowed.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/doclint/tidy/TextNotAllowed.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,19 +1,19 @@
 TextNotAllowed.java:13: error: text not allowed in <table> element
  * <table summary=description> abc </table>
-                                   ^
+                              ^
 TextNotAllowed.java:14: error: text not allowed in <tbody> element
  * <table summary=description> <tbody> abc </tbody> </table>
-                                           ^
+                                      ^
 TextNotAllowed.java:15: error: text not allowed in <tr> element
  * <table summary=description> <tr> abc </tr> </table>
-                                        ^
+                                   ^
 TextNotAllowed.java:17: error: text not allowed in <dl> element
  * <dl> abc </dl>
-            ^
+       ^
 TextNotAllowed.java:18: error: text not allowed in <ol> element
  * <ol> abc </ol>
-            ^
+       ^
 TextNotAllowed.java:19: error: text not allowed in <ul> element
  * <ul> abc </ul>
-            ^
+       ^
 6 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tool/AAA.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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 8006728
+ * @summary temporarily workaround jtreg problems for doclint tests in othervm
+ */
+
+// dummy test/class to be compiled before other tests in this directory
+// see JDK-8006730
+public class AAA {
+    public static void main(String... args) { }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tool/HelpTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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 8006263
+ * @summary Supplementary test cases needed for doclint
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -ref HelpTest.out
+ * @run main DocLintTester -ref HelpTest.out -h
+ * @run main DocLintTester -ref HelpTest.out -help
+ * @run main DocLintTester -ref HelpTest.out --help
+ * @run main DocLintTester -ref HelpTest.out -usage
+ * @run main DocLintTester -ref HelpTest.out -?
+ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tool/HelpTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,43 @@
+Usage:
+    doclint [options] source-files...
+
+Options:
+  -Xmsgs  
+    Same as -Xmsgs:all
+  -Xmsgs:values
+    Specify categories of issues to be checked, where 'values'
+    is a comma-separated list of any of the following:
+      reference      show places where comments contain incorrect
+                     references to Java source code elements
+      syntax         show basic syntax errors within comments
+      html           show issues with HTML tags and attributes
+      accessibility  show issues for accessibility
+      missing        show issues with missing documentation
+      all            all of the above
+    Precede a value with '-' to negate it
+    Categories may be qualified by one of:
+      /public /protected /package /private
+    For positive categories (not beginning with '-')
+    the qualifier applies to that access level and above.
+    For negative categories (beginning with '-')
+    the qualifier applies to that access level and below.
+    If a qualifier is missing, the category applies to
+    all access levels.
+    For example, -Xmsgs:all,-syntax/private
+    This will enable all messages, except syntax errors
+    in the doc comments of private methods.
+    If no -Xmsgs options are provided, the default is
+    equivalent to -Xmsgs:all/protected, meaning that
+    all messages are reported for protected and public
+    declarations only. 
+  -stats
+    Report statistics on the reported issues.
+  -h -help --help -usage -?
+    Show this message.
+
+The following javac options are also supported
+  -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns
+
+To run doclint on part of a project, put the compiled classes for your
+project on the classpath (or bootclasspath), then specify the source files
+to be checked on the command line.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tool/MaxDiagsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006263
+ * @summary Supplementary test cases needed for doclint
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -ref MaxDiagsTest.out -Xmaxerrs 2 -Xmaxwarns 2 MaxDiagsTest.java
+ * @run main DocLintTester -badargs -Xmaxerrs
+ * @run main DocLintTester -badargs -Xmaxwarns
+ * @run main DocLintTester -badargs -Xmaxerrs two -Xmaxwarns two MaxDiagsTest.java
+ */
+
+public class MaxDiagsTest {
+    /**
+     * &#0; &#0; &#0; &#0;
+     */
+    public void errors() { }
+
+    /** 4 undocumented signature items */
+    public int warnings(int a1, int a2) throws Exception { return 0; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tool/MaxDiagsTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+MaxDiagsTest.java:13: warning: no comment
+public class MaxDiagsTest {
+       ^
+MaxDiagsTest.java:15: error: invalid entity &#0;
+     * &#0; &#0; &#0; &#0;
+       ^
+MaxDiagsTest.java:15: error: invalid entity &#0;
+     * &#0; &#0; &#0; &#0;
+            ^
+MaxDiagsTest.java:20: warning: no @param for a1
+    public int warnings(int a1, int a2) throws Exception { return 0; }
+               ^
+2 errors
+2 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tool/PathsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,136 @@
+/*
+ * 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 8006263
+ * @summary Supplementary test cases needed for doclint
+ */
+
+import com.sun.tools.doclint.DocLint;
+import com.sun.tools.doclint.DocLint.BadArgs;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.regex.Pattern;
+
+public class PathsTest {
+    public static void main(String... args) throws Exception {
+        new PathsTest().run();
+    }
+
+    void run() throws Exception {
+        String PS = File.pathSeparator;
+        writeFile("src1/p/A.java",
+                "package p; public class A { }");
+        compile("-d", "classes1", "src1/p/A.java");
+
+        writeFile("src2/q/B.java",
+                "package q; public class B extends p.A { }");
+        compile("-d", "classes2", "-classpath", "classes1", "src2/q/B.java");
+
+        writeFile("src/Test.java",
+                "/** &0; */ class Test extends q.B { }");
+
+        test("src/Test.java", "-sourcepath", "src1" + PS + "src2");
+        test("src/Test.java", "-classpath", "classes1" + PS + "classes2");
+        String sysBootClassPath = System.getProperty("sun.boot.class.path");
+        test("src/Test.java", "-bootclasspath",
+                sysBootClassPath + PS + "classes1" + PS + "classes2");
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    Pattern pkgNotFound = Pattern.compile("package [a-z]+ does not exist");
+    Pattern badHtmlEntity = Pattern.compile("bad HTML entity");
+
+    void test(String file, String pathOpt, String path) throws BadArgs, IOException {
+        System.err.println("test " + pathOpt);
+        String out1 = doclint("-Xmsgs", file);
+        if (!pkgNotFound.matcher(out1).find())
+            error("message not found: " + pkgNotFound);
+
+        String out2 = doclint("-Xmsgs", pathOpt, path, file);
+        if (pkgNotFound.matcher(out2).find())
+            error("unexpected message found: " + pkgNotFound);
+        if (!badHtmlEntity.matcher(out1).find())
+            error("message not found: " + badHtmlEntity);
+
+        try {
+            doclint("-Xmsgs", pathOpt);
+            error("expected exception not thrown");
+        } catch (BadArgs e) {
+            System.err.println(e);
+        }
+    }
+
+    void compile(String... args) {
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("-d")) {
+                new File(args[++i]).mkdirs();
+                break;
+            }
+        }
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(args, pw);
+        pw.close();
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out);
+        if (rc != 0)
+            error("compilation failed: rc=" + rc);
+    }
+
+    String doclint(String... args) throws BadArgs, IOException {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        DocLint dl = new DocLint();
+        dl.run(pw, args);
+        pw.close();
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out);
+        return out;
+    }
+
+    File writeFile(String path, String body) throws IOException {
+        File f = new File(path);
+        f.getParentFile().mkdirs();
+        try (FileWriter fw = new FileWriter(path)) {
+            fw.write(body);
+        }
+        return f;
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tool/RunTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,200 @@
+/*
+ * 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 8006263
+ * @summary Supplementary test cases needed for doclint
+ */
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.doclint.DocLint;
+import com.sun.tools.doclint.DocLint.BadArgs;
+import com.sun.tools.javac.api.JavacTool;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.security.Permission;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
+public class RunTest {
+    static class SimpleSecurityManager extends SecurityManager {
+        boolean allowExit = false;
+
+        @Override
+        public void checkExit(int status) {
+            if (!allowExit)
+                throw new SecurityException("System.exit(" + status + ")");
+        }
+        @Override
+        public void checkPermission(Permission perm) { }
+
+    }
+
+    public static void main(String... args) throws Exception {
+        // if no security manager already installed, install one to
+        // prevent System.exit
+        SimpleSecurityManager secmgr = null;
+        if (System.getSecurityManager() == null) {
+            System.setSecurityManager(secmgr = new SimpleSecurityManager() { });
+        }
+
+        try {
+            new RunTest().run();
+        } finally {
+            if (secmgr != null)
+                secmgr.allowExit = true;
+        }
+    }
+
+    void run() throws Exception {
+        testMain();
+        testRun();
+        testInit();
+        testArgsNoFiles();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    void testMain() {
+        System.err.println("test main(String[])");
+        testMain(true, "-help");
+        testMain(false, "-unknownOption");
+    }
+
+    void testMain(boolean expectOK, String... args) {
+        try {
+            DocLint.main(args);
+            if (!expectOK)
+                error("expected SecurityException (from System.exit) not thrown");
+        } catch (SecurityException e) {
+            System.err.println(e);
+            if (expectOK)
+                error("unexpected SecurityException caught");
+        }
+    }
+
+    void testRun() throws BadArgs, IOException {
+        System.err.println("test run(String[])");
+        DocLint dl = new DocLint();
+        String[] args = { "-help" };
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        PrintStream ps = new PrintStream(baos);
+        PrintStream prev = System.out;
+        try {
+            System.setOut(ps);
+            dl.run(args);
+        } finally {
+            System.setOut(prev);
+        }
+        ps.close();
+        String stdout = baos.toString();
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        dl.run(pw, args);
+        pw.close();
+        String direct = sw.toString();
+
+        if (!stdout.equals(direct)) {
+            error("unexpected output");
+            System.err.println("EXPECT>>" + direct + "<<");
+            System.err.println("FOUND>>" + stdout + "<<");
+        }
+    }
+
+    void testInit() {
+        System.err.println("test init");
+        DocLint dl = new DocLint();
+        String name = dl.getName();
+        if (!Objects.equals(name, "doclint"))
+            error("unexpected result for DocLint.getName()");
+
+        List<? extends JavaFileObject> files =
+                Arrays.asList(createFile("Test.java", "/** &0; */ class Test{ }"));
+        String[] goodArgs = { "-Xmsgs" };
+        testInit(true, goodArgs, files);
+
+        String[] badArgs = { "-unknown" };
+        testInit(false, badArgs, files);
+    }
+
+    void testInit(boolean expectOK, String[] args, List<? extends JavaFileObject> files) {
+        JavacTool javac = JavacTool.create();
+        JavacTask task = javac.getTask(null, null, null, null, null, files);
+        try {
+            DocLint dl = new DocLint();
+            dl.init(task, args, true);
+            if (!expectOK)
+                error("expected IllegalArgumentException not thrown");
+            task.call();
+        } catch (IllegalArgumentException e) {
+            System.err.println(e);
+            if (expectOK)
+                error("unexpected IllegalArgumentException caught");
+        }
+    }
+
+    void testArgsNoFiles() throws BadArgs, IOException {
+        System.err.println("test args, no files");
+        DocLint dl = new DocLint();
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        dl.run(pw, "-Xmsgs");
+        pw.close();
+        String out = sw.toString();
+
+        String expect = "no files given";
+        if (!Objects.equals(out.trim(), expect)) {
+            error("unexpected output");
+            System.err.println("EXPECT>>" + expect + "<<");
+            System.err.println("FOUND>>" + out + "<<");
+        }
+
+    }
+
+    JavaFileObject createFile(String name, final String body) {
+        return new SimpleJavaFileObject(URI.create(name), JavaFileObject.Kind.SOURCE) {
+            @Override
+            public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                return body;
+            }
+        };
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tool/StatsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006263
+ * @summary Supplementary test cases needed for doclint
+ * @library ..
+ * @build DocLintTester
+ * @run main DocLintTester -ref StatsTest.out -stats -Xmsgs:all StatsTest.java
+ */
+
+// warning: missing comment
+public class StatsTest {
+    /**
+     * &#0; &#0; &#0; &#0;
+     */
+    public void errors() { }
+
+    /** 4 undocumented signature items */
+    public int warnings(int a1, int a2) throws Exception { return 0; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/doclint/tool/StatsTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,43 @@
+StatsTest.java:11: warning: no comment
+public class StatsTest {
+       ^
+StatsTest.java:13: error: invalid entity &#0;
+     * &#0; &#0; &#0; &#0;
+       ^
+StatsTest.java:13: error: invalid entity &#0;
+     * &#0; &#0; &#0; &#0;
+            ^
+StatsTest.java:13: error: invalid entity &#0;
+     * &#0; &#0; &#0; &#0;
+                 ^
+StatsTest.java:13: error: invalid entity &#0;
+     * &#0; &#0; &#0; &#0;
+                      ^
+StatsTest.java:18: warning: no @param for a1
+    public int warnings(int a1, int a2) throws Exception { return 0; }
+               ^
+StatsTest.java:18: warning: no @param for a2
+    public int warnings(int a1, int a2) throws Exception { return 0; }
+               ^
+StatsTest.java:18: warning: no @return
+    public int warnings(int a1, int a2) throws Exception { return 0; }
+               ^
+StatsTest.java:18: warning: no @throws for java.lang.Exception
+    public int warnings(int a1, int a2) throws Exception { return 0; }
+               ^
+By group...
+     5: missing
+     4: html
+
+By diagnostic kind...
+     5: warning
+     4: error
+
+By message kind...
+     4: invalid entity &{0};
+     2: no @param for {0}
+     1: no @return
+     1: no @throws for {0}
+     1: no comment
+4 errors
+5 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/4846262/CheckEBCDICLocaleTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,96 @@
+/*
+ * 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 4846262
+ * @summary check that javac operates correctly in EBCDIC locale
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main CheckEBCDICLocaleTest
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+public class CheckEBCDICLocaleTest {
+
+    private static final String TestSrc =
+        "public class Test {\n" +
+        "    public void test() {\n" +
+        "        abcdefg\n" +
+        "    }\n" +
+        "}";
+
+    private static final String TestOutTemplate =
+        "output%1$sTest.java:3: error: not a statement\n" +
+        "        abcdefg\n" +
+        "        ^\n" +
+        "output%1$sTest.java:3: error: ';' expected\n" +
+        "        abcdefg\n" +
+        "               ^\n" +
+        "2 errors\n";
+
+    public static void main(String[] args) throws Exception {
+        new CheckEBCDICLocaleTest().test();
+    }
+
+    public void test() throws Exception {
+        String native2asciiBinary = Paths.get(
+                System.getProperty("test.jdk"),"bin", "native2ascii").toString();
+
+        ToolBox.createJavaFileFromSource(TestSrc);
+        Files.createDirectory(Paths.get("output"));
+
+        ToolBox.AnyToolArgs nativeCmdParams =
+                new ToolBox.AnyToolArgs()
+                .appendArgs(native2asciiBinary)
+                .appendArgs(ToolBox.testToolVMOpts)
+                .appendArgs("-reverse", "-encoding", "IBM1047", "Test.java",
+                "output/Test.java");
+        ToolBox.executeCommand(nativeCmdParams);
+
+        ToolBox.AnyToolArgs javacParams =
+                new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(ToolBox.javacBinary)
+                .appendArgs(ToolBox.testToolVMOpts)
+                .appendArgs("-J-Duser.language=en",
+                "-J-Duser.region=US", "-J-Dfile.encoding=IBM1047",
+                "output/Test.java")
+                .setErrOutput(new File("Test.tmp"));
+        ToolBox.executeCommand(javacParams);
+
+        nativeCmdParams = new ToolBox.AnyToolArgs()
+                .appendArgs(native2asciiBinary)
+                .appendArgs(ToolBox.testToolVMOpts)
+                .appendArgs("-encoding", "IBM1047", "Test.tmp", "Test.out");
+        ToolBox.executeCommand(nativeCmdParams);
+
+        String goldenFile = String.format(TestOutTemplate, File.separator);
+        ToolBox.compareLines(Paths.get("Test.out"),
+                Arrays.asList(goldenFile.split("\n")), null, true);
+    }
+
+}
--- a/test/tools/javac/4846262/Test.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-/* /nodynamiccopyright/ */
-public class Test {
-    public void test() {
-        abcdefg
-    }
-}
--- a/test/tools/javac/4846262/Test.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-Test.java:4: error: not a statement
-        abcdefg
-        ^
-Test.java:4: error: ';' expected
-        abcdefg
-               ^
-2 errors
--- a/test/tools/javac/4846262/Test.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-#!/bin/sh -f
-
-#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# @test
-# @bug 4846262
-# @summary check that javac operates correctly in EBCDIC locale
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    FS="/"
-    ;;
-  CYGWIN* )
-    FS="/"
-    DIFFOPTS="--strip-trailing-cr"
-    ;;
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-rm -f Test.java Test.out
-
-"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -reverse -encoding IBM1047 ${TESTSRC}${FS}Test.java Test.java
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Duser.language=en -J-Duser.region=US -J-Dfile.encoding=IBM1047 Test.java 2>Test.tmp
-
-"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -encoding IBM1047 Test.tmp Test.out
-
-diff ${DIFFOPTS} -c "${TESTSRC}${FS}Test.out" Test.out
-result=$?
-
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/6302184/HiddenOptionsShouldUseGivenEncodingTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,49 @@
+/*
+ * 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 6302184 6350124 6357979
+ * @summary javac hidden options that generate source should use the given
+ * encoding, if available
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run compile -encoding iso-8859-1 -XD-printsource T6302184.java
+ * @run main HiddenOptionsShouldUseGivenEncodingTest
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+//original test: test/tools/javac/6302184/T6302184.sh
+public class HiddenOptionsShouldUseGivenEncodingTest {
+
+    public static void main(String[] args) throws Exception {
+//"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -cp ${TC} -encoding iso-8859-1 -XD-printsource ${TS}${FS}T6302184.java 2>&1
+//diff ${DIFFOPTS} -c ${TC}${FS}T6302184.java ${TS}${FS}T6302184.out
+        Path path1 = Paths.get(System.getProperty("test.classes"), "T6302184.java");
+        Path path2 = Paths.get(System.getProperty("test.src"), "T6302184.out");
+        ToolBox.compareLines(path1, path2, "iso-8859-1");
+    }
+
+}
--- a/test/tools/javac/6302184/T6302184.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#! /bin/sh -f
-
-#
-# Copyright (c) 2005, 2009, 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 6302184 6350124 6357979
-# @summary javac hidden options that generate source should use the given encoding, if available
-# @run shell T6302184.sh
-
-TS=${TESTSRC-.}
-TC=${TESTCLASSES-.}
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    FS="/"
-    ;;
-  CYGWIN* )
-    FS="/"
-    DIFFOPTS="--strip-trailing-cr"
-    ;;
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -cp ${TC} -encoding iso-8859-1 -XD-printsource ${TS}${FS}T6302184.java 2>&1
-diff ${DIFFOPTS} -c ${TC}${FS}T6302184.java ${TS}${FS}T6302184.out
-result=$?
-
-
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/6563143/EqualsHashCodeWarningTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,71 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6563143 8008436 8009138
+ * @summary javac should issue a warning for overriding equals without hashCode
+ * @summary javac should not issue a warning for overriding equals without hasCode
+ * @summary javac, equals-hashCode warning tuning
+ * if hashCode has been overriden by a superclass
+ * @compile/ref=EqualsHashCodeWarningTest.out -Xlint:overrides -XDrawDiagnostics EqualsHashCodeWarningTest.java
+ */
+
+import java.util.Comparator;
+
+public class EqualsHashCodeWarningTest {
+    @Override
+    public boolean equals(Object o) {
+        return o == this;
+    }
+
+    @Override
+    public int hashCode() {
+        return 0;
+    }
+
+    public Comparator m() {
+        return new Comparator() {
+            @Override
+            public boolean equals(Object o) {return true;}
+
+            @Override
+            public int compare(Object o1, Object o2) {
+                return 0;
+            }
+        };
+    }
+}
+
+class SubClass extends EqualsHashCodeWarningTest {
+    @Override
+    public boolean equals(Object o) {
+        return true;
+    }
+}
+
+@SuppressWarnings("overrides")
+class DontWarnMe {
+    @Override
+    public boolean equals(Object o) {
+        return true;
+    }
+}
+
+class DoWarnMe {
+    @Override
+    public boolean equals(Object o) {
+        return o == this;
+    }
+}
+
+abstract class IamAbstractGetMeOutOfHere {
+    public boolean equals(Object o){return true;}
+}
+
+interface I {
+    public boolean equals(Object o);
+}
+
+enum E {
+    A, B
+}
+
+@interface anno {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/6563143/EqualsHashCodeWarningTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+EqualsHashCodeWarningTest.java:52:1: compiler.warn.override.equals.but.not.hashcode: DoWarnMe
+1 warning
--- a/test/tools/javac/6758789/T6758789b.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/6758789/T6758789b.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,4 +1,4 @@
-T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
+T6758789b.java:16:11: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<java.lang.Object>
 T6758789b.java:16:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
 - compiler.err.warnings.and.werror
 1 error
--- a/test/tools/javac/7129225/TestImportStar.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/7129225/TestImportStar.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -30,7 +30,7 @@
  * @build JavacTestingAbstractProcessor
  * @compile/fail/ref=NegTest.ref -XDrawDiagnostics TestImportStar.java
  * @compile Anno.java AnnoProcessor.java
- * @compile/ref=TestImportStar.ref -XDrawDiagnostics -processor AnnoProcessor -proc:only TestImportStar.java
+ * @compile/fail/ref=TestImportStar.ref -XDrawDiagnostics -processor AnnoProcessor -proc:only TestImportStar.java
  */
 
  //The @compile/fail... verifies that the fix doesn't break the normal compilation of import xxx.*
--- a/test/tools/javac/7129225/TestImportStar.ref	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/7129225/TestImportStar.ref	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,4 @@
 - compiler.note.proc.messager: RUNNING - lastRound = false
 TestImportStar.java:39:1: compiler.err.doesnt.exist: xxx
 - compiler.note.proc.messager: RUNNING - lastRound = true
+1 error
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7166455/CheckACC_STRICTFlagOnclinitTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,107 @@
+/*
+ * 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 7166455
+ * @summary javac doesn't set ACC_STRICT bit on <clinit> for strictfp class
+ * @run main CheckACC_STRICTFlagOnclinitTest
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.io.File;
+import java.io.IOException;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Method;
+
+import static com.sun.tools.classfile.AccessFlags.ACC_STRICT;
+
+public strictfp class CheckACC_STRICTFlagOnclinitTest {
+    private static final String AssertionErrorMessage =
+        "All methods should have the ACC_STRICT access flag " +
+        "please check output";
+    private static final String offendingMethodErrorMessage =
+        "Method %s of class %s doesn't have the ACC_STRICT access flag";
+
+    static {
+        class Foo {
+            class Bar {
+                void m11() {}
+            }
+            void m1() {}
+        }
+    }
+    void m2() {
+        class Any {
+            void m21() {}
+        }
+    }
+
+    private List<String> errors = new ArrayList<>();
+
+    public static void main(String[] args)
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        new CheckACC_STRICTFlagOnclinitTest().run();
+    }
+
+    private void run()
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        String testClasses = System.getProperty("test.classes");
+        check(testClasses,
+              "CheckACC_STRICTFlagOnclinitTest.class",
+              "CheckACC_STRICTFlagOnclinitTest$1Foo.class",
+              "CheckACC_STRICTFlagOnclinitTest$1Foo$Bar.class",
+              "CheckACC_STRICTFlagOnclinitTest$1Any.class");
+        if (errors.size() > 0) {
+            for (String error: errors) {
+                System.err.println(error);
+            }
+            throw new AssertionError(AssertionErrorMessage);
+        }
+    }
+
+    void check(String dir, String... fileNames)
+        throws
+            IOException,
+            ConstantPoolException,
+            Descriptor.InvalidDescriptor {
+        for (String fileName : fileNames) {
+            ClassFile classFileToCheck = ClassFile.read(new File(dir, fileName));
+
+            for (Method method : classFileToCheck.methods) {
+                if ((method.access_flags.flags & ACC_STRICT) == 0) {
+                    errors.add(String.format(offendingMethodErrorMessage,
+                            method.getName(classFileToCheck.constant_pool),
+                            classFileToCheck.getName()));
+                }
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7167125/DiffResultAfterSameOperationInnerClasses.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2002, 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 7167125
+ * @summary Two variables after the same operation in a inner class return
+ * different results
+ * @run main DiffResultAfterSameOperationInnerClasses
+ */
+
+public class DiffResultAfterSameOperationInnerClasses {
+    public int i = 1;
+    private int j = 1;
+    public String s1 = "Hi, ";
+    private String s2 = "Hi, ";
+    public int arr1[] = new int[]{1};
+    public int arr2[] = new int[]{1};
+
+    public static void main(String[] args) {
+        DiffResultAfterSameOperationInnerClasses theTest =
+                new DiffResultAfterSameOperationInnerClasses();
+        InnerClass inner = theTest.new InnerClass();
+        if (!inner.test1()) {
+            throw new AssertionError("Different results after same calculation");
+        }
+
+        theTest.resetVars();
+        if (!inner.test2()) {
+            throw new AssertionError("Different results after same calculation");
+        }
+    }
+
+    void resetVars() {
+        i = 1;
+        j = 1;
+        s1 = "Hi, ";
+        s2 = "Hi, ";
+        arr1[0] = 1;
+        arr2[0] = 1;
+    }
+
+    class InnerClass {
+        public boolean test1() {
+            i += i += 1;
+            j += j += 1;
+
+            arr1[0] += arr1[0] += 1;
+            arr2[0] += arr2[0] += 1;
+
+            s1 += s1 += "dude";
+            s2 += s2 += "dude";
+
+            return (i == j && i == 3 &&
+                    arr1[0] == arr2[0] && arr2[0] == 3 &&
+                    s1.equals(s2) && s1.endsWith("Hi, Hi, dude"));
+        }
+
+        public boolean test2() {
+            (i) += (i) += 1;
+            (j) += (j) += 1;
+
+            (arr1[0])+= (arr1[0]) += 1;
+            (arr2[0])+= (arr2[0]) += 1;
+
+            (s1) += (s1) += "dude";
+            (s2) += (s2) += "dude";
+
+            return (i == j && i == 3 &&
+                    arr1[0] == arr2[0] && arr2[0] == 3 &&
+                    s1.equals(s2) && s1.endsWith("Hi, Hi, dude"));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7199823/InnerClassCannotBeVerified.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,110 @@
+/*
+ * 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
+ * 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 7199823
+ * @summary javac generates inner class that can't be verified
+ * @run main InnerClassCannotBeVerified
+ */
+
+import java.util.Arrays;
+import javax.tools.JavaFileObject;
+import java.net.URI;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+import javax.tools.JavaCompiler;
+import com.sun.source.util.JavacTask;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import java.io.File;
+import java.io.IOException;
+
+public class InnerClassCannotBeVerified {
+
+    private static final String errorMessage =
+            "Compile error while compiling the following source:\n";
+
+    public static void main(String... args) throws Exception {
+        new InnerClassCannotBeVerified().run();
+    }
+
+    void run() throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        JavaSource source = new JavaSource();
+        JavacTask ct = (JavacTask)comp.getTask(null, null, null,
+                null, null, Arrays.asList(source));
+        try {
+            if (!ct.call()) {
+                throw new AssertionError(errorMessage +
+                        source.getCharContent(true));
+            }
+        } catch (Throwable ex) {
+            throw new AssertionError(errorMessage +
+                    source.getCharContent(true));
+        }
+        check();
+    }
+
+    private void check() throws IOException, ConstantPoolException {
+        File file = new File("Test$1.class");
+        ClassFile classFile = ClassFile.read(file);
+        boolean inheritsFromObject =
+                classFile.getSuperclassName().equals("java/lang/Object");
+        boolean implementsNoInterface = classFile.interfaces.length == 0;
+        boolean noMethods = classFile.methods.length == 0;
+        if (!(inheritsFromObject &&
+              implementsNoInterface &&
+              noMethods)) {
+            throw new AssertionError("The inner classes reused as " +
+                    "access constructor tag for this code must be empty");
+        }
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String internalSource =
+                              "public class Test {\n" +
+                              "    private static class Foo {}\n" +
+                              "    public static void main(String[] args){ \n" +
+                              "        new Foo();\n" +
+                              "        if(false) {\n" +
+                              "            new Runnable() {\n" +
+                              "                @Override\n" +
+                              "                public void run() {\n" +
+                              "                    System.out.println();\n" +
+                              "                }\n" +
+                              "            }.run();\n" +
+                              "        }\n" +
+                              "   }\n" +
+                              "}";
+        public JavaSource() {
+            super(URI.create("Test.java"), JavaFileObject.Kind.SOURCE);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return internalSource;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,130 @@
+/*
+ * 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 8005931
+ * @summary javac doesn't set ACC_STRICT for classes with package access
+ * @run main CheckACC_STRICTFlagOnPkgAccessClassTest
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+import com.sun.source.util.JavacTask;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Method;
+
+import static com.sun.tools.classfile.AccessFlags.ACC_STRICT;
+
+public class CheckACC_STRICTFlagOnPkgAccessClassTest {
+
+    private static final String AssertionErrorMessage =
+        "All methods should have the ACC_STRICT access flag " +
+        "please check output";
+    private static final String CompilationErrorMessage =
+        "Error thrown when compiling the following source:\n";
+    private static final String offendingMethodErrorMessage =
+        "Method %s of class %s doesn't have the ACC_STRICT access flag";
+
+    JavaSource source = new JavaSource();
+
+    private List<String> errors = new ArrayList<>();
+
+    public static void main(String[] args)
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        new CheckACC_STRICTFlagOnPkgAccessClassTest().run(comp);
+    }
+
+    private void run(JavaCompiler comp)
+            throws IOException, ConstantPoolException, InvalidDescriptor {
+        compile(comp);
+        check();
+        if (errors.size() > 0) {
+            for (String error: errors) {
+                System.err.println(error);
+            }
+            throw new AssertionError(AssertionErrorMessage);
+        }
+    }
+
+    private void compile(JavaCompiler comp) {
+        JavacTask ct = (JavacTask)comp.getTask(null, null, null, null, null,
+                Arrays.asList(source));
+        try {
+            if (!ct.call()) {
+                throw new AssertionError(CompilationErrorMessage +
+                        source.getCharContent(true));
+            }
+        } catch (Throwable ex) {
+            throw new AssertionError(CompilationErrorMessage +
+                    source.getCharContent(true));
+        }
+    }
+
+    void check()
+        throws
+            IOException,
+            ConstantPoolException,
+            Descriptor.InvalidDescriptor {
+        ClassFile classFileToCheck = ClassFile.read(new File("Test.class"));
+
+        for (Method method : classFileToCheck.methods) {
+            if ((method.access_flags.flags & ACC_STRICT) == 0) {
+                errors.add(String.format(offendingMethodErrorMessage,
+                        method.getName(classFileToCheck.constant_pool),
+                        classFileToCheck.getName()));
+            }
+        }
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String source = "strictfp class Test {" +
+                "    Test(){}" +
+                "    void m(){}" +
+                "}";
+
+        public JavaSource() {
+            super(URI.create("Test.java"), JavaFileObject.Kind.SOURCE);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/8009170/RedundantByteCodeInArrayTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,71 @@
+/*
+ * 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 8009170
+ * @summary Regression: javac generates redundant bytecode in assignop involving
+ * arrays
+ * @run main RedundantByteCodeInArrayTest
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.Code_attribute.InvalidIndex;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
+import com.sun.tools.classfile.Method;
+
+public class RedundantByteCodeInArrayTest {
+    public static void main(String[] args)
+            throws IOException, ConstantPoolException, InvalidDescriptor, InvalidIndex {
+        new RedundantByteCodeInArrayTest()
+                .checkClassFile(new File(System.getProperty("test.classes", "."),
+                    RedundantByteCodeInArrayTest.class.getName() + ".class"));
+    }
+
+    void arrMethod(int[] array, int p, int inc) {
+        array[p] += inc;
+    }
+
+    void checkClassFile(File file)
+            throws IOException, ConstantPoolException, InvalidDescriptor, InvalidIndex {
+        ClassFile classFile = ClassFile.read(file);
+        ConstantPool constantPool = classFile.constant_pool;
+
+        //lets get all the methods in the class file.
+        for (Method method : classFile.methods) {
+            if (method.getName(constantPool).equals("arrMethod")) {
+                Code_attribute code = (Code_attribute) method.attributes
+                        .get(Attribute.Code);
+                if (code.max_locals > 4)
+                    throw new AssertionError("Too many locals for method arrMethod");
+            }
+        }
+    }
+}
--- a/test/tools/javac/ClassFileModifiers/MemberModifiers.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/ClassFileModifiers/MemberModifiers.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -26,7 +26,7 @@
  * @bug 4249112 4785453
  * @summary Verify that implicit member modifiers are set correctly.
  *
- * @compile/ref=MemberModifiers.out  -source 1.4 -target 1.4.2 -Xlint:-options -XDdumpmodifiers=cfm MemberModifiers.java
+ * @compile/ref=MemberModifiers.out  -source 1.4 -target 1.5 -Xlint:-options -XDdumpmodifiers=cfm MemberModifiers.java
  */
 
 // Currently, we check only that members of final classes are not final.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/ClassPathTest/ClassPathTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,178 @@
+/*
+ * 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 4241229 4785453
+ * @summary Test -classpath option and classpath defaults.
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main ClassPathTest
+ */
+
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+//original test: test/tools/javac/ClassPathTest/ClassPathTest.sh
+public class ClassPathTest {
+
+    private static final String ClassPathTest1Src =
+        "import pkg.*;\n" +
+        "public class ClassPathTest1 {\n" +
+        "    ClassPathTestAux1 x;\n" +
+        "}";
+
+    private static final String ClassPathTest2Src =
+        "import pkg.*;\n" +
+        "public class ClassPathTest2 {\n" +
+        "    ClassPathTestAux2 x;\n" +
+        "}";
+
+    private static final String ClassPathTest3Src =
+        "import pkg.*;\n" +
+        "public class ClassPathTest3 {\n" +
+        "    ClassPathTestAux3 x;\n" +
+        "}";
+
+    private static final String fooPkgClassPathTestAux1Src =
+        "package pkg;\n" +
+        "public class ClassPathTestAux1 {}";
+
+    private static final String barPkgClassPathTestAux2Src =
+        "package pkg;\n" +
+        "public class ClassPathTestAux2 {}";
+
+    private static final String pkgClassPathTestAux3Src =
+        "package pkg;\n" +
+        "public class ClassPathTestAux3 {}";
+
+    ProcessBuilder pb = null;
+
+    public static void main(String[] args) throws Exception {
+        new ClassPathTest().test();
+    }
+
+    public void test() throws Exception {
+        createOutputDirAndSourceFiles();
+        checkCompileCommands();
+    }
+
+    void createOutputDirAndSourceFiles() throws Exception {
+        //dirs and files creation
+        ToolBox.createJavaFileFromSource(ClassPathTest1Src);
+        ToolBox.createJavaFileFromSource(ClassPathTest2Src);
+        ToolBox.createJavaFileFromSource(ClassPathTest3Src);
+        ToolBox.createJavaFileFromSource(Paths.get("foo"),
+                fooPkgClassPathTestAux1Src);
+        ToolBox.createJavaFileFromSource(Paths.get("bar"),
+                barPkgClassPathTestAux2Src);
+        ToolBox.createJavaFileFromSource(pkgClassPathTestAux3Src);
+    }
+
+    void checkCompileCommands() throws Exception {
+//        Without the -cp . parameter the command will fail seems like when called
+//        from the command line, the current dir is added to the classpath
+//        automatically but this is not happening when called using ProcessBuilder
+
+//        testJavac success ClassPathTest3.java
+        List<String> mainArgs = new ArrayList<>();
+        mainArgs.add(ToolBox.javacBinary.toString());
+        if (ToolBox.testToolVMOpts != null) {
+            mainArgs.addAll(ToolBox.testToolVMOpts);
+        }
+
+        List<String> commonArgs = new ArrayList<>();
+        commonArgs.addAll(mainArgs);
+        commonArgs.addAll(Arrays.asList("-cp", "."));
+
+        ToolBox.AnyToolArgs successParams = new ToolBox.AnyToolArgs()
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest3.java");
+        ToolBox.executeCommand(successParams);
+
+//        testJavac failure ClassPathTest1.java
+        ToolBox.AnyToolArgs failParams =
+                new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest1.java");
+        ToolBox.executeCommand(failParams);
+
+//        This is done inside the executeCommand method
+//        CLASSPATH=bar; export CLASSPATH
+
+        Map<String, String> extVars = new TreeMap<>();
+        extVars.put("CLASSPATH", "bar");
+
+//        testJavac success ClassPathTest2.java
+        successParams = new ToolBox.AnyToolArgs()
+                .appendArgs(mainArgs)
+                .appendArgs("ClassPathTest2.java")
+                .set(extVars);
+        ToolBox.executeCommand(successParams);
+
+//        testJavac failure ClassPathTest1.java
+        failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(mainArgs)
+                .appendArgs("ClassPathTest1.java")
+                .set(extVars);
+        ToolBox.executeCommand(failParams);
+
+//        testJavac failure ClassPathTest3.java
+        failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(mainArgs)
+                .appendArgs("ClassPathTest3.java")
+                .set(extVars);
+        ToolBox.executeCommand(failParams);
+
+//        testJavac success -classpath foo ClassPathTest1.java
+
+        commonArgs.clear();
+        commonArgs.addAll(mainArgs);
+        commonArgs.addAll(Arrays.asList("-cp", "foo"));
+
+        successParams = new ToolBox.AnyToolArgs()
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest1.java")
+                .set(extVars);
+        ToolBox.executeCommand(successParams);
+
+//        testJavac failure -classpath foo ClassPathTest2.java
+        failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest2.java")
+                .set(extVars);
+        ToolBox.executeCommand(failParams);
+
+//        testJavac failure -classpath foo ClassPathTest3.java
+        failParams = new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(commonArgs)
+                .appendArgs("ClassPathTest3.java")
+                .set(extVars);
+        ToolBox.executeCommand(failParams);
+    }
+
+}
--- a/test/tools/javac/ClassPathTest/ClassPathTest.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-
-# @test
-# @bug 4241229 4785453
-# @summary Test -classpath option and classpath defaults.
-# @author maddox
-#
-# @run shell/timeout=180 ClassPathTest.sh
-
-# TODO: Should test sourcepath and classpath separately.
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | CYGWIN* )
-    FS="/"
-    ;;
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-javac="${TESTJAVA}${FS}bin${FS}javac"
-
-cleanup() {
-	rm -f *.class pkg${FS}*.class foo${FS}pkg${FS}*.class bar${FS}pkg${FS}*.class
-	cp -rf $TESTSRC${FS}* .
-}
-
-fail() {
-	echo "FAIL: $1"
-	failed="yes"
-}
-
-# report expectedResult $?
-report() {
-	if   test "$1" = "success" -a "$2" = 0; then
-		echo "PASS: succeeded as expected"
-	elif test "$1" = "failure" -a "$2" != 0; then
-		echo "PASS: failed as expected"
-	elif test "$1" = "success" -a "$2" != 0; then
-		fail "test failed unexpectedly"
-	elif test "$1" = "failure" -a "$2" = 0; then
-		fail "test succeeded unexpectedly"
-	else
-		fail "internal error"
-	fi
-}
-
-# testJavac expectedResult javacArgs...
-testJavac() {
-	expectedResult="$1"; shift
-	cleanup
-	echo $javac ${TESTTOOLVMOPTS} "$@"
-	"$javac" ${TESTTOOLVMOPTS} "$@"
-	report $expectedResult $?
-}
-
-unset CLASSPATH
-
-# classpath should default to current directory
-
-testJavac success ClassPathTest3.java
-testJavac failure ClassPathTest1.java
-
-# if CLASSPATH is set, it should be honored
-
-CLASSPATH=bar; export CLASSPATH
-
-testJavac success ClassPathTest2.java
-testJavac failure ClassPathTest1.java
-testJavac failure ClassPathTest3.java
-
-# -classpath option should override default
-
-testJavac success -classpath foo ClassPathTest1.java
-testJavac failure -classpath foo ClassPathTest2.java
-testJavac failure -classpath foo ClassPathTest3.java
-
-if test -n "$failed"; then
-	echo "Some tests failed"
-	exit 1
-else
-	echo PASS: all tests gave expected results
-	exit 0
-fi
--- a/test/tools/javac/ClassPathTest/ClassPathTest1.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 1999, 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 pkg.*;
-
-public class ClassPathTest1 {
-    ClassPathTestAux1 x;
-
-}
--- a/test/tools/javac/ClassPathTest/ClassPathTest2.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 1999, 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 pkg.*;
-
-public class ClassPathTest2 {
-    ClassPathTestAux2 x;
-
-}
--- a/test/tools/javac/ClassPathTest/ClassPathTest3.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 1999, 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 pkg.*;
-
-public class ClassPathTest3 {
-    ClassPathTestAux3 x;
-
-}
--- a/test/tools/javac/ClassPathTest/bar/pkg/ClassPathTestAux2.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 1999, 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 pkg;
-
-public class ClassPathTestAux2 {}
--- a/test/tools/javac/ClassPathTest/foo/pkg/ClassPathTestAux1.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 1999, 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 pkg;
-
-public class ClassPathTestAux1 {}
--- a/test/tools/javac/ClassPathTest/pkg/ClassPathTestAux3.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 1999, 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 pkg;
-
-public class ClassPathTestAux3 {}
--- a/test/tools/javac/Diagnostics/6722234/T6722234d_1.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/Diagnostics/6722234/T6722234d_1.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,3 @@
-T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.intersection.type: 1, T6722234d.A)
+T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.intersection.type: 1, T6722234d.A,java.lang.Object)
 - compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, java.lang.Object,T6722234d.I1,T6722234d.I2)}
 1 error
--- a/test/tools/javac/Diagnostics/6722234/T6722234d_2.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/Diagnostics/6722234/T6722234d_2.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,3 @@
-T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.intersection.type: 1, T6722234d.A)
+T6722234d.java:18:20: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.intersection.type: 1, T6722234d.A,Object)
 - compiler.misc.where.description.intersection: compiler.misc.intersection.type: 1,{(compiler.misc.where.intersection: compiler.misc.intersection.type: 1, Object,I1,I2)}
 1 error
--- a/test/tools/javac/Diagnostics/6769027/T6769027.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/Diagnostics/6769027/T6769027.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2011, 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,17 +23,26 @@
 
 /**
  * @test
- * @bug     6769027
+ * @bug     6769027 8006694
  * @summary Source line should be displayed immediately after the first diagnostic line
+ *  temporarily workaround combo tests are causing time out in several platforms
  * @author  Maurizio Cimadamore
+ * @library ../../lib
+ * @build JavacTestingAbstractThreadedTest
  * @run main/othervm T6769027
  */
+
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.regex.Matcher;
 import javax.tools.*;
 import com.sun.tools.javac.util.*;
 
-public class T6769027 {
+public class T6769027
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum OutputKind {
         RAW("rawDiagnostics","rawDiagnostics"),
@@ -314,7 +323,7 @@
 
         @Override
         protected java.io.PrintWriter getWriterForDiagnosticType(JCDiagnostic.DiagnosticType dt) {
-            return new java.io.PrintWriter(System.out);
+            return outWriter;
         }
 
         @Override
@@ -323,13 +332,42 @@
         }
     }
 
-    int nerrors = 0;
+    OutputKind outputKind;
+    ErrorKind errorKind;
+    MultilineKind multiKind;
+    MultilinePolicy multiPolicy;
+    PositionKind posKind;
+    XDiagsSource xdiagsSource;
+    XDiagsCompact xdiagsCompact;
+    CaretKind caretKind;
+    SourceLineKind sourceLineKind;
+    IndentKind summaryIndent;
+    IndentKind detailsIndent;
+    IndentKind sourceIndent;
+    IndentKind subdiagsIndent;
 
-    void exec(OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
+    T6769027(OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
             MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource,
             XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind,
             IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent,
             IndentKind subdiagsIndent) {
+        this.outputKind = outputKind;
+        this.errorKind = errorKind;
+        this.multiKind = multiKind;
+        this.multiPolicy = multiPolicy;
+        this.posKind = posKind;
+        this.xdiagsSource = xdiagsSource;
+        this.xdiagsCompact = xdiagsCompact;
+        this.caretKind = caretKind;
+        this.sourceLineKind = sourceLineKind;
+        this.summaryIndent = summaryIndent;
+        this.detailsIndent = detailsIndent;
+        this.sourceIndent = sourceIndent;
+        this.subdiagsIndent = subdiagsIndent;
+    }
+
+    @Override
+    public void run() {
         Context ctx = new Context();
         Options options = Options.instance(ctx);
         outputKind.init(options);
@@ -362,23 +400,10 @@
             d = new JCDiagnostic.MultilineDiagnostic(d, subdiags);
         }
         String diag = log.getDiagnosticFormatter().format(d, messages.getCurrentLocale());
-        checkOutput(diag,
-                outputKind,
-                errorKind,
-                multiKind,
-                multiPolicy,
-                posKind,
-                xdiagsSource,
-                xdiagsCompact,
-                caretKind,
-                sourceLineKind,
-                summaryIndent,
-                detailsIndent,
-                sourceIndent,
-                subdiagsIndent);
+        checkOutput(diag);
     }
 
-    void test() {
+    public static void main(String[] args) throws Exception {
         for (OutputKind outputKind : OutputKind.values()) {
             for (ErrorKind errKind : ErrorKind.values()) {
                 for (MultilineKind multiKind : MultilineKind.values()) {
@@ -392,7 +417,7 @@
                                                 for (IndentKind detailsIndent : IndentKind.values()) {
                                                     for (IndentKind sourceIndent : IndentKind.values()) {
                                                         for (IndentKind subdiagsIndent : IndentKind.values()) {
-                                                            exec(outputKind,
+                                                            pool.execute(new T6769027(outputKind,
                                                                 errKind,
                                                                 multiKind,
                                                                 multiPolicy,
@@ -404,7 +429,7 @@
                                                                 summaryIndent,
                                                                 detailsIndent,
                                                                 sourceIndent,
-                                                                subdiagsIndent);
+                                                                subdiagsIndent));
                                                         }
                                                     }
                                                 }
@@ -418,15 +443,11 @@
                 }
             }
         }
-        if (nerrors != 0)
-            throw new AssertionError(nerrors + " errors found");
+
+        checkAfterExec(false);
     }
 
-    void printInfo(String msg, OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
-            MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource,
-            XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind,
-            IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent,
-            IndentKind subdiagsIndent, String errorLine) {
+    void printInfo(String msg, String errorLine) {
         String sep = "*********************************************************";
         String desc = "raw=" + outputKind + " pos=" + posKind + " key=" + errorKind.key() +
                 " multiline=" + multiKind +" multiPolicy=" + multiPolicy.value +
@@ -434,18 +455,14 @@
                 " caret=" + caretKind + " sourcePosition=" + sourceLineKind +
                 " summaryIndent=" + summaryIndent + " detailsIndent=" + detailsIndent +
                 " sourceIndent=" + sourceIndent + " subdiagsIndent=" + subdiagsIndent;
-        System.out.println(sep);
-        System.out.println(desc);
-        System.out.println(sep);
-        System.out.println(msg);
-        System.out.println("Diagnostic formatting problem - expected diagnostic...\n" + errorLine);
+        errWriter.println(sep);
+        errWriter.println(desc);
+        errWriter.println(sep);
+        errWriter.println(msg);
+        errWriter.println("Diagnostic formatting problem - expected diagnostic...\n" + errorLine);
     }
 
-    void checkOutput(String msg, OutputKind outputKind, ErrorKind errorKind, MultilineKind multiKind,
-            MultilinePolicy multiPolicy, PositionKind posKind, XDiagsSource xdiagsSource,
-            XDiagsCompact xdiagsCompact, CaretKind caretKind, SourceLineKind sourceLineKind,
-            IndentKind summaryIndent, IndentKind detailsIndent, IndentKind sourceIndent,
-            IndentKind subdiagsIndent) {
+    void checkOutput(String msg) {
         boolean shouldPrintSource = posKind == PositionKind.POS &&
                 xdiagsSource != XDiagsSource.NO_SOURCE &&
                 (xdiagsSource == XDiagsSource.SOURCE ||
@@ -453,7 +470,8 @@
         String errorLine = posKind.getOutput(outputKind) +
                 errorKind.getOutput(outputKind, summaryIndent, detailsIndent);
         if (xdiagsCompact != XDiagsCompact.COMPACT)
-            errorLine += multiKind.getOutput(outputKind, errorKind, multiPolicy, summaryIndent, detailsIndent, subdiagsIndent);
+            errorLine += multiKind.getOutput(outputKind, errorKind, multiPolicy,
+                    summaryIndent, detailsIndent, subdiagsIndent);
         String[] lines = errorLine.split("\n");
         if (xdiagsCompact == XDiagsCompact.COMPACT) {
             errorLine = lines[0];
@@ -474,26 +492,9 @@
         }
 
         if (!msg.equals(errorLine)) {
-            printInfo(msg,
-                    outputKind,
-                    errorKind,
-                    multiKind,
-                    multiPolicy,
-                    posKind,
-                    xdiagsSource,
-                    xdiagsCompact,
-                    caretKind,
-                    sourceLineKind,
-                    summaryIndent,
-                    detailsIndent,
-                    sourceIndent,
-                    subdiagsIndent,
-                    errorLine);
-            nerrors++;
+//            printInfo(msg, errorLine);
+            errCount.incrementAndGet();
         }
     }
 
-    public static void main(String... args) throws Exception {
-        new T6769027().test();
-    }
 }
--- a/test/tools/javac/Diagnostics/6799605/T6799605.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/Diagnostics/6799605/T6799605.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,4 +1,4 @@
-T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.inferred.do.not.conform.to.upper.bounds: compiler.misc.type.captureof: 1, ?, T6799605<compiler.misc.type.captureof: 1, ?>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
+T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.incompatible.eq.upper.bounds: T, compiler.misc.type.captureof: 1, ?, T6799605<T>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
 T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 2, ?, compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T))}
 T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch: T)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.inferred.do.not.conform.to.eq.bounds: compiler.misc.type.captureof: 3, ?, compiler.misc.type.captureof: 3, ?,compiler.misc.type.captureof: 2, ?,compiler.misc.type.captureof: 1, ?))}
 3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/Diagnostics/8010387/T8010387.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,17 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug     8010387
+ * @summary rich diagnostic sometimes contain wrong type variable numbering
+ * @compile/fail/ref=T8010387.out -XDrawDiagnostics -XDdiags=disambiguateTvars,where T8010387.java
+ */
+abstract class T8010387<X> {
+
+    interface F<X> { }
+
+    <P> void test() {
+        m(new F<P>() { });
+    }
+
+
+    abstract <T> T8010387<?> m(F<? extends X> fx);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/Diagnostics/8010387/T8010387.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,3 @@
+T8010387.java:12:9: compiler.err.cant.apply.symbol: kindname.method, m, T8010387.F<? extends X>, compiler.misc.anonymous.class: T8010387.F<P>, kindname.class, T8010387<X>, (compiler.misc.infer.no.conforming.assignment.exists: T, (compiler.misc.inconvertible.types: compiler.misc.anonymous.class: T8010387.F<P>, T8010387.F<? extends X>))
+- compiler.misc.where.description.typevar.1: X,P,T,{(compiler.misc.where.typevar: X, java.lang.Object, kindname.class, T8010387),(compiler.misc.where.typevar: P, java.lang.Object, kindname.method, <P>test()),(compiler.misc.where.typevar: T, java.lang.Object, kindname.method, <T>m(T8010387.F<? extends X>))}
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/ExtDirs/ExtDirTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,176 @@
+/*
+ * 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 4204897 4256097 4785453 4863609
+ * @summary Test that '.jar' files in -extdirs are found.
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main ExtDirTest
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+
+//original test: test/tools/javac/ExtDirs/ExtDirs.sh
+public class ExtDirTest {
+
+    private static final String ExtDirTestClass1Src =
+        "package pkg1;\n" +
+        "\n" +
+        "public class ExtDirTestClass1 {}";
+
+    private static final String ExtDirTestClass2Src =
+        "package pkg2;\n" +
+        "\n" +
+        "public class ExtDirTestClass2 {}";
+
+    private static final String ExtDirTest_1Src =
+        "import pkg1.*;\n" +
+        "\n" +
+        "public class ExtDirTest_1 {\n" +
+        "  ExtDirTestClass1 x;\n" +
+        "}";
+
+    private static final String ExtDirTest_2Src =
+        "import pkg1.*;\n" +
+        "import pkg2.*;\n" +
+        "\n" +
+        "public class ExtDirTest_2 {\n" +
+        "  ExtDirTestClass1 x;\n" +
+        "  ExtDirTestClass2 y;\n" +
+        "}";
+
+    private static final String ExtDirTest_3Src =
+        "import pkg1.*;\n" +
+        "import pkg2.*;\n" +
+        "\n" +
+        "public class ExtDirTest_3 {\n" +
+        "  ExtDirTestClass1 x;\n" +
+        "  ExtDirTestClass2 y;\n" +
+        "}";
+
+    private static final String jar1Manifest =
+        "Manifest-Version: 1.0\n" +
+        "\n" +
+        "Name: pkg1/ExtDirTestClass1.class\n" +
+        "Digest-Algorithms: SHA MD5 \n" +
+        "SHA-Digest: 9HEcO9LJmND3cvOlq/AbUsbD9S0=\n" +
+        "MD5-Digest: hffPBwfqcUcnEdNv4PXu1Q==\n" +
+        "\n" +
+        "Name: pkg1/ExtDirTestClass1.java\n" +
+        "Digest-Algorithms: SHA MD5 \n" +
+        "SHA-Digest: 2FQVe6w3n2Ma1ACYpe8a988EBU8=\n" +
+        "MD5-Digest: /Ivr4zVI9MSM26NmqWtZpQ==\n";
+
+    private static final String jar2Manifest =
+        "Manifest-Version: 1.0\n" +
+        "\n" +
+        "Name: pkg2/ExtDirTestClass2.class\n" +
+        "Digest-Algorithms: SHA MD5 \n" +
+        "SHA-Digest: elbPaqWf8hjj1+ZkkdW3PGTsilo=\n" +
+        "MD5-Digest: 57Nn0e2t1yEQfu/4kSw8yg==\n" +
+        "\n" +
+        "Name: pkg2/ExtDirTestClass2.java\n" +
+        "Digest-Algorithms: SHA MD5 \n" +
+        "SHA-Digest: ILJOhwHg5US+yuw1Sc1d+Avu628=\n" +
+        "MD5-Digest: j8wnz8wneEcuJ/gjXBBQNA==\n";
+
+    List<String> ouputDirParam = Arrays.asList("-d", ".");
+
+    public static void main(String args[]) throws Exception {
+        new ExtDirTest().run();
+    }
+
+    void run() throws Exception {
+        createJars();
+        compileWithExtDirs();
+    }
+
+    void createJars() throws Exception {
+
+//        for i in 1 2 3; do
+//            if test ! -d ext${i}; then mkdir ext${i}; fi
+//            cp ${TESTSRC}${FS}ext${i}${FS}*.jar ext${i}
+//        done
+        sun.tools.jar.Main jarGenerator =
+                new sun.tools.jar.Main(System.out, System.err, "jar");
+
+        ToolBox.JavaToolArgs javacParams =
+                new ToolBox.JavaToolArgs()
+                .setOptions(ouputDirParam)
+                .setSources(ExtDirTestClass1Src);
+        ToolBox.javac(javacParams);
+
+        ToolBox.writeFile(Paths.get("pkg1", "MANIFEST.MF"), jar1Manifest);
+        jarGenerator.run(new String[] {"cfm", "pkg1.jar", "pkg1/MANIFEST.MF",
+            "pkg1/ExtDirTestClass1.class"});
+
+        javacParams.setSources(ExtDirTestClass2Src);
+        ToolBox.javac(javacParams);
+
+        ToolBox.writeFile(Paths.get("pkg2", "MANIFEST.MF"), jar2Manifest);
+        jarGenerator.run(new String[] {"cfm", "pkg2.jar", "pkg2/MANIFEST.MF",
+            "pkg2/ExtDirTestClass2.class"});
+
+        ToolBox.copyFile(Paths.get("ext1", "pkg1.jar"), Paths.get("pkg1.jar"));
+        ToolBox.copyFile(Paths.get("ext2", "pkg2.jar"), Paths.get("pkg2.jar"));
+        ToolBox.copyFile(Paths.get("ext3", "pkg1.jar"), Paths.get("pkg1.jar"));
+        ToolBox.copyFile(Paths.get("ext3", "pkg2.jar"), Paths.get("pkg2.jar"));
+
+        Files.delete(Paths.get("pkg1.jar"));
+        Files.delete(Paths.get("pkg2.jar"));
+
+        Files.delete(Paths.get("pkg1", "ExtDirTestClass1.class"));
+        Files.delete(Paths.get("pkg1", "MANIFEST.MF"));
+        Files.delete(Paths.get("pkg1"));
+        Files.delete(Paths.get("pkg2", "ExtDirTestClass2.class"));
+        Files.delete(Paths.get("pkg2", "MANIFEST.MF"));
+        Files.delete(Paths.get("pkg2"));
+    }
+
+    void compileWithExtDirs() throws Exception {
+
+//"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1 "${TESTSRC}${FS}ExtDirTest_1.java"
+        ToolBox.JavaToolArgs params =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-d", ".", "-extdirs", "ext1")
+                .setSources(ExtDirTest_1Src);
+        ToolBox.javac(params);
+
+//"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1${PS}ext2 "${TESTSRC}${FS}ExtDirTest_2.java"
+        params.setOptions("-d", ".", "-extdirs", "ext1" + File.pathSeparator + "ext2")
+                .setSources(ExtDirTest_2Src);
+        ToolBox.javac(params);
+
+//"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext3 "${TESTSRC}${FS}ExtDirTest_3.java"
+        params.setOptions("-d", ".", "-extdirs", "ext3")
+                .setSources(ExtDirTest_3Src);
+        ToolBox.javac(params);
+    }
+
+}
--- a/test/tools/javac/ExtDirs/ExtDirTest_1.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 1999, 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 pkg1.*;
-
-public class ExtDirTest_1 {
-  ExtDirTestClass1 x;
-}
--- a/test/tools/javac/ExtDirs/ExtDirTest_2.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1999, 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 pkg1.*;
-import pkg2.*;
-
-public class ExtDirTest_2 {
-  ExtDirTestClass1 x;
-  ExtDirTestClass2 y;
-}
--- a/test/tools/javac/ExtDirs/ExtDirTest_3.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1999, 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 pkg1.*;
-import pkg2.*;
-
-public class ExtDirTest_3 {
-  ExtDirTestClass1 x;
-  ExtDirTestClass2 y;
-}
--- a/test/tools/javac/ExtDirs/ExtDirs.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-
-# @test
-# @bug 4204897 4256097 4785453 4863609
-# @summary Test that '.jar' files in -extdirs are found.
-# @author maddox
-#
-# @run shell/timeout=180 ExtDirs.sh
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    PS=":"
-    FS="/"
-    ;;
-  CYGWIN* )
-    PS=";" # native PS, not Cygwin PS
-    FS="/"
-    ;;
-  Windows* )
-    PS=";"
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-fail() {
-	echo 'FAIL: unexpected result encountered'
-        exit 1
-}
-
-javac="${TESTJAVA}${FS}bin${FS}javac"
-
-for i in 1 2 3; do
-    if test ! -d ext${i}; then mkdir ext${i}; fi
-    cp ${TESTSRC}${FS}ext${i}${FS}*.jar ext${i}
-done
-
-echo "Test 1"
-"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1 "${TESTSRC}${FS}ExtDirTest_1.java"
-if [ $? -ne 0 ] ; then fail ; fi
-
-echo "Test 2"
-"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1${PS}ext2 "${TESTSRC}${FS}ExtDirTest_2.java"
-if [ $? -ne 0 ] ; then fail ; fi
-
-echo "Test 3"
-"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext3 "${TESTSRC}${FS}ExtDirTest_3.java"
-if [ $? -ne 0 ] ; then fail ; fi
-
-echo PASS: all tests gave expected results
-exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/AnnotationTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,54 @@
+/*
+ * 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 8006582
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters AnnotationTest.java
+ * @run main Tester AnnotationTest
+ */
+
+import java.lang.annotation.*;
+
+/** Test that annotations do not interfere with recording of parameter names */
+class AnnotationTest {
+
+    @Repeatable(Annos.class)
+    @interface Anno {
+        Class f() default int.class;
+    }
+
+    @interface Annos { Anno[] value(); String foo() default "hello"; }
+
+    interface I {
+        int m(@Anno @Anno int i, @Anno int ji);
+    }
+
+    public AnnotationTest(@Anno @Anno I i, @Anno int ji) { }
+    public @Anno String foo(@Anno @Anno I i, int ji) { return null; }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/AnonymousClass.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,104 @@
+/*
+ * 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 8006582
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters AnonymousClass.java
+ * @run main Tester AnonymousClass
+ */
+
+class AnonymousClass {
+
+    interface I<T> {
+        T m();
+        T m(T x, T yx);
+    }
+
+    private class Inner implements I<String> {
+        public Inner()  { }
+        public Inner(String arg, String barg)  { }
+        public String m() { return "0"; }
+        public String m(String s, String ts) { return "0"; }
+    }
+
+    public static class Sinner implements I<Long> {
+        public Sinner()  { }
+        public Sinner(Long arg, Long barg)  { }
+        public Long m() { return 0L; }
+        public Long m(Long s, Long ts) { return s + ts; }
+    }
+
+    /** Inner class in constructor context */
+    public AnonymousClass(final Long a, Long ba) {
+        new I<Long>() {
+            public Long m() { return null; }
+            public Long m(Long i, Long ji) { return i + ji; }
+        }.m(a, ba);
+        new Inner() {
+            public String m() { return null; }
+            public String m(String i, String ji) { return i + ji; }
+        }.m(a.toString(), ba.toString());
+        new Inner(a.toString(), ba.toString()) {
+            public String m() { return null; }
+            public String m(String i, String ji) { return i + ji; }
+        }.m(a.toString(), ba.toString());
+        new Sinner() {
+            public Long m() { return null; }
+            public Long m(Long i, Long ji) { return i + ji; }
+        }.m(a, ba);
+        new Sinner(a, ba) {
+            public Long m() { return null; }
+            public Long m(Long i, Long ji) { return i + ji; }
+        }.m(a, ba);
+    }
+
+    /** Inner class in method context */
+    public void foo(final Long a, Long ba) {
+        new I<Long>() {
+            public Long m() { return null; }
+            public Long m(Long i, Long ji) { return i + ji; }
+        }.m(a, ba);
+        new Inner() {
+            public String m() { return null; }
+            public String m(String i, String ji) { return i + ji; }
+        }.m(a.toString(), ba.toString());
+        new Inner(a.toString(), ba.toString()) {
+            public String m() { return null; }
+            public String m(String i, String ji) { return i + ji; }
+        }.m(a.toString(), ba.toString());
+        new Sinner() {
+            public Long m() { return null; }
+            public Long m(Long i, Long ji) { return i + ji; }
+        }.m(a, ba);
+        new Sinner(a, ba) {
+            public Long m() { return null; }
+            public Long m(Long i, Long ji) { return i + ji; }
+        }.m(a, ba);
+    }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/AttributeVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.
+ */
+
+import com.sun.tools.classfile.*;
+
+/**
+ * Trivial {@code Attribute.Visitor} implementation, to make it easy to
+ * write visitors for specific attributes.
+ */
+class AttributeVisitor<R, P> implements Attribute.Visitor<R, P> {
+    public R visitBootstrapMethods(BootstrapMethods_attribute attr, P p) { return null; }
+    public R visitDefault(DefaultAttribute attr, P p) { return null; }
+    public R visitAnnotationDefault(AnnotationDefault_attribute attr, P p) { return null; }
+    public R visitCharacterRangeTable(CharacterRangeTable_attribute attr, P p) { return null; }
+    public R visitCode(Code_attribute attr, P p) { return null; }
+    public R visitCompilationID(CompilationID_attribute attr, P p) { return null; }
+    public R visitConstantValue(ConstantValue_attribute attr, P p) { return null; }
+    public R visitDeprecated(Deprecated_attribute attr, P p) { return null; }
+    public R visitEnclosingMethod(EnclosingMethod_attribute attr, P p) { return null; }
+    public R visitExceptions(Exceptions_attribute attr, P p) { return null; }
+    public R visitInnerClasses(InnerClasses_attribute attr, P p) { return null; }
+    public R visitLineNumberTable(LineNumberTable_attribute attr, P p) { return null; }
+    public R visitLocalVariableTable(LocalVariableTable_attribute attr, P p) { return null; }
+    public R visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr, P p) { return null; }
+    public R visitMethodParameters(MethodParameters_attribute attr, P p) { return null; }
+    public R visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr, P p) { return null; }
+    public R visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, P p) { return null; }
+    public R visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr, P p) { return null; }
+    public R visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr, P p) { return null; }
+    public R visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr, P p) { return null; }
+    public R visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr, P p) { return null; }
+    public R visitSignature(Signature_attribute attr, P p) { return null; }
+    public R visitSourceDebugExtension(SourceDebugExtension_attribute attr, P p) { return null; }
+    public R visitSourceFile(SourceFile_attribute attr, P p) { return null; }
+    public R visitSourceID(SourceID_attribute attr, P p) { return null; }
+    public R visitStackMap(StackMap_attribute attr, P p) { return null; }
+    public R visitStackMapTable(StackMapTable_attribute attr, P p) { return null; }
+    public R visitSynthetic(Synthetic_attribute attr, P p) { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/ClassFileVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,387 @@
+/*
+ * 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 java.io.*;
+import javax.lang.model.element.*;
+import java.util.*;
+
+/**
+ * The {@code ClassFileVisitor} reads a class file using the
+ * {@code com.sun.tools.classfile} library. It iterates over the methods
+ * in a class, and checks MethodParameters attributes against JLS
+ * requirements, as well as assumptions about the javac implementations.
+ * <p>
+ * It enforces the following rules:
+ * <ul>
+ * <li>All non-synthetic methods with arguments must have the
+ * MethodParameters attribute. </li>
+ * <li>At most one MethodParameters attribute per method.</li>
+ * <li>An empty MethodParameters attribute is not allowed (i.e. no
+ * attribute for methods taking no parameters).</li>
+ * <li>The number of recorded parameter names much equal the number
+ * of parameters, including any implicit or synthetic parameters generated
+ * by the compiler.</li>
+ * <li>Although the spec allow recording parameters with no name, the javac
+ * implementation is assumed to record a name for all parameters. That is,
+ * the Methodparameters attribute must record a non-zero, valid constant
+ * pool index for each parameter.</li>
+ * <li>Check presence, expected names (e.g. this$N, $enum$name, ...) and flags
+ * (e.g. ACC_SYNTHETIC, ACC_MANDATED) for compiler generated parameters.</li>
+ * <li>Names of explicit parameters must reflect the names in the Java source.
+ * This is checked by assuming a design pattern where any name is permitted
+ * for the first explicit parameter. For subsequent parameters the following
+ * rule is checked: <i>param[n] == ++param[n-1].charAt(0) + param[n-1]</i>
+ * </ul>
+ */
+class ClassFileVisitor extends Tester.Visitor {
+
+    Tester tester;
+
+    public String cname;
+    public boolean isEnum;
+    public boolean isInterface;
+    public boolean isInner;
+    public boolean isPublic;
+    public boolean isStatic;
+    public boolean isAnon;
+    public ClassFile classFile;
+
+
+    public ClassFileVisitor(Tester tester) {
+        super(tester);
+    }
+
+    public void error(String msg) {
+        super.error("classfile: " + msg);
+    }
+
+    public void warn(String msg) {
+        super.warn("classfile: " + msg);
+    }
+
+    /**
+     * 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 {
+        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;
+        isAnon = false;
+
+        Attribute attr = classFile.getAttribute("InnerClasses");
+        if (attr != null) attr.accept(new InnerClassVisitor(), null);
+        isAnon = isInner & isAnon;
+
+        sb.append(isStatic ? "static " : "")
+            .append(isPublic ? "public " : "")
+            .append(isEnum ? "enum " : isInterface ? "interface " : "class ")
+            .append(cname).append(" -- ")
+            .append(isInner? "inner " : "" )
+            .append(isAnon ?  "anon" : "")
+            .append("\n");;
+
+        for (Method method : classFile.methods) {
+            new MethodVisitor().visitMethod(method, sb);
+        }
+    }
+
+    /**
+     * Used to visit InnerClasses_attribute of a class,
+     * to determne if this class is an local class, and anonymous
+     * inner class or a none-static member class. These types of
+     * classes all have an containing class instances field that
+     * requires an implicit or synthetic constructor argument.
+     */
+    class InnerClassVisitor extends AttributeVisitor<Void, Void> {
+        public Void visitInnerClasses(InnerClasses_attribute iattr, Void v) {
+            try{
+                for (InnerClasses_attribute.Info info : iattr.classes) {
+                    if (info.getInnerClassInfo(classFile.constant_pool) == null) continue;
+                    String in = info.getInnerClassInfo(classFile.constant_pool).getName();
+                    if (in == null || !cname.equals(in)) continue;
+                    isInner = true;
+                    isAnon = null == info.getInnerName(classFile.constant_pool);
+                    isStatic = info.inner_class_access_flags.is(AccessFlags.ACC_STATIC);
+                    break;
+                }
+            } catch(Exception e) {
+                throw new IllegalStateException(e);
+            }
+            return null;
+        }
+    }
+
+    /**
+     * Check the MethodParameters attribute of a method.
+     */
+    class MethodVisitor extends AttributeVisitor<Void, StringBuilder> {
+
+        public String mName;
+        public Descriptor mDesc;
+        public int mParams;
+        public int mAttrs;
+        public int mNumParams;
+        public boolean mSynthetic;
+        public boolean mIsConstructor;
+        public String prefix;
+
+        void visitMethod(Method method, StringBuilder sb) throws Exception {
+
+            mName = method.getName(classFile.constant_pool);
+            mDesc = method.descriptor;
+            mParams =  mDesc.getParameterCount(classFile.constant_pool);
+            mAttrs = method.attributes.attrs.length;
+            mNumParams = -1; // no MethodParameters attribute found
+            mSynthetic = method.access_flags.is(AccessFlags.ACC_SYNTHETIC);
+            mIsConstructor = mName.equals("<init>");
+            prefix = cname + "." + mName + "() - ";
+
+            sb.append(cname).append(".").append(mName).append("(");
+
+            for (Attribute a : method.attributes) {
+                a.accept(this, sb);
+            }
+            if (mNumParams == -1) {
+                if (mSynthetic) {
+                    sb.append("<none>)!!");
+                } else {
+                    sb.append("<none>)");
+                }
+            }
+            sb.append("\n");
+
+            // IMPL: methods with arguments must have a MethodParameters
+            // attribute, except possibly some synthetic methods.
+            if (mNumParams == -1 && mParams > 0 && ! mSynthetic) {
+                error(prefix + "missing MethodParameters attribute");
+            }
+        }
+
+        public Void visitMethodParameters(MethodParameters_attribute mp,
+                                          StringBuilder sb) {
+
+            // SPEC: At most one MethodParameters attribute allowed
+            if (mNumParams != -1) {
+                error(prefix + "Multiple MethodParameters attributes");
+                return null;
+            }
+
+            mNumParams = mp.method_parameter_table_length;
+
+            // SPEC: An empty attribute is not allowed!
+            if (mNumParams == 0) {
+                error(prefix + "0 length MethodParameters attribute");
+                return null;
+            }
+
+            // SPEC: one name per parameter.
+            if (mNumParams != mParams) {
+                error(prefix + "found " + mNumParams +
+                      " parameters, expected " + mParams);
+                return null;
+            }
+
+            // IMPL: Whether MethodParameters attributes will be generated
+            // for some synthetics is unresolved. For now, assume no.
+            if (mSynthetic) {
+                warn(prefix + "synthetic has MethodParameter attribute");
+            }
+
+            String sep = "";
+            String userParam = null;
+            for (int x = 0; x <  mNumParams; x++) {
+
+                // IMPL: Assume all parameters are named, something.
+                int cpi = mp.method_parameter_table[x].name_index;
+                if (cpi == 0) {
+                    error(prefix + "name expected, param[" + x + "]");
+                    return null;
+                }
+
+                // SPEC: a non 0 index, must be valid!
+                String param = null;
+                try {
+                    param = classFile.constant_pool.getUTF8Value(cpi);
+                    sb.append(sep).append(param);
+                    sep = ", ";
+                } catch(ConstantPoolException e) {
+                    error(prefix + "invalid index " + cpi + " for param["
+                          + x + "]");
+                    return null;
+                }
+
+
+                // Check availability, flags and special names
+                int check = checkParam(mp, param, x, sb);
+                if (check < 0) {
+                    return null;
+                }
+
+                // TEST: check test assumptions about parameter name.
+                // Expected names are calculated starting with the
+                // 2nd explicit (user given) parameter.
+                // param[n] == ++param[n-1].charAt(0) + param[n-1]
+                String expect = null;
+                if (userParam != null) {
+                    char c = userParam.charAt(0);
+                    expect =  (++c) + userParam;
+                }
+                if (check > 0) {
+                    userParam = param;
+                }
+                if (expect != null && !param.equals(expect)) {
+                    error(prefix + "param[" + x + "]='"
+                          + param + "' expected '" + expect + "'");
+                    return null;
+                }
+            }
+            if (mSynthetic) {
+                sb.append(")!!");
+            } else {
+                sb.append(")");
+            }
+            return null;
+        }
+
+        /*
+         * Check a parameter for conformity to JLS and javac specific
+         * assumptions.
+         * Return -1, if an error is detected. Otherwise, return 0, if
+         * the parameter is compiler generated, or 1 for an (presumably)
+         * explicitly declared parameter.
+         */
+        int checkParam(MethodParameters_attribute mp, String param, int index,
+                       StringBuilder sb) {
+
+            boolean synthetic = (mp.method_parameter_table[index].flags
+                                 & AccessFlags.ACC_SYNTHETIC) != 0;
+            boolean mandated = (mp.method_parameter_table[index].flags
+                                & AccessFlags.ACC_MANDATED) != 0;
+
+            // Setup expectations for flags and special names
+            String expect = null;
+            boolean allowMandated = false;
+            boolean allowSynthetic = false;
+            if (mSynthetic || synthetic) {
+                // not an implementation gurantee, but okay for now
+                expect = "arg" + index; // default
+            }
+            if (mIsConstructor) {
+                if (isEnum) {
+                    if (index == 0) {
+                        expect = "\\$enum\\$name";
+                        allowSynthetic = true;
+                    } else if(index == 1) {
+                        expect = "\\$enum\\$ordinal";
+                        allowSynthetic = true;
+                    }
+                } else if (index == 0) {
+                    if (isAnon) {
+                        allowMandated = true;
+                        expect = "this\\$[0-n]*";
+                    } else if (isInner && !isStatic) {
+                        allowMandated = true;
+                        if (!isPublic) {
+                            // some but not all non-public inner classes
+                            // have synthetic argument. For now we give
+                            // the test a bit of slack and allow either.
+                            allowSynthetic = true;
+                        }
+                        expect = "this\\$[0-n]*";
+                    }
+                } else if (isAnon) {
+                    // not an implementation gurantee, but okay for now
+                    expect = "x[0-n]*";
+                }
+            } else if (isEnum && mNumParams == 1 && index == 0 && mName.equals("valueOf")) {
+                expect = "name";
+                allowMandated = true;
+            }
+            if (mandated) sb.append("!");
+            if (synthetic) sb.append("!!");
+
+            // IMPL: our rules a somewhat fuzzy, sometimes allowing both mandated
+            // and synthetic. However, a parameters cannot be both.
+            if (mandated && synthetic) {
+                error(prefix + "param[" + index + "] == \"" + param
+                      + "\" ACC_SYNTHETIC and ACC_MANDATED");
+                return -1;
+            }
+            // ... but must be either, if both "allowed".
+            if (!(mandated || synthetic) && allowMandated && allowSynthetic) {
+                error(prefix + "param[" + index + "] == \"" + param
+                      + "\" expected ACC_MANDATED or ACC_SYNTHETIC");
+                return -1;
+            }
+
+            // ... if only one is "allowed", we meant "required".
+            if (!mandated && allowMandated && !allowSynthetic) {
+                error(prefix + "param[" + index + "] == \"" + param
+                      + "\" expected ACC_MANDATED");
+                return -1;
+            }
+            if (!synthetic && !allowMandated && allowSynthetic) {
+                error(prefix + "param[" + index + "] == \"" + param
+                      + "\" expected ACC_SYNTHETIC");
+                return -1;
+            }
+
+            // ... and not "allowed", means prohibited.
+            if (mandated && !allowMandated) {
+                error(prefix + "param[" + index + "] == \"" + param
+                      + "\" unexpected, is ACC_MANDATED");
+                return -1;
+            }
+            if (synthetic && !allowSynthetic) {
+                error(prefix + "param[" + index + "] == \"" + param
+                      + "\" unexpected, is ACC_SYNTHETIC");
+                return -1;
+            }
+
+            // Test special name expectations
+            if (expect != null) {
+                if (param.matches(expect)) {
+                    return 0;
+                }
+                error(prefix + "param[" + index + "]='" + param +
+                      "' expected '" + expect + "'");
+                return -1;
+            }
+
+            // No further checking for synthetic methods.
+            if (mSynthetic) {
+                return 0;
+            }
+
+            // Otherwise, do check test parameter naming convention.
+            return 1;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/Constructors.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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 8006582
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters Constructors.java
+ * @run main Tester Constructors
+ */
+
+public class Constructors {
+    public Constructors() {}
+    Constructors(final Object a, final String... ba) { }
+    protected Constructors(Object a, final Object ba, final String... cba) { }
+    private Constructors(int a, Object ba, final Object cba, final String... dcba) { }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/EnumTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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 8006582 8008658
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters EnumTest.java
+ * @run main Tester EnumTest
+ */
+
+/** Test that parameter names are recorded for enum methods */
+enum EnumTest {
+    E1(0), E2(1, "x"), E3(2, "x", "y"), E4;
+
+    EnumTest() { }
+    EnumTest(int a, String... ba) { }
+    boolean ok(int c, String... dc) { return true; }
+
+    int valueOf(EnumTest A, EnumTest BA) { return 0; }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/InstanceMethods.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,46 @@
+/*
+ * 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 8006582
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters InstanceMethods.java
+ * @run main Tester InstanceMethods
+ */
+
+public class InstanceMethods {
+    public void empty() {}
+    final void def(Object a, final Object ba, final String... cba) { }
+    final public void pub(Object d, final Object ed, final String... fed) { }
+    protected boolean prot(Object g, final Object hg, final String... ihg) { return true; }
+    private boolean priv(Object j, final Object kj, final String... lkj) { return true; }
+    void def(int A, Object BA, final Object CBA, final String... DCBA) { }
+    public void pub(int B, Object CB, final Object DCB, final String... EDCB) { }
+    final protected boolean prot(int C, Object DC, final Object EDC, final String... FEDC) { return true; }
+    final private boolean priv(int D, Object ED, final Object FED, final String... GFED) { return true; }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/LambdaTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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 8006582
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters LambdaTest.java
+ * @run main Tester LambdaTest
+ */
+
+/**
+ * Parameter names are not recorded for lambdas. This test verifies
+ * that there are no MethodParameters attribute for lambdas.
+ */
+class LambdaTest {
+
+    interface I {
+        int m(int x);
+    }
+
+    static int foo(I i) { return i.m(0); }
+
+    static {
+        foo((int x1) -> { return foo((int x2) -> { return x1 + x2; }); });
+    }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/LocalClassTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * 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 8006582 8008658
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters LocalClassTest.java
+ * @run main Tester LocalClassTest
+ */
+
+class LocalClassTest {
+    void foo() {
+        class Local_default_constructor {
+            public void foo() {}
+            public void foo(int m, int nm) {}
+        }
+        class Local_has_constructor {
+            public Local_has_constructor() {}
+            public Local_has_constructor(int a, int ba) {}
+            public void foo() {}
+            public void foo(int m, int nm) {}
+        }
+        new LocalClassTest().foo();
+    }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/MemberClassTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8006582 8008658
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters MemberClassTest.java
+ * @run main Tester MemberClassTest
+ */
+
+class MemberClassTest {
+
+    interface I {
+        Long m();
+        Long m(Long x, Long yx);
+    }
+
+    public class Member implements I {
+        public class Member_Member {
+            public Member_Member() {}
+            public Member_Member(String x, String yx) {}
+        }
+
+        public Member()  { }
+        public Member(Long a, Long ba)  { }
+        public Long m() { return 0L; }
+        public Long m(Long s, Long ts) { return 0L; }
+    }
+
+    static class Static_Member implements I {
+        public class Static_Member_Member {
+            public Static_Member_Member() {}
+            public Static_Member_Member(String x, String yx) {}
+        }
+
+        public static class Static_Member_Static_Member {
+            public Static_Member_Static_Member() {}
+            public Static_Member_Static_Member(String x, String yx) {}
+        }
+        public Static_Member()  { }
+        public Static_Member(Long arg, Long barg)  { }
+        public Long m() { return 0L; }
+        public Long m(Long s, Long ts) { return s + ts; }
+    }
+
+    public MemberClassTest() {
+    }
+    public MemberClassTest(final Long a, Long ba) {
+    }
+
+    public void foo() {
+
+        new I() {
+
+            class Anonymous_Member {
+                public Anonymous_Member() {}
+                public Anonymous_Member(String x, String yx) {}
+            }
+
+            public Long m() { return 0L; }
+            public Long m(Long s, Long ts) { return s + ts; }
+        }.m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/ReflectionVisitor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,270 @@
+/*
+ * 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.*;
+import java.util.*;
+import java.net.*;
+import java.lang.reflect.*;
+
+/**
+ * Test MethodParameter attributs by reflection API
+ */
+public class ReflectionVisitor extends Tester.Visitor {
+
+    public ReflectionVisitor(Tester tester) {
+        super(tester);
+    }
+
+    public void error(String msg) {
+        super.error("reflection: " + msg);
+    }
+
+    public void warn(String msg) {
+        super.warn("reflection: " + msg);
+    }
+
+    boolean isEnum;
+    boolean isInterface;
+    boolean isAnon;
+    boolean isLocal;
+    boolean isMember;
+    boolean isStatic;
+    boolean isPublic;
+    Class clazz;
+    StringBuilder sb;
+
+    /**
+     * Read class using {@code ClassFile}, and generate a list of methods
+     * with parameter names as available in the MethodParameters attribute.
+     */
+    void visitClass(final String cl, final File cfile, final StringBuilder sb)
+        throws Exception {
+
+        this.sb = sb;
+        clazz = Class.forName(cl);
+        isEnum = clazz.isEnum();
+        isInterface = clazz.isInterface();
+        isAnon = clazz.isAnonymousClass();
+        isLocal = clazz.isLocalClass();
+        isMember = clazz.isMemberClass();
+        isStatic = ((clazz.getModifiers() & Modifier.STATIC) != 0);
+        isPublic = ((clazz.getModifiers() & Modifier.PUBLIC) != 0);
+
+        sb.append(isStatic ? "static " : "")
+            .append(isPublic ? "public " : "")
+            .append(isEnum ? "enum " : isInterface ? "interface " : "class ")
+            .append(cl).append(" -- ")
+            .append(isMember? "member " : "" )
+            .append(isLocal? "local " : "" )
+            .append(isAnon ?  "anon" : "")
+            .append("\n");
+
+        for (Constructor c : clazz.getDeclaredConstructors()) {
+            testConstructor(c);
+        }
+
+        for (Method m :clazz.getDeclaredMethods()) {
+
+            testMethod(m);
+        }
+    }
+
+    void testConstructor(Constructor c) {
+
+        String prefix = clazz.getName() + "." + c.getName() + "() - ";
+
+        // Parameters must match parameter types
+        Parameter params[] = c.getParameters();
+        int paramTypes =  c.getParameterTypes().length;
+        if (paramTypes != params.length) {
+            error(prefix + "number of parameter types (" + paramTypes
+                  + ") != number of parameters (" + params.length + ")");
+            return;
+        }
+
+        sb.append(clazz.getName()).append(".").append("<init>").append("(");
+        String sep = "";
+
+        // Some paramters are expected
+        if (params.length < 2 && isEnum) {
+            error(prefix + "enum constuctor, two arguments expected");
+        } else if (params.length < 1 && (isAnon || isLocal ||
+                                         (isMember && !isStatic ))) {
+            error(prefix + "class constuctor,expected implicit argument");
+        }
+
+        int i = -1;
+        String param = null;
+        for (Parameter p : c.getParameters()) {
+            i++;
+            String pname = p.getName();
+            sb.append(sep).append(pname);
+            if (p.isImplicit()) sb.append("!");
+            if (p.isSynthetic()) sb.append("!!");
+            sep = ", ";
+
+            // Set expectations
+            String expect = null;
+            boolean allowImplicit = false;
+            boolean allowSynthetic = false;
+            if (isEnum) {
+                if (i == 0) {
+                    expect = "\\$enum\\$name";
+                    allowSynthetic = true;
+                } else if(i == 1) {
+                    expect = "\\$enum\\$ordinal";
+                    allowSynthetic = true;
+                }
+            } else if (i == 0) {
+                if (isAnon) {
+                    allowImplicit = true;
+                } else if (isLocal) {
+                    allowImplicit = true;
+                    expect = "this\\$[0-n]*";
+                } else if ((isMember && !isStatic)) {
+                    allowImplicit = true;
+                    if (!isPublic) {
+                        // some but not all non-public inner classes
+                        // have synthetic argument. For now we give
+                        // the test a bit of slack and allow either.
+                        allowSynthetic = true;
+                    }
+                    expect = "this\\$[0-n]*";
+                }
+            } else if (isAnon) {
+                // not an implementation gurantee, but okay for now
+                expect = "x[0-n]*";
+            }
+
+            // Check expected flags
+            if (p.isSynthetic() && p.isImplicit()) {
+                error(prefix + "param[" + i + "]='" + pname +
+                      "' both isImplicit() and isSynthetic()");
+                break;
+            }
+            if (allowImplicit && allowSynthetic &&
+                !(p.isSynthetic() || p.isImplicit())) {
+                error(prefix + "param[" + i + "]='" + pname +
+                      "' isImplicit() or isSynthetic() expected");
+                break;
+            }
+
+            if (allowImplicit && !allowSynthetic && !p.isImplicit()) {
+                error(prefix + "param[" + i + "]='" + pname +
+                      "' isImplicit() expected");
+                break;
+            }
+            if (!allowImplicit && allowSynthetic && !p.isSynthetic()) {
+                error(prefix + "param[" + i + "]='" + pname +
+                      "' isSynthetic() expected");
+                break;
+            }
+
+            if (!allowImplicit && p.isImplicit()) {
+                error(prefix + "param[" + i + "]='" + pname +
+                      "' isImplicit() unexpected");
+                break;
+            }
+
+            if (!allowSynthetic && p.isSynthetic()) {
+                error(prefix + "param[" + i + "]='" + pname +
+                      "' isSynthetic() unexpected");
+                break;
+            }
+
+            // Check expected names
+            if (expect != null) {
+                if (pname.matches(expect))  continue;
+                error(prefix + "param[" + i + "]='" + pname +
+                      "' expected '" + expect + "'");
+                break;
+            }
+
+            // Test naming convention for explicit parameters.
+            boolean fidelity = !isAnon;
+            if (param != null && fidelity) {
+                char ch = param.charAt(0);
+                expect =  (++ch) + param;
+            }
+
+            if (pname != null && fidelity) {
+                param = pname;
+            }
+
+            if (expect != null && !expect.equals(pname)) {
+                error(prefix + "param[" + i + "]='" + pname +
+                      "' expected '" + expect + "'");
+                break;
+            }
+        }
+        if  (c.isSynthetic()) {
+            sb.append(")!!\n");
+        } else {
+            sb.append(")\n");
+        }
+    }
+
+    void testMethod(Method m) {
+
+        String prefix = clazz.getName() + "." + m.getName() + "() - ";
+
+        // Parameters must match parameter types
+        int paramTypes =  m.getParameterTypes().length;
+        int params = m.getParameters().length;
+        if (paramTypes != params) {
+            error(prefix + "number of parameter types (" + paramTypes
+                  + ") != number of parameters (" + params + ")");
+            return;
+        }
+
+        sb.append(clazz.getName()).append(".").append(m.getName()).append("(");
+        String sep = "";
+        String param = null;
+        int i = -1;
+        // For methods we expect all parameters to follow
+        // the test-case design pattern, except synthetic methods.
+        for (Parameter p : m.getParameters()) {
+            i++;
+            if (param == null) {
+                param = p.getName();
+                sb.append(sep).append(param);
+            } else  {
+                char c = param.charAt(0);
+                String expect =  m.isSynthetic() ? ("arg" + i) : ((++c) + param);
+                param = p.getName();
+                sb.append(sep).append(param);
+                if (!expect.equals(param)) {
+                    error(prefix + "param[" + i + "]='"
+                          + param + "' expected '" + expect + "'");
+                    break;
+                }
+            }
+            sep = ", ";
+        }
+        if  (m.isSynthetic()) {
+            sb.append(")!!\n");
+        } else {
+            sb.append(")\n");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/StaticMethods.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,46 @@
+/*
+ * 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 8006582
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters StaticMethods.java
+ * @run main Tester StaticMethods
+ */
+
+public class StaticMethods {
+    static public void empty() {}
+    static final void def(Object a, final Object ba, final String... cba) { }
+    static final public void pub(Object d, final Object ed, final String... fed) { }
+    static protected boolean prot(Object g, final Object hg, final String... ihg) { return true; }
+    static private boolean priv(Object j, final Object kj, final String... lkj) { return true; }
+    static void def(int a, Object ba, final Object cba, final String... dcba) { }
+    static public void pub(int a, Object ba, final Object cba , final String... dcba) { }
+    static final protected boolean prot(int aa, Object baa, final Object cbaa, final String... dcbaa) { return true; }
+    static final private boolean priv(int abc, Object babc, final Object cbabc, final String... dcbabc) { return true; }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/Tester.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,162 @@
+/*
+ * 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.*;
+import java.util.*;
+import java.lang.reflect.Constructor;
+
+/**
+ * Test driver for MethodParameters testing.
+ * <p>
+ * The intended use of this driver is to run it, giving the name of
+ * a single class compiled with -parameters as argument. The driver
+ * will test the specified class, and any nested classes it finds.
+ * <p>
+ * Each class is tested in two way. By refelction, and by directly
+ * checking MethodParameters attributes in the classfile. The checking
+ * is done using two visitor classes {@link ClassFileVisitor} and
+ * {@link ReflectionVisitor}.
+ * <p>
+ * The {@code ReflectionVisitor} test logically belongs with library tests.
+ * we wish to reuse the same test-cases, so both test are committed together,
+ * under langtools. The tests, may be duplicated in the jdk repository.
+ */
+public class Tester {
+
+    final static File classesdir = new File(System.getProperty("test.classes", "."));
+
+    /**
+     * The visitor classes that does the actual checking are referenced
+     * statically, to force compilations, without having to reference
+     * them in individual test cases.
+     * <p>
+     * This makes it easy to change the set of visitors, without
+     * complicating the design with dynamic discovery and compilation
+     * of visitor classes.
+     */
+    static final Class visitors[] = {
+        ClassFileVisitor.class,
+        ReflectionVisitor.class
+    };
+
+    /**
+     * 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");
+        }
+        final String pattern = args[0] + ".*\\.class";
+        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");
+            throw new Error(file.getPath() + " not found");
+        }
+
+        new Tester(args[0], files).run();
+    }
+
+    public Tester(String name, File files[]) {
+        this.classname = name;
+        this.files = files;
+    }
+
+    void run() throws Exception {
+
+        // Test with each visitor
+        for (Class<Visitor> vclass : visitors) {
+            try {
+                String vname = vclass.getName();
+                Constructor c = vclass.getConstructor(Tester.class);
+
+                info("\nRun " + vname + " for " + classname + "\n");
+                StringBuilder sb = new StringBuilder();
+                for (File f : files) {
+                    String fname = f.getName();
+                    fname = fname.substring(0, fname.length() - 6);
+                    Visitor v = (Visitor) c.newInstance(this);
+                    try {
+                        v.visitClass(fname, f,  sb);
+                    } catch(Exception e) {
+                        error("Uncaught exception in visitClass()");
+                        e.printStackTrace();
+                    }
+                }
+                info(sb.toString());
+            } catch(ReflectiveOperationException e) {
+                warn("Class " + vclass.getName() + " ignored, not a Visitor");
+                continue;
+            }
+        }
+
+        if(0 != warnings)
+                System.err.println("Test generated " + warnings + " warnings");
+
+        if(0 != errors)
+            throw new Exception("Tester test failed with " +
+                                errors + " errors");
+    }
+
+    abstract static  class Visitor {
+        Tester tester;
+        File classesdir;
+
+        public Visitor(Tester tester) {
+            this.tester = tester;
+        }
+
+        abstract void visitClass(final String classname, final File  cfile,
+                final StringBuilder sb) throws Exception;
+
+        public void error(String msg) {
+            tester.error(msg);
+        }
+
+        public void warn(String msg) {
+            tester.warn(msg);
+        }
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    void warn(String msg) {
+        System.err.println("Warning: " + msg);
+        warnings++;
+    }
+
+    void info(String msg) {
+        System.out.println(msg);
+    }
+
+    int errors;
+    int warnings;
+    String classname;
+    File files[];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParameters/UncommonParamNames.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,68 @@
+/*
+ * 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 8006582
+ * @summary javac should generate method parameters correctly.
+ * @build Tester
+ * @compile -parameters UncommonParamNames.java
+ * @run main Tester UncommonParamNames
+ */
+
+/** Test uncommon parameter names */
+class UncommonParamNames {
+    public UncommonParamNames(int _x) { }
+    public UncommonParamNames(short $1) { }
+    public UncommonParamNames(long \u0061) { }
+    public UncommonParamNames(char zero\u0000zero\u0000) { }
+    public UncommonParamNames(String zero\u0000zero\u0000seven\u0007) { }
+    public UncommonParamNames(Object zero\u0000zero\u0000eight\u0008) { }
+    public UncommonParamNames(Object aLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName,
+                              Object baLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName,
+                              Object cbaLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName) { }
+    public UncommonParamNames(int a, int ba, int cba, int dcba, int edcba, int fedcba, int gfedcba,
+                              int hgfedcba, int ihgfedcba, int jihgfedcba, int kjihgfedcba, int lkjihgfedcba,
+                              int mlkjihgfedcba, int nmlkjihgfedcba, int onmlkjihgfedcba, int ponmlkjihgfedcba,
+                              int qponmlkjihgfedcba, int rqponmlkjihgfedcba, int srqponmlkjihgfedcba,
+                              int tsrqponmlkjihgfedcba, int utsrqponmlkjihgfedcba, int vutsrqponmlkjihgfedcba,
+                              int wvutsrqponmlkjihgfedcba, int xwvutsrqponmlkjihgfedcba,
+                              int yxwvutsrqponmlkjihgfedcba, int zyxwvutsrqponmlkjihgfedcba) { }
+
+    public void foo(int _x) { }
+    public void foo(short $1) { }
+    public void foo(long \u0061) { }
+    public void foo(char zero\u0000zero\u0000) { }
+    public void foo(String zero\u0000zero\u0000seven\u0007) { }
+    public void foo(Object zero\u0000zero\u0000eight\u0008) { }
+    public void foo(Object aLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName,
+                    Object baLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName,
+                    Object cbaLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName) { }
+    public void foo(int a, int ba, int cba, int dcba, int edcba, int fedcba, int gfedcba,
+                    int hgfedcba, int ihgfedcba, int jihgfedcba, int kjihgfedcba, int lkjihgfedcba,
+                    int mlkjihgfedcba, int nmlkjihgfedcba, int onmlkjihgfedcba, int ponmlkjihgfedcba,
+                    int qponmlkjihgfedcba, int rqponmlkjihgfedcba, int srqponmlkjihgfedcba,
+                    int tsrqponmlkjihgfedcba, int utsrqponmlkjihgfedcba, int vutsrqponmlkjihgfedcba,
+                    int wvutsrqponmlkjihgfedcba, int xwvutsrqponmlkjihgfedcba,
+                    int yxwvutsrqponmlkjihgfedcba, int zyxwvutsrqponmlkjihgfedcba) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MethodParametersTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,344 @@
+/*
+ * 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
+ * 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 8004727
+ * @summary javac should generate method parameters correctly.
+ */
+// key: opt.arg.parameters
+import com.sun.tools.classfile.*;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.main.Main;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Names;
+import java.io.*;
+import javax.lang.model.element.*;
+import java.util.*;
+
+public class MethodParametersTest {
+
+    static final String Foo_name = "Foo";
+    static final String Foo_contents =
+        "public class Foo {\n" +
+        "  Foo() {}\n" +
+        "  void foo0() {}\n" +
+        "  void foo2(int j, int k) {}\n" +
+        "}";
+    static final String Bar_name = "Bar";
+    static final String Bar_contents =
+        "public class Bar {\n" +
+        "  Bar(int i) {}" +
+        "  Foo foo() { return new Foo(); }\n" +
+        "}";
+    static final String Baz_name = "Baz";
+    static final String Baz_contents =
+        "public class Baz {\n" +
+        "  int baz;" +
+        "  Baz(int i) {}" +
+        "}";
+    static final String Qux_name = "Qux";
+    static final String Qux_contents =
+        "public class Qux extends Baz {\n" +
+        "  Qux(int i) { super(i); }" +
+        "}";
+    static final File classesdir = new File("methodparameters");
+
+    public static void main(String... args) throws Exception {
+        new MethodParametersTest().run();
+    }
+
+    void run() throws Exception {
+        classesdir.mkdir();
+        final File Foo_java =
+            writeFile(classesdir, Foo_name + ".java", Foo_contents);
+        final File Bar_java =
+            writeFile(classesdir, Bar_name + ".java", Bar_contents);
+        final File Baz_java =
+            writeFile(classesdir, Baz_name + ".java", Baz_contents);
+        System.err.println("Test compile with -parameter");
+        compile("-parameters", "-d", classesdir.getPath(), Foo_java.getPath());
+        // First test: make sure javac doesn't choke to death on
+        // MethodParameter attributes
+        System.err.println("Test compile with classfile containing MethodParameter attributes");
+        compile("-parameters", "-d", classesdir.getPath(),
+                "-cp", classesdir.getPath(), Bar_java.getPath());
+        System.err.println("Examine class foo");
+        checkFoo();
+        checkBar();
+        System.err.println("Test debug information conflict");
+        compile("-g", "-parameters", "-d", classesdir.getPath(),
+                "-cp", classesdir.getPath(), Baz_java.getPath());
+        System.err.println("Introducing debug information conflict");
+        Baz_java.delete();
+        modifyBaz(false);
+        System.err.println("Checking language model");
+        inspectBaz();
+        System.err.println("Permuting attributes");
+        modifyBaz(true);
+        System.err.println("Checking language model");
+        inspectBaz();
+
+        if(0 != errors)
+            throw new Exception("MethodParameters test failed with " +
+                                errors + " errors");
+    }
+
+    void inspectBaz() throws Exception {
+        final File Qux_java =
+            writeFile(classesdir, Qux_name + ".java", Qux_contents);
+        final String[] args = { "-XDsave-parameter-names", "-d",
+                                classesdir.getPath(),
+                                "-cp", classesdir.getPath(),
+                                Qux_java.getPath() };
+        final StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw);
+
+        // We need to be able to crack open javac and look at its data
+        // structures.  We'll rig up a compiler instance, but keep its
+        // Context, thus allowing us to get at the ClassReader.
+        Context context = new Context();
+        Main comp =  new Main("javac", pw);
+        JavacFileManager.preRegister(context);
+
+        // Compile Qux, which uses Baz.
+        comp.compile(args, context);
+        pw.close();
+        final String out = sw.toString();
+        if (out.length() > 0)
+            System.err.println(out);
+
+        // Now get the class reader, construct a name for Baz, and load it.
+        com.sun.tools.javac.jvm.ClassReader cr =
+            com.sun.tools.javac.jvm.ClassReader.instance(context);
+        Name name = Names.instance(context).fromString(Baz_name);
+
+        // Now walk down the language model and check the name of the
+        // parameter.
+        final Element baz = cr.loadClass(name);
+        for (Element e : baz.getEnclosedElements()) {
+            if (e instanceof ExecutableElement) {
+                final ExecutableElement ee = (ExecutableElement) e;
+                final List<? extends VariableElement> params =
+                    ee.getParameters();
+                if (1 != params.size())
+                    throw new Exception("Classfile Baz badly formed: wrong number of methods");
+                final VariableElement param = params.get(0);
+                if (!param.getSimpleName().contentEquals("baz")) {
+                    errors++;
+                    System.err.println("javac did not correctly resolve the metadata conflict, parameter's name reads as " + param.getSimpleName());
+                } else
+                    System.err.println("javac did correctly resolve the metadata conflict");
+            }
+        }
+    }
+
+    void modifyBaz(boolean flip) throws Exception {
+        final File Baz_class = new File(classesdir, Baz_name + ".class");
+        final ClassFile baz = ClassFile.read(Baz_class);
+        final int ind = baz.constant_pool.getUTF8Index("baz");
+        MethodParameters_attribute mpattr = null;
+        int mpind = 0;
+        Code_attribute cattr = null;
+        int cind = 0;
+
+        // Find the indexes of the MethodParameters and the Code attributes
+        if (baz.methods.length != 1)
+            throw new Exception("Classfile Baz badly formed: wrong number of methods");
+        if (!baz.methods[0].getName(baz.constant_pool).equals("<init>"))
+            throw new Exception("Classfile Baz badly formed: method has name " +
+                                baz.methods[0].getName(baz.constant_pool));
+        for (int i = 0; i < baz.methods[0].attributes.attrs.length; i++) {
+            if (baz.methods[0].attributes.attrs[i] instanceof
+                MethodParameters_attribute) {
+                mpattr = (MethodParameters_attribute)
+                    baz.methods[0].attributes.attrs[i];
+                mpind = i;
+            } else if (baz.methods[0].attributes.attrs[i] instanceof
+                       Code_attribute) {
+                cattr = (Code_attribute) baz.methods[0].attributes.attrs[i];
+                cind = i;
+            }
+        }
+        if (null == mpattr)
+            throw new Exception("Classfile Baz badly formed: no method parameters info");
+        if (null == cattr)
+            throw new Exception("Classfile Baz badly formed: no local variable table");
+
+        int flags = mpattr.method_parameter_table[0].flags;
+
+        // Alter the MethodParameters attribute, changing the name of
+        // the parameter from i to baz.  This requires Black Magic...
+        //
+        // The (well-designed) classfile library (correctly) does not
+        // allow us to mess around with the attribute data structures,
+        // or arbitrarily generate new ones.
+        //
+        // Instead, we install a new subclass of Attribute that
+        // hijacks the Visitor pattern and outputs the sequence of
+        // bytes that we want.  This only works in this particular
+        // instance, because we know we'll only every see one kind of
+        // visitor.
+        //
+        // If anyone ever changes the makeup of the Baz class, or
+        // tries to install some kind of visitor that gets run prior
+        // to serialization, this will break.
+        baz.methods[0].attributes.attrs[mpind] =
+            new Attribute(mpattr.attribute_name_index,
+                          mpattr.attribute_length) {
+                public <R, D> R accept(Visitor<R, D> visitor, D data) {
+                    if (data instanceof ByteArrayOutputStream) {
+                        ByteArrayOutputStream out =
+                            (ByteArrayOutputStream) data;
+                        out.write(1);
+                        out.write((ind >> 8) & 0xff);
+                        out.write(ind & 0xff);
+                        out.write((flags >> 24) & 0xff);
+                        out.write((flags >> 16) & 0xff);
+                        out.write((flags >> 8) & 0xff);
+                        out.write(flags & 0xff);
+                    } else
+                        throw new RuntimeException("Output stream is of type " + data.getClass() + ", which is not handled by this test.  Update the test and it should work.");
+                    return null;
+                }
+            };
+
+        // Flip the code and method attributes.  This is for checking
+        // that order doesn't matter.
+        if (flip) {
+            baz.methods[0].attributes.attrs[mpind] = cattr;
+            baz.methods[0].attributes.attrs[cind] = mpattr;
+        }
+
+        new ClassWriter().write(baz, Baz_class);
+    }
+
+    // Run a bunch of structural tests on foo to make sure it looks right.
+    void checkFoo() throws Exception {
+        final File Foo_class = new File(classesdir, Foo_name + ".class");
+        final ClassFile foo = ClassFile.read(Foo_class);
+        for (int i = 0; i < foo.methods.length; i++) {
+            System.err.println("Examine method Foo." + foo.methods[i].getName(foo.constant_pool));
+            if (foo.methods[i].getName(foo.constant_pool).equals("foo2")) {
+                for (int j = 0; j < foo.methods[i].attributes.attrs.length; j++)
+                    if (foo.methods[i].attributes.attrs[j] instanceof
+                        MethodParameters_attribute) {
+                        MethodParameters_attribute mp =
+                            (MethodParameters_attribute)
+                            foo.methods[i].attributes.attrs[j];
+                        System.err.println("Foo.foo2 should have 2 parameters: j and k");
+                        if (2 != mp.method_parameter_table_length)
+                            error("expected 2 method parameter entries in foo2, got " +
+                                  mp.method_parameter_table_length);
+                        else if (!foo.constant_pool.getUTF8Value(mp.method_parameter_table[0].name_index).equals("j"))
+                            error("expected first parameter to foo2 to be \"j\", got \"" +
+                                  foo.constant_pool.getUTF8Value(mp.method_parameter_table[0].name_index) +
+                                  "\" instead");
+                        else if  (!foo.constant_pool.getUTF8Value(mp.method_parameter_table[1].name_index).equals("k"))
+                            error("expected first parameter to foo2 to be \"k\", got \"" +
+                                  foo.constant_pool.getUTF8Value(mp.method_parameter_table[1].name_index) +
+                                  "\" instead");
+                    }
+            }
+            else if (foo.methods[i].getName(foo.constant_pool).equals("<init>")) {
+                for (int j = 0; j < foo.methods[i].attributes.attrs.length; j++) {
+                    if (foo.methods[i].attributes.attrs[j] instanceof
+                        MethodParameters_attribute)
+                        error("Zero-argument constructor shouldn't have MethodParameters");
+                }
+            }
+            else if (foo.methods[i].getName(foo.constant_pool).equals("foo0")) {
+                for (int j = 0; j < foo.methods[i].attributes.attrs.length; j++)
+                    if (foo.methods[i].attributes.attrs[j] instanceof
+                        MethodParameters_attribute)
+                        error("Zero-argument method shouldn't have MethodParameters");
+            }
+            else
+                error("Unknown method " + foo.methods[i].getName(foo.constant_pool) + " showed up in class Foo");
+        }
+    }
+
+    // Run a bunch of structural tests on Bar to make sure it looks right.
+    void checkBar() throws Exception {
+        final File Bar_class = new File(classesdir, Bar_name + ".class");
+        final ClassFile bar = ClassFile.read(Bar_class);
+        for (int i = 0; i < bar.methods.length; i++) {
+            System.err.println("Examine method Bar." + bar.methods[i].getName(bar.constant_pool));
+            if (bar.methods[i].getName(bar.constant_pool).equals("<init>")) {
+                for (int j = 0; j < bar.methods[i].attributes.attrs.length; j++)
+                    if (bar.methods[i].attributes.attrs[j] instanceof
+                        MethodParameters_attribute) {
+                        MethodParameters_attribute mp =
+                            (MethodParameters_attribute)
+                            bar.methods[i].attributes.attrs[j];
+                        System.err.println("Bar constructor should have 1 parameter: i");
+                        if (1 != mp.method_parameter_table_length)
+                            error("expected 1 method parameter entries in constructor, got " +
+                                  mp.method_parameter_table_length);
+                        else if (!bar.constant_pool.getUTF8Value(mp.method_parameter_table[0].name_index).equals("i"))
+                            error("expected first parameter to foo2 to be \"i\", got \"" +
+                                  bar.constant_pool.getUTF8Value(mp.method_parameter_table[0].name_index) +
+                                  "\" instead");
+                    }
+            }
+            else if (bar.methods[i].getName(bar.constant_pool).equals("foo")) {
+                for (int j = 0; j < bar.methods[i].attributes.attrs.length; j++) {
+                    if (bar.methods[i].attributes.attrs[j] instanceof
+                        MethodParameters_attribute)
+                        error("Zero-argument constructor shouldn't have MethodParameters");
+                }
+            }
+        }
+    }
+
+    String compile(String... args) throws Exception {
+        System.err.println("compile: " + Arrays.asList(args));
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(args, pw);
+        pw.close();
+        String out = sw.toString();
+        if (out.length() > 0)
+            System.err.println(out);
+        if (rc != 0)
+            error("compilation failed, rc=" + rc);
+        return out;
+    }
+
+    File writeFile(File dir, String path, String body) throws IOException {
+        File f = new File(dir, path);
+        f.getParentFile().mkdirs();
+        FileWriter out = new FileWriter(f);
+        out.write(body);
+        out.close();
+        return f;
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- a/test/tools/javac/MissingInclude.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, 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 4509051 4785453
- * @summary javac <AT>sourcefiles should catch Exception, when sourcefiles doesn't exist.
- * @author gafter
- *
- * @run shell MissingInclude.sh
- */
-
-class MissingInclude {}
--- a/test/tools/javac/MissingInclude.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2001, 2009, 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.
-#
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | CYGWIN* )
-    FS="/"
-    ;;
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-TMP1=OUTPUT.txt
-
-cp "${TESTSRC}${FS}MissingInclude.java" .
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} @/nonexistent_file MissingInclude.java 2> ${TMP1}
-result=$?
-cat ${TMP1}
-rm ${TMP1}
-
-if [ $result -eq 0 ]
-then
-  echo "Failed"
-  exit 1
-else
-  echo "Passed"
-  exit 0
-fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/MissingInclude/MissingIncludeTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * 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 4509051 4785453
+ * @summary javac <AT>sourcefiles should catch Exception, when sourcefiles
+ * doesn't exist.
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main MissingIncludeTest
+ */
+
+//original test: test/tools/javac/MissingInclude.sh
+public class MissingIncludeTest {
+
+    private static final String MissingIncludeSrc =
+        "class MissingInclude {}";
+
+    public static void main(String[] args) throws Exception {
+        ToolBox.createJavaFileFromSource(MissingIncludeSrc);
+
+//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} @/nonexistent_file MissingInclude.java 2> ${TMP1}
+        ToolBox.JavaToolArgs params =
+                new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
+                .setAllArgs("@/nonexistent_file", "MissingInclude.java");
+        ToolBox.javac(params);
+    }
+
+}
--- a/test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-#
-# Copyright (c) 1998, 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 4087314 4800342
-# @summary Verify allowed access to protected class from another package.
-# @author William Maddox (maddox)
-#
-# @run shell ProtectedInnerClass.sh
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    PS=":"
-    FS="/"
-    ;;
-  CYGWIN* ) 
-    PS=";" # native PS, not Cygwin PS
-    FS="/"
-    ;;
-  Windows* )
-    PS=";"
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-rm -f ${TESTCLASSES}${FS}p1${FS}*.class ${TESTCLASSES}${FS}p2${FS}*.class
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" "${TESTSRC}${FS}p1${FS}ProtectedInnerClass1.java" "${TESTSRC}${FS}p2${FS}ProtectedInnerClass2.java"
-"${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -classpath "${CLASSPATH}${PS}${TESTCLASSES}" p2.ProtectedInnerClass2
-result=$?
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- a/test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2000, 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 4307565
- * @summary Verify that access to inaccessable protected inner class is rejected.
- * @author William Maddox (maddox)
- *
- * @run compile p1/ProtectedInnerClass1.java
- * @run compile/fail p2/ProtectedInnerClass3.java
- */
-class Dummy {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/ProtectedInnerClass/ProtectedInnerClassesTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,118 @@
+/*
+ * 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 4087314 4800342 4307565
+ * @summary Verify allowed access to protected class from another package
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main ProtectedInnerClassesTest
+ */
+
+//original tests: test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh
+//and test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java
+public class ProtectedInnerClassesTest {
+
+    private static final String protectedInnerClass1Src =
+        "package p1;\n" +
+        "\n" +
+        "public class ProtectedInnerClass1 {\n" +
+        "    protected class Foo {\n" +
+        "        public String getBar() { return \"bar\"; }\n" +
+        "    }\n" +
+        "}";
+
+    private static final String protectedInnerClass2Src =
+        "package p2;\n" +
+        "\n" +
+        "public class ProtectedInnerClass2 extends p1.ProtectedInnerClass1\n" +
+        "{\n" +
+        "    class Bug extends Foo {\n" +
+        "        String getBug() { return getBar(); }\n" +
+        "    }\n" +
+        "\n" +
+        "    public static void main(String[] args) {\n" +
+        "        ProtectedInnerClass2 x = new ProtectedInnerClass2();\n" +
+        "        Bug y = x.new Bug();\n" +
+        "        System.out.println(y.getBug());\n" +
+        "    }\n" +
+        "}";
+
+    private static final String protectedInnerClass3Src =
+        "package p2;\n" +
+        "\n" +
+        "public class ProtectedInnerClass3 {\n" +
+        "\n" +
+        "  void test() {\n" +
+        "    p1.ProtectedInnerClass1.Foo x;\n" +
+        "  }\n" +
+        "\n" +
+        "}";
+
+    public static void main(String args[]) throws Exception {
+        new ProtectedInnerClassesTest().run();
+    }
+
+    void run() throws Exception {
+        compileAndExecute();
+        compileOnly();
+    }
+
+    void compileAndExecute() throws Exception {
+//"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" "${TESTSRC}${FS}p1${FS}ProtectedInnerClass1.java" "${TESTSRC}${FS}p2${FS}ProtectedInnerClass2.java"
+        ToolBox.JavaToolArgs javacParams =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-d", ".")
+                .setSources(protectedInnerClass1Src, protectedInnerClass2Src);
+
+        ToolBox.javac(javacParams);
+
+//"${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -classpath "${CLASSPATH}${PS}${TESTCLASSES}" p2.ProtectedInnerClass2
+        ToolBox.AnyToolArgs javaParams =
+                new ToolBox.AnyToolArgs()
+                .appendArgs(ToolBox.javaBinary)
+                .appendArgs(ToolBox.testVMOpts)
+                .appendArgs("-classpath", System.getProperty("user.dir"),
+                    "p2.ProtectedInnerClass2");
+        ToolBox.executeCommand(javaParams);
+    }
+
+//from test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java
+    void compileOnly() throws Exception {
+//@run compile p1/ProtectedInnerClass1.java
+        ToolBox.JavaToolArgs javacParams =
+                new ToolBox.JavaToolArgs()
+                .appendArgs("-d", ".")
+                .setSources(protectedInnerClass1Src);
+
+        ToolBox.javac(javacParams);
+
+//@run compile/fail p2/ProtectedInnerClass3.java
+        javacParams = new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs("-d", ".")
+                .setSources(protectedInnerClass3Src);
+        ToolBox.javac(javacParams);
+    }
+
+}
--- a/test/tools/javac/ProtectedInnerClass/p1/ProtectedInnerClass1.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1997, 2000, 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.
- */
-
-/*
- * Auxiliary file for test for 4087314.
- * Verify allowed access to protected class from another package.
- * This file must be compiled prior to compiling p2.ProtectedInnerClass2.
- * It is that compilation that will either succeed or fail.
- */
-
-package p1;
-
-public class ProtectedInnerClass1 {
-    protected class Foo {
-        public String getBar() { return "bar"; }
-    }
-}
--- a/test/tools/javac/ProtectedInnerClass/p2/ProtectedInnerClass2.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1997, 2000, 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.
- */
-
-/*
- * Auxiliary file for test for 4087314.
- * Verify allowed access to protected class from another package.
- *
- * This file should compile and run successfully.
- * Note that class p1.ProtectedInnerClass1 must be compiled first.
- */
-
-package p2;
-
-public class ProtectedInnerClass2 extends p1.ProtectedInnerClass1
-{
-    class Bug extends Foo {
-        String getBug() { return getBar(); }
-    }
-
-    public static void main(String[] args) {
-        ProtectedInnerClass2 x = new ProtectedInnerClass2();
-        Bug y = x.new Bug();
-        System.out.println(y.getBug());
-    }
-}
--- a/test/tools/javac/ProtectedInnerClass/p2/ProtectedInnerClass3.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- */
-
-/*
- * Auxiliary file for ProtectedInnerClass_2.java (bugid 4307565)
- */
-
-package p2;
-
-public class ProtectedInnerClass3 {
-
-  void test() {
-    p1.ProtectedInnerClass1.Foo x;
-  }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T5053846/MethodRefDupInConstantPoolTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 5053846
+ * @summary javac: MethodRef entries are duplicated in the constant pool
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Paths;
+import java.util.*;
+
+public class MethodRefDupInConstantPoolTest {
+
+    private static final String methodToLookFor =
+            "java/util/Vector.iterator:()Ljava/util/Iterator;";
+
+    public static void main(String[] args) {
+        new MethodRefDupInConstantPoolTest().run();
+    }
+
+    void run() {
+        check("-v", Paths.get(System.getProperty("test.classes"),
+                "TestHelper1.class").toString());
+        check("-v", Paths.get(System.getProperty("test.classes"),
+                "TestHelper2.class").toString());
+    }
+
+    void check(String... params) {
+        StringWriter s;
+        String out;
+        try (PrintWriter pw = new PrintWriter(s = new StringWriter())) {
+            com.sun.tools.javap.Main.run(params, pw);
+            out = s.toString();
+        }
+        String constantPool = getConstantPool(out);
+        if (constantPool.indexOf(methodToLookFor) !=
+                constantPool.lastIndexOf(methodToLookFor)) {
+            throw new AssertionError("There is more than one entry for the method seek "  +
+                    methodToLookFor);
+        }
+    }
+
+    String getConstantPool(String out) {
+        int start = out.indexOf("Constant pool:");
+        int end = out.indexOf("{");
+        return out.substring(start, end);
+    }
+}
+
+class TestHelper1 {
+    void m() {
+        Vector v = new Vector();
+        Iterator iter = v.iterator();
+        while (iter.hasNext()) {
+            Object o = iter.next();
+            Object o2 = o;
+        }
+        for (Object o: v) {
+            Object o2 = o;
+        }
+    }
+}
+
+class TestHelper2<X extends Number & Iterable<String>> {
+    void test(X x) {
+        for (String s : x) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T5090006/AssertionFailureTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,69 @@
+/*
+ * 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 5090006
+ * @summary javac fails with assertion error
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main AssertionFailureTest
+ */
+
+import java.io.File;
+import java.nio.file.Paths;
+
+//original test: test/tools/javac/T5090006/compiler.sh
+public class AssertionFailureTest {
+
+    private static final String testSrc =
+        "import stub_tie_gen.wsdl_hello_lit.client.*;\n" +
+        "import junit.framework.*;\n" +
+        "import testutil.ClientServerTestUtil;\n" +
+        "\n" +
+        "public class Test {\n" +
+        "\n" +
+        "    void getStub() throws Exception {\n" +
+        "        Hello_PortType_Stub x = null;\n" +
+        "        new ClientServerTestUtil().setTransport(x, null, null, null);\n" +
+        "    }\n" +
+        "\n" +
+        "    public static void main(String[] args) {\n" +
+        "        System.out.println(\"FISK\");\n" +
+        "    }\n" +
+        "}";
+
+    public static void main(String args[]) throws Exception {
+        String classpath = Paths.get(System.getProperty("test.src"), "broken.jar")
+                .toString();
+        classpath = new StringBuilder(classpath)
+                .append(File.pathSeparator).append(".").toString();
+//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -verbose -d "${TESTCLASSES}" -cp "${TESTSRC}${FS}broken.jar" "${TESTSRC}${FS}$1"
+        ToolBox.JavaToolArgs params =
+                new ToolBox.JavaToolArgs()
+                .setOptions("-cp", classpath)
+                .setSources(testSrc);
+        ToolBox.javac(params);
+    }
+
+}
--- a/test/tools/javac/T5090006/T5090006.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2004, 2006, 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 5090006
- * @summary javac fails with assertion error
- * @author Peter von der Ah\u00e9
- * @run shell compiler.sh T5090006.java
- * @run main T5090006
- */
-
-import stub_tie_gen.wsdl_hello_lit.client.*;
-import junit.framework.*;
-import testutil.ClientServerTestUtil;
-
-public class T5090006 {
-
-    void getStub() throws Exception {
-        Hello_PortType_Stub x = null;
-        new ClientServerTestUtil().setTransport(x, null, null, null);
-    }
-
-    public static void main(String[] args) {
-        System.out.println("FISK");
-    }
-}
--- a/test/tools/javac/T5090006/compiler.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 2009, 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.
-#
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | CYGWIN* )
-    FS="/"
-    ;;
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -verbose -d "${TESTCLASSES}" -cp "${TESTSRC}${FS}broken.jar" "${TESTSRC}${FS}$1"
-
-result=$?
-
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T6181889/EmptyFinallyTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,67 @@
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Paths;
+
+/*
+ * 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 6181889
+ * @summary Empty try/finally results in bytecodes being generated
+ */
+
+public class EmptyFinallyTest {
+    private static final String assertionErrorMsg =
+            "No \"Exception table\" should be generated in this case";
+
+    public static void main(String[] args) {
+        new EmptyFinallyTest().run();
+    }
+
+    void run() {
+        check("-c", Paths.get(System.getProperty("test.classes"),
+                "EmptyFinally.class").toString());
+    }
+
+    void check(String... params) {
+        StringWriter s;
+        String out;
+        try (PrintWriter pw = new PrintWriter(s = new StringWriter())) {
+            com.sun.tools.javap.Main.run(params, pw);
+            out = s.toString();
+        }
+        if (out.contains("Exception table")) {
+            throw new AssertionError(assertionErrorMsg);
+        }
+    }
+}
+
+class EmptyFinally {
+    void m() {
+        try {
+            System.out.println("EMPTY TRY!");
+        } finally {}
+    }
+}
--- a/test/tools/javac/T6873845.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/T6873845.java	Tue Jul 02 10:13:00 2013 +0100
@@ -19,8 +19,8 @@
         if (out.contains("sunapi"))
             throw new Exception("unexpected output for -X");
 
-        String warn1 = "T6873845.java:72:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline;
-        String warn2 = "T6873845.java:77:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline;
+        String warn1 = "T6873845.java:73:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline;
+        String warn2 = "T6873845.java:78:9: compiler.warn.sun.proprietary: sun.misc.Unsafe" + newline;
         String note1 = "- compiler.note.sunapi.filename: T6873845.java" + newline;
         String note2 = "- compiler.note.sunapi.recompile" + newline;
 
@@ -52,7 +52,8 @@
         args.add(0, "-XDrawDiagnostics");
         String out = compile(args);
         if (!out.equals(expect))
-            throw new Exception("unexpected output from compiler");
+            throw new Exception("unexpected output from compiler; expected: " + expect +
+                    "\n  found: " + out);
     }
 
     String compile(List<String> args) throws Exception{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T6985181.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010, 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 6985181
+ * @summary Annotations lost from classfile
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class T6985181 {
+    public static void main(String... args) throws Exception{
+        new T6985181().run();
+    }
+
+    public void run() throws Exception {
+        String code = "@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_PARAMETER)\n" +
+                "@interface Simple { }\n" +
+                "interface Test<@Simple T> { }";
+
+        File srcFile = writeFile("Test.java", code);
+        File classesDir = new File("classes");
+        classesDir.mkdirs();
+        compile("-d", classesDir.getPath(), srcFile.getPath());
+        String out = javap(new File(classesDir, srcFile.getName().replace(".java", ".class")));
+        if (!out.contains("RuntimeInvisibleTypeAnnotations"))
+            throw new Exception("RuntimeInvisibleTypeAnnotations not found");
+    }
+
+    void compile(String... args) throws Exception {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(args, pw);
+        pw.close();
+        String out = sw.toString();
+        if (out.length() > 0)
+            System.err.println(out);
+        if (rc != 0)
+            throw new Exception("Compilation failed: rc=" + rc);
+    }
+
+    String javap(File classFile) throws Exception {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String[] args = { "-v", classFile.getPath() };
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        pw.close();
+        String out = sw.toString();
+        if (out.length() > 0)
+            System.err.println(out);
+        if (rc != 0)
+            throw new Exception("javap failed: rc=" + rc);
+        return out;
+    }
+
+    File writeFile(String path, String body) throws IOException {
+        File f = new File(path);
+        FileWriter out = new FileWriter(f);
+        try {
+            out.write(body);
+        } finally {
+            out.close();
+        }
+        return f;
+    }
+}
--- a/test/tools/javac/T7093325.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/T7093325.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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,37 +23,35 @@
 
 /*
  * @test
- * @bug 7093325
+ * @bug 7093325 8006694
  * @summary Redundant entry in bytecode exception table
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm T7093325
  */
 
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
 import com.sun.source.util.JavacTask;
 import com.sun.tools.classfile.Attribute;
 import com.sun.tools.classfile.ClassFile;
 import com.sun.tools.classfile.Code_attribute;
 import com.sun.tools.classfile.ConstantPool.*;
 import com.sun.tools.classfile.Method;
-import com.sun.tools.javac.api.JavacTool;
 
-import java.io.File;
-import java.net.URI;
-import java.util.Arrays;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-
-public class T7093325 {
-
-    /** global decls ***/
-
-    // Create a single file manager and reuse it for each compile to save time.
-    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
-
-    //statistics
-    static int checkCount = 0;
+public class T7093325
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum StatementKind {
         THROW("throw new RuntimeException();", false, false),
@@ -89,7 +87,8 @@
             if (this.ordinal() == 0) {
                 return catchStr;
             } else {
-                return CatchArity.values()[this.ordinal() - 1].catchers() + catchStr;
+                return CatchArity.values()[this.ordinal() - 1].catchers() +
+                        catchStr;
             }
         }
     }
@@ -98,31 +97,36 @@
         for (CatchArity ca : CatchArity.values()) {
             for (StatementKind stmt0 : StatementKind.values()) {
                 if (ca.ordinal() == 0) {
-                    new T7093325(ca, stmt0).compileAndCheck();
+                    pool.execute(new T7093325(ca, stmt0));
                     continue;
                 }
                 for (StatementKind stmt1 : StatementKind.values()) {
                     if (ca.ordinal() == 1) {
-                        new T7093325(ca, stmt0, stmt1).compileAndCheck();
+                        pool.execute(new T7093325(ca, stmt0, stmt1));
                         continue;
                     }
                     for (StatementKind stmt2 : StatementKind.values()) {
                         if (ca.ordinal() == 2) {
-                            new T7093325(ca, stmt0, stmt1, stmt2).compileAndCheck();
+                            pool.execute(new T7093325(ca, stmt0, stmt1, stmt2));
                             continue;
                         }
                         for (StatementKind stmt3 : StatementKind.values()) {
                             if (ca.ordinal() == 3) {
-                                new T7093325(ca, stmt0, stmt1, stmt2, stmt3).compileAndCheck();
+                                pool.execute(
+                                    new T7093325(ca, stmt0, stmt1, stmt2, stmt3));
                                 continue;
                             }
                             for (StatementKind stmt4 : StatementKind.values()) {
                                 if (ca.ordinal() == 4) {
-                                    new T7093325(ca, stmt0, stmt1, stmt2, stmt3, stmt4).compileAndCheck();
+                                    pool.execute(
+                                        new T7093325(ca, stmt0, stmt1,
+                                                     stmt2, stmt3, stmt4));
                                     continue;
                                 }
                                 for (StatementKind stmt5 : StatementKind.values()) {
-                                    new T7093325(ca, stmt0, stmt1, stmt2, stmt3, stmt4, stmt5).compileAndCheck();
+                                    pool.execute(
+                                        new T7093325(ca, stmt0, stmt1, stmt2,
+                                                     stmt3, stmt4, stmt5));
                                 }
                             }
                         }
@@ -131,7 +135,7 @@
             }
         }
 
-        System.out.println("Total checks made: " + checkCount);
+        checkAfterExec();
     }
 
     /** instance decls **/
@@ -144,17 +148,18 @@
         this.stmts = stmts;
     }
 
-    void compileAndCheck() throws Exception {
+    @Override
+    public void run() {
+        int id = checkCount.incrementAndGet();
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
-        JavaSource source = new JavaSource();
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, null,
+        JavaSource source = new JavaSource(id);
+        JavacTask ct = (JavacTask)tool.getTask(null, fm.get(), null,
                 null, null, Arrays.asList(source));
         ct.call();
-        verifyBytecode(source);
+        verifyBytecode(source, id);
     }
 
-    void verifyBytecode(JavaSource source) {
-        checkCount++;
+    void verifyBytecode(JavaSource source, int id) {
         boolean lastInlined = false;
         boolean hasCode = false;
         int gapsCount = 0;
@@ -170,13 +175,12 @@
             gapsCount++;
         }
 
-        //System.out.printf("gaps %d \n %s \n", gapsCount, source.toString());
-
-        File compiledTest = new File("Test.class");
+        File compiledTest = new File(String.format("Test%s.class", id));
         try {
             ClassFile cf = ClassFile.read(compiledTest);
             if (cf == null) {
-                throw new Error("Classfile not found: " + compiledTest.getName());
+                throw new Error("Classfile not found: " +
+                                compiledTest.getName());
             }
 
             Method test_method = null;
@@ -232,7 +236,7 @@
                 "class C extends RuntimeException {} \n" +
                 "class D extends RuntimeException {} \n" +
                 "class E extends RuntimeException {} \n" +
-                "class Test {\n" +
+                "class Test#ID {\n" +
                 "   void test() {\n" +
                 "   try { #S0 } #C finally { System.out.println(); }\n" +
                 "   }\n" +
@@ -240,10 +244,12 @@
 
         String source;
 
-        public JavaSource() {
-            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+        public JavaSource(int id) {
+            super(URI.create(String.format("myfo:/Test%s.java", id)),
+                  JavaFileObject.Kind.SOURCE);
             source = source_template.replace("#C", ca.catchers());
             source = source.replace("#S0", stmts[0].stmt);
+            source = source.replace("#ID", String.valueOf(id));
             for (int i = 1; i < ca.ordinal() + 1; i++) {
                 source = source.replace("#S" + i, stmts[i].stmt);
             }
@@ -259,4 +265,5 @@
             return source;
         }
     }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T8004969.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,103 @@
+/*
+ * 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 8004969
+@summary Lambda deserialization
+
+*/
+
+import java.io.*;
+
+public class T8004969 implements Serializable {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    static String mm(String s) { return "mref" + s; }
+
+    String aField = "aF";
+
+    public static void main(String[] args) throws Exception {
+        (new T8004969()).doit();
+    }
+
+    public void doit() throws Exception {
+        String aLocal = "aL";
+        int anInt = 99;
+
+        try {
+            // Write lambdas out
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutput out = new ObjectOutputStream(baos);
+
+            write(out, z -> "[" + z + "]" );
+            write(out, z -> { String x = z + z; return x + x; } );
+            write(out, T8004969::mm );
+            write(out, z -> (new LSI() { public String convert(String x) { return "*"+x; }} ).convert(z) );
+            write(out, z -> aField + z );
+            write(out, z -> aLocal + z );
+            write(out, z -> z + anInt );
+            out.flush();
+            out.close();
+
+            // Read them back
+            ByteArrayInputStream bais =
+                new ByteArrayInputStream(baos.toByteArray());
+            ObjectInputStream in = new ObjectInputStream(bais);
+            readAssert(in, "[X]");
+            readAssert(in, "XXXX");
+            readAssert(in, "mrefX");
+            readAssert(in, "*X");
+            readAssert(in, "aFX");
+            readAssert(in, "aLX");
+            readAssert(in, "X99");
+            in.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw e;
+        }
+        assertTrue(assertionCount == 7);
+    }
+
+    static void write(ObjectOutput out, LSI lamb) throws IOException {
+        out.writeObject(lamb);
+    }
+
+    static void readAssert(ObjectInputStream in, String expected)  throws IOException, ClassNotFoundException {
+        LSI ls = (LSI) in.readObject();
+        String result = ls.convert("X");
+        System.out.printf("Result: %s\n", result);
+        assertTrue(result.equals(expected));
+    }
+}
+
+interface LSI extends Serializable {
+    String convert(String x);
+}
--- a/test/tools/javac/annotations/6881115/T6881115.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/6881115/T6881115.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,6 @@
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
 /*
  * @test /nodynamiccopyright/
  * @bug     6881115 6976649
@@ -6,15 +9,18 @@
  * @compile/fail/ref=T6881115.out -XDrawDiagnostics T6881115.java
  */
 
+@Target({ElementType.TYPE, ElementType.TYPE_PARAMETER, ElementType.ANNOTATION_TYPE})
 @interface A {
     B b() default @B(b2 = 1, b2 = 2);
     B[] b_arr() default {@B(), @B(b2 = 1, b2 = 2)};
 }
+
 @interface B {
     String b1();
     int b2();
 }
+
 @A(b = @B(b2 = 1, b2 = 2),
    b_arr = {@B(), @B(b2 = 1, b2 = 2)})
-class T6881115</*308 @A(b = @B(b2 = 1, b2 = 2),
-                  b_arr = {@B(), @B(b2 = 1, b2 = 2)})*/ X> {}
+class T6881115<@A(b = @B(b2 = 1, b2 = 2),
+                  b_arr = {@B(), @B(b2 = 1, b2 = 2)}) X> {}
--- a/test/tools/javac/annotations/6881115/T6881115.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/6881115/T6881115.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,11 +1,16 @@
-T6881115.java:10:30: compiler.err.duplicate.annotation.member.value: b2, B
-T6881115.java:10:19: compiler.err.annotation.missing.default.value: B, b1
-T6881115.java:11:26: compiler.err.annotation.missing.default.value.1: B, b1,b2
-T6881115.java:11:43: compiler.err.duplicate.annotation.member.value: b2, B
-T6881115.java:11:32: compiler.err.annotation.missing.default.value: B, b1
-T6881115.java:17:19: compiler.err.duplicate.annotation.member.value: b2, B
-T6881115.java:17:8: compiler.err.annotation.missing.default.value: B, b1
-T6881115.java:18:13: compiler.err.annotation.missing.default.value.1: B, b1,b2
-T6881115.java:18:30: compiler.err.duplicate.annotation.member.value: b2, B
-T6881115.java:18:19: compiler.err.annotation.missing.default.value: B, b1
-10 errors
+T6881115.java:14:30: compiler.err.duplicate.annotation.member.value: b2, B
+T6881115.java:14:19: compiler.err.annotation.missing.default.value: B, b1
+T6881115.java:15:26: compiler.err.annotation.missing.default.value.1: B, b1,b2
+T6881115.java:15:43: compiler.err.duplicate.annotation.member.value: b2, B
+T6881115.java:15:32: compiler.err.annotation.missing.default.value: B, b1
+T6881115.java:23:19: compiler.err.duplicate.annotation.member.value: b2, B
+T6881115.java:23:8: compiler.err.annotation.missing.default.value: B, b1
+T6881115.java:24:13: compiler.err.annotation.missing.default.value.1: B, b1,b2
+T6881115.java:24:30: compiler.err.duplicate.annotation.member.value: b2, B
+T6881115.java:24:19: compiler.err.annotation.missing.default.value: B, b1
+T6881115.java:25:34: compiler.err.duplicate.annotation.member.value: b2, B
+T6881115.java:25:23: compiler.err.annotation.missing.default.value: B, b1
+T6881115.java:26:28: compiler.err.annotation.missing.default.value.1: B, b1,b2
+T6881115.java:26:45: compiler.err.duplicate.annotation.member.value: b2, B
+T6881115.java:26:34: compiler.err.annotation.missing.default.value: B, b1
+15 errors
--- a/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.java	Tue Jul 02 10:13:00 2013 +0100
@@ -6,11 +6,9 @@
  * @compile/fail/ref=BaseAnnoAsContainerAnno.out -XDrawDiagnostics BaseAnnoAsContainerAnno.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(Foo.class)
-@ContainerFor(Foo.class)
+@Repeatable(Foo.class)
 @interface Foo {
     Foo[] value() default {};
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/BaseAnnoAsContainerAnno.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-BaseAnnoAsContainerAnno.java:15:11: compiler.err.cyclic.annotation.element
+BaseAnnoAsContainerAnno.java:13:11: compiler.err.cyclic.annotation.element
 1 error
--- a/test/tools/javac/annotations/repeatingAnnotations/BasicRepeatingAnnotations.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/BasicRepeatingAnnotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -34,10 +34,9 @@
 import java.lang.annotation.*;
 
 @Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @Retention(RetentionPolicy.RUNTIME)
 @interface Foos {
     Foo[] value();
--- a/test/tools/javac/annotations/repeatingAnnotations/CheckTargets.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/CheckTargets.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -32,32 +32,29 @@
 
 import java.lang.annotation.*;
 
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
 @Target(ElementType.TYPE)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @Target(ElementType.ANNOTATION_TYPE)
 @interface Foos {
     Foo[] value();
 }
 
-@ContainedBy(Bars.class)
+@Repeatable(Bars.class)
 @Target(ElementType.TYPE)
 @interface Bar {}
 
-@ContainerFor(Bar.class)
 @Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE })
 @interface Bars {
     Bar[] value();
 }
 
 
-@ContainedBy(Bazs.class)
+@Repeatable(Bazs.class)
 @Target({ ElementType.TYPE, ElementType.ANNOTATION_TYPE })
 @interface Baz {}
 
-@ContainerFor(Baz.class)
 @Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE })
 @interface Bazs {
     Baz[] value();
--- a/test/tools/javac/annotations/repeatingAnnotations/ClassReaderDefault.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/ClassReaderDefault.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -30,17 +30,15 @@
  * @compile ClassReaderDefault.java
  * @compile SeparateCompile.java
  */
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
 public class ClassReaderDefault {
 }
 
-@ContainerFor(Foo.class)
 @interface FooContainer {
      Foo[] value();
      int f() default 0;
 }
 
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {}
--- a/test/tools/javac/annotations/repeatingAnnotations/ContainerHasRepeatedContained.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/ContainerHasRepeatedContained.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -30,15 +30,13 @@
  * @run compile ContainerHasRepeatedContained.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(BarContainer.class)
+@Repeatable(BarContainer.class)
 @interface Bar {}
 
 @Bar
 @Bar
-@ContainerFor(Bar.class)
 @interface BarContainer {
     Bar[] value();
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -6,17 +6,14 @@
  * @compile/fail/ref=CyclicAnnotation.out -XDrawDiagnostics CyclicAnnotation.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(Foo.class)
-@ContainerFor(Baz.class)
+@Repeatable(Foo.class)
 @interface Baz {
     Foo[] value() default {};
 }
 
-@ContainedBy(Baz.class)
-@ContainerFor(Foo.class)
+@Repeatable(Baz.class)
 @interface Foo{
     Baz[] value() default {};
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/CyclicAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,6 +1,2 @@
-CyclicAnnotation.java:12:1: compiler.err.invalid.container.wrong.containerfor: Foo, Baz
-CyclicAnnotation.java:13:1: compiler.err.invalid.container.wrong.containedby: Foo, Baz
-CyclicAnnotation.java:15:11: compiler.err.cyclic.annotation.element
-CyclicAnnotation.java:18:1: compiler.err.invalid.container.wrong.containerfor: Baz, Foo
-CyclicAnnotation.java:19:1: compiler.err.invalid.container.wrong.containedby: Baz, Foo
-5 errors
+CyclicAnnotation.java:13:11: compiler.err.cyclic.annotation.element
+1 error
--- a/test/tools/javac/annotations/repeatingAnnotations/DefaultCasePresent.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/DefaultCasePresent.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -29,13 +29,11 @@
  * @compile DefaultCasePresent.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @interface FooContainer {
     Foo[] value();
     String other() default "other-method";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/DefaultTarget.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,47 @@
+/*
+ * 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.lang.annotation.*;
+
+/**
+ * @test
+ * @bug 8006547
+ * @compile DefaultTarget.java
+ */
+
+@Target({
+    ElementType.CONSTRUCTOR,
+    ElementType.PARAMETER,
+    ElementType.TYPE,
+    ElementType.METHOD,
+    ElementType.LOCAL_VARIABLE,
+    ElementType.PACKAGE,
+    ElementType.ANNOTATION_TYPE,
+    ElementType.FIELD,
+})
+@interface Container {
+  DefaultTarget[] value();
+}
+
+@Repeatable(Container.class)
+public @interface DefaultTarget {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/DefaultTargetTypeParameter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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.lang.annotation.*;
+
+/**
+ * @test
+ * @bug 8006547
+ * @compile/fail/ref=DefaultTargetTypeParameter.out -XDrawDiagnostics DefaultTargetTypeParameter.java
+ */
+
+@Target({
+    ElementType.TYPE_PARAMETER,
+})
+@interface Container {
+  DefaultTargetTypeParameter[] value();
+}
+
+@Repeatable(Container.class)
+public @interface DefaultTargetTypeParameter {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/DefaultTargetTypeParameter.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DefaultTargetTypeParameter.java:39:1: compiler.err.invalid.repeatable.annotation.incompatible.target: Container, DefaultTargetTypeParameter
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/DefaultTargetTypeUse.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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.lang.annotation.*;
+
+/**
+ * @test
+ * @bug 8006547
+ * @compile/fail/ref=DefaultTargetTypeUse.out -XDrawDiagnostics DefaultTargetTypeUse.java
+ */
+
+@Target({
+    ElementType.TYPE_USE,
+})
+@interface Container {
+  DefaultTargetTypeUse[] value();
+}
+
+@Repeatable(Container.class)
+public @interface DefaultTargetTypeUse {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/DefaultTargetTypeUse.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DefaultTargetTypeUse.java:39:1: compiler.err.invalid.repeatable.annotation.incompatible.target: Container, DefaultTargetTypeUse
+1 error
--- a/test/tools/javac/annotations/repeatingAnnotations/DelayRepeatedContainer.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/DelayRepeatedContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -39,12 +39,11 @@
 
 @Bar("katt")
 @Bar("lol")
-@ContainedBy(BarContainer.class)
+@Repeatable(BarContainer.class)
 @interface Bar {
     String value();
 }
 
-@ContainerFor(Bar.class)
 @interface BarContainer {
     Bar[] value();
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/DocumentedContainerAnno.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/DocumentedContainerAnno.java	Tue Jul 02 10:13:00 2013 +0100
@@ -6,15 +6,13 @@
  * @compile/fail/ref=DocumentedContainerAnno.out -XDrawDiagnostics DocumentedContainerAnno.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 import java.lang.annotation.Documented;
 
 @Documented
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @interface FooContainer{
     Foo[] value();
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/DocumentedContainerAnno.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/DocumentedContainerAnno.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-DocumentedContainerAnno.java:14:1: compiler.err.invalid.containedby.annotation.not.documented: FooContainer, Foo
+DocumentedContainerAnno.java:13:1: compiler.err.invalid.repeatable.annotation.not.documented: FooContainer, Foo
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/DuplicateErrors.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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 7196531
+ * @compile/fail/ref=DuplicateErrors.out  -XDrawDiagnostics DuplicateErrors.java
+ */
+
+
+@interface Foo {}
+
+@Foo
+@Foo
+@Foo
+public class DuplicateErrors {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/DuplicateErrors.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,3 @@
+DuplicateErrors.java:34:1: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.Repeatable
+DuplicateErrors.java:35:1: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.Repeatable
+2 errors
--- a/test/tools/javac/annotations/repeatingAnnotations/InheritedContainerAnno.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/InheritedContainerAnno.java	Tue Jul 02 10:13:00 2013 +0100
@@ -6,15 +6,13 @@
  * @compile/fail/ref=InheritedContainerAnno.out -XDrawDiagnostics InheritedContainerAnno.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 import java.lang.annotation.Inherited;
 
 @Inherited
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @interface FooContainer{
     Foo[] value();
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/InheritedContainerAnno.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/InheritedContainerAnno.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-InheritedContainerAnno.java:14:1: compiler.err.invalid.containedby.annotation.not.inherited: FooContainer, Foo
+InheritedContainerAnno.java:13:1: compiler.err.invalid.repeatable.annotation.not.inherited: FooContainer, Foo
 1 error
--- a/test/tools/javac/annotations/repeatingAnnotations/InvalidTarget.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/InvalidTarget.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -32,11 +32,10 @@
 
 import java.lang.annotation.*;
 
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
 @Target(ElementType.ANNOTATION_TYPE)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @Target(ElementType.TYPE)
 @interface Foos {
     Foo[] value();
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingContainedBy.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * 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
- * @summary Smoke test for repeating annotations
- * @compile/fail MissingContainedBy.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-
-@ContainerFor(MissingContainedBy.class)
-@interface Foos {
-    MissingContainedBy[] value();
-}
-
-public @interface MissingContainedBy {}
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingContainer.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MissingContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,18 +1,16 @@
 /**
  * @test    /nodynamiccopyright/
- * @bug     7169362
+ * @bug     7169362 8001114
  * @author  sogoel
  * @summary ContainerAnnotation does not have FooContainer.class specified
  * @compile/fail/ref=MissingContainer.out -XDrawDiagnostics MissingContainer.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy()
+@Repeatable()
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @interface FooContainer {
     Foo[] value();
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingContainer.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MissingContainer.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,4 @@
-MissingContainer.java:20:1: compiler.err.invalid.containedby.annotation: Foo
-MissingContainer.java:20:6: compiler.err.invalid.containedby.annotation: Foo
-MissingContainer.java:12:1: compiler.err.annotation.missing.default.value: java.lang.annotation.ContainedBy, value
-MissingContainer.java:15:1: compiler.err.invalid.container.wrong.containedby: Foo, FooContainer
-4 errors
+MissingContainer.java:18:1: compiler.err.invalid.repeatable.annotation: Foo
+MissingContainer.java:18:6: compiler.err.invalid.repeatable.annotation: Foo
+MissingContainer.java:11:1: compiler.err.annotation.missing.default.value: java.lang.annotation.Repeatable, value
+3 errors
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingContainerFor.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * 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
- * @summary Smoke test for repeating annotations
- * @compile/fail MissingContainerFor.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@interface Foos {
-    MissingContainerFor[] value();
-}
-
-@ContainedBy(Foos.class)
-public @interface MissingContainerFor {}
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase1.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase1.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,18 +1,16 @@
 /**
  * @test    /nodynamiccopyright/
- * @bug     7169362
+ * @bug     7169362 8001114
  * @author  sogoel
  * @summary Default case not specified for other methods in container annotation
  * @compile/fail/ref=MissingDefaultCase1.out -XDrawDiagnostics MissingDefaultCase1.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @interface FooContainer {
     Foo[] value();
     String other();  // missing default clause
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase1.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase1.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,3 @@
-MissingDefaultCase1.java:21:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
-MissingDefaultCase1.java:12:1: compiler.err.invalid.containedby.annotation.elem.nondefault: FooContainer, other()
+MissingDefaultCase1.java:19:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
+MissingDefaultCase1.java:11:1: compiler.err.invalid.repeatable.annotation.elem.nondefault: FooContainer, other()
 2 errors
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase2.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase2.java	Tue Jul 02 10:13:00 2013 +0100
@@ -6,13 +6,11 @@
  * @compile/fail/ref=MissingDefaultCase2.out -XDrawDiagnostics MissingDefaultCase2.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @interface FooContainer {
     Foo[] value();
     Foo other();  // missing default clause and return type is an annotation
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase2.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MissingDefaultCase2.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,3 @@
-MissingDefaultCase2.java:21:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
-MissingDefaultCase2.java:12:1: compiler.err.invalid.containedby.annotation.elem.nondefault: FooContainer, other()
+MissingDefaultCase2.java:19:1: compiler.err.duplicate.annotation.invalid.repeated: Foo
+MissingDefaultCase2.java:11:1: compiler.err.invalid.repeatable.annotation.elem.nondefault: FooContainer, other()
 2 errors
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingValueMethod.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MissingValueMethod.java	Tue Jul 02 10:13:00 2013 +0100
@@ -6,13 +6,11 @@
  * @compile/fail/ref=MissingValueMethod.out -XDrawDiagnostics MissingValueMethod.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @interface FooContainer{
     Foo[] values();  // wrong method name
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/MissingValueMethod.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MissingValueMethod.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,4 +1,4 @@
-MissingValueMethod.java:20:1: compiler.err.invalid.containedby.annotation.no.value: FooContainer
-MissingValueMethod.java:20:6: compiler.err.invalid.containedby.annotation.no.value: FooContainer
-MissingValueMethod.java:12:1: compiler.err.invalid.containedby.annotation.elem.nondefault: FooContainer, values()
+MissingValueMethod.java:18:1: compiler.err.invalid.repeatable.annotation.no.value: FooContainer
+MissingValueMethod.java:18:6: compiler.err.invalid.repeatable.annotation.no.value: FooContainer
+MissingValueMethod.java:11:1: compiler.err.invalid.repeatable.annotation.no.value: FooContainer
 3 errors
--- a/test/tools/javac/annotations/repeatingAnnotations/MultiLevelRepeatableAnno.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MultiLevelRepeatableAnno.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -29,19 +29,16 @@
  * @compile MultiLevelRepeatableAnno.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {}
 
-@ContainedBy(FooContainerContainer.class)
-@ContainerFor(Foo.class)
+@Repeatable(FooContainerContainer.class)
 @interface FooContainer {
     Foo[] value();
 }
 
-@ContainerFor(FooContainer.class)
 @interface FooContainerContainer {
   FooContainer[] value();
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/MultipleAnnoMixedOrder.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/MultipleAnnoMixedOrder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -29,25 +29,22 @@
  * @compile MultipleAnnoMixedOrder.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {
     int getNumbers();
 }
 
-@ContainerFor(Foo.class)
 @interface FooContainer {
   Foo[] value();
 }
 
-@ContainedBy(BazContainer.class)
+@Repeatable(BazContainer.class)
 @interface Baz {
     String getStr();
 }
 
-@ContainerFor(Baz.class)
 @interface BazContainer {
   Baz[] value();
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/NestedContainers.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/NestedContainers.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -34,17 +34,15 @@
 import java.lang.annotation.*;
 
 @Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
 @interface Foo {}
 
 @Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(FoosFoos.class)
-@ContainerFor(Foo.class)
+@Repeatable(FoosFoos.class)
 @interface Foos {
     Foo[] value();
 }
 
-@ContainerFor(Foos.class)
 @Retention(RetentionPolicy.RUNTIME)
 @interface FoosFoos {
     Foos[] value();
--- a/test/tools/javac/annotations/repeatingAnnotations/NoRepeatableAnno.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/NoRepeatableAnno.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,2 @@
-NoRepeatableAnno.java:11:1: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.ContainedBy
-NoRepeatableAnno.java:11:6: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.ContainedBy
-2 errors
+NoRepeatableAnno.java:11:6: compiler.err.duplicate.annotation.missing.container: Foo, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/NoTargetOnContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,49 @@
+/*
+ * 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.lang.annotation.*;
+
+/**
+ * @test
+ * @bug 8006547
+ * @compile NoTargetOnContainer.java
+ */
+
+@interface FooContainer {
+  Foo[] value();
+}
+
+@Target({
+    ElementType.CONSTRUCTOR,
+    ElementType.PARAMETER,
+    ElementType.TYPE,
+    ElementType.METHOD,
+    ElementType.LOCAL_VARIABLE,
+    ElementType.PACKAGE,
+    ElementType.ANNOTATION_TYPE,
+    ElementType.FIELD,
+})
+@Repeatable(FooContainer.class)
+@interface Foo {}
+
+class NoTargetOnContainer {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/NoTargetOnContainer2.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * 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.lang.annotation.*;
+
+/**
+ * @test
+ * @bug 8006547
+ * @compile NoTargetOnContainer2.java
+ */
+
+@interface FooContainer {
+  Foo[] value();
+}
+
+@Target({
+    ElementType.CONSTRUCTOR,
+    ElementType.PARAMETER,
+    ElementType.TYPE,
+    ElementType.METHOD,
+    ElementType.LOCAL_VARIABLE,
+    ElementType.PACKAGE,
+    ElementType.ANNOTATION_TYPE,
+    ElementType.FIELD,
+    ElementType.TYPE_USE,
+    ElementType.TYPE_PARAMETER})
+@Repeatable(FooContainer.class)
+@interface Foo {}
+
+class NoTargetOnContainer2 {}
--- a/test/tools/javac/annotations/repeatingAnnotations/RepMemberAnno.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/RepMemberAnno.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -30,20 +30,18 @@
  * @run compile RepMemberAnno.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
 public class RepMemberAnno {
     @Bar("Apa") @Bar("Banan")
     public void meh() {}
 }
 
-@ContainedBy(BarContainer.class)
+@Repeatable(BarContainer.class)
 @interface Bar {
     String value();
 }
 
-@ContainerFor(Bar.class)
 @interface BarContainer {
     Bar[] value();
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/RepSelfMemberAnno.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/RepSelfMemberAnno.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -34,21 +34,19 @@
 
 
 @Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(BarContainer.class)
+@Repeatable(BarContainer.class)
 public @interface RepSelfMemberAnno {
     @RepSelfMemberAnno @RepSelfMemberAnno
     String meh() default "banan";
 }
 
 
-@ContainedBy(BarContainerContainer.class)
+@Repeatable(BarContainerContainer.class)
 @Retention(RetentionPolicy.RUNTIME)
-@ContainerFor(RepSelfMemberAnno.class)
 @interface BarContainer {
     RepSelfMemberAnno[] value();
 }
 
-@ContainerFor(BarContainer.class)
 @Retention(RetentionPolicy.RUNTIME)
 @interface BarContainerContainer {
     BarContainer[] value();
--- a/test/tools/javac/annotations/repeatingAnnotations/RepeatingAndContainerPresent.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/RepeatingAndContainerPresent.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -30,7 +30,7 @@
 
 import java.lang.annotation.*;
 
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
 @interface Foo {}
 
 @interface Foos {
--- a/test/tools/javac/annotations/repeatingAnnotations/RepeatingTargetNotAllowed.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/RepeatingTargetNotAllowed.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -31,10 +31,9 @@
 
 import java.lang.annotation.*;
 
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @Target(ElementType.ANNOTATION_TYPE)
 @interface Foos {
     Foo[] value();
--- a/test/tools/javac/annotations/repeatingAnnotations/RepeatingTargetNotAllowed.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/RepeatingTargetNotAllowed.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-RepeatingTargetNotAllowed.java:44:5: compiler.err.invalid.containedby.annotation.incompatible.target: Foos, Foo
+RepeatingTargetNotAllowed.java:43:5: compiler.err.invalid.repeatable.annotation.incompatible.target: Foos, Foo
 1 error
--- a/test/tools/javac/annotations/repeatingAnnotations/SelfRepeatingAnnotations.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/SelfRepeatingAnnotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -33,7 +33,6 @@
 
 import java.lang.annotation.*;
 
-@ContainerFor(SelfRepeatingAnno.class)
 @Retention(RetentionPolicy.RUNTIME)
 @interface Foos {
     SelfRepeatingAnno[] value();
@@ -42,7 +41,7 @@
 @SelfRepeatingAnno
 @Retention(RetentionPolicy.RUNTIME)
 @SelfRepeatingAnno
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
 @interface SelfRepeatingAnno {}
 
 public class SelfRepeatingAnnotations {
--- a/test/tools/javac/annotations/repeatingAnnotations/SingleRepeatingAndContainer.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/SingleRepeatingAndContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -30,10 +30,9 @@
 
 import java.lang.annotation.*;
 
-@ContainedBy(Foos.class)
+@Repeatable(Foos.class)
 @interface Foo {}
 
-@ContainerFor(Foo.class)
 @interface Foos {
     Foo[] value();
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/UseWrongContainedBy.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * 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
- * @summary Smoke test for repeating annotations
- * @compile/fail UseWrongContainedBy.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@ContainerFor(UseWrongContainedBy.class)
-@interface Foos {
-    UseWrongContainedBy[] value();
-}
-
-@ContainedBy(Target.class)
-public @interface UseWrongContainedBy {}
-
-@UseWrongContainedBy @UseWrongContainedBy
-@interface Foo {}
--- a/test/tools/javac/annotations/repeatingAnnotations/UseWrongContainerFor.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * 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
- * @summary Smoke test for repeating annotations
- * @compile/fail UseWrongContainerFor.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@ContainerFor(Retention.class)
-@interface Foos {
-    UseWrongContainerFor[] value();
-}
-
-@ContainedBy(Foos.class)
-public @interface UseWrongContainerFor {}
-
-@UseWrongContainerFor @UseWrongContainerFor
-@interface Foo {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/UseWrongRepeatable.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary Smoke test for repeating annotations
+ * @compile/fail UseWrongRepeatable.java
+ * @bug 7151010
+ */
+
+import java.lang.annotation.*;
+
+@interface Foos {
+    UseWrongRepeatable[] value();
+}
+
+@Repeatable(Target.class)
+public @interface UseWrongRepeatable {}
+
+@UseWrongRepeatable @UseWrongRepeatable
+@interface Foo {}
--- a/test/tools/javac/annotations/repeatingAnnotations/WrongContainedBy.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * 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
- * @summary Smoke test for repeating annotations
- * @compile/fail WrongContainedBy.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@ContainerFor(WrongContainedBy.class)
-@interface Foos {
-    WrongContainedBy[] value();
-}
-
-@ContainedBy(Target.class)
-public @interface WrongContainedBy {}
--- a/test/tools/javac/annotations/repeatingAnnotations/WrongContainerFor.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * 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
- * @summary Smoke test for repeating annotations
- * @compile/fail WrongContainerFor.java
- * @bug 7151010
- */
-
-import java.lang.annotation.*;
-
-@ContainerFor(Retention.class)
-@interface Foos {
-    WrongContainerFor[] value();
-}
-
-@ContainedBy(Foos.class)
-public @interface WrongContainerFor {}
--- a/test/tools/javac/annotations/repeatingAnnotations/WrongReturnTypeForValue.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/WrongReturnTypeForValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -6,15 +6,13 @@
  * @compile/fail/ref=WrongReturnTypeForValue.out -XDrawDiagnostics WrongReturnTypeForValue.java
  */
 
-import java.lang.annotation.ContainedBy;
-import java.lang.annotation.ContainerFor;
+import java.lang.annotation.Repeatable;
 
-@ContainedBy(FooContainer.class)
+@Repeatable(FooContainer.class)
 @interface Foo {
     int getNumbers();
 }
 
-@ContainerFor(Foo.class)
 @interface FooContainer{
     Foo value();     // wrong return type
 }
--- a/test/tools/javac/annotations/repeatingAnnotations/WrongReturnTypeForValue.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/WrongReturnTypeForValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,4 @@
-WrongReturnTypeForValue.java:22:1: compiler.err.invalid.containedby.annotation.value.return: FooContainer, Foo, Foo[]
-WrongReturnTypeForValue.java:22:6: compiler.err.invalid.containedby.annotation.value.return: FooContainer, Foo, Foo[]
-2 errors
+WrongReturnTypeForValue.java:20:1: compiler.err.invalid.repeatable.annotation.value.return: FooContainer, Foo, Foo[]
+WrongReturnTypeForValue.java:20:6: compiler.err.invalid.repeatable.annotation.value.return: FooContainer, Foo, Foo[]
+WrongReturnTypeForValue.java:11:1: compiler.err.invalid.repeatable.annotation.value.return: FooContainer, Foo, Foo[]
+3 errors
--- a/test/tools/javac/annotations/repeatingAnnotations/combo/BasicSyntaxCombo.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/BasicSyntaxCombo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -163,9 +163,8 @@
         String replaceStr = "/*"+type+"*/";
         StringBuilder annoData = new StringBuilder();
         annoData.append(Helper.ContentVars.IMPORTCONTAINERSTMTS.getVal())
-                .append(Helper.ContentVars.CONTAINERFOR.getVal())
                 .append(Helper.ContentVars.CONTAINER.getVal())
-                .append(Helper.ContentVars.CONTAINEDBY.getVal())
+                .append(Helper.ContentVars.REPEATABLE.getVal())
                 .append(Helper.ContentVars.BASE.getVal());
 
         JavaFileObject pkgInfoFile = null;
--- a/test/tools/javac/annotations/repeatingAnnotations/combo/DeprecatedAnnoCombo.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/DeprecatedAnnoCombo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -115,24 +115,21 @@
         switch(className) {
         case "DeprecatedonBoth":
             annoData.append(Helper.ContentVars.DEPRECATED.getVal())
-                    .append(Helper.ContentVars.CONTAINERFOR.getVal())
                     .append(Helper.ContentVars.CONTAINER.getVal())
                     .append(Helper.ContentVars.DEPRECATED.getVal())
-                    .append(Helper.ContentVars.CONTAINEDBY.getVal())
+                    .append(Helper.ContentVars.REPEATABLE.getVal())
                     .append(Helper.ContentVars.BASE.getVal());
             break;
         case "DeprecatedonBase":
-            annoData.append(Helper.ContentVars.CONTAINERFOR.getVal())
-                    .append(Helper.ContentVars.CONTAINER.getVal())
+            annoData.append(Helper.ContentVars.CONTAINER.getVal())
                     .append(Helper.ContentVars.DEPRECATED.getVal())
-                    .append(Helper.ContentVars.CONTAINEDBY.getVal())
+                    .append(Helper.ContentVars.REPEATABLE.getVal())
                     .append(Helper.ContentVars.BASE.getVal());
             break;
         case "DeprecatedonContainer":
             annoData.append(Helper.ContentVars.DEPRECATED.getVal())
-                    .append(Helper.ContentVars.CONTAINERFOR.getVal())
                     .append(Helper.ContentVars.CONTAINER.getVal())
-                    .append(Helper.ContentVars.CONTAINEDBY.getVal())
+                    .append(Helper.ContentVars.REPEATABLE.getVal())
                     .append(Helper.ContentVars.BASE.getVal());
             break;
         }
--- a/test/tools/javac/annotations/repeatingAnnotations/combo/DocumentedAnnoCombo.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/DocumentedAnnoCombo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -93,17 +93,15 @@
         switch(className) {
             case "DocumentedonBothAnno":
                 annoData.append(Helper.ContentVars.DOCUMENTED.getVal())
-                .append(Helper.ContentVars.CONTAINERFOR.getVal())
                 .append(Helper.ContentVars.CONTAINER.getVal())
                 .append(Helper.ContentVars.DOCUMENTED.getVal())
-                .append(Helper.ContentVars.CONTAINEDBY.getVal())
+                .append(Helper.ContentVars.REPEATABLE.getVal())
                 .append(Helper.ContentVars.BASE.getVal());
             break;
             case "DocumentedonContainer":
                 annoData.append(Helper.ContentVars.DOCUMENTED.getVal())
-                .append(Helper.ContentVars.CONTAINERFOR.getVal())
                 .append(Helper.ContentVars.CONTAINER.getVal())
-                .append(Helper.ContentVars.CONTAINEDBY.getVal())
+                .append(Helper.ContentVars.REPEATABLE.getVal())
                 .append(Helper.ContentVars.BASE.getVal());
             break;
         }
--- a/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -21,39 +21,51 @@
  * questions.
  */
 
+import java.io.File;
+import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Arrays;
+import java.util.Iterator;
+
+import javax.tools.Diagnostic;
 import javax.tools.DiagnosticCollector;
 import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
 import javax.tools.ToolProvider;
-import javax.tools.JavaCompiler.CompilationTask;
+
+import com.sun.source.util.JavacTask;
 
 public class Helper {
 
     enum ContentVars {
-        IMPORTCONTAINERSTMTS("\nimport java.lang.annotation.ContainedBy;\n" +
-                            "\nimport java.lang.annotation.ContainerFor;\n"),
+
+        IMPORTCONTAINERSTMTS("\nimport java.lang.annotation.Repeatable;\n"),
         IMPORTDEPRECATED("import java.lang.Deprecated;\n"),
         IMPORTDOCUMENTED("import java.lang.annotation.Documented;\n"),
         IMPORTINHERITED("import java.lang.annotation.Inherited;\n"),
-        IMPORTRETENTION("import java.lang.annotation.Retention;\n" +
-                        "\nimport java.lang.annotation.RetentionPolicy;\n"),
-        CONTAINEDBY("\n@ContainedBy(FooContainer.class)\n"),
-        CONTAINERFOR("@ContainerFor(Foo.class)\n"),
-        CONTAINER("@interface FooContainer {\n" +"  Foo[] value();\n}\n"),
+        IMPORTRETENTION("import java.lang.annotation.Retention;\n"
+        + "\nimport java.lang.annotation.RetentionPolicy;\n"),
+        IMPORTSTMTS("import java.lang.annotation.*;\n"),
+        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()"),
         DEPRECATED("\n@Deprecated"),
         DOCUMENTED("\n@Documented"),
         INHERITED("\n@Inherited"),
-        RETENTION("@Retention(RetentionPolicy.#VAL)\n");
-
+        TARGET("\n@Target(#VAL)\n"),
+        RETENTION("@Retention(RetentionPolicy.#VAL)\n"),
+        RETENTIONRUNTIME("@Retention(RetentionPolicy.RUNTIME)\n");
         private String val;
 
-
         private ContentVars(String val) {
             this.val = val;
         }
@@ -63,44 +75,6 @@
         }
     }
 
-    /* String template where /*<TYPE>*/ /*gets replaced by repeating anno
-     * Used to generate test src for combo tests
-     *   - BasicSyntaxCombo.java
-     *   - TargetAnnoCombo.java
-     */
-    public static final String template =
-            "/*PACKAGE*/\n" +
-            "//pkg test;\n\n" +
-            "/*TYPE*/ //class\n" +
-            "class #ClassName {\n" +
-            "  /*FIELD*/ //instance var\n" +
-            "  public int x = 0;\n\n" +
-            "  /*FIELD*/ //Enum constants\n" +
-            "  TestEnum testEnum;\n\n" +
-            "  /*FIELD*/ // Static field\n" +
-            "  public static int num;\n\n" +
-            "  /*STATIC_INI*/\n" +
-            "  static { \n" + "num = 10; \n  }\n\n" +
-            "  /*CONSTRUCTOR*/\n" +
-            "  #ClassName() {}\n\n" +
-            "  /*INSTANCE_INI*/\n" +
-            "  { \n x = 10; \n }" +
-            "  /*INNER_CLASS*/\n" +
-            "  class innerClass {}\n" +
-            "  /*METHOD*/\n" +
-            "  void bar(/*PARAMETER*/ int baz) {\n" +
-            "    /*LOCAL_VARIABLE*/\n" +
-            "    int y = 0;\n" +
-            "  }\n" +
-            "}\n\n" +
-            "/*TYPE*/ //Enum\n" +
-            "enum TestEnum {}\n\n" +
-            "/*TYPE*/ //Interface\n" +
-            "interface TestInterface {}\n\n" +
-            "/*TYPE*/\n" +
-            "/*ANNOTATION_TYPE*/\n" +
-            "@interface TestAnnotationType{}\n";
-
     // Create and compile FileObject using values for className and contents
     public static boolean compileCode(String className, String contents,
             DiagnosticCollector<JavaFileObject> diagnostics) {
@@ -116,21 +90,97 @@
         CompilationTask task = compiler.getTask(null, null, diagnostics, null, null, compilationUnit);
         ok = task.call();
         return ok;
-
     }
+    // Compile a list of FileObjects
+    // Used when packages are needed and classes need to be loaded at runtime
+    static File destDir = new File(System.getProperty("user.dir"));
 
-    // Compile a list of FileObjects
     public static boolean compileCode(DiagnosticCollector<JavaFileObject> diagnostics, Iterable<? extends JavaFileObject> files) {
+        boolean ok = false;
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
         if (compiler == null) {
             throw new RuntimeException("can't get javax.tools.JavaCompiler!");
         }
 
-        CompilationTask task = compiler.getTask(null, null, diagnostics, null, null, files);
-        boolean ok = task.call();
+        StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
+
+        // Assuming filesCount can maximum be 2 and if true, one file is package-info.java
+        if (isPkgInfoPresent(files)) {
+            JavacTask task = (JavacTask) compiler.getTask(null, fm, diagnostics, null, null, files);
+            try {
+                fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir));
+                task.generate();
+            } catch (IOException ioe) {
+                throw new RuntimeException("Compilation failed for package level tests", ioe);
+            }
+            int err = 0;
+            for (Diagnostic<? extends JavaFileObject> d : diagnostics.getDiagnostics()) {
+                if(d.getKind() == Diagnostic.Kind.ERROR) {
+                  err++;
+                }
+            }
+            ok = (err == 0);
+        } else {
+            CompilationTask task = compiler.getTask(null, null, diagnostics, null, null, files);
+            ok = task.call();
+        }
         return ok;
     }
 
+    static private boolean isPkgInfoPresent(Iterable<? extends JavaFileObject> files) {
+        Iterator<? extends JavaFileObject> itr = files.iterator();
+        while (itr.hasNext()) {
+            String name = itr.next().getName();
+            if (name.contains("package-info")) {
+                return true;
+            }
+        }
+        return false;
+    }
+    /* String template where /*<TYPE>*/ /*gets replaced by repeating anno
+     * Used to generate test src for combo tests
+     *   - BasicSyntaxCombo.java
+     *   - TargetAnnoCombo.java
+     */
+
+    public static final String template =
+            "/*PACKAGE*/\n"
+            + "//pkg test;\n\n"
+            + "/*ANNODATA*/\n" // import statements, declaration of Foo/FooContainer
+            + "/*TYPE*/ //class\n"
+            + "class #ClassName {\n"
+            + "  /*FIELD*/ //instance var\n"
+            + "  public int x = 0;\n\n"
+            + "  /*FIELD*/ //Enum constants\n"
+            + "  TestEnum testEnum;\n\n"
+            + "  /*FIELD*/ // Static field\n"
+            + "  public static int num;\n\n"
+            + "  /*STATIC_INI*/\n"
+            + "  static { \n" + "num = 10; \n  }\n\n"
+            + "  /*CONSTRUCTOR*/\n"
+            + "  #ClassName() {}\n\n"
+            + "  /*INSTANCE_INI*/\n"
+            + "  { \n x = 10; \n }"
+            + "  /*INNER_CLASS*/\n"
+            + "  class innerClass {}\n"
+            + "  /*METHOD*/\n"
+            + "  void bar(/*PARAMETER*/ int baz) {\n"
+            + "    /*LOCAL_VARIABLE*/\n"
+            + "    int y = 0;\n"
+            + "  }\n"
+            + "}\n\n"
+            + "/*TYPE*/ //Enum\n"
+            + "enum TestEnum {}\n\n"
+            + "/*TYPE*/ //Interface\n"
+            + "interface TestInterface {}\n\n"
+            + "/*TYPE*/\n"
+            + "/*ANNOTATION_TYPE*/\n"
+            + "@interface TestAnnotationType{}\n"
+            + "class TestPkg {}\n"
+            + "class TestTypeAnno </*TYPE_PARAMETER*/ T extends Object> {\n"
+            + "  String /*TYPE_USE*/[] arr;\n"
+            + "}";
+
     static JavaFileObject getFile(String name, String code) {
         JavaFileObject o = null;
         try {
@@ -140,12 +190,16 @@
         }
         return o;
     }
+
     static class JavaStringFileObject extends SimpleJavaFileObject {
+
         final String theCode;
+
         public JavaStringFileObject(String fileName, String theCode) throws URISyntaxException {
-            super(new URI("string:///" + fileName.replace('.','/') + ".java"), Kind.SOURCE);
+            super(new URI("string:///" + fileName.replace('.', '/') + ".java"), Kind.SOURCE);
             this.theCode = theCode;
         }
+
         @Override
         public CharSequence getCharContent(boolean ignoreEncodingErrors) {
             return theCode;
--- a/test/tools/javac/annotations/repeatingAnnotations/combo/InheritedAnnoCombo.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/InheritedAnnoCombo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -94,17 +94,15 @@
         switch(className) {
         case "InheritedonBothAnno":
             annoData.append(Helper.ContentVars.INHERITED.getVal())
-            .append(Helper.ContentVars.CONTAINERFOR.getVal())
             .append(Helper.ContentVars.CONTAINER.getVal())
             .append(Helper.ContentVars.INHERITED.getVal())
-            .append(Helper.ContentVars.CONTAINEDBY.getVal())
+            .append(Helper.ContentVars.REPEATABLE.getVal())
             .append(Helper.ContentVars.BASE.getVal());
             break;
         case "InheritedonBase":
             annoData.append(Helper.ContentVars.INHERITED.getVal())
-            .append(Helper.ContentVars.CONTAINERFOR.getVal())
             .append(Helper.ContentVars.CONTAINER.getVal())
-            .append(Helper.ContentVars.CONTAINEDBY.getVal())
+            .append(Helper.ContentVars.REPEATABLE.getVal())
             .append(Helper.ContentVars.BASE.getVal());
             break;
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2932 @@
+/*
+ * 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      8001457
+ * @author   sogoel
+ * @summary  Reflection api tests
+ * @build    Helper
+ * @compile  expectedFiles/ExpectedBase.java expectedFiles/ExpectedContainer.java
+ * @run main ReflectionTest
+ */
+import java.io.File;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaFileObject;
+
+import expectedFiles.ExpectedBase;
+import expectedFiles.ExpectedContainer;
+
+/*
+ * Objective:
+ * Test the following 6 methods from java.lang.reflect.AnnotatedElement:
+ * - getAnnotation(Class<T>)
+ * - getAnnotations()
+ * - getDeclaredAnnotations()
+ * - getDeclaredAnnotation(Class<T>)  // new method in JDK8
+ * - getAnnotationsByType(Class<T>)         // new method in JDK8
+ * - getDeclaredAnnotationsByType(Class<T>) // new method in JDK8
+ * for multiple test cases, for example, BasicNonRepeatable case, BasicRepeatable case
+ * for each of the src types - class, method, field, package
+ *
+ * This test uses following three enums:
+ * 1. TestCase - Defines the ExpectedBase/ExpectedContainer values for each testCase
+ *             - getTestFiles() - Creates list of JavaFileObjects for the primary
+ *                                src types (class, method, field, package)
+ *             - Each testCase is a new scenario with a combination of @Repeatable
+ *               relationship present/absent in conjunction with @Inherited.
+ *               For eg: BasicNonRepeatable_Legacy - It is a pre-JDK8 way of writing a single
+ *                       annotation on a given srcType( class, method, field, package)
+ *                       BasicRepeatable - It is a JDK8 way of writing repeating annotations
+ *                       on a given srcType with a @Repeatable relationship
+ *                       defined between Foo and FooContainer.
+ *
+ * 2. SrcType - Defines templates used in creation of test src
+ *            - Defines getExpectedBase() and getExpectedContainer() for primary src types
+ * 3. TestMethod - Defines getActualAnnoBase(), getActualAnnoContainer(), getExpectedAnnoBase(),
+ *                 and getExpectedAnnoContainer() for each of the 6 methods that are being tested
+ *                 in java.lang.reflect.AnnotatedElement
+ *
+ * Test execution flow:
+ * - Loop over each of the src types and each test cases
+ * - Creates test src for each flow, compile it, load the class object
+ * - Run all 6 methods on this class object
+ * - Get expected and actual annotations for each object and compare them.
+ * - Increment the error counter if the annotations don't match.
+ *
+ * The test fails if the number of errors is greater than 0.
+ */
+public class ReflectionTest {
+
+    static int errors = 0;
+    // Variables used in creating test src for a given testcase/testSrcType
+    static final String TESTPKG = "testpkg";
+    static final String TESTMETHOD = "testMethod";
+    static final String TESTFIELD = "testField";
+    static final String PKGINFONAME = TESTPKG + ".package-info";
+    static final String SUPERCLASS = "SuperClass";
+    static final String TESTINTERFACE = "TestInterface";
+    /*
+     *  Set it to true to get more debug information
+     */
+    static final boolean DEBUG = false;
+
+    public static void main(String args[]) throws Exception {
+        ReflectionTest test = new ReflectionTest();
+        test.runTest();
+    }
+
+    public void runTest() throws Exception {
+
+        ClassLoader parentClassLoader = getLoader();
+        String className = "";
+        Iterable<? extends JavaFileObject> files = null;
+
+        for (SrcType srcType : SrcType.getSrcTypes()) {
+            for (TestCase testCase : TestCase.values()) {
+                className = testCase + "_" + srcType;
+                debugPrint("*****************************************");
+                System.out.println("Running Test for ClassName: " + className);
+
+                // @Inherited only applicable for class, exclude cases for
+                // package, method, field
+                if (testCase.name().contains("Inherited")
+                        && (srcType != SrcType.CLASS)) {
+                    continue;
+                }
+
+                // Get list of JavaFileObjects to be compiled
+                files = testCase.getTestFiles(srcType, className);
+                if (srcType == SrcType.PACKAGE) {
+                    className = TESTPKG + "." + className;
+                }
+                DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
+
+                // Compile the list of JavaFileObjects
+                try {
+                    Helper.compileCode(diagnostics, files);
+                } catch (Exception ex) {
+                    printTestSrc(files);
+                    throw new RuntimeException(
+                            "Exception when compiling class " + className, ex);
+                }
+
+                // Get Class object for the compiled class
+                Class<?> c = loadClass(className, parentClassLoader, Helper.destDir);
+                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
+                    checkAnnoValues(srcType, c);
+                } else {
+                    error("Could not load className = " + c);
+                }
+            }
+        }
+
+        if (getNumErrors() > 0) {
+            System.err.println("Test failed with " + getNumErrors() + " errors");
+            throw new RuntimeException();
+        }
+    }
+
+    /*
+     *  Each test case in this enum has the following:
+     *  - Define each test case with its @ExpectedBase and @ExpectedContainer annotations
+     *  - Override getTestFiles() that creates list of JavaFileObjects for each case
+     *    based on the src type.
+     */
+    enum TestCase {
+        BasicNonRepeatable_Legacy(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + "getDeclAnnoVal = \"Foo\", "
+                + "getAnnosArgs = {\"Foo\"}, "
+                + "getDeclAnnosArgs = {\"Foo\"}) ",
+        "@ExpectedContainer") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String testSrc = "";
+                String pkgInfoContents = "";
+                String contents = "";
+
+                JavaFileObject pkgFileObj = null;
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = new StringBuilder();
+                anno = Helper.ContentVars.BASEANNO.getVal();
+                commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
+                        .append(Helper.ContentVars.IMPORTSTMTS.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.BASE.getVal());
+                switch (srcType) {
+                    case PACKAGE:
+                        /*
+                        Sample package-info.java
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @Foo
+                        package testpkg;
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface Foo {}
+
+                        Sample testSrc:
+                        package testpkg;
+                        class A {}
+                         */
+                        testSrc = srcType.getTemplate().replace("#CN", className);
+                        contents = testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+
+                        replaceVal = expectedVals + "\n" + anno;
+                        pkgInfoContents = SrcType.PKGINFO.getTemplate()
+                                .replace("#REPLACE1", replaceVal)
+                                .replace("#REPLACE2", commonStmts);
+                        pkgFileObj = Helper.getFile(PKGINFONAME, pkgInfoContents);
+
+                        files = Arrays.asList(pkgFileObj, srcFileObj);
+                        break;
+                    default:
+                        // class, method, field
+                    /*
+                        Sample testSrc for class
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface Foo {}
+
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @Foo
+                        class A {}
+                         */
+                        replaceVal = expectedVals + anno;
+                        testSrc = srcType.getTemplate().replace("#CN", className)
+                                .replace("#REPLACE", replaceVal);
+                        contents = commonStmts + testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+                        files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        SingleAnnoInherited_Legacy(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {\"Foo\", \"ExpectedBase\", \"ExpectedContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+                + "getDeclAnnoVal = \"NULL\", "
+                + "getAnnosArgs = {\"Foo\"}, "
+                + "getDeclAnnosArgs = {})",
+        "@ExpectedContainer") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = new StringBuilder();
+
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface Foo {}
+
+                @Foo
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                class SubClass extends SuperClass {}
+                 */
+
+                // @Inherited only works for classes, no switch cases for
+                // method, field, package
+                anno = Helper.ContentVars.BASEANNO.getVal();
+                commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
+                        .append(Helper.ContentVars.IMPORTSTMTS.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.INHERITED.getVal())
+                        .append(Helper.ContentVars.BASE.getVal());
+
+                if (srcType == SrcType.CLASS) {
+                    // Contents for SuperClass
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS).replace("#REPLACE", replaceVal);
+
+                    // Contents for SubClass that extends SuperClass
+                    replaceVal = expectedVals;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className).replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        InheritedAnnoOnInterface_Legacy(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"NULL\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"},"
+                + "getDeclAnnoVal = \"NULL\"," + "getAnnosArgs = {},"
+                + "getDeclAnnosArgs = {})",
+        "@ExpectedContainer") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = new StringBuilder();
+
+                /*
+                Sample test src:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface Foo {}
+
+                @Foo
+                interface TestInterface { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                class A implements TestInterface {}
+                 */
+                anno = Helper.ContentVars.BASEANNO.getVal();
+                commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
+                        .append(Helper.ContentVars.IMPORTSTMTS.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.INHERITED.getVal())
+                        .append(Helper.ContentVars.BASE.getVal());
+
+                if (srcType == SrcType.CLASS) {
+                    // Contents for TestInterface
+                    replaceVal = commonStmts + "\n" + anno;
+                    String interfaceContents = SrcType.INTERFACE.getTemplate()
+                            .replace("#IN", TESTINTERFACE)
+                            .replace("#REPLACE", replaceVal);
+
+                    // Contents for class implementing TestInterface
+                    replaceVal = expectedVals;
+                    String classContents = SrcType.INTERFACEIMPL.getTemplate()
+                            .replace("#CN", className).replace("#IN", TESTINTERFACE)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = interfaceContents + classContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        AnnoOnSuperAndSubClass_Inherited_Legacy(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + // override every annotation on superClass
+                "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + // ignores inherited annotations
+                "getDeclAnnoVal = \"Foo\", " // ignores inherited
+                + "getAnnosArgs = {\"Foo\"}, "
+                + "getDeclAnnosArgs = { \"Foo\" })", // ignores inherited
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"NULL\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + // ignores inherited annotations
+                "getDeclAnnoVal = \"NULL\", " + // ignores inherited
+                "getAnnosArgs = {}, " + "getDeclAnnosArgs = {})") { // ignores inherited
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = new StringBuilder();
+
+                /*
+                Sample test src
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface Foo {}
+
+                @Inherited
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @Foo
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                @Foo
+                class SubClass extends SuperClass {}
+                 */
+                // @Inherited only works for classes, no switch cases for
+                // method, field, package
+                commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
+                        .append(Helper.ContentVars.IMPORTSTMTS.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.INHERITED.getVal())
+                        .append(Helper.ContentVars.BASE.getVal())
+                        .append(Helper.ContentVars.INHERITED.getVal())
+                        .append(Helper.ContentVars.CONTAINER.getVal());
+
+                if (srcType == SrcType.CLASS) {
+                    // Contents for SuperClass
+                    anno = Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS).replace("#REPLACE", replaceVal);
+
+                    // Contents for SubClass that extends SuperClass
+                    replaceVal = expectedVals + "\n" + anno;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className).replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        BasicContainer_Legacy(
+        "@ExpectedBase(value = Foo.class, "
+                + "getAnnotationVal = \"NULL\","
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnoVal = \"NULL\", " + "getAnnosArgs = {}, "
+                + "getDeclAnnosArgs = {} )",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnoVal = \"FooContainer\", "
+                + "getAnnosArgs = {\"FooContainer\"}, "
+                + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String testSrc = "";
+                String pkgInfoContents = "";
+                String contents = "";
+
+                JavaFileObject pkgFileObj = null;
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = new StringBuilder();
+
+                anno = Helper.ContentVars.LEGACYCONTAINER.getVal();
+                commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
+                        .append(Helper.ContentVars.IMPORTSTMTS.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.BASE.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.CONTAINER.getVal());
+                switch (srcType) {
+                    case PACKAGE:
+                        /*
+                        Sample package-info.java
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @FooContainer(value = {@Foo, @Foo})
+                        package testpkg;
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        Sample testSrc:
+                        package testpkg;
+                        class A {}
+                         */
+                        testSrc = srcType.getTemplate().replace("#CN", className);
+                        contents = testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+
+                        replaceVal = "\n" + expectedVals + "\n" + anno;
+                        pkgInfoContents = SrcType.PKGINFO.getTemplate()
+                                .replace("#REPLACE1", replaceVal)
+                                .replace("#REPLACE2", commonStmts);
+                        pkgFileObj = Helper.getFile(PKGINFONAME, pkgInfoContents);
+                        files = Arrays.asList(pkgFileObj, srcFileObj);
+                        break;
+                    default:
+                        /*
+                        Sample testSrc for class:
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Inherited
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Inherited
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @FooContainer(value = {@Foo, @Foo})
+                        class A {}
+                         */
+                        replaceVal = expectedVals + anno;
+                        testSrc = srcType.getTemplate().replace("#CN", className)
+                                .replace("#REPLACE", replaceVal);
+                        contents = commonStmts + testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+                        files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        SingleAndContainerOnSuper_Legacy(
+        "@ExpectedBase(value = Foo.class, "
+                + "getAnnotationVal = \"Foo\","
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnoVal = \"Foo\", "
+                + "getAnnosArgs = {\"Foo\"}, "
+                + "getDeclAnnosArgs = {\"Foo\"} )",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnoVal = \"FooContainer\", "
+                + "getAnnosArgs = {\"FooContainer\"}, "
+                + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String testSrc = "";
+                String pkgInfoContents = "";
+                String contents = "";
+
+                JavaFileObject pkgFileObj = null;
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = new StringBuilder();
+
+                anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
+                        + Helper.ContentVars.BASEANNO.getVal();
+                commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
+                        .append(Helper.ContentVars.IMPORTSTMTS.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.BASE.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.CONTAINER.getVal());
+                switch (srcType) {
+                    case PACKAGE:
+                        /*
+                        Sample package-info.java
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @Foo
+                        @FooContainer(value = {@Foo, @Foo})
+                        package testpkg;
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        Sample testSrc:
+                        package testpkg;
+                        class A {}
+                         */
+                        testSrc = srcType.getTemplate().replace("#CN", className);
+                        contents = testSrc;
+
+                        srcFileObj = Helper.getFile(className, contents);
+
+                        replaceVal = "\n" + expectedVals + "\n" + anno;
+                        pkgInfoContents = SrcType.PKGINFO.getTemplate()
+                                .replace("#REPLACE1", replaceVal)
+                                .replace("#REPLACE2", commonStmts);
+                        pkgFileObj = Helper.getFile(PKGINFONAME, pkgInfoContents);
+                        files = Arrays.asList(pkgFileObj, srcFileObj);
+                        break;
+                    default:
+                        /*
+                        Sample testSrc for class:
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Inherited
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Inherited
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @Foo
+                        @FooContainer(value = {@Foo, @Foo})
+                        class A {}
+                         */
+                        replaceVal = expectedVals + anno;
+                        testSrc = srcType.getTemplate().replace("#CN", className)
+                                .replace("#REPLACE", replaceVal);
+                        contents = commonStmts + testSrc;
+
+                        srcFileObj = Helper.getFile(className, contents);
+                        files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        BasicContainer_Inherited_Legacy(
+        "@ExpectedBase(value = Foo.class, "
+                + "getAnnotationVal = \"NULL\","
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+                + "getDeclAnnoVal = \"NULL\", "
+                + "getAnnosArgs = {}, "
+                + "getDeclAnnosArgs = {} )",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+                + "getDeclAnnoVal = \"NULL\", "
+                + "getAnnosArgs = {\"FooContainer\"}, "
+                + "getDeclAnnosArgs = {} )") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = getCommonStmts(false);
+
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface Foo {}
+
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @FooContainer(value = {@Foo, @Foo})
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                class SubClass extends SuperClass {}
+                 */
+                // @Inherited only works for classes, no switch cases for
+                // method, field, package
+
+                if (srcType == SrcType.CLASS) {
+                    // Contents for SuperClass
+                    anno = Helper.ContentVars.LEGACYCONTAINER.getVal();
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    // Contents for SubClass that extends SuperClass
+                    replaceVal = expectedVals;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className)
+                            .replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        ContainerOnSuperSingleOnSub_Inherited_Legacy(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+                + "getDeclAnnoVal = \"Foo\","
+                + "getAnnosArgs = {\"Foo\"},"
+                + "getDeclAnnosArgs = {\"Foo\"})",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+                + "getDeclAnnoVal = \"NULL\","
+                + "getAnnosArgs = {\"FooContainer\"},"
+                + "getDeclAnnosArgs = {})") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = getCommonStmts(false);
+
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface Foo {}
+
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @FooContainer(value = {@Foo, @Foo})
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                @Foo
+                class SubClass extends SuperClass {}
+                 */
+                // @Inherited only works for classes, no switch cases for
+                // method, field, package
+
+                if (srcType == SrcType.CLASS) {
+                    // Contents for SuperClass
+                    anno = Helper.ContentVars.LEGACYCONTAINER.getVal();
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    // Contents for SubClass that extends SuperClass
+                    anno = Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = expectedVals + "\n" + anno;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className)
+                            .replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        ContainerAndSingleOnSuperSingleOnSub_Inherited_Legacy(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+                + "getDeclAnnoVal = \"Foo\","
+                + "getAnnosArgs = {\"Foo\"},"
+                + "getDeclAnnosArgs = {\"Foo\"})",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+                + "getDeclAnnoVal = \"NULL\","
+                + "getAnnosArgs = {\"FooContainer\"},"
+                + "getDeclAnnosArgs = {})") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = getCommonStmts(false);
+
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface Foo {}
+
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @FooContainer(value = {@Foo, @Foo}) @Foo
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                @Foo
+                class SubClass extends SuperClass {}
+                 */
+                // @Inherited only works for classes, no switch cases for
+                // method, field, package
+
+                if (srcType == SrcType.CLASS) {
+                    // Contents for SuperClass
+                    anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
+                            + Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    // Contents for SubClass that extends SuperClass
+                    anno = Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = expectedVals + "\n" + anno;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className).replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        SingleOnSuperContainerOnSub_Inherited_Legacy(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                + "getDeclAnnoVal = \"NULL\","
+                + "getAnnosArgs = {\"Foo\"},"
+                + "getDeclAnnosArgs = {})",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                + "getDeclAnnoVal = \"FooContainer\","
+                + "getAnnosArgs = {\"FooContainer\"},"
+                + "getDeclAnnosArgs = {\"FooContainer\"})") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = getCommonStmts(false);
+
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface Foo {}
+
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @Foo
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                @FooContainer(value = {@Foo, @Foo})
+                class SubClass extends SuperClass {}
+                 */
+
+                if (srcType == SrcType.CLASS) {
+                    //Contents for SuperClass
+                    anno = Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    //Contents for SubClass that extends SuperClass
+                    anno = Helper.ContentVars.LEGACYCONTAINER.getVal();
+                    replaceVal = expectedVals + "\n" + anno;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className).replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        SingleOnSuperContainerAndSingleOnSub_Inherited_Legacy(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+                + "getDeclAnnoVal = \"Foo\","
+                + "getAnnosArgs = {\"Foo\"},"
+                + "getDeclAnnosArgs = {\"Foo\"})",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+                + "getDeclAnnoVal = \"FooContainer\","
+                + "getAnnosArgs = {\"FooContainer\"},"
+                + "getDeclAnnosArgs = {\"FooContainer\"})") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = getCommonStmts(false);
+
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface Foo {}
+
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @Foo
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                @FooContainer(value = {@Foo, @Foo}) @Foo
+                class SubClass extends SuperClass {}
+                 */
+
+                if (srcType == SrcType.CLASS) {
+                    //Contents for SuperClass
+                    anno = Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    //Contents for SubClass that extends SuperClass
+                    anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
+                            + Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = expectedVals + "\n" + anno;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className).replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        BasicRepeatable(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"NULL\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\" }, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                + "getDeclAnnoVal = \"NULL\","
+                + "getAnnosArgs = {\"Foo\", \"Foo\"},"
+                + "getDeclAnnosArgs = {\"Foo\", \"Foo\"})",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\","
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnoVal = \"FooContainer\","
+                + "getAnnosArgs = {\"FooContainer\"},"
+                + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String testSrc = "";
+                String pkgInfoContents = "";
+                String contents = "";
+
+                JavaFileObject pkgFileObj = null;
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = new StringBuilder();
+
+                anno = Helper.ContentVars.REPEATABLEANNO.getVal();
+                commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
+                        .append(Helper.ContentVars.IMPORTSTMTS.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.REPEATABLE.getVal())
+                        .append(Helper.ContentVars.BASE.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.CONTAINER.getVal());
+                switch (srcType) {
+                    case PACKAGE:
+                        /*
+                        Sample package-info.java
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @Foo() @Foo()
+                        package testpkg;
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Repeatable(FooContainer.class)
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        Sample testSrc:
+                        package testpkg;
+                        class A {}
+                         */
+                        testSrc = srcType.getTemplate().replace("#CN", className);
+                        contents = testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+
+                        replaceVal = expectedVals + "\n" + anno;
+                        pkgInfoContents = SrcType.PKGINFO.getTemplate()
+                                .replace("#REPLACE1", replaceVal)
+                                .replace("#REPLACE2", commonStmts);
+                        pkgFileObj = Helper.getFile(PKGINFONAME, pkgInfoContents);
+                        files = Arrays.asList(pkgFileObj, srcFileObj);
+                        break;
+                    default:
+                        /*
+                        Sample testSrc for class:
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Repeatable(FooContainer.class)
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @Foo @Foo
+                        class A { }
+                         */
+                        replaceVal = expectedVals + anno;
+                        testSrc = srcType.getTemplate().replace("#CN", className)
+                                .replace("#REPLACE", replaceVal);
+                        contents = commonStmts + testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+                        files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        BasicContainerRepeatable(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"NULL\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                + "getDeclAnnoVal = \"NULL\","
+                + "getAnnosArgs = {\"Foo\", \"Foo\"},"
+                + "getDeclAnnosArgs = {\"Foo\", \"Foo\"})",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\","
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnoVal = \"FooContainer\","
+                + "getAnnosArgs = {\"FooContainer\"},"
+                + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String testSrc = "";
+                String pkgInfoContents = "";
+                String contents = "";
+
+                JavaFileObject pkgFileObj = null;
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = new StringBuilder();
+
+                anno = Helper.ContentVars.LEGACYCONTAINER.getVal();
+                commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
+                        .append(Helper.ContentVars.IMPORTSTMTS.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.REPEATABLE.getVal())
+                        .append(Helper.ContentVars.BASE.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.CONTAINER.getVal());
+                switch (srcType) {
+                    case PACKAGE:
+                        /*
+                        Sample package-info.java
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @FooContainer(value = {@Foo, @Foo})
+                        package testpkg;
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Repeatable(FooContainer.class)
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        Sample testSrc:
+                        package testpkg;
+                        class A {}
+                         */
+                        testSrc = srcType.getTemplate().replace("#CN", className);
+                        contents = testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+
+                        replaceVal = expectedVals + "\n" + anno;
+                        pkgInfoContents = SrcType.PKGINFO.getTemplate()
+                                .replace("#REPLACE1", replaceVal)
+                                .replace("#REPLACE2", commonStmts);
+                        pkgFileObj = Helper.getFile(PKGINFONAME, pkgInfoContents);
+                        files = Arrays.asList(pkgFileObj, srcFileObj);
+                        break;
+                    default:
+                        /*
+                        Sample testSrc for class:
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Repeatable(FooContainer.class)
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @FooContainer(value = {@Foo, @Foo})
+                        class A { }
+                         */
+                        replaceVal = expectedVals + anno;
+                        testSrc = srcType.getTemplate().replace("#CN", className)
+                                .replace("#REPLACE", replaceVal);
+                        contents = commonStmts + testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+                        files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        BasicContainerRepeatable_Inherited(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"NULL\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+                + "getDeclAnnoVal = \"NULL\", "
+                + "getAnnosArgs = {\"Foo\", \"Foo\"}, "
+                + "getDeclAnnosArgs = {})",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
+                + "getDeclAnnoVal = \"NULL\", "
+                + "getAnnosArgs = {\"FooContainer\"}, "
+                + "getDeclAnnosArgs = {})") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = getCommonStmts(true);
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @Repeatable(FooContainer.class)
+                @interface Foo {}
+
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @FooContainer(value = {@Foo, @Foo})
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                class SubClass extends SuperClass { }
+                 */
+                // @Inherited only works for classes, no switch cases for
+                // method, field, package
+                anno = Helper.ContentVars.LEGACYCONTAINER.getVal();
+
+                if (srcType == SrcType.CLASS) {
+                    // Contents for SuperClass
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    // Contents for SubClass that extends SuperClass
+                    replaceVal = expectedVals;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className)
+                            .replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        RepeatableAnnoInherited(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"NULL\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+                + // ignores inherited annotations
+                "getDeclAnnoVal = \"NULL\", "
+                + // ignores inherited
+                "getAnnosArgs = {\"Foo\", \"Foo\"}, "
+                + "getDeclAnnosArgs = {})", // ignores inherited
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
+                + // ignores inherited annotations
+                "getDeclAnnoVal = \"NULL\", "
+                + // ignores inherited
+                "getAnnosArgs = {\"FooContainer\"}, "
+                + "getDeclAnnosArgs = {})") { // ignores inherited
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = getCommonStmts(true);
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @Repeatable(FooContainer.class)
+                @interface Foo {}
+
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @Foo() @Foo()
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                class SubClass extends SuperClass { }
+                 */
+                // @Inherited only works for classes, no switch cases for
+                // method, field, package
+                anno = Helper.ContentVars.REPEATABLEANNO.getVal();
+
+                if (srcType == SrcType.CLASS) {
+                    // Contents for SuperClass
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    // Contents for SubClass that extends SuperClass
+                    replaceVal = expectedVals;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className)
+                            .replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        SingleAnnoWithContainer(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+                + "getDeclAnnoVal = \"Foo\","
+                + "getAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"},"
+                + "getDeclAnnosArgs = {\"Foo\", \"Foo\",\"Foo\"})",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnoVal = \"FooContainer\","
+                + "getDeclAnnosArgs = {\"FooContainer\"},"
+                + "getAnnosArgs = {\"FooContainer\"})") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String testSrc = "";
+                String pkgInfoContents = "";
+                String contents = "";
+
+                JavaFileObject pkgFileObj = null;
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = new StringBuilder();
+
+                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())
+                        .append(Helper.ContentVars.REPEATABLE.getVal())
+                        .append(Helper.ContentVars.BASE.getVal())
+                        .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+                        .append(Helper.ContentVars.CONTAINER.getVal());
+                switch (srcType) {
+                    case PACKAGE:
+                        /*
+                        Sample package-info.java
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @Foo @FooContainer(value = {@Foo, @Foo})
+                        package testpkg;
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Repeatable(FooContainer.class)
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        Sample testSrc:
+                        package testpkg;
+                        class A {}
+                         */
+                        testSrc = srcType.getTemplate().replace("#CN", className);
+                        contents = testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+
+                        replaceVal = expectedVals + "\n" + anno;
+                        pkgInfoContents = SrcType.PKGINFO.getTemplate()
+                                .replace("#REPLACE1", replaceVal)
+                                .replace("#REPLACE2", commonStmts);
+                        pkgFileObj = Helper.getFile(PKGINFONAME, pkgInfoContents);
+                        files = Arrays.asList(pkgFileObj, srcFileObj);
+                        break;
+                    default:
+                        /*
+                        Sample testSrc:
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Inherited
+                        @Repeatable(FooContainer.class)
+                        @interface Foo {}
+
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @Inherited
+                        @interface FooContainer {
+                        Foo[] value();
+                        }
+
+                        @ExpectedBase
+                        @ExpectedContainer
+                        @Foo @FooContainer(value = {@Foo, @Foo})
+                        class A { }
+                         */
+                        replaceVal = expectedVals + anno;
+                        testSrc = srcType.getTemplate()
+                                .replace("#CN", className)
+                                .replace("#REPLACE", replaceVal);
+                        contents = commonStmts + testSrc;
+                        srcFileObj = Helper.getFile(className, contents);
+                        files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+        AnnoOnSuperAndSubClass_Inherited(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\" }, "
+                + // override every annotation on superClass
+                "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + // ignores inherited annotations
+                "getDeclAnnoVal = \"Foo\", " // ignores inherited
+                + "getAnnosArgs = {\"Foo\"}, "
+                + "getDeclAnnosArgs = { \"Foo\" })", // ignores inherited
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"NULL\", "
+                + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\" }, "
+                + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+                + // ignores inherited annotations
+                "getDeclAnnoVal = \"NULL\", " + // ignores inherited
+                "getAnnosArgs = {}, " + "getDeclAnnosArgs = {})") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = getCommonStmts(true);
+
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @Repeatable(FooContainer.class)
+                @interface Foo {}
+
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @Foo()
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                @Foo
+                class SubClass extends SuperClass { }
+                 */
+                // @Inherited only works for classes, no switch cases for
+                // method, field, package
+
+                if (srcType == SrcType.CLASS) {
+                    // Contents for SuperClass
+                    anno = Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    // Contents for SubClass that extends SuperClass
+                    replaceVal = expectedVals + "\n" + anno;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className)
+                            .replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+//         // Testcase not working as expected, JDK-8004912
+//         RepeatableOnSuperSingleOnSub_Inherited(
+//         "@ExpectedBase(value=Foo.class, "
+//                 + "getAnnotationVal = \"Foo\", "
+//                 + "getAnnotationsVals = {"
+//                 +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                 + //override every annotation on superClass
+//                 "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+//                 + // ignores inherited annotations
+//                 "getDeclAnnoVal = \"Foo\", " // ignores inherited
+//                 + "getAnnosArgs = {\"Foo\"}, "
+//                 + "getDeclAnnosArgs = { \"Foo\" })", // ignores inherited
+//         "@ExpectedContainer(value=FooContainer.class, "
+//                 + "getAnnotationVal = \"FooContainer\", "
+//                 + "getAnnotationsVals = {"
+//                 +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+//                 + // ignores inherited annotations
+//                 "getDeclAnnoVal = \"NULL\", "
+//                 + "getAnnosArgs = {\"FooContainer\"}, "
+//                 + "getDeclAnnosArgs = {}) // ignores inherited ") {
+
+//             @Override
+//             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+//                     String className) {
+//                 String anno = "";
+//                 String replaceVal = "";
+//                 String contents = "";
+//                 JavaFileObject srcFileObj = null;
+//                 Iterable<? extends JavaFileObject> files = null;
+
+//                 String expectedVals = "\n" + getExpectedBase() + "\n"
+//                         + getExpectedContainer() + "\n";
+//                 StringBuilder commonStmts = getCommonStmts(true);
+
+//                 /*
+//                 Sample testSrc:
+//                 @Retention(RetentionPolicy.RUNTIME)
+//                 @Inherited
+//                 @Repeatable(FooContainer.class)
+//                 @interface Foo {}
+
+//                 @Retention(RetentionPolicy.RUNTIME)
+//                 @Inherited
+//                 @interface FooContainer {
+//                 Foo[] value();
+//                 }
+
+//                 @Foo() @Foo
+//                 class SuperClass { }
+
+//                 @ExpectedBase
+//                 @ExpectedContainer
+//                 @Foo
+//                 class SubClass extends SuperClass { }
+//                  */
+//                 //@Inherited only works for classes, no switch cases for method, field, package
+
+//                 if (srcType == SrcType.CLASS) {
+//                     //Contents for SuperClass
+//                     anno = Helper.ContentVars.REPEATABLEANNO.getVal();
+//                     replaceVal = commonStmts + "\n" + anno;
+//                     String superClassContents = srcType.getTemplate()
+//                             .replace("#CN", SUPERCLASS)
+//                             .replace("#REPLACE", replaceVal);
+
+//                     //Contents for SubClass that extends SuperClass
+//                     anno = Helper.ContentVars.BASEANNO.getVal();
+//                     replaceVal = expectedVals + "\n" + anno;
+//                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+//                             .replace("#CN", className)
+//                             .replace("#SN", SUPERCLASS)
+//                             .replace("#REPLACE", replaceVal);
+//                     contents = superClassContents + subClassContents;
+//                     srcFileObj = Helper.getFile(className, contents);
+//                     files = Arrays.asList(srcFileObj);
+//                 }
+//                 return files;
+//             }
+//         },
+//         //Testcase not working as expected, JDK-8004912
+//         SingleOnSuperRepeatableOnSub_Inherited(
+//         "@ExpectedBase(value=Foo.class, "
+//                 + "getAnnotationVal = \"Foo\", "
+//                 + "getAnnotationsVals = {"
+//                 +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                 + //override every annotation on superClass
+//                 "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+//                 + // ignores inherited annotations
+//                 "getDeclAnnoVal = \"NULL\","// ignores inherited
+//                 + "getAnnosArgs = {\"Foo\", \"Foo\"}, "
+//                 + "getDeclAnnosArgs = { \"Foo\", \"Foo\"})",
+//         "@ExpectedContainer(value=FooContainer.class, "
+//                 + "getAnnotationVal = \"FooContainer\", "
+//                 + "getAnnotationsVals = {"
+//                 +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+//                 + // ignores inherited annotations
+//                 "getDeclAnnoVal = \"FooContainer\", "// ignores inherited
+//                 + "getAnnosArgs = {\"FooContainer\"}, "
+//                 + "getDeclAnnosArgs = {\"FooContainer\"})") {
+
+//             @Override
+//             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+//                     String className) {
+//                 String anno = "";
+//                 String replaceVal = "";
+//                 String contents = "";
+//                 JavaFileObject srcFileObj = null;
+//                 Iterable<? extends JavaFileObject> files = null;
+
+//                 String expectedVals = "\n" + getExpectedBase() + "\n"
+//                         + getExpectedContainer() + "\n";
+//                 StringBuilder commonStmts = getCommonStmts(true);
+
+//                 /*
+//                 Sample testSrc:
+//                 @Retention(RetentionPolicy.RUNTIME)
+//                 @Inherited
+//                 @Repeatable(FooContainer.class)
+//                 @interface Foo {}
+
+//                 @Retention(RetentionPolicy.RUNTIME)
+//                 @Inherited
+//                 @interface FooContainer {
+//                 Foo[] value();
+//                 }
+
+//                 @Foo()
+//                 class SuperClass { }
+
+//                 @ExpectedBase
+//                 @ExpectedContainer
+//                 @Foo @Foo
+//                 class SubClass extends SuperClass { }
+//                  */
+
+//                 //@Inherited only works for classes, no switch cases for method, field, package
+//                 if (srcType == SrcType.CLASS) {
+//                     //Contents for SuperClass
+//                     anno = Helper.ContentVars.BASEANNO.getVal();
+//                     replaceVal = commonStmts + "\n" + anno;
+//                     String superClassContents = srcType.getTemplate()
+//                             .replace("#CN", SUPERCLASS)
+//                             .replace("#REPLACE", replaceVal);
+
+//                     //Contents for SubClass that extends SuperClass
+//                     anno = Helper.ContentVars.REPEATABLEANNO.getVal();
+//                     replaceVal = expectedVals + "\n" + anno;
+//                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+//                             .replace("#CN", className)
+//                             .replace("#SN", SUPERCLASS)
+//                             .replace("#REPLACE", replaceVal);
+
+//                     contents = superClassContents + subClassContents;
+//                     srcFileObj = Helper.getFile(className, contents);
+//                     files = Arrays.asList(srcFileObj);
+//                 }
+//                 return files;
+//             }
+//         },
+//         //Testcase not working as expected, JDK-8004912
+//         ContainerOnSuperSingleOnSub_Inherited(
+//         "@ExpectedBase(value=Foo.class, "
+//                 + "getAnnotationVal = \"Foo\", "
+//                 + "getAnnotationsVals = {"
+//                 +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+//                 + "getDeclAnnoVal = \"Foo\","
+//                 + "getAnnosArgs = {\"Foo\"},"
+//                 + "getDeclAnnosArgs = {\"Foo\"})",
+//         "@ExpectedContainer(value=FooContainer.class, "
+//                 + "getAnnotationVal = \"FooContainer\", "
+//                 + "getAnnotationsVals = {"
+//                 +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+//                 + "getDeclAnnoVal = \"NULL\","
+//                 + "getAnnosArgs = {\"FooContainer\"},"
+//                 + "getDeclAnnosArgs = {})") {
+
+//             @Override
+//             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+//                     String className) {
+//                 String anno = "";
+//                 String replaceVal = "";
+//                 String contents = "";
+//                 JavaFileObject srcFileObj = null;
+//                 Iterable<? extends JavaFileObject> files = null;
+
+//                 String expectedVals = "\n" + getExpectedBase() + "\n"
+//                         + getExpectedContainer() + "\n";
+//                 StringBuilder commonStmts = getCommonStmts(true);
+
+//                 /*
+//                 Sample testSrc:
+//                 @Retention(RetentionPolicy.RUNTIME)
+//                 @Inherited
+//                 @Repeatable(FooContainer.class)
+//                 @interface Foo {}
+
+//                 @Retention(RetentionPolicy.RUNTIME)
+//                 @Inherited
+//                 @interface FooContainer {
+//                 Foo[] value();
+//                 }
+
+//                 @FooContainer(value = {@Foo, @Foo})
+//                 class SuperClass { }
+
+//                 @ExpectedBase
+//                 @ExpectedContainer
+//                 @Foo
+//                 class SubClass extends SuperClass { }
+//                  */
+
+//                 //@Inherited only works for classes, no switch cases for method, field, package
+//                 if (srcType == SrcType.CLASS) {
+//                     //Contents for SuperClass
+//                     anno = Helper.ContentVars.LEGACYCONTAINER.getVal();
+//                     replaceVal = commonStmts + "\n" + anno;
+//                     String superClassContents = srcType.getTemplate()
+//                             .replace("#CN", SUPERCLASS)
+//                             .replace("#REPLACE", replaceVal);
+
+//                     //Contents for SubClass that extends SuperClass
+//                     anno = Helper.ContentVars.BASEANNO.getVal();
+//                     replaceVal = expectedVals + "\n" + anno;
+//                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+//                             .replace("#CN", className)
+//                             .replace("#SN", SUPERCLASS)
+//                             .replace("#REPLACE", replaceVal);
+
+//                     contents = superClassContents + subClassContents;
+//                     srcFileObj = Helper.getFile(className, contents);
+//                     files = Arrays.asList(srcFileObj);
+//                 }
+//                 return files;
+//             }
+//         },
+//         // TestCase not working as expected, JDK-8004912
+//         SingleOnSuperContainerOnSub_Inherited(
+//         "@ExpectedBase(value=Foo.class, "
+//                 + "getAnnotationVal = \"Foo\", "
+//                 + "getAnnotationsVals = {"
+//                 +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+//                 + "getDeclAnnoVal = \"NULL\","
+//                 + "getAnnosArgs = {\"Foo\", \"Foo\"},"
+//                 + "getDeclAnnosArgs = {\"Foo\", \"Foo\"})",
+//         "@ExpectedContainer(value=FooContainer.class, "
+//                 + "getAnnotationVal = \"FooContainer\", "
+//                 + "getAnnotationsVals = {"
+//                 +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+//                 + "getDeclAnnoVal = \"FooContainer\","
+//                 + "getAnnosArgs = {\"FooContainer\"},"
+//                 + "getDeclAnnosArgs = {\"FooContainer\"})") {
+
+//             @Override
+//             public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+//                     String className) {
+//                 String anno = "";
+//                 String replaceVal = "";
+//                 String contents = "";
+//                 JavaFileObject srcFileObj = null;
+//                 Iterable<? extends JavaFileObject> files = null;
+
+//                 String expectedVals = "\n" + getExpectedBase() + "\n"
+//                         + getExpectedContainer() + "\n";
+//                 StringBuilder commonStmts = getCommonStmts(true);
+
+//                 /*
+//                 Sample testSrc:
+//                 @Retention(RetentionPolicy.RUNTIME)
+//                 @Inherited
+//                 @Repeatable(FooContainer.class)
+//                 @interface Foo {}
+
+//                 @Retention(RetentionPolicy.RUNTIME)
+//                 @Inherited
+//                 @interface FooContainer {
+//                 Foo[] value();
+//                 }
+
+//                 @Foo
+//                 class SuperClass { }
+
+//                 @ExpectedBase
+//                 @ExpectedContainer
+//                 @FooContainer(value = {@Foo, @Foo})
+//                 class SubClass extends SuperClass { }
+//                  */
+
+//                 //@Inherited only works for classes, no switch cases for method, field, package
+//                 if (srcType == SrcType.CLASS) {
+//                     //Contents for SuperClass
+//                     anno = Helper.ContentVars.BASEANNO.getVal();
+//                     replaceVal = commonStmts + "\n" + anno;
+//                     String superClassContents = srcType.getTemplate()
+//                             .replace("#CN", SUPERCLASS)
+//                             .replace("#REPLACE", replaceVal);
+
+//                     //Contents for SubClass that extends SuperClass
+//                     anno = Helper.ContentVars.LEGACYCONTAINER.getVal();
+//                     replaceVal = expectedVals + "\n" + anno;
+//                     String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+//                             .replace("#CN", className)
+//                             .replace("#SN", SUPERCLASS)
+//                             .replace("#REPLACE", replaceVal);
+
+//                     contents = superClassContents + subClassContents;
+//                     srcFileObj = Helper.getFile(className, contents);
+//                     files = Arrays.asList(srcFileObj);
+//                 }
+//                 return files;
+//             }
+//         },
+        SingleOnSuperContainerAndSingleOnSub_Inherited(
+        "@ExpectedBase(value=Foo.class, "
+                + "getAnnotationVal = \"Foo\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+                + "getDeclAnnoVal = \"Foo\","
+                + "getAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"},"
+                + "getDeclAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"})",
+        "@ExpectedContainer(value=FooContainer.class, "
+                + "getAnnotationVal = \"FooContainer\", "
+                + "getAnnotationsVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+                + "getDeclAnnosVals = {"
+                +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+                + "getDeclAnnoVal = \"FooContainer\","
+                + "getAnnosArgs = {\"FooContainer\"},"
+                + "getDeclAnnosArgs = {\"FooContainer\"})") {
+
+            @Override
+            public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                    String className) {
+                String anno = "";
+                String replaceVal = "";
+                String contents = "";
+                JavaFileObject srcFileObj = null;
+                Iterable<? extends JavaFileObject> files = null;
+                String expectedVals = "\n" + getExpectedBase() + "\n"
+                        + getExpectedContainer() + "\n";
+                StringBuilder commonStmts = getCommonStmts(true);
+
+                /*
+                Sample testSrc:
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @interface Foo {}
+
+                @Retention(RetentionPolicy.RUNTIME)
+                @Inherited
+                @Repeatable(FooContainer.class)
+                @interface FooContainer {
+                Foo[] value();
+                }
+
+                @Foo
+                class SuperClass { }
+
+                @ExpectedBase
+                @ExpectedContainer
+                @FooContainer(value = {@Foo, @Foo}) @Foo
+                class SubClass extends SuperClass {}
+                 */
+
+                if (srcType == SrcType.CLASS) {
+                    //Contents for SuperClass
+                    anno = Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = commonStmts + "\n" + anno;
+                    String superClassContents = srcType.getTemplate()
+                            .replace("#CN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    //Contents for SubClass that extends SuperClass
+                    anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
+                            + Helper.ContentVars.BASEANNO.getVal();
+                    replaceVal = expectedVals + "\n" + anno;
+                    String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+                            .replace("#CN", className)
+                            .replace("#SN", SUPERCLASS)
+                            .replace("#REPLACE", replaceVal);
+
+                    contents = superClassContents + subClassContents;
+                    srcFileObj = Helper.getFile(className, contents);
+                    files = Arrays.asList(srcFileObj);
+                }
+                return files;
+            }
+        },
+//          // TestCase not working as expected, JDK-8004912
+//          ContainerAndSingleOnSuperSingleOnSub_Inherited(
+//          "@ExpectedBase(value=Foo.class, "
+//                  + "getAnnotationVal = \"Foo\", "
+//                  + "getAnnotationsVals = {"
+//                  +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                  + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+//                  + "getDeclAnnoVal = \"Foo\","
+//                  + "getAnnosArgs = {\"Foo\"},"
+//                  + "getDeclAnnosArgs = {\"Foo\"})",
+//          "@ExpectedContainer(value=FooContainer.class, "
+//                  + "getAnnotationVal = \"FooContainer\", "
+//                  + "getAnnotationsVals = {"
+//                  +       "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+//                  + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+//                  + "getDeclAnnoVal = \"NULL\","
+//                  + "getAnnosArgs = {\"FooContainer\"},"
+//                  + "getDeclAnnosArgs = {})") {
+
+//              @Override
+//              public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+//                      String className) {
+//                  String anno = "";
+//                  String replaceVal = "";
+//                  String contents = "";
+//                  JavaFileObject srcFileObj = null;
+//                  Iterable<? extends JavaFileObject> files = null;
+
+//                  String expectedVals = "\n" + getExpectedBase() + "\n"
+//                          + getExpectedContainer() + "\n";
+//                  StringBuilder commonStmts = getCommonStmts(true);
+
+//                  /*
+//                  Sample testSrc:
+//                  @Retention(RetentionPolicy.RUNTIME)
+//                  @Inherited
+//                  @Repeatable(FooContainer.class)
+//                  @interface Foo {}
+
+//                  @Retention(RetentionPolicy.RUNTIME)
+//                  @Inherited
+//                  @interface FooContainer {
+//                  Foo[] value();
+//                  }
+
+//                  @FooContainer(value = {@Foo, @Foo})
+//                  @Foo
+//                  class SuperClass { }
+
+//                  @ExpectedBase
+//                  @ExpectedContainer
+//                  @Foo
+//                  class SubClass extends SuperClass { }
+//                   */
+
+//                  //@Inherited only works for classes, no switch cases for method, field, package
+//                  if (srcType == SrcType.CLASS) {
+//                      //Contents for SuperClass
+//                      anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
+//                              + Helper.ContentVars.BASEANNO.getVal();
+//                      replaceVal = commonStmts + "\n" + anno;
+//                      String superClassContents = srcType.getTemplate()
+//                              .replace("#CN", SUPERCLASS)
+//                              .replace("#REPLACE", replaceVal);
+
+//                      //Contents for SubClass that extends SuperClass
+//                      anno = Helper.ContentVars.BASEANNO.getVal();
+//                      replaceVal = expectedVals + "\n" + anno;
+//                      String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
+//                              .replace("#CN", className)
+//                              .replace("#SN", SUPERCLASS)
+//                              .replace("#REPLACE", replaceVal);
+
+//                      contents = superClassContents + subClassContents;
+//                      srcFileObj = Helper.getFile(className, contents);
+//                      files = Arrays.asList(srcFileObj);
+//                  }
+//                  return files;
+//              }
+//         }
+            ;
+         private String expectedBase, expectedContainer;
+
+         private TestCase(String expectedBase, String expectedContainer) {
+             this.expectedBase = expectedBase;
+             this.expectedContainer = expectedContainer;
+         }
+
+         public String getExpectedBase() {
+             return expectedBase;
+         }
+
+         public String getExpectedContainer() {
+             return expectedContainer;
+         }
+
+         // Each enum element should override this method
+         public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
+                 String className) {
+             return null;
+         }
+    }
+
+    /*
+     * Each srctype has its template defined used for test src generation
+     * Primary src types: class, method, field, package define
+     *                    getExpectedBase() and getExpectedContainer()
+     */
+    enum SrcType {
+
+        CLASS("\n#REPLACE\nclass #CN { } ") {
+
+            @Override
+            public ExpectedBase getExpectedBase(Class<?> c) {
+                return c.getAnnotation(ExpectedBase.class);
+            }
+
+            @Override
+            public ExpectedContainer getExpectedContainer(Class<?> c) {
+                return c.getAnnotation(ExpectedContainer.class);
+            }
+        },
+        METHOD("class #CN  {\n" + "   " + "#REPLACE\n" + "   void "
+        + TESTMETHOD + "() {} \n" + "}\n") {
+
+            @Override
+            public ExpectedBase getExpectedBase(Class<?> c) {
+                ExpectedBase ret = null;
+                try {
+                    ret = c.getDeclaredMethod(TESTMETHOD).getAnnotation(
+                            ExpectedBase.class);
+                } catch (NoSuchMethodException nme) {
+                    error("Could not get " + TESTMETHOD + " for className "
+                            + c.getName() + " Exception:\n" + nme);
+                }
+                return ret;
+            }
+
+            @Override
+            public ExpectedContainer getExpectedContainer(Class<?> c) {
+                ExpectedContainer ret = null;
+                try {
+                    ret = c.getDeclaredMethod(TESTMETHOD).getAnnotation(
+                            ExpectedContainer.class);
+                } catch (NoSuchMethodException nme) {
+                    error("Could not get " + TESTMETHOD + " for className "
+                            + c.getName() + " Exception:\n" + nme);
+                }
+                return ret;
+
+            }
+        },
+        FIELD("class #CN  {\n" + "   " + "#REPLACE\n" + "   int " + TESTFIELD
+        + " = 0; \n" + "}\n") {
+
+            @Override
+            public ExpectedBase getExpectedBase(Class<?> c) {
+                ExpectedBase ret = null;
+                try {
+                    ret = c.getDeclaredField(TESTFIELD).getAnnotation(
+                            ExpectedBase.class);
+                } catch (NoSuchFieldException nme) {
+                    error("Could not get " + TESTFIELD + " for className "
+                            + c.getName() + " Exception:\n" + nme);
+                }
+                return ret;
+            }
+
+            @Override
+            public ExpectedContainer getExpectedContainer(Class<?> c) {
+                ExpectedContainer ret = null;
+                try {
+                    ret = c.getDeclaredField(TESTFIELD).getAnnotation(
+                            ExpectedContainer.class);
+                } catch (NoSuchFieldException nme) {
+                    error("Could not get " + TESTFIELD + " for className "
+                            + c.getName() + " Exception:\n" + nme);
+                }
+                return ret;
+
+            }
+        },
+        PACKAGE("package " + TESTPKG + "; \n" + "class #CN {}") {
+
+            @Override
+            public ExpectedBase getExpectedBase(Class<?> c) {
+                return c.getPackage().getAnnotation(ExpectedBase.class);
+            }
+
+            @Override
+            public ExpectedContainer getExpectedContainer(Class<?> c) {
+                return c.getPackage().getAnnotation(ExpectedContainer.class);
+            }
+        },
+        PKGINFO("#REPLACE1\npackage " + TESTPKG + "; \n" + "#REPLACE2"),
+        INTERFACE("#REPLACE\ninterface #IN { } "),
+        INTERFACEIMPL("#REPLACE\nclass #CN implements #IN {}"),
+        CLASSEXTENDS("#REPLACE\nclass #CN extends #SN {}");
+        String template;
+
+        private SrcType(String template) {
+            this.template = template;
+        }
+
+        public String getTemplate() {
+            return template;
+        }
+
+        // Elements should override
+        public ExpectedBase getExpectedBase(Class<?> c) {
+            return null;
+        }
+
+        public ExpectedContainer getExpectedContainer(Class<?> c) {
+            return null;
+        }
+
+        /*
+         * Returns only primary src types ;
+         */
+        public static SrcType[] getSrcTypes() {
+            return new SrcType[]{CLASS, PACKAGE, METHOD, FIELD};
+        }
+    }
+
+    /*
+     * Each enum constant is one of the 6 methods from AnnotatedElement interface
+     * that needs to be tested.
+     * Each enum constant overrides these 4 methods:
+     * - getActualAnnoBase(SrcType srcType, Class<?> c)
+     * - getActualAnnoContainer(SrcType srcType, Class<?> c)
+     * - getExpectedAnnoBase(SrcType srcType, Class<?> c)
+     * - getExpectedAnnoContainer(SrcType srcType, Class<?> c)
+     */
+    enum TestMethod {
+
+        GET_ANNO("getAnnotation") {
+
+            @Override
+            public Annotation[] getActualAnnoBase(SrcType srcType, Class<?> c) {
+                Annotation[] actualAnno = new Annotation[1];
+                switch (srcType) {
+                    case CLASS:
+                        actualAnno[0] = c.getAnnotation(srcType.getExpectedBase(c).value());
+                        break;
+                    case PACKAGE:
+                        actualAnno[0] = c.getPackage().getAnnotation(
+                                srcType.getExpectedBase(c).value());
+                        break;
+                    case METHOD:
+                        try {
+                            actualAnno[0] = c.getDeclaredMethod(TESTMETHOD).getAnnotation(
+                                    srcType.getExpectedBase(c).value());
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualAnno[0] = c.getDeclaredField(TESTFIELD).getAnnotation(
+                                    srcType.getExpectedBase(c).value());
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualAnno;
+            }
+
+            @Override
+            public Annotation[] getActualAnnoContainer(SrcType srcType,
+                    Class<?> c) {
+                Annotation[] actualAnno = new Annotation[1];
+                switch (srcType) {
+                    case CLASS:
+                        actualAnno[0] = c.getAnnotation(srcType.getExpectedContainer(c).value());
+                        break;
+                    case PACKAGE:
+                        actualAnno[0] = c.getPackage().getAnnotation(
+                                srcType.getExpectedContainer(c).value());
+                        break;
+                    case METHOD:
+                        try {
+                            actualAnno[0] = c.getDeclaredMethod(TESTMETHOD).getAnnotation(
+                                    srcType.getExpectedContainer(c).value());
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualAnno[0] = c.getDeclaredField(TESTFIELD).getAnnotation(
+                                    srcType.getExpectedContainer(c).value());
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualAnno;
+            }
+
+            @Override
+            public String[] getExpectedAnnoBase(SrcType srcType, Class<?> c) {
+                String[] expAnno = {srcType.getExpectedBase(c).getAnnotationVal()};
+                return expAnno;
+            }
+
+            @Override
+            public String[] getExpectedAnnoContainer(SrcType srcType, Class<?> c) {
+                String[] expAnno = {srcType.getExpectedContainer(c).getAnnotationVal()};
+                return expAnno;
+            }
+        },
+        GET_ANNOS("getAnnotations") {
+
+            @Override
+            public Annotation[] getActualAnnoBase(SrcType srcType, Class<?> c) {
+                Annotation[] actualAnnos = null;
+                switch (srcType) {
+                    case CLASS:
+                        actualAnnos = c.getAnnotations();
+                        break;
+                    case PACKAGE:
+                        actualAnnos = c.getPackage().getAnnotations();
+                        break;
+                    case METHOD:
+                        try {
+                            actualAnnos = c.getDeclaredMethod(TESTMETHOD).getAnnotations();
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualAnnos = c.getDeclaredField(TESTFIELD).getAnnotations();
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualAnnos;
+            }
+
+            @Override
+            public Annotation[] getActualAnnoContainer(SrcType srcType,
+                    Class<?> c) {
+                Annotation[] actualAnnos = null;
+                switch (srcType) {
+                    case CLASS:
+                        actualAnnos = c.getAnnotations();
+                        break;
+                    case PACKAGE:
+                        actualAnnos = c.getPackage().getAnnotations();
+                        break;
+                    case METHOD:
+                        try {
+                            actualAnnos = c.getDeclaredMethod(TESTMETHOD).getAnnotations();
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualAnnos = c.getDeclaredField(TESTFIELD).getAnnotations();
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualAnnos;
+            }
+
+            @Override
+            public String[] getExpectedAnnoBase(SrcType srcType, Class<?> c) {
+                return srcType.getExpectedBase(c).getAnnotationsVals();
+            }
+
+            @Override
+            public String[] getExpectedAnnoContainer(SrcType srcType, Class<?> c) {
+                return srcType.getExpectedContainer(c).getAnnotationsVals();
+            }
+        },
+        GET_DECL_ANNOS("getDeclaredAnnotations") {
+
+            @Override
+            public Annotation[] getActualAnnoBase(SrcType srcType, Class<?> c) {
+                Annotation[] actualDeclAnnos = null;
+                switch (srcType) {
+                    case CLASS:
+                        actualDeclAnnos = c.getDeclaredAnnotations();
+                        break;
+                    case PACKAGE:
+                        actualDeclAnnos = c.getPackage().getDeclaredAnnotations();
+                        break;
+                    case METHOD:
+                        try {
+                            actualDeclAnnos = c.getDeclaredMethod(TESTMETHOD)
+                                    .getDeclaredAnnotations();
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualDeclAnnos = c.getDeclaredField(TESTFIELD)
+                                    .getDeclaredAnnotations();
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualDeclAnnos;
+            }
+
+            @Override
+            public Annotation[] getActualAnnoContainer(SrcType srcType,
+                    Class<?> c) {
+                Annotation[] actualDeclAnnos = null;
+                switch (srcType) {
+                    case CLASS:
+                        actualDeclAnnos = c.getDeclaredAnnotations();
+                        break;
+                    case PACKAGE:
+                        actualDeclAnnos = c.getPackage().getDeclaredAnnotations();
+                        break;
+                    case METHOD:
+                        try {
+                            actualDeclAnnos = c.getDeclaredMethod(TESTMETHOD)
+                                    .getDeclaredAnnotations();
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualDeclAnnos = c.getDeclaredField(TESTFIELD)
+                                    .getDeclaredAnnotations();
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualDeclAnnos;
+            }
+
+            @Override
+            public String[] getExpectedAnnoBase(SrcType srcType, Class<?> c) {
+                return srcType.getExpectedBase(c).getDeclAnnosVals();
+            }
+
+            @Override
+            public String[] getExpectedAnnoContainer(SrcType srcType, Class<?> c) {
+                return srcType.getExpectedContainer(c).getDeclAnnosVals();
+            }
+        },
+        GET_DECL_ANNO("getDeclaredAnnotation") {
+
+            @Override
+            public Annotation[] getActualAnnoBase(SrcType srcType, Class<?> c) {
+                Annotation[] actualDeclAnno = new Annotation[1];
+                switch (srcType) {
+                    case CLASS:
+                        actualDeclAnno[0] = c.getDeclaredAnnotation(
+                                srcType.getExpectedBase(c).value());
+                        break;
+                    case PACKAGE:
+                        actualDeclAnno[0] = c.getPackage().getDeclaredAnnotation(
+                                srcType.getExpectedBase(c).value());
+                        break;
+                    case METHOD:
+                        try {
+                            actualDeclAnno[0] = c.getDeclaredMethod(TESTMETHOD)
+                                    .getDeclaredAnnotation(
+                                        srcType.getExpectedBase(c).value());
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualDeclAnno[0] = c.getDeclaredField(TESTFIELD)
+                                    .getDeclaredAnnotation(
+                                        srcType.getExpectedBase(c).value());
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualDeclAnno;
+            }
+
+            @Override
+            public Annotation[] getActualAnnoContainer(SrcType srcType,
+                    Class<?> c) {
+                Annotation[] actualDeclAnno = new Annotation[1];
+                switch (srcType) {
+                    case CLASS:
+                        actualDeclAnno[0] = c.getDeclaredAnnotation(
+                                srcType.getExpectedContainer(c).value());
+                        break;
+                    case PACKAGE:
+                        actualDeclAnno[0] = c.getPackage().getDeclaredAnnotation(
+                                srcType.getExpectedContainer(c).value());
+                        break;
+                    case METHOD:
+                        try {
+                            actualDeclAnno[0] = c.getDeclaredMethod(TESTMETHOD)
+                                    .getDeclaredAnnotation(
+                                        srcType.getExpectedContainer(c).value());
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualDeclAnno[0] = c.getDeclaredField(TESTFIELD)
+                                    .getDeclaredAnnotation(
+                                        srcType.getExpectedContainer(c).value());
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualDeclAnno;
+            }
+
+            @Override
+            public String[] getExpectedAnnoBase(SrcType srcType, Class<?> c) {
+                String[] expAnno = {srcType.getExpectedBase(c).getDeclAnnoVal()};
+                return expAnno;
+            }
+
+            @Override
+            public String[] getExpectedAnnoContainer(SrcType srcType, Class<?> c) {
+                String[] expAnno = {srcType.getExpectedContainer(c).getDeclAnnoVal()};
+                return expAnno;
+            }
+        }, // new
+        GET_ANNOS_ARG("getAnnotationsArg") {
+
+            @Override
+            public Annotation[] getActualAnnoBase(SrcType srcType, Class<?> c) {
+                Annotation[] actualAnnoArgs = null;
+                switch (srcType) {
+                    case CLASS:
+                        actualAnnoArgs = c.getAnnotationsByType(srcType.getExpectedBase(c).value());
+                        break;
+                    case PACKAGE:
+                        actualAnnoArgs = c.getPackage().getAnnotationsByType(
+                                srcType.getExpectedBase(c).value());
+                        break;
+                    case METHOD:
+                        try {
+                            actualAnnoArgs = c.getDeclaredMethod(TESTMETHOD)
+                                    .getAnnotationsByType(
+                                        srcType.getExpectedBase(c).value());
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualAnnoArgs = c.getDeclaredField(TESTFIELD)
+                                    .getAnnotationsByType(
+                                        srcType.getExpectedBase(c).value());
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualAnnoArgs;
+            }
+
+            @Override
+            public Annotation[] getActualAnnoContainer(SrcType srcType,
+                    Class<?> c) {
+                Annotation[] actualAnnoArgs = null;
+                switch (srcType) {
+                    case CLASS:
+                        actualAnnoArgs = c.getAnnotationsByType(srcType.getExpectedContainer(c).value());
+                        break;
+                    case PACKAGE:
+                        actualAnnoArgs = c.getPackage().getAnnotationsByType(
+                                srcType.getExpectedContainer(c).value());
+                        break;
+                    case METHOD:
+                        try {
+                            actualAnnoArgs = c.getDeclaredMethod(TESTMETHOD)
+                                    .getAnnotationsByType(
+                                        srcType.getExpectedContainer(c).value());
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualAnnoArgs = c.getDeclaredField(TESTFIELD)
+                                    .getAnnotationsByType(
+                                        srcType.getExpectedContainer(c).value());
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualAnnoArgs;
+            }
+
+            @Override
+            public String[] getExpectedAnnoBase(SrcType srcType, Class<?> c) {
+                return srcType.getExpectedBase(c).getAnnosArgs();
+            }
+
+            @Override
+            public String[] getExpectedAnnoContainer(SrcType srcType, Class<?> c) {
+                return srcType.getExpectedContainer(c).getAnnosArgs();
+            }
+        }, // new
+        GET_DECL_ANNOS_ARG("getDeclAnnosArg") {
+
+            @Override
+            public Annotation[] getActualAnnoBase(SrcType srcType, Class<?> c) {
+                Annotation[] actualDeclAnnosArgs = null;
+                switch (srcType) {
+                    case CLASS:
+                        actualDeclAnnosArgs = c.getDeclaredAnnotationsByType(
+                                srcType.getExpectedBase(c).value());
+                        break;
+                    case PACKAGE:
+                        actualDeclAnnosArgs = c.getPackage().getDeclaredAnnotationsByType(
+                                srcType.getExpectedBase(c).value());
+                        break;
+                    case METHOD:
+                        try {
+                            actualDeclAnnosArgs = c.getDeclaredMethod(TESTMETHOD)
+                                    .getDeclaredAnnotationsByType(
+                                        srcType.getExpectedBase(c).value());
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualDeclAnnosArgs = c.getDeclaredField(TESTFIELD)
+                                    .getDeclaredAnnotationsByType(
+                                        srcType.getExpectedBase(c).value());
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualDeclAnnosArgs;
+            }
+
+            @Override
+            public Annotation[] getActualAnnoContainer(SrcType srcType,
+                    Class<?> c) {
+                Annotation[] actualDeclAnnosArgs = null;
+                switch (srcType) {
+                    case CLASS:
+                        actualDeclAnnosArgs = c.getDeclaredAnnotationsByType(
+                                srcType.getExpectedContainer(c).value());
+                        break;
+                    case PACKAGE:
+                        actualDeclAnnosArgs = c.getPackage().getDeclaredAnnotationsByType(
+                                srcType.getExpectedContainer(c).value());
+                        break;
+                    case METHOD:
+                        try {
+                            actualDeclAnnosArgs = c.getDeclaredMethod(TESTMETHOD)
+                                    .getDeclaredAnnotationsByType(
+                                        srcType.getExpectedContainer(c).value());
+                        } catch (NoSuchMethodException nme) {
+                            error("Could not get " + TESTMETHOD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nme);
+                        }
+                        break;
+                    case FIELD:
+                        try {
+                            actualDeclAnnosArgs = c.getDeclaredField(TESTFIELD)
+                                   .getDeclaredAnnotationsByType(
+                                        srcType.getExpectedContainer(c).value());
+                        } catch (NoSuchFieldException nfe) {
+                            error("Could not get " + TESTFIELD
+                                    + " for className = " + c.getName()
+                                    + "Exception = " + nfe);
+                        }
+                        break;
+                }
+                return actualDeclAnnosArgs;
+            }
+
+            @Override
+            public String[] getExpectedAnnoBase(SrcType srcType, Class<?> c) {
+                return srcType.getExpectedBase(c).getDeclAnnosArgs();
+            }
+
+            @Override
+            public String[] getExpectedAnnoContainer(SrcType srcType, Class<?> c) {
+                return srcType.getExpectedContainer(c).getDeclAnnosArgs();
+            }
+        }; // new
+        String name;
+
+        private TestMethod(String name) {
+            this.name = name;
+        }
+
+        public Annotation[] getActualAnnoBase(SrcType srcType, Class<?> c) {
+            return null;
+        }
+
+        public Annotation[] getActualAnnoContainer(SrcType srcType, Class<?> c) {
+            return null;
+        }
+
+        public String[] getExpectedAnnoBase(SrcType srcType, Class<?> c) {
+            return null;
+        }
+
+        public String[] getExpectedAnnoContainer(SrcType srcType, Class<?> c) {
+            return null;
+        }
+    }
+
+    /*
+     * For a given srcType and class object, compare expectedBase and actualBase
+     * annotations as well as expectedContainer and actualContainer annotations.
+     *
+     * Return true if both comparisons are true else return false.
+     *
+     */
+    protected static void checkAnnoValues(SrcType srcType, Class<?> c) {
+
+        // Load @ExpectedBase and @ExpectedContainer
+        ExpectedBase eb = srcType.getExpectedBase(c);
+        ExpectedContainer ec = srcType.getExpectedContainer(c);
+        if (eb == null) {
+            error("Did not find ExpectedBase Annotation, Test will exit");
+            throw new RuntimeException();
+        }
+        if (ec == null) {
+            error("Did not find ExpectedContainer Annotation, Test will exit");
+            throw new RuntimeException();
+        }
+
+        for (TestMethod testMethod : TestMethod.values()) {
+            debugPrint("---------------------------------------------");
+            debugPrint("Test method = " + testMethod);
+            boolean isBasePass = true;
+            boolean isConPass = true;
+            // ExpectedBase = Annotation, no annotation is defined, skip comparison
+            if (!eb.value().getSimpleName().equalsIgnoreCase("Annotation")) {
+                isBasePass = compareAnnotations(
+                        testMethod.getActualAnnoBase(srcType, c),
+                        testMethod.getExpectedAnnoBase(srcType, c));
+            }
+
+            // ExpectedContainer = Annotation, no annotation is defined, skip comparison
+            if (!ec.value().getSimpleName().equalsIgnoreCase("Annotation")) {
+                isConPass = compareAnnotations(
+                        testMethod.getActualAnnoContainer(srcType, c),
+                        testMethod.getExpectedAnnoContainer(srcType, c));
+            }
+            if (isBasePass && isConPass) {
+                debugPrint("Testcase passed for " + testMethod +
+                        " for className = " + c.getName());
+            } else {
+                debugPrint("Testcase failed for " + testMethod +
+                        " for className = " + c.getName());
+            }
+        }
+    }
+
+    // Annotation comparison: Length should be same and all expected values
+    // should be present in actualAnno[].
+    private static boolean compareAnnotations(Annotation[] actualAnnos,
+            String[] expectedAnnos) {
+        // Length is different
+        if (actualAnnos.length != expectedAnnos.length) {
+            error("Length not same, Actual length = " + actualAnnos.length
+                    + " Expected length = " + expectedAnnos.length);
+            printArrContents(actualAnnos);
+            printArrContents(expectedAnnos);
+            return false;
+        } else {
+            int i = 0;
+            // Length is same and 0
+            if (actualAnnos.length == 0) {
+                // Expected/actual lengths already checked for
+                // equality; no more checks do to
+                return true;
+            }
+            // Expected annotation should be NULL
+            if (actualAnnos[0] == null) {
+                if (expectedAnnos[0].equals("NULL")) {
+                    debugPrint("Arr values are NULL as expected");
+                    return true;
+                } else {
+                    error("Array values are not NULL");
+                    printArrContents(actualAnnos);
+                    printArrContents(expectedAnnos);
+                    return false;
+                }
+            }
+            // Lengths are same, compare array contents
+            String[] actualArr = new String[actualAnnos.length];
+            for (Annotation a : actualAnnos) {
+                actualArr[i++] = a.annotationType().getSimpleName();
+            }
+
+            List<String> actualList = Arrays.asList(actualArr);
+            List<String> expectedList = Arrays.asList(expectedAnnos);
+
+            if (!actualList.containsAll(expectedList)) {
+                error("Array values are not same");
+                printArrContents(actualAnnos);
+                printArrContents(expectedAnnos);
+                return false;
+            } else {
+                debugPrint("Arr values are same as expected");
+            }
+        }
+        return true;
+    }
+
+    private static void printArrContents(Annotation[] actualAnnos) {
+        System.out.print("Actual Arr Values: ");
+        for (Annotation a : actualAnnos) {
+            if (a != null && a.annotationType() != null) {
+                System.out.print("[" + a.annotationType().getSimpleName() + "]");
+            } else {
+                System.out.println("[null]");
+            }
+        }
+        System.out.println();
+    }
+
+    private static void printArrContents(String[] expectedAnnos) {
+        System.out.print("Expected Arr Values: ");
+        for (String s : expectedAnnos) {
+            System.out.print("[" + s + "]");
+        }
+        System.out.println();
+    }
+
+    private ClassLoader getLoader() {
+        return getClass().getClassLoader();
+    }
+
+    private static Class<?> loadClass(String className, ClassLoader parentClassLoader, File... destDirs) {
+        try {
+            List<URL> list = new ArrayList<>();
+            for (File f : destDirs) {
+                list.add(new URL("file:" + f.toString().replace("\\", "/") + "/"));
+            }
+            return Class.forName(className, true, new URLClassLoader(
+                    list.toArray(new URL[list.size()]), parentClassLoader));
+        } catch (ClassNotFoundException | MalformedURLException e) {
+            throw new RuntimeException("Error loading class " + className, e);
+        }
+    }
+
+    private static void printTestSrc(Iterable<? extends JavaFileObject> files) {
+        for (JavaFileObject f : files) {
+            System.out.println("Test file " + f.getName() + ":");
+            try {
+                System.out.println("" + f.getCharContent(true));
+            } catch (IOException e) {
+                throw new RuntimeException(
+                        "Exception when printing test src contents for class " +
+                                f.getName(), e);
+            }
+        }
+
+    }
+
+    public static StringBuilder getCommonStmts(boolean isRepeatable) {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
+          .append(Helper.ContentVars.IMPORTSTMTS.getVal())
+          .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+          .append(Helper.ContentVars.INHERITED.getVal());
+        if(isRepeatable) {
+            sb.append(Helper.ContentVars.REPEATABLE.getVal());
+        }
+        sb.append(Helper.ContentVars.BASE.getVal())
+          .append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
+          .append(Helper.ContentVars.INHERITED.getVal())
+          .append(Helper.ContentVars.CONTAINER.getVal());
+        return sb;
+    }
+
+    private static int getNumErrors() {
+        return errors;
+    }
+
+    private static void error(String msg) {
+        System.out.println("error: " + msg);
+        errors++;
+    }
+
+    private static void debugPrint(String string) {
+        if(DEBUG)
+            System.out.println(string);
+    }
+}
--- a/test/tools/javac/annotations/repeatingAnnotations/combo/RetentionAnnoCombo.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/RetentionAnnoCombo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -120,7 +120,7 @@
                 new DiagnosticCollector<JavaFileObject>();
         boolean ok = compileCode(className, contents, diagnostics);
 
-        String expectedErrKey = "compiler.err.invalid.containedby" +
+        String expectedErrKey = "compiler.err.invalid.repeatable" +
                                         ".annotation.retention";
         if (!shouldCompile && !ok) {
             for (Diagnostic<?> d : diagnostics.getDiagnostics()) {
@@ -175,10 +175,9 @@
         StringBuilder annoData = new StringBuilder();
         annoData.append(Helper.ContentVars.IMPORTCONTAINERSTMTS.getVal())
                 .append(Helper.ContentVars.IMPORTRETENTION.getVal())
-                .append(Helper.ContentVars.CONTAINERFOR.getVal())
                 .append(replacedRetCAVal)
                 .append(Helper.ContentVars.CONTAINER.getVal())
-                .append(Helper.ContentVars.CONTAINEDBY.getVal())
+                .append(Helper.ContentVars.REPEATABLE.getVal())
                 .append(replacedRetBaseVal)
                 .append(Helper.ContentVars.BASE.getVal());
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/TargetAnnoCombo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,508 @@
+/*
+ * 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      7151010 8006547 8007766
+ * @summary  Default test cases for running combinations for Target values
+ * @build    Helper
+ * @run main TargetAnnoCombo
+ */
+
+import java.util.Set;
+import java.util.List;
+import java.io.IOException;
+import java.lang.annotation.ElementType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.EnumSet;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaFileObject;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
+import static java.lang.annotation.ElementType.TYPE_USE;
+import static java.lang.annotation.ElementType.TYPE_PARAMETER;
+
+public class TargetAnnoCombo {
+
+    static final String TESTPKG = "testpkg";
+
+    // Set it to true to get more debug information including base and container
+    // target sets for a given test case.
+    static final boolean DEBUG = false;
+
+    // Define constant target sets to be used for the combination of the target values.
+    final static Set<ElementType> noSet = null;
+    final static Set<ElementType> empty = EnumSet.noneOf(ElementType.class);
+
+    // [TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE,
+    // PACKAGE, TYPE_PARAMETER, TYPE_USE]
+    final static Set<ElementType> allTargets = EnumSet.allOf(ElementType.class);
+
+    // [TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE,
+    // PACKAGE]
+    final static Set<ElementType> jdk7 = EnumSet.range(TYPE, PACKAGE);
+
+    // [TYPE_USE, TYPE_PARAMETER]
+    final static Set<ElementType> jdk8 = EnumSet.range(TYPE_PARAMETER, TYPE_USE);
+
+    // List of test cases to run. This list is created in generate().
+    // To run a specific test cases add case number in @run main line.
+    List<TestCase> testCases = new ArrayList<TestCase>();
+
+    int errors = 0;
+
+    // Identify test cases that fail.
+    enum IgnoreKind {
+        RUN,
+        IGNORE
+    };
+
+    private class TestCase {
+
+        private Set<ElementType> baseAnnotations;
+        private Set<ElementType> containerAnnotations;
+        private IgnoreKind ignore;
+
+        public TestCase(Set<ElementType> baseAnnotations, Set<ElementType> containerAnnotations) {
+            this(baseAnnotations, containerAnnotations, IgnoreKind.RUN);
+        }
+
+        public TestCase(Set<ElementType> baseAnnotations, Set<ElementType> containerAnnotations,
+                        IgnoreKind ignoreKind) {
+            this.baseAnnotations = baseAnnotations;
+            this.containerAnnotations = containerAnnotations;
+            this.ignore = ignoreKind;
+        }
+
+        public Set getBaseAnnotations() {
+            return baseAnnotations;
+        }
+
+        public Set getContainerAnnotations() {
+            return containerAnnotations;
+        }
+
+        public boolean isIgnored() {
+            return ignore == IgnoreKind.IGNORE;
+        }
+
+        // Determine if a testCase should compile or not.
+        private boolean isValidSubSet() {
+            /*
+             *  RULE 1: conAnnoTarget should be a subset of baseAnnoTarget
+             *  RULE 2: For empty @Target ({}) - annotation cannot be applied anywhere
+             *         - Empty sets for both is valid
+             *         - Empty baseTarget set is invalid with non-empty conTarget set
+             *         - Non-empty baseTarget set is valid with empty conTarget set
+             *  RULE 3: For no @Target specified - annotation can be applied to any JDK 7 targets
+             *         - No @Target for both is valid
+             *         - No @Target for baseTarget set with @Target conTarget set is valid
+             *         - @Target for baseTarget set with no @Target for conTarget is invalid
+             */
+
+
+            /* If baseAnno has no @Target, Foo can be either applied to @Target specified
+             * for container annotation else will be applicable for all default targets
+             * if no @Target is present for container annotation.
+             * In both cases, the set will be a valid set with no @Target for base annotation
+             */
+            if (baseAnnotations == null) {
+                if (containerAnnotations == null) {
+                    return true;
+                }
+                return !(containerAnnotations.contains(TYPE_USE) ||
+                         containerAnnotations.contains(TYPE_PARAMETER));
+            }
+
+            Set<ElementType> tempBaseSet = EnumSet.noneOf(ElementType.class);
+            tempBaseSet.addAll(baseAnnotations);
+            // If BaseAnno has TYPE, then ANNOTATION_TYPE is allowed by default.
+            if (baseAnnotations.contains(TYPE)) {
+                tempBaseSet.add(ANNOTATION_TYPE);
+            }
+
+            // If containerAnno has no @Target, only valid case if baseAnnoTarget has
+            // all targets defined else invalid set.
+            if (containerAnnotations == null) {
+                return tempBaseSet.containsAll(jdk7);
+            }
+
+            // At this point, neither conAnnoTarget or baseAnnoTarget are null.
+            if (containerAnnotations.isEmpty()) {
+                return true;
+            }
+
+            // At this point, conAnnoTarget is non-empty.
+            if (baseAnnotations.isEmpty()) {
+                return false;
+            }
+
+            // At this point, neither conAnnoTarget or baseAnnoTarget are empty.
+            return tempBaseSet.containsAll(containerAnnotations);
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+        TargetAnnoCombo tac = new TargetAnnoCombo();
+        // Generates all test cases to be run.
+        tac.generate();
+        List<Integer> cases = new ArrayList<Integer>();
+        for (int i = 0; i < args.length; i++) {
+            cases.add(Integer.parseInt(args[i]));
+        }
+        if (cases.isEmpty()) {
+            tac.run();
+        } else {
+            for (int index : cases) {
+                tac.executeTestCase(tac.testCases.get(index), index);
+            }
+        }
+    }
+
+    private void generate() {
+        // Adding test cases to run.
+        testCases.addAll(Arrays.asList(
+                // No base target against no container target.
+                new TestCase(noSet, noSet),
+                // No base target against empty container target.
+                new TestCase(noSet, empty),
+                // No base target against TYPE_USE only container target.
+                new TestCase(noSet, less(jdk8, TYPE_PARAMETER)),
+                // No base target against TYPE_PARAMETER only container target.
+                new TestCase(noSet, less(jdk8, TYPE_USE)),
+                // No base target against TYPE_USE + TYPE_PARAMETER only container target.
+                new TestCase(noSet, jdk8),
+                // No base target against TYPE_USE + some selection of jdk7 targets.
+                new TestCase(noSet,
+                plus(EnumSet.range(TYPE, LOCAL_VARIABLE), TYPE_USE)),
+                // No base target against TYPE_PARAMETER + some selection of jdk7 targets.
+                new TestCase(noSet,
+                plus(EnumSet.range(TYPE, LOCAL_VARIABLE), TYPE_PARAMETER)),
+                // No base target against each jdk7 target alone as container target.
+                new TestCase(noSet, plus(empty, TYPE)),
+                new TestCase(noSet, plus(empty, PARAMETER)),
+                new TestCase(noSet, plus(empty, PACKAGE)),
+                new TestCase(noSet, plus(empty, METHOD)),
+                new TestCase(noSet, plus(empty, LOCAL_VARIABLE)),
+                new TestCase(noSet, plus(empty, FIELD)),
+                new TestCase(noSet, plus(empty, CONSTRUCTOR)),
+                new TestCase(noSet, plus(empty, ANNOTATION_TYPE)),
+                // Empty base target against no container target.
+                new TestCase(empty, noSet),
+                // Empty base target against empty container target.
+                new TestCase(empty, empty),
+                // Empty base target against any lone container target.
+                new TestCase(empty, plus(empty, TYPE)),
+                new TestCase(empty, plus(empty, PARAMETER)),
+                new TestCase(empty, plus(empty, PACKAGE)),
+                new TestCase(empty, plus(empty, METHOD)),
+                new TestCase(empty, plus(empty, LOCAL_VARIABLE)),
+                new TestCase(empty, plus(empty, FIELD)),
+                new TestCase(empty, plus(empty, CONSTRUCTOR)),
+                new TestCase(empty, plus(empty, ANNOTATION_TYPE)),
+                new TestCase(empty, less(jdk8, TYPE_USE)),
+                new TestCase(empty, less(jdk8, TYPE_PARAMETER)),
+                // No container target against all all-but one jdk7 targets.
+                new TestCase(less(jdk7, TYPE), noSet),
+                new TestCase(less(jdk7, PARAMETER), noSet),
+                new TestCase(less(jdk7, PACKAGE), noSet),
+                new TestCase(less(jdk7, METHOD), noSet),
+                new TestCase(less(jdk7, LOCAL_VARIABLE), noSet),
+                new TestCase(less(jdk7, FIELD), noSet),
+                new TestCase(less(jdk7, CONSTRUCTOR), noSet),
+                new TestCase(less(jdk7, ANNOTATION_TYPE), noSet),
+                // No container against all but TYPE and ANNOTATION_TYPE
+                new TestCase(less(jdk7, TYPE, ANNOTATION_TYPE), noSet),
+                // No container against jdk7 targets.
+                new TestCase(jdk7, noSet),
+                // No container against jdk7 targets plus one or both of TYPE_USE, TYPE_PARAMETER
+                new TestCase(plus(jdk7, TYPE_USE), noSet),
+                new TestCase(plus(jdk7, TYPE_PARAMETER), noSet),
+                new TestCase(allTargets, noSet),
+                // Empty container target against any lone target.
+                new TestCase(plus(empty, TYPE), empty),
+                new TestCase(plus(empty, PARAMETER), empty),
+                new TestCase(plus(empty, PACKAGE), empty),
+                new TestCase(plus(empty, METHOD), empty),
+                new TestCase(plus(empty, LOCAL_VARIABLE), empty),
+                new TestCase(plus(empty, FIELD), empty),
+                new TestCase(plus(empty, CONSTRUCTOR), empty),
+                new TestCase(plus(empty, ANNOTATION_TYPE), empty),
+                new TestCase(plus(empty, TYPE_USE), empty),
+                new TestCase(plus(empty, TYPE_PARAMETER), empty),
+                // All base targets against all container targets.
+                new TestCase(allTargets, allTargets),
+                // All base targets against all but one container targets.
+                new TestCase(allTargets, less(allTargets, TYPE)),
+                new TestCase(allTargets, less(allTargets, PARAMETER)),
+                new TestCase(allTargets, less(allTargets, PACKAGE)),
+                new TestCase(allTargets, less(allTargets, METHOD)),
+                new TestCase(allTargets, less(allTargets, LOCAL_VARIABLE)),
+                new TestCase(allTargets, less(allTargets, FIELD)),
+                new TestCase(allTargets, less(allTargets, CONSTRUCTOR)),
+                new TestCase(allTargets, less(allTargets, ANNOTATION_TYPE)),
+                new TestCase(allTargets, less(allTargets, TYPE_USE)),
+                new TestCase(allTargets, less(allTargets, TYPE_PARAMETER)),
+                // All container targets against all but one base targets.
+                new TestCase(less(allTargets, TYPE), allTargets),
+                new TestCase(less(allTargets, PARAMETER), allTargets),
+                new TestCase(less(allTargets, PACKAGE), allTargets),
+                new TestCase(less(allTargets, METHOD), allTargets),
+                new TestCase(less(allTargets, LOCAL_VARIABLE), allTargets),
+                new TestCase(less(allTargets, FIELD), allTargets),
+                new TestCase(less(allTargets, CONSTRUCTOR), allTargets),
+                new TestCase(less(allTargets, ANNOTATION_TYPE), allTargets),
+                new TestCase(less(allTargets, TYPE_USE), allTargets),
+                new TestCase(less(allTargets, TYPE_PARAMETER), allTargets)));
+        // Generates 100 test cases for any lone base target contained in Set
+        // allTargets against any lone container target.
+        for (ElementType b : allTargets) {
+            for (ElementType c : allTargets) {
+                testCases.add(new TestCase(plus(empty, b), plus(empty, c)));
+            }
+        }
+    }
+
+    void run() throws Exception {
+        int testCtr = 0;
+        for (TestCase tc : testCases) {
+            if (!tc.isIgnored()) {
+                executeTestCase(tc, testCases.indexOf(tc));
+                testCtr++;
+            }
+        }
+        System.out.println("Total tests run: " + testCtr);
+        if (errors > 0) {
+            throw new Exception(errors + " errors found");
+        }
+    }
+
+    private void executeTestCase(TestCase testCase, int index) {
+        debugPrint("Test case number = " + index);
+        debugPrint(" => baseAnnoTarget = " + testCase.getBaseAnnotations());
+        debugPrint(" => containerAnnoTarget = " + testCase.getContainerAnnotations());
+
+        String className = "TC" + index;
+        boolean shouldCompile = testCase.isValidSubSet();
+        Iterable<? extends JavaFileObject> files = getFileList(className, testCase, shouldCompile);
+        // Get result of compiling test src file(s).
+        boolean result = getCompileResult(className, shouldCompile, files);
+        // List test src code if test fails.
+        if (!result) {
+            System.out.println("FAIL: Test " + index);
+            try {
+                for (JavaFileObject f : files) {
+                    System.out.println("File: " + f.getName() + "\n" + f.getCharContent(true));
+                }
+            } catch (IOException ioe) {
+                System.out.println("Exception: " + ioe);
+            }
+        } else {
+            debugPrint("PASS: Test " + index);
+        }
+
+    }
+
+    // Create src code and corresponding JavaFileObjects.
+    private Iterable<? extends JavaFileObject> getFileList(String className,
+            TestCase testCase, boolean shouldCompile) {
+        Set<ElementType> baseAnnoTarget = testCase.getBaseAnnotations();
+        Set<ElementType> conAnnoTarget = testCase.getContainerAnnotations();
+        String srcContent = "";
+        String pkgInfoContent = "";
+        String template = Helper.template;
+        String baseTarget = "", conTarget = "";
+
+        String target = Helper.ContentVars.TARGET.getVal();
+        if (baseAnnoTarget != null) {
+            String tmp = target.replace("#VAL", convertToString(baseAnnoTarget).toString());
+            baseTarget = tmp.replace("[", "{").replace("]", "}");
+        }
+        if (conAnnoTarget != null) {
+            String tmp = target.replace("#VAL", convertToString(conAnnoTarget).toString());
+            conTarget = tmp.replace("[", "{").replace("]", "}");
+        }
+
+        String annoData = Helper.ContentVars.IMPORTSTMTS.getVal()
+                + conTarget
+                + Helper.ContentVars.CONTAINER.getVal()
+                + baseTarget
+                + Helper.ContentVars.REPEATABLE.getVal()
+                + Helper.ContentVars.BASE.getVal();
+
+        JavaFileObject pkgInfoFile = null;
+
+        // If shouldCompile = true and no @Target is specified for container annotation,
+        // then all 8 ElementType enum constants are applicable as targets for
+        // container annotation.
+        if (shouldCompile && conAnnoTarget == null) {
+            Set<ElementType> copySet = EnumSet.noneOf(ElementType.class);
+            copySet.addAll(jdk7);
+            conAnnoTarget = copySet;
+        }
+
+        if (shouldCompile) {
+            boolean isPkgCasePresent = conAnnoTarget.contains(PACKAGE);
+            String repeatableAnno = Helper.ContentVars.BASEANNO.getVal()
+                    + " " + Helper.ContentVars.BASEANNO.getVal();
+            for (ElementType s : conAnnoTarget) {
+                String replaceStr = "/*" + s.name() + "*/";
+                if (s.name().equalsIgnoreCase("PACKAGE")) {
+                    //Create packageInfo file.
+                    String pkgInfoName = TESTPKG + "." + "package-info";
+                    pkgInfoContent = repeatableAnno + "\npackage " + TESTPKG + ";" + annoData;
+                    pkgInfoFile = Helper.getFile(pkgInfoName, pkgInfoContent);
+                } else {
+                    template = template.replace(replaceStr, repeatableAnno);
+                    if (!isPkgCasePresent) {
+                        srcContent = template.replace(
+                                "/*ANNODATA*/", annoData).replace("#ClassName", className);
+                    } else {
+                        replaceStr = "/*PACKAGE*/";
+                        String tmp = template.replace(replaceStr, "package " + TESTPKG + ";");
+                        srcContent = tmp.replace("#ClassName", className);
+                    }
+                }
+            }
+        } else {
+            // For invalid cases, compilation should fail at declaration site.
+            template = "class #ClassName {}";
+            srcContent = annoData + template.replace("#ClassName", className);
+        }
+        JavaFileObject srcFile = Helper.getFile(className, srcContent);
+        Iterable<? extends JavaFileObject> files = null;
+        if (pkgInfoFile != null) {
+            files = Arrays.asList(pkgInfoFile, srcFile);
+        } else {
+            files = Arrays.asList(srcFile);
+        }
+        return files;
+    }
+
+    // Compile the test source file(s) and return test result.
+    private boolean getCompileResult(String className, boolean shouldCompile,
+            Iterable<? extends JavaFileObject> files) {
+
+        DiagnosticCollector<JavaFileObject> diagnostics =
+                new DiagnosticCollector<JavaFileObject>();
+        Helper.compileCode(diagnostics, files);
+        // Test case pass or fail.
+        boolean ok = false;
+        String errMesg = "";
+        int numDiags = diagnostics.getDiagnostics().size();
+        if (numDiags == 0) {
+            if (shouldCompile) {
+                debugPrint("Test passed, compiled as expected.");
+                ok = true;
+            } else {
+                errMesg = "Test failed, compiled unexpectedly.";
+                ok = false;
+            }
+        } else {
+            if (shouldCompile) {
+                // did not compile.
+                errMesg = "Test failed, did not compile.";
+                ok = false;
+            } else {
+                // Error in compilation as expected.
+                String expectedErrKey = "compiler.err.invalid.repeatable."
+                        + "annotation.incompatible.target";
+                for (Diagnostic<?> d : diagnostics.getDiagnostics()) {
+                    if ((d.getKind() == Diagnostic.Kind.ERROR)
+                            && d.getCode().contains(expectedErrKey)) {
+                        // Error message as expected.
+                        debugPrint("Error message as expected.");
+                        ok = true;
+                        break;
+                    } else {
+                        // error message is incorrect.
+                        ok = false;
+                    }
+                }
+                if (!ok) {
+                    errMesg = "Incorrect error received when compiling "
+                            + className + ", expected: " + expectedErrKey;
+                }
+            }
+        }
+
+        if (!ok) {
+            error(errMesg);
+            for (Diagnostic<?> d : diagnostics.getDiagnostics()) {
+                System.out.println(" Diags: " + d);
+            }
+        }
+        return ok;
+    }
+
+    private Set<ElementType> less(Set<ElementType> base, ElementType... sub) {
+        Set<ElementType> res = EnumSet.noneOf(ElementType.class);
+        res.addAll(base);
+        for (ElementType t : sub) {
+            res.remove(t);
+        }
+        return res;
+    }
+
+    private Set<ElementType> plus(Set<ElementType> base, ElementType... add) {
+        Set<ElementType> res = EnumSet.noneOf(ElementType.class);
+        res.addAll(base);
+        for (ElementType t : add) {
+            res.add(t);
+        }
+        return res;
+    }
+
+    // Iterate target set and add "ElementType." in front of every target type.
+    private List<String> convertToString(Set<ElementType> annoTarget) {
+        if (annoTarget == null) {
+            return null;
+        }
+        List<String> annoTargets = new ArrayList<String>();
+        for (ElementType e : annoTarget) {
+            annoTargets.add("ElementType." + e.name());
+        }
+        return annoTargets;
+    }
+
+    private void debugPrint(String string) {
+        if (DEBUG) {
+            System.out.println(string);
+        }
+    }
+
+    private void error(String msg) {
+        System.out.println("ERROR: " + msg);
+        errors++;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/expectedFiles/ExpectedBase.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package expectedFiles;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectedBase {
+    Class<? extends Annotation> value() default Annotation.class;
+    String getAnnotationVal() default "";
+    String[] getAnnotationsVals() default {};
+    String[] getDeclAnnosVals() default {};
+    // JDK8 methods
+    String getDeclAnnoVal() default "";
+    String[] getAnnosArgs() default{};
+    String[] getDeclAnnosArgs() default {};
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/repeatingAnnotations/combo/expectedFiles/ExpectedContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package expectedFiles;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectedContainer {
+    Class<? extends Annotation> value() default Annotation.class;
+    String getAnnotationVal() default "";
+    String[] getAnnotationsVals() default {};
+    String[] getDeclAnnosVals() default {};
+    // JDK8 methods
+    String getDeclAnnoVal() default "";
+    String[] getAnnosArgs() default{};
+    String[] getDeclAnnosArgs() default {};
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/6967002/T6967002.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 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 6967002 8006775
+ * @summary JDK7 b99 javac compilation error (java.lang.AssertionError)
+ * @author Maurizio Cimadamore
+ * @compile/fail/ref=T6967002.out -XDrawDiagnostics T6967002.java
+ */
+class Test {
+   private static void m(byte[] octets) {
+      return m(octets..., ?);
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/6967002/T6967002.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,8 @@
+T6967002.java:33:22: compiler.err.expected: ')'
+T6967002.java:33:25: compiler.err.illegal.start.of.expr
+T6967002.java:33:28: compiler.err.illegal.start.of.expr
+T6967002.java:33:29: compiler.err.illegal.start.of.expr
+T6967002.java:33:27: compiler.err.not.stmt
+T6967002.java:33:30: compiler.err.expected: ';'
+T6967002.java:35:2: compiler.err.premature.eof
+7 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/InnerClass.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,65 @@
+import java.lang.annotation.ElementType;
+
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary compiler crashes when visiting inner classes
+ * @author Mahmood Ali
+ * @compile InnerClass.java
+ */
+
+import java.lang.annotation.*;
+
+class InnerClass {
+
+    InnerClass() {}
+    InnerClass(Object o) {}
+
+    private void a() {
+        new Object() {
+            public <R> void method() { }
+        };
+    }
+
+    Object f1 = new InnerClass() {
+            <R> void method() { }
+        };
+
+    Object f2 = new InnerClass() {
+            <@A R> void method() { }
+        };
+
+    Object f3 = new InnerClass(null) {
+            <R> void method() { }
+        };
+
+    Object f4 = new InnerClass(null) {
+            <@A R> void method() { }
+        };
+
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface A { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/MultipleTargets.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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
+ * @bug 6843077 8006775
+ * @summary check that type annotations may appear on void method if it is a
+ *          method annotation too.
+ * @author Mahmood Ali
+ * @compile MultipleTargets.java
+ */
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+class TypeUseTarget<K extends @A Object> {
+  @A void voidMethod() { }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.METHOD})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/TargetTypes.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2009, 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 static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.util.*;
+import java.io.*;
+
+/*
+ * @test
+ * @summary compiler accepts all values
+ * @author Mahmood Ali
+ * @author Yuri Gaevsky
+ * @compile TargetTypes.java
+ */
+
+@Target({TYPE_USE, TYPE_PARAMETER, TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@interface A {}
+
+/** wildcard bound */
+class T0x1C {
+    void m0x1C(List<? extends @A String> lst) {}
+}
+
+/** wildcard bound generic/array */
+class T0x1D<T> {
+    void m0x1D(List<? extends @A List<int[]>> lst) {}
+}
+
+/** typecast */
+class T0x00 {
+    void m0x00(Long l1) {
+        Object l2 = (@A Long) l1;
+    }
+}
+
+/** typecast generic/array */
+class T0x01<T> {
+    void m0x01(List<T> list) {
+        List<T> l = (List<@A T>) list;
+    }
+}
+
+/** instanceof */
+class T0x02 {
+    boolean m0x02(String s) {
+        return (s instanceof @A String);
+    }
+}
+
+/** object creation (new) */
+class T0x04 {
+    void m0x04() {
+        new @A ArrayList<String>();
+    }
+}
+
+/** local variable */
+class T0x08 {
+    void m0x08() {
+      @A String s = null;
+    }
+}
+
+/** method parameter generic/array */
+class T0x0D {
+    void m0x0D(HashMap<@A Object, List<@A List<@A Class>>> s1) {}
+}
+
+/** method receiver */
+class T0x06 {
+    void m0x06(@A T0x06 this) {}
+}
+
+/** method return type generic/array */
+class T0x0B {
+    Class<@A Object> m0x0B() { return null; }
+}
+
+/** field generic/array */
+class T0x0F {
+    HashMap<@A Object, @A Object> c1;
+}
+
+/** method type parameter */
+class T0x20<T, U> {
+    <@A T, @A U> void m0x20() {}
+}
+
+/** class type parameter */
+class T0x22<@A T, @A U> {
+}
+
+/** class type parameter bound */
+class T0x10<T extends @A Object> {
+}
+
+/** method type parameter bound */
+class T0x12<T> {
+    <T extends @A Object> void m0x12() {}
+}
+
+/** class type parameter bound generic/array */
+class T0x11<T extends List<@A T>> {
+}
+
+
+/** method type parameter bound generic/array */
+class T0x13 {
+    static <T extends Comparable<@A T>> T m0x13() {
+        return null;
+    }
+}
+
+/** class extends/implements generic/array */
+class T0x15<T> extends ArrayList<@A T> {
+}
+
+/** type test (instanceof) generic/array */
+class T0x03<T> {
+    void m0x03(T typeObj, Object obj) {
+        boolean ok = obj instanceof String @A [];
+    }
+}
+
+/** object creation (new) generic/array */
+class T0x05<T> {
+    void m0x05() {
+        new ArrayList<@A T>();
+    }
+}
+
+/** local variable generic/array */
+class T0x09<T> {
+    void g() {
+        List<@A String> l = null;
+    }
+
+    void a() {
+        String @A [] as = null;
+    }
+}
+
+/** type argument in constructor call generic/array */
+class T0x19 {
+    <T> T0x19() {}
+
+    void g() {
+       new <List<@A String>> T0x19();
+    }
+}
+
+/** type argument in method call generic/array */
+class T0x1B<T> {
+    void m0x1B() {
+        Collections.<T @A []>emptyList();
+    }
+}
+
+/** type argument in constructor call */
+class T0x18<T> {
+    <T> T0x18() {}
+
+    void m() {
+        new <@A Integer> T0x18();
+    }
+}
+
+/** type argument in method call */
+class T0x1A<T,U> {
+    public static <T, U> T m() { return null; }
+    static void m0x1A() {
+        T0x1A.<@A Integer, @A Short>m();
+    }
+}
+
+/** class extends/implements */
+class T0x14 extends @A Object implements @A Serializable, @A Cloneable {
+}
+
+/** exception type in throws */
+class T0x16 {
+    void m0x16() throws @A Exception {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/TypeParameterTarget.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,46 @@
+/*
+ * 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
+ * @bug 6843077 8006775
+ * @summary check that type annotations may appear on all type parameter
+ * @author Mahmood Ali
+ * @compile TypeParameterTarget.java
+ */
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+class TypeUseTarget<@A K extends Object> {
+  String[] field;
+
+  <@A K, @A V> String genericMethod(K k) { return null; }
+}
+
+interface MyInterface { }
+
+@interface MyAnnotation { }
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/TypeProcOnly.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2009, 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.*;
+import java.util.Set;
+import java.util.HashSet;
+
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.*;
+import javax.lang.model.util.ElementFilter;
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.main.JavaCompiler;
+import com.sun.tools.javac.main.JavaCompiler.CompileState;
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.util.Context;
+
+/*
+ * @test
+ * @summary test that type processors are run when -proc:only is passed.
+ * This class implements the functionality of a type processor, as previously
+ * embodied by the AbstractTypeProcessor class.
+ *
+ * @author Mahmood Ali
+ * @author Werner Dietl
+ */
+@SupportedAnnotationTypes("*")
+public class TypeProcOnly extends AbstractProcessor {
+    private static final String INDICATOR = "INDICATOR";
+
+    private final AttributionTaskListener listener = new AttributionTaskListener();
+    private final Set<Name> elements = new HashSet<Name>();
+
+    @Override
+    public final void init(ProcessingEnvironment env) {
+        super.init(env);
+        JavacTask.instance(env).addTaskListener(listener);
+        Context ctx = ((JavacProcessingEnvironment)processingEnv).getContext();
+        JavaCompiler compiler = JavaCompiler.instance(ctx);
+        compiler.shouldStopPolicyIfNoError = CompileState.max(
+                compiler.shouldStopPolicyIfNoError,
+                CompileState.FLOW);
+    }
+
+    @Override
+    public final boolean process(Set<? extends TypeElement> annotations,
+            RoundEnvironment roundEnv) {
+        for (TypeElement elem : ElementFilter.typesIn(roundEnv.getRootElements())) {
+            elements.add(elem.getQualifiedName());
+        }
+        return false;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    private final class AttributionTaskListener implements TaskListener {
+        @Override
+        public void started(TaskEvent e) { }
+
+        @Override
+        public void finished(TaskEvent e) {
+            if (e.getKind() != TaskEvent.Kind.ANALYZE)
+                return;
+
+            if (!elements.remove(e.getTypeElement().getQualifiedName()))
+                return;
+
+            System.out.println(INDICATOR);
+        }
+    }
+
+
+    private static File writeTestFile() throws IOException {
+        File f = new File("Test.java");
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+        out.println("class Test { }");
+        out.close();
+        return f;
+    }
+
+    public static void main(String[] args) throws Exception {
+        PrintStream prevOut = System.out;
+
+        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+        PrintStream out = new PrintStream(bytes);
+        System.setOut(out);
+
+        try {
+            File f = writeTestFile();
+            com.sun.tools.javac.Main.compile(new String[] {"-proc:only", "-processor", "TypeProcOnly", f.getAbsolutePath()});
+        } finally {
+            System.setOut(prevOut);
+        }
+
+        if (bytes.toString().trim().equals(INDICATOR)) {
+            System.out.println("PASSED");
+        } else {
+            throw new Exception("Processor did not run correctly. Output: " + bytes);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/TypeUseTarget.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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
+ * @bug 6843077 8006775
+ * @summary check that type annotations may appear on all type declarations
+ * @author Mahmood Ali
+ * @compile TypeUseTarget.java
+ */
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+@A
+class TypeUseTarget<K extends @A Object> {
+  @A String @A [] field;
+
+  @A String test(@A TypeUseTarget<K> this, @A String param, @A String @A ... vararg) {
+    @A Object o = new @A String @A [3];
+    TypeUseTarget<@A String> target;
+    return (@A String) null;
+  }
+
+  <K> @A String genericMethod(K k) { return null; }
+  @Decl <K> @A String genericMethod1(K k) { return null; }
+  @A @Decl <K> String genericMethod2(K k) { return null; }
+  @Decl @A <K> String genericMethod3(K k) { return null; }
+  <K> @Decl String genericMethod4(K k) { return null; }
+  <K> @A @Decl String genericMethod5(K k) { return null; }
+}
+
+@A
+interface MyInterface { }
+
+@A
+@interface MyAnnotation { }
+
+@Target(ElementType.TYPE_USE)
+@interface A { }
+
+@interface Decl { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Checks the annotation types targeting array types
+ */
+
+import com.sun.tools.javac.api.JavacTool;
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.lang.annotation.*;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import com.sun.source.tree.*;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreeScanner;
+import javax.tools.StandardJavaFileManager;
+
+
+public class AnnotatedArrayOrder {
+    public static void main(String[] args) throws Exception {
+        PrintWriter out = new PrintWriter(System.out, true);
+        JavacTool tool = JavacTool.create();
+        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+        File testSrc = new File(System.getProperty("test.src"));
+        Iterable<? extends JavaFileObject> f =
+            fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "AnnotatedArrayOrder.java")));
+        JavacTask task = tool.getTask(out, fm, null, null, null, f);
+        Iterable<? extends CompilationUnitTree> trees = task.parse();
+        out.flush();
+
+        Scanner s = new Scanner();
+        for (CompilationUnitTree t: trees)
+            s.scan(t, null);
+
+    }
+
+    private static class Scanner extends TreeScanner<Void,Void> {
+        public Void visitCompilationUnit(CompilationUnitTree node, Void ignore) {
+            super.visitCompilationUnit(node, ignore);
+            if (!expectedLocations.isEmpty()) {
+                throw new AssertionError("Didn't found all annotations: " + expectedLocations);
+            }
+            return null;
+        }
+
+        private void testAnnotations(List<? extends AnnotationTree> annos, int found) {
+            String annotation = annos.get(0).toString();
+
+            if (!expectedLocations.containsKey(annotation))
+                throw new AssertionError("Found unexpected annotation: " + annotation + expectedLocations);
+
+            int expected = expectedLocations.get(annotation);
+            if (found != expected)
+                throw new AssertionError("The expected array length for this error doesn't match");
+
+            expectedLocations.remove(annotation);
+        }
+
+        public Void visitAnnotatedType(AnnotatedTypeTree node, Void ignore) {
+            testAnnotations(node.getAnnotations(), arrayLength(node));
+            return super.visitAnnotatedType(node, ignore);
+        }
+
+        private int arrayLength(Tree tree) {
+            switch (tree.getKind()) {
+            case ARRAY_TYPE:
+                return 1 + arrayLength(((ArrayTypeTree)tree).getType());
+            case ANNOTATED_TYPE:
+                return arrayLength(((AnnotatedTypeTree)tree).getUnderlyingType());
+            default:
+                return 0;
+            }
+        }
+    }
+
+    // expectedLocations values:
+    static Map<String, Integer> expectedLocations = new HashMap<String, Integer>();
+
+    // visited code
+    @A String @C [] @B [] field;
+    static {
+        // Shouldn't find @A(), as it is field annotation
+        expectedLocations.put("@B()", 1);
+        expectedLocations.put("@C()", 2);
+    }
+
+    List<@D String @F [] @E []> typearg;
+    static {
+        expectedLocations.put("@D()", 0);
+        expectedLocations.put("@E()", 1);
+        expectedLocations.put("@F()", 2);
+    }
+
+    void varargSimple(@G String @H ... vararg1) { }
+    static {
+        // Shouldn't find @G(), as it is a parameter annotation
+        expectedLocations.put("@H()", 1);
+    }
+
+    void varargLong(@I String @L [] @K [] @J ... vararg2) { }
+    static {
+        // Shouldn't find @I(), as it is a parameter annotation
+        expectedLocations.put("@J()", 1);
+        expectedLocations.put("@K()", 2);
+        expectedLocations.put("@L()", 3);
+    }
+
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface A {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface B {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface C {}
+
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface D {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface E {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface F {}
+
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface G {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface H {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface I {}
+
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface J {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface K {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface L {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/api/ArrayCreationTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Checks that the interaction between annotated and unannotated
+  *         array levels in array creation trees
+ */
+
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.tree.JCTree.JCNewArray;
+import java.lang.annotation.*;
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import com.sun.source.tree.*;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreeScanner;
+import javax.tools.StandardJavaFileManager;
+
+
+public class ArrayCreationTree {
+    public static void main(String[] args) throws Exception {
+        PrintWriter out = new PrintWriter(System.out, true);
+        JavacTool tool = JavacTool.create();
+        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+        File testSrc = new File(System.getProperty("test.src"));
+        Iterable<? extends JavaFileObject> f =
+            fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "ArrayCreationTree.java")));
+        JavacTask task = tool.getTask(out, fm, null, null, null, f);
+        Iterable<? extends CompilationUnitTree> trees = task.parse();
+        out.flush();
+
+        Scanner s = new Scanner();
+        for (CompilationUnitTree t: trees)
+            s.scan(t, null);
+
+    }
+
+    private static class Scanner extends TreeScanner<Void,Void> {
+        int foundAnnotations = 0;
+        public Void visitCompilationUnit(CompilationUnitTree node, Void ignore) {
+            super.visitCompilationUnit(node, ignore);
+            if (foundAnnotations != expectedAnnotations) {
+                throw new AssertionError("Expected " + expectedAnnotations +
+                        " annotations but found: " + foundAnnotations);
+            }
+            return null;
+        }
+
+        private void testAnnotations(List<? extends AnnotationTree> annos, int found) {
+            if (annos.isEmpty()) return;
+
+            String annotation = annos.get(0).toString();
+            foundAnnotations++;
+
+            int expected = -1;
+            if (annotation.equals("@A()"))
+                expected = 0;
+            else if (annotation.equals("@B()"))
+                expected = 1;
+            else if (annotation.equals("@C()"))
+                expected = 2;
+            else
+                throw new AssertionError("found an unexpected annotation: " + annotation);
+            if (found != expected) {
+                throw new AssertionError("Unexpected found length" +
+                    ", found " + found + " but expected " + expected);
+            }
+        }
+
+        public Void visitAnnotatedType(AnnotatedTypeTree node, Void ignore) {
+            testAnnotations(node.getAnnotations(), arrayLength(node));
+            return super.visitAnnotatedType(node, ignore);
+        }
+
+        public Void visitNewArray(NewArrayTree node, Void ignore) {
+            // the Tree API hasn't been updated to expose annotations yet
+            JCNewArray newArray = (JCNewArray)node;
+            int totalLength = node.getDimensions().size()
+                                + arrayLength(node.getType())
+                                + ((newArray.getInitializers() != null) ? 1 : 0);
+            testAnnotations(newArray.annotations, totalLength);
+            int count = 0;
+            for (List<? extends AnnotationTree> annos : newArray.dimAnnotations) {
+                testAnnotations(annos, totalLength - count);
+                count++;
+            }
+            return super.visitNewArray(node, ignore);
+        }
+
+        private int arrayLength(Tree tree) {
+            // TODO: the tree is null when called with node.getType(). Why?
+            if (tree==null) return -1;
+            switch (tree.getKind()) {
+            case ARRAY_TYPE:
+                return 1 + arrayLength(((ArrayTypeTree)tree).getType());
+            case ANNOTATED_TYPE:
+                return arrayLength(((AnnotatedTypeTree)tree).getUnderlyingType());
+            default:
+                return 0;
+            }
+        }
+    }
+
+    static int expectedAnnotations = 21;
+
+    Object a1 = new @A Object @C [2] @B [1];
+    Object b1 = new @A Object @C [2] @B [ ];
+    Object c1 = new @A Object @C [ ] @B [ ] { };
+
+    Object a2 = new @A Object @C [2]    [1];
+    Object b2 = new @A Object @C [2]    [ ];
+    Object c2 = new @A Object @C [ ]    [ ] { };
+
+    Object a3 = new @A Object    [2] @B [1];
+    Object b3 = new @A Object    [2] @B [ ];
+    Object c3 = new @A Object    [ ] @B [ ] { };
+
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface A {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface B {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface C {}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/api/ArrayPositionConsistency.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Checks that the interaction between annotated and unannotated
+  *         array levels
+ */
+
+import com.sun.tools.javac.api.JavacTool;
+import java.lang.annotation.*;
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import com.sun.source.tree.*;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreeScanner;
+import javax.tools.StandardJavaFileManager;
+
+
+public class ArrayPositionConsistency {
+    public static void main(String[] args) throws Exception {
+        PrintWriter out = new PrintWriter(System.out, true);
+        JavacTool tool = JavacTool.create();
+        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+        File testSrc = new File(System.getProperty("test.src"));
+        Iterable<? extends JavaFileObject> f =
+            fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "ArrayPositionConsistency.java")));
+        JavacTask task = tool.getTask(out, fm, null, null, null, f);
+        Iterable<? extends CompilationUnitTree> trees = task.parse();
+        out.flush();
+
+        Scanner s = new Scanner();
+        for (CompilationUnitTree t: trees)
+            s.scan(t, null);
+
+    }
+
+    private static class Scanner extends TreeScanner<Void,Void> {
+        int foundAnnotations = 0;
+        public Void visitCompilationUnit(CompilationUnitTree node, Void ignore) {
+            super.visitCompilationUnit(node, ignore);
+            if (foundAnnotations != expectedAnnotations) {
+                throw new AssertionError("Expected " + expectedAnnotations +
+                        " annotations but found: " + foundAnnotations);
+            }
+            return null;
+        }
+
+        private void testAnnotations(List<? extends AnnotationTree> annos, int found) {
+            String annotation = annos.get(0).toString();
+            foundAnnotations++;
+
+            int expected = -1;
+            if (annotation.equals("@A()"))
+                expected = 0;
+            else if (annotation.equals("@B()"))
+                expected = 1;
+            else if (annotation.equals("@C()"))
+                expected = 2;
+            else
+                throw new AssertionError("found an unexpected annotation: " + annotation);
+            if (found != expected) {
+                throw new AssertionError("Unexpected found length" +
+                    ", found " + found + " but expected " + expected);
+            }
+        }
+
+        public Void visitAnnotatedType(AnnotatedTypeTree node, Void ignore) {
+            testAnnotations(node.getAnnotations(), arrayLength(node));
+            return super.visitAnnotatedType(node, ignore);
+        }
+
+        private int arrayLength(Tree tree) {
+            switch (tree.getKind()) {
+            case ARRAY_TYPE:
+                return 1 + arrayLength(((ArrayTypeTree)tree).getType());
+            case ANNOTATED_TYPE:
+                return arrayLength(((AnnotatedTypeTree)tree).getUnderlyingType());
+            default:
+                return 0;
+            }
+        }
+    }
+
+    static int expectedAnnotations = 23;
+
+    // visited code
+    @A String @C [] @B [] field1;
+    @A String @C []    [] field2;
+    @A String    [] @B [] field3;
+       String    [] @B [] field4;
+
+    @A List<String> @C [] @B [] genfield1;
+    @A List<String> @C []    [] genfield2;
+    @A List<String>    [] @B [] genfield3;
+       List<String>    [] @B [] genfield4;
+
+    List<@A String @C [] @B []> typearg1;
+    List<@A String @C []    []> typearg2;
+    List<@A String    [] @B []> typearg3;
+    List<   String    [] @B []> typearg4;
+
+    void vararg1(@A String @C [] @B ... arg) {}
+    void vararg2(@A String @C []    ... arg) {}
+    void vararg3(@A String    [] @B ... arg) {}
+    void vararg4(   String    [] @B ... arg) {}
+
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface A {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface B {}
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface C {}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/attribution/Scopes.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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
+ * @bug 6843077 8006775
+ * @summary test scopes of attribution
+ * @author Mahmood Ali
+ * @compile Scopes.java
+ */
+class Scopes {
+
+  void test(@A(VALUE) Scopes this) { }
+  void test1(@A(value=VALUE) Scopes this) { }
+
+  private static final int VALUE = 1;
+  @interface A { int value(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,195 @@
+/*
+ * 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
+ * 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.*;
+
+public class ClassfileTestHelper {
+    int expected_tinvisibles = 0;
+    int expected_tvisibles = 0;
+    int expected_invisibles = 0;
+    int expected_visibles = 0;
+
+    //Makes debugging much easier. Set to 'false' for less output.
+    public Boolean verbose = true;
+    void println(String msg) { if(verbose) System.out.println(msg); }
+
+    File writeTestFile(String fname, String source) throws IOException {
+      File f = new File(fname);
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+        out.println(source);
+        out.close();
+        return f;
+    }
+
+    File compile(File f) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] {
+                "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    ClassFile getClassFile(String name) throws IOException, ConstantPoolException {
+        URL url = getClass().getResource(name);
+        InputStream in = url.openStream();
+        try {
+            return ClassFile.read(in);
+        } finally {
+            in.close();
+        }
+    }
+
+    ClassFile getClassFile(URL url) throws IOException, ConstantPoolException {
+            InputStream in = url.openStream();
+            try {
+                return ClassFile.read(in);
+            } finally {
+                in.close();
+            }
+    }
+
+    /************ Helper annotations counting methods ******************/
+    void test(ClassFile cf) {
+        test("CLASS",cf, null, null, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test("CLASS",cf, null, null, Attribute.RuntimeInvisibleTypeAnnotations, false);
+        //RuntimeAnnotations since one annotation can result in two attributes.
+        test("CLASS",cf, null, null, Attribute.RuntimeVisibleAnnotations, true);
+        test("CLASS",cf, null, null, Attribute.RuntimeInvisibleAnnotations, false);
+    }
+
+    void test(ClassFile cf, Method m) {
+        test("METHOD",cf, null, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test("METHOD",cf, null, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+        test("METHOD",cf, null, m, Attribute.RuntimeVisibleAnnotations, true);
+        test("METHOD",cf, null, m, Attribute.RuntimeInvisibleAnnotations, false);
+    }
+
+    void test(ClassFile cf, Field f) {
+        test("FIELD",cf, f, null, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test("FIELD",cf, f, null, Attribute.RuntimeInvisibleTypeAnnotations, false);
+        test("FIELD",cf, f, null, Attribute.RuntimeVisibleAnnotations, true);
+        test("FIELD",cf, f, null, Attribute.RuntimeInvisibleAnnotations, false);
+    }
+
+
+    // Test the result of Attributes.getIndex according to expectations
+    // encoded in the class/field/method name; increment annotations counts.
+    void test(String ttype, ClassFile cf, Field f, Method m, String annName, boolean visible) {
+        String testtype = ttype;
+        String name = null;
+        int index = -1;
+        Attribute attr = null;
+        boolean isTAattr = annName.contains("TypeAnnotations");
+        try {
+            switch(testtype) {
+                case "FIELD":
+                    name = f.getName(cf.constant_pool);
+                    index = f.attributes.getIndex(cf.constant_pool, annName);
+                    if(index!= -1) attr = f.attributes.get(index);
+                    break;
+                case "METHOD":
+                    name = m.getName(cf.constant_pool);
+                    index = m.attributes.getIndex(cf.constant_pool, annName);
+                    if(index!= -1) attr = m.attributes.get(index);
+                    break;
+                default:
+                    name = cf.getName();
+                    index = cf.attributes.getIndex(cf.constant_pool, annName);
+                    if(index!= -1) attr = cf.attributes.get(index);
+            }
+        } catch(ConstantPoolException cpe) { cpe.printStackTrace(); }
+
+        if (index != -1) {
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            if(isTAattr) { //count RuntimeTypeAnnotations
+                RuntimeTypeAnnotations_attribute tAttr =
+                        (RuntimeTypeAnnotations_attribute)attr;
+                println(testtype + ": " + name + ", " + annName + ": " +
+                        tAttr.annotations.length );
+                allt += tAttr.annotations.length;
+                if (visible)
+                    tvisibles += tAttr.annotations.length;
+                else
+                    tinvisibles += tAttr.annotations.length;
+            } else {
+                RuntimeAnnotations_attribute tAttr =
+                        (RuntimeAnnotations_attribute)attr;
+                println(testtype + ": " + name + ", " + annName + ": " +
+                        tAttr.annotations.length );
+                all += tAttr.annotations.length;
+                if (visible)
+                    visibles += tAttr.annotations.length;
+                else
+                    invisibles += tAttr.annotations.length;
+            }
+        }
+    }
+
+    void countAnnotations() {
+        errors=0;
+        int expected_allt = expected_tvisibles + expected_tinvisibles;
+        int expected_all = expected_visibles + expected_invisibles;
+
+        if (expected_allt != allt) {
+            errors++;
+            System.err.println("Failure: expected " + expected_allt +
+                    " type annotations but found " + allt);
+        }
+        if (expected_all != all) {
+            errors++;
+            System.err.println("Failure: expected " + expected_all +
+                    " annotations but found " + all);
+        }
+        if (expected_tvisibles != tvisibles) {
+            errors++;
+            System.err.println("Failure: expected " + expected_tvisibles +
+                    " typevisible annotations but found " + tvisibles);
+        }
+
+        if (expected_tinvisibles != tinvisibles) {
+            errors++;
+            System.err.println("Failure: expected " + expected_tinvisibles +
+                    " typeinvisible annotations but found " + tinvisibles);
+        }
+        allt=0;
+        tvisibles=0;
+        tinvisibles=0;
+        all=0;
+        visibles=0;
+        invisibles=0;
+    }
+
+    int errors;
+    int allt;
+    int tvisibles;
+    int tinvisibles;
+    int all;
+    int visibles;
+    int invisibles;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,366 @@
+/*
+ * 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 8005877 8004829 8005681 8006734 8006775
+ * @ignore
+ * @summary Combinations of Target ElementTypes on (repeated)type annotations.
+ */
+
+import com.sun.tools.classfile.*;
+import java.io.File;
+
+public class CombinationsTargetTest1 extends ClassfileTestHelper {
+    // Helps identify test case in event of failure.
+    int testcount = 0;
+    int src1 = 1, src2 = 2, src4 = 4,
+        src5 = 5, src6 = 6, src7 = 7;
+
+    String[] ETypes={"TYPE", "FIELD", "METHOD", "PARAMETER", "CONSTRUCTOR",
+                     "LOCAL_VARIABLE", "ANNOTATION_TYPE", "PACKAGE"};
+
+    // local class tests will have an inner class.
+    Boolean hasInnerClass=false;
+    String innerClassname="";
+
+    public static void main(String[] args) throws Exception {
+        new CombinationsTargetTest1().run();
+    }
+
+    void run() throws Exception {
+        // Determines which repeat and order in source(ABMix).
+        Boolean As= false, BDs=true, ABMix=false;
+        int testrun=0;
+        // A repeats and/or B/D repeats, ABMix for order of As and Bs.
+        Boolean [][] bRepeat = new Boolean[][]{{false,false,false},//no repeats
+                                               {true,false,false}, //repeat @A
+                                               {false,true,false}, //repeat @B
+                                               {true,true,false},  //repeat both
+                                               {false,false,true}  //repeat mix
+        };
+        for(Boolean[] bCombo : bRepeat) {
+            As=bCombo[0]; BDs=bCombo[1]; ABMix=bCombo[2];
+            for(String et : ETypes) {
+               switch(et) {
+                   case "METHOD":
+                       test( 8,  0, 2, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src1);
+                       test(10,  0, 2, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src2);
+                       test( 8,  0, 0, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src4);
+                       test(10,  0, 2, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src6);
+                       test( 0,  8, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, src1);
+                       test( 0, 10, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, src2);
+                       test( 0,  8, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, src4);
+                       test( 0, 10, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, src6);
+                       break;
+                   case "CONSTRUCTOR":
+                   case "FIELD":
+                       test( 8,  0, 4, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src1);
+                       test( 6,  0, 3, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src5);
+                       test( 9,  0, 0, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src7);
+                       test( 0,  8, 0, 4, As, BDs, ABMix, "RUNTIME", et, ++testrun, src1);
+                       test( 0,  6, 0, 3, As, BDs, ABMix, "RUNTIME", et, ++testrun, src5);
+                       test( 0,  9, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, src7);
+                       break;
+                   default:/*TYPE,PARAMETER,LOCAL_VARIABLE,ANNOTATION_TYPE,PACKAGE*/
+                       test( 8,  0, 2, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src1);
+                       test( 6,  0, 3, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src5);
+                       test( 0,  8, 0, 2, As, BDs, ABMix, "RUNTIME", et, ++testrun, src1);
+                       test( 0,  6, 0, 3, As, BDs, ABMix, "RUNTIME", et, ++testrun, src5);
+               }
+            }
+        }
+    }
+
+    public void test(int tinv, int tvis, int inv, int vis, Boolean Arepeats,
+                     Boolean BDrepeats, Boolean ABmix, String rtn, String et2,
+                     Integer N, int source) throws Exception {
+        ++testcount;
+        expected_tvisibles = tvis;
+        expected_tinvisibles = tinv;
+        expected_visibles = vis;
+        expected_invisibles = inv;
+        File testFile = null;
+        String tname="Test" + N.toString();
+        hasInnerClass=false;
+        String testDef = "Test " + testcount + " parameters: tinv=" + tinv +
+                ", tvis=" + tvis + ", inv=" + inv + ", vis=" + vis +
+                ", Arepeats=" + Arepeats + ", BDrepeats=" + BDrepeats +
+                ", ABmix=" + ABmix + ", retention: " + rtn + ", anno2: " +
+                et2 + ", src=" + source;
+
+        println(testDef);
+        // Create test source and File.
+        String sourceString = sourceString(tname, rtn, et2, Arepeats,
+                                           BDrepeats, ABmix, source);
+        testFile = writeTestFile(tname+".java", sourceString);
+        // 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;
+        }
+        //if sourcString() set hasInnerClass it also set innerClassname.
+        if(hasInnerClass) {
+            StringBuffer sb = new StringBuffer(classFile.getAbsolutePath());
+            classFile=new File(sb.insert(sb.lastIndexOf(".class"),innerClassname).toString());
+        }
+        ClassFile cf = ClassFile.read(classFile);
+
+        //Test class,fields and method counts.
+        test(cf);
+
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+        countAnnotations();
+        if (errors > 0) {
+            System.err.println( testDef );
+            System.err.println( "Source:\n" + sourceString );
+            throw new Exception( errors + " errors found" );
+        }
+        println("Pass");
+    }
+
+    //
+    // Source for test cases
+    //
+    String sourceString(String testname, String retentn, String annot2,
+                        Boolean Arepeats, Boolean BDrepeats, Boolean ABmix,
+                        int src) {
+
+        String As = "@A", Bs = "@B", Ds = "@D";
+        if(Arepeats) As = "@A @A";
+        if(BDrepeats) {
+            Bs = "@B @B";
+            Ds = "@D @D";
+        }
+        if(ABmix) { As = "@A @B"; Bs = "@A @B"; Ds = "@D @D"; }
+
+        // Source to check for TYPE_USE and TYPE_PARAMETER annotations.
+        // Source base (annotations) is same for all test cases.
+        String source = new String();
+        String imports = new String("import java.lang.annotation.*; \n" +
+            "import static java.lang.annotation.RetentionPolicy.*; \n" +
+            "import static java.lang.annotation.ElementType.*; \n" +
+            "import java.util.List; \n" +
+            "import java.util.HashMap; \n" +
+            "import java.util.Map; \n\n");
+
+            String sourceBase = new String("@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,_OTHER_})\n" +
+            "@Repeatable( AC.class )\n" +
+            "@interface A { }\n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,_OTHER_})\n" +
+            "@interface AC { A[] value(); }\n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,_OTHER_})\n" +
+            "@Repeatable( BC.class )\n" +
+            "@interface B { }\n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,_OTHER_})\n" +
+            "@interface BC { B[] value(); } \n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_PARAMETER,_OTHER_})\n" +
+            "@interface C { }\n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
+            "@Repeatable(DC.class)\n" +
+            "@interface D { }\n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
+            "@interface DC { D[] value(); }\n\n");
+
+        // Test case sources with sample generated source.
+        switch(src) {
+            case 1: // repeating type annotations at class level
+                    /*
+                     * @A @B class Test1 {
+                     * @A @B Test1(){}
+                     * @A @B Integer i1 = 0;
+                     * String @A @B [] @A @B [] sa = null;
+                     * // type usage in method body
+                     * String test(Test1 this, String param, String ... vararg) {
+                     *     Object o = new  String  [3];
+                     *     return (String) null;
+                     * }}
+                     */
+                source = new String(
+                "// (repeating) type annotations at class level. \n" +
+                "_As_ _Bs_ class " + testname + " {\n" +
+                "_As_ _Bs_ " + testname +"(){} \n" +
+                "_As_ _Bs_ Integer i1 = 0; \n" +
+                "String _As_ _Bs_ [] _As_ _Bs_ [] sa = null; \n" +
+                "// type usage in method body \n" +
+                "String test("+testname+" this, " +
+                   "String param, String ... vararg) { \n" +
+                "    Object o = new  String  [3]; \n" +
+                "    return (String) null; \n" +
+                "} \n" +
+                "} \n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+                "\n\n";
+                break;
+            case 2: // (repeating) type annotations on method.
+                    /*
+                     * class Test12 {
+                     * Test12(){}
+                     * // type usage on method
+                     * @A @B String test(@A @B  Test12 this, @A @B  String param, @A @B  String @A @B  ... vararg) {
+                     *     Object o = new String [3];
+                     *     return (String) null;
+                     * }}
+                     */
+                source = new String(
+                "// (repeating) type annotations on method. \n" +
+                "class " + testname + " {\n" +
+                testname +"(){} \n" +
+                "// type usage on method \n" +
+                "_As_ _Bs_ String test(_As_ _Bs_  "+testname+" this, " +
+                   "_As_ _Bs_  String param, _As_ _Bs_  String _As_ _Bs_  ... vararg) { \n" +
+                "    Object o = new String [3]; \n" +
+                "    return (String) null; \n" +
+                "} \n" +
+                "} \n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+                "\n\n";
+                break;
+            case 4: //(repeating) annotations on wildcard, type arguments in anonymous class.
+                    /*
+                     * class Test13<T extends Object> {
+                     *     public T data = null;
+                     *     T getData() { return data;}
+                     *     String mtest( Test13<String> t){ return t.getData(); }
+                     *     public void test() {
+                     *         mtest( new Test13<@A @B String>() {
+                     *                  void m1(List<@A @B ? extends @A @B  Object> lst) {}
+                     *                  void m2() throws@A @B Exception { }
+                     *                });
+                     *     }
+                     * }
+                     */
+                source = new String( source +
+                "// (repeating) annotations on wildcard, type arguments in anonymous class. \n" +
+                "class " + testname + "<T extends Object> {\n" +
+                "    public T data = null;\n" +
+                "    T getData() { return data;}\n" +
+                "    String mtest( " + testname + "<String> t){ return t.getData(); }\n" +
+                "    public void test() {\n" +
+                "        mtest( new " + testname + "<_As_ _Bs_ String>() {\n" +
+                "                 void m1(List<_As_ _Bs_ ? extends _As_ _Bs_  Object> lst) {}\n" +
+                "                 void m2() throws_As_ _Bs_ Exception { }\n" +
+                "               });\n" +
+                "    }\n" +
+                "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) + "\n\n";
+                hasInnerClass=true;
+                innerClassname="$1";
+            break;
+            case 5: // (repeating)annotations on type parameters, bounds and  type arguments on class decl.
+                    /*
+                     * @A @B @D
+                     * class Test2<@A @B @C @D T extends @A @B Object> {
+                     *     Map<List<String>, Integer> map =
+                     *         new HashMap<List< String>, Integer>();
+                     *     Map<List<String>,Integer> map2 = new HashMap<>();
+                     *     String test(Test2<T> this) { return null;}
+                     *     <T> String genericMethod(T t) { return null; }
+                     * }
+                     */
+                source = new String( source +
+                "// (repeating)annotations on type parameters, bounds and  type arguments on class decl. \n" +
+                "_As_ _Bs_ _Ds_\n" +  //8004829: A and B on type parameter below.
+                "class " + testname + "<_As_ _Bs_ @C _Ds_ T extends _As_ _Bs_ Object> {\n" +
+                "    Map<List<String>, Integer> map =\n" +
+                "        new HashMap<List< String>, Integer>();\n" +
+                "    Map<List<String>,Integer> map2 = new HashMap<>();\n" +
+                "    String test(" + testname + "<T> this) { return null;}\n" +
+                "    <T> String genericMethod(T t) { return null; }\n" +
+                "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs).replace("_Ds_",Ds) +
+                "\n\n";
+            break;
+            case 6: // (repeating) annotations on type parameters, bounds and  type arguments on method.
+                    /*
+                     * class Test14<T extends Object> {
+                     *     Map<List<String>, Integer> map =
+                     *         new HashMap<List<String>, Integer>();
+                     *     Map<List<String>, Integer> map2 = new HashMap<>();
+                     *     String test(@A @B Test14<@D T> this) { return null;}
+                     *     <@C @D T> @A @B String genericMethod(@A @B @D T t) { return null; }
+                     * }
+                     */
+                source = new String( source +
+                "// (repeating) annotations on type parameters, bounds and  type arguments on method. \n" +
+                "class " + testname + "<T extends Object> {\n" +
+                "    Map<List<String>, Integer> map =\n" +
+                "        new HashMap<List<String>, Integer>();\n" +
+                "    Map<List<String>, Integer> map2 = new HashMap<>();\n" +
+                "    String test(_As_ _Bs_ " + testname + "<_Ds_ T> this) { return null;}\n" +
+                "    <@C _Ds_ T> _As_ _Bs_ String genericMethod(_As_ _Bs_ _Ds_ T t) { return null; }\n" +
+                "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs).replace("_Ds_",Ds) +
+                "\n\n";
+            break;
+            case 7: // repeating annotations on type parameters, bounds and  type arguments in method.
+                    /*
+                     * class Test7{
+                     *     <E extends Comparable> Map<List<E>, E > foo(E e) {
+                     *         class maptest <@A @B @D E> {
+                     *             Map<List<@A @B @D E>,@A @B @D E> getMap() {
+                     *                 return new HashMap<List<E>,E>();
+                     *             }
+                     *         }
+                     *         return new maptest<E>().getMap();
+                     *    }
+                     *    Map<List<String>,String> shm = foo(new String("hello"));
+                     * }
+                     */
+                source = new String( source +
+                "// (repeating)annotations on type parameters of class, method return value in method. \n" +
+                "class "+ testname + "{\n" +
+                "    <E extends Comparable> Map<List<E>, E > foo(E e) {\n" +
+                "        class maptest <_As_ _Bs_ _Ds_ E> {\n" +                  // inner class $1maptest
+                "            Map<List<_As_ _Bs_ _Ds_ E>,_As_ _Bs_ _Ds_ E> getMap() { \n" +
+                "                return new HashMap<List<E>,E>();\n" +
+                "            }\n" +
+                "        }\n" +
+                "        return new maptest<E>().getMap();\n" +
+                "   }\n" +
+                "   Map<List<String>,String> shm = foo(new String(\"hello\"));\n" +
+                "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs).replace("_Ds_",Ds) +
+                "\n\n";
+                hasInnerClass=true;
+                innerClassname="$1maptest";
+            break;
+        }
+        return imports + source;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,282 @@
+/*
+ * 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 8005877 8004829 8005681 8006734 8006775
+ * @ignore
+ * @summary Combinations of Target ElementTypes on (repeated)type annotations.
+ */
+
+import com.sun.tools.classfile.*;
+import java.io.File;
+
+public class CombinationsTargetTest2 extends ClassfileTestHelper {
+    // Helps identify test case in event of failure.
+    int testcount = 0;
+    int src3 = 3, src8 = 8, src9 = 9;
+
+    String[] ETypes={"TYPE", "FIELD", "METHOD", "PARAMETER", "CONSTRUCTOR",
+                     "LOCAL_VARIABLE", "ANNOTATION_TYPE", "PACKAGE"};
+
+    // local class tests will have an inner class.
+    Boolean hasInnerClass=false;
+    String innerClassname="";
+
+    public static void main(String[] args) throws Exception {
+        new CombinationsTargetTest2().run();
+    }
+
+    void run() throws Exception {
+        // Determines which repeat and order in source(ABMix).
+        Boolean As= false, BDs=true, ABMix=false;
+        int testrun=0;
+        // A repeats and/or B/D repeats, ABMix for order of As and Bs.
+        Boolean [][] bRepeat = new Boolean[][]{{false,false,false},//no repeats
+                                               {true,false,false}, //repeat @A
+                                               {false,true,false}, //repeat @B
+                                               {true,true,false},  //repeat both
+                                               {false,false,true}  //repeat mix
+        };
+        for(Boolean[] bCombo : bRepeat) {
+            As=bCombo[0]; BDs=bCombo[1]; ABMix=bCombo[2];
+            for(String et : ETypes) {
+               switch(et) {
+                   case "METHOD":
+                       test( 8,  0, 0, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src3);
+                       test( 0,  8, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, src3);
+                       break;
+                   case "CONSTRUCTOR":
+                   case "FIELD":
+                       test( 8,  0, 0, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src3);
+                       test( 8,  0, 0, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src8);
+                       test( 6,  0, 0, 0, As, BDs, ABMix, "CLASS",   et, ++testrun, src9);
+                       test( 0,  8, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, src3);
+                       test( 0,  8, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, src8);
+                       test( 0,  6, 0, 0, As, BDs, ABMix, "RUNTIME", et, ++testrun, src9);
+                       break;
+                   default:/*TYPE,PARAMETER,LOCAL_VARIABLE,ANNOTATION_TYPE,PACKAGE*/
+                       break;
+               }
+            }
+        }
+    }
+
+    public void test(int tinv, int tvis, int inv, int vis, Boolean Arepeats,
+                     Boolean BDrepeats, Boolean ABmix, String rtn, String et2,
+                     Integer N, int source) throws Exception {
+        ++testcount;
+        expected_tvisibles = tvis;
+        expected_tinvisibles = tinv;
+        expected_visibles = vis;
+        expected_invisibles = inv;
+        File testFile = null;
+        String tname="Test" + N.toString();
+        hasInnerClass=false;
+        String testDef = "Test " + testcount + " parameters: tinv=" + tinv +
+                ", tvis=" + tvis + ", inv=" + inv + ", vis=" + vis +
+                ", Arepeats=" + Arepeats + ", BDrepeats=" + BDrepeats +
+                ", ABmix=" + ABmix + ", retention: " + rtn + ", anno2: " +
+                et2 + ", src=" + source;
+
+// Uncomment this block to run the tests but skip failing scenarios.
+//        // 8005681 - skip cases with repeated annotations on new, array, cast.
+//        if((source==3 || source==8 || source==9) && (ABmix || (Arepeats && BDrepeats))) {
+//            System.out.println(testDef+"\n8005681-skip repeated annotations on new,array,cast");
+//            return;
+//        }
+
+        println(testDef);
+        // Create test source and File.
+        String sourceString = sourceString(tname, rtn, et2, Arepeats,
+                                           BDrepeats, ABmix, source);
+        testFile = writeTestFile(tname+".java", sourceString);
+        // 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;
+        }
+        //if sourcString() set hasInnerClass it also set innerClassname.
+        if(hasInnerClass) {
+            StringBuffer sb = new StringBuffer(classFile.getAbsolutePath());
+            classFile=new File(sb.insert(sb.lastIndexOf(".class"),innerClassname).toString());
+        }
+        ClassFile cf = ClassFile.read(classFile);
+
+        //Test class,fields and method counts.
+        test(cf);
+
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+        countAnnotations();
+        if (errors > 0) {
+            System.err.println( testDef );
+            System.err.println( "Source:\n" + sourceString );
+            throw new Exception( errors + " errors found" );
+        }
+        println("Pass");
+    }
+
+    //
+    // Source for test cases
+    //
+    String sourceString(String testname, String retentn, String annot2,
+                        Boolean Arepeats, Boolean BDrepeats, Boolean ABmix,
+                        int src) {
+
+        String As = "@A", Bs = "@B", Ds = "@D";
+        if(Arepeats) As = "@A @A";
+        if(BDrepeats) {
+            Bs = "@B @B";
+            Ds = "@D @D";
+        }
+        if(ABmix) { As = "@A @B"; Bs = "@A @B"; Ds = "@D @D"; }
+
+        // Source to check for TYPE_USE and TYPE_PARAMETER annotations.
+        // Source base (annotations) is same for all test cases.
+        String source = new String();
+        String imports = new String("import java.lang.annotation.*; \n" +
+            "import static java.lang.annotation.RetentionPolicy.*; \n" +
+            "import static java.lang.annotation.ElementType.*; \n" +
+            "import java.util.List; \n" +
+            "import java.util.HashMap; \n" +
+            "import java.util.Map; \n\n");
+
+            String sourceBase = new String("@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,_OTHER_})\n" +
+            "@Repeatable( AC.class )\n" +
+            "@interface A { }\n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,_OTHER_})\n" +
+            "@interface AC { A[] value(); }\n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,_OTHER_})\n" +
+            "@Repeatable( BC.class )\n" +
+            "@interface B { }\n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,_OTHER_})\n" +
+            "@interface BC { B[] value(); } \n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
+            "@Repeatable(DC.class)\n" +
+            "@interface D { }\n\n" +
+
+            "@Retention("+retentn+")\n" +
+            "@Target({TYPE_USE,TYPE_PARAMETER,_OTHER_})\n" +
+            "@interface DC { D[] value(); }\n\n");
+
+        // Test case sources with sample generated source
+        switch(src) {
+            case 3: // (repeating) type annotations on field in method body
+                    /*
+                     * class Test1 {
+                     * Test1(){}
+                     * // type usage in method body
+                     * String test(Test1 this, String param, String ... vararg) {
+                     *     @A @B
+                     *     Object o = new @A @B  String @A @B  [3];
+                     *         return (@A @B  String) null;
+                     * }}
+                      */
+                source = new String(
+                "class " + testname + " {\n" +
+                "" + testname +"(){} \n" +
+                "// type usage in method body \n" +
+                "String test("+testname+" this, " +
+                   "String param, String ... vararg) { \n" +
+                "    _As_ _Bs_\n    Object o = new _As_ _Bs_  String _As_ _Bs_  [3]; \n" +
+                "        return (_As_ _Bs_  String) null; \n" +
+                "} \n" +
+                "} \n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+                "\n\n";
+                break;
+            case 8: // (repeating) annotations on type parameters, bounds and  type arguments in new statement.
+                    /*
+                     * class Test2<T extends Object> {
+                     *     Map<List<String>, Integer> map =
+                     *         new HashMap<@A @B List<@A @B String>, @A @B Integer>();
+                     *     Map<List<String>, Integer> map2 = new @A @B HashMap<>();
+                     *     String test(Test2<T> this) { return null;}
+                     *     <T> String genericMethod(T t) { return null; }
+                     * }
+                     */
+                source = new String( source +
+                "// (repeating) annotations on type parameters, bounds and  type arguments. \n" +
+                "class " + testname + "<T extends Object> {\n" +
+                "    Map<List<String>, Integer> map =\n" +
+                "        new HashMap<_As_ _Bs_ List<_As_ _Bs_ String>, _As_ _Bs_ Integer>();\n" +
+                "    Map<List<String>, Integer> map2 = new _As_ _Bs_ HashMap<>();\n" +
+                "    String test(" + testname + "<T> this) { return null;}\n" +
+                "    <T> String genericMethod(T t) { return null; }\n" +
+                "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs) +
+                "\n\n";
+            break;
+            case 9: // (repeating)annotations on type parameters of class, method return value in method.
+                    /*
+                     * class Test3{
+                     *     <E extends Comparable> Map<List<E>, E > foo(E e) {
+                     *         class maptest <E> {
+                     *             Map<List<E>,E> getMap() {
+                     *                 Map<List<E>,E> Em = new HashMap<List<@A @B @D E>,@A @B @D E>();
+                     *                 return Em;
+                     *             }
+                     *         }
+                     *         return new maptest<E>().getMap();
+                     *    }
+                     *    Map<List<String>,String> shm = foo(new String("hello"));
+                     * }
+                     */
+                source = new String( source +
+                "// (repeating)annotations on type parameters of class, method return value in method. \n" +
+                "class "+ testname + "{\n" +
+                "    <E extends Comparable> Map<List<E>, E > foo(E e) {\n" +
+                "        class maptest <E> {\n" +                  // inner class $1maptest
+                "            Map<List<E>,E> getMap() { \n" +
+                "                Map<List<E>,E> Em = new HashMap<List<_As_ _Bs_ _Ds_ E>,_As_ _Bs_ _Ds_ E>();\n" +
+                "                return Em;\n" +
+                "            }\n" +
+                "        }\n" +
+                "        return new maptest<E>().getMap();\n" +
+                "   }\n" +
+                "   Map<List<String>,String> shm = foo(new String(\"hello\"));\n" +
+                "}\n").concat(sourceBase).replace("_OTHER_", annot2).replace("_As_",As).replace("_Bs_",Bs).replace("_Ds_",Ds) +
+                "\n\n";
+                hasInnerClass=true;
+                innerClassname="$1maptest";
+            break;
+
+        }
+        return imports + source;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,82 @@
+/*
+ * 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 6917130 8006775
+ * @summary test that optimized away annotations are not emited to classfile
+ */
+
+public class DeadCode extends ClassfileTestHelper {
+    public static void main(String[] args) throws Exception {
+        new DeadCode().run();
+    }
+
+    public void run() throws Exception {
+        expected_tinvisibles = 1;
+        expected_tvisibles = 0;
+
+        ClassFile cf = getClassFile("DeadCode$Test.class");
+        test(cf);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    /*********************** Test class *************************/
+    static class Test {
+        @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+        @interface A {}
+
+        void test() {
+            List<? extends @A Object> o = null;
+            o.toString();
+
+            @A String m;
+            if (false) {
+                @A String a;
+                @A String b = "m";
+                b.toString();
+                List<? extends @A Object> c = null;
+                c.toString();
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2009, 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 ClassLiterals
+ * @summary test that new type arguments are emitted to classfile
+ */
+
+public class NewTypeArguments extends ClassfileTestHelper{
+    public static void main(String[] args) throws Exception {
+        new NewTypeArguments().run();
+    }
+
+    public void run() throws Exception {
+        expected_tinvisibles = 3;
+        expected_tvisibles = 0;
+
+        ClassFile cf = getClassFile("NewTypeArguments$Test.class");
+        test(cf);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    /*********************** Test class *************************/
+    static class Test {
+        @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+        @interface A {}
+        <E> Test(E e) {}
+
+        void test() {
+            new <@A String> Test(null);
+            new <@A List<@A String>> Test(null);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2008, 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.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.net.URL;
+import java.util.List;
+
+import com.sun.tools.classfile.*;
+
+/*
+ * @test NoTargetAnnotations
+ * @summary test that annotations with no Target meta type is emitted
+ *          only once as declaration annotation
+ */
+public class NoTargetAnnotations {
+
+    public static void main(String[] args) throws Exception {
+        new NoTargetAnnotations().run();
+    }
+
+    public void run() throws Exception {
+        ClassFile cf = getClassFile("NoTargetAnnotations$Test.class");
+        for (Field f : cf.fields) {
+            test(cf, f);
+            testDeclaration(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+            testDeclaration(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    ClassFile getClassFile(String name) throws IOException, ConstantPoolException {
+        URL url = getClass().getResource(name);
+        InputStream in = url.openStream();
+        try {
+            return ClassFile.read(in);
+        } finally {
+            in.close();
+        }
+    }
+
+    /************ Helper annotations counting methods ******************/
+    void test(ClassFile cf, Method m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Field m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void testDeclaration(ClassFile cf, Method m) {
+        testDecl(cf, m, Attribute.RuntimeVisibleAnnotations, true);
+        testDecl(cf, m, Attribute.RuntimeInvisibleAnnotations, false);
+    }
+
+    void testDeclaration(ClassFile cf, Field m) {
+        testDecl(cf, m, Attribute.RuntimeVisibleAnnotations, true);
+        testDecl(cf, m, Attribute.RuntimeInvisibleAnnotations, false);
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Method m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Field m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void testDecl(ClassFile cf, Method m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeAnnotations_attribute;
+            RuntimeAnnotations_attribute tAttr = (RuntimeAnnotations_attribute)attr;
+            this.declAnnotations += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void testDecl(ClassFile cf, Field m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeAnnotations_attribute;
+            RuntimeAnnotations_attribute tAttr = (RuntimeAnnotations_attribute)attr;
+            this.declAnnotations += tAttr.annotations.length;
+        }
+    }
+
+    File compileTestFile(File f) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] { "-XDTA:writer", "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    void countAnnotations() {
+        int expected_all = expected_visibles + expected_invisibles;
+
+        if (expected_all != all) {
+            errors++;
+            System.err.println("expected " + expected_all
+                    + " annotations but found " + all);
+        }
+
+        if (expected_visibles != visibles) {
+            errors++;
+            System.err.println("expected " + expected_visibles
+                    + " visibles annotations but found " + visibles);
+        }
+
+        if (expected_invisibles != invisibles) {
+            errors++;
+            System.err.println("expected " + expected_invisibles
+                    + " invisibles annotations but found " + invisibles);
+        }
+
+        if (expected_decl != declAnnotations) {
+            errors++;
+            System.err.println("expected " + expected_decl
+                    + " declaration annotations but found " + declAnnotations);
+        }
+    }
+
+    int errors;
+    int all;
+    int visibles;
+    int invisibles;
+
+    int declAnnotations;
+
+    /*********************** Test class *************************/
+    static int expected_invisibles = 0;
+    static int expected_visibles = 0;
+    static int expected_decl = 1;
+
+    static class Test {
+        @Retention(RetentionPolicy.RUNTIME)
+        @interface A {}
+
+        @A String method() {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2009, 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 test that typecasts annotation are emitted if only the cast
+ *          expression is optimized away
+ */
+
+public class TypeCasts extends ClassfileTestHelper{
+    public static void main(String[] args) throws Exception {
+        new TypeCasts().run();
+    }
+
+    public void run() throws Exception {
+        expected_tinvisibles = 4;
+        expected_tvisibles = 0;
+
+        ClassFile cf = getClassFile("TypeCasts$Test.class");
+        test(cf);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    /*********************** Test class *************************/
+    static class Test {
+        @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+        @interface A {}
+
+        void emit() {
+            Object o = null;
+            String s = null;
+
+            String a0 = (@A String)o;
+            Object a1 = (@A Object)o;
+
+            String b0 = (@A String)s;
+            Object b1 = (@A Object)s;
+        }
+
+        void alldeadcode() {
+            Object o = null;
+
+            if (false) {
+                String a0 = (@A String)o;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2009, 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 Wildcards
+ * @bug 6843077 8006775
+ * @summary test that annotations target wildcards get emitted to classfile
+ */
+public class Wildcards extends ClassfileTestHelper {
+    public static void main(String[] args) throws Exception {
+        new Wildcards().run();
+    }
+
+    public void run() throws Exception {
+        expected_tinvisibles = 3;
+        expected_tvisibles = 0;
+
+        ClassFile cf = getClassFile("Wildcards$Test.class");
+        test(cf);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    /*********************** Test class *************************/
+    static class Test {
+        @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+        @interface A {}
+
+        List<? extends @A Number> f;
+
+        List<? extends @A Object> test(List<? extends @A Number> p) {
+            List<? extends @A Object> l;  // not counted... gets optimized away
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006775
+ * @summary Import clauses cannot use annotations.
+ * @author Werner Dietl
+ * @compile/fail/ref=AnnotatedImport.out -XDrawDiagnostics AnnotatedImport.java
+ */
+
+import java.@A util.List;
+import @A java.util.Map;
+import java.util.@A HashMap;
+
+class AnnotatedImport { }
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,7 @@
+AnnotatedImport.java:9:13: compiler.err.expected: token.identifier
+AnnotatedImport.java:9:14: compiler.err.expected3: class, interface, enum
+AnnotatedImport.java:10:7: compiler.err.expected: token.identifier
+AnnotatedImport.java:10:10: compiler.err.expected: ';'
+AnnotatedImport.java:11:18: compiler.err.expected: token.identifier
+AnnotatedImport.java:11:19: compiler.err.expected3: class, interface, enum
+6 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006775
+ * @summary Package declarations cannot use annotations.
+ * @author Werner Dietl
+ * @compile/fail/ref=AnnotatedPackage1.out -XDrawDiagnostics AnnotatedPackage1.java
+ */
+
+package name.@A p1.p2;
+
+class AnnotatedPackage1 { }
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,3 @@
+AnnotatedPackage1.java:9:14: compiler.err.expected: token.identifier
+AnnotatedPackage1.java:9:15: compiler.err.expected3: class, interface, enum
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006775
+ * @summary Package declarations cannot use annotations.
+ * @author Werner Dietl
+ * @compile/fail/ref=AnnotatedPackage2.out -XDrawDiagnostics AnnotatedPackage2.java
+ */
+
+package @A p1.p2;
+
+class AnnotatedPackage2 { }
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,3 @@
+AnnotatedPackage2.java:9:8: compiler.err.expected: token.identifier
+AnnotatedPackage2.java:9:10: compiler.err.expected3: class, interface, enum
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary test that only Java 8 allows type annotations
+ * @author Mahmood Ali
+ * @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) { }
+}
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+AnnotationVersion.java:10:43: compiler.err.type.annotations.not.supported.in.source: 1.6
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+AnnotationVersion.java:10:43: compiler.err.type.annotations.not.supported.in.source: 1.7
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006775
+ * @summary A cast cannot consist of only an annotation.
+ * @author Werner Dietl
+ * @compile/fail/ref=BadCast.out -XDrawDiagnostics BadCast.java
+ */
+class BadCast {
+  static void main() {
+    Object o = (@A) "";
+  }
+}
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/BadCast.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+BadCast.java:10:19: compiler.err.illegal.start.of.type
+1 error
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006733 8006775
+ * @ignore
+ * @summary A static outer class cannot be annotated.
+ * @author Werner Dietl
+ * @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java
+ */
+
+import java.util.List;
+import java.lang.annotation.*;
+
+class CantAnnotateStaticClass {
+    @Target(ElementType.TYPE_USE)
+    @interface A {}
+
+    static class Outer {
+        class Inner {}
+    }
+
+    // 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;
+    }
+
+    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;
+    }
+
+    // OK:
+    @A Outer g1;
+    List<@A Outer> g2;
+    Outer. @A Inner g3;
+    List<Outer. @A Inner> g4;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,1 @@
+dummy
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary test incomplete array declaration
+ * @author Mahmood Ali
+ * @compile/fail/ref=IncompleteArray.out -XDrawDiagnostics IncompleteArray.java
+ */
+class IncompleteArray {
+  int @A [] @A var;
+}
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+IncompleteArray.java:9:13: compiler.err.illegal.start.of.type
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @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 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+IncompleteVararg.java:10:19: compiler.err.illegal.start.of.type
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary test indexing of an array
+ * @author Mahmood Ali
+ * @compile/fail/ref=IndexArray.out -XDrawDiagnostics IndexArray.java
+ */
+class IndexArray {
+  int[] var;
+  int a = var @A [1];
+}
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+IndexArray.java:10:15: compiler.err.illegal.start.of.expr
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/LazyConstantValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * 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 8008077
+ * @summary Type annotations in a lazy constant need to be attributed
+ *   in the correct order.
+ * @author Werner Dietl
+ * @compile LazyConstantValue.java
+ */
+
+import java.lang.annotation.*;
+
+class ClassA {
+    Object o = ClassB.lcv;
+}
+
+class ClassB {
+    static final String[] lcv = new @TA String[0];
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TA {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/LintCast.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,69 @@
+import java.lang.annotation.*;
+import java.util.List;
+
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary test that compiler doesn't warn about annotated redundant casts
+ * @author Mahmood Ali
+ * @author Werner Dietl
+ * @compile/ref=LintCast.out -Xlint:cast -XDrawDiagnostics LintCast.java
+ */
+class LintCast {
+    void unparameterized() {
+        String s = "m";
+        String s1 = (String)s;
+        String s2 = (@A String)s;
+    }
+
+    void parameterized() {
+        List<String> l = null;
+        List<String> l1 = (List<String>)l;
+        List<String> l2 = (List<@A String>)l;
+    }
+
+    void array() {
+        int @A [] a = null;
+        int[] a1 = (int[])a;
+        int[] a2 = (int @A [])a;
+    }
+
+    void sameAnnotations() {
+        @A String annotated = null;
+        String unannotated = null;
+
+        // compiler ignore annotated casts even if redundant
+        @A String anno1 = (@A String)annotated;
+
+        // warn if redundant without an annotation
+        String anno2 = (String)annotated;
+        String unanno2 = (String)unannotated;
+    }
+
+    void more() {
+        Object @A [] a = null;
+        Object[] a1 = (Object[])a;
+        Object[] a2 = (Object @A [])a;
+
+        @A List<String> l3 = null;
+        List<String> l4 = (List<String>)l3;
+        List<String> l5 = (@A List<String>)l3;
+
+        List<@A String> l6 = null;
+        List<String> l7 = (List<String>)l6;
+        List<String> l8 = (List<@A String>)l6;
+
+        @A Object o = null;
+        Object o1 = (Object)o;
+        Object o2 = (@A Object)o;
+
+        Outer. @A Inner oi = null;
+        Outer.Inner oi1 = (Outer.Inner)oi;
+        Outer.Inner oi2 = (Outer. @A Inner)oi;
+    }
+
+    class Outer { class Inner {} }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/LintCast.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +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: (@A :: 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: (@A :: 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<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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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
+ * @bug 6843077 8006775
+ * @summary test old array syntax
+ * @author Mahmood Ali
+ * @compile/fail -XDrawDiagnostics OldArray.java
+ */
+class OldArray {
+  String [@A]  s() { return null; }
+}
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check that A is accessible in the class type parameters
+ * @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 { };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/Scopes.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,3 @@
+Scopes.java:8:25: compiler.err.cant.resolve: kindname.class, UniqueInner, , 
+Scopes.java:8:24: compiler.err.annotation.type.not.applicable
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary static field access isn't a valid location
+ * @author Mahmood Ali
+ * @compile/fail/ref=StaticFields.out -XDrawDiagnostics StaticFields.java
+ */
+class C {
+  int f;
+  int a = @A C.f;
+}
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+StaticFields.java:10:17: compiler.err.illegal.start.of.expr
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,12 @@
+/*
+ * @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(@A StaticMethods this) { }
+}
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+StaticMethods.java:9:37: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/TypeAndField.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 8006703 8006775
+ * @summary Ensure that TYPE_USE and FIELD work together.
+ * @author Werner Dietl
+ * @compile TypeAndField.java
+ */
+import java.lang.annotation.*;
+
+class TypeAndField {
+    @TA Integer i;
+    @TA int j;
+}
+
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.TYPE_USE, ElementType.FIELD})
+@interface TA { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/TypeVariable.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 8008077
+ * @summary Type annotations on a type variable, where the bound of
+ *   the type variable is also annotated, need to be processed correctly.
+ * @author Werner Dietl
+ * @compile TypeVariable.java
+ */
+
+import java.lang.annotation.*;
+
+class TypeVariable {
+    <TV extends  @TA Object> TV cast(TV p) {
+        return (@TA TV) p;
+    }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TA {}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/VoidGenericMethod.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary test type annotation on void generic methods
+ * @author Mahmood Ali
+ * @compile/fail VoidGenericMethod.java
+ */
+class VoidGenericMethod {
+  public @A <T> void method() { }
+}
+
+@Target(ElementType.TYPE_USE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DuplicateAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 6919944 8006775
+ * @summary check for duplicate annotation values
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics DuplicateAnnotationValue.java
+ */
+import java.lang.annotation.*;
+class DuplicateAnnotationValue {
+  void test() {
+    String @A(value = 2, value = 1) [] s;
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DuplicateAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateAnnotationValue.java:11:26: compiler.err.duplicate.annotation.member.value: value, A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DuplicateTypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for duplicate annotations
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics DuplicateTypeAnnotation.java
+ */
+import java.lang.annotation.*;
+class DuplicateTypeAnnotation {
+  void test() {
+    String @A @A [] s;
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/DuplicateTypeAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateTypeAnnotation.java:11:15: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/InvalidLocation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for invalid annotatins given the target
+ * @author Mahmood Ali
+ * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics InvalidLocation.java
+ */
+
+class InvalidLocation {
+  void test() {
+    String @A [] s;
+  }
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/InvalidLocation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InvalidLocation.java:11:12: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/MissingAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for missing annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics MissingAnnotationValue.java
+ */
+class MissingAnnotationValue {
+  void test() {
+    String @A [] s;
+  }
+}
+
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/arrays/MissingAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MissingAnnotationValue.java:10:12: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/DuplicateAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 6919944 8006775
+ * @summary check for duplicate annotation values for type parameter
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics DuplicateAnnotationValue.java
+ */
+import java.lang.annotation.*;
+class DuplicateAnnotationValue {
+  void method() {
+    class Inner<@A(value = 2, value = 1) K> {}
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/DuplicateAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateAnnotationValue.java:11:31: compiler.err.duplicate.annotation.member.value: value, A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/DuplicateTypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for duplicate annotations
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics DuplicateTypeAnnotation.java
+ */
+import java.lang.annotation.*;
+class DuplicateTypeAnno {
+  void innermethod() {
+    class Inner<@A @A K> { }
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/DuplicateTypeAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateTypeAnnotation.java:11:20: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/InvalidLocation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for invalid annotatins given the target
+ * @author Mahmood Ali
+ * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics InvalidLocation.java
+ */
+class InvalidLocation {
+  void innermethod() {
+    class Inner<@A K> {}
+  }
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/InvalidLocation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InvalidLocation.java:10:17: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/MissingAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for missing annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics MissingAnnotationValue.java
+ */
+class MissingAnnotationValue {
+  void innermethod() {
+    class Inner<@A K> { }
+  }
+}
+
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/innertypeparams/MissingAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MissingAnnotationValue.java:10:17: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/DuplicateAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 6919944 8006775
+ * @summary check for duplicate annotation values
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics DuplicateAnnotationValue.java
+ */
+import java.lang.annotation.*;
+class DuplicateAnnotationValue {
+  void test() {
+    String[] a = new String @A(value = 2, value = 1) [5] ;
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/DuplicateAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateAnnotationValue.java:11:43: compiler.err.duplicate.annotation.member.value: value, A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/DuplicateTypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for duplicate annotations
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics DuplicateTypeAnnotation.java
+ */
+import java.lang.annotation.*;
+class DuplicateTypeAnnotation {
+  void test() {
+    String[] a = new String @A @A [5] ;
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/DuplicateTypeAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateTypeAnnotation.java:11:32: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/InvalidLocation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for invalid annotatins given the target
+ * @author Mahmood Ali
+ * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics InvalidLocation.java
+ */
+
+class InvalidLocation {
+  void test() {
+    String[] s = new String @A [5] ;
+  }
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/InvalidLocation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InvalidLocation.java:11:29: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/MissingAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for missing annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics MissingAnnotationValue.java
+ */
+class MissingAnnotationValue {
+  void test() {
+    String[] a = new String @A [5];
+  }
+}
+
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/newarray/MissingAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MissingAnnotationValue.java:10:29: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/BrokenAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,99 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006775
+ * @summary Ensure unresolved upper bound annotation is handled correctly
+ * @author Werner Dietl
+ * @compile/fail/ref=BrokenAnnotation.out -XDrawDiagnostics BrokenAnnotation.java
+ */
+
+// No import, making the annotation @A invalid.
+// import java.lang.annotation.*;
+
+// Works: @Broke.A class...
+// Works: class Broke<@Broke.A T> {
+// Used to fail:
+class BrokenAnnotation<T extends @BrokenAnnotation.A Object> {
+    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+    @interface A { }
+}
+
+// If the Annotation is e.g. on the top-level class, we
+// get something like this:
+//
+// Broke.java:6: cannot find symbol
+// symbol  : class Target
+// location: class Broke
+//     @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+//      ^
+// 1 error
+//
+// When the annotation is in the upper bound, one used to get
+// the following stack trace:
+//
+// An exception has occurred in the compiler (1.7.0-jsr308-1.2.7). Please report this bug so we can fix it.  For instructions, see http://types.cs.washington.edu/checker-framework/current/README-jsr308.html#reporting-bugs .  Thank you.
+// java.lang.NullPointerException
+//      at com.sun.tools.javac.code.Type.isCompound(Type.java:346)
+//      at com.sun.tools.javac.code.Types.getBounds(Types.java:1940)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter$1.visitTypeVar(RichDiagnosticFormatter.java:534)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter$1.visitTypeVar(RichDiagnosticFormatter.java:1)
+//      at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1049)
+//      at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3809)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter$1.visit(RichDiagnosticFormatter.java:450)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter$1.visitClassType(RichDiagnosticFormatter.java:518)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter$1.visitClassType(RichDiagnosticFormatter.java:1)
+//      at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:596)
+//      at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3809)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter.preprocessType(RichDiagnosticFormatter.java:442)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter.preprocessArgument(RichDiagnosticFormatter.java:172)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter.preprocessDiagnostic(RichDiagnosticFormatter.java:155)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter.preprocessArgument(RichDiagnosticFormatter.java:178)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter.preprocessDiagnostic(RichDiagnosticFormatter.java:155)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter.format(RichDiagnosticFormatter.java:111)
+//      at com.sun.tools.javac.util.RichDiagnosticFormatter.format(RichDiagnosticFormatter.java:1)
+//      at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:514)
+//      at com.sun.tools.javac.util.Log.report(Log.java:496)
+//      at com.sun.tools.javac.comp.Resolve.logResolveError(Resolve.java:2160)
+//      at com.sun.tools.javac.comp.Resolve.access(Resolve.java:1553)
+//      at com.sun.tools.javac.comp.Resolve.access(Resolve.java:1580)
+//      at com.sun.tools.javac.comp.Resolve.access(Resolve.java:1592)
+//      at com.sun.tools.javac.comp.Resolve.resolveIdent(Resolve.java:1653)
+//      at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:2191)
+//      at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:1873)
+//      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:467)
+//      at com.sun.tools.javac.comp.Attr.attribType(Attr.java:503)
+//      at com.sun.tools.javac.comp.Attr.attribType(Attr.java:496)
+//      at com.sun.tools.javac.comp.Attr.attribAnnotationTypes(Attr.java:605)
+//      at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:944)
+//      at com.sun.tools.javac.code.Symbol.complete(Symbol.java:432)
+//      at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:832)
+//      at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:775)
+//      at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:350)
+//      at com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:346)
+//      at com.sun.tools.javac.comp.Resolve.findMemberType(Resolve.java:1346)
+//      at com.sun.tools.javac.comp.Resolve.findIdentInType(Resolve.java:1512)
+//      at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:2434)
+//      at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:2312)
+//      at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1805)
+//      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:467)
+//      at com.sun.tools.javac.comp.Attr.attribType(Attr.java:503)
+//      at com.sun.tools.javac.comp.Attr.attribType(Attr.java:496)
+//      at com.sun.tools.javac.comp.Attr.attribAnnotationTypes(Attr.java:605)
+//      at com.sun.tools.javac.comp.Attr.visitAnnotatedType(Attr.java:3016)
+//      at com.sun.tools.javac.tree.JCTree$JCAnnotatedType.accept(JCTree.java:2253)
+//      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:467)
+//      at com.sun.tools.javac.comp.Attr.attribType(Attr.java:503)
+//      at com.sun.tools.javac.comp.Attr.attribType(Attr.java:496)
+//      at com.sun.tools.javac.comp.Attr.attribTypeVariables(Attr.java:569)
+//      at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:955)
+//      at com.sun.tools.javac.code.Symbol.complete(Symbol.java:432)
+//      at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:832)
+//      at com.sun.tools.javac.comp.Enter.complete(Enter.java:500)
+//      at com.sun.tools.javac.comp.Enter.main(Enter.java:478)
+//      at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:950)
+//      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:841)
+//      at com.sun.tools.javac.main.Main.compile(Main.java:441)
+//      at com.sun.tools.javac.main.Main.compile(Main.java:358)
+//      at com.sun.tools.javac.main.Main.compile(Main.java:347)
+//      at com.sun.tools.javac.main.Main.compile(Main.java:338)
+//      at com.sun.tools.javac.Main.compile(Main.java:76)
+//      at com.sun.tools.javac.Main.main(Main.java:61)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/BrokenAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,3 @@
+BrokenAnnotation.java:16:6: compiler.err.cant.resolve.location: kindname.class, Target, , , (compiler.misc.location: kindname.class, BrokenAnnotation<T>, null)
+BrokenAnnotation.java:15:34: compiler.err.annotation.type.not.applicable
+2 errors
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/DuplicateAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 6919944 8006775
+ * @summary check for duplicate annotation values for type parameter
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics DuplicateAnnotationValue.java
+ */
+import java.lang.annotation.*;
+class DuplicateAnnotationValue<K extends @A(value = 2, value = 1) Object> {
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/DuplicateAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateAnnotationValue.java:9:56: compiler.err.duplicate.annotation.member.value: value, A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/DuplicateTypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for duplicate annotations
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics DuplicateTypeAnnotation.java
+ */
+import java.lang.annotation.*;
+class DuplicateTypeAnno<K extends @A @A Object> {
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/DuplicateTypeAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateTypeAnnotation.java:9:38: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/InvalidLocation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for invalid annotatins given the target
+ * @author Mahmood Ali
+ * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics InvalidLocation.java
+ */
+
+class InvalidLocation<K extends @A Object> {
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/InvalidLocation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InvalidLocation.java:9:33: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/MissingAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+import java.lang.annotation.*;
+
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for missing annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics MissingAnnotationValue.java
+ */
+class MissingAnnotationValue<K extends @A Object> {
+}
+
+@Target(ElementType.TYPE_USE)
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/parambounds/MissingAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MissingAnnotationValue.java:10:40: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/DuplicateAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 6919944 8006775
+ * @summary check for duplicate annotation values in receiver
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics DuplicateAnnotationValue.java
+ */
+import java.lang.annotation.*;
+class DuplicateAnnotationValue {
+  void test(@A(value = 2, value = 1) DuplicateAnnotationValue this) { }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/DuplicateAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateAnnotationValue.java:10:27: compiler.err.duplicate.annotation.member.value: value, A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/DuplicateTypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for duplicate annotations in receiver
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics DuplicateTypeAnnotation.java
+ */
+import java.lang.annotation.*;
+class DuplicateTypeAnnotation {
+  void test(@A @A DuplicateTypeAnnotation this) { }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/DuplicateTypeAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateTypeAnnotation.java:10:16: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/InvalidLocation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for invalid annotatins given the target
+ * @author Mahmood Ali
+ * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics InvalidLocation.java
+ */
+
+class InvalidLocation {
+  void test(@A InvalidLocation this) {
+  }
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/InvalidLocation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InvalidLocation.java:10:13: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/MissingAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for missing annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics MissingAnnotationValue.java
+ */
+class MissingAnnotationValue {
+  void test(@A MissingAnnotationValue this) { }
+}
+
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/MissingAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MissingAnnotationValue.java:9:13: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/Nesting.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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
+ * @bug 8006775
+ * @summary Ensure that nested classes/methods work
+ * @author Werner Dietl
+ * @compile Nesting.java
+ */
+@interface A { }
+
+class Nesting {
+    void top(@A Nesting this) {}
+
+    class B {
+        void inB(@A B this) {}
+    }
+
+    void meth(@A Nesting this) {
+        class C {
+            void inMethod(@A C this) {}
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/StaticThings.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,56 @@
+/*
+ * 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
+ * @bug 8006775
+ * @summary the receiver parameter and static methods/classes
+ * @author Werner Dietl
+ * @compile/fail/ref=StaticThings.out -XDrawDiagnostics StaticThings.java
+ */
+class Test {
+  // bad
+  static void test1(Test this) {}
+
+  // bad
+  static Object test2(Test this) { return null; }
+
+  class Nested1 {
+    // good
+    void test3a(Nested1 this) {}
+    // good
+    void test3b(Test.Nested1 this) {}
+    // No static methods
+    // static void test3c(Nested1 this) {}
+  }
+  static class Nested2 {
+    // good
+    void test4a(Nested2 this) {}
+    // good
+    void test4b(Test.Nested2 this) {}
+    // bad
+    static void test4c(Nested2 this) {}
+    // bad
+    static void test4d(Test.Nested2 this) {}
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/StaticThings.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,5 @@
+StaticThings.java:52:32: compiler.err.annotation.type.not.applicable
+StaticThings.java:54:37: compiler.err.annotation.type.not.applicable
+StaticThings.java:33:26: compiler.err.annotation.type.not.applicable
+StaticThings.java:36:28: compiler.err.annotation.type.not.applicable
+4 errors
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/WrongType.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,68 @@
+/*
+ * 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
+ * @bug 8006775
+ * @summary the receiver parameter has the type of the surrounding class
+ * @author Werner Dietl
+ * @compile/fail/ref=WrongType.out -XDrawDiagnostics WrongType.java
+ */
+
+@interface A {}
+
+class WrongType {
+  Object f;
+
+  void good1(@A WrongType this) {}
+
+  void good2(@A WrongType this) {
+    this.f = null;
+    Object o = this.f;
+  }
+
+  void bad1(@A Object this) {}
+
+  void bad2(@A Object this) {
+    this.f = null;
+    Object o = this.f;
+  }
+
+  void wow(@A XYZ this) {
+    this.f = null;
+  }
+
+  class Inner {
+    void good1(@A Inner this) {}
+    void good2(@A WrongType.Inner this) {}
+
+    void outerOnly(@A WrongType this) {}
+    void wrongInner(@A Object this) {}
+    void badOuter(@A Outer.Inner this) {}
+    void badInner(@A WrongType.XY this) {}
+  }
+
+  class Generics<X> {
+    <Y> void m(Generics<Y> this) {}
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/receiver/WrongType.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,9 @@
+WrongType.java:51:15: compiler.err.cant.resolve.location: kindname.class, XYZ, , , (compiler.misc.location: kindname.class, WrongType, null)
+WrongType.java:61:27: compiler.err.doesnt.exist: Outer
+WrongType.java:62:31: compiler.err.cant.resolve.location: kindname.class, XY, , , (compiler.misc.location: kindname.class, WrongType, null)
+WrongType.java:44:23: compiler.err.incorrect.receiver.type
+WrongType.java:46:23: compiler.err.incorrect.receiver.type
+WrongType.java:59:33: compiler.err.incorrect.receiver.type
+WrongType.java:60:31: compiler.err.incorrect.receiver.type
+WrongType.java:66:28: compiler.err.incorrect.receiver.type
+8 errors
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/rest/DuplicateAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for Duplicate annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics DuplicateAnnotationValue.java
+ */
+import java.lang.annotation.*;
+class DuplicateAnnotationValue {
+  void test() {
+    new @A String();
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/rest/DuplicateAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateAnnotationValue.java:11:9: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/rest/DuplicateTypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for duplicate annotations
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics DuplicateTypeAnnotation.java
+ */
+import java.lang.annotation.*;
+class DuplicateTypeAnnotation {
+  void test() {
+    new @A @A String();
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/rest/DuplicateTypeAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateTypeAnnotation.java:11:12: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/rest/InvalidLocation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for invalid annotatins given the target
+ * @author Mahmood Ali
+ * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics InvalidLocation.java
+ */
+
+class InvalidLocation {
+  void test() {
+    new @A String();
+  }
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/rest/InvalidLocation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InvalidLocation.java:11:9: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/rest/MissingAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for missing annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics MissingAnnotationValue.java
+ */
+class MissingAnnotationValue {
+  void test() {
+    new @A String();
+  }
+}
+
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/rest/MissingAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MissingAnnotationValue.java:10:9: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/DuplicateAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 6919944 8006775
+ * @summary check for duplicate annotation values for type parameter
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics DuplicateAnnotationValue.java
+ */
+import java.lang.annotation.*;
+class DuplicateAnnotationValue<K> {
+  DuplicateAnnotationValue<@A(value = 2, value = 1) String> l;
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/DuplicateAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateAnnotationValue.java:10:42: compiler.err.duplicate.annotation.member.value: value, A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/DuplicateTypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for duplicate annotations
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics DuplicateTypeAnnotation.java
+ */
+import java.lang.annotation.*;
+class DuplicateTypeAnno<K> {
+  DuplicateTypeAnno<@A @A String> l;
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/DuplicateTypeAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateTypeAnnotation.java:10:24: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/InvalidLocation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for invalid annotatins given the target
+ * @author Mahmood Ali
+ * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics InvalidLocation.java
+ */
+
+class InvalidLocation<K> {
+  InvalidLocation<@A String> l;
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/InvalidLocation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InvalidLocation.java:10:19: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/MissingAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for missing annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics MissingAnnotationValue.java
+ */
+class MissingAnnotationValue<K> {
+  MissingAnnotationValue<@A String> l;
+}
+
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeArgs/MissingAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MissingAnnotationValue.java:9:26: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/DuplicateAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 6919944 8006775
+ * @summary check for duplicate annotation values for type parameter
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics DuplicateAnnotationValue.java
+ */
+import java.lang.annotation.*;
+class DuplicateAnnotationValue<@A(value = 2, value = 1) K> {
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/DuplicateAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateAnnotationValue.java:9:46: compiler.err.duplicate.annotation.member.value: value, A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/DuplicateTypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for duplicate annotations
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics DuplicateTypeAnnotation.java
+ */
+import java.lang.annotation.*;
+class DuplicateTypeAnno<@A @A K> {
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/DuplicateTypeAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateTypeAnnotation.java:9:28: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/InvalidLocation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for invalid annotatins given the target
+ * @author Mahmood Ali
+ * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics InvalidLocation.java
+ */
+
+class InvalidLocation<@A K> {
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/InvalidLocation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InvalidLocation.java:9:23: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/MissingAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,11 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for missing annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics MissingAnnotationValue.java
+ */
+class MissingAnnotationValue<@A K> {
+}
+
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/typeparams/MissingAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MissingAnnotationValue.java:8:30: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/DuplicateAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 6919944 8006775
+ * @summary check for duplicate annotation values for type parameter
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateAnnotationValue.out -XDrawDiagnostics DuplicateAnnotationValue.java
+ */
+import java.lang.annotation.*;
+class DuplicateAnnotationValue<K> {
+  DuplicateAnnotationValue<@A(value = 2, value = 1) ?> l;
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/DuplicateAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateAnnotationValue.java:10:42: compiler.err.duplicate.annotation.member.value: value, A
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/DuplicateTypeAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for duplicate annotations
+ * @author Mahmood Ali
+ * @compile/fail/ref=DuplicateTypeAnnotation.out -XDrawDiagnostics DuplicateTypeAnnotation.java
+ */
+import java.lang.annotation.*;
+class DuplicateTypeAnno<K> {
+  DuplicateTypeAnno<@A @A ?> l;
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/DuplicateTypeAnnotation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+DuplicateTypeAnnotation.java:10:24: compiler.err.duplicate.annotation.missing.container: A, java.lang.annotation.Repeatable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/InvalidLocation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,14 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for invalid annotatins given the target
+ * @author Mahmood Ali
+ * @compile/fail/ref=InvalidLocation.out -XDrawDiagnostics InvalidLocation.java
+ */
+
+class InvalidLocation<K> {
+  InvalidLocation<@A ?> l;
+}
+
+@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/InvalidLocation.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InvalidLocation.java:10:19: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/MissingAnnotationValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary check for missing annotation value
+ * @author Mahmood Ali
+ * @compile/fail/ref=MissingAnnotationValue.out -XDrawDiagnostics MissingAnnotationValue.java
+ */
+class MissingAnnotationValue<K> {
+  MissingAnnotationValue<@A ?> l;
+}
+
+@interface A { int field(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/common/wildcards/MissingAnnotationValue.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MissingAnnotationValue.java:9:26: compiler.err.annotation.missing.default.value: A, field
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/Constructor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary test invalid location of TypeUse
+ * @author Mahmood Ali
+ * @compile/fail/ref=Constructor.out -XDrawDiagnostics Constructor.java
+ */
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+class Constructor {
+  // Constructor result type use annotation
+  @A Constructor() { }
+
+  // Not type parameter annotation
+  @B Constructor(int x) { }
+
+  // TODO add err: no "this" receiver parameter for constructors
+  // Constructor(@A Constructor this, Object o) { }
+
+  // TODO: support Outer.this.
+}
+
+class Constructor2 {
+  class Inner {
+    // OK
+    @A Inner() { }
+  }
+}
+
+@Target(ElementType.TYPE_USE)
+@interface A { }
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface B { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/Constructor.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+Constructor.java:17:3: compiler.err.annotation.type.not.applicable
+1 error
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/DotClass.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Class literals are not type uses and cannot be annotated
+ * @author Werner Dietl
+ * @compile/fail/ref=DotClass.out -XDrawDiagnostics DotClass.java
+ */
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.TYPE_PARAMETER;
+import static java.lang.annotation.ElementType.TYPE_USE;
+
+@Target({TYPE_USE, TYPE_PARAMETER, TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@interface A {}
+
+@interface B { int value(); }
+
+class T0x1E {
+    void m0x1E() {
+        Class<Object> c = @A Object.class;
+    }
+
+    Class<?> c = @A String.class;
+
+    Class<? extends @A String> as = @A String.class;
+}
+
+class ClassLiterals {
+    public static void main(String[] args) {
+        if (String.class != @A String.class) throw new Error();
+        if (@A int.class != int.class) throw new Error();
+        if (@A int.class != Integer.TYPE) throw new Error();
+        if (@A int @B(0) [].class != int[].class) throw new Error();
+
+        if (String[].class != @A String[].class) throw new Error();
+        if (String[].class != String @A [].class) throw new Error();
+        if (@A int[].class != int[].class) throw new Error();
+        if (@A int @B(0) [].class != int[].class) throw new Error();
+    }
+
+    Object classLit1 = @A String @C [] @B(0) [].class;
+    Object classLit2 = @A String @C []       [].class;
+    Object classLit3 = @A String    [] @B(0) [].class;
+    Object classLit4 =    String    [] @B(0) [].class;
+    Object classLit5 =    String @C []       [].class;
+    Object classLit6 =    String    []       [].class;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/DotClass.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,17 @@
+DotClass.java:47:42: compiler.err.no.annotations.on.dot.class
+DotClass.java:50:33: compiler.err.no.annotations.on.dot.class
+DotClass.java:52:52: compiler.err.no.annotations.on.dot.class
+DotClass.java:57:44: compiler.err.no.annotations.on.dot.class
+DotClass.java:58:26: compiler.err.no.annotations.on.dot.class
+DotClass.java:59:26: compiler.err.no.annotations.on.dot.class
+DotClass.java:60:35: compiler.err.no.annotations.on.dot.class
+DotClass.java:62:48: compiler.err.no.annotations.on.dot.class
+DotClass.java:63:49: compiler.err.no.annotations.on.dot.class
+DotClass.java:64:28: compiler.err.no.annotations.on.dot.class
+DotClass.java:65:35: compiler.err.no.annotations.on.dot.class
+DotClass.java:68:54: compiler.err.no.annotations.on.dot.class
+DotClass.java:69:54: compiler.err.no.annotations.on.dot.class
+DotClass.java:70:54: compiler.err.no.annotations.on.dot.class
+DotClass.java:71:54: compiler.err.no.annotations.on.dot.class
+DotClass.java:72:54: compiler.err.no.annotations.on.dot.class
+16 errors
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/IncompleteArray.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary test incomplete array declaration
+ * @author Mahmood Ali
+ * @compile/fail/ref=IncompleteArray.out -XDrawDiagnostics IncompleteArray.java
+ */
+class IncompleteArray {
+  int @A [] @A var;
+}
+
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/IncompleteArray.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+IncompleteArray.java:9:13: compiler.err.illegal.start.of.type
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/NotTypeParameter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,25 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary test invalid location of TypeUse and TypeParameter
+ * @author Mahmood Ali
+ * @compile/fail/ref=NotTypeParameter.out -XDrawDiagnostics NotTypeParameter.java
+ */
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+class VoidMethod<@A K> {
+  @A void test() { }
+}
+
+@Target(ElementType.TYPE_USE)
+@interface A { }
+
+class TypeVariable<@B T> {
+  @B T test1() { return null; }
+  void test2(@B T p) {}
+}
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/NotTypeParameter.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,4 @@
+NotTypeParameter.java:13:3: compiler.err.annotation.type.not.applicable
+NotTypeParameter.java:20:3: compiler.err.annotation.type.not.applicable
+NotTypeParameter.java:21:14: compiler.err.annotation.type.not.applicable
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/NotTypeUse.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary test invalid location of TypeUse
+ * @author Mahmood Ali
+ * @compile/fail/ref=NotTypeUse.out -XDrawDiagnostics NotTypeUse.java
+ */
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+class VoidMethod {
+  @A void test() { }
+}
+
+@Target(ElementType.TYPE)
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/NotTypeUse.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+NotTypeUse.java:13:3: compiler.err.annotation.type.not.applicable
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/VoidMethod.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,33 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6843077 8006775
+ * @summary test invalid location of TypeUse and TypeParameter
+ * @author Mahmood Ali
+ * @compile/fail/ref=VoidMethod.out -XDrawDiagnostics VoidMethod.java
+ */
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+
+class VoidMethod {
+  // Invalid
+  @A void test1() { }
+  // The following is legal:
+  @B void test2() { }
+  // Invalid
+  @C void test3() { }
+  // The following is legal:
+  @D void test4() { }
+}
+
+@Target(ElementType.TYPE_USE)
+@interface A { }
+
+@Target({ElementType.TYPE_USE, ElementType.METHOD})
+@interface B { }
+
+@Target(ElementType.TYPE_PARAMETER)
+@interface C { }
+
+@Target({ElementType.TYPE_PARAMETER, ElementType.METHOD})
+@interface D { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/failures/target/VoidMethod.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,3 @@
+VoidMethod.java:14:3: compiler.err.annotation.type.not.applicable
+VoidMethod.java:18:3: compiler.err.annotation.type.not.applicable
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,81 @@
+
+/*
+ * 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
+ * @bug 6843077 8006775
+ * @summary random tests for new locations
+ * @author Matt Papi
+ * @compile BasicTest.java
+ */
+
+import java.lang.annotation.*;
+import java.util.*;
+import java.io.*;
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A {}
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B {}
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface C {}
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface D {}
+
+/**
+ * Tests basic JSR 308 parser functionality. We don't really care about what
+ * the parse tree looks like, just that these annotations can be parsed.
+ */
+class BasicTest<T extends @A Object> extends @B LinkedList<T> implements @C List<T> {
+
+    void test() {
+
+        // Handle annotated cast types
+        Object o = (@A Object) "foo";
+
+        // Handle annotated "new" expressions (except arrays; see ArrayTest)
+        String s = new @A String("bar");
+
+        boolean b = o instanceof @A Object;
+
+        @A Map<@B List<@C String>, @D String> map =
+            new @A HashMap<@B List<@C String>, @D String>();
+
+        Class<? extends @A String> c2 = null;
+    }
+
+    // Handle receiver annotations
+    // Handle annotations on a qualified identifier list
+    void test2(@C @D BasicTest<T> this) throws @A IllegalArgumentException, @B IOException {
+
+    }
+
+    // Handle annotations on a varargs element type
+    void test3(@B Object @A... objs) { }
+
+    void test4(@B Class<@C ?> @A ... clz) { }
+
+
+    // TODO: add more tests... nested classes, etc.
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/ClassExtends.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: class extends/implements
+ * @author Mahmood Ali
+ * @compile ClassExtends.java
+ */
+abstract class MyClass extends @A ParameterizedClass<@B String>
+  implements @B CharSequence, @A ParameterizedInterface<@B String> { }
+
+interface MyInterface extends @A ParameterizedInterface<@A String>,
+                              @B CharSequence { }
+
+class ParameterizedClass<K> {}
+interface ParameterizedInterface<K> {}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A {}
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/ClassParameters.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: class type parameter bounds
+ * @author Mahmood Ali
+ * @compile ClassParameters.java
+ */
+class Unannotated<K> { }
+
+class ExtendsBound<K extends @A String> { }
+class ExtendsGeneric<K extends @A Unannotated<@B String>> { }
+class TwoBounds<K extends @A String, V extends @B String> { }
+
+class Complex1<K extends @A String&Runnable> { }
+class Complex2<K extends String & @B Runnable> { }
+class ComplexBoth<K extends @A String & @A Runnable> { }
+
+class Outer {
+  void inner() {
+    class Unannotated<K> { }
+
+    class ExtendsBound<K extends @A String> { }
+    class ExtendsGeneric<K extends @A Unannotated<@B String>> { }
+    class TwoBounds<K extends @A String, V extends @B String> { }
+
+    class Complex1<K extends @A String&Runnable> { }
+    class Complex2<K extends String & @B Runnable> { }
+    class ComplexBoth<K extends @A String & @A Runnable> { }
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/ConstructorTypeArgs.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: constructor type args
+ * @author Mahmood Ali
+ * @compile ConstructorTypeArgs.java
+ */
+
+class ConstructorTypeArgs {
+  void oneArg() {
+    new @A MyList<@A String>();
+    new MyList<@A MyList<@B(0) String>>();
+  }
+
+  void twoArg() {
+    new MyMap<String, String>();
+    new MyMap<@A String, @B(0) MyList<@A String>>();
+  }
+
+  void withArraysIn() {
+    new MyList<String[]>();
+    new MyList<@A String @B(0) [] @A []>();
+
+    new MyMap<@A String[], @B(0) MyList<@A String> @A []>();
+  }
+}
+
+class MyList<E> { }
+class MyMap<K, V> { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/ExceptionParameters.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,76 @@
+/*
+ * 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.lang.annotation.*;
+
+import java.io.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: exception parameters
+ * @author Werner Dietl
+ * @compile ExceptionParameters.java
+ */
+
+class ExceptionParameters {
+
+  void exception() {
+    try {
+      foobar();
+    } catch (@A Exception e) {
+      e.toString();
+    }
+  }
+
+  void finalException() {
+    try {
+      foobar();
+    } catch (final @B Exception e) {
+      e.toString();
+    }
+  }
+
+  void multiException1() {
+    try {
+      foobar();
+    } catch (@A NullPointerException | @B IndexOutOfBoundsException e) {
+      e.toString();
+    }
+  }
+
+  void multiException2() {
+    try {
+      foobar();
+    } catch (java.lang.@A NullPointerException | java.lang.@B IndexOutOfBoundsException e) {
+      e.toString();
+    }
+  }
+
+  void foobar() {}
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Expressions.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: expressions
+ * @author Mahmood Ali
+ * @compile Expressions.java
+ */
+class Expressions {
+  void instanceOf() {
+    Object o = null;
+    boolean a = o instanceof @A String;
+    boolean b = o instanceof @B(0) String;
+  }
+
+  void instanceOfArray() {
+    Object o = null;
+    boolean a1 = o instanceof @A String [];
+    boolean a2 = o instanceof @B(0) String [];
+
+    boolean b1 = o instanceof String @A [];
+    boolean b2 = o instanceof String @B(0) [];
+  }
+
+  void objectCreation() {
+    new @A String();
+    new @B(0) String();
+  }
+
+  void objectCreationArray() {
+    Object a1 = new @A String [] [] { };
+    Object a2 = new @A String [1] [];
+    Object a3 = new @A String [1] [2];
+
+    Object b1 = new @A String @B(0) [] [] { };
+    Object b2 = new @A String @B(0) [1] [];
+    Object b3 = new @A String @B(0) [1] [2];
+
+    Object c1 = new @A String []  @B(0) [] { };
+    Object c2 = new @A String [1] @B(0) [];
+    Object c3 = new @A String [1] @B(0) [2];
+
+    Object d1 = new @A String @B(0) []  @B(0) [] { };
+    Object d2 = new @A String @B(0) [1] @B(0) [];
+    Object d3 = new @A String @B(0) [1] @B(0) [2];
+
+    Object rand = new @A String @B(value = 0) [1] @B(value = 0) [2];
+
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Fields.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: field type array/generics
+ * @author Mahmood Ali
+ * @compile Fields.java
+ */
+
+class DefaultScope {
+  Parameterized<String, String> unannotated;
+  Parameterized<@A String, String> firstTypeArg;
+  Parameterized<String, @A String> secondTypeArg;
+  Parameterized<@A String, @B String> bothTypeArgs;
+
+  Parameterized<@A Parameterized<@A String, @B String>, @B String>
+    nestedParameterized;
+
+  @A String [] array1;
+  @A String @B [] array1Deep;
+  @A String [] [] array2;
+  @A String @A [] @B [] array2Deep;
+  String @A [] [] array2First;
+  String [] @B [] array2Second;
+
+  // Old-style array syntax
+  String array2FirstOld @A [];
+  String array2SecondOld [] @B [];
+}
+
+class ModifiedScoped {
+  public final Parameterized<String, String> unannotated = null;
+  public final Parameterized<@A String, String> firstTypeArg = null;
+  public final Parameterized<String, @A String> secondTypeArg = null;
+  public final Parameterized<@A String, @B String> bothTypeArgs = null;
+
+  public final Parameterized<@A Parameterized<@A String, @B String>, @B String>
+    nestedParameterized = null;
+
+  public final @A String [] array1 = null;
+  public final @A String @B [] array1Deep = null;
+  public final @A String [] [] array2 = null;
+  public final @A String @A [] @B [] array2Deep = null;
+  public final String @A [] [] array2First = null;
+  public final String [] @B [] array2Second = null;
+}
+
+class Parameterized<K, V> { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Lambda.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 8008077
+ * @summary new type annotation location: lambda expressions
+ * @compile Lambda.java
+ * @author Werner Dietl
+ */
+
+import java.lang.annotation.*;
+
+public class Lambda {
+
+    interface LambdaInt {
+        <S, T> void generic(S p1, T p2);
+    }
+
+    static class LambdaImpl implements LambdaInt {
+        <S, T> LambdaImpl(S p1, T p2) {}
+        public <S, T> void generic(S p1, T p2) {}
+    }
+
+    LambdaInt getMethodRefTA(LambdaImpl r) {
+        return r::<@TA Object, @TB Object>generic;
+    }
+
+    LambdaInt getConstructorRefTA() {
+        return LambdaImpl::<@TA Object, @TB Object>new;
+    }
+
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TA { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TB { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/LocalVariables.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: local variables array/generics
+ * @author Mahmood Ali
+ * @compile LocalVariables.java
+ */
+
+class DefaultScope {
+  void parameterized() {
+    Parameterized<String, String> unannotated;
+    Parameterized<@A String, String> firstTypeArg;
+    Parameterized<String, @A String> secondTypeArg;
+    Parameterized<@A String, @B String> bothTypeArgs;
+
+    Parameterized<@A Parameterized<@A String, @B String>, @B String>
+      nestedParameterized;
+  }
+
+  void arrays() {
+    @A String [] array1;
+    @A String @B [] array1Deep;
+    @A String [] [] array2;
+    @A String @A [] @B [] array2Deep;
+    String @A [] [] array2First;
+    String [] @B [] array2Second;
+  }
+}
+
+class ModifiedVars {
+  void parameterized() {
+    final Parameterized<String, String> unannotated = null;
+    final Parameterized<@A String, String> firstTypeArg = null;
+    final Parameterized<String, @A String> secondTypeArg = null;
+    final Parameterized<@A String, @B String> bothTypeArgs = null;
+
+    final Parameterized<@A Parameterized<@A String, @B String>, @B String>
+      nestedParameterized = null;
+  }
+
+  void arrays() {
+    final @A String [] array1 = null;
+    final @A String @B [] array1Deep = null;
+    final @A String [] [] array2 = null;
+    final @A String @A [] @B [] array2Deep = null;
+    final String @A [] [] array2First = null;
+    final String [] @B [] array2Second = null;
+  }
+}
+
+class Parameterized<K, V> { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/MethodReturnType.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: method return type array/generics
+ * @author Mahmood Ali
+ * @compile MethodReturnType.java
+ */
+
+class DefaultScope {
+  Parameterized<String, String> unannotated() { return null; }
+  Parameterized<@A String, String> firstTypeArg() { return null; }
+  Parameterized<String, @A String> secondTypeArg() { return null; }
+  Parameterized<@A String, @B String> bothTypeArgs() { return null; }
+
+  Parameterized<@A Parameterized<@A String, @B String>, @B String>
+    nestedParameterized() { return null; }
+
+  public <T> @A String method() { return null; }
+
+  @A String [] array1() { return null; }
+  @A String @B [] array1Deep() { return null; }
+  @A String [] [] array2() { return null; }
+  @A String @A [] @B [] array2Deep() { return null; }
+  String @A [] [] array2First() { return null; }
+  String [] @B [] array2Second() { return null; }
+
+  // Old-style array syntax
+  String array2FirstOld() @A [] { return null; }
+  String array2SecondOld() [] @B [] { return null; }
+}
+
+class ModifiedScoped {
+  public final Parameterized<String, String> unannotated() { return null; }
+  public final Parameterized<@A String, String> firstTypeArg() { return null; }
+  public final Parameterized<String, @A String> secondTypeArg() { return null; }
+  public final Parameterized<@A String, @B String> bothTypeArgs() { return null; }
+
+  public final Parameterized<@A Parameterized<@A String, @B String>, @B String>
+    nestedParameterized() { return null; }
+
+  public final @A String [] array1() { return null; }
+  public final @A String @B [] array1Deep() { return null; }
+  public final @A String [] [] array2() { return null; }
+  public final @A String @A [] @B [] array2Deep() { return null; }
+  public final String @A [] [] array2First() { return null; }
+  public final String [] @B [] array2Second() { return null; }
+}
+
+class Parameterized<K, V> { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/MethodTypeArgs.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: method type args
+ * @author Mahmood Ali
+ * @compile MethodTypeArgs.java
+ */
+
+class MethodTypeArgs {
+  void oneArg() {
+    this.<@A String>newList();
+    this.<@A MyList<@B(0) String>>newList();
+
+    MethodTypeArgs.<@A String>newList();
+    MethodTypeArgs.<@A MyList<@B(0) String>>newList();
+  }
+
+  void twoArg() {
+    this.<String, String>newMap();
+    this.<@A String, @B(0) MyList<@A String>>newMap();
+
+    MethodTypeArgs.<String, String>newMap();
+    MethodTypeArgs.<@A String, @B(0) MyList<@A String>>newMap();
+  }
+
+  void withArraysIn() {
+    this.<String[]>newList();
+    this.<@A String @B(0) [] @A []>newList();
+
+    this.<@A String[], @B(0) MyList<@A String> @A []>newMap();
+  }
+
+  static <E> void newList() { }
+  static <K, V> void newMap() { }
+}
+
+class MyList<E> { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { int value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/MethodTypeParameters.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: method type parameter bounds
+ * @author Mahmood Ali
+ * @compile MethodTypeParameters.java
+ */
+
+class UnscopedUnmodified {
+  <K extends @A String> void methodExtends() {}
+  <K extends @A Parameterized<@B String>> void nestedExtends() {}
+  <K extends @A String, V extends @A Parameterized<@B String>> void dual() {}
+  <K extends String, V extends Parameterized<@B String>> void dualOneAnno() {}
+}
+
+class PublicModifiedMethods {
+  public final <K extends @A String> void methodExtends() {}
+  public final <K extends @A Parameterized<@B String>> void nestedExtends() {}
+  public final <K extends @A String, V extends @A Parameterized<@B String>> void dual() {}
+  public final <K extends String, V extends Parameterized<@B String>> void dualOneAnno() {}
+}
+
+class Parameterized<K> { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @ignore // syntax not sure yet.
+ * @bug 8006775
+ * @summary new type annotation location: multicatch
+ * @author Werner Dietl
+ * @compile MultiCatch.java
+ */
+
+class DefaultScope {
+  void exception01() {
+    try {
+        System.out.println("Hello 1!");
+    } catch (@B NullPointerException | @C IllegalArgumentException e) {
+      e.toString();
+    }
+  }
+  void exception02() {
+    try {
+        System.out.println("Hello 2!");
+    } catch @A (@B NullPointerException | @C IllegalArgumentException e) {
+      e.toString();
+    }
+  }
+}
+
+class ModifiedVars {
+    /*
+  void exception() {
+    try {
+      arrays();
+    } catch (final @A Exception e) {
+      e.toString();
+    }
+  }
+    */
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface C { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface D { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/NestedTypes.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,212 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+import java.util.Map;
+
+/*
+ * @test
+ * @bug 8006775
+ * @summary new type annotation location: nested types
+ * @author Werner Dietl
+ * @compile NestedTypes.java
+ */
+class Outer {
+    class Inner {
+        class Inner2 {
+            // m1a-c all have the same parameter type.
+            void m1a(@A Inner2 p1a) {}
+            void m1b(Inner.@A Inner2 p1b) {}
+            void m1c(Outer.Inner.@A Inner2 p1c) {}
+            // notice the difference to m1d
+            void m1d(@A Outer.Inner.Inner2 p1d) {}
+
+            // m2a-b both have the same parameter type.
+            void m2a(@A Inner.Inner2 p2a) {}
+            void m2b(Outer.@A Inner.Inner2 p2b) {}
+
+            // The location for @A is the same in m3a-c
+            void m3a(@A Outer p3a) {}
+            void m3b(@A Outer.Inner p3b) {}
+            void m3c(@A Outer.Inner.Inner2 p3c) {}
+
+            // Test combinations
+            void m4a(@A Outer p3a) {}
+            void m4b(@A Outer. @B Inner p3b) {}
+            void m4c(@A Outer. @B Inner. @C Inner2 p3c) {}
+        }
+    }
+
+    void m4a(@A Map p4a) {}
+    void m4b(Map.@B Entry p4c) {}
+    // Illegal:
+    // void m4b(@A Map.Entry p4b) {}
+    // void m4c(@A Map.@B Entry p4c) {}
+
+    void m4c(Map<String,String>.@B Entry<String,String> p4d) {}
+    // Illegal:
+    // void m4d(@A Map<String,String>.@B Entry<String,String> p4d) {}
+
+    void m4e(MyList<Map.Entry> p4e) {}
+    void m4f(MyList<Map.@B Entry> p4f) {}
+    // Illegal:
+    // void m4g(MyList<@A Map.Entry> p4e) {}
+    // void m4h(MyList<@A Map.@B Entry> p4f) {}
+
+    class GInner<X> {
+        class GInner2<Y, Z> {}
+    }
+
+    static class Static {}
+    static class GStatic<X, Y> {
+        static class GStatic2<Z> {}
+    }
+}
+
+class Test1 {
+    // Outer.GStatic<Object,Object>.GStatic2<Object> gs;
+    Outer.GStatic.@A GStatic2<Object> gsgood;
+    // TODO: add failing test
+    // Outer.@A GStatic.GStatic2<Object> gsbad;
+
+    MyList<@A Outer . @B Inner. @C Inner2> f;
+    @A Outer .GInner<Object>.GInner2<String, Integer> g;
+
+    // TODO: Make sure that something like this fails gracefully:
+    // MyList<java.@B lang.Object> pkg;
+
+    @A Outer f1;
+    @A Outer . @B Inner f2 = f1.new @B Inner();
+    // TODO: ensure type annos on new are stored.
+    @A Outer . @B GInner<@C Object> f3 = f1.new @B GInner<@C Object>();
+
+    MyList<@A Outer . @B GInner<@C MyList<@D Object>>. @E GInner2<@F Integer, @G Object>> f4;
+    // MyList<Outer.GInner<Object>.GInner2<Integer>> f4clean;
+
+    @A Outer . @B GInner<@C MyList<@D Object>>. @E GInner2<@F Integer, @G Object> f4top;
+
+    MyList<@A Outer . @B GInner<@C MyList<@D Object @E[] @F[]>>. @G GInner2<@H Integer, @I Object> @J[] @K[]> f4arr;
+
+    @A Outer . @B GInner<@C MyList<@D Object @E[] @F[]>>. @G GInner2<@H Integer, @I Object> @J[] @K[] f4arrtop;
+
+    MyList<Outer . @B Static> f5;
+    // Illegal:
+    // MyList<@A Outer . @B Static> f5;
+
+    Outer . @B Static f6;
+    // Illegal:
+    // @A Outer . @B Static f6;
+
+    Outer . @Bv("B") GStatic<@Cv("C") String, @Dv("D") Object> f7;
+    // Illegal:
+    // @Av("A") Outer . @Bv("B") GStatic<@Cv("C") String, @Dv("D") Object> f7;
+
+    Outer . @Cv("Data") Static f8;
+    // Illegal:
+    // @A Outer . @Cv("Data") Static f8;
+
+    MyList<Outer . @Cv("Data") Static> f9;
+    // Illegal:
+    // MyList<@A Outer . @Cv("Data") Static> f9;
+}
+
+class Test2 {
+    void m() {
+        @A Outer f1 = null;
+        @A Outer.@B Inner f2 = null;
+        Outer.@B Static f3 = null;
+        // Illegal:
+        // @A Outer.@B Static f3 = null;
+        @A Outer.@C Inner f4 = null;
+
+        Outer . @B Static f5 = null;
+        Outer . @Cv("Data") Static f6 = null;
+        MyList<Outer . @Cv("Data") Static> f7 = null;
+    }
+}
+
+class Test3 {
+    void monster(@A Outer p1,
+        @A Outer.@B Inner p2,
+        Outer.@B Static p3,
+        @A Outer.@Cv("Test") Inner p4,
+        Outer . @B Static p5,
+        Outer . @Cv("Data") Static p6,
+        MyList<Outer . @Cv("Data") Static> p7) {
+    }
+}
+
+class Test4 {
+    void m() {
+        @A Outer p1 = new @A Outer();
+        @A Outer.@B Inner p2 = p1.new @B Inner();
+        // Illegal:
+        // @A Outer.@B Static p3 = new @A Outer.@B Static();
+        // Object o3 = new @A Outer.@B Static();
+
+        @A Outer.@Cv("Test") Inner p4 = p1.new @Cv("Test") Inner();
+        Outer . @B Static p5 = new Outer . @B Static();
+        Outer . @Cv("Data") Static p6 = new Outer . @Cv("Data") Static();
+        MyList<Outer . @Cv("Data") Static> p7 = new MyList<Outer . @Cv("Data") Static>();
+    }
+}
+
+class MyList<K> { }
+
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface C { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface D { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface E { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface F { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface G { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface H { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface I { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface J { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface K { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface Av { String value(); }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface Bv { String value(); }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface Cv { String value(); }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface Dv { String value(); }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface Ev { String value(); }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface Fv { String value(); }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Parameters.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: parameter type array/generics
+ * @author Mahmood Ali
+ * @compile Parameters.java
+ */
+
+class Parameters {
+  void unannotated(Parameterized<String, String> a) {}
+  void firstTypeArg(Parameterized<@A String, String> a) {}
+  void secondTypeArg(Parameterized<String, @A String> a) {}
+  void bothTypeArgs(Parameterized<@A String, @B String> both) {}
+
+  void nestedParameterized(Parameterized<@A Parameterized<@A String, @B String>, @B String> a) {}
+
+  void array1(@A String [] a) {}
+  void array1Deep(@A String @B [] a) {}
+  void array2(@A String [] [] a) {}
+  void array2Deep(@A String @A [] @B [] a) {}
+  void array2First(String @A [] [] a) {}
+  void array2Second(String [] @B [] a) {}
+}
+
+class Parameterized<K, V> { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Receivers.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: receivers
+ * @author Mahmood Ali, Werner Dietl
+ * @compile Receivers.java
+ */
+class DefaultUnmodified {
+  void plain(@A DefaultUnmodified this) { }
+  <T> void generic(@A DefaultUnmodified this) { }
+  void withException(@A DefaultUnmodified this) throws Exception { }
+  String nonVoid(@A DefaultUnmodified this) { return null; }
+  <T extends Runnable> void accept(@A DefaultUnmodified this, T r) throws Exception { }
+}
+
+class PublicModified {
+  public final void plain(@A PublicModified this) { }
+  public final <T> void generic(@A PublicModified this) { }
+  public final void withException(@A PublicModified this) throws Exception { }
+  public final String nonVoid(@A PublicModified this) { return null; }
+  public final <T extends Runnable> void accept(@A PublicModified this, T r) throws Exception { }
+}
+
+class WithValue {
+  void plain(@B("m") WithValue this) { }
+  <T> void generic(@B("m") WithValue this) { }
+  void withException(@B("m") WithValue this) throws Exception { }
+  String nonVoid(@B("m") WithValue this) { return null; }
+  <T extends Runnable> void accept(@B("m") WithValue this, T r) throws Exception { }
+}
+
+class WithFinal {
+  void plain(final @B("m") WithFinal this) { }
+  <T> void generic(final @B("m") WithFinal this) { }
+  void withException(final @B("m") WithFinal this) throws Exception { }
+  String nonVoid(final @B("m") WithFinal this) { return null; }
+  <T extends Runnable> void accept(final @B("m") WithFinal this, T r) throws Exception { }
+}
+
+class WithBody {
+  Object f;
+
+  void field(@A WithBody this) {
+    this.f = null;
+  }
+  void meth(@A WithBody this) {
+    this.toString();
+  }
+}
+
+class Generic1<X> {
+  void test1(Generic1<X> this) {}
+  void test2(@A Generic1<X> this) {}
+  void test3(Generic1<@A X> this) {}
+  void test4(@A Generic1<@A X> this) {}
+}
+
+class Generic2<@A X> {
+  void test1(Generic2<X> this) {}
+  void test2(@A Generic2<X> this) {}
+  void test3(Generic2<@A X> this) {}
+  void test4(@A Generic2<@A X> this) {}
+}
+
+class Generic3<X extends @A Object> {
+  void test1(Generic3<X> this) {}
+  void test2(@A Generic3<X> this) {}
+  void test3(Generic3<@A X> this) {}
+  void test4(@A Generic3<@A X> this) {}
+}
+
+class Generic4<X extends @A Object> {
+  <Y> void test1(Generic4<X> this) {}
+  <Y> void test2(@A Generic4<X> this) {}
+  <Y> void test3(Generic4<@A X> this) {}
+  <Y> void test4(@A Generic4<@A X> this) {}
+}
+
+class Outer {
+  class Inner {
+    void none(Outer.Inner this) {}
+    void outer(@A Outer.Inner this) {}
+    void inner(Outer. @B("i") Inner this) {}
+    void both(@A Outer.@B("i") Inner this) {}
+
+    void innerOnlyNone(Inner this) {}
+    void innerOnly(@A Inner this) {}
+  }
+}
+
+class GenericOuter<S, T> {
+  class GenericInner<U, V> {
+    void none(GenericOuter<S, T>.GenericInner<U, V> this) {}
+    void outer(@A GenericOuter<S, T>.GenericInner<U, V> this) {}
+    void inner(GenericOuter<S, T>. @B("i") GenericInner<U, V> this) {}
+    void both(@A GenericOuter<S, T>.@B("i") GenericInner<U, V> this) {}
+
+    void innerOnlyNone(GenericInner<U, V> this) {}
+    void innerOnly(@A GenericInner<U, V> this) {}
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A {}
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { String value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/RepeatingTypeAnnotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,126 @@
+/*
+ * 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
+ * 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.*;
+
+/*
+ * @test
+ * @bug 8006775
+ * @summary repeating type annotations are possible
+ * @author Werner Dietl
+ * @compile/fail/ref=RepeatingTypeAnnotations.out -XDrawDiagnostics RepeatingTypeAnnotations.java
+ */
+
+class RepeatingTypeAnnotations {
+    // Fields
+    @RTA @RTA Object fr1 = null;
+    Object fr2 = new @RTA @RTA Object();
+    // error
+    Object fs = new @TA @TA Object();
+    // error
+    Object ft = new @TA @TA Object();
+    Object fe = new @TA @TA Object();
+
+    // Local variables
+    Object foo() {
+        Object o = new @RTA @RTA Object();
+        o = new @TA @RTA @RTA Object();
+        o = new @RTA @TA @RTA Object();
+        // error
+        o = new @RTA @TA @RTA @TA Object();
+        // error
+        return new @TA @TA Object();
+    }
+
+    // Instance creation
+    Object bar() {
+        Object o = new @RTA @RTA MyList<@RTA @RTA Object>();
+        o = new @TA @RTA MyList<@TA @RTA Object>();
+        o = new @TA @RTA @RTA MyList<@RTA @TA @RTA Object>();
+        // error
+        o = new @TA @TA MyList<@RTA @RTA Object>();
+        // error
+        o = new @RTA @RTA MyList<@TA @TA Object>();
+        // error
+        return new @TA @TA MyList<@RTA @RTA Object>();
+    }
+
+    // More tests
+    void oneArg() {
+        Object o = new @RTA @RTA Object();
+        // error
+        o = new @TA @TA Object();
+        o = new @RTA @TA @RTA Object();
+
+        o = new MyList<@RTA @RTA Object>();
+        // error
+        o = new MyList<@TA @TA Object>();
+        // error
+        o = new @TA @TA MyList<@TA @TA Object>();
+        // error
+        this.<@TA @TA String>newList();
+
+        this.<@RTA @RTA MyList<@RTA @RTA String>>newList();
+        // error
+        this.<@TA @TA MyList<@TA @TA String>>newList();
+
+        o = (@RTA @RTA MyList<@RTA @RTA Object>) o;
+        // error
+        o = (@TA @TA MyList<@TA @TA Object>) o;
+
+        this.<@RTA @RTA String, @RTA @RTA Object>newMap();
+        // error
+        this.<@TA @TA String, @TA @TA Object>newMap();
+
+        this.<@RTA @RTA String @RTA @RTA []>newList();
+        // error
+        this.<@TA @TA String @TA @TA []>newList();
+
+        this.<@RTA @RTA String @RTA @RTA [] @RTA @RTA [], MyList<@RTA @RTA String> @RTA @RTA []>newMap();
+        // error
+        this.<String @TA @TA [] @TA @TA [], MyList<@TA @TA String> @TA @TA []>newMap();
+    }
+
+    static <E> void newList() { }
+    static <K, V> void newMap() { }
+}
+
+class MyList<E> { }
+
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TA { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface TAs {
+    TA[] value();
+}
+
+@Repeatable(RTAs.class)
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface RTA { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface RTAs {
+    RTA[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/RepeatingTypeAnnotations.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+RepeatingTypeAnnotations.java:39:25: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:41:25: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:42:25: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:50:31: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:52:24: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:61:21: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:63:38: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:65:24: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:72:21: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:77:28: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:79:21: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:79:36: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:81:19: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:85:19: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:85:34: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:89:18: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:89:33: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:93:19: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:93:35: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:97:34: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:97:19: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:101:26: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:101:37: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:101:72: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+RepeatingTypeAnnotations.java:101:56: compiler.err.duplicate.annotation.missing.container: TA, java.lang.annotation.Repeatable
+- compiler.note.unchecked.filename: RepeatingTypeAnnotations.java
+- compiler.note.unchecked.recompile
+25 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/ResourceVariables.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,46 @@
+/*
+ * 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.lang.annotation.*;
+
+import java.io.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: resource variables
+ * @author Werner Dietl
+ * @compile ResourceVariables.java
+ */
+
+class ResourceVariables {
+    void m() throws Exception {
+        try (@A InputStream is = new @B FileInputStream("xxx")) {
+        }
+    }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Throws.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: throw clauses
+ * @author Mahmood Ali
+ * @compile Throws.java
+ */
+class DefaultUnmodified {
+  void oneException() throws @A Exception {}
+  void twoExceptions() throws @A RuntimeException, @A Exception {}
+}
+
+class PublicModified {
+  public final void oneException(String a) throws @A Exception {}
+  public final void twoExceptions(String a) throws @A RuntimeException, @A Exception {}
+}
+
+class WithValue {
+  void oneException() throws @B("m") Exception {}
+  void twoExceptions() throws @B(value="m") RuntimeException, @A Exception {}
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A {}
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { String value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/TopLevelBlocks.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * 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
+ * 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.util.Map;
+
+/*
+ * @test
+ * @bug 8006775
+ * @summary type annotation location: top level blocks
+ * @author Werner Dietl
+ * @compile TopLevelBlocks.java
+ */
+
+class TopLevelBlocks {
+    static Object f;
+
+    {
+        f = new @A Object();
+    }
+
+    static final Object sf;
+
+    static {
+        sf = new @A Object();
+    }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/TypeCasts.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: type casts
+ * @author Mahmood Ali
+ * @compile TypeCasts.java
+ */
+class TypeCasts {
+  void methodA() {
+    String s = (@A String) null;
+    Object o = (@A Class<@A String>) null;
+  }
+
+  void methodB() {
+    String s = (@B("m") String) null;
+    Object o = (@B("m") Class<@B("m") String>) null;
+  }
+}
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { String value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/TypeParameters.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: class and method type parameters
+ * @author Mahmood Ali
+ * @compile TypeParameters.java
+ */
+
+class Unannotated<K> { }
+class OneAnnotated<@A K> { }
+class TwoAnnotated<@A K, @A V> { }
+class SecondAnnotated<K, @A V extends String> { }
+
+class TestMethods {
+  <K> void unannotated() { }
+  <@A K> void oneAnnotated() { }
+  <@A K, @B("m") V> void twoAnnotated() { }
+  <K, @A V extends @A String> void secondAnnotated() { }
+}
+
+class UnannotatedB<K> { }
+class OneAnnotatedB<@B("m") K> { }
+class TwoAnnotatedB<@B("m") K, @B("m") V> { }
+class SecondAnnotatedB<K, @B("m") V extends @B("m") String> { }
+
+class OneAnnotatedC<@C K> { }
+class TwoAnnotatedC<@C K, @C V> { }
+class SecondAnnotatedC<K, @C V extends String> { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { String value(); }
+@Target(ElementType.TYPE_USE)
+@interface C { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Varargs.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary test acceptance of varargs annotations
+ * @author Mahmood Ali
+ * @compile Varargs.java
+ */
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A {}
+
+class Varargs {
+
+    // Handle annotations on a varargs element type
+    void varargPlain(Object @A... objs) {
+
+    }
+
+    void varargGeneric(Class<?> @A ... clz) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/newlocations/Wildcards.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+import java.lang.annotation.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary new type annotation location: wildcard bound
+ * @author Mahmood Ali
+ * @compile Wildcards.java
+ */
+class BoundTest {
+  void wcExtends(MyList<? extends @A String> l) { }
+  void wcSuper(MyList<? super @A String> l) { }
+
+  MyList<? extends @A String> returnWcExtends() { return null; }
+  MyList<? super @A String> returnWcSuper() { return null; }
+  MyList<? extends @A MyList<? super @B("m") String>> complex() { return null; }
+}
+
+class BoundWithValue {
+  void wcExtends(MyList<? extends @B("m") String> l) { }
+  void wcSuper(MyList<? super @B(value="m") String> l) { }
+
+  MyList<? extends @B("m") String> returnWcExtends() { return null; }
+  MyList<? super @B(value="m") String> returnWcSuper() { return null; }
+  MyList<? extends @B("m") MyList<? super @B("m") String>> complex() { return null; }
+}
+
+class SelfTest {
+  void wcExtends(MyList<@A ?> l) { }
+  void wcSuper(MyList<@A ?> l) { }
+
+  MyList<@A ?> returnWcExtends() { return null; }
+  MyList<@A ?> returnWcSuper() { return null; }
+  MyList<@A ? extends @A MyList<@B("m") ?>> complex() { return null; }
+}
+
+class SelfWithValue {
+  void wcExtends(MyList<@B("m") ?> l) { }
+  void wcSuper(MyList<@B(value="m") ?> l) { }
+
+  MyList<@B("m") ?> returnWcExtends() { return null; }
+  MyList<@B(value="m") ?> returnWcSuper() { return null; }
+  MyList<@B("m") ? extends MyList<@B("m") ? super String>> complex() { return null; }
+}
+
+class MyList<K> { }
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface A { }
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@interface B { String value(); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/packageanno/PackageProcessor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2009, 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.util.HashSet;
+import java.util.Set;
+
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.*;
+import javax.lang.model.util.ElementFilter;
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.source.util.TreePath;
+import com.sun.tools.javac.main.JavaCompiler;
+import com.sun.tools.javac.main.JavaCompiler.CompileState;
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.util.Context;
+
+/*
+ * @test
+ * @summary test that package annotations are available to type processors.
+ * This class implements the functionality of a type processor, as previously
+ * embodied by the AbstractTypeProcessor class.
+ *
+ * @author Mahmood Ali
+ * @author Werner Dietl
+ *
+ * @compile PackageProcessor.java
+ * @compile -cp . -processor PackageProcessor mypackage/Anno.java mypackage/MyClass.java mypackage/package-info.java
+ */
+
+@SupportedAnnotationTypes("*")
+public class PackageProcessor extends AbstractProcessor {
+
+    private final AttributionTaskListener listener = new AttributionTaskListener();
+    private final Set<Name> elements = new HashSet<Name>();
+
+    @Override
+    public final void init(ProcessingEnvironment env) {
+        super.init(env);
+        JavacTask.instance(env).addTaskListener(listener);
+        Context ctx = ((JavacProcessingEnvironment)processingEnv).getContext();
+        JavaCompiler compiler = JavaCompiler.instance(ctx);
+        compiler.shouldStopPolicyIfNoError = CompileState.max(compiler.shouldStopPolicyIfNoError,
+                CompileState.FLOW);
+    }
+
+    @Override
+    public final boolean process(Set<? extends TypeElement> annotations,
+            RoundEnvironment roundEnv) {
+        for (TypeElement elem : ElementFilter.typesIn(roundEnv.getRootElements())) {
+            elements.add(elem.getQualifiedName());
+        }
+        return false;
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    private final class AttributionTaskListener implements TaskListener {
+        @Override
+        public void started(TaskEvent e) { }
+
+        @Override
+        public void finished(TaskEvent e) {
+            if (e.getKind() != TaskEvent.Kind.ANALYZE)
+                return;
+
+            if (!elements.remove(e.getTypeElement().getQualifiedName()))
+                return;
+
+            if (e.getTypeElement().getSimpleName().contentEquals("MyClass")) {
+                Element owner = e.getTypeElement().getEnclosingElement();
+                if (owner.getKind() != ElementKind.PACKAGE)
+                    throw new RuntimeException("class owner should be a package: " + owner);
+                if (owner.getAnnotationMirrors().size() != 1)
+                    throw new RuntimeException("the owner package should have one annotation: " + owner);
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/Anno.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2009, 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 mypackage;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Retention;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Anno {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/MyClass.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2009, 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 mypackage;
+
+public class MyClass {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/packageanno/mypackage/package-info.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+
+@mypackage.Anno
+package mypackage;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for class extends clauses
+ * @compile -g Driver.java ReferenceInfoUtil.java ClassExtends.java
+ * @run main Driver ClassExtends
+ */
+public class ClassExtends {
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1),
+        @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1)
+    })
+    public String regularClass() {
+        return "class Test extends @TA Object implements Cloneable, @TB Runnable {"
+               + "  public void run() { } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1,
+                genericLocation  = { 3, 1 })
+    })
+    public String regularClassExtendsParametrized() {
+        return "class Test extends HashMap<@TA String, String> implements Cloneable, Map<String, @TB String>{ } ";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1),
+        @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1)
+    })
+    public String abstractClass() {
+        return "abstract class Test extends @TA Date implements Cloneable, @TB Runnable {"
+               + "  public void run() { } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_EXTENDS, typeIndex = -1,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1,
+                genericLocation  = { 3, 1 })
+    })
+    public String abstractClassExtendsParametrized() {
+        return "abstract class Test extends HashMap<@TA String, String> implements Cloneable, Map<String, @TB String>{ } ";
+    }
+
+    @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1)
+    public String regularInterface() {
+        return "interface Test extends Cloneable, @TB Runnable { }";
+    }
+
+    @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1,
+            genericLocation  = { 3, 1 })
+    public String regularInterfaceExtendsParametrized() {
+        return "interface Test extends Cloneable, Map<String, @TB String>{ } ";
+    }
+
+    @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1)
+    public String regularEnum() {
+        return "enum Test implements Cloneable, @TB Runnable { TEST; public void run() { } }";
+    }
+
+    @TADescription(annotation = "TB", type = CLASS_EXTENDS, typeIndex = 1,
+            genericLocation  = { 3, 0 })
+    public String regularEnumExtendsParametrized() {
+        return
+            "enum Test implements Cloneable, Comparator<@TB String> { TEST;  "
+            + "public int compare(String a, String b) { return 0; }}";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for class type parameters
+ * @compile -g Driver.java ReferenceInfoUtil.java ClassTypeParam.java
+ * @run main Driver ClassTypeParam
+ */
+public class ClassTypeParam {
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TC", type = CLASS_TYPE_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TD", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TE", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1)
+    })
+    public String regularClass() {
+        return "class Test<@TA K extends @TB Date, @TC V extends @TD Object & @TE Cloneable> { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TC", type = CLASS_TYPE_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TE", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1)
+    })
+    public String regularClass2() {
+        return "class Test<@TA K extends @TB Date, @TC V extends @TE Cloneable> { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0})
+    })
+    public String regularClassParameterized() {
+        return "class Test<K extends @TA Map<String, @TB String>, V extends @TC List<@TD List<@TE Object>>> { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TG", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0)
+    })
+    public String regularClassParameterized2() {
+        return "class Test<K extends @TG Object & @TA Map<String, @TB String>, V extends @TF Object & @TC List<@TD List<@TE Object>>> { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TC", type = CLASS_TYPE_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TD", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TE", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1)
+    })
+    public String abstractClass() {
+        return "abstract class Test<@TA K extends @TB Date, @TC V extends @TD Object & @TE Cloneable> { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0)
+    })
+    public String abstractClassParameterized() {
+        return "abstract class Test<K extends @TA Map<String, @TB String>, V extends @TF Object & @TC List<@TD List<@TE Object>>> { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TC", type = CLASS_TYPE_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TD", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TE", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1)
+    })
+    public String regularInterface() {
+        return "interface Test<@TA K extends @TB Date, @TC V extends @TD Object & @TE Cloneable> { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0})
+    })
+    public String regularInterfaceParameterized() {
+        return "interface Test<K extends @TA Map<String, @TB String>, V extends @TC List<@TD List<@TE Object>>> { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TG", type = CLASS_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0)
+    })
+    public String regularInterfaceParameterized2() {
+        return "interface Test<K extends @TG Object & @TA Map<String, @TB String>, V extends @TF Object & @TC List<@TD List<@TE Object>>> { }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RETURN)
+    public String useInReturn1() {
+        return "class Test<T> { @TA T m() { throw new RuntimeException(); } }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RETURN, genericLocation = {3, 0})
+    public String useInReturn2() {
+        return "class Test<T> { Class<@TA T> m() { throw new RuntimeException(); } }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+            paramIndex = 0, genericLocation = {3, 0})
+    public String useInParam1() {
+        return "class Test<T> { void m(Class<@TA T> p) { throw new RuntimeException(); } }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+            paramIndex = 0, genericLocation = {3, 0})
+    public String useInParam2() {
+        return "class Test { void m(Class<@TA Object> p) { throw new RuntimeException(); } }";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for constructor results
+ * @compile -g Driver.java ReferenceInfoUtil.java Constructors.java
+ * @run main Driver Constructors
+ */
+public class Constructors {
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN),
+        @TADescription(annotation = "TB", type = METHOD_RETURN),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    })
+    public String regularClass() {
+        return "class Test { @TA Test() {}" +
+                           " @TB Test(@TC int b) {} }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN),
+        @TADescription(annotation = "TB", type = METHOD_RETURN),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    })
+    @TestClass("Test$Inner")
+    public String innerClass() {
+        return "class Test { class Inner {" +
+               " @TA Inner() {}" +
+               " @TB Inner(@TC int b) {}" +
+               " } }";
+    }
+
+    /* TODO: Outer.this annotation support.
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RECEIVER),
+        @TADescription(annotation = "TB", type = METHOD_RETURN),
+        @TADescription(annotation = "TC", type = METHOD_RECEIVER),
+        @TADescription(annotation = "TD", type = METHOD_RETURN),
+        @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    })
+    @TestClass("Test$Inner")
+    public String innerClass2() {
+        return "class Test { class Inner {" +
+               " @TB Inner(@TA Test Test.this) {}" +
+               " @TD Inner(@TC Test Test.this, @TE int b) {}" +
+               " } }";
+    }
+    */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Driver.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,289 @@
+/*
+ * 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.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.TypeAnnotation;
+import com.sun.tools.classfile.TypeAnnotation.TargetType;
+
+public class Driver {
+
+    private static final PrintStream out = System.out;
+
+    public static void main(String[] args) throws Exception {
+        if (args.length == 0 || args.length > 1)
+            throw new IllegalArgumentException("Usage: java Driver <test-name>");
+        String name = args[0];
+        Class<?> clazz = Class.forName(name);
+        new Driver().runDriver(clazz.newInstance());
+    }
+
+    protected void runDriver(Object object) throws Exception {
+        int passed = 0, failed = 0;
+        Class<?> clazz = object.getClass();
+        out.println("Tests for " + clazz.getName());
+
+        // Find methods
+        for (Method method : clazz.getMethods()) {
+            Map<String, TypeAnnotation.Position> expected = expectedOf(method);
+            if (expected == null)
+                continue;
+            if (method.getReturnType() != String.class)
+                throw new IllegalArgumentException("Test method needs to return a string: " + method);
+            String testClass = testClassOf(method);
+
+            try {
+                String compact = (String)method.invoke(object);
+                String fullFile = wrap(compact);
+                ClassFile cf = compileAndReturn(fullFile, testClass);
+                List<TypeAnnotation> actual = ReferenceInfoUtil.extendedAnnotationsOf(cf);
+                ReferenceInfoUtil.compare(expected, actual, cf);
+                out.println("PASSED:  " + method.getName());
+                ++passed;
+            } catch (Throwable e) {
+                out.println("FAILED:  " + method.getName());
+                out.println("    " + e.toString());
+                ++failed;
+            }
+        }
+
+        out.println();
+        int total = passed + failed;
+        out.println(total + " total tests: " + passed + " PASSED, " + failed + " FAILED");
+
+        out.flush();
+
+        if (failed != 0)
+            throw new RuntimeException(failed + " tests failed");
+    }
+
+    private Map<String, TypeAnnotation.Position> expectedOf(Method m) {
+        TADescription ta = m.getAnnotation(TADescription.class);
+        TADescriptions tas = m.getAnnotation(TADescriptions.class);
+
+        if (ta == null && tas == null)
+            return null;
+
+        Map<String, TypeAnnotation.Position> result =
+            new HashMap<String, TypeAnnotation.Position>();
+
+        if (ta != null)
+            result.putAll(expectedOf(ta));
+
+        if (tas != null) {
+            for (TADescription a : tas.value()) {
+                result.putAll(expectedOf(a));
+            }
+        }
+
+        return result;
+    }
+
+    private Map<String, TypeAnnotation.Position> expectedOf(TADescription d) {
+        String annoName = d.annotation();
+
+        TypeAnnotation.Position p = new TypeAnnotation.Position();
+        p.type = d.type();
+        if (d.offset() != NOT_SET)
+            p.offset = d.offset();
+        if (d.lvarOffset().length != 0)
+            p.lvarOffset = d.lvarOffset();
+        if (d.lvarLength().length != 0)
+            p.lvarLength = d.lvarLength();
+        if (d.lvarIndex().length != 0)
+            p.lvarIndex = d.lvarIndex();
+        if (d.boundIndex() != NOT_SET)
+            p.bound_index = d.boundIndex();
+        if (d.paramIndex() != NOT_SET)
+            p.parameter_index = d.paramIndex();
+        if (d.typeIndex() != NOT_SET)
+            p.type_index = d.typeIndex();
+        if (d.exceptionIndex() != NOT_SET)
+            p.exception_index = d.exceptionIndex();
+        if (d.genericLocation().length != 0) {
+            p.location = TypeAnnotation.Position.getTypePathFromBinary(wrapIntArray(d.genericLocation()));
+        }
+
+        return Collections.singletonMap(annoName, p);
+    }
+
+    private List<Integer> wrapIntArray(int[] ints) {
+        List<Integer> list = new ArrayList<Integer>(ints.length);
+        for (int i : ints)
+            list.add(i);
+        return list;
+    }
+
+    private String testClassOf(Method m) {
+        TestClass tc = m.getAnnotation(TestClass.class);
+        if (tc != null) {
+            return tc.value();
+        } else {
+            return "Test";
+        }
+    }
+
+    private ClassFile compileAndReturn(String fullFile, String testClass) throws Exception {
+        File source = writeTestFile(fullFile);
+        File clazzFile = compileTestFile(source, testClass);
+        return ClassFile.read(clazzFile);
+    }
+
+    protected File writeTestFile(String fullFile) throws IOException {
+        File f = new File("Test.java");
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+        out.println(fullFile);
+        out.close();
+        return f;
+    }
+
+    protected File compileTestFile(File f, String testClass) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path;
+        if (f.getParent() != null) {
+            path = f.getParent();
+        } else {
+            path = "";
+        }
+
+        return new File(path + testClass + ".class");
+    }
+
+    private String wrap(String compact) {
+        StringBuilder sb = new StringBuilder();
+
+        // Automatically import java.util
+        sb.append("\nimport java.util.*;");
+        sb.append("\nimport java.lang.annotation.*;");
+
+        sb.append("\n\n");
+        boolean isSnippet = !(compact.startsWith("class")
+                              || compact.contains(" class"))
+                            && !compact.contains("interface")
+                            && !compact.contains("enum");
+        if (isSnippet)
+            sb.append("class Test {\n");
+
+        sb.append(compact);
+        sb.append("\n");
+
+        if (isSnippet)
+            sb.append("}\n\n");
+
+        if (isSnippet) {
+            // Have a few common nested types for testing
+            sb.append("class Outer { class Inner {} }");
+            sb.append("class SOuter { static class SInner {} }");
+            sb.append("class GOuter<X, Y> { class GInner<X, Y> {} }");
+        }
+
+        // create A ... F annotation declarations
+        sb.append("\n@interface A {}");
+        sb.append("\n@interface B {}");
+        sb.append("\n@interface C {}");
+        sb.append("\n@interface D {}");
+        sb.append("\n@interface E {}");
+        sb.append("\n@interface F {}");
+
+        // create TA ... TF proper type annotations
+        sb.append("\n");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TB {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TC {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TD {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TE {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TF {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TG {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TH {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TI {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TJ {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TK {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TL {}");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TM {}");
+
+        // create RTA, RTAs, RTB, RTBs for repeating type annotations
+        sb.append("\n");
+        sb.append("\n@Repeatable(RTAs.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTA {}");
+        sb.append("\n@Repeatable(RTBs.class) @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTB {}");
+
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTAs { RTA[] value(); }");
+        sb.append("\n@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface RTBs { RTB[] value(); }");
+
+        sb.append("\n@Target(value={ElementType.TYPE,ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.CONSTRUCTOR,ElementType.LOCAL_VARIABLE})");
+        sb.append("\n@interface Decl {}");
+
+        return sb.toString();
+    }
+
+    public static final int NOT_SET = -888;
+
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@interface TADescription {
+    String annotation();
+
+    TargetType type();
+    int offset() default Driver.NOT_SET;
+    int[] lvarOffset() default { };
+    int[] lvarLength() default { };
+    int[] lvarIndex() default { };
+    int boundIndex() default Driver.NOT_SET;
+    int paramIndex() default Driver.NOT_SET;
+    int typeIndex() default Driver.NOT_SET;
+    int exceptionIndex() default Driver.NOT_SET;
+
+    int[] genericLocation() default {};
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@interface TADescriptions {
+    TADescription[] value() default {};
+}
+
+/**
+ * The name of the class that should be analyzed.
+ * Should only need to be provided when analyzing inner classes.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@interface TestClass {
+    String value() default "Test";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.
+ */
+
+import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for exception parameters
+ * @author Werner Dietl
+ * @compile -g Driver.java ReferenceInfoUtil.java ExceptionParameters.java
+ * @run main Driver ExceptionParameters
+ */
+public class ExceptionParameters {
+
+    @TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0)
+    public String exception() {
+        return "void exception() { try { new Object(); } catch(@TA Exception e) { } }";
+    }
+
+    @TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0)
+    public String finalException() {
+        return "void finalException() { try { new Object(); } catch(final @TA Exception e) { } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0),
+        @TADescription(annotation = "TB", type = EXCEPTION_PARAMETER, exceptionIndex = 1),
+        @TADescription(annotation = "TC", type = EXCEPTION_PARAMETER, exceptionIndex = 2)
+    })
+    public String multipleExceptions() {
+        return "void multipleExceptions() { " +
+            "try { new Object(); } catch(@TA Exception e) { }" +
+            "try { new Object(); } catch(@TB Exception e) { }" +
+            "try { new Object(); } catch(@TC Exception e) { }" +
+            " }";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for field
+ * @compile -g Driver.java ReferenceInfoUtil.java Fields.java
+ * @run main Driver Fields
+ */
+public class Fields {
+
+    // field types
+    @TADescription(annotation = "TA", type = FIELD)
+    public String fieldAsPrimitive() {
+        return "@TA int test;";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD)
+    public String fieldAsObject() {
+        return "@TA Object test;";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TC", type = FIELD,
+                genericLocation = { 3, 1 }),
+        @TADescription(annotation = "TD", type = FIELD,
+                genericLocation = { 3, 1, 3, 0 })
+    })
+    public String fieldAsParametrized() {
+        return "@TA Map<@TB String, @TC List<@TD String>> test;";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = { 0, 0 }),
+        @TADescription(annotation = "TC", type = FIELD,
+                genericLocation = { 0, 0, 0, 0 })
+    })
+    public String fieldAsArray() {
+        return "@TC String @TA [] @TB [] test;";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = { 0, 0 }),
+        @TADescription(annotation = "TC", type = FIELD,
+                genericLocation = { 0, 0, 0, 0 })
+    })
+    public String fieldAsArrayOld() {
+        return "@TC String test @TA [] @TB [];";
+    }
+
+    @TADescriptions({})
+    public String fieldWithDeclarationAnnotatin() {
+        return "@Decl String test;";
+    }
+
+    @TADescriptions({})
+    public String fieldWithNoTargetAnno() {
+        return "@A String test;";
+    }
+
+    // Smoke tests
+    @TADescription(annotation = "TA", type = FIELD)
+    public String interfacefieldAsObject() {
+        return "interface Test { @TA String test = null; }";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD)
+    public String abstractfieldAsObject() {
+        return "abstract class Test { @TA String test; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TC", type = FIELD,
+                genericLocation = { 3, 1 }),
+        @TADescription(annotation = "TD", type = FIELD,
+                genericLocation = { 3, 1, 3, 0 })
+    })
+    public String interfacefieldAsParametrized() {
+        return "interface Test { @TA Map<@TB String, @TC List<@TD String>> test = null; }";
+    }
+
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TC", type = FIELD,
+                genericLocation = { 3, 1 }),
+        @TADescription(annotation = "TD", type = FIELD,
+                genericLocation = { 3, 1, 3, 0 })
+    })
+    public String staticFieldAsParametrized() {
+        return "static @TA Map<@TB String, @TC List<@TD String>> test;";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,122 @@
+/*
+ * 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.
+ */
+
+import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test that the examples from the manual are stored as expected
+ * @compile -g Driver.java ReferenceInfoUtil.java FromSpecification.java
+ * @run main Driver FromSpecification
+ */
+public class FromSpecification {
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 2, 0}, paramIndex = 0),
+        @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 1}, paramIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 1, 3, 0}, paramIndex = 0)
+    })
+    public String testSpec1() {
+        return "void test(@TA Map<@TB ? extends @TC String, @TD List<@TE Object>> a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TI", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0, 0, 0}, paramIndex = 0)
+    })
+    public String testSpec2() {
+        return "void test(@TI String @TF [] @TG [] @TH [] a) { }";
+    }
+
+    // Note first "1, 0" for top-level class Test.
+    @TADescriptions({
+        @TADescription(annotation = "TJ", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0, 1, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TK", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TL", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TM", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0}, paramIndex = 0)
+    })
+    public String testSpec3() {
+        return "class Test { class O1 { class O2 { class O3 { class NestedStatic {} } } }" +
+                "void test(@TM O1.@TL O2.@TK O3.@TJ NestedStatic a) { } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 3, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 3, 0, 0, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 3, 0, 0, 0, 0, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 1}, paramIndex = 0),
+        @TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 1, 3, 0}, paramIndex = 0)
+    })
+    public String testSpec4() {
+        return "void test(@TA Map<@TB Comparable<@TF Object @TC [] @TD [] @TE []>, @TG List<@TH String>> a) { }";
+    }
+
+    // Note first "1, 0" for top-level class Test.
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0, 1, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0, 1, 0, 1, 0, 3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0, 1, 0, 1, 0, 3, 1}, paramIndex = 0),
+        @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0, 3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0, 1, 0, 3, 1}, paramIndex = 0),
+        @TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0}, paramIndex = 0)
+    })
+    public String testSpec5() {
+        return "class Test { class O1 { class O2<A, B> { class O3 { class Nested<X, Y> {} } } }" +
+                "void test(@TH O1.@TE O2<@TF String, @TG String>.@TD O3.@TA Nested<@TB String, @TC String> a) { } }";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,262 @@
+/*
+ * 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 8008077
+ * @summary Test population of reference info for lambda expressions
+ * @compile -g Driver.java ReferenceInfoUtil.java Lambda.java
+ * @run main Driver Lambda
+ * @author Werner Dietl
+ */
+
+import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+public class Lambda {
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String returnMethodRef1() {
+        return
+                "class Lambda {" +
+                "  public String getName() { return \"Lambda!\"; }" +
+                "}" +
+
+                "class Test {" +
+                "  java.util.function.Function<Lambda, String> lambda() {" +
+                "    return @TA @TB Lambda::getName;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TC", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TD", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 }),
+        @TADescription(annotation = "TE", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 })
+    })
+    public String returnMethodRef2() {
+        return
+                "class Lambda<S, T> {" +
+                "  public String getName() { return \"Lambda!\"; }" +
+                "}" +
+
+                "class Test {" +
+                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
+                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::getName;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "CTA", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "CTB", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "CTC", type = METHOD_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 })
+    })
+    public String returnMethodRef3() {
+        return
+                "class Lambda<S, T> {" +
+                "  public String getName() { return \"Lambda!\"; }" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTA {" +
+                "  String value();" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTB {" +
+                "  int age();" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTC {" +
+                "  String name();" +
+                "}" +
+
+                "class Test {" +
+                "  java.util.function.Function<Lambda<Integer, Float>, String> lambda() {" +
+                "    return @CTA(\"x\") Lambda<@CTB(age = 5) Integer, @CTC(name = \"y\") Float>::getName;" +
+                "  }" +
+                "}";
+    }
+
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String returnConstructorRef1() {
+        return
+                "class Lambda {" +
+                "  Lambda() { }" +
+                "}" +
+
+                "class Test {" +
+                "  Runnable lambda() {" +
+                "    return @TA @TB Lambda::new;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TC", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TD", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 }),
+        @TADescription(annotation = "TE", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 })
+    })
+    public String returnConstructorRef2() {
+        return
+                "class Lambda<S, T> {" +
+                "  Lambda() { }" +
+                "}" +
+
+                "class Test {" +
+                "  Runnable lambda() {" +
+                "    return @TA Lambda<@TB @TC Integer, @TD @TE Float>::new;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "CTA", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "CTB", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "CTC", type = CONSTRUCTOR_REFERENCE,
+                offset = ReferenceInfoUtil.IGNORE_VALUE,
+                genericLocation = { 3, 1 })
+    })
+    public String returnConstructorRef3() {
+        return
+                "class Lambda<S, T> {" +
+                "  Lambda() { }" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTA {" +
+                "  String value();" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTB {" +
+                "  int age();" +
+                "}" +
+
+                "@Target(ElementType.TYPE_USE)" +
+                "@interface CTC {" +
+                "  String name();" +
+                "}" +
+
+                "class Test {" +
+                "  Runnable lambda() {" +
+                "    return @CTA(\"x\") Lambda<@CTB(age = 5) Integer, @CTC(name = \"y\") Float>::new;" +
+                "  }" +
+                "}";
+    }
+
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_REFERENCE_TYPE_ARGUMENT,
+                 offset = ReferenceInfoUtil.IGNORE_VALUE,
+                 typeIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_REFERENCE_TYPE_ARGUMENT,
+                 offset = ReferenceInfoUtil.IGNORE_VALUE,
+                 typeIndex = 1)
+    })
+    public String returnMethodRefTA1() {
+        return
+                "interface Lambda {" +
+                "  <S, T> void generic(S p1, T p2);" +
+                "}" +
+
+                "class LambdaImpl implements Lambda {" +
+                "  public <S, T> void generic(S p1, T p2) {}" +
+                "}" +
+
+                "class Test {" +
+                "  Lambda lambda(LambdaImpl r) {" +
+                "    return r::<@TA Object, @TB Object>generic;" +
+                "  }" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
+                 offset = ReferenceInfoUtil.IGNORE_VALUE,
+                 typeIndex = 0),
+        @TADescription(annotation = "TB", type = CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT,
+                 offset = ReferenceInfoUtil.IGNORE_VALUE,
+                 typeIndex = 1)
+    })
+    public String returnConstructorRefTA2() {
+        return
+                "interface Lambda {" +
+                "  <S, T> void generic(S p1, T p2);" +
+                "}" +
+
+                "class LambdaImpl implements Lambda {" +
+                "  <S, T> LambdaImpl(S p1, T p2) {}" +
+                "  public <S, T> void generic(S p1, T p2) {}" +
+                "}" +
+
+                "class Test {" +
+                "  Lambda lambda() {" +
+                "    return LambdaImpl::<@TA Object, @TB Object>new;" +
+                "  }" +
+                "}";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for method parameters
+ * @compile -g Driver.java ReferenceInfoUtil.java MethodParameters.java
+ * @run main Driver MethodParameters
+ */
+public class MethodParameters {
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    public String methodParamAsPrimitive() {
+        return "void test(@TA int a) { }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1)
+    public String methodParamAsObject() {
+        return "void test(Object b, @TA Object a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 0 }, paramIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1 }, paramIndex = 0),
+        @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1, 3, 0 }, paramIndex = 0)
+    })
+    public String methodParamAsParametrized() {
+        return "void test(@TA Map<@TB String, @TC List<@TD String>> a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 0 }, paramIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 0, 2, 0 }, paramIndex = 0),
+        @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1 }, paramIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1, 3, 0 }, paramIndex = 0),
+        @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1, 3, 0, 2, 0 }, paramIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1, 3, 0, 2, 0, 3, 0 }, paramIndex = 0),
+        @TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1, 3, 0, 2, 0, 3, 0, 2, 0 }, paramIndex = 0),
+        @TADescription(annotation = "TI", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1, 3, 0, 2, 0, 3, 1 }, paramIndex = 0),
+        @TADescription(annotation = "TJ", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1, 3, 0, 2, 0, 3, 1, 2, 0 }, paramIndex = 0)
+    })
+    public String methodParamAsWildcard() {
+        return "void test(@TA Map<@TB ? extends @TC String," +
+                "                 @TD List<@TE ? extends @TF Map<@TG ? super @TH String," +
+                "                                                @TI ? extends @TJ Object>>> a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
+    })
+    public String methodParamAsArray() {
+        return "void test(Object b, @TC String @TA [] @TB [] a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1)
+    })
+    public String methodParamAsArray2() {
+        return "void test(Object b, @TA @TB String [] a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1)
+    })
+    public String methodParamAsArray3() {
+        return "void test(Object b, @TA @TB @TC String [] a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
+    })
+    public String methodParamAsVararg() {
+        return "void test(Object b, @TC String @TA [] @TB ... a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0 }, paramIndex = 1),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
+    })
+    public String methodParamAsFQVararg() {
+        return "void test(Object b, java.lang.@TC String @TA [] @TB ... a) { }";
+    }
+
+    @TADescriptions({})
+    public String methodWithDeclarationAnnotatin() {
+        return "void test(@Decl String a) { }";
+    }
+
+    @TADescriptions({})
+    public String methodWithNoTargetAnno() {
+        return "void test(@A String a) { }";
+    }
+
+    // Smoke tests
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    public String interfacemethodParamAsObject() {
+        return "interface Test { void test(@TA Object a); }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 2)
+    public String abstractmethodParamAsObject() {
+        return "abstract class Test { abstract void test(Object b, Object c, @TA Object a); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 0 }, paramIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1 }, paramIndex = 0),
+        @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = { 3, 1, 3, 0 }, paramIndex = 0)
+    })
+    public String interfacemethodParamAsParametrized() {
+        return "interface Test { void test(@TA Map<@TB String, @TC List<@TD String>> a); }";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for method receivers
+ * @compile -g Driver.java ReferenceInfoUtil.java MethodReceivers.java
+ * @run main Driver MethodReceivers
+ */
+public class MethodReceivers {
+
+    @TADescription(annotation = "TA", type = METHOD_RECEIVER)
+    public String regularMethod() {
+        return "class Test { void test(@TA Test this) { } }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RECEIVER)
+    public String abstractMethod() {
+        return "abstract class Test { abstract void test(@TA Test this); }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RECEIVER)
+    public String interfaceMethod() {
+        return "interface Test { void test(@TA Test this); }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RECEIVER)
+    public String regularWithThrows() {
+        return "class Test { void test(@TA Test this) throws Exception { } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RECEIVER,
+                genericLocation = {}),
+        @TADescription(annotation = "TB", type = METHOD_RECEIVER,
+                genericLocation = {1, 0})
+    })
+    @TestClass("TestOuter$TestInner")
+    public String nestedtypes1() {
+        return "class TestOuter { class TestInner { void test(@TA TestOuter. @TB TestInner this) { } } }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RECEIVER,
+            genericLocation = {})
+    @TestClass("TestOuter$TestInner")
+    public String nestedtypes2() {
+        return "class TestOuter { class TestInner { void test(@TA TestOuter.TestInner this) { } } }";
+    }
+
+    @TADescription(annotation = "TB", type = METHOD_RECEIVER,
+            genericLocation = {1, 0})
+    @TestClass("TestOuter$TestInner")
+    public String nestedtypes3() {
+        return "class TestOuter { class TestInner { void test(TestOuter. @TB TestInner this) { } } }";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for method return
+ * @compile -g Driver.java ReferenceInfoUtil.java MethodReturns.java
+ * @run main Driver MethodReturns
+ */
+public class MethodReturns {
+
+    // Method returns
+    @TADescription(annotation = "TA", type = METHOD_RETURN)
+    public String methodReturnAsPrimitive() {
+        return "@TA int test() { return 0; }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RETURN)
+    public String methodReturnAsObject() {
+        return "@TA Object test() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 3, 1 }),
+        @TADescription(annotation = "TD", type = METHOD_RETURN,
+                genericLocation = { 3, 1, 3, 0 })
+    })
+    public String methodReturnAsParametrized() {
+        return "@TA Map<@TB String, @TC List<@TD String>> test() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = { 0, 0 }),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 0, 0, 0, 0 })
+    })
+    public String methodReturnAsArray() {
+        return "@TC String @TA [] @TB [] test() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = { 0, 0 }),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 0, 0, 0, 0 })
+    })
+    public String methodReturnAsArrayOld() {
+        return "@TC String test() @TA [] @TB [] { return null; }";
+    }
+
+    @TADescriptions({})
+    public String methodWithDeclarationAnnotation() {
+        return "@Decl String test() { return null; }";
+    }
+
+    @TADescriptions({})
+    public String methodWithNoTargetAnno() {
+        return "@A String test() { return null; }";
+    }
+
+    // Smoke tests
+    @TADescription(annotation = "TA", type = METHOD_RETURN)
+    public String interfaceMethodReturnAsObject() {
+        return "interface Test { @TA Object test(); }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RETURN)
+    public String abstractMethodReturnAsObject() {
+        return "abstract class Test { abstract @TA Object test(); }";
+    }
+
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 3, 1 }),
+        @TADescription(annotation = "TD", type = METHOD_RETURN,
+                genericLocation = { 3, 1, 3, 0 })
+    })
+    public String interfaceMethodReturnAsParametrized() {
+        return "interface Test { @TA Map<@TB String, @TC List<@TD String>> test(); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN,
+                genericLocation = { 3, 0 }),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0 }),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0 }),
+        @TADescription(annotation = "TD", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0, 3, 0 }),
+        @TADescription(annotation = "TE", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1 }),
+        @TADescription(annotation = "TF", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1, 2, 0 })
+    })
+    public String methodReturnAsNestedWildcard() {
+        return "Set<@TA ? extends @TB GOuter<String, String>. @TC GInner<@TD String, @TE ? super @TF Object>> entrySet() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 1, 0, 3, 0 }),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 1, 0, 3, 1 }),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 1, 0, 3, 1, 2, 0 })
+    })
+    public String methodReturnAsNestedWildcard2() {
+        return "class GOuter<X, Y> { class GInner<X, Y> {} } " +
+                "class Test<K> { Set<GOuter<String, String>.GInner<@TA K, @TB ? extends @TC Object>> entrySet() { return null; } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0 }),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0 }),
+    })
+    public String methodReturnAsNestedWildcard3() {
+        return "Set<? extends @TB GOuter<String, String>. @TC GInner<String, Object>> entrySet() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0 }),
+    })
+    public String methodReturnAsNestedWildcard4() {
+        return "Set<? extends GOuter<String, String>. @TC GInner<String, Object>> entrySet() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0 }),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0 }),
+    })
+    public String methodReturnAsNestedWildcard5() {
+        return "Set<? extends @TB Outer. @TC Inner> entrySet() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0, 3, 0 }),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0, 3, 1 }),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = { 3, 0, 2, 0, 1, 0 }),
+    })
+    public String methodReturnAsNestedWildcard6() {
+        return "Set<? extends GOuter<String, String>. @TC GInner<@TA String, @TB Object>> entrySet() { return null; }";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for method exception clauses
+ * @compile -g Driver.java ReferenceInfoUtil.java MethodThrows.java
+ * @run main Driver MethodThrows
+ */
+public class MethodThrows {
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = THROWS, typeIndex = 0),
+        @TADescription(annotation = "TB", type = THROWS, typeIndex = 2)
+    })
+    public String regularMethod() {
+        return "class Test { void test() throws @TA RuntimeException, IllegalArgumentException, @TB Exception { } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = THROWS, typeIndex = 0),
+        @TADescription(annotation = "TB", type = THROWS, typeIndex = 2)
+    })
+    public String abstractMethod() {
+        return "abstract class Test { abstract void test() throws @TA RuntimeException, IllegalArgumentException, @TB Exception; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = THROWS, typeIndex = 0),
+        @TADescription(annotation = "TB", type = THROWS, typeIndex = 2)
+    })
+    public String interfaceMethod() {
+        return "interface Test { void test() throws @TA RuntimeException, IllegalArgumentException, @TB Exception; }";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for method type parameters
+ * @compile -g Driver.java ReferenceInfoUtil.java MethodTypeParam.java
+ * @run main Driver MethodTypeParam
+ */
+public class MethodTypeParam {
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1)
+    })
+    public String regularClass() {
+        return "<@TA K extends @TB Date, @TC V extends @TD Object & @TE Cloneable> void test() { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1)
+    })
+    public String regularClass2() {
+        return "<@TA K extends @TB Date, @TC V extends @TE Cloneable> void test() { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0)
+    })
+    public String regularClassParameterized() {
+        return "<K extends @TA Map<String, @TB String>, V extends @TF Object & @TC List<@TD List<@TE Object>>> void test() { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1)
+    })
+    public String abstractClass() {
+        return "abstract class Test { abstract <@TA K extends @TB Date, @TC V extends @TD Object & @TE Cloneable> void test(); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0)
+    })
+    public String abstractClassParameterized() {
+        return "abstract class Test { abstract <K extends @TG Object & @TA Map<String, @TB String>, V extends @TF Object & @TC List<@TD List<@TE Object>>> void test(); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0})
+    })
+    public String abstractClassParameterized2() {
+        return "abstract class Test { abstract <K extends @TA Map<String, @TB String>, V extends @TC List<@TD List<@TE Object>>> void test(); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1)
+    })
+    public String abstractClassParameterized3() {
+        return "abstract class Test { abstract <K extends @TA List<String>, V extends @TB List<Object>> void test(); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER, paramIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1)
+    })
+    public String regularInterface() {
+        return "interface Test { <@TA K extends @TB Date, @TC V extends @TD Object & @TE Cloneable> void test(); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TH", type = METHOD_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TI", type = METHOD_TYPE_PARAMETER, paramIndex = 1)
+    })
+    public String regularInterfaceParameterized() {
+        return "interface Test { <@TH K extends @TG Object & @TA Map<String, @TB String>, @TI V extends @TF Object & @TC List<@TD List<@TE Object>>> void test(); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1, genericLocation = {3, 1}),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0}),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 1, boundIndex = 1, genericLocation = {3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_TYPE_PARAMETER, paramIndex = 1)
+    })
+    public String regularInterfaceParameterized2() {
+        return "interface Test { <@TF K extends @TA Map<String, @TB String>, @TG V extends @TC List<@TD List<@TE Object>>> void test(); }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RETURN)
+    public String useInReturn1() {
+        return "class Test { <T> @TA T m() { throw new RuntimeException(); } }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_RETURN, genericLocation = {3, 0})
+    public String useInReturn2() {
+        return "class Test { <T> Class<@TA T> m() { throw new RuntimeException(); } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_RETURN)
+    })
+    public String useInReturn3() {
+        return "class Test { <T extends @TA Object> @TB T m() { throw new RuntimeException(); } }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+            paramIndex = 0, genericLocation = {3, 0})
+    public String useInParam1() {
+        return "class Test { <T> void m(Class<@TA T> p) { throw new RuntimeException(); } }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+            paramIndex = 0, genericLocation = {3, 0})
+    public String useInParam2() {
+        return "class Test { void m(Class<@TA Object> p) { throw new RuntimeException(); } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND, paramIndex = 0, boundIndex = 2),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER, paramIndex = 0)
+    })
+    public String useInParam3() {
+        return "interface IA {} " +
+               "interface IB<XB> {} " +
+               "interface IC<XC> {} " +
+               "class Test { <T extends @TA IB<IA> & @TB IC<IA>> void m(@TC T p) { throw new RuntimeException(); } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND,
+                paramIndex = 0, boundIndex = 1,
+                genericLocation = {}),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND,
+                paramIndex = 0, boundIndex = 2,
+                genericLocation = {}),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                paramIndex = 0)
+    })
+    public String useInParam4() {
+        return "class Test {" +
+               "  interface IA {} " +
+               "  interface IB<XB> {} " +
+               "  interface IC<XC> {} " +
+               "  <T extends @TA IB<IA> & @TB IC<IA>> void m(@TC T p) { throw new RuntimeException(); } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND,
+                paramIndex = 0, boundIndex = 0,
+                genericLocation = {}),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND,
+                paramIndex = 0, boundIndex = 0,
+                genericLocation = {1, 0}),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND,
+                paramIndex = 0, boundIndex = 0,
+                genericLocation = {1, 0, 3, 0}),
+    })
+    public String useInParam5() {
+        return "class Test {" +
+               "  interface IA {} " +
+               "  class CB<XC> {} " +
+               "  <T extends @TA Test. @TB CB<@TC IA>> void m(T p) { throw new RuntimeException(); } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER,
+                paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND,
+                paramIndex = 0, boundIndex = 0,
+                genericLocation = {}),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND,
+                paramIndex = 0, boundIndex = 0,
+                genericLocation = {1, 0, 3, 0}),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND,
+                paramIndex = 0, boundIndex = 1,
+                genericLocation = {}),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND,
+                paramIndex = 0, boundIndex = 1,
+                genericLocation = {3, 0})
+    })
+    public String useInParam6() {
+        return "class Test {" +
+               "  interface IA {} " +
+               "  interface IB<XB> {} " +
+               "  class CC<XC> {} " +
+               "  interface ID<XD> {} " +
+               "  <@TA T extends @TB Test.CC<@TC IA> & Test. @TD ID<@TE IA>> void m(T p) { throw new RuntimeException(); } }";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,56 @@
+/*
+ * 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @bug 8006732 8006775
+ * @ignore
+ * @summary Test population of reference info for multicatch exception parameters
+ * @author Werner Dietl
+ * @compile -g Driver.java ReferenceInfoUtil.java MultiCatch.java
+ * @run main Driver MultiCatch
+ */
+public class MultiCatch {
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0),
+        @TADescription(annotation = "TB", type = EXCEPTION_PARAMETER, exceptionIndex = 1)
+    })
+    public String multiCatch1() {
+        return "void multiCatch1() { " +
+            "try { new Object(); } catch (@TA NullPointerException | @TB IndexOutOfBoundsException e) { e.toString(); } }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = EXCEPTION_PARAMETER, exceptionIndex = 0),
+        @TADescription(annotation = "TB", type = EXCEPTION_PARAMETER, exceptionIndex = 1),
+        @TADescription(annotation = "TC", type = EXCEPTION_PARAMETER, exceptionIndex = 2),
+    })
+    public String multiCatch2() {
+        return "void multiCatch2() { " +
+            "try { new Object(); } catch (@TA NullPointerException | @TB IndexOutOfBoundsException | @TC IllegalArgumentException e) { e.toString(); } }";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,834 @@
+/*
+ * 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.
+ */
+
+import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for nested types
+ * @compile -g Driver.java ReferenceInfoUtil.java NestedTypes.java
+ * @run main Driver NestedTypes
+ */
+public class NestedTypes {
+
+    // method parameters
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {}, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0}, paramIndex = 0)
+    })
+    public String testParam1() {
+        return "void test(@TA Outer.@TB Inner a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 1, 0}, paramIndex = 0)
+    })
+    public String testParam1b() {
+        return "void test(List<@TA Outer.@TB Inner> a) { }";
+    }
+
+    // TODO: the tests that use @TA Map.Entry should fail, as
+    // Map cannot be annotated.
+    // We need some tests for the fully qualified name syntax.
+    /*
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+            genericLocation = {}, paramIndex = 0)
+    public String testParam1c() {
+        return "void test(java.util.@TA Map.Entry a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {}, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0}, paramIndex = 0)
+    })
+    public String testParam1d() {
+        return "void test(java.util.@TA Map.@TB Entry a) { }";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+            genericLocation = {3, 0}, paramIndex = 0)
+    public String testParam1e() {
+        return "void test(List<java.util.@TA Map.Entry> a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 1, 0}, paramIndex = 0)
+    })
+    public String testParam1f() {
+        return "void test(List<java.util.@TA Map. @TB Entry> a) { }";
+    }
+    */
+
+    @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+           genericLocation = {3, 0}, paramIndex = 0)
+    public String testParam1g() {
+        return "void test(List<java.util.Map. @TB Entry> a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {}, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {1, 0}, paramIndex = 0)
+    })
+    public String testParam2() {
+        return "void test(@TA GOuter<String,String>.@TB GInner<String,String> a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 1, 0}, paramIndex = 0)
+    })
+    public String testParam2b() {
+        return "void test(List<@TA GOuter<String,String>.@TB GInner<String,String>> a) { }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0, 3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TI", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0, 3, 1}, paramIndex = 0),
+        @TADescription(annotation = "TJ", type = METHOD_FORMAL_PARAMETER, paramIndex = 0),
+        @TADescription(annotation = "TK", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {0, 0}, paramIndex = 0)
+    })
+    public String testParam3() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " void test(@TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object> @TJ[] @TK[] a) { }\n" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TD", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TF", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0}, paramIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0}, paramIndex = 0),
+        @TADescription(annotation = "TH", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TI", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 1}, paramIndex = 0),
+        @TADescription(annotation = "TJ", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0}, paramIndex = 0),
+        @TADescription(annotation = "TK", type = METHOD_FORMAL_PARAMETER,
+                genericLocation = {3, 0, 0, 0}, paramIndex = 0)
+    })
+    public String testParam4() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " void test(List<@TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object> @TJ[] @TK[]> a) { }\n" +
+                "}";
+    }
+
+
+    // Local variables
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = LOCAL_VARIABLE,
+                genericLocation = {},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TB", type = LOCAL_VARIABLE,
+                genericLocation = {1, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1})
+    })
+    public String testLocal1a() {
+        return "void test() { @TA Outer.@TB Inner a = null; }";
+    }
+
+    @TADescription(annotation = "TA", type = LOCAL_VARIABLE,
+            genericLocation = {},
+            lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1})
+    public String testLocal1b() {
+        return "void test() { @TA Outer.Inner a = null; }";
+    }
+
+    @TADescription(annotation = "TB", type = LOCAL_VARIABLE,
+            genericLocation = {1, 0},
+            lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1})
+    public String testLocal1c() {
+        return "void test() { Outer.@TB Inner a = null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = LOCAL_VARIABLE,
+                genericLocation = {},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TB", type = LOCAL_VARIABLE,
+                genericLocation = {1, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1})
+    })
+    public String testLocal2() {
+        return "void test() { @TA GOuter<String,String>.@TB GInner<String,String> a = null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0, 0, 0},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TB", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0, 0, 0, 1, 0},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TC", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TD", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TE", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TF", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TG", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TH", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0, 3, 0},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TI", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0, 3, 1},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TJ", type = LOCAL_VARIABLE,
+                genericLocation = {},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TK", type = LOCAL_VARIABLE,
+                genericLocation = {0, 0},
+                lvarOffset = {5}, lvarLength = {1}, lvarIndex = {1})
+    })
+    public String testLocal3() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " void test() { @TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object> @TJ[] @TK[] a = null; }\n" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0, 0, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TB", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TC", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TD", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TE", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TF", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TG", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TH", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TI", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 1},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TJ", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1}),
+        @TADescription(annotation = "TK", type = LOCAL_VARIABLE,
+                genericLocation = {3, 0, 0, 0},
+                lvarOffset = {2}, lvarLength = {1}, lvarIndex = {1})
+    })
+    public String testLocal4() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " void test() { List<@TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object> @TJ[] @TK[]> a = null; }\n" +
+                "}";
+    }
+
+
+    // fields
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD,
+                genericLocation = {}),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = {1, 0})
+    })
+    public String testField1a() {
+        return "@TA Outer.@TB Inner a;";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {})
+    public String testField1b() {
+        return "@TA Outer.Inner a;";
+    }
+
+    @TADescription(annotation = "TB", type = FIELD,
+            genericLocation = {1, 0})
+    public String testField1c() {
+        return "Outer.@TB Inner a;";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD,
+                genericLocation = {}),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = {1, 0})
+    })
+    public String testField2() {
+        return "@TA GOuter<String,String>.@TB GInner<String,String> a;";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD,
+                genericLocation = {0, 0, 0, 0}),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = {0, 0, 0, 0, 1, 0}),
+        @TADescription(annotation = "TC", type = FIELD,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0}),
+        @TADescription(annotation = "TD", type = FIELD,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0}),
+        @TADescription(annotation = "TE", type = FIELD,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = FIELD,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0}),
+        @TADescription(annotation = "TG", type = FIELD,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0}),
+        @TADescription(annotation = "TH", type = FIELD,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0, 3, 0}),
+        @TADescription(annotation = "TI", type = FIELD,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0, 3, 1}),
+        @TADescription(annotation = "TJ", type = FIELD),
+        @TADescription(annotation = "TK", type = FIELD,
+                genericLocation = {0, 0})
+    })
+    public String testField3() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " @TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object> @TJ[] @TK[] a;\n" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD,
+                genericLocation = {3, 0, 0, 0, 0, 0}),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0}),
+        @TADescription(annotation = "TC", type = FIELD,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0}),
+        @TADescription(annotation = "TD", type = FIELD,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0}),
+        @TADescription(annotation = "TE", type = FIELD,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = FIELD,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0}),
+        @TADescription(annotation = "TG", type = FIELD,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0}),
+        @TADescription(annotation = "TH", type = FIELD,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 0}),
+        @TADescription(annotation = "TI", type = FIELD,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 1}),
+        @TADescription(annotation = "TJ", type = FIELD,
+                genericLocation = {3, 0}),
+        @TADescription(annotation = "TK", type = FIELD,
+                genericLocation = {3, 0, 0, 0})
+    })
+    public String testField4() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " List<@TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object> @TJ[] @TK[]> a;\n" +
+                "}";
+    }
+
+
+    // return types
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN,
+                genericLocation = {}),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = {1, 0})
+    })
+    public String testReturn1() {
+        return "@TA Outer.@TB Inner test() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN,
+                genericLocation = {}),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = {1, 0})
+    })
+    public String testReturn2() {
+        return "@TA GOuter<String,String>.@TB GInner<String,String> test() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN,
+                genericLocation = {0, 0, 0, 0}),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = {0, 0, 0, 0, 1, 0}),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0}),
+        @TADescription(annotation = "TD", type = METHOD_RETURN,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0}),
+        @TADescription(annotation = "TE", type = METHOD_RETURN,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = METHOD_RETURN,
+                genericLocation = {0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0}),
+        @TADescription(annotation = "TG", type = METHOD_RETURN,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0}),
+        @TADescription(annotation = "TH", type = METHOD_RETURN,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0, 3, 0}),
+        @TADescription(annotation = "TI", type = METHOD_RETURN,
+                genericLocation = {0, 0, 0, 0, 1, 0, 1, 0, 3, 1}),
+        @TADescription(annotation = "TJ", type = METHOD_RETURN),
+        @TADescription(annotation = "TK", type = METHOD_RETURN,
+                genericLocation = {0, 0})
+    })
+    public String testReturn3() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " @TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object> @TJ[] @TK[] test() { return null; }\n" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0, 0, 0}),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0}),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0}),
+        @TADescription(annotation = "TD", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0}),
+        @TADescription(annotation = "TE", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0}),
+        @TADescription(annotation = "TF", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0}),
+        @TADescription(annotation = "TG", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0}),
+        @TADescription(annotation = "TH", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 0}),
+        @TADescription(annotation = "TI", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 1}),
+        @TADescription(annotation = "TJ", type = METHOD_RETURN,
+                genericLocation = {3, 0}),
+        @TADescription(annotation = "TK", type = METHOD_RETURN,
+                genericLocation = {3, 0, 0, 0})
+    })
+    public String testReturn4() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " List<@TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object> @TJ[] @TK[]> test() { return null; }\n" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_RETURN,
+                genericLocation = {3, 0}),
+        @TADescription(annotation = "TB", type = METHOD_RETURN,
+                genericLocation = {3, 0, 3, 0}),
+        @TADescription(annotation = "TC", type = METHOD_RETURN,
+                genericLocation = {3, 0, 3, 1}),
+        @TADescription(annotation = "TD", type = METHOD_RETURN,
+                genericLocation = {3, 0, 3, 1, 3, 0}),
+        @TADescription(annotation = "TE", type = METHOD_RETURN,
+                genericLocation = {3, 0, 1, 0}),
+        @TADescription(annotation = "TF", type = METHOD_RETURN,
+                genericLocation = {3, 0, 1, 0, 3, 0}),
+        @TADescription(annotation = "TG", type = METHOD_RETURN,
+                genericLocation = {3, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0}),
+        @TADescription(annotation = "TH", type = METHOD_RETURN,
+                genericLocation = {3, 0, 1, 0, 3, 0, 3, 0}),
+        @TADescription(annotation = "TI", type = METHOD_RETURN,
+                genericLocation = {3, 0, 1, 0, 3, 0, 3, 0, 0, 0}),
+        @TADescription(annotation = "TJ", type = METHOD_RETURN,
+                genericLocation = {3, 0, 1, 0, 1, 0}),
+    })
+    public String testReturn5() {
+        return "class GOuter<A, B> {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " List<@TA GOuter<@TB String, @TC List<@TD Object>> . @TE GInner<@TF List<@TG Object @TH[] @TI[]>>. @TJ GInner2<String, String>> test() { return null; }\n" +
+                "}";
+    }
+
+
+    // type parameters
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {}, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0}, paramIndex = 0, boundIndex = 0)
+    })
+    public String testTypeparam1() {
+        return "<X extends @TA Outer.@TB Inner> X test() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {}, paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0}, paramIndex = 0, boundIndex = 0)
+    })
+    public String testTypeparam2() {
+        return "<X extends @TA GOuter<String,String>.@TB GInner<String,String>> X test() { return null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {},
+                paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0},
+                paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0, 3, 0},
+                paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0, 3, 0, 3, 0, 0, 0, 0, 0},
+                paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0, 3, 0, 3, 0},
+                paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0, 3, 0, 3, 0, 0, 0},
+                paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TG", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0, 1, 0},
+                paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TH", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0, 1, 0, 3, 0},
+                paramIndex = 0, boundIndex = 0),
+        @TADescription(annotation = "TI", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {1, 0, 1, 0, 3, 1},
+                paramIndex = 0, boundIndex = 0),
+    })
+    public String testTypeparam3() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " <X extends @TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object>> X test() { return null; }\n" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0, 0, 0},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 0, 0, 0},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TG", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TH", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 0},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TI", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0, 0, 0, 1, 0, 1, 0, 3, 1},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TJ", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0},
+                paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TK", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 0, 0},
+                paramIndex = 0, boundIndex = 1)
+    })
+    public String testTypeparam4() {
+        return "class Outer {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " <X extends List<@TA Outer . @TB GInner<@TC List<@TD Object @TE[] @TF[]>>. @TG GInner2<@TH Integer, @TI Object> @TJ[] @TK[]>> X test() { return null; }\n" +
+                "}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0}, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TB", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 3, 0}, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TC", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 3, 1}, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TD", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 3, 1, 3, 0}, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TE", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 1, 0}, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TF", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 1, 0, 3, 0}, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TG", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 1, 0, 3, 0, 3, 0, 0, 0, 0, 0}, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TH", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 1, 0, 3, 0, 3, 0}, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TI", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 1, 0, 3, 0, 3, 0, 0, 0}, paramIndex = 0, boundIndex = 1),
+        @TADescription(annotation = "TJ", type = METHOD_TYPE_PARAMETER_BOUND,
+                genericLocation = {3, 0, 1, 0, 1, 0}, paramIndex = 0, boundIndex = 1),
+    })
+    public String testTypeparam5() {
+        return "class GOuter<A, B> {\n" +
+                " class GInner<X> {\n" +
+                "  class GInner2<Y, Z> {}\n" +
+                "}}\n\n" +
+                "class Test {\n" +
+                " <X extends List<@TA GOuter<@TB String, @TC List<@TD Object>> . @TE GInner<@TF List<@TG Object @TH[] @TI[]>>. @TJ GInner2<String, String>>> X test() { return null; }\n" +
+                "}";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0, 1, 0})
+    public String testUses1a() {
+        return "class Test { class Inner {}    List<@TA Inner> f; }";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0})
+    public String testUses1b() {
+        return "class Test { class Inner {}    List<@TA Test.Inner> f; }";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0, 1, 0, 1, 0})
+    @TestClass("Test$Inner")
+    public String testUses2a() {
+        return "class Test { class Inner { class Inner2{}    List<@TA Inner2> f; }}";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0, 1, 0})
+    @TestClass("Test$Inner")
+    public String testUses2b() {
+        return "class Test { class Inner { class Inner2{}    List<@TA Inner.Inner2> f; }}";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0, 1, 0, 1, 0})
+    @TestClass("Test$Inner")
+    public String testUses2c() {
+        return "class Test { class Inner { class Inner2{}    List<Inner.@TA Inner2> f; }}";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0})
+    @TestClass("Test$Inner")
+    public String testUses2d() {
+        return "class Test{ class Inner { class Inner2{}    List<@TA Test.Inner.Inner2> f; }}";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0, 1, 0})
+    @TestClass("Test$Inner")
+    public String testUses2e() {
+        return "class Test { class Inner { class Inner2{}    List<Test.@TA Inner.Inner2> f; }}";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0, 1, 0, 1, 0})
+    @TestClass("Test$Inner")
+    public String testUses2f() {
+        return "class Test { class Inner { class Inner2{}    List<Test.Inner.@TA Inner2> f; }}";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0, 1, 0, 1, 0})
+    @TestClass("Test$Inner")
+    public String testUses3a() {
+        return "class Test { class Inner<A, B> { class Inner2<C, D>{}\n" +
+                "    List<Test.Inner.@TA Inner2> f; }}";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0, 1, 0})
+    @TestClass("Test$Inner")
+    public String testUses3b() {
+        return "class Test { class Inner<A, B> { class Inner2<C, D>{}\n" +
+                "    List<Test.@TA Inner.Inner2> f; }}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = FIELD,
+                genericLocation = {}),
+        @TADescription(annotation = "TB", type = FIELD,
+                genericLocation = {3, 0})
+    })
+    public String testUses4() {
+        return "class Test { static class TInner {}\n" +
+                "    @TA TInner f; \n" +
+                "    List<@TB TInner> g; }";
+    }
+
+    @TADescription(annotation = "TA", type = FIELD,
+            genericLocation = {3, 0, 1, 0, 3, 1})
+    @TestClass("Test$Inner")
+    public String testUses3c() {
+        return "class Test { class Inner<A, B> { class Inner2<C, D>{}\n" +
+                "    List<Test.Inner<String, @TA Object>.Inner2<Test, Test>> f; }}";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex=0)
+    public String testFullyQualified1() {
+        return "void testme(java.security.@TA ProtectionDomain protectionDomain) {}";
+    }
+
+    @TADescription(annotation = "TA", type = METHOD_FORMAL_PARAMETER, paramIndex=0,
+            genericLocation = {3, 0})
+    public String testFullyQualified2() {
+        return "void testme(List<java.security.@TA ProtectionDomain> protectionDomain) {}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = LOCAL_VARIABLE,
+                genericLocation = {},
+                lvarOffset = ReferenceInfoUtil.IGNORE_VALUE,
+                lvarLength = ReferenceInfoUtil.IGNORE_VALUE,
+                lvarIndex = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = LOCAL_VARIABLE,
+                genericLocation = {1, 0},
+                lvarOffset = ReferenceInfoUtil.IGNORE_VALUE,
+                lvarLength = ReferenceInfoUtil.IGNORE_VALUE,
+                lvarIndex = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TC", type = LOCAL_VARIABLE,
+                // Only classes count, not methods.
+                genericLocation = {1, 0, 1, 0},
+                lvarOffset = ReferenceInfoUtil.IGNORE_VALUE,
+                lvarLength = ReferenceInfoUtil.IGNORE_VALUE,
+                lvarIndex = ReferenceInfoUtil.IGNORE_VALUE),
+    })
+    @TestClass("Outer$Inner")
+    public String testMethodNesting1() {
+        return "class Outer {\n" +
+                " class Inner {\n" +
+                "  void foo() {\n" +
+                "    class MInner {}\n" +
+                "    @TA Outer . @TB Inner l1 = null;\n" +
+                "    @TC MInner l2 = null;\n" +
+                "  }\n" +
+                "}}\n";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = NEW,
+                genericLocation = {},
+                offset = 0),
+        @TADescription(annotation = "TB", type = NEW,
+                genericLocation = {1, 0},
+                offset = 0),
+        @TADescription(annotation = "TC", type = NEW,
+                // Only classes count, not methods.
+                genericLocation = {1, 0, 1, 0},
+                offset = 12),
+    })
+    @TestClass("Outer$Inner")
+    public String testMethodNesting2() {
+        return "class Outer {\n" +
+                " class Inner {\n" +
+                "  void foo() {\n" +
+                "    class MInner {}\n" +
+                "    Object o1 = new @TA Outer . @TB Inner();" +
+                "    Object o2 = new @TC MInner();\n" +
+                "  }\n" +
+                "}}\n";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for new object creations
+ * @compile -g Driver.java ReferenceInfoUtil.java NewObjects.java
+ * @run main Driver NewObjects
+ */
+public class NewObjects {
+
+    @TADescription(annotation = "TA", type = NEW, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    public String returnObject() {
+        return "Object returnObject() { return new @TA String(); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = NEW, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = NEW,
+                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String returnObjectGeneric() {
+        return "Object returnObjectGeneric() { return new @TA ArrayList<@TB String>(); }";
+    }
+
+    @TADescription(annotation = "TA", type = NEW, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    public String initObject() {
+        return "void initObject() { Object a =  new @TA String(); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = NEW, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = NEW,
+                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TC", type = NEW,
+                genericLocation = { 3, 1 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String initObjectGeneric() {
+        return "void initObjectGeneric() { Object a = new @TA HashMap<@TB String, @TC String>(); }";
+    }
+
+    @TADescription(annotation = "TA", type = NEW, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    public String eqtestObject() {
+        return "void eqtestObject() { if (null == new @TA String()); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = NEW, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = NEW,
+                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String eqtestObjectGeneric() {
+        return "void eqtestObjectGeneric() { if (null == new @TA ArrayList<@TB String >()); }";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/ReferenceInfoUtil.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,332 @@
+/*
+ * Copyright (c) 2009, 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.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.TypeAnnotation;
+import com.sun.tools.classfile.Field;
+import com.sun.tools.classfile.Method;
+import com.sun.tools.classfile.RuntimeTypeAnnotations_attribute;
+import com.sun.tools.classfile.ConstantPool.InvalidIndex;
+import com.sun.tools.classfile.ConstantPool.UnexpectedEntry;
+
+public class ReferenceInfoUtil {
+
+    public static final int IGNORE_VALUE = -321;
+
+    public static List<TypeAnnotation> extendedAnnotationsOf(ClassFile cf) {
+        List<TypeAnnotation> annos = new ArrayList<TypeAnnotation>();
+        findAnnotations(cf, annos);
+        return annos;
+    }
+
+    /////////////////// Extract type annotations //////////////////
+    private static void findAnnotations(ClassFile cf, List<TypeAnnotation> annos) {
+        findAnnotations(cf, Attribute.RuntimeVisibleTypeAnnotations, annos);
+        findAnnotations(cf, Attribute.RuntimeInvisibleTypeAnnotations, annos);
+
+        for (Field f : cf.fields) {
+            findAnnotations(cf, f, annos);
+        }
+        for (Method m: cf.methods) {
+            findAnnotations(cf, m, annos);
+        }
+    }
+
+    private static void findAnnotations(ClassFile cf, Method m, List<TypeAnnotation> annos) {
+        findAnnotations(cf, m, Attribute.RuntimeVisibleTypeAnnotations, annos);
+        findAnnotations(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, annos);
+    }
+
+    private static void findAnnotations(ClassFile cf, Field m, List<TypeAnnotation> annos) {
+        findAnnotations(cf, m, Attribute.RuntimeVisibleTypeAnnotations, annos);
+        findAnnotations(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, annos);
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    private static void findAnnotations(ClassFile cf, String name, List<TypeAnnotation> annos) {
+        int index = cf.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = cf.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            annos.addAll(Arrays.asList(tAttr.annotations));
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    private static void findAnnotations(ClassFile cf, Method m, String name, List<TypeAnnotation> annos) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            annos.addAll(Arrays.asList(tAttr.annotations));
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    private static void findAnnotations(ClassFile cf, Field m, String name, List<TypeAnnotation> annos) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            annos.addAll(Arrays.asList(tAttr.annotations));
+        }
+    }
+
+    /////////////////// TA Position Builder ///////////////////////
+    /* TODO: comment out this dead code. Was this unfinished code that was
+     * supposed to be used somewhere? The tests pass without this.
+    private static class TAPositionBuilder {
+        private TypeAnnotation.Position pos = new TypeAnnotation.Position();
+
+        private TAPositionBuilder() { }
+
+        public TypeAnnotation.Position build() { return pos; }
+
+        public static TAPositionBuilder ofType(TypeAnnotation.TargetType type) {
+            TAPositionBuilder builder = new TAPositionBuilder();
+            builder.pos.type = type;
+            return builder;
+        }
+
+        public TAPositionBuilder atOffset(int offset) {
+            switch (pos.type) {
+            // type cast
+            case TYPECAST:
+            // instanceof
+            case INSTANCEOF:
+            // new expression
+            case NEW:
+                pos.offset = offset;
+                break;
+            default:
+                throw new IllegalArgumentException("invalid field for given type: " + pos.type);
+            }
+            return this;
+        }
+
+        public TAPositionBuilder atLocalPosition(int offset, int length, int index) {
+            switch (pos.type) {
+            // local variable
+            case LOCAL_VARIABLE:
+                pos.lvarOffset = new int[] { offset };
+                pos.lvarLength = new int[] { length };
+                pos.lvarIndex  = new int[] { index  };
+                break;
+            default:
+                throw new IllegalArgumentException("invalid field for given type: " + pos.type);
+            }
+            return this;
+        }
+
+        public TAPositionBuilder atParameterIndex(int index) {
+            switch (pos.type) {
+            // type parameters
+            case CLASS_TYPE_PARAMETER:
+            case METHOD_TYPE_PARAMETER:
+            // method parameter
+            case METHOD_FORMAL_PARAMETER:
+                pos.parameter_index = index;
+                break;
+            default:
+                throw new IllegalArgumentException("invalid field for given type: " + pos.type);
+            }
+            return this;
+        }
+
+        public TAPositionBuilder atParamBound(int param, int bound) {
+            switch (pos.type) {
+            // type parameters bounds
+            case CLASS_TYPE_PARAMETER_BOUND:
+            case METHOD_TYPE_PARAMETER_BOUND:
+                pos.parameter_index = param;
+                pos.bound_index = bound;
+                break;
+            default:
+                throw new IllegalArgumentException("invalid field for given type: " + pos.type);
+            }
+            return this;
+        }
+
+        public TAPositionBuilder atWildcardPosition(TypeAnnotation.Position pos) {
+            switch (pos.type) {
+            // wildcards
+            case WILDCARD_BOUND:
+                pos.wildcard_position = pos;
+                break;
+            default:
+                throw new IllegalArgumentException("invalid field for given type: " + pos.type);
+            }
+            return this;
+        }
+
+        public TAPositionBuilder atTypeIndex(int index) {
+            switch (pos.type) {
+            // class extends or implements clauses
+            case CLASS_EXTENDS:
+            // throws
+            case THROWS:
+                pos.type_index = index;
+                break;
+            default:
+                throw new IllegalArgumentException("invalid field for given type: " + pos.type);
+            }
+            return this;
+        }
+
+        public TAPositionBuilder atOffsetWithIndex(int offset, int index) {
+            switch (pos.type) {
+            // method type argument: wasn't specified
+            case NEW_TYPE_ARGUMENT:
+            case METHOD_TYPE_ARGUMENT:
+                pos.offset = offset;
+                pos.type_index = index;
+                break;
+            default:
+                throw new IllegalArgumentException("invalid field for given type: " + pos.type);
+            }
+            return this;
+        }
+
+        public TAPositionBuilder atGenericLocation(Integer ...loc) {
+            pos.location = Arrays.asList(loc);
+            pos.type = pos.type.getGenericComplement();
+            return this;
+        }
+    }*/
+
+    /////////////////////// Equality testing /////////////////////
+    private static boolean areEquals(int a, int b) {
+        return a == b || a == IGNORE_VALUE || b == IGNORE_VALUE;
+    }
+
+    private static boolean areEquals(int[] a, int[] a2) {
+        if (a==a2)
+            return true;
+        if (a==null || a2==null)
+            return false;
+
+        int length = a.length;
+        if (a2.length != length)
+            return false;
+
+        for (int i=0; i<length; i++)
+            if (a[i] != a2[i] && a[i] != IGNORE_VALUE && a2[i] != IGNORE_VALUE)
+                return false;
+
+        return true;
+    }
+
+    public static boolean areEquals(TypeAnnotation.Position p1, TypeAnnotation.Position p2) {
+        if (p1 == p2)
+            return true;
+        if (p1 == null || p2 == null)
+            return false;
+
+        return ((p1.type == p2.type)
+                && (p1.location.equals(p2.location))
+                && areEquals(p1.offset, p2.offset)
+                && areEquals(p1.lvarOffset, p2.lvarOffset)
+                && areEquals(p1.lvarLength, p2.lvarLength)
+                && areEquals(p1.lvarIndex, p2.lvarIndex)
+                && areEquals(p1.bound_index, p2.bound_index)
+                && areEquals(p1.parameter_index, p2.parameter_index)
+                && areEquals(p1.type_index, p2.type_index)
+                && areEquals(p1.exception_index, p2.exception_index));
+    }
+
+    private static TypeAnnotation findAnnotation(String name, List<TypeAnnotation> annotations, ClassFile cf) throws InvalidIndex, UnexpectedEntry {
+        String properName = "L" + name + ";";
+        for (TypeAnnotation anno : annotations) {
+            String actualName = cf.constant_pool.getUTF8Value(anno.annotation.type_index);
+            if (properName.equals(actualName))
+                return anno;
+        }
+        return null;
+    }
+
+    public static boolean compare(Map<String, TypeAnnotation.Position> expectedAnnos,
+            List<TypeAnnotation> actualAnnos, ClassFile cf) throws InvalidIndex, UnexpectedEntry {
+        if (actualAnnos.size() != expectedAnnos.size()) {
+            throw new ComparisionException("Wrong number of annotations",
+                    expectedAnnos,
+                    actualAnnos);
+        }
+
+        for (Map.Entry<String, TypeAnnotation.Position> e : expectedAnnos.entrySet()) {
+            String aName = e.getKey();
+            TypeAnnotation.Position expected = e.getValue();
+            TypeAnnotation actual = findAnnotation(aName, actualAnnos, cf);
+            if (actual == null)
+                throw new ComparisionException("Expected annotation not found: " + aName);
+
+            // TODO: you currently get an exception if the test case does not use all necessary
+            // annotation attributes, e.g. forgetting the offset for a local variable.
+            // It would be nicer to give an understandable warning instead.
+            if (!areEquals(expected, actual.position)) {
+                throw new ComparisionException("Unexpected position for annotation : " + aName +
+                        "\n  Expected: " + expected.toString() +
+                        "\n  Found: " + actual.position.toString());
+            }
+        }
+        return true;
+    }
+}
+
+class ComparisionException extends RuntimeException {
+    private static final long serialVersionUID = -3930499712333815821L;
+
+    public final Map<String, TypeAnnotation.Position> expected;
+    public final List<TypeAnnotation> found;
+
+    public ComparisionException(String message) {
+        this(message, null, null);
+    }
+
+    public ComparisionException(String message, Map<String, TypeAnnotation.Position> expected, List<TypeAnnotation> found) {
+        super(message);
+        this.expected = expected;
+        this.found = found;
+    }
+
+    public String toString() {
+        String str = super.toString();
+        if (expected != null && found != null) {
+            str += "\n\tExpected: " + expected.size() + " annotations; but found: " + found.size() + " annotations\n" +
+                   "  Expected: " + expected +
+                   "\n  Found: " + found;
+        }
+        return str;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+import static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for repeating type annotations
+ * @compile -g Driver.java ReferenceInfoUtil.java RepeatingTypeAnnotations.java
+ * @run main Driver RepeatingTypeAnnotations
+ * @author Werner Dietl
+ */
+public class RepeatingTypeAnnotations {
+    // Field types
+    @TADescription(annotation = "RTAs", type = FIELD)
+    public String fieldAsPrimitive() {
+        return "@RTA @RTA int test;";
+    }
+
+    // Method returns
+    @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+    public String methodReturn1() {
+        return "@RTA @RTA int test() { return 0; }";
+    }
+
+    @TADescription(annotation = "RTAs", type = METHOD_RETURN)
+    public String methodReturn2() {
+        return "@RTAs({@RTA, @RTA}) int test() { return 0; }";
+    }
+
+    // Method parameters
+    @TADescriptions({
+        @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER,
+                paramIndex = 0),
+        @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+                paramIndex = 0,
+                genericLocation = { 3, 0 })
+    })
+    public String methodParam1() {
+        return "void m(@RTA @RTA List<@RTB @RTB String> p) {}";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "RTAs", type = METHOD_FORMAL_PARAMETER,
+                paramIndex = 0),
+        @TADescription(annotation = "RTBs", type = METHOD_FORMAL_PARAMETER,
+                paramIndex = 0,
+                genericLocation = { 3, 0 })
+    })
+    public String methodParam2() {
+        return "void m(@RTAs({@RTA, @RTA}) List<@RTBs({@RTB, @RTB}) String> p) {}";
+    }
+
+    // TODO: test that all other locations work with repeated type annotations.
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for type casts
+ * @compile -g Driver.java ReferenceInfoUtil.java TypeCasts.java
+ * @run main Driver TypeCasts
+ */
+public class TypeCasts {
+
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
+    public String returnObject() {
+        return "Object returnObject() { return (@TA String)null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TC", type = CAST,
+                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
+    })
+    public String returnObjectArray() {
+        return "Object returnObjectArray() { return (@TC String @TA [] @TB [])null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
+    })
+    public String returnObjectGeneric() {
+        return "Object returnObjectGeneric() { return (@TA List<@TB String>)null; }";
+    }
+
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
+    public String returnPrim() {
+        return "Object returnPrim() { return (@TA int)0; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
+    })
+    public String returnPrimArray() {
+        return "Object returnPrimArray() { return (@TB int @TA [])null; }";
+    }
+
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
+    public String initObject() {
+        return "void initObject() { Object a =  (@TA String)null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
+    })
+    public String initObjectArray() {
+        return "void initObjectArray() { Object a = (@TB String @TA [])null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
+    })
+    public String initObjectGeneric() {
+        return "void initObjectGeneric() { Object a = (@TA List<@TB String>)null; }";
+    }
+
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
+    public String initPrim() {
+        return "void initPrim() { Object a =  (@TA int)0; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
+    })
+    public String initPrimArray() {
+        return "void initPrimArray() { Object a = (@TB int @TA [])null; }";
+    }
+
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
+    public String eqtestObject() {
+        return "void eqtestObject() { if (null == (@TA String)null); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
+    })
+    public String eqtestObjectArray() {
+        return "void eqtestObjectArray() { if (null == (@TB String @TA [])null); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                genericLocation = { 3, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
+    })
+    public String eqtestObjectGeneric() {
+        return "void eqtestObjectGeneric() { if (null == (@TA List<@TB String >)null); }";
+    }
+
+    @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+            typeIndex = 0)
+    // compiler optimizes away compile time constants casts
+    public String eqtestPrim() {
+        return "void eqtestPrim(int a) { if (0 == (@TA int)a); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE,
+                typeIndex = 0)
+    })
+    public String eqtestPrimArray() {
+        return "void eqtestPrimArray() { if (null == (@TB int @TA [])null); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1),
+        @TADescription(annotation = "TC", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1,
+                genericLocation = {3, 0})
+    })
+    public String intersection1() {
+        return "void intersection() { Object o = (@TA String & @TB Comparable<@TC String>) null; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 0),
+        @TADescription(annotation = "TB", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1),
+        @TADescription(annotation = "TC", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 1,
+                genericLocation = {3, 0}),
+        @TADescription(annotation = "TD", type = CAST,
+                offset = ReferenceInfoUtil.IGNORE_VALUE, typeIndex = 2),
+    })
+    public String intersection2() {
+        return "void intersection() { Object o = (@TA String & @TB Comparable<@TC String> & @TD CharSequence) null; }";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2009, 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 static com.sun.tools.classfile.TypeAnnotation.TargetType.*;
+
+/*
+ * @test
+ * @summary Test population of reference info for class literals
+ * @compile -g Driver.java ReferenceInfoUtil.java TypeTests.java
+ * @run main Driver TypeTests
+ */
+public class TypeTests {
+
+    @TADescription(annotation = "TA", type = INSTANCEOF, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    public String returnObject() {
+        return "Object returnObject() { return null instanceof @TA String; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = INSTANCEOF, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = INSTANCEOF,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TC", type = INSTANCEOF,
+                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String returnObjectArray() {
+        return "Object returnObjectArray() { return null instanceof @TC String @TA [] @TB []; }";
+    }
+
+    // no type test for primitives
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = INSTANCEOF, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = INSTANCEOF,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TC", type = INSTANCEOF,
+                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String returnPrimArray() {
+        return "Object returnPrimArray() { return null instanceof @TC int @TA [] @TB []; }";
+    }
+
+    // no void
+    // no void array
+
+    @TADescription(annotation = "TA", type = INSTANCEOF, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    public String initObject() {
+        return "void initObject() { Object a =  null instanceof @TA String; }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = INSTANCEOF, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = INSTANCEOF,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TC", type = INSTANCEOF,
+                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String initObjectArray() {
+        return "void initObjectArray() { Object a = null instanceof @TC String @TA [] @TB []; }";
+    }
+
+    // no primitive instanceof
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = INSTANCEOF, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = INSTANCEOF,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TC", type = INSTANCEOF,
+                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String initPrimArray() {
+        return "void initPrimArray() { Object a = null instanceof @TC int @TA [] @TB []; }";
+    }
+
+    // no void
+    // no void array
+
+    @TADescription(annotation = "TA", type = INSTANCEOF, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    public String eqtestObject() {
+        return "void eqtestObject() { if (true == (null instanceof @TA String)); }";
+    }
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = INSTANCEOF, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = INSTANCEOF,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TC", type = INSTANCEOF,
+                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String eqtestObjectArray() {
+        return "void eqtestObjectArray() { if (true == (null instanceof @TC String @TA [] @TB [])); }";
+    }
+
+    // no primitives
+
+    @TADescriptions({
+        @TADescription(annotation = "TA", type = INSTANCEOF, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TB", type = INSTANCEOF,
+                genericLocation = { 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE),
+        @TADescription(annotation = "TC", type = INSTANCEOF,
+                genericLocation = { 0, 0, 0, 0 }, offset = ReferenceInfoUtil.IGNORE_VALUE)
+    })
+    public String eqtestPrimArray() {
+        return "void eqtestPrimArray() { if (true == (null instanceof @TC int @TA [] @TB [])); }";
+    }
+
+    // no void
+    // no void array
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/api/8007344/Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,229 @@
+/*
+ * Copyright (c) 2010, 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 8007344
+ * @summary javac may not make tree end positions and/or doc comments
+ *          available to processors and listeners
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor
+ * @run main Test
+ */
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Set;
+
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.source.doctree.DocCommentTree;
+import com.sun.source.tree.*;
+import com.sun.source.util.DocTrees;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.SourcePositions;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.TreePathScanner;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.Pretty;
+import com.sun.tools.javac.util.Position;
+
+/** Doc comment: Test */
+public class Test {
+    public static final int EXPECT_DOC_COMMENTS = 3;
+
+    /** Doc comment: main */
+    public static void main(String... args) throws Exception {
+        PrintWriter out = new PrintWriter(System.err);
+        try {
+            new Test(out).run();
+        } finally {
+            out.flush();
+        }
+    }
+
+    PrintWriter out;
+    int errors;
+
+    Test(PrintWriter out) {
+        this.out = out;
+    }
+
+    /** Doc comment: run */
+    void run() throws Exception {
+        File testSrc = new File(System.getProperty("test.src"));
+        File thisFile = new File(testSrc, getClass().getName() + ".java");
+        JavacTool javac = JavacTool.create();
+        StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
+        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
+        Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(thisFile);
+        testAnnoProcessor(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
+        testTaskListener(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    void testAnnoProcessor(JavacTool javac, StandardJavaFileManager fm,
+            Iterable<? extends JavaFileObject> files, PrintWriter out,
+            int expectedDocComments) {
+        out.println("Test annotation processor");
+        JavacTask task = javac.getTask(out, fm, null, null, null, files);
+        AnnoProc ap = new AnnoProc(DocTrees.instance(task));
+        task.setProcessors(Arrays.asList(ap));
+        task.call();
+        ap.checker.checkDocComments(expectedDocComments);
+    }
+
+    void testTaskListener(JavacTool javac, StandardJavaFileManager fm,
+            Iterable<? extends JavaFileObject> files, PrintWriter out,
+            int expectedDocComments) {
+        out.println("Test task listener");
+        JavacTask task = javac.getTask(out, fm, null, null, null, files);
+        TaskListnr tl = new TaskListnr(DocTrees.instance(task));
+        task.addTaskListener(tl);
+        task.call();
+        tl.checker.checkDocComments(expectedDocComments);
+    }
+
+    void error(String msg) {
+        out.println("Error: " + msg);
+        errors++;
+    }
+
+    class AnnoProc extends JavacTestingAbstractProcessor {
+        Checker checker;
+
+        AnnoProc(DocTrees trees) {
+            checker = new Checker(trees);
+        }
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            for (Element e : roundEnv.getRootElements()) {
+                checker.scan(checker.trees.getPath(e), null);
+            }
+            return true;
+        }
+    }
+
+    class TaskListnr implements TaskListener {
+        Checker checker;
+
+        TaskListnr(DocTrees trees) {
+            checker = new Checker(trees);
+        }
+
+        public void started(TaskEvent e) {
+            if (e.getKind() == TaskEvent.Kind.ANALYZE)
+                checker.scan(new TreePath(e.getCompilationUnit()), null);
+        }
+
+        public void finished(TaskEvent e) {
+        }
+    }
+
+    class Checker extends TreePathScanner<Void,Void> {
+        DocTrees trees;
+        SourcePositions srcPosns;
+
+        int docComments = 0;
+
+        Checker(DocTrees trees) {
+            this.trees = trees;
+            srcPosns = trees.getSourcePositions();
+        }
+
+        @Override
+        public Void scan(Tree tree, Void ignore) {
+            if (tree != null) {
+                switch (tree.getKind()) {
+                    // HACK: Workaround 8007350
+                    // Some tree nodes do not have endpos set
+                    case ASSIGNMENT:
+                    case BLOCK:
+                    case IDENTIFIER:
+                    case METHOD_INVOCATION:
+                        break;
+
+                    default:
+                        checkEndPos(getCurrentPath().getCompilationUnit(), tree);
+                }
+            }
+            return super.scan(tree, ignore);
+        }
+
+        @Override
+        public Void visitClass(ClassTree tree, Void ignore) {
+            checkComment();
+            return super.visitClass(tree, ignore);
+        }
+
+        @Override
+        public Void visitMethod(MethodTree tree, Void ignore) {
+            checkComment();
+            return super.visitMethod(tree, ignore);
+        }
+
+        @Override
+        public Void visitVariable(VariableTree tree, Void ignore) {
+            checkComment();
+            return super.visitVariable(tree, ignore);
+        }
+
+        void checkComment() {
+            DocCommentTree dc = trees.getDocCommentTree(getCurrentPath());
+            if (dc != null) {
+                out.println("comment: " + dc.toString().replaceAll("\\s+", " "));
+                docComments++;
+            }
+        }
+
+        void checkEndPos(CompilationUnitTree unit, Tree tree) {
+            long sp = srcPosns.getStartPosition(unit, tree);
+            long ep = srcPosns.getEndPosition(unit, tree);
+            if (sp >= 0 && ep == Position.NOPOS) {
+                error("endpos not set for " + tree.getKind()
+                        + " " + Pretty.toSimpleString(((JCTree) tree))
+                        +", start:" + sp);
+            }
+        }
+
+        void checkDocComments(int expected) {
+            if (docComments != expected) {
+                error("Unexpected number of doc comments received: "
+                        + docComments + ", expected: " + expected);
+            }
+        }
+
+    }
+}
--- a/test/tools/javac/api/EndPositions.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/api/EndPositions.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -28,11 +28,7 @@
  * an annotation processor is present
  */
 
-import com.sun.source.tree.ClassTree;
-import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.tree.Tree;
 import com.sun.source.util.JavacTask;
-import com.sun.source.util.Trees;
 import java.io.IOException;
 import java.net.URI;
 import java.util.Arrays;
@@ -72,16 +68,17 @@
         JavacTask task = (JavacTask)javac.getTask(null, null, diagnostics, options, null, compilationUnits);
         boolean valid = task.call();
         if (valid)
-            throw new AssertionError("Compilation succeeded unexpectedly");
+            throw new AssertionError("Expected one error, but found none.");
 
         List<Diagnostic<? extends JavaFileObject>> errors = diagnostics.getDiagnostics();
         if (errors.size() != 1)
-            throw new AssertionError("Expected one error only, but found " + errors.size() + " errors");
+            throw new AssertionError("Expected one error only, but found " + errors.size() + "; errors: " + errors);
 
         Diagnostic<?> error = errors.get(0);
         if (error.getStartPosition() >= error.getEndPosition())
             throw new AssertionError("Expected start to be less than end position: start [" +
-                    error.getStartPosition() + "], end [" + error.getEndPosition() +"]");
+                    error.getStartPosition() + "], end [" + error.getEndPosition() +"]" +
+                    "; diagnostics code: " + error.getCode());
 
         System.out.println("All is good!");
     }
--- a/test/tools/javac/api/T6306137.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/api/T6306137.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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,10 +25,9 @@
  * @test
  * @bug     6306137
  * @summary JSR 199: encoding option doesn't affect standard file manager
+ * @compile -encoding utf-8 T6306137.java
+ * @run main T6306137
  * @author  Peter von der Ahé
- * @ignore
- *    Need to make the contentCache in JavacFileManager be aware of changes to the encoding.
- *    Need to propogate -source (and -encoding?) down to the JavacFileManager
  */
 
 import java.io.File;
--- a/test/tools/javac/api/TestJavacTaskScanner.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/api/TestJavacTaskScanner.java	Tue Jul 02 10:13:00 2013 +0100
@@ -179,7 +179,6 @@
 
         @Override
         public Scanner newScanner(CharSequence input, boolean keepDocComments) {
-            assert !keepDocComments;
             if (input instanceof CharBuffer) {
                 return new MyScanner(this, (CharBuffer)input, test);
             } else {
@@ -190,7 +189,6 @@
 
         @Override
         public Scanner newScanner(char[] input, int inputLength, boolean keepDocComments) {
-            assert !keepDocComments;
             return new MyScanner(this, input, inputLength, test);
         }
 
--- a/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/cast/intersection/IntersectionTypeCastTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -23,25 +23,32 @@
 
 /*
  * @test
- * @bug 8002099
+ * @bug 8002099 8006694
  * @summary Add support for intersection types in cast expression
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm/timeout=360 IntersectionTypeCastTest
  */
 
-import com.sun.source.util.JavacTask;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.ListBuffer;
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.Arrays;
 import javax.tools.Diagnostic;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
 
-public class IntersectionTypeCastTest {
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
 
-    static int checkCount = 0;
+public class IntersectionTypeCastTest
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     interface Type {
         boolean subtypeOf(Type that);
@@ -59,7 +66,8 @@
         String typeStr;
         InterfaceKind superInterface;
 
-        InterfaceKind(String declStr, String typeStr, InterfaceKind superInterface) {
+        InterfaceKind(String declStr, String typeStr,
+                InterfaceKind superInterface) {
             this.declStr = declStr;
             this.typeStr = typeStr;
             this.superInterface = superInterface;
@@ -67,7 +75,8 @@
 
         @Override
         public boolean subtypeOf(Type that) {
-            return this == that || superInterface == that || that == ClassKind.OBJECT;
+            return this == that || superInterface == that ||
+                   that == ClassKind.OBJECT;
         }
 
         @Override
@@ -88,19 +97,27 @@
 
     enum ClassKind implements Type {
         OBJECT(null, "Object"),
-        CA("#M class CA implements A { }\n", "CA", InterfaceKind.A),
-        CB("#M class CB implements B { }\n", "CB", InterfaceKind.B),
-        CAB("#M class CAB implements A, B { }\n", "CAB", InterfaceKind.A, InterfaceKind.B),
-        CC("#M class CC implements C { }\n", "CC", InterfaceKind.C, InterfaceKind.A),
-        CCA("#M class CCA implements C, A { }\n", "CCA", InterfaceKind.C, InterfaceKind.A),
-        CCB("#M class CCB implements C, B { }\n", "CCB", InterfaceKind.C, InterfaceKind.A, InterfaceKind.B),
-        CCAB("#M class CCAB implements C, A, B { }\n", "CCAB", InterfaceKind.C, InterfaceKind.A, InterfaceKind.B);
+        CA("#M class CA implements A { }\n", "CA",
+           InterfaceKind.A),
+        CB("#M class CB implements B { }\n", "CB",
+           InterfaceKind.B),
+        CAB("#M class CAB implements A, B { }\n", "CAB",
+            InterfaceKind.A, InterfaceKind.B),
+        CC("#M class CC implements C { }\n", "CC",
+           InterfaceKind.C, InterfaceKind.A),
+        CCA("#M class CCA implements C, A { }\n", "CCA",
+            InterfaceKind.C, InterfaceKind.A),
+        CCB("#M class CCB implements C, B { }\n", "CCB",
+            InterfaceKind.C, InterfaceKind.A, InterfaceKind.B),
+        CCAB("#M class CCAB implements C, A, B { }\n", "CCAB",
+             InterfaceKind.C, InterfaceKind.A, InterfaceKind.B);
 
         String declTemplate;
         String typeStr;
         List<InterfaceKind> superInterfaces;
 
-        ClassKind(String declTemplate, String typeStr, InterfaceKind... superInterfaces) {
+        ClassKind(String declTemplate, String typeStr,
+                InterfaceKind... superInterfaces) {
             this.declTemplate = declTemplate;
             this.typeStr = typeStr;
             this.superInterfaces = List.from(superInterfaces);
@@ -114,7 +131,8 @@
 
         @Override
         public boolean subtypeOf(Type that) {
-            return this == that || superInterfaces.contains(that) || that == OBJECT;
+            return this == that || superInterfaces.contains(that) ||
+                    that == OBJECT;
         }
 
         @Override
@@ -170,9 +188,11 @@
         }
 
         String getCast() {
-            String temp = kind.castTemplate.replaceAll("#C", types[0].asString());
+            String temp = kind.castTemplate.replaceAll("#C",
+                    types[0].asString());
             for (int i = 0; i < kind.interfaceBounds ; i++) {
-                temp = temp.replace(String.format("#I%d", i), types[i + 1].asString());
+                temp = temp.replace(String.format("#I%d", i),
+                                    types[i + 1].asString());
             }
             return temp;
         }
@@ -195,7 +215,8 @@
                             t1.subtypeOf(t2) ||
                             t2.subtypeOf(t1) ||
                             (t1.isInterface() && t2.isInterface()) || //side-cast (1)
-                            (mod == ModifierKind.NONE && (t1.isInterface() != t2.isInterface())); //side-cast (2)
+                            (mod == ModifierKind.NONE &&
+                            (t1.isInterface() != t2.isInterface())); //side-cast (2)
                     if (!compat) return false;
                 }
             }
@@ -204,18 +225,15 @@
     }
 
     public static void main(String... args) throws Exception {
-        //create default shared JavaCompiler - reused across multiple compilations
-        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
-
         for (ModifierKind mod : ModifierKind.values()) {
             for (CastInfo cast1 : allCastInfo()) {
                 for (CastInfo cast2 : allCastInfo()) {
-                    new IntersectionTypeCastTest(mod, cast1, cast2).run(comp, fm);
+                    pool.execute(
+                        new IntersectionTypeCastTest(mod, cast1, cast2));
                 }
             }
         }
-        System.out.println("Total check executed: " + checkCount);
+        checkAfterExec();
     }
 
     static List<CastInfo> allCastInfo() {
@@ -235,11 +253,14 @@
                         } else {
                             for (InterfaceKind intf2 : InterfaceKind.values()) {
                                 if (kind.interfaceBounds == 2) {
-                                    buf.append(new CastInfo(kind, clazz, intf1, intf2));
+                                    buf.append(
+                                            new CastInfo(kind, clazz, intf1, intf2));
                                     continue;
                                 } else {
                                     for (InterfaceKind intf3 : InterfaceKind.values()) {
-                                        buf.append(new CastInfo(kind, clazz, intf1, intf2, intf3));
+                                        buf.append(
+                                                new CastInfo(kind, clazz, intf1,
+                                                             intf2, intf3));
                                         continue;
                                     }
                                 }
@@ -265,6 +286,21 @@
         this.diagChecker = new DiagnosticChecker();
     }
 
+    @Override
+    public void run() {
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+
+        JavacTask ct = (JavacTask)tool.getTask(null, fm.get(), diagChecker,
+                null, null, Arrays.asList(source));
+        try {
+            ct.analyze();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling the following code:\n" +
+                    source.getCharContent(true));
+        }
+        check();
+    }
+
     class JavaSource extends SimpleJavaFileObject {
 
         String bodyTemplate = "class Test {\n" +
@@ -282,7 +318,8 @@
             for (InterfaceKind ik : InterfaceKind.values()) {
                 source += ik.declStr;
             }
-            source += bodyTemplate.replaceAll("#C1", cast1.getCast()).replaceAll("#C2", cast2.getCast());
+            source += bodyTemplate.replaceAll("#C1", cast1.getCast()).
+                    replaceAll("#C2", cast2.getCast());
         }
 
         @Override
@@ -291,21 +328,11 @@
         }
     }
 
-    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
-                Arrays.asList("-XDallowIntersectionTypes"), null, Arrays.asList(source));
-        try {
-            ct.analyze();
-        } catch (Throwable ex) {
-            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
-        }
-        check();
-    }
+    void check() {
+        checkCount.incrementAndGet();
 
-    void check() {
-        checkCount++;
-
-        boolean errorExpected = cast1.hasDuplicateTypes() || cast2.hasDuplicateTypes();
+        boolean errorExpected = cast1.hasDuplicateTypes() ||
+                cast2.hasDuplicateTypes();
 
         errorExpected |= !cast2.compatibleWith(mod, cast1);
 
@@ -317,7 +344,8 @@
         }
     }
 
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean errorFound;
 
@@ -327,4 +355,5 @@
             }
         }
     }
+
 }
--- a/test/tools/javac/cast/intersection/IntersectionTypeParserTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/cast/intersection/IntersectionTypeParserTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -170,7 +170,7 @@
     void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
         checkCount++;
         JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
-                Arrays.asList("-XDallowIntersectionTypes"), null, Arrays.asList(source));
+                null, null, Arrays.asList(source));
         ct.parse();
         if (diagChecker.errorFound) {
             throw new Error("Unexpected parser error for source:\n" +
--- a/test/tools/javac/cast/intersection/model/Model01.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/cast/intersection/model/Model01.java	Tue Jul 02 10:13:00 2013 +0100
@@ -27,7 +27,7 @@
  * @summary Add support for intersection types in cast expression
  * @library /tools/javac/lib
  * @build JavacTestingAbstractProcessor ModelChecker
- * @compile -XDallowIntersectionTypes -processor ModelChecker Model01.java
+ * @compile -processor ModelChecker Model01.java
  */
 
 import javax.lang.model.element.ElementKind;
--- a/test/tools/javac/constDebug/ConstDebug.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2002, 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 4645152 4785453
- * @summary javac compiler incorrectly inserts <clinit> when -g is specified
- * @author gafter
- *
- * @run shell ConstDebug.sh ConstDebug
- */
-
-public class ConstDebug {
-    public static final long l = 12;
-}
--- a/test/tools/javac/constDebug/ConstDebug.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2009, 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.
-#
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    PS=":"
-    FS="/"
-    ;;
-  CYGWIN* )
-    PS=";" # Platform PS, not Cygwin PS
-    FS="/"
-    ;;
-  Windows* )
-    PS=";"
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-TMP1=OUTPUT.txt
-
-cp "${TESTSRC}${FS}$1.java" .
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -g -d . -classpath .${PS}${TESTSRC} $1.java 2> ${TMP1}
-result=$?
-if [ $result -ne 0 ]; then exit $result; fi
-if "${TESTJAVA}${FS}bin${FS}javap" $1.class | grep clinit; then
-  echo "Failed"
-  exit 1;
-else
-  echo "Passed"
-  exit 0;
-fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/constDebug/ConstDebugTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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 4645152 4785453
+ * @summary javac compiler incorrectly inserts <clinit> when -g is specified
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run compile -g ConstDebugTest.java
+ * @run main ConstDebugTest
+ */
+
+//original test: test/tools/javac/constDebug/ConstDebug.sh
+public class ConstDebugTest {
+
+    public static final long l = 12;
+
+    public static void main(String args[]) throws Exception {
+//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -g -d . -classpath .${PS}${TESTSRC} $1.java 2> ${TMP1}
+//        if "${TESTJAVA}${FS}bin${FS}javap" $1.class | grep clinit; then fail
+        ToolBox.JavaToolArgs javapArgs =
+                new ToolBox.JavaToolArgs().setAllArgs("-v",
+                "-classpath", System.getProperty("test.classes"), "ConstDebugTest.class");
+        if (ToolBox.javap(javapArgs).contains("clinit")) {
+            throw new AssertionError(
+                "javac should not create a <clinit> method for ConstDebugTest class");
+        }
+    }
+
+}
--- a/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java	Tue Jul 02 10:13:00 2013 +0100
@@ -23,7 +23,6 @@
 
 /*
  * @test
- * @ignore awaits for VM support
  * @summary  check that javac does not generate bridge methods for defaults
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/Static01.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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 8005166
+ * @summary Add support for static interface methods
+ *          smoke test for static interface methods
+ * @compile -XDallowStaticInterfaceMethods Static01.java
+ */
+public class Static01 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface I {
+        public static void test() {
+            assertTrue(true);
+        }
+    }
+
+    public static void main(String[] args) {
+        I.test();
+        assertTrue(assertionCount == 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/Static02.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,42 @@
+/*
+ * 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 8005166
+ * @summary Add support for static interface methods
+ *          smoke test for static interface methods
+ * @compile/fail/ref=Static02.out -XDrawDiagnostics -XDallowStaticInterfaceMethods Static02.java
+ */
+class Static02 {
+
+    interface I {
+        public static void test() { }
+    }
+
+    public static void main(String[] args) {
+        I.test(); //ok
+        I i = new I() {};
+        i.test(); //no!
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/Static02.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+Static02.java:40:15: compiler.err.illegal.static.intf.meth.call: Static02.I
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/hiding/InterfaceMethodHidingTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,243 @@
+/*
+ * 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 8005166
+ * @summary Add support for static interface methods
+ *          Smoke test for static interface method hiding
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+
+public class InterfaceMethodHidingTest {
+
+    static int checkCount = 0;
+
+    enum SignatureKind {
+        VOID_INTEGER("void m(Integer s)", "return;"),
+        STRING_INTEGER("String m(Integer s)", "return null;"),
+        VOID_STRING("void m(String s)", "return;"),
+        STRING_STRING("String m(String s)", "return null;");
+
+        String sigStr;
+        String retStr;
+
+        SignatureKind(String sigStr, String retStr) {
+            this.sigStr = sigStr;
+            this.retStr = retStr;
+        }
+
+        boolean overrideEquivalentWith(SignatureKind s2) {
+            switch (this) {
+                case VOID_INTEGER:
+                case STRING_INTEGER:
+                    return s2 == VOID_INTEGER || s2 == STRING_INTEGER;
+                case VOID_STRING:
+                case STRING_STRING:
+                    return s2 == VOID_STRING || s2 == STRING_STRING;
+                default:
+                    throw new AssertionError("bad signature kind");
+            }
+        }
+    }
+
+    enum MethodKind {
+        VIRTUAL("", "#M #S;"),
+        STATIC("static", "#M #S { #BE; #R }"),
+        DEFAULT("default", "#M #S { #BE; #R }");
+
+        String modStr;
+        String methTemplate;
+
+        MethodKind(String modStr, String methTemplate) {
+            this.modStr = modStr;
+            this.methTemplate = methTemplate;
+        }
+
+        boolean inherithed() {
+            return this != STATIC;
+        }
+
+        static boolean overrides(MethodKind mk1, SignatureKind sk1, MethodKind mk2, SignatureKind sk2) {
+            return sk1 == sk2 &&
+                    mk2.inherithed() &&
+                    mk1 != STATIC;
+        }
+
+        String getBody(BodyExpr be, SignatureKind sk) {
+            return methTemplate.replaceAll("#BE", be.bodyExprStr)
+                    .replaceAll("#R", sk.retStr)
+                    .replaceAll("#M", modStr)
+                    .replaceAll("#S", sk.sigStr);
+        }
+    }
+
+    enum BodyExpr {
+        NONE(""),
+        THIS("Object o = this");
+
+        String bodyExprStr;
+
+        BodyExpr(String bodyExprStr) {
+            this.bodyExprStr = bodyExprStr;
+        }
+
+        boolean allowed(MethodKind mk) {
+            return this == NONE ||
+                    mk != MethodKind.STATIC;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (MethodKind mk1 : MethodKind.values()) {
+            for (SignatureKind sk1 : SignatureKind.values()) {
+                for (BodyExpr be1 : BodyExpr.values()) {
+                    for (MethodKind mk2 : MethodKind.values()) {
+                        for (SignatureKind sk2 : SignatureKind.values()) {
+                            for (BodyExpr be2 : BodyExpr.values()) {
+                                for (MethodKind mk3 : MethodKind.values()) {
+                                    for (SignatureKind sk3 : SignatureKind.values()) {
+                                        for (BodyExpr be3 : BodyExpr.values()) {
+                                            new InterfaceMethodHidingTest(mk1, mk2, mk3, sk1, sk2, sk3, be1, be2, be3).run(comp, fm);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    MethodKind mk1, mk2, mk3;
+    SignatureKind sk1, sk2, sk3;
+    BodyExpr be1, be2, be3;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    InterfaceMethodHidingTest(MethodKind mk1, MethodKind mk2, MethodKind mk3,
+            SignatureKind sk1, SignatureKind sk2, SignatureKind sk3, BodyExpr be1, BodyExpr be2, BodyExpr be3) {
+        this.mk1 = mk1;
+        this.mk2 = mk2;
+        this.mk3 = mk3;
+        this.sk1 = sk1;
+        this.sk2 = sk2;
+        this.sk3 = sk3;
+        this.be1 = be1;
+        this.be2 = be2;
+        this.be3 = be3;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "interface Sup {\n" +
+                          "   default void sup() { }\n" +
+                          "}\n" +
+                          "interface A extends Sup {\n" +
+                          "   #M1\n" +
+                          "}\n" +
+                          "interface B extends A, Sup {\n" +
+                          "   #M2\n" +
+                          "}\n" +
+                          "interface C extends B, Sup {\n" +
+                          "   #M3\n" +
+                          "}\n";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replaceAll("#M1", mk1.getBody(be1, sk1))
+                    .replaceAll("#M2", mk2.getBody(be2, sk2))
+                    .replaceAll("#M3", mk3.getBody(be3, sk3));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                Arrays.asList("-XDallowStaticInterfaceMethods"), null, Arrays.asList(source));
+        try {
+            ct.analyze();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when analyzing the following source:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        boolean errorExpected =
+                !be1.allowed(mk1) || !be2.allowed(mk2) || !be3.allowed(mk3);
+
+        if (mk1.inherithed()) {
+            errorExpected |=
+                    sk2.overrideEquivalentWith(sk1) && !MethodKind.overrides(mk2, sk2, mk1, sk1) ||
+                    sk3.overrideEquivalentWith(sk1) && !MethodKind.overrides(mk3, sk3, mk1, sk1);
+        }
+
+        if (mk2.inherithed()) {
+            errorExpected |=
+                    sk3.overrideEquivalentWith(sk2) && !MethodKind.overrides(mk3, sk3, mk2, sk2);
+        }
+
+        checkCount++;
+        if (diagChecker.errorFound != errorExpected) {
+            throw new AssertionError("Problem when compiling source:\n" + source.getCharContent(true) +
+                    "\nfound error: " + diagChecker.errorFound);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/import/StaticImport1.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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 8005166
+ * @summary Add support for static interface methods
+ *          Smoke test for static imports of static interface methods
+ * @compile -XDallowStaticInterfaceMethods StaticImport1.java
+ */
+
+import static pkg.A.*;
+
+class StaticImport1 {
+    void test() {
+        m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/import/StaticImport2.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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 8005166
+ * @summary Add support for static interface methods
+ *          Smoke test for static imports of static interface methods
+ * @compile/fail/ref=StaticImport2.out -XDrawDiagnostics -XDallowStaticInterfaceMethods StaticImport2.java
+ */
+
+import static pkg.B.*;
+
+class StaticImport2 {
+    void test() {
+        m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/import/StaticImport2.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+StaticImport2.java:36:9: compiler.err.cant.resolve.location.args: kindname.method, m, , , (compiler.misc.location: kindname.class, StaticImport2, null)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/import/StaticImport3.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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 8005166
+ * @summary Add support for static interface methods
+ *          Smoke test for static imports of static interface methods
+ * @compile/fail/ref=StaticImport3.out -XDrawDiagnostics -XDallowStaticInterfaceMethods StaticImport3.java
+ */
+
+import static pkg.C.*;
+
+class StaticImport3 {
+    void test() {
+        m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/import/StaticImport3.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+StaticImport3.java:36:9: compiler.err.cant.resolve.location.args: kindname.method, m, , , (compiler.misc.location: kindname.class, StaticImport3, null)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/import/pkg/A.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public interface A {
+    static void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/import/pkg/B.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public interface B extends A { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/defaultMethods/static/import/pkg/C.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+public class C implements A { }
--- a/test/tools/javac/defaultMethods/super/TestDefaultSuperCall.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/defaultMethods/super/TestDefaultSuperCall.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -23,26 +23,30 @@
 
 /*
  * @test
+ * @bug 8006694
  * @summary Automatic test for checking correctness of default super/this resolution
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm TestDefaultSuperCall
  */
 
-import com.sun.source.util.JavacTask;
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Locale;
-import java.util.Map;
 import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
+
+import com.sun.source.util.JavacTask;
 
-public class TestDefaultSuperCall {
-
-    static int checkCount = 0;
+public class TestDefaultSuperCall
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum InterfaceKind {
         DEFAULT("interface A extends B { default void m() { } }"),
@@ -212,7 +216,6 @@
         List<String> elementsWithMethod;
 
         Shape(ElementKind... elements) {
-            System.err.println("elements = " + Arrays.toString(elements));
             enclosingElements = new ArrayList<>();
             enclosingNames = new ArrayList<>();
             elementsWithMethod = new ArrayList<>();
@@ -231,28 +234,26 @@
                     elementsWithMethod.add(prevName);
                 }
                 String element = ek.templateDecl.replaceAll("#N", name);
-                shapeStr = shapeStr == null ? element : shapeStr.replaceAll("#B", element);
+                shapeStr = shapeStr ==
+                        null ? element : shapeStr.replaceAll("#B", element);
                 prevName = name;
             }
         }
 
         String getShape(QualifierKind qk, ExprKind ek) {
             String methName = ek == ExprKind.THIS ? "test" : "m";
-            String call = qk.getQualifier(this) + "." + ek.exprStr + "." + methName + "();";
+            String call = qk.getQualifier(this) + "." +
+                    ek.exprStr + "." + methName + "();";
             return shapeStr.replaceAll("#B", call);
         }
 
         String enclosingAt(int index) {
-            return index < enclosingNames.size() ? enclosingNames.get(index) : "BAD";
+            return index < enclosingNames.size() ?
+                    enclosingNames.get(index) : "BAD";
         }
     }
 
     public static void main(String... args) throws Exception {
-
-        //create default shared JavaCompiler - reused across multiple compilations
-        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
-
         for (InterfaceKind ik : InterfaceKind.values()) {
             for (PruneKind pk : PruneKind.values()) {
                 for (ElementKind ek1 : ElementKind.values()) {
@@ -264,10 +265,14 @@
                             for (ElementKind ek4 : ElementKind.values()) {
                                 if (!ek4.isAllowedEnclosing(ek3, false)) continue;
                                 for (ElementKind ek5 : ElementKind.values()) {
-                                    if (!ek5.isAllowedEnclosing(ek4, false) || ek5.isClassDecl()) continue;
+                                    if (!ek5.isAllowedEnclosing(ek4, false) ||
+                                            ek5.isClassDecl()) continue;
                                     for (QualifierKind qk : QualifierKind.values()) {
                                         for (ExprKind ek : ExprKind.values()) {
-                                            new TestDefaultSuperCall(ik, pk, new Shape(ek1, ek2, ek3, ek4, ek5), qk, ek).run(comp, fm);
+                                            pool.execute(
+                                                    new TestDefaultSuperCall(ik, pk,
+                                                    new Shape(ek1, ek2, ek3,
+                                                    ek4, ek5), qk, ek));
                                         }
                                     }
                                 }
@@ -277,7 +282,8 @@
                 }
             }
         }
-        System.out.println("Total check executed: " + checkCount);
+
+        checkAfterExec();
     }
 
     InterfaceKind ik;
@@ -288,7 +294,8 @@
     JavaSource source;
     DiagnosticChecker diagChecker;
 
-    TestDefaultSuperCall(InterfaceKind ik, PruneKind pk, Shape sh, QualifierKind qk, ExprKind ek) {
+    TestDefaultSuperCall(InterfaceKind ik, PruneKind pk, Shape sh,
+            QualifierKind qk, ExprKind ek) {
         this.ik = ik;
         this.pk = pk;
         this.sh = sh;
@@ -321,13 +328,14 @@
         }
     }
 
-    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+    public void run() {
+        JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), diagChecker,
                 null, null, Arrays.asList(source));
         try {
             ct.analyze();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thrown when analyzing the following source:\n" + source.getCharContent(true));
+            processException(ex);
+            return;
         }
         check();
     }
@@ -370,7 +378,8 @@
 
             int lastIdx = sh.enclosingElements.size() - 1;
             boolean found = lastIdx == -1 ? false :
-                    sh.enclosingElements.get(lastIdx).hasSuper() && qk.allowSuperCall(ik, pk);
+                    sh.enclosingElements.get(lastIdx).hasSuper() &&
+                    qk.allowSuperCall(ik, pk);
 
             errorExpected |= !found;
             if (!found) {
@@ -378,9 +387,10 @@
             }
         }
 
-        checkCount++;
+        checkCount.incrementAndGet();
         if (diagChecker.errorFound != errorExpected) {
-            throw new AssertionError("Problem when compiling source:\n" + source.getCharContent(true) +
+            throw new AssertionError("Problem when compiling source:\n" +
+                    source.getCharContent(true) +
                     "\nenclosingElems: " + sh.enclosingElements +
                     "\nenclosingNames: " + sh.enclosingNames +
                     "\nelementsWithMethod: " + sh.elementsWithMethod +
@@ -392,15 +402,16 @@
         }
     }
 
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean errorFound;
 
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
-                System.err.println(diagnostic.getMessage(Locale.getDefault()));
                 errorFound = true;
             }
         }
     }
+
 }
--- a/test/tools/javac/defaultMethods/syntax/TestDefaultMethodsSyntax.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/defaultMethods/syntax/TestDefaultMethodsSyntax.java	Tue Jul 02 10:13:00 2013 +0100
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7192245
+ * @bug 7192245 8005851 8005166
  * @summary Automatic test for checking set of allowed modifiers on interface methods
  */
 
@@ -54,7 +54,7 @@
         }
 
         List<String> getOptions() {
-            return Arrays.asList("-source", versionString);
+            return Arrays.asList("-XDallowStaticInterfaceMethods", "-source", versionString);
         }
     }
 
@@ -77,32 +77,6 @@
             this.modStr = modStr;
         }
 
-        boolean isAllowed(EnclosingKind ek, ModifierKind otherMod) {
-            if (this == otherMod) return false;
-            switch (this) {
-                case NONE:
-                    return true;
-                case ABSTRACT:
-                    return otherMod != PRIVATE;
-                case NATIVE:
-                    return otherMod != ABSTRACT &&
-                            otherMod != STRICTFP;
-                case FINAL:
-                case STATIC:
-                case SYNCHRONIZED:
-                case STRICTFP:
-                     return otherMod != ABSTRACT;
-                case PUBLIC:
-                    return true;
-                case PROTECTED:
-                    return ek == EnclosingKind.ABSTRACT_CLASS;
-                case DEFAULT:
-                    return otherMod != ABSTRACT;
-                default:
-                    return true;
-            }
-        }
-
         static boolean intersect(ModifierKind mk, ModifierKind... mks) {
             for (ModifierKind mk2 : mks) {
                 if (mk == mk2) return true;
@@ -113,7 +87,7 @@
         static boolean compatible(MethodKind mk, ModifierKind mod1, ModifierKind mod2, EnclosingKind ek) {
             if (intersect(ABSTRACT, mod1, mod2) || intersect(NATIVE, mod1, mod2)) {
                 return mk == MethodKind.NO_BODY;
-            } else if (intersect(DEFAULT, mod1, mod2)) {
+            } else if (intersect(DEFAULT, mod1, mod2) || intersect(STATIC, mod1, mod2)) {
                 return mk == MethodKind.BODY;
             } else {
                 return ek == EnclosingKind.INTERFACE ?
@@ -123,7 +97,6 @@
 
         boolean compatible(EnclosingKind ek) {
             switch (this) {
-                case STATIC:
                 case PRIVATE:
                 case PROTECTED:
                     return ek != EnclosingKind.INTERFACE;
@@ -176,17 +149,17 @@
 
         static Result[][] allowedModifierPairs = {
             /*                     NONE  PUBLIC  PROTECTED  PRIVATE  ABSTRACT  STATIC  NATIVE  SYNCHRONIZED  FINAL  STRICTFP  DEFAULT */
-            /* NONE */           { T   , T    , C        , C       , T       , C     , C     , C           , C    , C       , I   },
-            /* PUBLIC */         { T   , F    , F        , F       , T       , C     , C     , C           , C    , C       , I   },
+            /* NONE */           { T   , T    , C        , C       , T       , T     , C     , C           , C    , C       , I   },
+            /* PUBLIC */         { T   , F    , F        , F       , T       , T     , C     , C           , C    , C       , I   },
             /* PROTECTED */      { C   , F    , F        , F       , C       , C     , C     , C           , C    , C       , F   },
             /* PRIVATE */        { C   , F    , F        , F       , F       , C     , C     , C           , C    , C       , F   },
             /* ABSTRACT */       { T   , T    , C        , F       , F       , F     , F     , F           , F    , F       , F   },
-            /* STATIC */         { C   , C    , C        , C       , F       , F     , C     , C           , C    , C       , F   },
+            /* STATIC */         { T   , T    , C        , C       , F       , F     , C     , C           , C    , T       , F   },
             /* NATIVE */         { C   , C    , C        , C       , F       , C     , F     , C           , C    , F       , F   },
-            /* SYNCHRONIZED */   { C   , C    , C        , C       , F       , C     , C     , F           , C    , C       , I   },
+            /* SYNCHRONIZED */   { C   , C    , C        , C       , F       , C     , C     , F           , C    , C       , F   },
             /* FINAL */          { C   , C    , C        , C       , F       , C     , C     , C           , F    , C       , F   },
-            /* STRICTFP */       { C   , C    , C        , C       , F       , C     , F     , C           , C    , F       , I   },
-            /* DEFAULT */        { I   , I    , F        , F       , F       , F     , F     , I           , F    , I       , F   }};
+            /* STRICTFP */       { C   , C    , C        , C       , F       , T     , F     , C           , C    , F       , I   },
+            /* DEFAULT */        { I   , I    , F        , F       , F       , F     , F     , F           , F    , I       , F   }};
     }
 
     enum MethodKind {
@@ -291,6 +264,9 @@
         errorExpected |= ModifierKind.intersect(ModifierKind.DEFAULT, modk1, modk2) &&
                 vk == VersionKind.PRE_LAMBDA;
 
+        errorExpected |= ModifierKind.intersect(ModifierKind.STATIC, modk1, modk2) &&
+                ek == EnclosingKind.INTERFACE && vk == VersionKind.PRE_LAMBDA;
+
         checkCount++;
         if (diagChecker.errorFound != errorExpected) {
             throw new AssertionError("Problem when compiling source:\n" + source.getCharContent(true) +
--- a/test/tools/javac/diags/CheckResourceKeys.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/CheckResourceKeys.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -200,6 +200,7 @@
 
 
     Set<String> needToInvestigate = new TreeSet<String>(Arrays.asList(
+        "compiler.misc.fatal.err.cant.close.loader",        // Supressed by JSR308
         "compiler.err.cant.read.file",                      // UNUSED
         "compiler.err.illegal.self.ref",                    // UNUSED
         "compiler.err.io.exception",                        // UNUSED
--- a/test/tools/javac/diags/MessageFile.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/MessageFile.java	Tue Jul 02 10:13:00 2013 +0100
@@ -65,7 +65,7 @@
         }
 
         void insertAfter(Line l) {
-            assert prev == null && next == null;
+            assert l.prev == null && l.next == null;
             l.prev = this;
             l.next = next;
             if (next == null)
@@ -82,7 +82,7 @@
         }
 
         void insertBefore(Line l) {
-            assert prev == null && next == null;
+            assert l.prev == null && l.next == null;
             l.prev = prev;
             l.next = this;
             if (prev == null)
--- a/test/tools/javac/diags/MessageInfo.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/MessageInfo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -409,5 +409,3 @@
     }
 
 }
-
-
--- a/test/tools/javac/diags/examples.not-yet.txt	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples.not-yet.txt	Tue Jul 02 10:13:00 2013 +0100
@@ -1,13 +1,14 @@
 compiler.err.already.annotated                          # internal compiler error?
 compiler.err.already.defined.this.unit                  # seems to be masked by compiler.err.duplicate.class
 compiler.err.annotation.value.not.allowable.type        # cannot happen: precluded by complete type-specific tests
+compiler.err.bad.functional.intf.anno                   # seems to be masked by compiler.err.annotation.type.not.applicable
 compiler.err.cant.read.file                             # (apt.JavaCompiler?)
 compiler.err.cant.select.static.class.from.param.type
 compiler.err.dc.unterminated.string                     # cannot happen
 compiler.err.illegal.char.for.encoding
-compiler.err.invalid.containedby.annotation             # should not happen
-compiler.err.invalid.containedby.annotation.invalid.value # "can't" happen
-compiler.err.invalid.containedby.annotation.multiple.values # can't happen
+compiler.err.invalid.repeatable.annotation              # should not happen
+compiler.err.invalid.repeatable.annotation.invalid.value # "can't" happen
+compiler.err.invalid.repeatable.annotation.multiple.values # can't happen
 compiler.err.io.exception                               # (javah.JavahTask?)
 compiler.err.limit.code                                 # Code
 compiler.err.limit.code.too.large.for.try.stmt          # Gen
@@ -47,6 +48,7 @@
 compiler.misc.bad.enclosing.method                      # bad class file
 compiler.misc.bad.runtime.invisible.param.annotations   # bad class file
 compiler.misc.bad.signature                             # bad class file
+compiler.misc.bad.type.annotation.value
 compiler.misc.base.membership                           # UNUSED
 compiler.misc.ccf.found.later.version
 compiler.misc.ccf.unrecognized.attribute
@@ -58,6 +60,7 @@
 compiler.misc.fatal.err.cant.close	                # JavaCompiler
 compiler.misc.file.does.not.contain.package
 compiler.misc.illegal.start.of.class.file
+compiler.misc.inferred.do.not.conform.to.lower.bounds   # cannot happen?
 compiler.misc.kindname.annotation
 compiler.misc.kindname.enum
 compiler.misc.kindname.package
@@ -67,6 +70,7 @@
 compiler.misc.kindname.value
 compiler.misc.incompatible.eq.lower.bounds              # cannot happen?
 compiler.misc.no.unique.minimal.instance.exists
+compiler.misc.no.unique.maximal.instance.exists         # cannot happen?
 compiler.misc.resume.abort                              # prompt for a response
 compiler.misc.source.unavailable                        # DiagnosticSource
 compiler.misc.token.bad-symbol
@@ -106,4 +110,5 @@
 compiler.warn.unexpected.archive.file                   # Paths: zip file with unknown extn
 compiler.warn.unknown.enum.constant                     # in bad class file
 compiler.warn.unknown.enum.constant.reason              # in bad class file
+compiler.warn.override.equals.but.not.hashcode          # when a class overrides equals but not hashCode method from Object
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/BadFunctionalIntfAnno.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.bad.functional.intf.anno.1
+// key: compiler.misc.not.a.functional.intf
+
+@FunctionalInterface
+class BadFunctionalIntfAnno { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/CantAnnotateNestedType.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.annotate.nested.type
+
+import java.lang.annotation.*;
+
+class CantAnnotateStaticClass {
+    @Target(ElementType.TYPE_USE)
+    @interface A {}
+
+    interface Outer {
+        interface Inner {}
+    }
+
+    // Error:
+    @A Outer.Inner f;
+
+    // OK:
+    @A Outer g;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/CantAnnotateStaticClass.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.annotate.static.class
+
+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;
+}
--- a/test/tools/javac/diags/examples/CantApplyDiamond1.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/CantApplyDiamond1.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 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
@@ -23,7 +23,7 @@
 
 // key: compiler.err.prob.found.req
 // key: compiler.misc.cant.apply.diamond.1
-// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
+// key: compiler.misc.incompatible.eq.upper.bounds
 // key: compiler.misc.diamond
 
 class CantApplyDiamond1<X> {
--- a/test/tools/javac/diags/examples/ContainedByDocumentedMismatch.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.not.documented
-
-import java.lang.annotation.*;
-
-@Documented
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); }
-
-@Anno
-@Anno
-class ContainedByDocumentedMismatch { }
--- a/test/tools/javac/diags/examples/ContainedByInheritedMismatch.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.not.inherited
-
-import java.lang.annotation.*;
-
-@Inherited
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); }
-
-@Anno
-@Anno
-class ContainedByInheritedMismatch { }
--- a/test/tools/javac/diags/examples/ContainedByNoValue.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.no.value
-
-import java.lang.annotation.*;
-
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos {}
-
-@Anno
-@Anno
-class ContainedByNoValue { }
--- a/test/tools/javac/diags/examples/ContainedByNonDefault.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.elem.nondefault
-
-import java.lang.annotation.*;
-
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); String foo(); }
-
-class ContainedByNonDefault { }
--- a/test/tools/javac/diags/examples/ContainedByRetentionMismatch.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.retention
-
-import java.lang.annotation.*;
-
-@Retention(RetentionPolicy.RUNTIME)
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); }
-
-@Anno
-@Anno
-class ContainedByRetentionMismatch { }
--- a/test/tools/javac/diags/examples/ContainedByTargetMismatch.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.incompatible.target
-
-import java.lang.annotation.*;
-
-@ContainedBy(Annos.class)
-@Target(ElementType.METHOD)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { Anno[] value(); }
-
-class ContainedByTargetMismatch { }
--- a/test/tools/javac/diags/examples/ContainedByWrongValueType.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.invalid.containedby.annotation.value.return
-
-import java.lang.annotation.*;
-
-@ContainedBy(Annos.class)
-@interface Anno { }
-
-@ContainerFor(Anno.class)
-@interface Annos { String value(); }
-
-@Anno
-@Anno
-class ContainedByWrongValueType { }
--- a/test/tools/javac/diags/examples/CyclicInference.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/CyclicInference.java	Tue Jul 02 10:13:00 2013 +0100
@@ -21,7 +21,7 @@
  * questions.
  */
 
-// key: compiler.err.cant.apply.symbol
+// key: compiler.err.prob.found.req
 // key: compiler.misc.cyclic.inference
 
 class CyclicInference {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/IllegalStaticIntfMethCall.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.illegal.static.intf.meth.call
+// options: -XDallowStaticInterfaceMethods
+
+class IllegalStaticIntfMethCall {
+    interface A {
+        static void m() { }
+    }
+    void test(A a) {
+        a.m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/IncompatibleArgTypesInMethodRef.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.cant.apply.symbol
+// key: compiler.misc.infer.no.conforming.assignment.exists
+// key: compiler.misc.incompatible.arg.types.in.mref
+
+class IncompatibleArgTypesInMethodRef {
+    interface SAM<X> {
+        void m(X x);
+    }
+
+    void g(String s, Integer i) { }
+
+    <Z> void m(SAM<Z> s) { }
+
+    void test() {
+        m(this::g);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/IncorrectReceiverType.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.incorrect.receiver.type
+
+class IncorrectReceiverType {
+    void m(Object this) {}
+}
--- a/test/tools/javac/diags/examples/InferredDoNotConformToEq.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/InferredDoNotConformToEq.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 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
@@ -23,6 +23,7 @@
 
 // key: compiler.err.cant.apply.symbol
 // key: compiler.misc.inferred.do.not.conform.to.eq.bounds
+// options: -source 7 -Xlint:-options
 
 import java.util.*;
 
--- a/test/tools/javac/diags/examples/InferredDoNotConformToLower.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.prob.found.req
-// key: compiler.misc.inferred.do.not.conform.to.lower.bounds
-
-import java.util.*;
-
-class InferredDoNotConformToLower {
-    <X extends Number> List<X> m() { return null; }
-    { List<? super String> lss = this.m(); }
-}
--- a/test/tools/javac/diags/examples/InferredDoNotConformToUpper.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/InferredDoNotConformToUpper.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 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
@@ -23,6 +23,7 @@
 
 // key: compiler.err.cant.apply.symbol
 // key: compiler.misc.inferred.do.not.conform.to.upper.bounds
+// options: -source 7 -Xlint:-options
 
 import java.util.*;
 
--- a/test/tools/javac/diags/examples/InvalidDuplicateAnnotation.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/InvalidDuplicateAnnotation.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -22,17 +22,16 @@
  */
 
 // key: compiler.err.duplicate.annotation.invalid.repeated
-// key: compiler.err.invalid.containedby.annotation.elem.nondefault
-//
+// key: compiler.err.invalid.repeatable.annotation.elem.nondefault
+
 // We need an almost valid containing annotation. The easiest way to get
 // one close enough to valid is by forgetting a default.
 
 import java.lang.annotation.*;
 
-@ContainedBy(Annos.class)
+@Repeatable(Annos.class)
 @interface Anno { }
 
-@ContainerFor(Anno.class)
 @interface Annos { Anno[] value(); String foo(); }
 
 @Anno
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/NoAnnotationsOnDotClass.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,31 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.no.annotations.on.dot.class
+
+class NoAnnotationsOnDotClass {
+    @Target(ElementType.TYPE_USE)
+    @interface A {}
+
+    Object o = @A Object.class;
+}
--- a/test/tools/javac/diags/examples/NoUniqueMaximalInstance.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.prob.found.req
-// key: compiler.misc.no.unique.maximal.instance.exists
-
-class NoUniqueMaximalInstance {
-    <Z extends Integer> Z m() { return null; }
-
-    { String s = m(); }
-}
--- a/test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java	Tue Jul 02 10:13:00 2013 +0100
@@ -21,9 +21,8 @@
  * questions.
  */
 
-// key: compiler.err.prob.found.req
 // key: compiler.misc.non-static.cant.be.ref
-// key: compiler.misc.invalid.mref
+// key: compiler.err.invalid.mref
 
 class NonStaticCantBeRefFragment {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/NotDefPublicCantAccessFragment/NotDefPublicCantAccessFragment.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.prob.found.req
+// key: compiler.misc.invalid.mref
+// key: compiler.misc.not.def.public.cant.access
+
+class NotDefPublicCantAccessFragment {
+    interface SAM {
+        void m();
+    }
+
+    void test (p.C c) {
+        SAM s = c::m;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/NotDefPublicCantAccessFragment/p/C.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+/*
+ * 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 p;
+
+public class C {
+    void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/NotInProfile.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.not.in.profile
+// options: -profile compact1
+
+class NotInProfile {
+    Class<?> c = java.awt.Frame.class;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/RepeatableDocumentedMismatch.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.not.documented
+
+import java.lang.annotation.*;
+
+@Documented
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); }
+
+@Anno
+@Anno
+class RepeatableDocumentedMismatch { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/RepeatableInheritedMismatch.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.not.inherited
+
+import java.lang.annotation.*;
+
+@Inherited
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); }
+
+@Anno
+@Anno
+class RepeatableInheritedMismatch { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/RepeatableNoValue.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.no.value
+
+import java.lang.annotation.*;
+
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos {}
+
+@Anno
+@Anno
+class RepeatableNoValue { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/RepeatableNonDefault.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,33 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.elem.nondefault
+
+import java.lang.annotation.*;
+
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); String foo(); }
+
+class RepeatableNonDefault { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/RepeatableRetentionMismatch.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.retention
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); }
+
+@Anno
+@Anno
+class RepeatableRetentionMismatch { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/RepeatableTargetMismatch.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.incompatible.target
+
+import java.lang.annotation.*;
+
+@Repeatable(Annos.class)
+@Target(ElementType.METHOD)
+@interface Anno { }
+
+@interface Annos { Anno[] value(); }
+
+class RepeatableTargetMismatch { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/RepeatableWrongValueType.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.invalid.repeatable.annotation.value.return
+
+import java.lang.annotation.*;
+
+@Repeatable(Annos.class)
+@interface Anno { }
+
+@interface Annos { String value(); }
+
+@Anno
+@Anno
+class RepeatableWrongValueType { }
--- a/test/tools/javac/diags/examples/RepeatingAnnotationAndContainer.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/RepeatingAnnotationAndContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -21,14 +21,13 @@
  * questions.
  */
 
-// key: compiler.err.invalid.containedby.annotation.repeated.and.container.present
+// key: compiler.err.invalid.repeatable.annotation.repeated.and.container.present
 
 import java.lang.annotation.*;
 
-@ContainedBy(Annos.class)
+@Repeatable(Annos.class)
 @interface Anno { }
 
-@ContainerFor(Anno.class)
 @interface Annos { Anno[] value(); }
 
 @Anno
--- a/test/tools/javac/diags/examples/SecondaryBoundMustBeMarkerIntf.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/SecondaryBoundMustBeMarkerIntf.java	Tue Jul 02 10:13:00 2013 +0100
@@ -23,7 +23,6 @@
 
 // key: compiler.err.prob.found.req
 // key: compiler.misc.secondary.bound.must.be.marker.intf
-// options: -XDallowIntersectionTypes
 
 class SecondaryBoundMustBeMarkerInterface {
     Runnable r = (Runnable & Comparable<?>)()->{};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/StaticIntfMethodNotSupported.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.static.intf.methods.not.supported.in.source
+// options: -source 7 -Xlint:-options -XDallowStaticInterfaceMethods
+
+interface StaticIntfMethodNotSupported {
+    static void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/StaticMethodInUnboundLookup.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.invalid.mref
+// key: compiler.misc.static.method.in.unbound.lookup
+
+class StaticBoundMref {
+
+    interface SAM {
+        void m(StaticBoundMref m);
+    }
+
+    SAM s = StaticBoundMref::m;
+
+    static void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/ThisAsIdentifier.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.this.as.identifier
+
+class ThisAsIdentifier {
+    Object this;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/TypeAnnotationsNotSupported.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 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.
+ */
+
+// key: compiler.err.type.annotations.not.supported.in.source
+// key: compiler.warn.source.no.bootclasspath
+// options: -source 6
+
+@interface Anno { }
+
+class TypeAnnotationsNotSupported {
+    void m() {
+        int i = (@Anno int) 3.14;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/UnderscoreAsIdentifier.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+// key: compiler.warn.underscore.as.identifier
+
+class UnderscoreAsIdentifier {
+    String _ = null;
+}
--- a/test/tools/javac/diags/examples/WhereFreshTvar.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/WhereFreshTvar.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 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
@@ -24,7 +24,7 @@
 // key: compiler.misc.where.fresh.typevar
 // key: compiler.misc.where.description.typevar
 // key: compiler.err.prob.found.req
-// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
+// key: compiler.misc.inconvertible.types
 // options: -XDdiags=where,simpleNames
 // run: simple
 
@@ -33,5 +33,5 @@
 class WhereFreshTvar {
     <T extends List<T>> T m() {}
 
-    { List<String> ls = m(); }
+    { Object o = (List<String>)m(); }
 }
--- a/test/tools/javac/diags/examples/WhereIntersection.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/diags/examples/WhereIntersection.java	Tue Jul 02 10:13:00 2013 +0100
@@ -25,7 +25,7 @@
 // key: compiler.misc.where.description.intersection
 // key: compiler.misc.intersection.type
 // key: compiler.err.prob.found.req
-// key: compiler.misc.inconvertible.types
+// key: compiler.misc.inferred.do.not.conform.to.upper.bounds
 // options: -XDdiags=where
 // run: simple
 
--- a/test/tools/javac/diags/examples/WrongContainedBy.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.invalid.container.no.containerfor
-// key: compiler.err.invalid.container.wrong.containedby
-
-import java.lang.annotation.*;
-
-@ContainerFor(WrongContainedBy.class)
-@interface Foos {
-    WrongContainedBy[] value();
-}
-
-@ContainedBy(Target.class)
-public @interface WrongContainedBy {}
--- a/test/tools/javac/diags/examples/WrongContainerFor.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.invalid.container.wrong.containerfor
-// key: compiler.err.invalid.container.no.containedby
-
-import java.lang.annotation.*;
-
-@ContainerFor(Retention.class)
-@interface Foos {
-    WrongContainerFor[] value();
-}
-
-@ContainedBy(Foos.class)
-public @interface WrongContainerFor {}
--- a/test/tools/javac/failover/CheckAttributedTree.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/failover/CheckAttributedTree.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,7 +21,19 @@
  * questions.
  */
 
-import com.sun.source.util.TaskEvent;
+/*
+ * @test
+ * @bug 6970584 8006694
+ * @summary assorted position errors in compiler syntax trees
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm CheckAttributedTree -q -r -et ERRONEOUS .
+ */
+
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Dimension;
@@ -34,6 +46,20 @@
 import java.awt.event.ActionListener;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.lang.model.element.Element;
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.JComboBox;
 import javax.swing.JComponent;
@@ -49,23 +75,14 @@
 import javax.swing.text.BadLocationException;
 import javax.swing.text.DefaultHighlighter;
 import javax.swing.text.Highlighter;
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
 import javax.tools.Diagnostic;
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
 
 import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.TaskEvent;
 import com.sun.source.util.JavacTask;
 import com.sun.source.util.TaskListener;
-import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.tree.EndPosTable;
@@ -76,11 +93,6 @@
 import com.sun.tools.javac.tree.TreeScanner;
 import com.sun.tools.javac.util.Pair;
 
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-import javax.lang.model.element.Element;
-
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
 /**
@@ -95,13 +107,7 @@
  * covering any new language features that may be tested in this test suite.
  */
 
-/*
- * @test
- * @bug 6970584
- * @summary assorted position errors in compiler syntax trees
- * @run main CheckAttributedTree -q -r -et ERRONEOUS .
- */
-public class CheckAttributedTree {
+public class CheckAttributedTree extends JavacTestingAbstractThreadedTest {
     /**
      * Main entry point.
      * If test.src is set, program runs in jtreg mode, and will throw an Error
@@ -110,9 +116,10 @@
      * args is the value of ${test.src}. In jtreg mode, the -r option can be
      * given to change the default base directory to the root test directory.
      */
-    public static void main(String... args) {
+    public static void main(String... args) throws Exception {
         String testSrc = System.getProperty("test.src");
         File baseDir = (testSrc == null) ? null : new File(testSrc);
+        throwAssertionOnError = false;
         boolean ok = new CheckAttributedTree().run(baseDir, args);
         if (!ok) {
             if (testSrc != null)  // jtreg mode
@@ -130,7 +137,7 @@
      * @param args command line args
      * @return true if successful or in gui mode
      */
-    boolean run(File baseDir, String... args) {
+    boolean run(File baseDir, String... args) throws Exception {
         if (args.length == 0) {
             usage(System.out);
             return true;
@@ -145,8 +152,10 @@
                 gui = true;
             else if (arg.equals("-q"))
                 quiet = true;
-            else if (arg.equals("-v"))
+            else if (arg.equals("-v")) {
                 verbose = true;
+                printAll = true;
+            }
             else if (arg.equals("-t") && i + 1 < args.length)
                 tags.add(args[++i]);
             else if (arg.equals("-ef") && i + 1 < args.length)
@@ -179,12 +188,11 @@
                 error("File not found: " + file);
         }
 
-        if (fileCount != 1)
-            System.err.println(fileCount + " files read");
-        if (errors > 0)
-            System.err.println(errors + " errors");
+        if (fileCount.get() != 1)
+            errWriter.println(fileCount + " files read");
+        checkAfterExec(false);
 
-        return (gui || errors == 0);
+        return (gui || errCount.get() == 0);
     }
 
     /**
@@ -215,7 +223,7 @@
      * for java files.
      * @param file the file or directory to test
      */
-    void test(File file) {
+    void test(final File file) {
         if (excludeFiles.contains(file)) {
             if (!quiet)
                 error("File " + file + " excluded");
@@ -230,20 +238,24 @@
         }
 
         if (file.isFile() && file.getName().endsWith(".java")) {
-            try {
-                if (verbose)
-                    System.err.println(file);
-                fileCount++;
-                NPETester p = new NPETester();
-                p.test(read(file));
-            } catch (AttributionException e) {
-                if (!quiet) {
-                    error("Error attributing " + file + "\n" + e.getMessage());
+            pool.execute(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        if (verbose)
+                            errWriter.println(file);
+                        fileCount.incrementAndGet();
+                        NPETester p = new NPETester();
+                        p.test(read(file));
+                    } catch (AttributionException e) {
+                        if (!quiet) {
+                            error("Error attributing " + file + "\n" + e.getMessage());
+                        }
+                    } catch (IOException e) {
+                        error("Error reading " + file + ": " + e);
+                    }
                 }
-            } catch (IOException e) {
-                error("Error reading " + file + ": " + e);
-            }
-            return;
+            });
         }
 
         if (!quiet)
@@ -254,8 +266,6 @@
     StringWriter sw = new StringWriter();
     PrintWriter pw = new PrintWriter(sw);
     Reporter r = new Reporter(pw);
-    JavacTool tool = JavacTool.create();
-    StandardJavaFileManager fm = tool.getStandardFileManager(r, null, null);
 
     /**
      * Read a file.
@@ -265,11 +275,10 @@
      * @throws TreePosTest.ParseException if any errors occur while parsing the file
      */
     List<Pair<JCCompilationUnit, JCTree>> read(File file) throws IOException, AttributionException {
-        JavacTool tool = JavacTool.create();
         r.errors = 0;
-        Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(file);
+        Iterable<? extends JavaFileObject> files = fm.get().getJavaFileObjects(file);
         String[] opts = { "-XDshouldStopPolicy=ATTR", "-XDverboseCompilePolicy" };
-        JavacTask task = tool.getTask(pw, fm, r, Arrays.asList(opts), null, files);
+        JavacTask task = (JavacTask)comp.getTask(pw, fm.get(), r, Arrays.asList(opts), null, files);
         final List<Element> analyzedElems = new ArrayList<>();
         task.setTaskListener(new TaskListener() {
             public void started(TaskEvent e) {
@@ -308,13 +317,9 @@
      */
     void error(String msg) {
         System.err.println(msg);
-        errors++;
+        errCount.incrementAndGet();
     }
 
-    /** Number of files that have been analyzed. */
-    int fileCount;
-    /** Number of errors reported. */
-    int errors;
     /** Flag: don't report irrelevant files. */
     boolean quiet;
     /** Flag: show errors in GUI viewer. */
@@ -357,11 +362,18 @@
             }
 
             Info self = new Info(tree, endPosTable);
-            check(!mandatoryType(tree) ||
-                    (tree.type != null &&
-                    checkFields(tree)),
-                    "'null' found in tree ",
-                    self);
+            if (mandatoryType(tree)) {
+                check(tree.type != null,
+                        "'null' field 'type' found in tree ", self);
+                if (tree.type==null)
+                    new Throwable().printStackTrace();
+            }
+
+            Field errField = checkFields(tree);
+            if (errField!=null) {
+                check(false,
+                        "'null' field '" + errField.getName() + "' found in tree ", self);
+            }
 
             Info prevEncl = encl;
             encl = self;
@@ -385,11 +397,12 @@
                         viewer = new Viewer();
                     viewer.addEntry(sourcefile, label, encl, self);
                 }
-                error(label + self.toString() + " encl: " + encl.toString() + " in file: " + sourcefile + "  " + self.tree);
+                error(label + self.toString() + " encl: " + encl.toString() +
+                        " in file: " + sourcefile + "  " + self.tree);
             }
         }
 
-        boolean checkFields(JCTree t) {
+        Field checkFields(JCTree t) {
             List<Field> fieldsToCheck = treeUtil.getFieldsOfType(t,
                     excludedFields,
                     Symbol.class,
@@ -397,7 +410,7 @@
             for (Field f : fieldsToCheck) {
                 try {
                     if (f.get(t) == null) {
-                        return false;
+                        return f;
                     }
                 }
                 catch (IllegalAccessException e) {
@@ -405,7 +418,7 @@
                     //swallow it
                 }
             }
-            return true;
+            return null;
         }
 
         @Override
@@ -503,7 +516,7 @@
         }
 
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
-            out.println(diagnostic);
+            //out.println(diagnostic);
             switch (diagnostic.getKind()) {
                 case ERROR:
                     errors++;
@@ -754,4 +767,8 @@
             final Info self;
         }
     }
+
+    /** Number of files that have been analyzed. */
+    static AtomicInteger fileCount = new AtomicInteger();
+
 }
--- a/test/tools/javac/fatalErrors/NoJavaLang.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 1999, 2002, 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 4263768 4785453
- * @summary Verify that the compiler does not crash when java.lang is not
- * found.
- * @author iag
- *
- * @run shell NoJavaLang.sh
- */
-
-public class NoJavaLang {
-    private String s;
-
-    public String s() {
-        return s;
-    }
-}
--- a/test/tools/javac/fatalErrors/NoJavaLang.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Fatal Error: Unable to find package java.lang in classpath or bootclasspath
--- a/test/tools/javac/fatalErrors/NoJavaLang.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 1999, 2009, 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.
-#
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-printf '%s' "TESTSRC=${TESTSRC}" ; echo
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-printf '%s' "TESTJAVA=${TESTJAVA}" ; echo
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-printf '%s' "TESTCLASSES=${TESTCLASSES}" ; echo
-printf '%s' "CLASSPATH=${CLASSPATH}" ; echo
-echo
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    FS="/"
-    ;;
-  CYGWIN* )
-    FS="/"
-    DIFFOPTS="--strip-trailing-cr"
-    ;;
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-TMP1=OUTPUT.txt
-
-cp "${TESTSRC}${FS}NoJavaLang.java" .
-
-echo "- verifing that fatal error is not produced in the regular case" 
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} NoJavaLang.java 2> "${TMP1}"
-result=$?
-
-if [ $result -eq 0 ]
-then
-  echo "Passed - base compilation successful"
-else
-  echo "Failed - unable to compile test"
-  exit $result
-fi
-
-echo
-
-echo "- verifing the fatal error is produced"
-rm "${TMP1}"
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -bootclasspath . NoJavaLang.java 2> "${TMP1}"
-
-# return code should be EXIT_SYSERR
-result=$?
-if [ $result -ne 3 ]
-then
-  echo "Failed - unexpected return code"
-  exit $result
-else
-  echo "Passed - expected return code"
-fi
-
-# expected message
-cat "${TMP1}"
-diff ${DIFFOPTS} -c "${TESTSRC}${FS}NoJavaLang.out" "${TMP1}"
-result=$?
-rm "${TMP1}"
-
-if [ $result -eq 0 ]
-then
-  echo "Passed - expected message"
-else
-  echo "Failed - unexpected message"
-  exit $result
-
-fi
-
-exit
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/fatalErrors/NoJavaLangTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,76 @@
+/*
+ * 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 4263768 4785453
+ * @summary Verify that the compiler does not crash when java.lang is not
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main NoJavaLangTest
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+//original test: test/tools/javac/fatalErrors/NoJavaLang.sh
+public class NoJavaLangTest {
+
+    private static final String noJavaLangSrc =
+        "public class NoJavaLang {\n" +
+        "    private String s;\n" +
+        "\n" +
+        "    public String s() {\n" +
+        "        return s;\n" +
+        "    }\n" +
+        "}";
+
+    private static final String compilerErrorMessage =
+        "Fatal Error: Unable to find package java.lang in classpath or bootclasspath";
+
+    public static void main(String[] args) throws Exception {
+//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} NoJavaLang.java 2> "${TMP1}"
+        ToolBox.JavaToolArgs javacSuccessArgs =
+                new ToolBox.JavaToolArgs().setSources(noJavaLangSrc);
+        ToolBox.javac(javacSuccessArgs);
+
+//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -bootclasspath . NoJavaLang.java 2> "${TMP1}"
+        List<String> output = new ArrayList<>();
+        ToolBox.JavaToolArgs javacFailArgs =
+                new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
+                .setOptions("-bootclasspath", ".")
+                .setSources(noJavaLangSrc)
+                .setErrOutput(output);
+
+        int cr = ToolBox.javac(javacFailArgs);
+        if (cr != 3) {
+            throw new AssertionError("Compiler exit result should be 3");
+        }
+
+//        diff ${DIFFOPTS} -c "${TESTSRC}${FS}NoJavaLang.out" "${TMP1}"
+        if (!(output.size() == 1 && output.get(0).equals(compilerErrorMessage))) {
+            throw new AssertionError("javac generated error output is not correct");
+        }
+    }
+
+}
--- a/test/tools/javac/generics/7015430/T7015430.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/7015430/T7015430.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,14 +1,14 @@
-T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
+T7015430.java:41:15: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
 T7015430.java:41:14: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
 T7015430.java:50:42: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
 T7015430.java:50:41: compiler.warn.unchecked.meth.invocation.applied: kindname.method, empty, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
-T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
+T7015430.java:68:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
 T7015430.java:68:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
 T7015430.java:77:40: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
 T7015430.java:77:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
 T7015430.java:104:41: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.RuntimeException>
 T7015430.java:104:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
-T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<E>
+T7015430.java:113:22: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.lang.Iterable, java.lang.Iterable<java.lang.Exception>
 T7015430.java:113:9: compiler.warn.unchecked.meth.invocation.applied: kindname.constructor, <init>, java.lang.Iterable<E>, java.lang.Iterable, kindname.class, T7015430
 T7015430.java:41:14: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
 T7015430.java:68:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception
--- a/test/tools/javac/generics/7151802/T7151802.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/7151802/T7151802.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 T7151802.java:14:31: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get1, Z, T7151802.Foo, kindname.class, T7151802
-T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<Z>
+T7151802.java:22:31: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.Object>
 T7151802.java:22:30: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get3, T7151802.Foo<Z>, T7151802.Foo, kindname.class, T7151802
 T7151802.java:30:36: compiler.warn.unchecked.meth.invocation.applied: kindname.method, get5, compiler.misc.no.args, compiler.misc.no.args, kindname.class, T7151802
 T7151802.java:38:32: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7151802.Foo, T7151802.Foo<java.lang.String>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/6939780/T6939780.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6939780 7020044 8009459
+ *
+ * @summary  add a warning to detect diamond sites
+ * @author mcimadamore
+ * @compile/ref=T6939780_7.out -Xlint:-options -source 7 T6939780.java -XDrawDiagnostics -XDfindDiamond
+ * @compile/ref=T6939780_8.out T6939780.java -XDrawDiagnostics -XDfindDiamond
+ *
+ */
+
+class T6939780 {
+
+    static class Foo<X extends Number> {
+        Foo() {}
+        Foo(X x) {}
+    }
+
+    void testAssign() {
+        Foo<Number> f1 = new Foo<Number>(1);
+        Foo<?> f2 = new Foo<Number>();
+        Foo<?> f3 = new Foo<Integer>();
+        Foo<Number> f4 = new Foo<Number>(1) {};
+        Foo<?> f5 = new Foo<Number>() {};
+        Foo<?> f6 = new Foo<Integer>() {};
+    }
+
+    void testMethod() {
+        gn(new Foo<Number>(1));
+        gw(new Foo<Number>());
+        gw(new Foo<Integer>());
+        gn(new Foo<Number>(1) {});
+        gw(new Foo<Number>() {});
+        gw(new Foo<Integer>() {});
+    }
+
+    void gw(Foo<?> fw) { }
+    void gn(Foo<Number> fn) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/6939780/T6939780_7.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,4 @@
+T6939780.java:21:28: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
+T6939780.java:22:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
+T6939780.java:30:19: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
+3 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/6939780/T6939780_8.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,7 @@
+T6939780.java:20:33: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
+T6939780.java:21:28: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
+T6939780.java:22:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
+T6939780.java:29:19: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
+T6939780.java:30:19: compiler.warn.diamond.redundant.args: T6939780.Foo<java.lang.Number>, T6939780.Foo<java.lang.Number>
+T6939780.java:31:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo<java.lang.Integer>, T6939780.Foo<java.lang.Number>
+6 warnings
--- a/test/tools/javac/generics/diamond/7046778/DiamondAndInnerClassTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/diamond/7046778/DiamondAndInnerClassTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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,23 +23,27 @@
 
 /*
  * @test
- * @bug 7046778
+ * @bug 7046778 8006694
  * @summary Project Coin: problem with diamond and member inner classes
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm DiamondAndInnerClassTest
  */
 
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import com.sun.source.util.JavacTask;
 import java.net.URI;
 import java.util.Arrays;
 import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
 
-public class DiamondAndInnerClassTest {
-
-    static int checkCount = 0;
+public class DiamondAndInnerClassTest
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum TypeArgumentKind {
         NONE(""),
@@ -151,11 +155,6 @@
     }
 
     public static void main(String... args) throws Exception {
-
-        //create default shared JavaCompiler - reused across multiple compilations
-        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
-
         for (InnerClassDeclArity innerClassDeclArity : InnerClassDeclArity.values()) {
             for (TypeQualifierArity declType : TypeQualifierArity.values()) {
                 if (!declType.matches(innerClassDeclArity)) continue;
@@ -168,53 +167,79 @@
                             //no diamond on decl site
                             if (taDecl1 == TypeArgumentKind.DIAMOND) continue;
                             for (TypeArgumentKind taSite1 : TypeArgumentKind.values()) {
-                                boolean isSiteRaw = taSite1 == TypeArgumentKind.NONE;
+                                boolean isSiteRaw =
+                                        taSite1 == TypeArgumentKind.NONE;
                                 //diamond only allowed on the last type qualifier
                                 if (taSite1 == TypeArgumentKind.DIAMOND &&
-                                        innerClassDeclArity != InnerClassDeclArity.ONE) continue;
+                                        innerClassDeclArity !=
+                                        InnerClassDeclArity.ONE)
+                                    continue;
                                 for (ArgumentKind arg1 : ArgumentKind.values()) {
                                     if (innerClassDeclArity == innerClassDeclArity.ONE) {
-                                        new DiamondAndInnerClassTest(innerClassDeclArity, declType, newClassType,
-                                                argList, new TypeArgumentKind[] {taDecl1},
-                                                new TypeArgumentKind[] {taSite1}, new ArgumentKind[] {arg1}).run(comp, fm);
+                                        pool.execute(
+                                                new DiamondAndInnerClassTest(
+                                                innerClassDeclArity, declType,
+                                                newClassType, argList,
+                                                new TypeArgumentKind[] {taDecl1},
+                                                new TypeArgumentKind[] {taSite1},
+                                                new ArgumentKind[] {arg1}));
                                         continue;
                                     }
                                     for (TypeArgumentKind taDecl2 : TypeArgumentKind.values()) {
                                         //no rare types
-                                        if (isDeclRaw != (taDecl2 == TypeArgumentKind.NONE)) continue;
+                                        if (isDeclRaw != (taDecl2 == TypeArgumentKind.NONE))
+                                            continue;
                                         //no diamond on decl site
-                                        if (taDecl2 == TypeArgumentKind.DIAMOND) continue;
+                                        if (taDecl2 == TypeArgumentKind.DIAMOND)
+                                            continue;
                                         for (TypeArgumentKind taSite2 : TypeArgumentKind.values()) {
                                             //no rare types
-                                            if (isSiteRaw != (taSite2 == TypeArgumentKind.NONE)) continue;
+                                            if (isSiteRaw != (taSite2 == TypeArgumentKind.NONE))
+                                                continue;
                                             //diamond only allowed on the last type qualifier
                                             if (taSite2 == TypeArgumentKind.DIAMOND &&
-                                                    innerClassDeclArity != InnerClassDeclArity.TWO) continue;
+                                                    innerClassDeclArity != InnerClassDeclArity.TWO)
+                                                continue;
                                             for (ArgumentKind arg2 : ArgumentKind.values()) {
                                                 if (innerClassDeclArity == innerClassDeclArity.TWO) {
-                                                    new DiamondAndInnerClassTest(innerClassDeclArity, declType, newClassType,
-                                                            argList, new TypeArgumentKind[] {taDecl1, taDecl2},
+                                                    pool.execute(
+                                                            new DiamondAndInnerClassTest(
+                                                            innerClassDeclArity,
+                                                            declType,
+                                                            newClassType,
+                                                            argList,
+                                                            new TypeArgumentKind[] {taDecl1, taDecl2},
                                                             new TypeArgumentKind[] {taSite1, taSite2},
-                                                            new ArgumentKind[] {arg1, arg2}).run(comp, fm);
+                                                            new ArgumentKind[] {arg1, arg2}));
                                                     continue;
                                                 }
                                                 for (TypeArgumentKind taDecl3 : TypeArgumentKind.values()) {
                                                     //no rare types
-                                                    if (isDeclRaw != (taDecl3 == TypeArgumentKind.NONE)) continue;
+                                                    if (isDeclRaw != (taDecl3 == TypeArgumentKind.NONE))
+                                                        continue;
                                                     //no diamond on decl site
-                                                    if (taDecl3 == TypeArgumentKind.DIAMOND) continue;
+                                                    if (taDecl3 == TypeArgumentKind.DIAMOND)
+                                                        continue;
                                                     for (TypeArgumentKind taSite3 : TypeArgumentKind.values()) {
                                                         //no rare types
-                                                        if (isSiteRaw != (taSite3 == TypeArgumentKind.NONE)) continue;
+                                                        if (isSiteRaw != (taSite3 == TypeArgumentKind.NONE))
+                                                            continue;
                                                         //diamond only allowed on the last type qualifier
                                                         if (taSite3 == TypeArgumentKind.DIAMOND &&
-                                                                innerClassDeclArity != InnerClassDeclArity.THREE) continue;
+                                                            innerClassDeclArity != InnerClassDeclArity.THREE)
+                                                            continue;
                                                         for (ArgumentKind arg3 : ArgumentKind.values()) {
-                                                            if (innerClassDeclArity == innerClassDeclArity.THREE) {
-                                                                new DiamondAndInnerClassTest(innerClassDeclArity, declType, newClassType,
-                                                                        argList, new TypeArgumentKind[] {taDecl1, taDecl2, taDecl3},
+                                                            if (innerClassDeclArity ==
+                                                                    innerClassDeclArity.THREE) {
+                                                                pool.execute(
+                                                                        new DiamondAndInnerClassTest(
+                                                                        innerClassDeclArity,
+                                                                        declType,
+                                                                        newClassType,
+                                                                        argList,
+                                                                        new TypeArgumentKind[] {taDecl1, taDecl2, taDecl3},
                                                                         new TypeArgumentKind[] {taSite1, taSite2, taSite3},
-                                                                        new ArgumentKind[] {arg1, arg2, arg3}).run(comp, fm);
+                                                                        new ArgumentKind[] {arg1, arg2, arg3}));
                                                                 continue;
                                                             }
                                                         }
@@ -230,7 +255,8 @@
                 }
             }
         }
-        System.out.println("Total check executed: " + checkCount);
+
+        checkAfterExec();
     }
 
     InnerClassDeclArity innerClassDeclArity;
@@ -244,9 +270,9 @@
     DiagnosticChecker diagChecker;
 
     DiamondAndInnerClassTest(InnerClassDeclArity innerClassDeclArity,
-            TypeQualifierArity declType, TypeQualifierArity siteType, ArgumentListArity argList,
-            TypeArgumentKind[] declTypeArgumentKinds, TypeArgumentKind[] siteTypeArgumentKinds,
-            ArgumentKind[] argumentKinds) {
+            TypeQualifierArity declType, TypeQualifierArity siteType,
+            ArgumentListArity argList, TypeArgumentKind[] declTypeArgumentKinds,
+            TypeArgumentKind[] siteTypeArgumentKinds, ArgumentKind[] argumentKinds) {
         this.innerClassDeclArity = innerClassDeclArity;
         this.declType = declType;
         this.siteType = siteType;
@@ -267,9 +293,9 @@
         public JavaSource() {
             super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
             source = innerClassDeclArity.classDeclStr.replace("#B", bodyTemplate)
-                             .replace("#D", declType.getType(declTypeArgumentKinds))
-                             .replace("#S", siteType.getType(siteTypeArgumentKinds))
-                             .replace("#AL", argList.getArgs(argumentKinds));
+                    .replace("#D", declType.getType(declTypeArgumentKinds))
+                    .replace("#S", siteType.getType(siteTypeArgumentKinds))
+                    .replace("#AL", argList.getArgs(argumentKinds));
         }
 
         @Override
@@ -278,36 +304,39 @@
         }
     }
 
-    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+    @Override
+    public void run() {
+        JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), diagChecker,
                 null, null, Arrays.asList(source));
         try {
             ct.analyze();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
+            throw new AssertionError("Error thrown when compiling the following code:\n" +
+                    source.getCharContent(true));
         }
         check();
     }
 
     void check() {
-        checkCount++;
+        checkCount.incrementAndGet();
 
         boolean errorExpected = false;
 
-        TypeArgumentKind[] expectedArgKinds = new TypeArgumentKind[innerClassDeclArity.n];
+        TypeArgumentKind[] expectedArgKinds =
+                new TypeArgumentKind[innerClassDeclArity.n];
 
         for (int i = 0 ; i < innerClassDeclArity.n ; i++) {
             if (!declTypeArgumentKinds[i].compatible(siteTypeArgumentKinds[i])) {
                 errorExpected = true;
                 break;
             }
-            expectedArgKinds[i] = siteTypeArgumentKinds[i] == TypeArgumentKind.DIAMOND ?
+            expectedArgKinds[i] = siteTypeArgumentKinds[i] ==
+                    TypeArgumentKind.DIAMOND ?
                 declTypeArgumentKinds[i] : siteTypeArgumentKinds[i];
         }
 
         if (!errorExpected) {
             for (int i = 0 ; i < innerClassDeclArity.n ; i++) {
-                //System.out.println("check " + expectedArgKinds[i] + " against " + argumentKinds[i]);
                 if (!expectedArgKinds[i].compatible(argumentKinds[i])) {
                     errorExpected = true;
                     break;
@@ -323,7 +352,8 @@
         }
     }
 
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean errorFound;
 
@@ -333,4 +363,5 @@
             }
         }
     }
+
 }
--- a/test/tools/javac/generics/diamond/T6939780.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 6939780 7020044
- *
- * @summary  add a warning to detect diamond sites
- * @author mcimadamore
- * @compile/ref=T6939780.out T6939780.java -XDrawDiagnostics -XDfindDiamond
- *
- */
-
-class T6939780 {
-
-    void test() {
-        class Foo<X extends Number> {
-            Foo() {}
-            Foo(X x) {}
-        }
-        Foo<Number> f1 = new Foo<Number>(1);
-        Foo<?> f2 = new Foo<Number>();
-        Foo<?> f3 = new Foo<Integer>();
-        Foo<Number> f4 = new Foo<Number>(1) {};
-        Foo<?> f5 = new Foo<Number>() {};
-        Foo<?> f6 = new Foo<Integer>() {};
-    }
-}
--- a/test/tools/javac/generics/diamond/T6939780.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-T6939780.java:19:28: compiler.warn.diamond.redundant.args: Foo<java.lang.Number>, Foo<java.lang.Number>
-T6939780.java:20:28: compiler.warn.diamond.redundant.args.1: Foo<java.lang.Integer>, Foo<java.lang.Number>
-2 warnings
--- a/test/tools/javac/generics/diamond/neg/Neg05.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg05.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,25 +1,25 @@
 Neg05.java:19:48: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:19:35: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>)
 Neg05.java:20:58: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:20:45: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>)
 Neg05.java:21:43: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:21:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>)
 Neg05.java:22:56: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:22:43: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>)
 Neg05.java:24:48: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:24:35: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>)
 Neg05.java:25:58: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:25:45: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>)
 Neg05.java:26:43: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:26:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>)
 Neg05.java:27:56: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:27:43: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>)
 Neg05.java:31:37: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:31:44: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo<V>, Neg05<?>.Foo<java.lang.String>))
 Neg05.java:32:47: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:32:54: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo<V>, Neg05<?>.Foo<? extends java.lang.String>))
 Neg05.java:33:32: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:33:39: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo<V>, Neg05<?>.Foo<?>))
 Neg05.java:34:45: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:34:52: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo<V>, Neg05<?>.Foo<? super java.lang.String>))
 Neg05.java:36:37: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:36:44: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo<V>, Neg05<?>.Foo<java.lang.String>))
 Neg05.java:37:47: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:37:54: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo<V>, Neg05<?>.Foo<? extends java.lang.String>))
 Neg05.java:38:32: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:38:39: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo<V>, Neg05<?>.Foo<?>))
 Neg05.java:39:45: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:39:52: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo<V>, Neg05<?>.Foo<? super java.lang.String>))
 24 errors
--- a/test/tools/javac/generics/diamond/neg/Neg06.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg06.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))
+Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))
 1 error
--- a/test/tools/javac/generics/diamond/neg/Neg10.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg10.java	Tue Jul 02 10:13:00 2013 +0100
@@ -4,7 +4,8 @@
  *
  * @summary  Check that 'complex' diamond can infer type that is too specific
  * @author mcimadamore
- * @compile/fail/ref=Neg10.out Neg10.java -XDrawDiagnostics
+ * @compile/fail/ref=Neg10.out -source 7 -Xlint:-options Neg10.java -XDrawDiagnostics
+ * @compile Neg10.java -XDrawDiagnostics
  *
  */
 
--- a/test/tools/javac/generics/diamond/neg/Neg10.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/diamond/neg/Neg10.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-Neg10.java:16:22: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg10.Foo<java.lang.Integer>, Neg10.Foo<java.lang.Number>)
+Neg10.java:17:22: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: Neg10.Foo<java.lang.Integer>, Neg10.Foo<java.lang.Number>)
 1 error
--- a/test/tools/javac/generics/inference/6278587/T6278587Neg.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/6278587/T6278587Neg.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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,10 +23,11 @@
 
 /*
  * @test
- * @bug     6278587
+ * @bug     6278587 8007464
  * @summary Inference broken for subtypes of subtypes of F-bounded types
  * @author  Peter von der Ah\u00e9
- * @compile/fail T6278587Neg.java
+ * @compile/fail -source 7 T6278587Neg.java
+ * @compile T6278587Neg.java
  */
 
 public abstract class T6278587Neg {
--- a/test/tools/javac/generics/inference/6315770/T6315770.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/6315770/T6315770.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,3 @@
-T6315770.java:16:42: compiler.err.prob.found.req: (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable)
-T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer&java.lang.Runnable, java.lang.String)
+T6315770.java:16:42: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.bounds: T, java.lang.String,java.lang.Integer,java.lang.Runnable)
+T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Integer,java.lang.Runnable)
 2 errors
--- a/test/tools/javac/generics/inference/6638712/T6638712b.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/6638712/T6638712b.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-T6638712b.java:14:21: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.String,java.lang.Object)
+T6638712b.java:14:21: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: T, java.lang.Integer, java.lang.String,java.lang.Object)
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712d.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/6638712/T6638712d.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.String, java.lang.Integer)
+T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.incompatible.eq.lower.bounds: U, java.lang.String, java.lang.Integer)
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712e.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/6638712/T6638712e.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Boolean,java.lang.Object)
+T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Boolean,java.lang.Object)
 1 error
--- a/test/tools/javac/generics/inference/6650759/T6650759m.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/6650759/T6650759m.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-T6650759m.java:43:36: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.lower.bounds: java.lang.Integer, java.lang.String)
+T6650759m.java:43:36: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Integer,java.lang.Object)
 1 error
--- a/test/tools/javac/generics/inference/7154127/T7154127.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/7154127/T7154127.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,8 +1,9 @@
 /**
  * @test /nodynamiccopyright/
- * @bug 7154127
+ * @bug 7154127 8007464
  * @summary Inference cleanup: remove bound check analysis from visitors in Types.java
- * @compile/fail/ref=T7154127.out -XDrawDiagnostics T7154127.java
+ * @compile/fail/ref=T7154127.out -Xlint:-options -source 7 -XDrawDiagnostics T7154127.java
+ * @compile T7154127.java
  */
 class T7154127 {
 
--- a/test/tools/javac/generics/inference/7154127/T7154127.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/7154127/T7154127.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-T7154127.java:19:49: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: Y, T7154127.D,T7154127.B<U>)
+T7154127.java:20:49: compiler.err.prob.found.req: (compiler.misc.incompatible.upper.bounds: Y, T7154127.B<U>,T7154127.D)
 1 error
--- a/test/tools/javac/generics/inference/7177306/T7177306a.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/7177306/T7177306a.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,4 +1,4 @@
-T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<E>
+T7177306a.java:13:34: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), java.util.List, java.util.List<java.lang.Object>
 T7177306a.java:13:33: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, java.util.List<E>, java.util.List, kindname.class, T7177306a
 T7177306a.java:13:33: compiler.warn.prob.found.req: (compiler.misc.unchecked.assign), T7177306a, T7177306a<java.lang.Object>
 - compiler.err.warnings.and.werror
--- a/test/tools/javac/generics/inference/7177306/T7177306e.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/7177306/T7177306e.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,8 +1,9 @@
 /**
  * @test /nodynamiccopyright/
- * @bug 7177306
+ * @bug 7177306 8007464
  * @summary Regression: unchecked method call does not erase return type
- * @compile/fail/ref=T7177306e.out -XDrawDiagnostics T7177306e.java
+ * @compile/fail/ref=T7177306e.out -source 7 -Xlint:-options -XDrawDiagnostics T7177306e.java
+ * @compile/fail T7177306e.java
  */
 
 import java.util.List;
--- a/test/tools/javac/generics/inference/7177306/T7177306e.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/inference/7177306/T7177306e.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-T7177306e.java:15:9: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<?>, java.util.List<compiler.misc.type.captureof: 1, ?>)
+T7177306e.java:16:9: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.util.List<?>, java.util.List<compiler.misc.type.captureof: 1, ?>)
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/8006692/T8006692.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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 8006692
+ * @summary jdk/test/java/util/Collections/BigBinarySearch.java fails to compile
+ * @compile T8006692.java
+ */
+
+import java.util.*;
+
+class Test {
+    static void test(List<Integer> l, int i) {
+        equal(i, Collections.binarySearch(l, l.get(i)));
+    }
+    static void equal(Object x, Object y) {}
+}
--- a/test/tools/javac/generics/odersky/BadTest4.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/odersky/BadTest4.java	Tue Jul 02 10:13:00 2013 +0100
@@ -23,11 +23,12 @@
 
 /*
  * @test
- * @ bug
+ * @bug 8007464
  * @summary Negative regression test from odersky
  * @author odersky
  *
- * @compile/fail  BadTest4.java
+ * @compile/fail -source 7 BadTest4.java
+ * @compile BadTest4.java
  */
 
 class BadTest4 {
--- a/test/tools/javac/generics/rawOverride/7062745/GenericOverrideTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/generics/rawOverride/7062745/GenericOverrideTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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,23 +23,28 @@
 
 /*
  * @test
- * @bug 7062745
- * @summary  Regression: difference in overload resolution when two methods are maximally specific
+ * @bug 7062745 8006694
+ * @summary  Regression: difference in overload resolution when two methods
+ *  are maximally specific
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm GenericOverrideTest
  */
 
-import com.sun.source.util.JavacTask;
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.Arrays;
 import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
+import com.sun.source.util.JavacTask;
 
-public class GenericOverrideTest {
-
-    static int checkCount = 0;
+public class GenericOverrideTest
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum SignatureKind {
         NON_GENERIC(""),
@@ -126,11 +131,6 @@
     }
 
     public static void main(String... args) throws Exception {
-
-        //create default shared JavaCompiler - reused across multiple compilations
-        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
-
         for (SignatureKind sig1 : SignatureKind.values()) {
             for (ReturnTypeKind rt1 : ReturnTypeKind.values()) {
                 for (TypeArgumentKind ta1 : TypeArgumentKind.values()) {
@@ -141,8 +141,12 @@
                                 if (!ta2.compatibleWith(sig2)) continue;
                                 for (ReturnTypeKind rt3 : ReturnTypeKind.values()) {
                                     for (TypeArgumentKind ta3 : TypeArgumentKind.values()) {
-                                        if (!ta3.compatibleWith(SignatureKind.NON_GENERIC)) continue;
-                                        new GenericOverrideTest(sig1, rt1, ta1, sig2, rt2, ta2, rt3, ta3).run(comp, fm);
+                                        if (!ta3.compatibleWith(SignatureKind.NON_GENERIC))
+                                            continue;
+                                        pool.execute(
+                                                new GenericOverrideTest(sig1,
+                                                rt1, ta1, sig2, rt2,
+                                                ta2, rt3, ta3));
                                     }
                                 }
                             }
@@ -151,7 +155,8 @@
                 }
             }
         }
-        System.out.println("Total check executed: " + checkCount);
+
+        checkAfterExec();
     }
 
     SignatureKind sig1, sig2;
@@ -161,7 +166,8 @@
     DiagnosticChecker diagChecker;
 
     GenericOverrideTest(SignatureKind sig1, ReturnTypeKind rt1, TypeArgumentKind ta1,
-            SignatureKind sig2, ReturnTypeKind rt2, TypeArgumentKind ta2, ReturnTypeKind rt3, TypeArgumentKind ta3) {
+            SignatureKind sig2, ReturnTypeKind rt2, TypeArgumentKind ta2,
+            ReturnTypeKind rt3, TypeArgumentKind ta3) {
         this.sig1 = sig1;
         this.sig2 = sig2;
         this.rt1 = rt1;
@@ -204,19 +210,21 @@
         }
     }
 
-    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+    @Override
+    public void run() {
+        JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), diagChecker,
                 null, null, Arrays.asList(source));
         try {
             ct.analyze();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
+            throw new AssertionError("Error thrown when compiling the following code:\n" +
+                    source.getCharContent(true));
         }
         check();
     }
 
     void check() {
-        checkCount++;
+        checkCount.incrementAndGet();
 
         boolean errorExpected = false;
         int mostSpecific = 0;
@@ -234,14 +242,17 @@
         //check that either TA1 <= TA2 or TA2 <= TA1 (unless most specific return found above is raw)
         if (!errorExpected) {
             if (ta1 != ta2) {
-                boolean useStrictCheck = ta1.moreSpecificThan(ta2, true) || ta2.moreSpecificThan(ta1, true);
+                boolean useStrictCheck = ta1.moreSpecificThan(ta2, true) ||
+                        ta2.moreSpecificThan(ta1, true);
                 if (!ta1.moreSpecificThan(ta2, useStrictCheck) &&
                         !ta2.moreSpecificThan(ta1, useStrictCheck)) {
                     errorExpected = true;
                 } else {
                     int mostSpecific2 = ta1.moreSpecificThan(ta2, useStrictCheck) ? 1 : 2;
                     if (mostSpecific != 0 && mostSpecific2 != mostSpecific) {
-                        errorExpected = mostSpecific == 1 ? ta1 != TypeArgumentKind.NONE : ta2 != TypeArgumentKind.NONE;
+                        errorExpected = mostSpecific == 1 ?
+                                ta1 != TypeArgumentKind.NONE :
+                                ta2 != TypeArgumentKind.NONE;
                     } else {
                         mostSpecific = mostSpecific2;
                     }
@@ -273,7 +284,8 @@
         }
     }
 
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean errorFound;
 
@@ -283,4 +295,5 @@
             }
         }
     }
+
 }
--- a/test/tools/javac/innerClassFile/Driver.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2002, 2009, 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 4491755 4785453
-# @summary Prob w/static inner class with same name as a regular class
-# @author gafter
-#
-# @run shell Driver.sh
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | CYGWIN* )
-    FS="/"
-    ;;
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-set -x
-mkdir src
-cp -r ${TESTSRC}${FS}* src
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath . -sourcepath src src/x/B.java src/x/C.java src/y/Main.java
-rm y/R3.class
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath . -sourcepath src src/y/Main.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/innerClassFile/InnerClassFileTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,127 @@
+/*
+ * 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 4491755 4785453
+ * @summary Prob w/static inner class with same name as a regular class
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main InnerClassFileTest
+ */
+
+import java.nio.file.Paths;
+
+//original test: test/tools/javac/innerClassFile/Driver.sh
+public class InnerClassFileTest {
+
+    private static final String BSrc =
+        "package x;\n" +
+        "\n" +
+        "import x.*;\n" +
+        "\n" +
+        "public class B {\n" +
+        "    public static class C {}\n" +
+        "}";
+
+    private static final String CSrc =
+        "package x;\n" +
+        "\n" +
+        "import x.*;\n" +
+        "\n" +
+        "public class C {}";
+
+    private static final String MainSrc =
+        "package y;\n" +
+        "\n" +
+        "class Main {\n" +
+        "        private R1 a;\n" +
+        "        private R2 b;\n" +
+        "        private R3 c;\n" +
+        "}";
+
+    private static final String R1Src =
+        "package y;\n" +
+        "\n" +
+        "public final class R1 {\n" +
+        "    x.B.C a = null;\n" +
+        "    x.C b = null;\n" +
+        "    R2 c = new R2();\n" +
+        "}";
+
+    private static final String R2Src =
+        "package y;\n" +
+        "\n" +
+        "public final class R2 {\n" +
+        "    x.B.C a = null;\n" +
+        "    x.C b = null;\n" +
+        "}";
+
+    private static final String R3Src =
+        "package y;\n" +
+        "\n" +
+        "public final class R3 {\n" +
+        "    x.B.C a = null;\n" +
+        "    x.C b = null;\n" +
+        "    R1 c = new R1();\n" +
+        "}";
+
+    public static void main(String args[]) throws Exception {
+        new InnerClassFileTest().run();
+    }
+
+    void run() throws Exception {
+        createFiles();
+        compileFiles();
+    }
+
+    void createFiles() throws Exception {
+//        mkdir src
+//        cp -r ${TESTSRC}${FS}* src
+        ToolBox.createJavaFileFromSource(Paths.get("src"), BSrc);
+        ToolBox.createJavaFileFromSource(Paths.get("src"), CSrc);
+        ToolBox.createJavaFileFromSource(Paths.get("src"), MainSrc);
+        ToolBox.createJavaFileFromSource(Paths.get("src"), R1Src);
+        ToolBox.createJavaFileFromSource(Paths.get("src"), R2Src);
+        ToolBox.createJavaFileFromSource(Paths.get("src"), R3Src);
+    }
+
+    void compileFiles() throws Exception {
+//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath .
+//              -sourcepath src src/x/B.java src/x/C.java src/y/Main.java
+        ToolBox.JavaToolArgs args =
+                new ToolBox.JavaToolArgs()
+                .setAllArgs("-d", ".", "-cp" , ".", "-sourcepath", "src",
+                "src/x/B.java", "src/x/C.java", "src/y/Main.java");
+        ToolBox.javac(args);
+
+//        rm y/R3.class
+        ToolBox.rm(Paths.get("y", "R3.class"));
+
+//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath .
+//                -sourcepath src src/y/Main.java
+        args.setAllArgs("-d", ".", "-cp", ".", "-sourcepath", "src", "src/y/Main.java");
+        ToolBox.javac(args);
+    }
+
+}
--- a/test/tools/javac/innerClassFile/x/B.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2002, 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 x;
-
-import x.*;
-
-public class B {
-    public static class C {}
-}
--- a/test/tools/javac/innerClassFile/x/C.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2002, 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 x;
-
-import x.*;
-
-public class C {}
--- a/test/tools/javac/innerClassFile/y/Main.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2002, 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 y;
-
-class Main {
-        private R1 a;
-        private R2 b;
-        private R3 c;
-}
--- a/test/tools/javac/innerClassFile/y/R1.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2002, 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 y;
-
-public final class R1 {
-    x.B.C a = null;
-    x.C b = null;
-    R2 c = new R2();
-}
--- a/test/tools/javac/innerClassFile/y/R2.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2002, 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 y;
-
-public final class R2 {
-    x.B.C a = null;
-    x.C b = null;
-}
--- a/test/tools/javac/innerClassFile/y/R3.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2002, 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 y;
-
-public final class R3 {
-    x.B.C a = null;
-    x.C b = null;
-    R1 c = new R1();
-}
--- a/test/tools/javac/javazip/A.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2005, 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.
- */
-
-// A class that references another
-class A {
-    B b;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/javazip/JavaZipTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,126 @@
+/*
+ * 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 4098712 6304984 6388453
+ * @summary check that source files inside zip files on the class path are ignored
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main JavaZipTest
+ */
+
+import java.io.File;
+import java.nio.file.Paths;
+
+//original test: test/tools/javac/javazip/Test.sh
+public class JavaZipTest {
+
+    private static final String ASrc =
+        "class A {\n" +
+        "    B b;\n" +
+        "}";
+
+    private static final String BGoodSrc =
+        "public class B {}";
+
+    private static final String BBadSrc =
+        "class B";
+
+    private static final String[][] jarArgs = {
+        {"cf", "good.jar", "-C", "good", "B.java"},
+        {"cf", "good.zip", "-C", "good", "B.java"},
+        {"cf", "bad.jar", "-C", "bad", "B.java"},
+        {"cf", "bad.zip", "-C", "bad", "B.java"},
+    };
+
+    private static final String[][] successfulCompilationArgs = {
+        {"-d", "output", "A.java", "good/B.java"},
+        {"-d", "output", "-cp", "good", "A.java"},
+        {"-d", "output", "-sourcepath", "good", "A.java"},
+        {"-d", "output", "-cp", "good.zip", "A.java"},
+        {"-d", "output", "-cp", "good.jar", "A.java"},
+    };
+
+    private static final String[][] unSuccessfulCompilationArgs = {
+        {"-d", "output", "A.java", "bad/B.java"},
+        {"-d", "output", "-cp", "bad", "A.java"},
+        {"-d", "output", "-sourcepath", "bad", "A.java"},
+        {"-d", "output", "-sourcepath", "bad.zip", "A.java"},
+        {"-d", "output", "-sourcepath", "bad.jar", "A.java"},
+    };
+
+    public static void main(String[] args) throws Exception {
+        new JavaZipTest().test();
+    }
+
+    public void test() throws Exception {
+        createOutputDirAndSourceFiles();
+        createZipsAndJars();
+        check(ToolBox.Expect.SUCCESS, successfulCompilationArgs);
+        check(ToolBox.Expect.FAIL, unSuccessfulCompilationArgs);
+    }
+
+    void createOutputDirAndSourceFiles() throws Exception {
+        //create output dir
+        new File("output").mkdir();
+
+        //source file creation
+        ToolBox.createJavaFileFromSource(Paths.get("good"), BGoodSrc);
+        ToolBox.createJavaFileFromSource(Paths.get("bad"), BBadSrc);
+        ToolBox.createJavaFileFromSource(ASrc);
+    }
+
+    void createZipsAndJars() throws Exception {
+        //jar and zip creation
+//        check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.jar" -C "${TESTSRC}${FS}good" B.java
+//        check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.zip" -C "${TESTSRC}${FS}good" B.java
+//        check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.jar"  -C "${TESTSRC}${FS}bad" B.java
+//        check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.zip"  -C "${TESTSRC}${FS}bad" B.java
+        for (String[] args: jarArgs) {
+            ToolBox.jar(args);
+        }
+    }
+
+    void check(ToolBox.Expect whatToExpect, String[][] theArgs) throws Exception {
+//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}good${FS}B.java"
+//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}good"   "${TESTSRC}${FS}A.java"
+//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}good"  "${TESTSRC}${FS}A.java"
+//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.zip"   "${TESTSRC}${FS}A.java"
+//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.jar"   "${TESTSRC}${FS}A.java"
+
+//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}bad${FS}B.java"
+//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}bad"    "${TESTSRC}${FS}A.java"
+//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}bad"   "${TESTSRC}${FS}A.java"
+//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.zip"   "${TESTSRC}${FS}A.java"
+//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.jar"   "${TESTSRC}${FS}A.java"
+        ToolBox.JavaToolArgs args =
+                new ToolBox.JavaToolArgs(whatToExpect);
+
+        for (String[] allArgs: theArgs) {
+            args.setAllArgs(allArgs);
+            ToolBox.javac(args);
+        }
+    }
+
+}
--- a/test/tools/javac/javazip/Test.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-#! /bin/sh -f
-
-#
-# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 4098712 6304984 6388453
-# @summary check that source files inside zip files on the class path are ignored
-# @run shell Test.sh
-
-TS=${TESTSRC-.}
-TC=${TESTCLASSES-.}
-SCR=`pwd`
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    FS="/"
-    SCR=`pwd`
-    ;;
-  CYGWIN* )
-    FS="/"
-    SCR=`pwd | cygpath -d -f -`
-    ;;
-  Windows* )
-    FS="\\"
-    SCR=`pwd`
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-check() {
-    expected=$1
-    shift
-
-    # clean old classes
-    rm -f ${TC}${FS}*.class 
-
-    echo "$@"
-    if "$@" 2>&1 ; then
-      actual=ok
-    else
-      actual=err
-    fi
-    if [ "$actual" != "$expected" ]; then
-      case "$actual" in
-        ok  ) echo "error: unexpected result: command succeeded" ;;
-        err ) echo "error: unexpected result: command failed"
-      esac
-      exit 1
-    else 
-      case "$actual" in
-        ok  ) echo "command succeeded as expected" ;;
-        err ) echo "command failed as expected."
-      esac
-    fi
-
-    echo 
-}
-
-echo "# create zip/jar files with source code"
-check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.jar" -C "${TESTSRC}${FS}good" B.java
-check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.zip" -C "${TESTSRC}${FS}good" B.java
-check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.jar"  -C "${TESTSRC}${FS}bad" B.java
-check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.zip"  -C "${TESTSRC}${FS}bad" B.java
-
-echo "# control tests, with no paths"
-check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}good${FS}B.java"
-check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}bad${FS}B.java"
-
-echo "# test that source files are found in directories on path"
-check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}good"   "${TESTSRC}${FS}A.java"
-check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}good"  "${TESTSRC}${FS}A.java"
-check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}bad"    "${TESTSRC}${FS}A.java"
-check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}bad"   "${TESTSRC}${FS}A.java"
-
-echo "# test that source files are found in zip/jar files on path"
-check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.zip"   "${TESTSRC}${FS}A.java"
-check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.jar"   "${TESTSRC}${FS}A.java"
-check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.zip"   "${TESTSRC}${FS}A.java"  
-check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.jar"   "${TESTSRC}${FS}A.java" 
--- a/test/tools/javac/javazip/bad/B.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2005, 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.
- */
-
-// this class is invalid
-class B
--- a/test/tools/javac/javazip/good/B.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2005, 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.
- */
-
-// this is a valid class
-public class B {
-}
--- a/test/tools/javac/lambda/BadConv03.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/BadConv03.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-BadConv03.java:19:11: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, BadConv03.B))
+BadConv03.java:19:11: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: BadConv03.B, (compiler.misc.incompatible.abstracts: kindname.interface, BadConv03.B))
 1 error
--- a/test/tools/javac/lambda/BadLambdaPos.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/BadLambdaPos.out	Tue Jul 02 10:13:00 2013 +0100
@@ -4,6 +4,6 @@
 BadLambdaPos.java:23:18: compiler.err.unexpected.lambda
 BadLambdaPos.java:23:34: compiler.err.unexpected.lambda
 BadLambdaPos.java:24:21: compiler.err.unexpected.lambda
-BadLambdaPos.java:28:22: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-BadLambdaPos.java:29:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+BadLambdaPos.java:28:22: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+BadLambdaPos.java:29:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
 8 errors
--- a/test/tools/javac/lambda/BadTargetType.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/BadTargetType.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
-BadTargetType.java:16:24: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-BadTargetType.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-BadTargetType.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, java.lang.Object, @460, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf))
-BadTargetType.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, java.lang.Object, @489, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf))
+BadTargetType.java:16:24: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+BadTargetType.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+BadTargetType.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, java.lang.Object, @460, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
+BadTargetType.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, java.lang.Object, @489, kindname.class, BadTargetType, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
 4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/DoubleStaticImport.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8009820
+ * @summary AssertionError when compiling java code with two identical static imports
+ * @compile DoubleStaticImport.java
+ */
+
+import static java.lang.Thread.holdsLock;
+import static java.lang.Thread.holdsLock; //dup
+
+class DoubleStaticImport {
+    public void test() {
+        holdsLock(null);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/FunctionalInterfaceAnno.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,33 @@
+/*
+ * @test /nodynamiccopyright/
+ * @summary smoke test for functional interface annotation
+ * @compile/fail/ref=FunctionalInterfaceAnno.out -XDrawDiagnostics FunctionalInterfaceAnno.java
+ */
+class FunctionalInterfaceAnno {
+    @FunctionalInterface
+    static class A { } //not an interface
+
+    @FunctionalInterface
+    static abstract class B { } //not an interface
+
+    @FunctionalInterface
+    enum C { } //not an interface
+
+    @FunctionalInterface
+    @interface D { } //not an interface
+
+    @FunctionalInterface
+    interface E { } //no abstracts
+
+    @FunctionalInterface
+    interface F { default void m() { } } //no abstracts
+
+    @FunctionalInterface
+    interface G { String toString(); } //no abstracts
+
+    @FunctionalInterface
+    interface H { void m(); void n(); } //incompatible abstracts
+
+    @FunctionalInterface
+    interface I { void m(); } //ok
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/FunctionalInterfaceAnno.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,9 @@
+FunctionalInterfaceAnno.java:7:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf: FunctionalInterfaceAnno.A)
+FunctionalInterfaceAnno.java:10:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf: FunctionalInterfaceAnno.B)
+FunctionalInterfaceAnno.java:13:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf: FunctionalInterfaceAnno.C)
+FunctionalInterfaceAnno.java:16:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf: FunctionalInterfaceAnno.D)
+FunctionalInterfaceAnno.java:19:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf.1: FunctionalInterfaceAnno.E, (compiler.misc.no.abstracts: kindname.interface, FunctionalInterfaceAnno.E))
+FunctionalInterfaceAnno.java:22:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf.1: FunctionalInterfaceAnno.F, (compiler.misc.no.abstracts: kindname.interface, FunctionalInterfaceAnno.F))
+FunctionalInterfaceAnno.java:25:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf.1: FunctionalInterfaceAnno.G, (compiler.misc.no.abstracts: kindname.interface, FunctionalInterfaceAnno.G))
+FunctionalInterfaceAnno.java:28:5: compiler.err.bad.functional.intf.anno.1: (compiler.misc.not.a.functional.intf.1: FunctionalInterfaceAnno.H, (compiler.misc.incompatible.abstracts: kindname.interface, FunctionalInterfaceAnno.H))
+8 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/FunctionalInterfaceAnno02.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * 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 8007535
+ * @summary Compiler crashes on FunctionalInterface used on interface with two inherited methods with same signatures
+ * @compile FunctionalInterfaceAnno02.java
+ */
+class FunctionalInterfaceAnno02 {
+    interface Foo<T, N extends Number> {
+        void m(T arg);
+        void m(N arg);
+    }
+
+    @FunctionalInterface
+    interface Baz extends Foo<Integer, Integer> { }
+}
--- a/test/tools/javac/lambda/FunctionalInterfaceConversionTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/FunctionalInterfaceConversionTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -23,24 +23,32 @@
 
 /**
  * @test
- * @bug 8003280 8004102
+ * @bug 8003280 8004102 8006694
  * @summary Add lambda tests
  *  perform several automated checks in lambda conversion, esp. around accessibility
+ *  temporarily workaround combo tests are causing time out in several platforms
  * @author  Maurizio Cimadamore
- * @run main FunctionalInterfaceConversionTest
+ * @library ../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm FunctionalInterfaceConversionTest
  */
 
-import com.sun.source.util.JavacTask;
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
+import java.io.IOException;
 import java.net.URI;
 import java.util.Arrays;
 import javax.tools.Diagnostic;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
+import com.sun.source.util.JavacTask;
 
-public class FunctionalInterfaceConversionTest {
+public class FunctionalInterfaceConversionTest
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum PackageKind {
         NO_PKG(""),
@@ -139,8 +147,6 @@
     }
 
     public static void main(String[] args) throws Exception {
-        final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
         for (PackageKind samPkg : PackageKind.values()) {
             for (ModifierKind modKind : ModifierKind.values()) {
                 for (SamKind samKind : SamKind.values()) {
@@ -150,8 +156,11 @@
                                 for (TypeKind argType : TypeKind.values()) {
                                     for (TypeKind thrownType : TypeKind.values()) {
                                         for (ExprKind exprKind : ExprKind.values()) {
-                                            new FunctionalInterfaceConversionTest(samPkg, modKind, samKind,
-                                                    samMeth, clientMeth, retType, argType, thrownType, exprKind).test(comp, fm);
+                                            pool.execute(
+                                                new FunctionalInterfaceConversionTest(
+                                                    samPkg, modKind, samKind,
+                                                    samMeth, clientMeth, retType,
+                                                    argType, thrownType, exprKind));
                                         }
                                     }
                                 }
@@ -161,6 +170,8 @@
                 }
             }
         }
+
+        checkAfterExec(false);
     }
 
     PackageKind samPkg;
@@ -175,24 +186,30 @@
     DiagnosticChecker dc;
 
     SourceFile samSourceFile = new SourceFile("Sam.java", "#P \n #C") {
+        @Override
         public String toString() {
             return template.replaceAll("#P", samPkg.getPkgDecl()).
-                    replaceAll("#C", samKind.getSam(samMeth.getMethod(retType, argType, thrownType)));
+                    replaceAll("#C", samKind.getSam(
+                    samMeth.getMethod(retType, argType, thrownType)));
         }
     };
 
-    SourceFile pkgClassSourceFile = new SourceFile("PackageClass.java",
-                                                   "#P\n #M class PackageClass extends Exception { }") {
+    SourceFile pkgClassSourceFile =
+            new SourceFile("PackageClass.java",
+                           "#P\n #M class PackageClass extends Exception { }") {
+        @Override
         public String toString() {
             return template.replaceAll("#P", samPkg.getPkgDecl()).
                     replaceAll("#M", modKind.modifier_str);
         }
     };
 
-    SourceFile clientSourceFile = new SourceFile("Client.java",
-                                                 "#I\n abstract class Client { \n" +
-                                                 "  Sam s = #E;\n" +
-                                                 "  #M \n }") {
+    SourceFile clientSourceFile =
+            new SourceFile("Client.java",
+                           "#I\n abstract class Client { \n" +
+                           "  Sam s = #E;\n" +
+                           "  #M \n }") {
+        @Override
         public String toString() {
             return template.replaceAll("#I", samPkg.getImportStat())
                     .replaceAll("#E", exprKind.exprStr)
@@ -200,9 +217,10 @@
         }
     };
 
-    FunctionalInterfaceConversionTest(PackageKind samPkg, ModifierKind modKind, SamKind samKind,
-            MethodKind samMeth, MethodKind clientMeth, TypeKind retType, TypeKind argType,
-            TypeKind thrownType, ExprKind exprKind) {
+    FunctionalInterfaceConversionTest(PackageKind samPkg, ModifierKind modKind,
+            SamKind samKind, MethodKind samMeth, MethodKind clientMeth,
+            TypeKind retType, TypeKind argType, TypeKind thrownType,
+            ExprKind exprKind) {
         this.samPkg = samPkg;
         this.modKind = modKind;
         this.samKind = samKind;
@@ -215,12 +233,20 @@
         this.dc = new DiagnosticChecker();
     }
 
-    void test(JavaCompiler comp, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)comp.getTask(null, fm, dc,
-                null, null, Arrays.asList(samSourceFile, pkgClassSourceFile, clientSourceFile));
-        ct.analyze();
+    @Override
+    public void run() {
+        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
+
+        JavacTask ct = (JavacTask)tool.getTask(null, fm.get(), dc, null, null,
+                Arrays.asList(samSourceFile, pkgClassSourceFile, clientSourceFile));
+        try {
+            ct.analyze();
+        } catch (IOException ex) {
+            throw new AssertionError("Test failing with cause", ex.getCause());
+        }
         if (dc.errorFound == checkSamConversion()) {
-            throw new AssertionError(samSourceFile + "\n\n" + pkgClassSourceFile + "\n\n" + clientSourceFile);
+            throw new AssertionError(samSourceFile + "\n\n" +
+                pkgClassSourceFile + "\n\n" + clientSourceFile);
         }
     }
 
@@ -264,13 +290,16 @@
             return toString();
         }
 
+        @Override
         public abstract String toString();
     }
 
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean errorFound = false;
 
+        @Override
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
                 errorFound = true;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/GenericMethodRefImplClass.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,81 @@
+/*
+ * 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 8009582
+ * @summary Method reference generic constructor gives: IllegalArgumentException: Invalid lambda deserialization
+ * @author  Robert Field
+ * @run main GenericMethodRefImplClass
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class GenericMethodRefImplClass {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            // Write lambdas out
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutput out = new ObjectOutputStream(baos);
+
+            write(out, HashMap::new );
+            out.flush();
+            out.close();
+
+            // Read them back
+            ByteArrayInputStream bais =
+                new ByteArrayInputStream(baos.toByteArray());
+            ObjectInputStream in = new ObjectInputStream(bais);
+            readIt(in);
+            in.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw e;
+        }
+        assertTrue(assertionCount == 1);
+    }
+
+    static void write(ObjectOutput out, GenericMethodRefImplClassLSI lamb) throws IOException {
+        out.writeObject(lamb);
+    }
+
+    static void readIt(ObjectInputStream in)  throws IOException, ClassNotFoundException {
+        GenericMethodRefImplClassLSI ls = (GenericMethodRefImplClassLSI) in.readObject();
+        Map result = ls.convert();
+        assertTrue(result.getClass().getName().equals("java.util.HashMap"));
+    }
+}
+
+interface GenericMethodRefImplClassLSI extends Serializable {
+    Map convert();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/IdentifierTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,182 @@
+/*
+ * @test   /nodynamiccopyright/
+ * @bug    8007401 8007427
+ * @author sogoel
+ * @summary Test generation of warnings when '_' is used an identifier
+ * @compile/fail/ref=IdentifierTest.out -Werror -XDrawDiagnostics IdentifierTest.java
+ */
+
+import java.util.List;
+
+/*
+ * This test checks for the generation of warnings when '_' is used as an
+ * identifier in following cases:
+ * package name, class name, class member names including constructor
+ * cass members access using class object or this
+ * loops: for, enhanced-for, while, do-while
+ * arrays,
+ * switch,
+ * annotations, element=value pair
+ * try-catch,
+ * enum
+ * break + identifier
+ * continue + identifier
+ * type-bounds
+ * Above cases for identifier occurrences have been identified from JLS v3.
+ *
+ */
+
+// Test class
+public class IdentifierTest {
+    class _UnderscorePrefix {}
+    class Underscore_Infix {}
+    class UnderscorePostfix_ {}
+    class __ {}
+
+    static final int _prefix = 10;
+    List<String> postfix_;
+
+    // Test: class with name as '_'
+    class _ {
+        String in_fix;
+        //Test: Constructor, "_", local variable, value
+        public _() {
+            String _ = "_";
+            in_fix = _;
+        }
+
+        public void testClassMembersAccess(String[] _args) {
+            // Instance creation
+            _ _ = new _();
+            //Method invocation
+            _.testTryCatch();
+            //Field access
+            _.in_fix = "__";
+        }
+
+        // Test: try-catch
+        public void testTryCatch() {
+            try {
+                int _ = 30/0;
+            } catch (ArithmeticException _) {
+                System.out.println("Got Arithmentic exception " + _);
+            }
+        }
+    }
+
+    // Test: class member access using class object '_', use of this.
+    class TestMisc {
+        int _;
+        void _ () {
+            this._ = 5;
+        }
+
+        public void testClassMemberAccess(String[] args) {
+            // Instance creation
+            TestMisc _ = new TestMisc();
+            //Field access
+            _._ = 10;
+           //Method access
+            _._();
+        }
+    }
+
+    //Test: Type Bounds
+    class TestTypeBounds {
+        //Type bounds
+        <_ extends Object> void test(_ t) {}
+    }
+
+    // Test: enum and switch case
+    static class TestEnum {
+        // Enum
+        enum _ {
+            _MONDAY, _TUESDAY, _WEDNESDAY, _THURSDAY, _FRIDAY,
+            _SATURDAY, _SUNDAY;
+        }
+
+        void foo() {
+            // switch-case
+            for(_ _day : _.values()) {
+                switch(_day) {
+                case _SATURDAY:
+                case _SUNDAY:
+                    System.out.println("Weekend is here!");
+                    break;
+                default:
+                    System.out.println("Weekday is here!");
+                    break;
+                }
+            }
+        }
+    }
+
+    // Test: Annotation
+    static class TestAnno {
+        // Annotation with name as _
+        @interface _ {
+            String _name();
+            int _id();
+        }
+        // Element-Value pair
+        @_(_name ="m",_id=1)
+        public void m(int arg) {}
+
+        //Annotation with _ as one of the elements
+        @interface MyAnno {
+            int _();
+        }
+        // Element Value pair
+        @MyAnno(_='1')
+        public void m2() {}
+    }
+
+    // Test: for loop, while loop, do-while loop, increment/decrement op, condition, print
+    public void testLoop() {
+        // for loop
+        for(int _ = 0; _ < 5; ++_) {
+            System.out.println("_=" + _ + " ");
+        }
+
+        // while loop
+        int _ = 0;
+        while(_ <= 5) {
+            _++;
+        }
+
+        //do-while loop
+        do {
+            --_;
+        } while(_ > 0);
+    }
+
+    // Test: Array and enhanced for loop
+    public void testArraysEnhancedForLoop() {
+        // Arrays
+        String _[] = {"A","B","C","D"};
+
+        for(String _s : _ ) {
+            System.out.println("_s="+_s);
+        }
+    }
+
+    // Test: Labels in break, continue
+    public void testLabels() {
+        // break/continue with labels
+        int j = 0;
+    _:
+        for (int i = 0; i <= 5; i++) {
+            while( j > 4 ) {
+                j++;
+                continue _;
+            }
+            break _;
+        }
+    }
+}
+
+//interface
+interface _ {
+    void mI();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/IdentifierTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,47 @@
+IdentifierTest.java:40:11: compiler.warn.underscore.as.identifier
+IdentifierTest.java:43:16: compiler.warn.underscore.as.identifier
+IdentifierTest.java:44:20: compiler.warn.underscore.as.identifier
+IdentifierTest.java:45:22: compiler.warn.underscore.as.identifier
+IdentifierTest.java:50:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:50:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:50:23: compiler.warn.underscore.as.identifier
+IdentifierTest.java:52:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:54:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:60:21: compiler.warn.underscore.as.identifier
+IdentifierTest.java:61:42: compiler.warn.underscore.as.identifier
+IdentifierTest.java:62:67: compiler.warn.underscore.as.identifier
+IdentifierTest.java:69:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:70:14: compiler.warn.underscore.as.identifier
+IdentifierTest.java:71:18: compiler.warn.underscore.as.identifier
+IdentifierTest.java:76:22: compiler.warn.underscore.as.identifier
+IdentifierTest.java:78:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:78:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:80:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:80:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:87:10: compiler.warn.underscore.as.identifier
+IdentifierTest.java:87:38: compiler.warn.underscore.as.identifier
+IdentifierTest.java:93:14: compiler.warn.underscore.as.identifier
+IdentifierTest.java:100:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:100:26: compiler.warn.underscore.as.identifier
+IdentifierTest.java:117:20: compiler.warn.underscore.as.identifier
+IdentifierTest.java:122:10: compiler.warn.underscore.as.identifier
+IdentifierTest.java:127:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:130:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:137:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:137:24: compiler.warn.underscore.as.identifier
+IdentifierTest.java:137:33: compiler.warn.underscore.as.identifier
+IdentifierTest.java:138:39: compiler.warn.underscore.as.identifier
+IdentifierTest.java:142:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:143:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:144:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:149:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:150:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:156:16: compiler.warn.underscore.as.identifier
+IdentifierTest.java:158:25: compiler.warn.underscore.as.identifier
+IdentifierTest.java:167:5: compiler.warn.underscore.as.identifier
+IdentifierTest.java:171:26: compiler.warn.underscore.as.identifier
+IdentifierTest.java:173:19: compiler.warn.underscore.as.identifier
+IdentifierTest.java:179:11: compiler.warn.underscore.as.identifier
+- compiler.err.warnings.and.werror
+1 error
+44 warnings
--- a/test/tools/javac/lambda/Intersection01.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/Intersection01.java	Tue Jul 02 10:13:00 2013 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8002099
  * @summary Add support for intersection types in cast expression
- * @compile/fail/ref=Intersection01.out -XDallowIntersectionTypes -XDrawDiagnostics Intersection01.java
+ * @compile/fail/ref=Intersection01.out -XDrawDiagnostics Intersection01.java
  */
 class Intersection01 {
 
--- a/test/tools/javac/lambda/Intersection01.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/Intersection01.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,3 @@
-Intersection01.java:36:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
-Intersection01.java:38:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
+Intersection01.java:36:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: java.io.Serializable, (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
+Intersection01.java:38:45: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: java.io.Serializable, (compiler.misc.no.abstracts: kindname.interface, java.io.Serializable))
 2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/Intersection02.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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 8010101
+ * @summary Intersection type cast issues redundant unchecked warning
+ * @compile/fail/ref=Intersection02.out -Werror -Xlint:unchecked -XDrawDiagnostics Intersection02.java
+ */
+import java.io.Serializable;
+import java.util.List;
+
+class Intersection02 {
+
+    interface P<X> { }
+
+    void test(List<String> ls) {
+        Object o1 = (List<String> & Serializable)ls;
+        Object o2 = (List<String> & Serializable & P<String>)ls;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/Intersection02.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,4 @@
+Intersection02.java:39:62: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.util.List<java.lang.String>, java.lang.Object&java.util.List<java.lang.String>&java.io.Serializable&Intersection02.P<java.lang.String>
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- a/test/tools/javac/lambda/LambdaCapture06.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/LambdaCapture06.java	Tue Jul 02 10:13:00 2013 +0100
@@ -23,7 +23,6 @@
 
 /*
  * @test
- * @ignore investigate as to whether code generation fails
  * @bug 8003280
  * @summary Add lambda tests
  *  Compiler crash when local inner class nested inside lambda captures local variables from enclosing scope
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaCapture07.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8004962
+ * @summary Code generation crash with lambda and local classes
+ */
+public class LambdaCapture07 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM {
+        void m();
+    }
+
+    void test(int i) {
+        class Local { Local() { assertTrue(i == 42); } }
+        class LocalSub extends Local { }
+        SAM s_sup = ()->new Local();
+        s_sup.m();
+        SAM s_sub = ()->new LocalSub();
+        s_sub.m();
+        SAM s_sup_nested = ()->{ SAM s = ()->new Local(); s.m(); };
+        s_sup_nested.m();
+        SAM s_sub_nested = ()->{ SAM s = ()->new LocalSub(); s.m(); };
+        s_sub_nested.m();
+    }
+
+    public static void main(String[] args) {
+        new LambdaCapture07().test(42);
+        assertTrue(assertionCount == 4);
+    }
+}
--- a/test/tools/javac/lambda/LambdaConv09.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/LambdaConv09.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
-LambdaConv09.java:42:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo1))
-LambdaConv09.java:43:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo2))
-LambdaConv09.java:44:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo3))
-LambdaConv09.java:46:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo5))
+LambdaConv09.java:42:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: LambdaConv09.Foo1, (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo1))
+LambdaConv09.java:43:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: LambdaConv09.Foo2, (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo2))
+LambdaConv09.java:44:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: LambdaConv09.Foo3, (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo3))
+LambdaConv09.java:46:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: LambdaConv09.Foo5, (compiler.misc.no.abstracts: kindname.interface, LambdaConv09.Foo5))
 4 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaConv25.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @summary check that merged inherited descriptors preservers type-parameters
+ * @compile/fail/ref=LambdaConv25.out -XDrawDiagnostics LambdaConv25.java
+ */
+class LambdaConv25 {
+
+    interface A {
+        <X> void m();
+    }
+
+    interface B {
+        <X> void m();
+    }
+
+    interface C extends A, B { }
+
+    void test() {
+        C c = ()->{}; //should fail
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaConv25.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+LambdaConv25.java:19:15: compiler.err.prob.found.req: (compiler.misc.invalid.generic.lambda.target: <X>()void, kindname.interface, LambdaConv25.C)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaConv26.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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 8006749
+ * @summary compiler does not allow Object protected methods to be used in lambda
+ * @compile LambdaConv26.java
+ */
+public class LambdaConv26 {
+    interface I {
+        Object clone();
+    }
+
+    Object m() { return null; }
+
+    void test() {
+        I i1 = ()->null;
+        I i2 = this::m;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaConv27.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 8008227
+ * @summary Mixing lambdas with anonymous classes leads to NPE thrown by compiler
+ * @run main LambdaConv27
+ */
+public class LambdaConv27 {
+
+     public static void main(String[] args) {
+         SAM s = ()-> { SAM s2 = ()->{ new Object() { }; }; s2.m(); };
+         s.m();
+     }
+
+     interface SAM {
+         void m();
+     }
+}
--- a/test/tools/javac/lambda/LambdaExpr10.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/LambdaExpr10.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,9 +1,9 @@
-LambdaExpr10.java:18:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:19:32: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:23:40: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:24:46: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:28:29: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-LambdaExpr10.java:29:33: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+LambdaExpr10.java:18:28: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:19:32: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:23:40: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:24:46: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:28:29: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
+LambdaExpr10.java:29:33: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
 LambdaExpr10.java:33:35: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, void))
 LambdaExpr10.java:34:49: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, void))
 8 errors
--- a/test/tools/javac/lambda/LambdaExpr15.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/LambdaExpr15.java	Tue Jul 02 10:13:00 2013 +0100
@@ -23,7 +23,6 @@
 
 /*
  * @test
- * @ignore investigate as to whether code generation fails
  * @bug 8003280
  * @summary Add lambda tests
  *  check that nested inner class in statement lambdas don't get corrupted return statements
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaExpr21.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,67 @@
+/*
+ * 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 8006684
+ * @summary Compiler produces java.lang.VerifyError: Bad type on operand stack
+ * @run main LambdaExpr21
+ */
+public class LambdaExpr21 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM {
+        void foo();
+    }
+
+    static class Checker {
+        Checker(boolean cond) {
+            assertTrue(cond);
+        }
+    }
+
+    static {
+        SAM s = ()-> { new Checker(true) { }; };
+        s.foo();
+    }
+
+    static void test(){
+        SAM s = ()-> { new Checker(true) { }; };
+        s.foo();
+    }
+
+    static SAM s = ()-> { new Checker(true) { }; };
+
+    public static void main(String[] args) {
+        test();
+        s.foo();
+        assertTrue(assertionCount == 3);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaInnerTypeVarArgs.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.
+ *
+ * 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 8005653
+ * @summary A lambda containing an inner class referencing an external type var in class parameter type
+ * @author  Robert Field
+ * @run main LambdaInnerTypeVarArgs
+ */
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.ArrayList;
+
+public class LambdaInnerTypeVarArgs {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface I {
+        C doit();
+    }
+
+    abstract class C {
+        abstract Object it();
+    }
+
+    class TV {
+        C go() {
+            List<String> ls = new ArrayList<>();
+            ls.add("Oh");
+            ls.add("my");
+            return foo(ls).doit();
+        }
+
+        <RRRRR> I foo(List<RRRRR> r) {
+            return () -> new C() {
+                List<RRRRR> xxxxx = r;
+                @Override
+                    Object it() { return xxxxx; };
+            };
+        }
+    }
+
+    void test1() {
+        assertTrue(((List<String>)(new TV().go().it())).get(0).equals("Oh"));
+    }
+
+    public static void main(String[] args) {
+        LambdaInnerTypeVarArgs t = new LambdaInnerTypeVarArgs();
+        t.test1();
+        assertTrue(assertionCount == 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaInnerTypeVarArgsSerialize.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.
+ *
+ * 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 8005653
+ * @summary A serialized lambda containing an inner class referencing an external type var in class parameter type
+ * @author  Robert Field
+ * @run main LambdaInnerTypeVarArgsSerialize
+ */
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.ArrayList;
+
+public class LambdaInnerTypeVarArgsSerialize {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface I extends Serializable {
+        C doit();
+    }
+
+    abstract class C {
+        abstract Object it();
+    }
+
+    class TV {
+        C go() {
+            List<String> ls = new ArrayList<>();
+            ls.add("Oh");
+            ls.add("my");
+            return foo(ls).doit();
+        }
+
+        <RRRRR> I foo(List<RRRRR> r) {
+            return () -> new C() {
+                List<RRRRR> xxxxx = r;
+                @Override
+                    Object it() { return xxxxx; };
+            };
+        }
+    }
+
+    void test1() {
+        assertTrue(((List<String>)(new TV().go().it())).get(0).equals("Oh"));
+    }
+
+    public static void main(String[] args) {
+        LambdaInnerTypeVarArgsSerialize t = new LambdaInnerTypeVarArgsSerialize();
+        t.test1();
+        assertTrue(assertionCount == 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaInnerTypeVarReflect.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8005653
+ * @summary A lambda containing an inner class referencing an external type var
+ * @author  Robert Field
+ * @run main LambdaInnerTypeVarReflect
+ */
+
+import java.io.StringWriter;
+import java.io.PrintWriter;
+import java.io.IOException;
+
+public class LambdaInnerTypeVarReflect {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface I {
+        C doit();
+    }
+
+    abstract class C {
+        abstract Object it();
+    }
+
+    class TV {
+        C go() {
+            return foo("Frump").doit();
+        }
+
+        <RRRRR> I foo(RRRRR r) {
+            return () -> new C() {
+                public RRRRR xxxxx = r;
+                @Override
+                    Object it() { return xxxxx; };
+            };
+        }
+    }
+
+    void test1() throws IOException {
+        char[] buffer = new char[1024];
+        String innerName = new TV().go().getClass().getName();
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int exitCode = com.sun.tools.javap.Main.run(new String[] {innerName}, pw);
+        assertTrue(exitCode == 0);
+
+        String javapOut = sw.toString();
+        assertTrue(javapOut.contains(innerName));
+        assertTrue(!javapOut.contains("RRRRR"));
+    }
+
+    public static void main(String[] args) throws IOException {
+        LambdaInnerTypeVarReflect t = new LambdaInnerTypeVarReflect();
+        t.test1();
+        assertTrue(assertionCount == 3);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaInnerTypeVarSerialize.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,75 @@
+/*
+ * 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 8005653
+ * @summary A serialized lambda containing an inner class referencing an external type var
+ * @author  Robert Field
+ * @run main LambdaInnerTypeVarSerialize
+ */
+
+import java.io.Serializable;
+
+public class LambdaInnerTypeVarSerialize {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface I extends Serializable {
+        C doit();
+    }
+
+    abstract class C {
+        abstract Object it();
+    }
+
+    class TV {
+        C go() {
+            return foo("Frump").doit();
+        }
+
+        <RRRRR> I foo(RRRRR r) {
+            return () -> new C() {
+                RRRRR xxxxx = r;
+                @Override
+                    Object it() { return xxxxx; };
+            };
+        }
+    }
+
+    void test1() {
+        assertTrue(new TV().go().it().equals("Frump"));
+    }
+
+    public static void main(String[] args) {
+        LambdaInnerTypeVarSerialize t = new LambdaInnerTypeVarSerialize();
+        t.test1();
+        assertTrue(assertionCount == 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/LambdaLambdaSerialized.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,79 @@
+/*
+ * 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 8010010
+@summary NPE generating serializedLambdaName for nested lambda
+*/
+
+import java.io.*;
+import java.util.Map;
+import java.util.HashMap;
+
+public class LambdaLambdaSerialized {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            // Write lambdas out
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutput out = new ObjectOutputStream(baos);
+            LSI<LSI<Map>> ssi = () -> (() -> new HashMap());
+            write(out, ssi );
+            out.flush();
+            out.close();
+
+            // Read them back
+            ByteArrayInputStream bais =
+                new ByteArrayInputStream(baos.toByteArray());
+            ObjectInputStream in = new ObjectInputStream(bais);
+            readAssert(in, "[X]");
+            in.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+
+    static void write(ObjectOutput out, LSI<LSI<Map>> lamb) throws IOException {
+        out.writeObject(lamb);
+    }
+
+    static void readAssert(ObjectInputStream in, String expected)  throws IOException, ClassNotFoundException {
+        LSI<LSI<Map>> ls = (LSI<LSI<Map>>) in.readObject();
+        Map result = ls.get().get();
+        System.out.printf("Result: %s\n", result);
+    }
+}
+
+interface LSI<T> extends Serializable {
+    T get();
+}
--- a/test/tools/javac/lambda/LambdaParserTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/LambdaParserTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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,35 +23,38 @@
 
 /*
  * @test
- * @bug 7115050
- * @bug 8003280
+ * @bug 7115050 8003280 8005852 8006694
  * @summary Add lambda tests
  *  Add parser support for lambda expressions
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm LambdaParserTest
  */
 
-import com.sun.source.util.JavacTask;
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.Arrays;
 import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
+import com.sun.source.util.JavacTask;
 
-public class LambdaParserTest {
-
-    static int checkCount = 0;
+public class LambdaParserTest
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum LambdaKind {
         NILARY_EXPR("()->x"),
         NILARY_STMT("()->{ return x; }"),
-        ONEARY_SHORT_EXPR("x->x"),
-        ONEARY_SHORT_STMT("x->{ return x; }"),
-        ONEARY_EXPR("(#M1 #T1 x)->x"),
-        ONEARY_STMT("(#M1 #T1 x)->{ return x; }"),
-        TWOARY_EXPR("(#M1 #T1 x, #M2 #T2 y)->x"),
-        TWOARY_STMT("(#M1 #T1 x, #M2 #T2 y)->{ return x; }");
+        ONEARY_SHORT_EXPR("#PN->x"),
+        ONEARY_SHORT_STMT("#PN->{ return x; }"),
+        ONEARY_EXPR("(#M1 #T1 #PN)->x"),
+        ONEARY_STMT("(#M1 #T1 #PN)->{ return x; }"),
+        TWOARY_EXPR("(#M1 #T1 #PN, #M2 #T2 y)->x"),
+        TWOARY_STMT("(#M1 #T1 #PN, #M2 #T2 y)->{ return x; }");
 
         String lambdaTemplate;
 
@@ -60,11 +63,12 @@
         }
 
         String getLambdaString(LambdaParameterKind pk1, LambdaParameterKind pk2,
-                ModifierKind mk1, ModifierKind mk2) {
+                ModifierKind mk1, ModifierKind mk2, LambdaParameterName pn) {
             return lambdaTemplate.replaceAll("#M1", mk1.modifier)
                     .replaceAll("#M2", mk2.modifier)
                     .replaceAll("#T1", pk1.parameterType)
-                    .replaceAll("#T2", pk2.parameterType);
+                    .replaceAll("#T2", pk2.parameterType)
+                    .replaceAll("#PN", pn.nameStr);
         }
 
         int arity() {
@@ -87,6 +91,17 @@
         }
     }
 
+    enum LambdaParameterName {
+        IDENT("x"),
+        UNDERSCORE("_");
+
+        String nameStr;
+
+        LambdaParameterName(String nameStr) {
+            this.nameStr = nameStr;
+        }
+    }
+
     enum LambdaParameterKind {
         IMPLICIT(""),
         EXPLIICT_SIMPLE("A"),
@@ -151,8 +166,8 @@
         }
 
         String expressionString(LambdaParameterKind pk1, LambdaParameterKind pk2,
-                ModifierKind mk1, ModifierKind mk2, LambdaKind lk, SubExprKind sk) {
-            return expressionTemplate.replaceAll("#L", lk.getLambdaString(pk1, pk2, mk1, mk2))
+                ModifierKind mk1, ModifierKind mk2, LambdaKind lk, LambdaParameterName pn, SubExprKind sk) {
+            return expressionTemplate.replaceAll("#L", lk.getLambdaString(pk1, pk2, mk1, mk2, pn))
                     .replaceAll("#S", sk.subExpression);
         }
     }
@@ -173,25 +188,28 @@
     }
 
     public static void main(String... args) throws Exception {
-
-        //create default shared JavaCompiler - reused across multiple compilations
-        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
-
         for (LambdaKind lk : LambdaKind.values()) {
-            for (LambdaParameterKind pk1 : LambdaParameterKind.values()) {
-                if (lk.arity() < 1 && pk1 != LambdaParameterKind.IMPLICIT) continue;
-                for (LambdaParameterKind pk2 : LambdaParameterKind.values()) {
-                    if (lk.arity() < 2 && pk2 != LambdaParameterKind.IMPLICIT) continue;
-                    for (ModifierKind mk1 : ModifierKind.values()) {
-                        if (mk1 != ModifierKind.NONE && lk.isShort()) continue;
-                        if (lk.arity() < 1 && mk1 != ModifierKind.NONE) continue;
-                        for (ModifierKind mk2 : ModifierKind.values()) {
-                            if (lk.arity() < 2 && mk2 != ModifierKind.NONE) continue;
-                            for (SubExprKind sk : SubExprKind.values()) {
-                                for (ExprKind ek : ExprKind.values()) {
-                                    new LambdaParserTest(pk1, pk2, mk1, mk2, lk, sk, ek)
-                                            .run(comp, fm);
+            for (LambdaParameterName pn : LambdaParameterName.values()) {
+                for (LambdaParameterKind pk1 : LambdaParameterKind.values()) {
+                    if (lk.arity() < 1 && pk1 != LambdaParameterKind.IMPLICIT)
+                        continue;
+                    for (LambdaParameterKind pk2 : LambdaParameterKind.values()) {
+                        if (lk.arity() < 2 && pk2 != LambdaParameterKind.IMPLICIT)
+                            continue;
+                        for (ModifierKind mk1 : ModifierKind.values()) {
+                            if (mk1 != ModifierKind.NONE && lk.isShort())
+                                continue;
+                            if (lk.arity() < 1 && mk1 != ModifierKind.NONE)
+                                continue;
+                            for (ModifierKind mk2 : ModifierKind.values()) {
+                                if (lk.arity() < 2 && mk2 != ModifierKind.NONE)
+                                    continue;
+                                for (SubExprKind sk : SubExprKind.values()) {
+                                    for (ExprKind ek : ExprKind.values()) {
+                                        pool.execute(
+                                            new LambdaParserTest(pk1, pk2, mk1,
+                                                                 mk2, lk, sk, ek, pn));
+                                    }
                                 }
                             }
                         }
@@ -199,7 +217,8 @@
                 }
             }
         }
-        System.out.println("Total check executed: " + checkCount);
+
+        checkAfterExec();
     }
 
     LambdaParameterKind pk1;
@@ -207,18 +226,21 @@
     ModifierKind mk1;
     ModifierKind mk2;
     LambdaKind lk;
+    LambdaParameterName pn;
     SubExprKind sk;
     ExprKind ek;
     JavaSource source;
     DiagnosticChecker diagChecker;
 
-    LambdaParserTest(LambdaParameterKind pk1, LambdaParameterKind pk2, ModifierKind mk1,
-            ModifierKind mk2, LambdaKind lk, SubExprKind sk, ExprKind ek) {
+    LambdaParserTest(LambdaParameterKind pk1, LambdaParameterKind pk2,
+            ModifierKind mk1, ModifierKind mk2, LambdaKind lk,
+            SubExprKind sk, ExprKind ek, LambdaParameterName pn) {
         this.pk1 = pk1;
         this.pk2 = pk2;
         this.mk1 = mk1;
         this.mk2 = mk2;
         this.lk = lk;
+        this.pn = pn;
         this.sk = sk;
         this.ek = ek;
         this.source = new JavaSource();
@@ -235,7 +257,8 @@
 
         public JavaSource() {
             super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
-            source = template.replaceAll("#E", ek.expressionString(pk1, pk2, mk1, mk2, lk, sk));
+            source = template.replaceAll("#E",
+                    ek.expressionString(pk1, pk2, mk1, mk2, lk, pn, sk));
         }
 
         @Override
@@ -244,19 +267,20 @@
         }
     }
 
-    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+    public void run() {
+        JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), diagChecker,
                 null, null, Arrays.asList(source));
         try {
             ct.parse();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thrown when parsing the following source:\n" + source.getCharContent(true));
+            processException(ex);
+            return;
         }
         check();
     }
 
     void check() {
-        checkCount++;
+        checkCount.incrementAndGet();
 
         boolean errorExpected = (lk.arity() > 0 && !mk1.compatibleWith(pk1)) ||
                 (lk.arity() > 1 && !mk2.compatibleWith(pk2));
@@ -267,6 +291,9 @@
             errorExpected = true;
         }
 
+        errorExpected |= pn == LambdaParameterName.UNDERSCORE &&
+                lk.arity() > 0;
+
         if (errorExpected != diagChecker.errorFound) {
             throw new Error("invalid diagnostics for source:\n" +
                 source.getCharContent(true) +
@@ -275,7 +302,8 @@
         }
     }
 
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean errorFound;
 
@@ -285,4 +313,5 @@
             }
         }
     }
+
 }
--- a/test/tools/javac/lambda/MethodReference04.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference04.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-MethodReference04.java:13:16: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+MethodReference04.java:13:16: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
 1 error
--- a/test/tools/javac/lambda/MethodReference22.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference22.java	Tue Jul 02 10:13:00 2013 +0100
@@ -48,19 +48,19 @@
     }
 
     static void test2() {
-        SAM2 s1 = MethodReference22::m1; //ok
-        call2(MethodReference22::m1); //ok
-        SAM2 s2 = MethodReference22::m2; //ok
-        call2(MethodReference22::m2); //ok
-        SAM2 s3 = MethodReference22::m3; //fail
-        call2(MethodReference22::m3); //fail
-        SAM2 s4 = MethodReference22::m4; //fail
-        call2(MethodReference22::m4); //fail
+        SAM2 s1 = MethodReference22::m1; //ambiguous
+        call2(MethodReference22::m1); //ambiguous
+        SAM2 s2 = MethodReference22::m2; //ambiguous
+        call2(MethodReference22::m2); //ambiguous
+        SAM2 s3 = MethodReference22::m3; //ambiguous
+        call2(MethodReference22::m3); //ambiguous
+        SAM2 s4 = MethodReference22::m4; //ambiguous
+        call2(MethodReference22::m4); //ambiguous
     }
 
     static void test3() {
-        call3(MethodReference22::m1); //ok
-        call3(MethodReference22::m2); //ambiguous
+        call3(MethodReference22::m1); //fail
+        call3(MethodReference22::m2); //ok
         call3(MethodReference22::m3); //ok
         call3(MethodReference22::m4); //fail
     }
--- a/test/tools/javac/lambda/MethodReference22.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference22.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,11 +1,15 @@
-MethodReference22.java:40:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String)))
-MethodReference22.java:41:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @999, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))))
-MethodReference22.java:46:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String)))
-MethodReference22.java:47:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @1270, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))))
-MethodReference22.java:55:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m3(MethodReference22,java.lang.String)))
-MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1574, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m3(MethodReference22,java.lang.String))))
+MethodReference22.java:40:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))
+MethodReference22.java:41:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))
+MethodReference22.java:46:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
+MethodReference22.java:47:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
+MethodReference22.java:51:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference22,java.lang.String), MethodReference22, kindname.method, m1(java.lang.String), MethodReference22))
+MethodReference22.java:52:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1401, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference22,java.lang.String), MethodReference22, kindname.method, m1(java.lang.String), MethodReference22)))
+MethodReference22.java:53:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference22,java.lang.String), MethodReference22, kindname.method, m2(java.lang.String), MethodReference22))
+MethodReference22.java:54:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1504, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference22,java.lang.String), MethodReference22, kindname.method, m2(java.lang.String), MethodReference22)))
+MethodReference22.java:55:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22))
+MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1607, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22)))
 MethodReference22.java:57:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22))
-MethodReference22.java:58:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1667, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
-MethodReference22.java:63:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
-MethodReference22.java:65:9: compiler.err.cant.apply.symbols: kindname.method, call3, @1881,{(compiler.misc.inapplicable.method: kindname.method, MethodReference22, call3(MethodReference22.SAM1), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))))),(compiler.misc.inapplicable.method: kindname.method, MethodReference22, call3(MethodReference22.SAM2), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22))))}
-10 errors
+MethodReference22.java:58:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1710, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
+MethodReference22.java:62:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))
+MethodReference22.java:65:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
+14 errors
--- a/test/tools/javac/lambda/MethodReference25.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference25.java	Tue Jul 02 10:13:00 2013 +0100
@@ -25,21 +25,13 @@
  * @test
  * @bug 8003280
  * @summary Add lambda tests
- *  check that non-boxing method references conversion has the precedence
- * @run main MethodReference25
+ *  check that non-boxing method references is not preferred over boxing one
+ * @compile/fail/ref=MethodReference25.out -XDrawDiagnostics MethodReference25.java
  */
 
-public class MethodReference25 {
+class MethodReference25 {
 
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
-    static int assertionCount = 0;
-
-    static void m(Integer i) { assertTrue(true); }
+    static void m(Integer i) { }
 
     interface SAM1 {
         void m(int x);
@@ -49,11 +41,10 @@
         void m(Integer x);
     }
 
-    static void call(int i, SAM1 s) { s.m(i); assertTrue(false); }
+    static void call(int i, SAM1 s) { s.m(i);  }
     static void call(int i, SAM2 s) { s.m(i);  }
 
     public static void main(String[] args) {
-        call(1, MethodReference25::m); //resolves to call(int, SAM2)
-        assertTrue(assertionCount == 1);
+        call(1, MethodReference25::m); //ambiguous
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference25.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MethodReference25.java:48:9: compiler.err.ref.ambiguous: call, kindname.method, call(int,MethodReference25.SAM1), MethodReference25, kindname.method, call(int,MethodReference25.SAM2), MethodReference25
+1 error
--- a/test/tools/javac/lambda/MethodReference26.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference26.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,9 +1,30 @@
 /*
- * @test /nodynamiccopyright/
- * @bug 8003280
- * @summary Add lambda tests
- *  check strict method conversion does not allow loose method reference conversion
- * @compile/fail/ref=MethodReference26.out -XDrawDiagnostics MethodReference26.java
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary check strict method conversion allows loose method reference conversion
+ * @compile MethodReference26.java
  */
 
 class MethodReference26 {
@@ -18,6 +39,6 @@
     static void call(Integer i, SAM s) {   }
 
     static void test() {
-        call(1, MethodReference26::m); //ambiguous
+        call(1, MethodReference26::m); //ok
     }
 }
--- a/test/tools/javac/lambda/MethodReference26.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-MethodReference26.java:21:9: compiler.err.ref.ambiguous: call, kindname.method, call(int,MethodReference26.SAM), MethodReference26, kindname.method, call(java.lang.Integer,MethodReference26.SAM), MethodReference26
-1 error
--- a/test/tools/javac/lambda/MethodReference28.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference28.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,7 +1,7 @@
 MethodReference28.java:31:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m2, java.lang.Integer,java.lang.Integer, int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch)))
 MethodReference28.java:32:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference28.java:33:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String))))
-MethodReference28.java:37:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.Integer)))
+MethodReference28.java:37:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.Integer))
 MethodReference28.java:38:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.Integer,java.lang.Integer, int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch)))
 MethodReference28.java:39:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference28.java:40:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String))))
--- a/test/tools/javac/lambda/MethodReference38.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference38.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
-MethodReference38.java:24:18: compiler.err.abstract.cant.be.instantiated
-MethodReference38.java:25:18: compiler.err.abstract.cant.be.instantiated
-MethodReference38.java:26:18: compiler.err.abstract.cant.be.instantiated
+MethodReference38.java:24:18: compiler.err.abstract.cant.be.instantiated: MethodReference38.A
+MethodReference38.java:25:18: compiler.err.abstract.cant.be.instantiated: MethodReference38.I
+MethodReference38.java:26:18: compiler.err.abstract.cant.be.instantiated: MethodReference38.AC
 MethodReference38.java:27:18: compiler.err.enum.cant.be.instantiated
 4 errors
--- a/test/tools/javac/lambda/MethodReference43.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference43.java	Tue Jul 02 10:13:00 2013 +0100
@@ -60,9 +60,9 @@
 
 
     static void m(SAM1 s) { assertTrue(false); }
-    static void m(SAM2 s) { assertTrue(true); }
+    static void m(SAM2 s) { assertTrue(false); }
     static void m(SAM3 s) { assertTrue(false); }
-    static void m(SAM4 s) { assertTrue(false); }
+    static void m(SAM4 s) { assertTrue(true); }
 
     public static void main(String[] args) {
         m(Foo::new);
--- a/test/tools/javac/lambda/MethodReference51.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference51.out	Tue Jul 02 10:13:00 2013 +0100
@@ -2,6 +2,6 @@
 MethodReference51.java:40:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, f, java.lang.String, int, kindname.class, MethodReference51, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference51.java:41:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, g, int,{(compiler.misc.inapplicable.method: kindname.method, MethodReference51, g(java.lang.Integer,java.lang.Number), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, MethodReference51, g(java.lang.Number,java.lang.Integer), (compiler.misc.arg.length.mismatch))}))
 MethodReference51.java:42:32: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: g, kindname.method, g(java.lang.Integer,java.lang.Number), MethodReference51, kindname.method, g(java.lang.Number,java.lang.Integer), MethodReference51))
-MethodReference51.java:43:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, h(int)))
+MethodReference51.java:43:21: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, h(int))
 MethodReference51.java:44:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.not.def.access.class.intf.cant.access: j(int), MethodReference51.Foo))
 6 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference59.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,52 @@
+/*
+ * 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 8004102
+ * @summary Add support for array constructor references
+ */
+public class MethodReference59 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface ArrayFactory<X> {
+        X make(int size);
+    }
+
+    public static void main(String[] args) {
+        ArrayFactory<int[]> factory1 = int[]::new;
+        int[] i1 = factory1.make(5);
+        assertTrue(i1.length == 5);
+        ArrayFactory<int[][]> factory2 = int[][]::new;
+        int[][] i2 = factory2.make(5);
+        assertTrue(i2.length == 5);
+        assertTrue(assertionCount == 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference60.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,55 @@
+/*
+ * 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 8004102
+ * @summary Add support for array constructor references
+ * @compile/fail/ref=MethodReference60.out -XDrawDiagnostics MethodReference60.java
+ */
+public class MethodReference60 {
+
+    interface ArrayFactory<X> {
+        X make(int size);
+    }
+
+    interface BadArrayFactory1<X> {
+        X make();
+    }
+
+    interface BadArrayFactory2<X> {
+        X make(int i1, int i2);
+    }
+
+    interface BadArrayFactory3<X> {
+        X make(String s);
+    }
+
+    public static void main(String[] args) {
+        BadArrayFactory1<int[]> factory1 = int[]::new; //param mismatch
+        BadArrayFactory2<int[]> factory2 = int[]::new; //param mismatch
+        BadArrayFactory3<int[]> factory3 = int[]::new; //param mismatch
+        ArrayFactory<Integer> factory4 = int[]::new; //return type mismatch
+        ArrayFactory<Integer[]> factory5 = int[]::new; //return type mismatch
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference60.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,6 @@
+MethodReference60.java:49:44: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Array, int, compiler.misc.no.args, kindname.class, Array, (compiler.misc.arg.length.mismatch)))
+MethodReference60.java:50:44: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Array, int, int,int, kindname.class, Array, (compiler.misc.arg.length.mismatch)))
+MethodReference60.java:51:44: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Array, int, java.lang.String, kindname.class, Array, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, int))))
+MethodReference60.java:52:42: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.mref: (compiler.misc.inconvertible.types: int[], java.lang.Integer))
+MethodReference60.java:53:44: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.mref: (compiler.misc.inconvertible.types: int[], java.lang.Integer[]))
+5 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference61.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 8006763
+ * @summary super in method reference used in anonymous class
+ */
+public class MethodReference61 {
+    interface SAM {
+        void m();
+    }
+
+    static class MyTester {
+        public void ifoo() { }
+    }
+
+    public static void main(String args[]) {
+        MyTester t = new MyTester() {
+            SAM s = super::ifoo;
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference62.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,22 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8007285
+ * @summary AbstractMethodError instead of compile-time error when method reference with super and abstract
+ * @compile/fail/ref=MethodReference62.out -XDrawDiagnostics MethodReference62.java
+ */
+class MethodReference62 {
+    interface SAM {
+        int m();
+    }
+
+    static abstract class Sup {
+        abstract int foo() ;
+    }
+
+    static abstract class Sub extends Sup {
+        abstract int foo() ;
+        void test() {
+            SAM s = super::foo;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference62.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+MethodReference62.java:19:21: compiler.err.abstract.cant.be.accessed.directly: kindname.method, foo(), MethodReference62.Sup
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference63.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 8005183
+ * @summary Missing accessor for constructor reference pointing to private inner class ctor
+ */
+public class MethodReference63 {
+
+    interface SAM {
+        void m();
+    }
+
+    static class Foo {
+        private Foo() { }
+    }
+
+    public static void main(String[] args) {
+        SAM s = Foo::new;
+        s.m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference64.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,46 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8008540 8008539 8008538
+ * @summary Constructor reference to non-reifiable array should be rejected
+ * @compile/fail/ref=MethodReference64.out -XDrawDiagnostics MethodReference64.java
+ */
+class MethodReference64 {
+    interface ClassFactory {
+        Object m();
+    }
+
+    interface ArrayFactory {
+        Object m(int i);
+    }
+
+    @interface Anno { }
+
+    enum E { }
+
+    interface I { }
+
+    static class Foo<X> { }
+
+    void m(ClassFactory cf) { }
+    void m(ArrayFactory cf) { }
+
+    void testAssign() {
+        ClassFactory c1 = Anno::new; //error
+        ClassFactory c2 = E::new; //error
+        ClassFactory c3 = I::new; //error
+        ClassFactory c4 = Foo<?>::new; //error
+        ClassFactory c5 = 1::new; //error
+        ArrayFactory a1 = Foo<?>[]::new; //ok
+        ArrayFactory a2 = Foo<? extends String>[]::new; //error
+    }
+
+    void testMethod() {
+        m(Anno::new); //error
+        m(E::new); //error
+        m(I::new); //error
+        m(Foo<?>::new); //error
+        m(1::new); //error
+        m(Foo<?>[]::new); //ok - resolves to m(ArrayFactory)
+        m(Foo<? extends String>[]::new); //error
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference64.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,13 @@
+MethodReference64.java:28:27: compiler.err.abstract.cant.be.instantiated: MethodReference64.Anno
+MethodReference64.java:29:27: compiler.err.enum.cant.be.instantiated
+MethodReference64.java:30:27: compiler.err.abstract.cant.be.instantiated: MethodReference64.I
+MethodReference64.java:31:30: compiler.err.type.found.req: ?, (compiler.misc.type.req.exact)
+MethodReference64.java:32:27: compiler.err.unexpected.type: kindname.class, kindname.value
+MethodReference64.java:34:48: compiler.err.generic.array.creation
+MethodReference64.java:38:11: compiler.err.abstract.cant.be.instantiated: MethodReference64.Anno
+MethodReference64.java:39:11: compiler.err.enum.cant.be.instantiated
+MethodReference64.java:40:11: compiler.err.abstract.cant.be.instantiated: MethodReference64.I
+MethodReference64.java:41:14: compiler.err.type.found.req: ?, (compiler.misc.type.req.exact)
+MethodReference64.java:42:11: compiler.err.unexpected.type: kindname.class, kindname.value
+MethodReference64.java:44:32: compiler.err.generic.array.creation
+12 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference65.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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 8009154
+ * @summary Missing cast in method reference bridge leads to NoSuchMethodError
+ */
+public class MethodReference65 {
+
+    interface SAM<X> {
+        void m(X ss, String s);
+    }
+
+    void m(String... s) { }
+
+    public static void main(String[] args) {
+        SAM<MethodReference65> st = MethodReference65::m;
+        st.m(new MethodReference65(), "");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference66.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,52 @@
+/*
+ * 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 8009299
+ * @summary Javac crashes when compiling method reference to static interface method
+ * @run main/othervm -Xverify:none MethodReference66
+ */
+public class MethodReference66 {
+
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    interface SAM {
+        void m(int i);
+    }
+
+    interface I {
+        static void f(int i) { assertTrue(i == 42); }
+    }
+    public static void main(String[] args) {
+        SAM s = I::f;
+        s.m(42);
+        assertTrue(assertionCount == 1);
+    }
+}
--- a/test/tools/javac/lambda/MethodReferenceParserTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/MethodReferenceParserTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -24,24 +24,28 @@
 /*
  * @test
  * @bug 7115052
- * @bug 8003280
+ * @bug 8003280 8006694
  * @summary Add lambda tests
  *  Add parser support for method references
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm MethodReferenceParserTest
  */
 
-import com.sun.source.util.JavacTask;
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.Arrays;
 import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
+import com.sun.source.util.JavacTask;
 
-public class MethodReferenceParserTest {
-
-    static int checkCount = 0;
+public class MethodReferenceParserTest
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum ReferenceKind {
         METHOD_REF("#Q::#Gm"),
@@ -88,7 +92,8 @@
             this.contextTemplate = contextTemplate;
         }
 
-        String contextString(ExprKind ek, ReferenceKind rk, QualifierKind qk, GenericKind gk, SubExprKind sk) {
+        String contextString(ExprKind ek, ReferenceKind rk, QualifierKind qk,
+                GenericKind gk, SubExprKind sk) {
             return contextTemplate.replaceAll("#E", ek.expressionString(rk, qk, gk, sk));
         }
     }
@@ -165,25 +170,21 @@
     }
 
     public static void main(String... args) throws Exception {
-
-        //create default shared JavaCompiler - reused across multiple compilations
-        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
-
         for (ReferenceKind rk : ReferenceKind.values()) {
             for (QualifierKind qk : QualifierKind.values()) {
                 for (GenericKind gk : GenericKind.values()) {
                     for (SubExprKind sk : SubExprKind.values()) {
                         for (ExprKind ek : ExprKind.values()) {
                             for (ContextKind ck : ContextKind.values()) {
-                                new MethodReferenceParserTest(rk, qk, gk, sk, ek, ck).run(comp, fm);
+                                pool.execute(new MethodReferenceParserTest(rk, qk, gk, sk, ek, ck));
                             }
                         }
                     }
                 }
             }
         }
-        System.out.println("Total check executed: " + checkCount);
+
+        checkAfterExec();
     }
 
     ReferenceKind rk;
@@ -227,19 +228,21 @@
         }
     }
 
-    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+    @Override
+    public void run() {
+        JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), diagChecker,
                 null, null, Arrays.asList(source));
         try {
             ct.parse();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thrown when parsing the following source:\n" + source.getCharContent(true));
+            processException(ex);
+            return;
         }
         check();
     }
 
     void check() {
-        checkCount++;
+        checkCount.incrementAndGet();
 
         if (diagChecker.errorFound != rk.erroneous()) {
             throw new Error("invalid diagnostics for source:\n" +
@@ -259,4 +262,5 @@
             }
         }
     }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MostSpecific08.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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 8008813
+ * @summary Structural most specific fails when method reference is passed to overloaded method
+ * @compile MostSpecific08.java
+ */
+class MostSpecific08 {
+
+    static class C {
+        int getInt() { return -1; }
+        Integer getInteger() { return -1; }
+    }
+
+    interface IntResult { }
+    interface ReferenceResult<X> { }
+
+    interface PrimitiveFunction {
+        int f(C c);
+    }
+
+    interface ReferenceFunction<X> {
+        X f(C c);
+    }
+
+    interface Tester {
+        IntResult apply(PrimitiveFunction p);
+        <Z> ReferenceResult<Z> apply(ReferenceFunction<Z> p);
+    }
+
+    void testMref(Tester t) {
+        IntResult pr = t.apply(C::getInt);
+        ReferenceResult<Integer> rr = t.apply(C::getInteger);
+    }
+
+    void testLambda(Tester t) {
+        IntResult pr = t.apply(c->c.getInt());
+        ReferenceResult<Integer> rr = t.apply(c->c.getInteger());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/SerializedLambdaInInit.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,118 @@
+/*
+ * 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 8009742
+@summary Bad method name: Serialized lambda in a constructor or class init
+*/
+
+import java.io.*;
+import java.lang.reflect.Method;
+
+public class SerializedLambdaInInit {
+    static int assertionCount = 0;
+
+    static void assertTrue(boolean cond) {
+        assertionCount++;
+        if (!cond)
+            throw new AssertionError();
+    }
+
+    static LSI cvisi = z -> "[" + z + "]";
+    static LSI cisi;
+
+    static {
+        cisi = z -> z + z;
+    }
+
+    LSI ivsi = z -> "blah";
+    LSI iisi;
+
+    SerializedLambdaInInit() {
+        iisi = z -> "*" + z;
+    }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            // Write lambdas out
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutput out = new ObjectOutputStream(baos);
+            SerializedLambdaInInit slii = new SerializedLambdaInInit();
+
+            write(out, cvisi );
+            write(out, cisi );
+            write(out, slii.ivsi );
+            write(out, slii.iisi );
+            out.flush();
+            out.close();
+
+            // Read them back
+            ByteArrayInputStream bais =
+                new ByteArrayInputStream(baos.toByteArray());
+            ObjectInputStream in = new ObjectInputStream(bais);
+            readAssert(in, "[X]");
+            readAssert(in, "XX");
+            readAssert(in, "blah");
+            readAssert(in, "*X");
+            in.close();
+
+            // Reflectively test for valid method names
+            for (Method meth : slii.getClass().getDeclaredMethods()) {
+                checkIdentifier(meth.getName());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw e;
+        }
+        assertTrue(assertionCount == 4);
+    }
+
+    static void write(ObjectOutput out, LSI lamb) throws IOException {
+        out.writeObject(lamb);
+    }
+
+    static void readAssert(ObjectInputStream in, String expected)  throws IOException, ClassNotFoundException {
+        LSI ls = (LSI) in.readObject();
+        String result = ls.convert("X");
+        System.out.printf("Result: %s\n", result);
+        assertTrue(result.equals(expected));
+    }
+
+    public static void checkIdentifier(String str) throws Exception {
+        // null and zero length identifers will throw their own exceptions
+        char[] chars = str.toCharArray();
+        if (!Character.isJavaIdentifierStart(chars[0])) {
+            throw new IllegalArgumentException(str + ": bad identifier start character: '" + chars[0] + "'");
+        }
+        for (char ch : chars) {
+            if (!Character.isJavaIdentifierPart(ch)) {
+                throw new IllegalArgumentException(str + ": bad identifier character: '" + ch + "'");
+            }
+        }
+    }
+}
+
+interface LSI extends Serializable {
+    String convert(String x);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/StaticMethodNegTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,26 @@
+/**
+ * @test    /nodynamiccopyright/
+ * @bug     8008337
+ * @author  sogoel
+ * @summary static method is called via super
+ * @compile/fail/ref=StaticMethodNegTest.out -XDrawDiagnostics StaticMethodNegTest.java
+ */
+
+interface A {
+  static String m() {
+    return "A";
+  }
+}
+
+interface B {
+  static String m() {
+    return "B";
+  }
+}
+
+interface AB extends A, B {
+ static String m() {
+   return A.super.m();
+ }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/StaticMethodNegTest.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+StaticMethodNegTest.java:23:12: compiler.err.not.encl.class: A
+1 error
--- a/test/tools/javac/lambda/TargetType01.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType01.java	Tue Jul 02 10:13:00 2013 +0100
@@ -27,7 +27,7 @@
  * @summary Add lambda tests
  *  check nested case of overload resolution and lambda parameter inference
  * @author  Maurizio Cimadamore
- * @compile TargetType01.java
+ * @compile/fail/ref=TargetType01.out -XDrawDiagnostics TargetType01.java
  */
 
 class TargetType01 {
@@ -43,7 +43,6 @@
     static String M(F_S_S f){ return null; }
 
     static {
-        //ambiguity here - the compiler does not try all the combinations!
-        M(x1 -> { return M( x2 -> { return x1 + x2; });});
+        M(x1 -> { return M( x2 -> { return x1 + x2; });}); //ambiguous
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType01.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,3 @@
+TargetType01.java:46:9: compiler.err.ref.ambiguous: M, kindname.method, M(TargetType01.F_I_I), TargetType01, kindname.method, M(TargetType01.F_S_S), TargetType01
+TargetType01.java:46:26: compiler.err.ref.ambiguous: M, kindname.method, M(TargetType01.F_I_I), TargetType01, kindname.method, M(TargetType01.F_S_S), TargetType01
+2 errors
--- a/test/tools/javac/lambda/TargetType06.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType06.java	Tue Jul 02 10:13:00 2013 +0100
@@ -4,7 +4,7 @@
  * @summary Add lambda tests
  *  check complex case of target typing
  * @author  Maurizio Cimadamore
- * @compile/fail/ref=TargetType06.out -XDrawDiagnostics TargetType06.java
+ * @compile TargetType06.java
  */
 
 import java.util.List;
--- a/test/tools/javac/lambda/TargetType06.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-TargetType06.java:25:23: compiler.err.cant.apply.symbol: kindname.method, map, TargetType06.Function<B,B>, @510, kindname.class, TargetType06, (compiler.misc.cyclic.inference: B)
-1 error
--- a/test/tools/javac/lambda/TargetType10.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType10.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-TargetType10.java:17:11: compiler.err.cant.apply.symbol: kindname.method, compose, TargetType10.Function<B,C>,TargetType10.Function<A,? extends B>, @500,@515, kindname.class, TargetType10.Test, (compiler.misc.cyclic.inference: B,A)
+TargetType10.java:17:18: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: B,A)
 1 error
--- a/test/tools/javac/lambda/TargetType11.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType11.java	Tue Jul 02 10:13:00 2013 +0100
@@ -4,7 +4,7 @@
  * @summary Add lambda tests
  *  check that wildcards in the target method of a lambda conversion is handled correctly
  * @author  Maurizio Cimadamore
- * @compile/fail/ref=TargetType11.out -Xlint:unchecked -XDrawDiagnostics TargetType11.java
+ * @compile TargetType11.java
  */
 
 class TargetType11 {
--- a/test/tools/javac/lambda/TargetType11.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-TargetType11.java:16:61: compiler.warn.unchecked.varargs.non.reifiable.type: TargetType11.Predicate<? super T>
-TargetType11.java:20:32: compiler.err.cant.apply.symbol: kindname.method, and, TargetType11.Predicate<? super T>[], @706,@718, kindname.class, TargetType11.Test, (compiler.misc.cyclic.inference: T)
-1 error
-1 warning
--- a/test/tools/javac/lambda/TargetType14.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType14.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-TargetType14.java:20:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: TargetType14.SAM<java.lang.String>, TargetType14.SAM<java.lang.Integer>)
+TargetType14.java:20:29: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.lower.bounds: X, java.lang.Integer, java.lang.String)
 1 error
--- a/test/tools/javac/lambda/TargetType17.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType17.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,9 +1,9 @@
-TargetType17.java:14:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:15:23: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:16:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:17:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:18:23: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:19:25: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:20:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
-TargetType17.java:21:27: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+TargetType17.java:14:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: byte)
+TargetType17.java:15:23: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: short)
+TargetType17.java:16:19: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: int)
+TargetType17.java:17:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: long)
+TargetType17.java:18:23: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: float)
+TargetType17.java:19:25: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: double)
+TargetType17.java:20:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: char)
+TargetType17.java:21:27: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: boolean)
 8 errors
--- a/test/tools/javac/lambda/TargetType20.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType20.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,10 +1,33 @@
 /*
- * @test /nodynamiccopyright/
+ * 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 8003280
  * @summary Add lambda tests
  *  complex case of lambda return type that depends on generic method
  *          inference variable
- * @compile/fail/ref=TargetType20.out -XDrawDiagnostics TargetType20.java
+ * @compile -XDrawDiagnostics TargetType20.java
  */
 import java.util.*;
 
--- a/test/tools/javac/lambda/TargetType20.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-TargetType20.java:19:10: compiler.err.cant.apply.symbol: kindname.method, call, TargetType20.SAM2<Z>,TargetType20.SAM2<Z>, @428,@459, kindname.class, TargetType20.Test, (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.String, java.lang.String,java.lang.Object)
-1 error
--- a/test/tools/javac/lambda/TargetType21.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType21.java	Tue Jul 02 10:13:00 2013 +0100
@@ -25,9 +25,9 @@
     <R,A> void call(SAM3<R,A> sam) { }
 
     void test() {
-        call(x -> { throw new Exception(); }); //ok - resolves to call(SAM1)
-        call(x -> { System.out.println(""); }); //ok - resolves to call(SAM2)
-        call(x -> { return (Object) null; }); //error - call(SAM3) is not applicable because of cyclic inference
-        call(x -> { return null; }); ////ok - resolves to call(SAM1)
+        call(x -> { throw new Exception(); }); //ambiguous
+        call(x -> { System.out.println(""); }); //ambiguous
+        call(x -> { return (Object) null; }); //cyclic inference
+        call(x -> { return null; }); //ambiguous
     }
 }
--- a/test/tools/javac/lambda/TargetType21.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType21.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,6 @@
-TargetType21.java:28:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM1), TargetType21, kindname.method, call(TargetType21.SAM2), TargetType21
-TargetType21.java:30:9: compiler.err.cant.apply.symbols: kindname.method, call, @755,{(compiler.misc.inapplicable.method: kindname.method, TargetType21, call(TargetType21.SAM1), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, TargetType21, call(TargetType21.SAM2), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.unexpected.ret.val)))),(compiler.misc.inapplicable.method: kindname.method, TargetType21, <R,A>call(TargetType21.SAM3<R,A>), (compiler.misc.cyclic.inference: A))}
-2 errors
+TargetType21.java:28:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM2), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
+TargetType21.java:28:14: compiler.err.incompatible.thrown.types.in.lambda: java.lang.Exception
+TargetType21.java:29:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM2), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
+TargetType21.java:30:13: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: A)
+TargetType21.java:31:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM1), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
+5 errors
--- a/test/tools/javac/lambda/TargetType26.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType26.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-TargetType26.java:16:7: compiler.err.cant.apply.symbol: kindname.method, call, Z, @340, kindname.class, TargetType26, (compiler.misc.cyclic.inference: Z)
+TargetType26.java:16:11: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: Z)
 1 error
--- a/test/tools/javac/lambda/TargetType27.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType27.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-TargetType27.java:18:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType27.F<A,R>, @490, kindname.class, TargetType27, (compiler.misc.cyclic.inference: R)
+TargetType27.java:18:10: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: R)
 1 error
--- a/test/tools/javac/lambda/TargetType28.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType28.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,2 @@
-TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: TargetType28.SuperFoo<java.lang.Number>, TargetType28.SuperFoo<java.lang.String>)
-TargetType28.java:21:33: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: TargetType28.SuperFoo<java.lang.Number>, TargetType28.SuperFoo<java.lang.Integer>)
-2 errors
+TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, R,java.lang.String, java.lang.Object,java.lang.Number)
+1 error
--- a/test/tools/javac/lambda/TargetType39.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType39.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,3 +1,3 @@
-TargetType39.java:19:9: compiler.err.cant.apply.symbol: kindname.method, call, TargetType39.SAM<U,V>, @442, kindname.class, TargetType39, (compiler.misc.cyclic.inference: U)
-TargetType39.java:20:9: compiler.err.cant.apply.symbol: kindname.method, call, TargetType39.SAM<U,V>, @479, kindname.class, TargetType39, (compiler.misc.cyclic.inference: V)
+TargetType39.java:19:13: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: U)
+TargetType39.java:20:13: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: V)
 2 errors
--- a/test/tools/javac/lambda/TargetType43.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType43.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
-TargetType43.java:13:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+TargetType43.java:13:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
 TargetType43.java:13:30: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, TargetType43, null)
-TargetType43.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, java.lang.Object, @359, kindname.class, TargetType43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf))
+TargetType43.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, java.lang.Object, @359, kindname.class, TargetType43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
 TargetType43.java:14:21: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, TargetType43, null)
 4 errors
--- a/test/tools/javac/lambda/TargetType45.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType45.java	Tue Jul 02 10:13:00 2013 +0100
@@ -3,7 +3,7 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  compiler crashes during flow analysis as it fails to report diagnostics during attribution
- * @compile/fail/ref=TargetType45.out -XDrawDiagnostics TargetType45.java
+ * @compile TargetType45.java
  */
 class TargetType45 {
 
--- a/test/tools/javac/lambda/TargetType45.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-TargetType45.java:27:28: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: U,V, (compiler.misc.inconvertible.types: TargetType45.Mapper<java.lang.String,java.lang.Integer>, TargetType45.Mapper<? super java.lang.Object,? extends java.lang.Integer>))
-1 error
--- a/test/tools/javac/lambda/TargetType50.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TargetType50.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,9 +1,32 @@
 /*
- * @test /nodynamiccopyright/
+ * 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 8003280
  * @summary Add lambda tests
  *  bad stuck check for method reference leads to javac crash
- * @compile/fail/ref=TargetType50.out -XDrawDiagnostics TargetType50.java
+ * @compile TargetType50.java
  */
 import java.util.*;
 
@@ -17,7 +40,7 @@
         static <Z> Sink<Z> make() { return null; }
     }
 
-    <Y, S extends Sink<Y>> List<Y> m(Factory<S> factory) {  }
+    <Y, S extends Sink<Y>> List<Y> m(Factory<S> factory) { return null; }
 
     void test() {
         List<?> l1 = m(Sink::new);
--- a/test/tools/javac/lambda/TargetType50.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-TargetType50.java:25:28: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.String, java.lang.String,java.lang.Object)
-TargetType50.java:26:28: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.String, java.lang.String,java.lang.Object)
-2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType51.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,68 @@
+/*
+ * 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 8005244
+ * @summary Implement overload resolution as per latest spec EDR
+ *          smoke test for combinator-like stuck analysis
+ * @author  Maurizio Cimadamore
+ * @compile TargetType51.java
+ */
+
+import java.util.Comparator;
+
+class TargetType51 {
+
+    interface SimpleMapper<T, U> {
+       T map(U t);
+    }
+
+    interface SimpleList<X> {
+        SimpleList<X> sort(Comparator<? super X> c);
+    }
+
+    static class Person {
+        String getName() { return ""; }
+    }
+
+    <T, U extends Comparable<? super U>> Comparator<T> comparing(SimpleMapper<U, T> mapper) {  return null; }
+
+    static class F<U extends Comparable<? super U>, T> {
+        F(SimpleMapper<U, T> f) { }
+    }
+
+    void testAssignmentContext(SimpleList<Person> list, boolean cond) {
+        SimpleList<Person> p1 = list.sort(comparing(Person::getName));
+        SimpleList<Person> p2 = list.sort(comparing(x->x.getName()));
+        SimpleList<Person> p3 = list.sort(cond ? comparing(Person::getName) : comparing(x->x.getName()));
+        SimpleList<Person> p4 = list.sort((cond ? comparing(Person::getName) : comparing(x->x.getName())));
+    }
+
+    void testMethodContext(SimpleList<Person> list, boolean cond) {
+        testMethodContext(list.sort(comparing(Person::getName)), true);
+        testMethodContext(list.sort(comparing(x->x.getName())), true);
+        testMethodContext(list.sort(cond ? comparing(Person::getName) : comparing(x->x.getName())), true);
+        testMethodContext(list.sort((cond ? comparing(Person::getName) : comparing(x->x.getName()))), true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType52.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8005244
+ * @summary Implement overload resolution as per latest spec EDR
+ *          uncatched sam conversion failure exception lead to javac crash
+ * @compile/fail/ref=TargetType52.out -XDrawDiagnostics TargetType52.java
+ */
+class TargetType52 {
+
+    interface FI<T extends CharSequence, V extends java.util.AbstractList<T>> {
+        T m(V p);
+    }
+
+    void m(FI<? extends CharSequence, ? extends java.util.ArrayList<? extends CharSequence>> fip) { }
+
+    void test() {
+        m(p -> p.get(0));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType52.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+TargetType52.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, TargetType52.FI<? extends java.lang.CharSequence,? extends java.util.ArrayList<? extends java.lang.CharSequence>>, @525, kindname.class, TargetType52, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.no.suitable.functional.intf.inst: TargetType52.FI<java.lang.CharSequence,java.util.ArrayList<? extends java.lang.CharSequence>>))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType53.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,47 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          smoke test for graph inference
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType53.java
+ */
+import java.util.*;
+import java.util.stream.*;
+import java.util.function.*;
+
+class TargetType53 {
+
+    <P> List<List<P>> perm(List<P> l) { return null; }
+
+    void g(List<List<UnaryOperator<IntStream>>> l) { }
+
+    void test() {
+        List<List<UnaryOperator<IntStream>>> l =
+            perm(Arrays.asList(s -> s.sorted()));
+        g(perm(Arrays.asList(s -> s.sorted())));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType54.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          smoke test for graph inference
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType54.java
+ */
+import java.util.stream.*;
+import java.util.*;
+import static java.util.stream.Collectors.*;
+
+class TargetType54 {
+    void test(Stream<Integer> si) {
+        List<Integer> l1 = si.collect(toList());
+        List<Integer> l2 = si.collect(toCollection(ArrayList::new));
+        m(si.collect(toList()));
+        m(si.collect(toCollection(ArrayList::new)));
+    }
+
+    void m(List<Integer> l) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType55.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,42 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference
+ *          support smoke test for graph inference
+ * @compile TargetType55.java
+ */
+import java.util.function.*;
+
+class TargetType55  {
+
+    <R> void m(Function<Integer, R> collector) { }
+
+    <T, D> Function<T, Integer> g(D d, BinaryOperator<D> reducer) { return null; }
+
+    public void test() {
+        m(g((Integer)null, (x,y)->1));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType56.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          smoke test for graph inference
+ * @compile TargetType56.java
+ */
+class TargetType56 {
+    <Z> Z m(Z z) { return null; }
+
+    void test() {
+        double d1 = m(1);
+        double d2 = m((Integer)null);
+        double d3 = m(m(1));
+        double d4 = m(m((Integer)null));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType57.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8007464
+ * @summary Add graph inference support
+ *          more smoke tests for graph inference
+ * @compile/fail/ref=TargetType57.out -XDrawDiagnostics TargetType57.java
+ */
+import java.util.*;
+import java.util.function.*;
+
+class TargetType57 {
+
+    void test(List<Integer> list) {
+        m(list, s -> s.intValue(), s -> s.nonExistentMethod());
+    }
+
+    <U, R, S_IN, S_OUT> R m(List<S_IN> list,
+                        Function<S_IN, S_OUT> f1,
+                        Function<S_OUT, R> f2) { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType57.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+TargetType57.java:14:42: compiler.err.cant.resolve.location.args: kindname.method, nonExistentMethod, , , (compiler.misc.location.1: kindname.variable, s, java.lang.Integer)
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType58.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,46 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          more smoke tests for graph inference
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType58.java
+ */
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+class TargetType58 {
+
+    void test(List<Integer> li) {
+        g(li, s -> s.substream(200), Collections.emptyList());
+    }
+
+    <T, U, S_OUT extends Stream<U>,
+            I extends Iterable<U>> Collection<U> g(Collection<T> coll, Function<Stream<T>, S_OUT> f, I i) {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType59.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,49 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          more smoke tests for graph inference
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType59.java
+ */
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+class TargetType59 {
+
+    <T, R> Collector<T, R> m(Supplier<? extends R> supplier, BiConsumer<R, T> accumulator) {
+        return null;
+    }
+
+    <T, C extends Collection<T>> Collector<T,C> test1(Supplier<C> collectionFactory) {
+        return m(collectionFactory, Collection::add);
+    }
+
+    Collector<String, StringBuilder> test2(Supplier<StringBuilder> sb) {
+        return m(sb, StringBuilder::append);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType60.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,65 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8007462
+ * @summary Fix provisional applicability for method references
+ * @compile/fail/ref=TargetType60.out -XDrawDiagnostics TargetType60.java
+ */
+class TargetType60 {
+
+    interface Sam0 {
+        void m();
+    }
+
+    interface Sam1<X> {
+        void m(X x);
+    }
+
+    interface Sam2<X,Y> {
+        void m(X x, Y y);
+    }
+
+    void m0() { }
+    void m1(String s) { }
+    void m2(String s1, String s2) { }
+
+    void m01() { }
+    void m01(String s) { }
+
+    void m012() { }
+    void m012(String s) { }
+    void m012(String s1, String s2) { }
+
+    void n0() { }
+    void n1(String s) { }
+    void n2(TargetType60 rec, String s2) { }
+
+    void n01() { }
+    void n01(String s) { }
+
+    void n012() { }
+    void n012(String s) { }
+    void n012(TargetType60 rec, String s2) { }
+
+    static String g(Sam0 s) { return null; }
+    static <U> U g(Sam1<U> s) { return null; }
+    static <U> U g(Sam2<U,String> s) { return null; }
+
+    static <U> U u(Sam1<U> s) { return null; }
+    static <U> U u(Sam2<U,String> s) { return null; }
+
+    void testBound() {
+        String s1 = g(this::m0); //ok - resolves to g(Sam0)
+        String s2 = g(this::m1); //ok - resolves to g(Sam1)
+        String s3 = g(this::m2); //ok - resolves to g(Sam2)
+        String s4 = g(this::m01);//ambiguous (g(Sam0), g(Sam1) apply)
+        String s5 = g(this::m012);//ambiguous (g(Sam0), g(Sam1), g(Sam2) apply)
+    }
+
+    static void testUnbound() {
+        TargetType60 s1 = u(TargetType60::n0); //ok - resolves to u(Sam1)
+        TargetType60 s2 = u(TargetType60::n1); //ambiguous (u(Sam1), u(Sam2) apply)
+        TargetType60 s3 = u(TargetType60::n2); //none is applicable
+        TargetType60 s4 = u(TargetType60::n01);//ambiguous (u(Sam1), u(Sam2) apply)
+        TargetType60 s5 = u(TargetType60::n012);//ambiguous (u(Sam1), u(Sam2) apply)
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType60.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,8 @@
+TargetType60.java:54:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60
+TargetType60.java:55:21: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60
+TargetType60.java:60:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
+TargetType60.java:60:28: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, n1, java.lang.String, TargetType60, kindname.class, TargetType60, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: TargetType60, java.lang.String)))))
+TargetType60.java:61:29: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, n2(TargetType60,java.lang.String))
+TargetType60.java:62:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
+TargetType60.java:63:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
+7 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType61.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,47 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          check that new wildcards inference strategy doesn't run into 7190296
+ * @compile TargetType61.java
+ */
+class TargetType61 {
+
+    interface Stream<T> {
+        void forEach(Sink<? super T> sink);
+    }
+
+    interface Sink<T> {
+        void put(T t);
+    }
+
+    public boolean add(CharSequence s) { return false; }
+
+    public void addAll(Stream<? extends CharSequence> stream) {
+        stream.forEach(this::add);
+        stream.forEach(e -> { add(e); });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType62.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,46 @@
+/*
+ * 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 8007464
+ * @summary Add graph inference support
+ *          check that new wildcards inference strategy doesn't run into 7190296
+ * @ignore  awaits stream API: 800NNNN
+ * @compile TargetType62.java
+ */
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+class TargetType61 {
+
+    Collector test(Function<Integer, Integer> classifier) {
+        return g(classifier, TreeMap::new, m(HashSet::new));
+    }
+
+    <R> Collector<Integer, R> m(Supplier<R> s) { return null; }
+
+    <T, K, D, M extends Map<K, D>>
+            Collector<T, M> g(Function<T, K> classifier, Supplier<M> mapFactory, Collector<T, D> downstream) { return null; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType64.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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 8008293
+ * @summary Declared bounds not considered when functional interface containing unbound wildcards is instantiated
+ * @compile TargetType64.java
+ */
+class TargetType64 {
+    interface SAM<X extends Number> {
+        void m(X x);
+    }
+
+    void g(Object o) { }
+
+    void test() {
+        SAM<?> s1 = (x)->{};
+        SAM<?> s2 = this::g;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType65.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,58 @@
+/*
+ * 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 8008723
+ * @summary Graph Inference: bad graph calculation leads to assertion error
+ * @compile TargetType65.java
+ */
+class TargetType65 {
+    interface Predicate<X> {
+        boolean accepts(X x);
+    }
+
+    static class Optional<T> {
+        public boolean isPresent() { return false; }
+        public static<E> Optional<E> empty() { return null; }
+    }
+
+    interface Supplier<X> {
+        X make();
+    }
+
+    static class Sink<O, T> { }
+
+    static class SubSink<R> extends Sink<R, Optional<R>> {  }
+
+    static class Tester<T, O> {
+        public static <F> Tester<F, Optional<F>> makeRef() {
+            return new Tester<>(Optional.empty(), Optional::isPresent, SubSink::new);
+        }
+
+        private Tester(O emptyValue,
+                       Predicate<O> presentPredicate,
+                       Supplier<Sink<T, O>> sinkSupplier) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType67.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * 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 8010303
+ * @summary Graph inference: missing incorporation step causes spurious inference error
+ * @compile TargetType67.java
+ */
+class TargetType67 {
+
+    interface Func<A, B> {
+        B f(A a);
+    }
+
+    class List<X> {
+
+        <M> List<M> map(Func<X, M> f) {
+            return null;
+        }
+
+        <A> List<A> apply(final List<Func<X, A>> lf) {
+            return null;
+        }
+
+        <B, C> List<C> bind(final List<B> lb, final Func<X, Func<B, C>> f) {
+            return lb.apply(map(f));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType68.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,63 @@
+/*
+ * 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 8010303
+ * @summary Graph inference: missing incorporation step causes spurious inference error
+ * @compile TargetType68.java
+ */
+import java.util.*;
+
+class TargetType68 {
+
+    //derived from FX 2.2 API
+    static class XYChart<X,Y> {
+        static final class Series<X,Y> {
+            Series(java.lang.String name, ObservableList<XYChart.Data<X,Y>> data) { }
+        }
+
+        static final class Data<X,Y> { }
+
+        ObservableList<XYChart.Series<X,Y>> getData() { return null; }
+    }
+
+    //derived from FX 2.2 API
+    interface ObservableList<X> extends List<X> {
+        boolean setAll(Collection<? extends X> col);
+    }
+
+    //derived from FX 2.2 API
+    static class FXCollections {
+        static <E> ObservableList<E> observableList(List<E> l) { return null; }
+    }
+
+    private void testMethod() {
+            XYChart<Number, Number> numberChart = null;
+            List<XYChart.Data<Number, Number>> data_1 = new ArrayList<>();
+            List<XYChart.Data<Number, Number>> data_2 = new ArrayList<>();
+            numberChart.getData().setAll(
+                    Arrays.asList(new XYChart.Series<>("Data", FXCollections.observableList(data_1)),
+                    new XYChart.Series<>("Data", FXCollections.observableList(data_2))));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType69.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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 8010303
+ * @summary Graph inference: missing incorporation step causes spurious inference error
+ * @compile TargetType68.java
+ */
+import java.util.*;
+
+class TargetType68 {
+
+    interface Function<X,Y> {
+        Y m(X x);
+    }
+
+    abstract class TabulationAssertion<T, U> { }
+
+    class GroupedMapAssertion<K, M1 extends Map<K, ?>> extends TabulationAssertion<Integer, M1> {
+        GroupedMapAssertion(Function<Integer, K> classifier) { }
+    }
+
+
+    <T, M2 extends Map> void exerciseMapTabulation(Function<T, ? extends M2> collector,
+                                                             TabulationAssertion<T, M2> assertion)  { }
+
+    void test(Function<Integer, Integer> classifier, Function<Integer, Map<Integer, List<Integer>>> coll) {
+        exerciseMapTabulation(coll, new GroupedMapAssertion<>(classifier));
+    }
+}
--- a/test/tools/javac/lambda/TestInvokeDynamic.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/TestInvokeDynamic.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -24,13 +24,18 @@
 /*
  * @test
  * @bug 7194586
- *
- * @bug 8003280
+ * @bug 8003280 8006694
  * @summary Add lambda tests
  *  Add back-end support for invokedynamic
- *
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm TestInvokeDynamic
  */
 
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import com.sun.source.tree.MethodInvocationTree;
 import com.sun.source.tree.MethodTree;
 import com.sun.source.util.TaskEvent;
@@ -46,7 +51,6 @@
 import com.sun.tools.classfile.Method;
 
 import com.sun.tools.javac.api.JavacTaskImpl;
-import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
 import com.sun.tools.javac.code.Symtab;
@@ -65,78 +69,85 @@
 import java.util.Locale;
 
 import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
 
 import static com.sun.tools.javac.jvm.ClassFile.*;
 
-public class TestInvokeDynamic {
-
-    static int checkCount = 0;
+public class TestInvokeDynamic
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum StaticArgumentKind {
         STRING("Hello!", "String", "Ljava/lang/String;") {
             @Override
             boolean check(CPInfo cpInfo) throws Exception {
                 return (cpInfo instanceof CONSTANT_String_info) &&
-                        ((CONSTANT_String_info)cpInfo).getString().equals(value);
+                        ((CONSTANT_String_info)cpInfo).getString()
+                        .equals(value);
             }
         },
         CLASS(null, "Class<?>", "Ljava/lang/Class;") {
             @Override
             boolean check(CPInfo cpInfo) throws Exception {
                 return (cpInfo instanceof CONSTANT_Class_info) &&
-                        ((CONSTANT_Class_info)cpInfo).getName().equals("java/lang/String");
+                        ((CONSTANT_Class_info)cpInfo).getName()
+                        .equals("java/lang/String");
             }
         },
         INTEGER(1, "int", "I") {
             @Override
             boolean check(CPInfo cpInfo) throws Exception {
                 return (cpInfo instanceof CONSTANT_Integer_info) &&
-                        ((CONSTANT_Integer_info)cpInfo).value == ((Integer)value).intValue();
+                        ((CONSTANT_Integer_info)cpInfo).value ==
+                        ((Integer)value).intValue();
             }
         },
         LONG(1L, "long", "J") {
             @Override
             boolean check(CPInfo cpInfo) throws Exception {
                 return (cpInfo instanceof CONSTANT_Long_info) &&
-                        ((CONSTANT_Long_info)cpInfo).value == ((Long)value).longValue();
+                        ((CONSTANT_Long_info)cpInfo).value ==
+                        ((Long)value).longValue();
             }
         },
         FLOAT(1.0f, "float", "F") {
             @Override
             boolean check(CPInfo cpInfo) throws Exception {
                 return (cpInfo instanceof CONSTANT_Float_info) &&
-                        ((CONSTANT_Float_info)cpInfo).value == ((Float)value).floatValue();
+                        ((CONSTANT_Float_info)cpInfo).value ==
+                        ((Float)value).floatValue();
             }
         },
         DOUBLE(1.0, "double","D") {
             @Override
             boolean check(CPInfo cpInfo) throws Exception {
                 return (cpInfo instanceof CONSTANT_Double_info) &&
-                        ((CONSTANT_Double_info)cpInfo).value == ((Double)value).doubleValue();
+                        ((CONSTANT_Double_info)cpInfo).value ==
+                        ((Double)value).doubleValue();
             }
         },
         METHOD_HANDLE(null, "MethodHandle", "Ljava/lang/invoke/MethodHandle;") {
             @Override
             boolean check(CPInfo cpInfo) throws Exception {
-                if (!(cpInfo instanceof CONSTANT_MethodHandle_info)) return false;
-                CONSTANT_MethodHandle_info handleInfo = (CONSTANT_MethodHandle_info)cpInfo;
+                if (!(cpInfo instanceof CONSTANT_MethodHandle_info))
+                    return false;
+                CONSTANT_MethodHandle_info handleInfo =
+                        (CONSTANT_MethodHandle_info)cpInfo;
                 return handleInfo.getCPRefInfo().getClassName().equals("Array") &&
                         handleInfo.reference_kind == RefKind.REF_invokeVirtual &&
-                        handleInfo.getCPRefInfo().getNameAndTypeInfo().getName().equals("clone") &&
-                        handleInfo.getCPRefInfo().getNameAndTypeInfo().getType().equals("()Ljava/lang/Object;");
+                        handleInfo.getCPRefInfo()
+                        .getNameAndTypeInfo().getName().equals("clone") &&
+                        handleInfo.getCPRefInfo()
+                        .getNameAndTypeInfo().getType().equals("()Ljava/lang/Object;");
             }
         },
         METHOD_TYPE(null, "MethodType", "Ljava/lang/invoke/MethodType;") {
             @Override
             boolean check(CPInfo cpInfo) throws Exception {
                 return (cpInfo instanceof CONSTANT_MethodType_info) &&
-                        ((CONSTANT_MethodType_info)cpInfo).getType().equals("()Ljava/lang/Object;");
+                        ((CONSTANT_MethodType_info)cpInfo).getType()
+                        .equals("()Ljava/lang/Object;");
             }
         };
 
@@ -144,7 +155,8 @@
         String sourceTypeStr;
         String bytecodeTypeStr;
 
-        StaticArgumentKind(Object value, String sourceTypeStr, String bytecodeTypeStr) {
+        StaticArgumentKind(Object value, String sourceTypeStr,
+                String bytecodeTypeStr) {
             this.value = value;
             this.sourceTypeStr = sourceTypeStr;
             this.bytecodeTypeStr = bytecodeTypeStr;
@@ -163,7 +175,8 @@
                 case CLASS:
                     return syms.stringType.tsym;
                 case METHOD_HANDLE:
-                    return new Pool.MethodHandle(REF_invokeVirtual, syms.arrayCloneMethod, types);
+                    return new Pool.MethodHandle(REF_invokeVirtual,
+                            syms.arrayCloneMethod, types);
                 case METHOD_TYPE:
                     return syms.arrayCloneMethod.type;
                 default:
@@ -186,23 +199,21 @@
     }
 
     public static void main(String... args) throws Exception {
-        // Create a single file manager and compiler and reuse it for each compile to save time.
-        StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
-        final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         for (StaticArgumentsArity arity : StaticArgumentsArity.values()) {
             if (arity.arity == 0) {
-                new TestInvokeDynamic(arity).compileAndCheck(fm, tool);
+                pool.execute(new TestInvokeDynamic(arity));
             } else {
                 for (StaticArgumentKind sak1 : StaticArgumentKind.values()) {
                     if (arity.arity == 1) {
-                        new TestInvokeDynamic(arity, sak1).compileAndCheck(fm, tool);
+                        pool.execute(new TestInvokeDynamic(arity, sak1));
                     } else {
                         for (StaticArgumentKind sak2 : StaticArgumentKind.values()) {
                             if (arity.arity == 2) {
-                                new TestInvokeDynamic(arity, sak1, sak2).compileAndCheck(fm, tool);
+                                pool.execute(new TestInvokeDynamic(arity, sak1, sak2));
                             } else {
                                 for (StaticArgumentKind sak3 : StaticArgumentKind.values()) {
-                                    new TestInvokeDynamic(arity, sak1, sak2, sak3).compileAndCheck(fm, tool);
+                                    pool.execute(
+                                        new TestInvokeDynamic(arity, sak1, sak2, sak3));
                                 }
                             }
                         }
@@ -211,23 +222,23 @@
             }
         }
 
-        System.out.println("Total checks made: " + checkCount);
+        checkAfterExec();
     }
 
     StaticArgumentsArity arity;
     StaticArgumentKind[] saks;
-    JavaSource source;
     DiagChecker dc;
 
     TestInvokeDynamic(StaticArgumentsArity arity, StaticArgumentKind... saks) {
         this.arity = arity;
         this.saks = saks;
-        source = new JavaSource();
         dc = new DiagChecker();
     }
 
-    void compileAndCheck(JavaFileManager fm, JavaCompiler tool) throws Exception {
-        JavacTaskImpl ct = (JavacTaskImpl)tool.getTask(null, fm, dc,
+    public void run() {
+        int id = checkCount.incrementAndGet();
+        JavaSource source = new JavaSource(id);
+        JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
                 null, null, Arrays.asList(source));
         Context context = ct.getContext();
         Symtab syms = Symtab.instance(context);
@@ -238,16 +249,20 @@
             ct.generate();
         } catch (Throwable t) {
             t.printStackTrace();
-            throw new AssertionError(String.format("Error thrown when compiling following code\n%s", source.source));
+            throw new AssertionError(
+                    String.format("Error thrown when compiling following code\n%s",
+                    source.source));
         }
         if (dc.diagFound) {
-            throw new AssertionError(String.format("Diags found when compiling following code\n%s\n\n%s", source.source, dc.printDiags()));
+            throw new AssertionError(
+                    String.format("Diags found when compiling following code\n%s\n\n%s",
+                    source.source, dc.printDiags()));
         }
-        verifyBytecode();
+        verifyBytecode(id);
     }
 
-    void verifyBytecode() {
-        File compiledTest = new File("Test.class");
+    void verifyBytecode(int id) {
+        File compiledTest = new File(String.format("Test%d.class", id));
         try {
             ClassFile cf = ClassFile.read(compiledTest);
             Method testMethod = null;
@@ -260,7 +275,8 @@
             if (testMethod == null) {
                 throw new Error("Test method not found");
             }
-            Code_attribute ea = (Code_attribute)testMethod.attributes.get(Attribute.Code);
+            Code_attribute ea =
+                    (Code_attribute)testMethod.attributes.get(Attribute.Code);
             if (testMethod == null) {
                 throw new Error("Code attribute for test() method not found");
             }
@@ -270,10 +286,12 @@
             for (Instruction i : ea.getInstructions()) {
                 if (i.getMnemonic().equals("invokedynamic")) {
                     CONSTANT_InvokeDynamic_info indyInfo =
-                            (CONSTANT_InvokeDynamic_info)cf.constant_pool.get(i.getShort(1));
+                         (CONSTANT_InvokeDynamic_info)cf
+                            .constant_pool.get(i.getShort(1));
                     bsmIdx = indyInfo.bootstrap_method_attr_index;
                     if (!indyInfo.getNameAndTypeInfo().getType().equals("()V")) {
-                        throw new AssertionError("type mismatch for CONSTANT_InvokeDynamic_info");
+                        throw new
+                            AssertionError("type mismatch for CONSTANT_InvokeDynamic_info");
                     }
                 }
             }
@@ -281,34 +299,41 @@
                 throw new Error("Missing invokedynamic in generated code");
             }
 
-            BootstrapMethods_attribute bsm_attr = (BootstrapMethods_attribute)cf.getAttribute(Attribute.BootstrapMethods);
+            BootstrapMethods_attribute bsm_attr =
+                    (BootstrapMethods_attribute)cf
+                    .getAttribute(Attribute.BootstrapMethods);
             if (bsm_attr.bootstrap_method_specifiers.length != 1) {
-                throw new Error("Bad number of method specifiers in BootstrapMethods attribute");
+                throw new Error("Bad number of method specifiers " +
+                        "in BootstrapMethods attribute");
             }
             BootstrapMethods_attribute.BootstrapMethodSpecifier bsm_spec =
                     bsm_attr.bootstrap_method_specifiers[0];
 
             if (bsm_spec.bootstrap_arguments.length != arity.arity) {
-                throw new Error("Bad number of static invokedynamic args in BootstrapMethod attribute");
+                throw new Error("Bad number of static invokedynamic args " +
+                        "in BootstrapMethod attribute");
             }
 
             int count = 0;
             for (StaticArgumentKind sak : saks) {
-                if (!sak.check(cf.constant_pool.get(bsm_spec.bootstrap_arguments[count]))) {
+                if (!sak.check(cf.constant_pool
+                        .get(bsm_spec.bootstrap_arguments[count]))) {
                     throw new Error("Bad static argument value " + sak);
                 }
                 count++;
             }
 
             CONSTANT_MethodHandle_info bsm_handle =
-                    (CONSTANT_MethodHandle_info)cf.constant_pool.get(bsm_spec.bootstrap_method_ref);
+                    (CONSTANT_MethodHandle_info)cf.constant_pool
+                    .get(bsm_spec.bootstrap_method_ref);
 
             if (bsm_handle.reference_kind != RefKind.REF_invokeStatic) {
                 throw new Error("Bad kind on boostrap method handle");
             }
 
             CONSTANT_Methodref_info bsm_ref =
-                    (CONSTANT_Methodref_info)cf.constant_pool.get(bsm_handle.reference_index);
+                    (CONSTANT_Methodref_info)cf.constant_pool
+                    .get(bsm_handle.reference_index);
 
             if (!bsm_ref.getClassInfo().getName().equals("Bootstrap")) {
                 throw new Error("Bad owner of boostrap method");
@@ -318,8 +343,11 @@
                 throw new Error("Bad boostrap method name");
             }
 
-            if (!bsm_ref.getNameAndTypeInfo().getType().equals(asBSMSignatureString())) {
-                throw new Error("Bad boostrap method type" + bsm_ref.getNameAndTypeInfo().getType() + " " + asBSMSignatureString());
+            if (!bsm_ref.getNameAndTypeInfo()
+                    .getType().equals(asBSMSignatureString())) {
+                throw new Error("Bad boostrap method type" +
+                        bsm_ref.getNameAndTypeInfo().getType() + " " +
+                        asBSMSignatureString());
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -341,20 +369,22 @@
 
         static final String source_template = "import java.lang.invoke.*;\n" +
                 "class Bootstrap {\n" +
-                "   public static CallSite bsm(MethodHandles.Lookup lookup, String name, MethodType methodType #SARGS) {\n" +
+                "   public static CallSite bsm(MethodHandles.Lookup lookup, " +
+                "String name, MethodType methodType #SARGS) {\n" +
                 "       return null;\n" +
                 "   }\n" +
                 "}\n" +
-                "class Test {\n" +
+                "class Test#ID {\n" +
                 "   void m() { }\n" +
                 "   void test() { m(); }\n" +
                 "}";
 
         String source;
 
-        JavaSource() {
+        JavaSource(int id) {
             super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
-            source = source_template.replace("#SARGS", asSignatureString());
+            source = source_template.replace("#SARGS", asSignatureString())
+                    .replace("#ID", String.valueOf(id));
         }
 
         @Override
@@ -411,7 +441,8 @@
                 for (int i = 0; i < arity.arity ; i++) {
                     staticArgs[i] = saks[i].getValue(syms, names, types);
                 }
-                ident.sym = new Symbol.DynamicMethodSymbol(oldSym.name, oldSym.owner, REF_invokeStatic, bsm, oldSym.type, staticArgs);
+                ident.sym = new Symbol.DynamicMethodSymbol(oldSym.name,
+                        oldSym.owner, REF_invokeStatic, bsm, oldSym.type, staticArgs);
             }
             return null;
         }
@@ -426,7 +457,8 @@
         }
     }
 
-    static class DiagChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean diagFound;
         ArrayList<String> diags = new ArrayList<>();
@@ -445,4 +477,5 @@
             return buf.toString();
         }
     }
+
 }
--- a/test/tools/javac/lambda/VoidCompatibility.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/VoidCompatibility.java	Tue Jul 02 10:13:00 2013 +0100
@@ -3,7 +3,7 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  check that that void compatibility affects overloading as expected
- * @compile/fail/ref=VoidCompatibility.out -XDrawDiagnostics VoidCompatibility.java
+ * @compile VoidCompatibility.java
  */
 class VoidCompatibility {
 
@@ -14,13 +14,13 @@
     void schedule(Thunk<?> t) { }
 
     void test() {
-        schedule(() -> System.setProperty("done", "true")); //2
+        schedule(() -> System.setProperty("done", "true")); //non-void most specific
         schedule(() -> { System.setProperty("done", "true"); }); //1
         schedule(() -> { return System.setProperty("done", "true"); }); //2
         schedule(() -> System.out.println("done")); //1
         schedule(() -> { System.out.println("done"); }); //1
         schedule(Thread::yield); //1
-        schedule(Thread::getAllStackTraces); //ambiguous
+        schedule(Thread::getAllStackTraces); //non-void most specific
         schedule(Thread::interrupted); //1 (most specific)
     }
 }
--- a/test/tools/javac/lambda/VoidCompatibility.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-VoidCompatibility.java:17:9: compiler.err.ref.ambiguous: schedule, kindname.method, schedule(VoidCompatibility.Runnable), VoidCompatibility, kindname.method, schedule(VoidCompatibility.Thunk<?>), VoidCompatibility
-VoidCompatibility.java:23:9: compiler.err.ref.ambiguous: schedule, kindname.method, schedule(VoidCompatibility.Runnable), VoidCompatibility, kindname.method, schedule(VoidCompatibility.Thunk<?>), VoidCompatibility
-2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/WarnUnderscoreAsIdent.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
+ * @summary Check usages of underscore as identifier generate warnings
+ * @compile/fail/ref=WarnUnderscoreAsIdent.out -XDrawDiagnostics -Werror WarnUnderscoreAsIdent.java
+ */
+package _._;
+
+import _._;
+
+class _ {
+    String _ = null;
+    void _(String _) { }
+    void testLocal() {
+        String _ = null;
+    }
+    void testFor() {
+        for (int _ = 0; _ < 10; _++);
+    }
+    void testTry() {
+        try { } catch (Throwable _) { }
+    }
+    void testLabel() {
+        _:
+        for (;;) {
+            break _;
+        }
+        _:
+        for (;;) {
+            continue _;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/WarnUnderscoreAsIdent.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,20 @@
+WarnUnderscoreAsIdent.java:29:9: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:29:11: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:31:8: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:31:10: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:33:7: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:34:12: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:35:10: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:35:19: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:37:16: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:40:18: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:40:25: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:40:33: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:43:34: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:46:9: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:48:19: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:50:9: compiler.warn.underscore.as.identifier
+WarnUnderscoreAsIdent.java:52:22: compiler.warn.underscore.as.identifier
+- compiler.err.warnings.and.werror
+1 error
+17 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/abort/CompletionFailure.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,137 @@
+/*
+ * 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 8009227
+ * @summary Certain diagnostics should not be deferred
+ */
+
+import com.sun.source.util.JavacTask;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class CompletionFailure {
+
+    public static void main(String... args) throws Exception {
+
+        String SCRATCH_DIR = System.getProperty("user.dir");
+        JavaCompiler javacTool = ToolProvider.getSystemJavaCompiler();
+        File scratchDir = new File(SCRATCH_DIR);
+
+        sourceA.dumpTo(scratchDir);
+        sourceB.dumpTo(scratchDir);
+
+        JavacTask ct = (JavacTask)javacTool.getTask(null, null, null,
+                null, null, Arrays.asList(sourceA.asJFO(scratchDir), sourceB.asJFO(scratchDir)));
+
+        ct.generate();
+
+        remove(scratchDir, "A.java");
+        remove(scratchDir, "B.java");
+        remove(scratchDir, "A.class");
+
+        sourceC.dumpTo(scratchDir);
+        sourceD.dumpTo(scratchDir);
+
+        DiagnosticChecker diagChecker = new DiagnosticChecker();
+        ct = (JavacTask)javacTool.getTask(null, null, diagChecker,
+                Arrays.asList("-XDrawDiagnostics", "-cp", scratchDir.getAbsolutePath()),
+                null, Arrays.asList(sourceC.asJFO(scratchDir), sourceD.asJFO(scratchDir)));
+        try {
+            ct.analyze();
+        } catch (Throwable ex) {
+            //ignore abort exception thrown by javac
+        }
+
+        if (!diagChecker.errorFound) {
+            throw new AssertionError("Missing diagnostic");
+        }
+    }
+
+    static void remove(File dir, String fileName) {
+        File fileToRemove = new File(dir, fileName);
+        fileToRemove.delete();
+    }
+
+    static class JavaSource {
+        String contents;
+        String filename;
+
+        public JavaSource(String filename, String contents) {
+            this.filename =  filename;
+            this.contents = contents;
+        }
+
+        void dumpTo(java.io.File loc) throws Exception {
+            File file = new File(loc, filename);
+            BufferedWriter bw = new java.io.BufferedWriter(new FileWriter(file));
+            bw.append(contents);
+            bw.close();
+        }
+
+        SimpleJavaFileObject asJFO(java.io.File dir) {
+            return new SimpleJavaFileObject(new File(dir, filename).toURI(), JavaFileObject.Kind.SOURCE) {
+                @Override
+                public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+                    return contents;
+                }
+            };
+        }
+    }
+
+    static JavaSource sourceA = new JavaSource("A.java", "public interface A { }\n");
+
+    static JavaSource sourceB = new JavaSource("B.java", "public class B implements A {\n" +
+                                               "   public static Object n() { return null; }\n" +
+                                               "}\n");
+
+    static JavaSource sourceC = new JavaSource("C.java", "public class C {\n" +
+                                               "   void test(B b) {\n" +
+                                               "      D.m(B.n());\n" +
+                                               "}  }\n");
+
+    static JavaSource sourceD = new JavaSource("D.java", "public class D {\n" +
+                                               "   static void m(Object o) { }\n" +
+                                               "}\n");
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR &&
+                    diagnostic.getCode().contains("compiler.err.cant.access")) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/bytecode/TestLambdaBytecode.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,365 @@
+/*
+ * 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 8009649
+ * @summary Lambda back-end should generate invokespecial for method handles referring to private instance methods
+ * @library ../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm TestLambdaBytecode
+ */
+
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.BootstrapMethods_attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.ConstantPool.*;
+import com.sun.tools.classfile.Instruction;
+import com.sun.tools.classfile.Method;
+
+import com.sun.tools.javac.api.JavacTaskImpl;
+
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Locale;
+
+import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
+import static com.sun.tools.javac.jvm.ClassFile.*;
+
+public class TestLambdaBytecode
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
+
+    enum ClassKind {
+        CLASS("class"),
+        INTERFACE("interface");
+
+        String classStr;
+
+        ClassKind(String classStr) {
+            this.classStr = classStr;
+        }
+    }
+
+    enum AccessKind {
+        PUBLIC("public"),
+        PRIVATE("private");
+
+        String accessStr;
+
+        AccessKind(String accessStr) {
+            this.accessStr = accessStr;
+        }
+    }
+
+    enum StaticKind {
+        STATIC("static"),
+        INSTANCE("");
+
+        String staticStr;
+
+        StaticKind(String staticStr) {
+            this.staticStr = staticStr;
+        }
+    }
+
+    enum DefaultKind {
+        DEFAULT("default"),
+        NO_DEFAULT("");
+
+        String defaultStr;
+
+        DefaultKind(String defaultStr) {
+            this.defaultStr = defaultStr;
+        }
+    }
+
+    enum ExprKind {
+        LAMBDA("Runnable r = ()->{ target(); };");
+
+        String exprString;
+
+        ExprKind(String exprString) {
+            this.exprString = exprString;
+        }
+    }
+
+    static class MethodKind {
+        ClassKind ck;
+        AccessKind ak;
+        StaticKind sk;
+        DefaultKind dk;
+
+        MethodKind(ClassKind ck, AccessKind ak, StaticKind sk, DefaultKind dk) {
+            this.ck = ck;
+            this.ak = ak;
+            this.sk = sk;
+            this.dk = dk;
+        }
+
+        boolean inInterface() {
+            return ck == ClassKind.INTERFACE;
+        }
+
+        boolean isPrivate() {
+            return ak == AccessKind.PRIVATE;
+        }
+
+        boolean isStatic() {
+            return sk == StaticKind.STATIC;
+        }
+
+        boolean isDefault() {
+            return dk == DefaultKind.DEFAULT;
+        }
+
+        boolean isOK() {
+            if (isDefault() && (!inInterface() || isStatic())) {
+                return false;
+            } else if (inInterface() &&
+                    ((!isStatic() && !isDefault()) || isPrivate())) {
+                return false;
+            } else {
+                return true;
+            }
+        }
+
+        String mods() {
+            StringBuilder buf = new StringBuilder();
+            buf.append(ak.accessStr);
+            buf.append(' ');
+            buf.append(sk.staticStr);
+            buf.append(' ');
+            buf.append(dk.defaultStr);
+            return buf.toString();
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        for (ClassKind ck : ClassKind.values()) {
+            for (AccessKind ak1 : AccessKind.values()) {
+                for (StaticKind sk1 : StaticKind.values()) {
+                    for (DefaultKind dk1 : DefaultKind.values()) {
+                        for (AccessKind ak2 : AccessKind.values()) {
+                            for (StaticKind sk2 : StaticKind.values()) {
+                                for (DefaultKind dk2 : DefaultKind.values()) {
+                                    for (ExprKind ek : ExprKind.values()) {
+                                        pool.execute(new TestLambdaBytecode(ck, ak1, ak2, sk1, sk2, dk1, dk2, ek));
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        checkAfterExec();
+    }
+
+    MethodKind mk1, mk2;
+    ExprKind ek;
+    DiagChecker dc;
+
+    TestLambdaBytecode(ClassKind ck, AccessKind ak1, AccessKind ak2, StaticKind sk1,
+            StaticKind sk2, DefaultKind dk1, DefaultKind dk2, ExprKind ek) {
+        mk1 = new MethodKind(ck, ak1, sk1, dk1);
+        mk2 = new MethodKind(ck, ak2, sk2, dk2);
+        this.ek = ek;
+        dc = new DiagChecker();
+    }
+
+    public void run() {
+        int id = checkCount.incrementAndGet();
+        JavaSource source = new JavaSource(id);
+        JavacTaskImpl ct = (JavacTaskImpl)comp.getTask(null, fm.get(), dc,
+                null, null, Arrays.asList(source));
+        try {
+            ct.generate();
+        } catch (Throwable t) {
+            t.printStackTrace();
+            throw new AssertionError(
+                    String.format("Error thrown when compiling following code\n%s",
+                    source.source));
+        }
+        if (dc.diagFound) {
+            boolean errorExpected = !mk1.isOK() || !mk2.isOK();
+            errorExpected |= mk1.isStatic() && !mk2.isStatic();
+
+            if (!errorExpected) {
+                throw new AssertionError(
+                        String.format("Diags found when compiling following code\n%s\n\n%s",
+                        source.source, dc.printDiags()));
+            }
+            return;
+        }
+        verifyBytecode(id, source);
+    }
+
+    void verifyBytecode(int id, JavaSource source) {
+        File compiledTest = new File(String.format("Test%d.class", id));
+        try {
+            ClassFile cf = ClassFile.read(compiledTest);
+            Method testMethod = null;
+            for (Method m : cf.methods) {
+                if (m.getName(cf.constant_pool).equals("test")) {
+                    testMethod = m;
+                    break;
+                }
+            }
+            if (testMethod == null) {
+                throw new Error("Test method not found");
+            }
+            Code_attribute ea =
+                    (Code_attribute)testMethod.attributes.get(Attribute.Code);
+            if (testMethod == null) {
+                throw new Error("Code attribute for test() method not found");
+            }
+
+            int bsmIdx = -1;
+
+            for (Instruction i : ea.getInstructions()) {
+                if (i.getMnemonic().equals("invokedynamic")) {
+                    CONSTANT_InvokeDynamic_info indyInfo =
+                         (CONSTANT_InvokeDynamic_info)cf
+                            .constant_pool.get(i.getShort(1));
+                    bsmIdx = indyInfo.bootstrap_method_attr_index;
+                    if (!indyInfo.getNameAndTypeInfo().getType().equals(makeIndyType(id))) {
+                        throw new
+                            AssertionError("type mismatch for CONSTANT_InvokeDynamic_info " + source.source + "\n" + indyInfo.getNameAndTypeInfo().getType() + "\n" + makeIndyType(id));
+                    }
+                }
+            }
+            if (bsmIdx == -1) {
+                throw new Error("Missing invokedynamic in generated code");
+            }
+
+            BootstrapMethods_attribute bsm_attr =
+                    (BootstrapMethods_attribute)cf
+                    .getAttribute(Attribute.BootstrapMethods);
+            if (bsm_attr.bootstrap_method_specifiers.length != 1) {
+                throw new Error("Bad number of method specifiers " +
+                        "in BootstrapMethods attribute");
+            }
+            BootstrapMethods_attribute.BootstrapMethodSpecifier bsm_spec =
+                    bsm_attr.bootstrap_method_specifiers[0];
+
+            if (bsm_spec.bootstrap_arguments.length != MF_ARITY) {
+                throw new Error("Bad number of static invokedynamic args " +
+                        "in BootstrapMethod attribute");
+            }
+
+            CONSTANT_MethodHandle_info mh =
+                    (CONSTANT_MethodHandle_info)cf.constant_pool.get(bsm_spec.bootstrap_arguments[1]);
+
+            boolean kindOK;
+            switch (mh.reference_kind) {
+                case REF_invokeStatic: kindOK = mk2.isStatic(); break;
+                case REF_invokeSpecial: kindOK = !mk2.isStatic(); break;
+                case REF_invokeInterface: kindOK = mk2.inInterface(); break;
+                default:
+                    kindOK = false;
+            }
+
+            if (!kindOK) {
+                throw new Error("Bad invoke kind in implementation method handle");
+            }
+
+            if (!mh.getCPRefInfo().getNameAndTypeInfo().getType().toString().equals(MH_SIG)) {
+                throw new Error("Type mismatch in implementation method handle");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new Error("error reading " + compiledTest +": " + e);
+        }
+    }
+    String makeIndyType(int id) {
+        StringBuilder buf = new StringBuilder();
+        buf.append("(");
+        if (!mk2.isStatic() || mk1.inInterface()) {
+            buf.append(String.format("LTest%d;", id));
+        }
+        buf.append(")Ljava/lang/Runnable;");
+        return buf.toString();
+    }
+
+    static final int MF_ARITY = 3;
+    static final String MH_SIG = "()V";
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        static final String source_template =
+                "#CK Test#ID {\n" +
+                "   #MOD1 void test() { #EK }\n" +
+                "   #MOD2 void target() { }\n" +
+                "}\n";
+
+        String source;
+
+        JavaSource(int id) {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = source_template.replace("#CK", mk1.ck.classStr)
+                    .replace("#MOD1", mk1.mods())
+                    .replace("#MOD2", mk2.mods())
+                    .replace("#EK", ek.exprString)
+                    .replace("#ID", String.valueOf(id));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    static class DiagChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean diagFound;
+        ArrayList<String> diags = new ArrayList<>();
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            diags.add(diagnostic.getMessage(Locale.getDefault()));
+            diagFound = true;
+        }
+
+        String printDiags() {
+            StringBuilder buf = new StringBuilder();
+            for (String s : diags) {
+                buf.append(s);
+                buf.append("\n");
+            }
+            return buf.toString();
+        }
+    }
+
+}
--- a/test/tools/javac/lambda/funcInterfaces/LambdaTest2_neg1.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/funcInterfaces/LambdaTest2_neg1.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-LambdaTest2_neg1.java:15:13: compiler.err.cant.apply.symbol: kindname.method, methodQooRoo, QooRoo<java.lang.Integer,java.lang.Integer,java.lang.Void>, @531, kindname.class, LambdaTest2_neg1, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, QooRoo)))
+LambdaTest2_neg1.java:15:13: compiler.err.cant.apply.symbol: kindname.method, methodQooRoo, QooRoo<java.lang.Integer,java.lang.Integer,java.lang.Void>, @531, kindname.class, LambdaTest2_neg1, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf.1: QooRoo, (compiler.misc.incompatible.abstracts: kindname.interface, QooRoo)))
 1 error
--- a/test/tools/javac/lambda/funcInterfaces/NonSAM1.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/funcInterfaces/NonSAM1.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-NonSAM1.java:11:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.no.abstracts: kindname.interface, Planet))
+NonSAM1.java:11:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: Planet, (compiler.misc.no.abstracts: kindname.interface, Planet))
 1 error
--- a/test/tools/javac/lambda/funcInterfaces/NonSAM3.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/funcInterfaces/NonSAM3.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,9 +1,9 @@
-NonSAM3.java:15:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, FooBar))
-NonSAM3.java:16:22: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, FooBar))
-NonSAM3.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:18:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:19:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:20:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:21:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
-NonSAM3.java:22:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:15:21: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: FooBar, (compiler.misc.incompatible.abstracts: kindname.interface, FooBar))
+NonSAM3.java:16:22: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: FooBar, (compiler.misc.incompatible.abstracts: kindname.interface, FooBar))
+NonSAM3.java:17:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:18:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:19:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:20:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:21:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
+NonSAM3.java:22:18: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf.1: DE, (compiler.misc.incompatible.abstracts: kindname.interface, DE))
 8 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/inaccessibleMref01/InaccessibleMref01.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * 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 8003280
+ * @summary Add lambda tests
+ *  check that classfiles with member ref CP entries are read correctly
+ * @compile/fail/ref=InaccessibleMref01.out -XDrawDiagnostics InaccessibleMref01.java
+ */
+class InaccessibleMref01 {
+    interface SAM {
+        void m();
+    }
+
+    void test(p1.C c) {
+        SAM s = c::m;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/inaccessibleMref01/InaccessibleMref01.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+InaccessibleMref01.java:37:17: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.not.def.public.cant.access: m(), p1.C))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/inaccessibleMref01/p1/C.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,27 @@
+/*
+ * 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 p1;
+
+public class C {
+    void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/inaccessibleMref02/InaccessibleMref02.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 8003280
+ * @summary Add lambda tests
+ *  check that classfiles with member ref CP entries are read correctly
+ */
+public class InaccessibleMref02 {
+    interface SAM {
+        void m();
+    }
+
+    public static void main(String[] args) {
+        p1.C c = new p1.C();
+        SAM s = c::m;
+        s.m();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/inaccessibleMref02/p1/C.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,29 @@
+/*
+ * 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 p1;
+
+class Sup {
+    public void m() { }
+}
+
+public class C extends Sup { }
--- a/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/intersection/IntersectionTargetTypeTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -248,7 +248,7 @@
 
     void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
         JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
-                Arrays.asList("-XDallowIntersectionTypes"), null, Arrays.asList(source));
+                null, null, Arrays.asList(source));
         try {
             ct.analyze();
         } catch (Throwable ex) {
--- a/test/tools/javac/lambda/lambdaExpression/AbstractClass_neg.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/lambdaExpression/AbstractClass_neg.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-AbstractClass_neg.java:16:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+AbstractClass_neg.java:16:17: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: AbstractClass_neg.SAM)
 1 error
--- a/test/tools/javac/lambda/lambdaExpression/InvalidExpression5.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/lambdaExpression/InvalidExpression5.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-InvalidExpression5.java:12:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf)
+InvalidExpression5.java:12:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
 1 error
--- a/test/tools/javac/lambda/lambdaExpression/SamConversionComboTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/lambdaExpression/SamConversionComboTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -149,8 +149,7 @@
                 return false; //ambiguous target type
             }
             else if(lambdaBody == LambdaBody.IMPLICIT) {
-                if(returnValue != ReturnValue.INTEGER) //ambiguous target type
-                    return false;
+                return false;
             }
             else { //explicit parameter type
                 if(fInterface.getParameterType().equals("Integer")) //ambiguous target type
--- a/test/tools/javac/lambda/methodReference/SamConversion.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/methodReference/SamConversion.java	Tue Jul 02 10:13:00 2013 +0100
@@ -149,14 +149,6 @@
         test2(A::method3, 4);
         test2(new A()::method4, 5);
         test2(new A()::method5, 6);
-        A a = new A(A::method1); //A(Foo f) called
-        assertTrue(a.method2(1) == 11);
-        assertTrue(a.method4(1) == 11);
-        assertTrue(a.method5(1) == 11);
-        A a2 = new A(new A()::method2); //A(Bar b) called
-        assertTrue(a2.method2(1) == 12);
-        assertTrue(a2.method4(1) == 12);
-        assertTrue(a2.method5(1) == 12);
     }
 
     /**
@@ -279,7 +271,7 @@
         testConditionalExpression(false);
         testLambdaExpressionBody();
 
-        assertTrue(assertionCount == 38);
+        assertTrue(assertionCount == 32);
     }
 
     static class MyException extends Exception {}
--- a/test/tools/javac/lambda/methodReference/SamConversionComboTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/methodReference/SamConversionComboTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -186,10 +186,7 @@
         if(context != Context.CONSTRUCTOR && fInterface != FInterface.C && methodDef == MethodDef.METHOD6)
         //method that throws exceptions not thrown by the interface method is a mismatch
             return false;
-        if(context == Context.CONSTRUCTOR &&
-           methodReference != MethodReference.METHOD1 &&
-           methodReference != MethodReference.METHOD2 &&
-           methodReference != MethodReference.METHOD3)//ambiguous reference
+        if(context == Context.CONSTRUCTOR)
                return false;
         return true;
     }
--- a/test/tools/javac/lambda/mostSpecific/StructuralMostSpecificTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/mostSpecific/StructuralMostSpecificTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -23,27 +23,30 @@
 
 /*
  * @test
- * @bug 8003280
+ * @bug 8003280 8006694
  * @summary Add lambda tests
  *  Automatic test for checking correctness of structural most specific test routine
- * @run main/timeout=360 StructuralMostSpecificTest
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm/timeout=600 StructuralMostSpecificTest
  */
 
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.api.ClientCodeWrapper;
 import com.sun.tools.javac.util.JCDiagnostic;
-import java.net.URI;
-import java.util.Arrays;
-import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
 
-public class StructuralMostSpecificTest {
-
-    static int checkCount = 0;
+public class StructuralMostSpecificTest
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum RetTypeKind {
         SHORT("short"),
@@ -105,7 +108,7 @@
         VOID("return;"),
         SHORT("return (short)0;"),
         INT("return 0;"),
-        INTEGER("return (Integer)null"),
+        INTEGER("return (Integer)null;"),
         NULL("return null;");
 
         String retStr;
@@ -142,11 +145,6 @@
     }
 
     public static void main(String... args) throws Exception {
-
-        //create default shared JavaCompiler - reused across multiple compilations
-        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
-
         for (LambdaReturnKind lrk : LambdaReturnKind.values()) {
             for (RetTypeKind rk1 : RetTypeKind.values()) {
                 for (RetTypeKind rk2 : RetTypeKind.values()) {
@@ -154,7 +152,9 @@
                         for (ExceptionKind ek2 : ExceptionKind.values()) {
                             for (ArgTypeKind ak11 : ArgTypeKind.values()) {
                                 for (ArgTypeKind ak12 : ArgTypeKind.values()) {
-                                    new StructuralMostSpecificTest(lrk, rk1, rk2, ek1, ek2, ak11, ak12).run(comp, fm);
+                                    pool.execute(
+                                        new StructuralMostSpecificTest(lrk, rk1,
+                                            rk2, ek1, ek2, ak11, ak12));
                                 }
                             }
                         }
@@ -162,7 +162,8 @@
                 }
             }
         }
-        System.out.println("Total check executed: " + checkCount);
+
+        checkAfterExec();
     }
 
     LambdaReturnKind lrk;
@@ -218,20 +219,22 @@
         }
     }
 
-    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+    public void run() {
+        JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), diagChecker,
                 Arrays.asList("-XDverboseResolution=all,-predef,-internal,-object-init"),
                 null, Arrays.asList(source));
         try {
             ct.analyze();
         } catch (Throwable ex) {
-            throw new AssertionError("Error thron when analyzing the following source:\n" + source.getCharContent(true));
+            throw new
+                AssertionError("Error thron when analyzing the following source:\n" +
+                    source.getCharContent(true));
         }
         check();
     }
 
     void check() {
-        checkCount++;
+        checkCount.incrementAndGet();
 
         if (!lrk.compatibleWith(rt1) || !lrk.compatibleWith(rt2))
             return;
@@ -265,8 +268,8 @@
         }
     }
 
-    boolean moreSpecific(RetTypeKind rk1, RetTypeKind rk2, ExceptionKind ek1, ExceptionKind ek2,
-            ArgTypeKind ak1, ArgTypeKind ak2) {
+    boolean moreSpecific(RetTypeKind rk1, RetTypeKind rk2, ExceptionKind ek1,
+            ExceptionKind ek2, ArgTypeKind ak1, ArgTypeKind ak2) {
         if (!rk1.moreSpecificThan(rk2))
             return false;
 
@@ -276,7 +279,8 @@
         return true;
     }
 
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean ambiguityFound;
         String mostSpecificSig;
@@ -287,12 +291,16 @@
                         diagnostic.getCode().equals("compiler.err.ref.ambiguous")) {
                     ambiguityFound = true;
                 } else if (diagnostic.getKind() == Diagnostic.Kind.NOTE &&
-                        diagnostic.getCode().equals("compiler.note.verbose.resolve.multi")) {
+                        diagnostic.getCode()
+                        .equals("compiler.note.verbose.resolve.multi")) {
                     ClientCodeWrapper.DiagnosticSourceUnwrapper dsu =
-                            (ClientCodeWrapper.DiagnosticSourceUnwrapper)diagnostic;
-                    JCDiagnostic.MultilineDiagnostic mdiag = (JCDiagnostic.MultilineDiagnostic)dsu.d;
+                        (ClientCodeWrapper.DiagnosticSourceUnwrapper)diagnostic;
+                    JCDiagnostic.MultilineDiagnostic mdiag =
+                        (JCDiagnostic.MultilineDiagnostic)dsu.d;
                     int mostSpecificIndex = (Integer)mdiag.getArgs()[2];
-                    mostSpecificSig = ((JCDiagnostic)mdiag.getSubdiagnostics().get(mostSpecificIndex)).getArgs()[1].toString();
+                    mostSpecificSig =
+                        ((JCDiagnostic)mdiag.getSubdiagnostics()
+                            .get(mostSpecificIndex)).getArgs()[1].toString();
                 }
             } catch (RuntimeException t) {
                 t.printStackTrace();
@@ -300,4 +308,5 @@
             }
         }
     }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/separate/Foo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+interface Foo<X extends Number> {
+    void m(X x);
+}
+
+class FooLib {
+    void m1(Foo<?> uf) { }
+    void m2(Foo<? extends Object> uf) { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/separate/Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * 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
+ * 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
+ * @compile Foo.java
+ * @compile Test.java
+ */
+class Test {
+    void test(FooLib fl) {
+        fl.m1(x->{});
+        fl.m2(x->{});
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/speculative/MissingError.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8008276
+ * @summary assertion error in com.sun.tools.javac.comp.TransTypes.visitApply
+ * @compile/fail/ref=MissingError.out -XDrawDiagnostics MissingError.java
+ */
+class MissingError {
+    void test() {
+       mtest(new Bad(){ Integer i = ""; });
+    }
+
+    void mtest(Bad t){ }
+}
+
+class Bad {
+    String s = 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/speculative/MissingError.out	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,3 @@
+MissingError.java:16:16: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.String)
+MissingError.java:9:37: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer)
+2 errors
--- a/test/tools/javac/lambda/typeInference/InferenceTest_neg5.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/typeInference/InferenceTest_neg5.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,2 +1,2 @@
-InferenceTest_neg5.java:14:13: compiler.err.cant.apply.symbol: kindname.method, method1, InferenceTest_neg5.SAM1<X>, @419, kindname.class, InferenceTest_neg5, (compiler.misc.cyclic.inference: X)
+InferenceTest_neg5.java:14:21: compiler.err.prob.found.req: (compiler.misc.cyclic.inference: X)
 1 error
--- a/test/tools/javac/lambda/typeInference/combo/TypeInferenceComboTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambda/typeInference/combo/TypeInferenceComboTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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,24 +23,30 @@
 
 /**
  * @test
- * @bug 8003280
+ * @bug 8003280 8006694
  * @summary Add lambda tests
- *  perform automated checks in type inference in lambda expressions in different contexts
+ *  perform automated checks in type inference in lambda expressions
+ *  in different contexts
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../../../lib
+ * @build JavacTestingAbstractThreadedTest
  * @compile  TypeInferenceComboTest.java
- * @run main/timeout=360 TypeInferenceComboTest
+ * @run main/othervm/timeout=360 TypeInferenceComboTest
  */
 
-import com.sun.source.util.JavacTask;
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.Arrays;
 import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.ToolProvider;
-import javax.tools.StandardJavaFileManager;
+import com.sun.source.util.JavacTask;
 
-public class TypeInferenceComboTest {
+public class TypeInferenceComboTest
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
     enum Context {
         ASSIGNMENT("SAM#Type s = #LBody;"),
         METHOD_CALL("#GenericDeclKind void method1(SAM#Type s) { }\n" +
@@ -59,27 +65,35 @@
             this.context = context;
         }
 
-        String getContext(SamKind sk, TypeKind samTargetT, Keyword kw, TypeKind parameterT, TypeKind returnT, LambdaKind lk, ParameterKind pk, GenericDeclKind gdk, LambdaBody lb) {
+        String getContext(SamKind sk, TypeKind samTargetT, Keyword kw,
+                TypeKind parameterT, TypeKind returnT, LambdaKind lk,
+                ParameterKind pk, GenericDeclKind gdk, LambdaBody lb) {
             String result = context;
             if (sk == SamKind.GENERIC) {
                 if(this == Context.METHOD_CALL) {
-                    result = result.replaceAll("#GenericDeclKind", gdk.getGenericDeclKind(samTargetT));
+                    result = result.replaceAll("#GenericDeclKind",
+                            gdk.getGenericDeclKind(samTargetT));
                     if(gdk == GenericDeclKind.NON_GENERIC)
-                        result = result.replaceAll("#Type", "<" + samTargetT.typeStr + ">");
+                        result = result.replaceAll("#Type", "<" +
+                                samTargetT.typeStr + ">");
                     else //#GenericDeclKind is <T> or <T extends xxx>
                         result = result.replaceAll("#Type", "<T>");
                 }
                 else {
                     if(kw == Keyword.VOID)
-                        result = result.replaceAll("#Type", "<" + samTargetT.typeStr + ">");
+                        result = result.replaceAll("#Type", "<" +
+                                samTargetT.typeStr + ">");
                     else
-                        result = result.replaceAll("#Type", "<? " + kw.keyStr + " " + samTargetT.typeStr + ">");
+                        result = result.replaceAll("#Type", "<? " + kw.keyStr +
+                                " " + samTargetT.typeStr + ">");
                 }
             }
             else
-                result = result.replaceAll("#Type", "").replaceAll("#GenericDeclKind", "");
+                result = result.replaceAll("#Type", "").
+                        replaceAll("#GenericDeclKind", "");
 
-            return result.replaceAll("#LBody", lb.getLambdaBody(samTargetT, parameterT, returnT, lk, pk));
+            return result.replaceAll("#LBody",
+                    lb.getLambdaBody(samTargetT, parameterT, returnT, lk, pk));
         }
     }
 
@@ -94,8 +108,10 @@
         }
 
         String getSam(TypeKind parameterT, TypeKind returnT) {
-            return sam_str.replaceAll("#ARG", parameterT == TypeKind.VOID ? "" : parameterT.typeStr + " arg")
-                          .replaceAll("#R", returnT.typeStr);
+            return sam_str.replaceAll("#ARG",
+                    parameterT == TypeKind.VOID ?
+                        "" : parameterT.typeStr + " arg")
+                    .replaceAll("#R", returnT.typeStr);
         }
     }
 
@@ -104,7 +120,8 @@
         STRING("String", "\"hello\""),
         INTEGER("Integer", "1"),
         INT("int", "0"),
-        COMPARATOR("java.util.Comparator<String>", "(java.util.Comparator<String>)(a, b) -> a.length()-b.length()"),
+        COMPARATOR("java.util.Comparator<String>",
+                "(java.util.Comparator<String>)(a, b) -> a.length()-b.length()"),
         SAM("SAM2", "null"),
         GENERIC("T", null);
 
@@ -152,8 +169,10 @@
     }
 
     enum LambdaBody {
-        RETURN_VOID("() -> #RET"),//no parameters, return type is one of the TypeKind
-        RETURN_ARG("(#PK arg) -> #RET");//has parameters, return type is one of the TypeKind
+        //no parameters, return type is one of the TypeKind
+        RETURN_VOID("() -> #RET"),
+        //has parameters, return type is one of the TypeKind
+        RETURN_ARG("(#PK arg) -> #RET");
 
         String bodyStr;
 
@@ -161,12 +180,14 @@
             this.bodyStr = bodyStr;
         }
 
-        String getLambdaBody(TypeKind samTargetT, TypeKind parameterT, TypeKind returnT, LambdaKind lk, ParameterKind pk) {
+        String getLambdaBody(TypeKind samTargetT, TypeKind parameterT,
+                TypeKind returnT, LambdaKind lk, ParameterKind pk) {
             String result = bodyStr.replaceAll("#PK", pk.paramTemplate);
 
             if(result.contains("#TYPE")) {
                 if (parameterT == TypeKind.GENERIC && this != RETURN_VOID)
-                    result = result.replaceAll("#TYPE", samTargetT == null? "": samTargetT.typeStr);
+                    result = result.replaceAll("#TYPE",
+                            samTargetT == null? "": samTargetT.typeStr);
                 else
                     result = result.replaceAll("#TYPE", parameterT.typeStr);
             }
@@ -174,9 +195,12 @@
                 return result.replaceAll("#RET", lk.stmt.replaceAll("#VAL", "arg"));
             else {
                 if(returnT != TypeKind.GENERIC)
-                    return result.replaceAll("#RET", lk.stmt.replaceAll("#VAL", (returnT==TypeKind.VOID && lk==LambdaKind.EXPRESSION)? "{}" : returnT.valStr));
+                    return result.replaceAll("#RET", lk.stmt.replaceAll("#VAL",
+                            (returnT==TypeKind.VOID &&
+                            lk==LambdaKind.EXPRESSION) ? "{}" : returnT.valStr));
                 else
-                    return result.replaceAll("#RET", lk.stmt.replaceAll("#VAL", samTargetT.valStr));
+                    return result.replaceAll("#RET",
+                            lk.stmt.replaceAll("#VAL", samTargetT.valStr));
             }
         }
     }
@@ -203,8 +227,10 @@
         }
         else if (lambdaBodyType != LambdaBody.RETURN_ARG)
             return false;
-        if (  genericDeclKind == GenericDeclKind.GENERIC_NOBOUND || genericDeclKind == GenericDeclKind.GENERIC_BOUND ) {
-            if ( parameterType == TypeKind.GENERIC && parameterKind == ParameterKind.IMPLICIT) //cyclic inference
+        if (  genericDeclKind == GenericDeclKind.GENERIC_NOBOUND ||
+                genericDeclKind == GenericDeclKind.GENERIC_BOUND ) {
+            if ( parameterType == TypeKind.GENERIC &&
+                    parameterKind == ParameterKind.IMPLICIT) //cyclic inference
                 return false;
         }
         return true;
@@ -216,7 +242,8 @@
                          "}\n";
     SourceFile samSourceFile = new SourceFile("Sam.java", templateStr) {
         public String toString() {
-            return template.replaceAll("#C", samKind.getSam(parameterType, returnType));
+            return template.replaceAll("#C",
+                    samKind.getSam(parameterType, returnType));
         }
     };
 
@@ -225,22 +252,25 @@
                                                  "    #Context\n" +
                                                  "}") {
         public String toString() {
-            return template.replaceAll("#Context", context.getContext(samKind, samTargetType, keyword, parameterType, returnType, lambdaKind, parameterKind, genericDeclKind, lambdaBodyType));
+            return template.replaceAll("#Context",
+                    context.getContext(samKind, samTargetType, keyword,
+                    parameterType, returnType, lambdaKind, parameterKind,
+                    genericDeclKind, lambdaBodyType));
         }
     };
 
-    void test() throws Exception {
-        System.out.println("kk:");
-        StringBuilder sb = new StringBuilder("SamKind:");
-        sb.append(samKind).append(" SamTargetType:").append(samTargetType).append(" ParameterType:").append(parameterType)
-            .append(" ReturnType:").append(returnType).append(" Context:").append(context).append(" LambdaKind:").append(lambdaKind)
-            .append(" LambdaBodyType:").append(lambdaBodyType).append(" ParameterKind:").append(parameterKind).append(" Keyword:").append(keyword);
-        System.out.println(sb);
+    public void run() {
         DiagnosticChecker dc = new DiagnosticChecker();
-        JavacTask ct = (JavacTask)comp.getTask(null, fm, dc, null, null, Arrays.asList(samSourceFile, clientSourceFile));
-        ct.analyze();
+        JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), dc,
+                null, null, Arrays.asList(samSourceFile, clientSourceFile));
+        try {
+            ct.analyze();
+        } catch (Throwable t) {
+            processException(t);
+        }
         if (dc.errorFound == checkTypeInference()) {
-            throw new AssertionError(samSourceFile + "\n\n" + clientSourceFile + "\n" + parameterType + " " + returnType);
+            throw new AssertionError(samSourceFile + "\n\n" +
+                    clientSourceFile + "\n" + parameterType + " " + returnType);
         }
     }
 
@@ -261,7 +291,8 @@
         public abstract String toString();
     }
 
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean errorFound = false;
 
@@ -283,10 +314,9 @@
     Keyword keyword;
     GenericDeclKind genericDeclKind;
 
-    static JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-    static StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
-
-    TypeInferenceComboTest(SamKind sk, TypeKind samTargetT, TypeKind parameterT, TypeKind returnT, LambdaBody lb, Context c, LambdaKind lk, ParameterKind pk, Keyword kw, GenericDeclKind gdk) {
+    TypeInferenceComboTest(SamKind sk, TypeKind samTargetT, TypeKind parameterT,
+            TypeKind returnT, LambdaBody lb, Context c, LambdaKind lk,
+            ParameterKind pk, Keyword kw, GenericDeclKind gdk) {
         samKind = sk;
         samTargetType = samTargetT;
         parameterType = parameterT;
@@ -308,24 +338,14 @@
                             for(LambdaKind lambdaK : LambdaKind.values()) {
                                 for (SamKind sk : SamKind.values()) {
                                     if (sk == SamKind.NON_GENERIC) {
-                                        if(parameterT != TypeKind.GENERIC && returnT != TypeKind.GENERIC )
-                                            new TypeInferenceComboTest(sk, null, parameterT, returnT, lb, ct, lambdaK, parameterK, null, null).test();
+                                        generateNonGenericSAM(ct, returnT,
+                                                parameterT, lb, parameterK,
+                                                lambdaK, sk);
                                     }
                                     else if (sk == SamKind.GENERIC) {
-                                        for (Keyword kw : Keyword.values()) {
-                                            for (TypeKind samTargetT : TypeKind.values()) {
-                                                if(samTargetT != TypeKind.VOID && samTargetT != TypeKind.INT && samTargetT != TypeKind.GENERIC
-                                                   && (parameterT == TypeKind.GENERIC || returnT == TypeKind.GENERIC)) {
-                                                    if(ct != Context.METHOD_CALL) {
-                                                        new TypeInferenceComboTest(sk, samTargetT, parameterT, returnT, lb, ct, lambdaK, parameterK, kw, null).test();
-                                                    }
-                                                    else {//Context.METHOD_CALL
-                                                        for (GenericDeclKind gdk : GenericDeclKind.values())
-                                                            new TypeInferenceComboTest(sk, samTargetT, parameterT, returnT, lb, ct, lambdaK, parameterK, kw, gdk).test();
-                                                    }
-                                                }
-                                            }
-                                        }
+                                        generateGenericSAM(ct, returnT,
+                                                parameterT, lb, parameterK,
+                                                lambdaK, sk);
                                     }
                                 }
                             }
@@ -334,5 +354,44 @@
                 }
             }
         }
+
+        checkAfterExec(false);
     }
+
+    static void generateNonGenericSAM(Context ct, TypeKind returnT,
+            TypeKind parameterT, LambdaBody lb, ParameterKind parameterK,
+            LambdaKind lambdaK, SamKind sk) {
+        if(parameterT != TypeKind.GENERIC && returnT != TypeKind.GENERIC ) {
+            pool.execute(new TypeInferenceComboTest(sk, null, parameterT,
+                    returnT, lb, ct, lambdaK, parameterK, null, null));
+        }
+    }
+
+    static void generateGenericSAM(Context ct, TypeKind returnT,
+            TypeKind parameterT, LambdaBody lb, ParameterKind parameterK,
+            LambdaKind lambdaK, SamKind sk) {
+        for (Keyword kw : Keyword.values()) {
+            for (TypeKind samTargetT : TypeKind.values()) {
+                if(samTargetT != TypeKind.VOID &&
+                   samTargetT != TypeKind.INT &&
+                   samTargetT != TypeKind.GENERIC &&
+                   (parameterT == TypeKind.GENERIC ||
+                   returnT == TypeKind.GENERIC)) {
+                    if(ct != Context.METHOD_CALL) {
+                        pool.execute(
+                            new TypeInferenceComboTest(sk, samTargetT, parameterT,
+                                returnT, lb, ct, lambdaK, parameterK, kw, null));
+                    } else {//Context.METHOD_CALL
+                        for (GenericDeclKind gdk :
+                                GenericDeclKind.values())
+                            pool.execute(
+                                    new TypeInferenceComboTest(sk, samTargetT,
+                                    parameterT, returnT, lb, ct, lambdaK,
+                                    parameterK, kw, gdk));
+                    }
+                }
+            }
+         }
+    }
+
 }
--- a/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -807,20 +807,8 @@
             fail("Could not load class", e);
         }
     }
-
-    public void testSynchronizedDefault() {
-        try {
-            java.lang.Class.forName("org.openjdk.tests.vm.SynchronizedDefault");
-        } catch (Exception e) {
-            fail("Could not load class", e);
-        }
-    }
 }
 
 interface StrictfpDefault {
     default strictfp void m() {}
 }
-
-interface SynchronizedDefault {
-    default synchronized void m() {}
-}
--- a/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/FDSeparateCompilationTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/FDSeparateCompilationTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -23,6 +23,9 @@
  * questions.
  */
 
+// this test has been disabled because of timeout issues.
+// see JDK-8006746
+
 package org.openjdk.tests.vm;
 
 import java.util.*;
@@ -91,7 +94,7 @@
     private static final ConcreteMethod canonicalMethod = new ConcreteMethod(
             "String", "m", "returns " + EMPTY + ";", AccessFlag.PUBLIC);
 
-    @Test(groups = "vm", dataProvider = "allShapes")
+    @Test(enabled = false, groups = "vm", dataProvider = "allShapes")
     public void separateCompilationTest(Hierarchy hs) {
         ClassCase cc = hs.root;
         Type type = sourceTypeFrom(hs.root);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lib/DPrinter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,1332 @@
+/*
+ * 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.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import javax.lang.model.element.Name;
+import javax.lang.model.element.TypeElement;
+import javax.tools.FileObject;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTrees;
+import com.sun.tools.javac.code.Annotations;
+import com.sun.tools.javac.code.Attribute;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Kinds;
+import com.sun.tools.javac.code.Printer;
+import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.Scope.CompoundScope;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.code.TypeTag;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.tree.Pretty;
+import com.sun.tools.javac.tree.TreeInfo;
+import com.sun.tools.javac.tree.TreeScanner;
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Log;
+
+
+/**
+ * Debug printer for javac internals, for when toString() just isn't enough.
+ *
+ * <p>
+ * The printer provides an API to generate structured views of javac objects,
+ * such as AST nodes, symbol, types and annotations. Various aspects of the
+ * output can be configured, such as whether to show nulls, empty lists, or
+ * a compressed representation of the source code. Visitors are used to walk
+ * object hierarchies, and can be replaced with custom visitors if the default
+ * visitors are not flexible enough.
+ *
+ * <p>
+ * In general, nodes are printed with an initial line identifying the node
+ * followed by indented lines for the child nodes. Currently, graphs are
+ * represented by printing a spanning subtree.
+ *
+ * <p>
+ * The printer can be accessed via a simple command-line utility,
+ * which makes it easy to see the internal representation of source code,
+ * such as simple test programs, during the compilation pipeline.
+ *
+ *  <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>
+ */
+
+public class DPrinter {
+    protected final PrintWriter out;
+    protected final Trees trees;
+    protected Printer printer;
+    protected boolean showEmptyItems = true;
+    protected boolean showNulls = true;
+    protected boolean showPositions = false;
+    protected boolean showSrc;
+    protected boolean showTreeSymbols;
+    protected boolean showTreeTypes;
+    protected int maxSrcLength = 32;
+    protected Locale locale = Locale.getDefault();
+    protected static final String NULL = "#null";
+
+    // <editor-fold defaultstate="collapsed" desc="Configuration">
+
+    public static DPrinter instance(Context context) {
+        DPrinter dp = context.get(DPrinter.class);
+        if (dp == null) {
+            dp = new DPrinter(context);
+        }
+        return dp;
+
+    }
+
+    protected DPrinter(Context context) {
+        context.put(DPrinter.class, this);
+        out = context.get(Log.outKey);
+        trees = JavacTrees.instance(context);
+    }
+
+    public DPrinter(PrintWriter out, Trees trees) {
+        this.out = out;
+        this.trees = trees;
+    }
+
+    public DPrinter emptyItems(boolean showEmptyItems) {
+        this.showEmptyItems = showEmptyItems;
+        return this;
+    }
+
+    public DPrinter nulls(boolean showNulls) {
+        this.showNulls = showNulls;
+        return this;
+    }
+
+    public DPrinter positions(boolean showPositions) {
+        this.showPositions = showPositions;
+        return this;
+    }
+
+    public DPrinter source(boolean showSrc) {
+        this.showSrc = showSrc;
+        return this;
+    }
+
+    public DPrinter source(int maxSrcLength) {
+        this.showSrc = true;
+        this.maxSrcLength = maxSrcLength;
+        return this;
+    }
+
+    public DPrinter treeSymbols(boolean showTreeSymbols) {
+        this.showTreeSymbols = showTreeSymbols;
+        return this;
+    }
+
+    public DPrinter treeTypes(boolean showTreeTypes) {
+        this.showTreeTypes = showTreeTypes;
+        return this;
+    }
+
+    public DPrinter typeSymbolPrinter(Printer p) {
+        printer = p;
+        return this;
+    }
+
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Printing">
+
+    protected enum Details {
+        /** A one-line non-recursive summary */
+        SUMMARY,
+        /** Multi-line, possibly recursive. */
+        FULL
+    };
+
+    public void printAnnotations(String label, Annotations annotations) {
+        printAnnotations(label, annotations, Details.FULL);
+    }
+
+    protected void printAnnotations(String label, Annotations annotations, Details details) {
+        if (annotations == null) {
+            printNull(label);
+        } else {
+            // no SUMMARY format currently available to use
+
+            // use reflection to get at private fields
+            Object DECL_NOT_STARTED = getField(null, Annotations.class, "DECL_NOT_STARTED");
+            Object DECL_IN_PROGRESS = getField(null, Annotations.class, "DECL_IN_PROGRESS");
+            Object attributes = getField(annotations, Annotations.class, "attributes");
+            Object type_attributes = getField(annotations, Annotations.class, "type_attributes");
+
+            if (!showEmptyItems) {
+                if (attributes instanceof List && ((List) attributes).isEmpty()
+                        && attributes != DECL_NOT_STARTED
+                        && attributes != DECL_IN_PROGRESS
+                        && type_attributes instanceof List && ((List) type_attributes).isEmpty())
+                    return;
+            }
+
+            printString(label, hashString(annotations));
+
+            indent(+1);
+            if (attributes == DECL_NOT_STARTED)
+                printString("attributes", "DECL_NOT_STARTED");
+            else if (attributes == DECL_IN_PROGRESS)
+                printString("attributes", "DECL_IN_PROGRESS");
+            else if (attributes instanceof List)
+                printList("attributes", (List) attributes);
+            else
+                printObject("attributes", attributes, Details.SUMMARY);
+
+            if (attributes instanceof List)
+                printList("type_attributes", (List) type_attributes);
+            else
+                printObject("type_attributes", type_attributes, Details.SUMMARY);
+            indent(-1);
+        }
+    }
+
+    public void printAttribute(String label, Attribute attr) {
+        if (attr == null) {
+            printNull(label);
+        } else {
+            printString(label, attr.getClass().getSimpleName());
+
+            indent(+1);
+            attr.accept(attrVisitor);
+            indent(-1);
+        }
+    }
+
+    public void printFileObject(String label, FileObject fo) {
+        if (fo == null) {
+            printNull(label);
+        } else {
+            printString(label, fo.getName());
+        }
+    }
+
+    protected <T> void printImplClass(T item, Class<? extends T> stdImplClass) {
+        if (item.getClass() != stdImplClass)
+            printString("impl", item.getClass().getName());
+    }
+
+    public void printInt(String label, int i) {
+        printString(label, String.valueOf(i));
+    }
+
+    public void printList(String label, List<?> list) {
+        if (list == null) {
+             printNull(label);
+        } else if (!list.isEmpty() || showEmptyItems) {
+            printString(label, "[" + list.size() + "]");
+
+            indent(+1);
+            int i = 0;
+            for (Object item: list) {
+                printObject(String.valueOf(i++), item, Details.FULL);
+            }
+            indent(-1);
+        }
+    }
+
+    public void printName(String label, Name name) {
+        if (name == null) {
+            printNull(label);
+        } else {
+            printString(label, name.toString());
+        }
+    }
+
+    public void printNull(String label) {
+        if (showNulls)
+            printString(label, NULL);
+    }
+
+    protected void printObject(String label, Object item, Details details) {
+        if (item == null) {
+            printNull(label);
+        } else if (item instanceof Attribute) {
+            printAttribute(label, (Attribute) item);
+        } else if (item instanceof Symbol) {
+            printSymbol(label, (Symbol) item, details);
+        } else if (item instanceof Type) {
+            printType(label, (Type) item, details);
+        } else if (item instanceof JCTree) {
+            printTree(label, (JCTree) item);
+        } else if (item instanceof List) {
+            printList(label, (List) item);
+        } else if (item instanceof Name) {
+            printName(label, (Name) item);
+        } else {
+            printString(label, String.valueOf(item));
+        }
+    }
+
+    public void printScope(String label, Scope scope) {
+        printScope(label, scope, Details.FULL);
+    }
+
+    public void printScope(String label, Scope scope, Details details) {
+        if (scope == null) {
+            printNull(label);
+        } else {
+            switch (details) {
+                case SUMMARY: {
+                    indent();
+                    out.print(label);
+                    out.print(": [");
+                    String sep = "";
+                    for (Symbol sym: scope.getElements()) {
+                        out.print(sep);
+                        out.print(sym.name);
+                        sep = ",";
+                    }
+                    out.println("]");
+                    break;
+                }
+
+                case FULL: {
+                    indent();
+                    out.println(label);
+
+                    indent(+1);
+                    printImplClass(scope, Scope.class);
+                    printSymbol("owner", scope.owner, Details.SUMMARY);
+                    printScope("next", scope.next, Details.SUMMARY);
+                    printObject("shared", getField(scope, Scope.class, "shared"), Details.SUMMARY);
+                    if (scope instanceof CompoundScope) {
+                        printObject("subScopes",
+                                getField(scope, CompoundScope.class, "subScopes"),
+                                Details.FULL);
+                    } else {
+                        for (Symbol sym : scope.getElements()) {
+                            printSymbol(sym.name.toString(), sym, Details.SUMMARY);
+                        }
+                    }
+                    indent(-1);
+                    break;
+                }
+            }
+        }
+    }
+
+    public void printSource(String label, JCTree tree) {
+        printString(label, Pretty.toSimpleString(tree, maxSrcLength));
+    }
+
+    public void printString(String label, String text) {
+        indent();
+        out.print(label);
+        out.print(": ");
+        out.print(text);
+        out.println();
+    }
+
+    public void printSymbol(String label, Symbol symbol) {
+        printSymbol(label, symbol, Details.FULL);
+    }
+
+    protected void printSymbol(String label, Symbol sym, Details details) {
+        if (sym == null) {
+            printNull(label);
+        } else {
+            switch (details) {
+            case SUMMARY:
+                printString(label, toString(sym));
+                break;
+
+            case FULL:
+                indent();
+                out.print(label);
+                out.println(": " +
+                        info(sym.getClass(),
+                            String.format("0x%x--%s", sym.kind, Kinds.kindName(sym)),
+                            sym.getKind())
+                        + " " + sym.name
+                        + " " + hashString(sym));
+
+                indent(+1);
+                if (showSrc) {
+                    JCTree tree = (JCTree) trees.getTree(sym);
+                    if (tree != null)
+                        printSource("src", tree);
+                }
+                printString("flags", String.format("0x%x--%s",
+                        sym.flags_field, Flags.toString(sym.flags_field)));
+                printObject("completer", sym.completer, Details.SUMMARY); // what if too long?
+                printSymbol("owner", sym.owner, Details.SUMMARY);
+                printType("type", sym.type, Details.SUMMARY);
+                printType("erasure", sym.erasure_field, Details.SUMMARY);
+                sym.accept(symVisitor, null);
+                printAnnotations("annotations", sym.annotations, Details.SUMMARY);
+                indent(-1);
+            }
+        }
+    }
+
+    protected String toString(Symbol sym) {
+        return (printer != null) ? printer.visit(sym, locale) : String.valueOf(sym);
+    }
+
+    protected void printTree(String label, JCTree tree) {
+        if (tree == null) {
+            printNull(label);
+        } else {
+            indent();
+            String ext;
+            try {
+                ext = tree.getKind().name();
+            } catch (Throwable t) {
+                ext = "n/a";
+            }
+            out.print(label + ": " + info(tree.getClass(), tree.getTag(), ext));
+            if (showPositions) {
+                // We can always get start position, but to get end position
+                // and/or line+offset, we would need a JCCompilationUnit
+                out.print(" pos:" + tree.pos);
+            }
+            if (showTreeTypes && tree.type != null)
+                out.print(" type:" + toString(tree.type));
+            Symbol sym;
+            if (showTreeSymbols && (sym = TreeInfo.symbolFor(tree)) != null)
+                out.print(" sym:" + toString(sym));
+            out.println();
+
+            indent(+1);
+            if (showSrc) {
+                indent();
+                out.println("src: " + Pretty.toSimpleString(tree, maxSrcLength));
+            }
+            tree.accept(treeVisitor);
+            indent(-1);
+        }
+    }
+
+    public void printType(String label, Type type) {
+        printType(label, type, Details.FULL);
+    }
+
+    protected void printType(String label, Type type, Details details) {
+        if (type == null)
+            printNull(label);
+        else {
+            switch (details) {
+                case SUMMARY:
+                    printString(label, toString(type));
+                    break;
+
+                case FULL:
+                    indent();
+                    out.print(label);
+                    out.println(": " + info(type.getClass(), type.getTag(), type.getKind())
+                            + " " + hashString(type));
+
+                    indent(+1);
+                    printSymbol("tsym", type.tsym, Details.SUMMARY);
+                    printObject("constValue", type.constValue(), Details.SUMMARY);
+                    type.accept(typeVisitor, null);
+                    indent(-1);
+            }
+        }
+    }
+
+    protected String toString(Type type) {
+        return (printer != null) ? printer.visit(type, locale) : String.valueOf(type);
+    }
+
+    protected String hashString(Object obj) {
+        return String.format("#%x", obj.hashCode());
+    }
+
+    protected String info(Class<?> clazz, Object internal, Object external) {
+        return String.format("%s,%s,%s", clazz.getSimpleName(), internal, external);
+    }
+
+    private int indent = 0;
+
+    protected void indent() {
+        for (int i = 0; i < indent; i++) {
+            out.print("  ");
+        }
+    }
+
+    protected void indent(int n) {
+        indent += n;
+    }
+
+    protected Object getField(Object o, Class<?> clazz, String name) {
+        try {
+            Field f = clazz.getDeclaredField(name);
+            boolean prev = f.isAccessible();
+            f.setAccessible(true);
+            try {
+                return f.get(o);
+            } finally {
+                f.setAccessible(prev);
+            }
+        } catch (ReflectiveOperationException e) {
+            return e;
+        } catch (SecurityException e) {
+            return e;
+        }
+    }
+
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="JCTree visitor methods">
+
+    protected JCTree.Visitor treeVisitor = new TreeVisitor();
+
+    /**
+     * Default visitor class for JCTree (AST) objects.
+     */
+    public class TreeVisitor extends JCTree.Visitor {
+        @Override
+        public void visitTopLevel(JCCompilationUnit tree) {
+            printList("packageAnnotations", tree.packageAnnotations);
+            printTree("pid", tree.pid);
+            printList("defs", tree.defs);
+        }
+
+        @Override
+        public void visitImport(JCImport tree) {
+            printTree("qualid", tree.qualid);
+        }
+
+        @Override
+        public void visitClassDef(JCClassDecl tree) {
+            printName("name", tree.name);
+            printTree("mods", tree.mods);
+            printList("typarams", tree.typarams);
+            printTree("extending", tree.extending);
+            printList("implementing", tree.implementing);
+            printList("defs", tree.defs);
+        }
+
+        @Override
+        public void visitMethodDef(JCMethodDecl tree) {
+            printName("name", tree.name);
+            printTree("mods", tree.mods);
+            printTree("restype", tree.restype);
+            printList("typarams", tree.typarams);
+            printTree("recvparam", tree.recvparam);
+            printList("params", tree.params);
+            printList("thrown", tree.thrown);
+            printTree("defaultValue", tree.defaultValue);
+            printTree("body", tree.body);
+        }
+
+        @Override
+        public void visitVarDef(JCVariableDecl tree) {
+            printName("name", tree.name);
+            printTree("mods", tree.mods);
+            printTree("vartype", tree.vartype);
+            printTree("init", tree.init);
+        }
+
+        @Override
+        public void visitSkip(JCSkip tree) {
+        }
+
+        @Override
+        public void visitBlock(JCBlock tree) {
+            printList("stats", tree.stats);
+        }
+
+        @Override
+        public void visitDoLoop(JCDoWhileLoop tree) {
+            printTree("body", tree.body);
+            printTree("cond", tree.cond);
+        }
+
+        @Override
+        public void visitWhileLoop(JCWhileLoop tree) {
+            printTree("cond", tree.cond);
+            printTree("body", tree.body);
+        }
+
+        @Override
+        public void visitForLoop(JCForLoop tree) {
+            printList("init", tree.init);
+            printTree("cond", tree.cond);
+            printList("step", tree.step);
+            printTree("body", tree.body);
+        }
+
+        @Override
+        public void visitForeachLoop(JCEnhancedForLoop tree) {
+            printTree("var", tree.var);
+            printTree("expr", tree.expr);
+            printTree("body", tree.body);
+        }
+
+        @Override
+        public void visitLabelled(JCLabeledStatement tree) {
+            printTree("body", tree.body);
+        }
+
+        @Override
+        public void visitSwitch(JCSwitch tree) {
+            printTree("selector", tree.selector);
+            printList("cases", tree.cases);
+        }
+
+        @Override
+        public void visitCase(JCCase tree) {
+            printTree("pat", tree.pat);
+            printList("stats", tree.stats);
+        }
+
+        @Override
+        public void visitSynchronized(JCSynchronized tree) {
+            printTree("lock", tree.lock);
+            printTree("body", tree.body);
+        }
+
+        @Override
+        public void visitTry(JCTry tree) {
+            printList("resources", tree.resources);
+            printTree("body", tree.body);
+            printList("catchers", tree.catchers);
+            printTree("finalizer", tree.finalizer);
+        }
+
+        @Override
+        public void visitCatch(JCCatch tree) {
+            printTree("param", tree.param);
+            printTree("body", tree.body);
+        }
+
+        @Override
+        public void visitConditional(JCConditional tree) {
+            printTree("cond", tree.cond);
+            printTree("truepart", tree.truepart);
+            printTree("falsepart", tree.falsepart);
+        }
+
+        @Override
+        public void visitIf(JCIf tree) {
+            printTree("cond", tree.cond);
+            printTree("thenpart", tree.thenpart);
+            printTree("elsepart", tree.elsepart);
+        }
+
+        @Override
+        public void visitExec(JCExpressionStatement tree) {
+            printTree("expr", tree.expr);
+        }
+
+        @Override
+        public void visitBreak(JCBreak tree) {
+            printName("label", tree.label);
+        }
+
+        @Override
+        public void visitContinue(JCContinue tree) {
+            printName("label", tree.label);
+        }
+
+        @Override
+        public void visitReturn(JCReturn tree) {
+            printTree("expr", tree.expr);
+        }
+
+        @Override
+        public void visitThrow(JCThrow tree) {
+            printTree("expr", tree.expr);
+        }
+
+        @Override
+        public void visitAssert(JCAssert tree) {
+            printTree("cond", tree.cond);
+            printTree("detail", tree.detail);
+        }
+
+        @Override
+        public void visitApply(JCMethodInvocation tree) {
+            printList("typeargs", tree.typeargs);
+            printTree("meth", tree.meth);
+            printList("args", tree.args);
+        }
+
+        @Override
+        public void visitNewClass(JCNewClass tree) {
+            printTree("encl", tree.encl);
+            printList("typeargs", tree.typeargs);
+            printTree("clazz", tree.clazz);
+            printList("args", tree.args);
+            printTree("def", tree.def);
+        }
+
+        @Override
+        public void visitNewArray(JCNewArray tree) {
+            printList("annotations", tree.annotations);
+            printTree("elemtype", tree.elemtype);
+            printList("dims", tree.dims);
+            printList("dimAnnotations", tree.dimAnnotations);
+            printList("elems", tree.elems);
+        }
+
+        @Override
+        public void visitLambda(JCLambda tree) {
+            printTree("body", tree.body);
+            printList("params", tree.params);
+        }
+
+        @Override
+        public void visitParens(JCParens tree) {
+            printTree("expr", tree.expr);
+        }
+
+        @Override
+        public void visitAssign(JCAssign tree) {
+            printTree("lhs", tree.lhs);
+            printTree("rhs", tree.rhs);
+        }
+
+        @Override
+        public void visitAssignop(JCAssignOp tree) {
+            printTree("lhs", tree.lhs);
+            printTree("rhs", tree.rhs);
+        }
+
+        @Override
+        public void visitUnary(JCUnary tree) {
+            printTree("arg", tree.arg);
+        }
+
+        @Override
+        public void visitBinary(JCBinary tree) {
+            printTree("lhs", tree.lhs);
+            printTree("rhs", tree.rhs);
+        }
+
+        @Override
+        public void visitTypeCast(JCTypeCast tree) {
+            printTree("clazz", tree.clazz);
+            printTree("expr", tree.expr);
+        }
+
+        @Override
+        public void visitTypeTest(JCInstanceOf tree) {
+            printTree("expr", tree.expr);
+            printTree("clazz", tree.clazz);
+        }
+
+        @Override
+        public void visitIndexed(JCArrayAccess tree) {
+            printTree("indexed", tree.indexed);
+            printTree("index", tree.index);
+        }
+
+        @Override
+        public void visitSelect(JCFieldAccess tree) {
+            printTree("selected", tree.selected);
+        }
+
+        @Override
+        public void visitReference(JCMemberReference tree) {
+            printTree("expr", tree.expr);
+            printList("typeargs", tree.typeargs);
+        }
+
+        @Override
+        public void visitIdent(JCIdent tree) {
+            printName("name", tree.name);
+        }
+
+        @Override
+        public void visitLiteral(JCLiteral tree) {
+            printString("value", Pretty.toSimpleString(tree, 32));
+        }
+
+        @Override
+        public void visitTypeIdent(JCPrimitiveTypeTree tree) {
+            printString("typetag", tree.typetag.name());
+        }
+
+        @Override
+        public void visitTypeArray(JCArrayTypeTree tree) {
+            printTree("elemtype", tree.elemtype);
+        }
+
+        @Override
+        public void visitTypeApply(JCTypeApply tree) {
+            printTree("clazz", tree.clazz);
+            printList("arguments", tree.arguments);
+        }
+
+        @Override
+        public void visitTypeUnion(JCTypeUnion tree) {
+            printList("alternatives", tree.alternatives);
+        }
+
+        @Override
+        public void visitTypeIntersection(JCTypeIntersection tree) {
+            printList("bounds", tree.bounds);
+        }
+
+        @Override
+        public void visitTypeParameter(JCTypeParameter tree) {
+            printName("name", tree.name);
+            printList("annotations", tree.annotations);
+            printList("bounds", tree.bounds);
+        }
+
+        @Override
+        public void visitWildcard(JCWildcard tree) {
+            printTree("kind", tree.kind);
+            printTree("inner", tree.inner);
+        }
+
+        @Override
+        public void visitTypeBoundKind(TypeBoundKind tree) {
+            printString("kind", tree.kind.name());
+        }
+
+        @Override
+        public void visitModifiers(JCModifiers tree) {
+            printList("annotations", tree.annotations);
+            printString("flags", String.valueOf(Flags.asFlagSet(tree.flags)));
+        }
+
+        @Override
+        public void visitAnnotation(JCAnnotation tree) {
+            printTree("annotationType", tree.annotationType);
+            printList("args", tree.args);
+        }
+
+        @Override
+        public void visitAnnotatedType(JCAnnotatedType tree) {
+            printList("annotations", tree.annotations);
+            printTree("underlyingType", tree.underlyingType);
+        }
+
+        @Override
+        public void visitErroneous(JCErroneous tree) {
+            printList("errs", tree.errs);
+        }
+
+        @Override
+        public void visitLetExpr(LetExpr tree) {
+            printList("defs", tree.defs);
+            printTree("expr", tree.expr);
+        }
+
+        @Override
+        public void visitTree(JCTree tree) {
+            Assert.error();
+        }
+    }
+
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Symbol visitor">
+
+    protected Symbol.Visitor<Void,Void> symVisitor = new SymbolVisitor();
+
+    /**
+     * Default visitor class for Symbol objects.
+     * Note: each visitXYZ method ends by calling the corresponding
+     * visit method for its superclass.
+     */
+    class SymbolVisitor implements Symbol.Visitor<Void,Void> {
+        @Override
+        public Void visitClassSymbol(ClassSymbol sym, Void ignore) {
+            printName("fullname", sym.fullname);
+            printName("flatname", sym.flatname);
+            printScope("members", sym.members_field);
+            printFileObject("sourcefile", sym.sourcefile);
+            printFileObject("classfile", sym.classfile);
+            // trans-local?
+            // pool?
+            return visitTypeSymbol(sym, null);
+        }
+
+        @Override
+        public Void visitMethodSymbol(MethodSymbol sym, Void ignore) {
+            // code
+            printList("params", sym.params);
+            printList("savedParameterNames", sym.savedParameterNames);
+            return visitSymbol(sym, null);
+        }
+
+        @Override
+        public Void visitPackageSymbol(PackageSymbol sym, Void ignore) {
+            printName("fullname", sym.fullname);
+            printScope("members", sym.members_field);
+            printSymbol("package-info", sym.package_info, Details.SUMMARY);
+            return visitTypeSymbol(sym, null);
+        }
+
+        @Override
+        public Void visitOperatorSymbol(OperatorSymbol sym, Void ignore) {
+            printInt("opcode", sym.opcode);
+            return visitMethodSymbol(sym, null);
+        }
+
+        @Override
+        public Void visitVarSymbol(VarSymbol sym, Void ignore) {
+            printInt("pos", sym.pos);
+            printInt("adm", sym.adr);
+            // data is a private field, and the standard accessors may
+            // mutate it as part of lazy evaluation. Therefore, use
+            // reflection to get the raw data.
+            printObject("data", getField(sym, VarSymbol.class, "data"), Details.SUMMARY);
+            return visitSymbol(sym, null);
+        }
+
+        @Override
+        public Void visitTypeSymbol(TypeSymbol sym, Void ignore) {
+            return visitSymbol(sym, null);
+        }
+
+        @Override
+        public Void visitSymbol(Symbol sym, Void ignore) {
+            return null;
+        }
+    }
+
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Type visitor">
+
+    protected Type.Visitor<Void,Void> typeVisitor = new TypeVisitor();
+
+    /**
+     * Default visitor class for Type objects.
+     * Note: each visitXYZ method ends by calling the corresponding
+     * visit method for its superclass.
+     */
+    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);
+            return visitType(type, null);
+        }
+
+        public Void visitArrayType(ArrayType type, Void ignore) {
+            printType("elemType", type.elemtype, Details.FULL);
+            return visitType(type, null);
+        }
+
+        public Void visitCapturedType(CapturedType type, Void ignore) {
+            printType("wildcard", type.wildcard, Details.FULL);
+            return visitTypeVar(type, null);
+        }
+
+        public Void visitClassType(ClassType type, Void ignore) {
+            printType("outer", type.getEnclosingType(), Details.SUMMARY);
+            printList("typarams", type.typarams_field);
+            printList("allparams", type.allparams_field);
+            printType("supertype", type.supertype_field, Details.SUMMARY);
+            printList("interfaces", type.interfaces_field);
+            printList("allinterfaces", type.all_interfaces_field);
+            return visitType(type, null);
+        }
+
+        public Void visitErrorType(ErrorType type, Void ignore) {
+            printType("originalType", type.getOriginalType(), Details.FULL);
+            return visitClassType(type, null);
+        }
+
+        public Void visitForAll(ForAll type, Void ignore) {
+            printList("tvars", type.tvars);
+            return visitDelegatedType(type);
+        }
+
+        public Void visitMethodType(MethodType type, Void ignore) {
+            printList("argtypes", type.argtypes);
+            printType("restype", type.restype, Details.FULL);
+            printList("thrown", type.thrown);
+            return visitType(type, null);
+        }
+
+        public Void visitPackageType(PackageType type, Void ignore) {
+            return visitType(type, null);
+        }
+
+        public Void visitTypeVar(TypeVar type, Void ignore) {
+            // For TypeVars (and not subtypes), the bound should always be
+            // null or bot. So, only print the bound for subtypes of TypeVar,
+            // or if the bound is (erroneously) not null or bot.
+            if (!type.hasTag(TypeTag.TYPEVAR)
+                    || !(type.bound == null || type.bound.hasTag(TypeTag.BOT))) {
+                printType("bound", type.bound, Details.FULL);
+            }
+            printType("lower", type.lower, Details.FULL);
+            return visitType(type, null);
+        }
+
+        public Void visitUndetVar(UndetVar type, Void ignore) {
+            for (UndetVar.InferenceBound ib: UndetVar.InferenceBound.values())
+                printList("bounds." + ib, type.getBounds(ib));
+            printInt("declaredCount", type.declaredCount);
+            printType("inst", type.inst, Details.SUMMARY);
+            return visitDelegatedType(type);
+        }
+
+        public Void visitWildcardType(WildcardType type, Void ignore) {
+            printType("type", type.type, Details.SUMMARY);
+            printString("kind", type.kind.name());
+            printType("bound", type.bound, Details.SUMMARY);
+            return visitType(type, null);
+        }
+
+        protected Void visitDelegatedType(DelegatedType type) {
+            printType("qtype", type.qtype, Details.FULL);
+            return visitType(type, null);
+        }
+
+        public Void visitType(Type type, Void ignore) {
+            return null;
+        }
+    }
+
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Attribute (annotations) visitor">
+
+    protected Attribute.Visitor attrVisitor = new AttributeVisitor();
+
+    /**
+     * Default visitor class for Attribute (annotation) objects.
+     */
+    public class AttributeVisitor implements Attribute.Visitor {
+
+        public void visitConstant(Attribute.Constant a) {
+            printObject("value", a.value, Details.SUMMARY);
+            visitAttribute(a);
+        }
+
+        public void visitClass(Attribute.Class a) {
+            printObject("classType", a.classType, Details.SUMMARY);
+            visitAttribute(a);
+        }
+
+        public void visitCompound(Attribute.Compound a) {
+            if (a instanceof Attribute.TypeCompound) {
+                Attribute.TypeCompound ta = (Attribute.TypeCompound) a;
+                // consider a custom printer?
+                printObject("position", ta.position, Details.SUMMARY);
+            }
+            printObject("synthesized", a.isSynthesized(), Details.SUMMARY);
+            printList("values", a.values);
+            visitAttribute(a);
+        }
+
+        public void visitArray(Attribute.Array a) {
+            printList("values", Arrays.asList(a.values));
+            visitAttribute(a);
+        }
+
+        public void visitEnum(Attribute.Enum a) {
+            printSymbol("value", a.value, Details.SUMMARY);
+            visitAttribute(a);
+        }
+
+        public void visitError(Attribute.Error a) {
+            visitAttribute(a);
+        }
+
+        public void visitAttribute(Attribute a) {
+            printType("type", a.type, Details.SUMMARY);
+        }
+
+    }
+    // </editor-fold>
+
+    // <editor-fold defaultstate="collapsed" desc="Utility front end">
+
+    /**
+     * Utility class to invoke DPrinter from the command line.
+     */
+    static class Main {
+        public static void main(String... args) throws IOException {
+            Main m = new Main();
+            PrintWriter out = new PrintWriter(System.out);
+            try {
+                if (args.length == 0)
+                    m.usage(out);
+                else
+                    m.run(out, args);
+            } finally {
+                out.flush();
+            }
+        }
+
+        void usage(PrintWriter out) {
+            out.println("Usage:");
+            out.println("  java " + Main.class.getName() + " mode [options] [javac-options]");
+            out.print("where mode is one of: ");
+            String sep = "";
+            for (Handler h: getHandlers().values()) {
+                out.print(sep);
+                out.print(h.name);
+                sep = ", ";
+            }
+            out.println();
+            out.println("and where options include:");
+            out.println("  -before PARSE|ENTER|ANALYZE|GENERATE|ANNOTATION_PROCESSING|ANNOTATION_PROCESSING_ROUND");
+            out.println("  -after PARSE|ENTER|ANALYZE|GENERATE|ANNOTATION_PROCESSING|ANNOTATION_PROCESSING_ROUND");
+            out.println("  -showPositions");
+            out.println("  -showSource");
+            out.println("  -showTreeSymbols");
+            out.println("  -showTreeTypes");
+            out.println("  -hideEmptyItems");
+            out.println("  -hideNulls");
+        }
+
+        void run(PrintWriter out, String... args) throws IOException {
+            JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+            StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
+
+            // DPrinter options
+            final Set<TaskEvent.Kind> before = EnumSet.noneOf(TaskEvent.Kind.class);
+            final Set<TaskEvent.Kind> after = EnumSet.noneOf(TaskEvent.Kind.class);
+            boolean showPositions = false;
+            boolean showSource = false;
+            boolean showTreeSymbols = false;
+            boolean showTreeTypes = false;
+            boolean showEmptyItems = true;
+            boolean showNulls = true;
+
+            // javac options
+            Collection<String> options = new ArrayList<String>();
+            Collection<File> files = new ArrayList<File>();
+            String classpath = null;
+            String classoutdir = null;
+
+            final Handler h = getHandlers().get(args[0]);
+            if (h == null)
+                throw new IllegalArgumentException(args[0]);
+
+            for (int i = 1; i < args.length; i++) {
+                String arg = args[i];
+                if (arg.equals("-before") && i + 1 < args.length) {
+                    before.add(getKind(args[++i]));
+                } else if (arg.equals("-after") && i + 1 < args.length) {
+                    after.add(getKind(args[++i]));
+                } else if (arg.equals("-showPositions")) {
+                    showPositions = true;
+                } else if (arg.equals("-showSource")) {
+                    showSource = true;
+                } else if (arg.equals("-showTreeSymbols")) {
+                    showTreeSymbols = true;
+                } else if (arg.equals("-showTreeTypes")) {
+                    showTreeTypes = true;
+                } else if (arg.equals("-hideEmptyLists")) {
+                    showEmptyItems = false;
+                } else if (arg.equals("-hideNulls")) {
+                    showNulls = false;
+                } else if (arg.equals("-classpath") && i + 1 < args.length) {
+                    classpath = args[++i];
+                } else if (arg.equals("-d") && i + 1 < args.length) {
+                    classoutdir = args[++i];
+                } else if (arg.startsWith("-")) {
+                    int n = c.isSupportedOption(arg);
+                    if (n < 0) throw new IllegalArgumentException(arg);
+                    options.add(arg);
+                    while (n > 0) options.add(args[++i]);
+                } else if (arg.endsWith(".java")) {
+                    files.add(new File(arg));
+                }
+            }
+
+            if (classoutdir != null) {
+                fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(classoutdir)));
+            }
+
+            if (classpath != null) {
+                Collection<File> path = new ArrayList<File>();
+                for (String p: classpath.split(File.pathSeparator)) {
+                    if (p.isEmpty()) continue;
+                    File f = new File(p);
+                    if (f.exists()) path.add(f);
+                }
+                fm.setLocation(StandardLocation.CLASS_PATH, path);
+            }
+            Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
+
+            JavacTask task = (JavacTask) c.getTask(out, fm, null, options, null, fos);
+            final Trees trees = Trees.instance(task);
+
+            final DPrinter dprinter = new DPrinter(out, trees);
+            dprinter.source(showSource)
+                    .emptyItems(showEmptyItems)
+                    .nulls(showNulls)
+                    .positions(showPositions)
+                    .treeSymbols(showTreeSymbols)
+                    .treeTypes(showTreeTypes);
+
+            if (before.isEmpty() && after.isEmpty()) {
+                if (h.name.equals("trees") && !showTreeSymbols && !showTreeTypes)
+                    after.add(TaskEvent.Kind.PARSE);
+                else
+                    after.add(TaskEvent.Kind.ANALYZE);
+            }
+
+            task.addTaskListener(new TaskListener() {
+                public void started(TaskEvent e) {
+                    if (before.contains(e.getKind()))
+                        handle(e);
+                }
+
+                public void finished(TaskEvent e) {
+                    if (after.contains(e.getKind()))
+                        handle(e);
+                }
+
+                private void handle(TaskEvent e) {
+                     switch (e.getKind()) {
+                         case PARSE:
+                         case ENTER:
+                             h.handle(e.getSourceFile().getName(),
+                                     (JCTree) e.getCompilationUnit(),
+                                     dprinter);
+                             break;
+
+                         default:
+                             TypeElement elem = e.getTypeElement();
+                             h.handle(elem.toString(),
+                                     (JCTree) trees.getTree(elem),
+                                     dprinter);
+                             break;
+                     }
+                }
+            });
+
+            task.call();
+        }
+
+        TaskEvent.Kind getKind(String s) {
+            return TaskEvent.Kind.valueOf(s.toUpperCase());
+        }
+
+        static protected abstract class Handler {
+            final String name;
+            Handler(String name) {
+                this.name = name;
+            }
+            abstract void handle(String label, JCTree tree, DPrinter dprinter);
+        }
+
+        Map<String,Handler> getHandlers() {
+            Map<String,Handler> map = new HashMap<String, Handler>();
+            for (Handler h: defaultHandlers) {
+                map.put(h.name, h);
+            }
+            return map;
+        }
+
+        protected final Handler[] defaultHandlers = {
+            new Handler("trees") {
+                @Override
+                void handle(String name, JCTree tree, DPrinter dprinter) {
+                    dprinter.printTree(name, tree);
+                    dprinter.out.println();
+                }
+            },
+
+            new Handler("symbols") {
+                @Override
+                void handle(String name, JCTree tree, final DPrinter dprinter) {
+                    TreeScanner ds = new TreeScanner() {
+                        @Override
+                        public void visitClassDef(JCClassDecl tree) {
+                            visitDecl(tree, tree.sym);
+                            super.visitClassDef(tree);
+                        }
+
+                        @Override
+                        public void visitMethodDef(JCMethodDecl tree) {
+                            visitDecl(tree, tree.sym);
+                            super.visitMethodDef(tree);
+                        }
+
+                        @Override
+                        public void visitVarDef(JCVariableDecl tree) {
+                            visitDecl(tree, tree.sym);
+                            super.visitVarDef(tree);
+                        }
+
+                        void visitDecl(JCTree tree, Symbol sym) {
+                            dprinter.printSymbol(sym.name.toString(), sym);
+                            dprinter.out.println();
+                        }
+                    };
+                    ds.scan(tree);
+                }
+            },
+
+            new Handler("types") {
+                @Override
+                void handle(String name, JCTree tree, final DPrinter dprinter) {
+                    TreeScanner ts = new TreeScanner() {
+                        @Override
+                        public void scan(JCTree tree) {
+                            if (tree == null) {
+                                return;
+                            }
+                            if (tree.type != null) {
+                                String label = Pretty.toSimpleString(tree);
+                                dprinter.printType(label, tree.type);
+                                dprinter.out.println();
+                            }
+                            super.scan(tree);
+                        }
+                    };
+                    ts.scan(tree);
+                }
+            }
+        };
+    }
+
+    // </editor-fold>
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lib/JavacTestingAbstractThreadedTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2010, 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.PrintWriter;
+import java.io.StringWriter;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.tools.JavaCompiler;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+/**
+ * An abstract superclass for threaded tests.
+ *
+ * This class will try to read a property named test.concurrency.
+ * The property can be provided by passing this option to jtreg:
+ * -javaoption:-Dtest.concurrency=#
+ *
+ * If the property is not set the class will use a heuristic to determine the
+ * maximum number of threads that can be fired to execute a given test.
+ *
+ * This code will have to be revisited if jprt starts using concurrency for
+ * for running jtreg tests.
+ */
+public abstract class JavacTestingAbstractThreadedTest {
+
+    protected static AtomicInteger numberOfThreads = new AtomicInteger();
+
+    protected static int getThreadPoolSize() {
+        Integer testConc = Integer.getInteger("test.concurrency");
+        if (testConc != null) return testConc;
+        int cores = Runtime.getRuntime().availableProcessors();
+        numberOfThreads.set(Math.max(2, Math.min(8, cores / 2)));
+        return numberOfThreads.get();
+    }
+
+    protected static void checkAfterExec() throws InterruptedException {
+        checkAfterExec(true);
+    };
+
+    protected static boolean throwAssertionOnError = true;
+
+    protected static boolean printAll = false;
+
+    protected static StringWriter errSWriter = new StringWriter();
+    protected static PrintWriter errWriter = new PrintWriter(errSWriter);
+
+    protected static StringWriter outSWriter = new StringWriter();
+    protected static PrintWriter outWriter = new PrintWriter(outSWriter);
+
+    protected static void checkAfterExec(boolean printCheckCount)
+            throws InterruptedException {
+        pool.shutdown();
+        pool.awaitTermination(15, TimeUnit.MINUTES);
+        if (errCount.get() > 0) {
+            if (throwAssertionOnError) {
+                closePrinters();
+                System.err.println(errSWriter.toString());
+                throw new AssertionError(
+                    String.format("%d errors found", errCount.get()));
+            } else {
+                System.err.println(
+                        String.format("%d errors found", errCount.get()));
+            }
+        } else if (printCheckCount) {
+            outWriter.println("Total check executed: " + checkCount.get());
+        }
+        /*
+         * This output is for supporting debugging. It does not mean that a given
+         * test had executed that number of threads concurrently. The value printed
+         * here is the maximum possible amount.
+         */
+        closePrinters();
+        if (printAll) {
+            System.out.println(errSWriter.toString());
+            System.out.println(outSWriter.toString());
+        }
+        System.out.println("Total number of threads in thread pool: " +
+                numberOfThreads.get());
+    }
+
+    protected static void closePrinters() {
+        errWriter.close();
+        outWriter.close();
+    }
+
+    protected static void processException(Throwable t) {
+        errCount.incrementAndGet();
+        t.printStackTrace(errWriter);
+        pool.shutdown();
+    }
+
+    //number of checks executed
+    protected static AtomicInteger checkCount = new AtomicInteger();
+
+    //number of errors found while running combo tests
+    protected static AtomicInteger errCount = new AtomicInteger();
+
+    //create default shared JavaCompiler - reused across multiple compilations
+    protected static JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+
+    protected static ExecutorService pool = Executors.newFixedThreadPool(
+            getThreadPoolSize(), new ThreadFactory() {
+        @Override
+        public Thread newThread(Runnable r) {
+            Thread t = new Thread(r);
+            t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+                @Override
+                public void uncaughtException(Thread t, Throwable e) {
+                    pool.shutdown();
+                    errCount.incrementAndGet();
+                    e.printStackTrace(System.err);
+                }
+            });
+            return t;
+        }
+    });
+
+    /*
+     * File manager is not thread-safe so it cannot be re-used across multiple
+     * threads. However we cache per-thread FileManager to avoid excessive
+     * object creation
+     */
+    protected static final ThreadLocal<StandardJavaFileManager> fm =
+        new ThreadLocal<StandardJavaFileManager>() {
+            @Override protected StandardJavaFileManager initialValue() {
+                return comp.getStandardFileManager(null, null, null);
+            }
+        };
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lib/ToolBox.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,977 @@
+/*
+ * 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.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTaskImpl;
+
+import sun.tools.jar.Main;
+
+import static java.nio.file.StandardCopyOption.*;
+
+/**
+ * Toolbox for jtreg tests.
+ */
+
+public class ToolBox {
+
+    public static final String lineSeparator = System.getProperty("line.separator");
+    public static final String jdkUnderTest = System.getProperty("test.jdk");
+    public static final Path javaBinary = Paths.get(jdkUnderTest, "bin", "java");
+    public static final Path javacBinary = Paths.get(jdkUnderTest, "bin", "javac");
+
+    public static final List<String> testToolVMOpts;
+    public static final List<String> testVMOpts;
+
+    private static final Charset defaultCharset = Charset.defaultCharset();
+
+    static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+
+    static {
+        String sysProp = System.getProperty("test.tool.vm.opts");
+        if (sysProp != null && sysProp.length() > 0) {
+            testToolVMOpts = Arrays.asList(sysProp.split("\\s+"));
+        } else {
+            testToolVMOpts = Collections.<String>emptyList();
+        }
+
+        sysProp = System.getProperty("test.vm.opts");
+        if (sysProp != null && sysProp.length() > 0) {
+            testVMOpts = Arrays.asList(sysProp.split("\\s+"));
+        } else {
+            testVMOpts = Collections.<String>emptyList();
+        }
+    }
+
+    /**
+     * The expected result of command-like method execution.
+     */
+    public enum Expect {SUCCESS, FAIL}
+
+    enum AcceptedParams {
+        EXPECT,
+        SOURCES,
+        OPTIONS,
+        STD_OUTPUT,
+        ERR_OUTPUT,
+        EXTRA_ENV,
+    }
+
+    enum OutputKind {STD, ERR}
+
+    /**
+     * Helper class to abstract the processing of command's output.
+     */
+    static abstract class WriterHelper {
+        OutputKind kind;
+        public abstract void pipeOutput(ProcessBuilder pb);
+        public abstract void readFromStream(Process p) throws IOException;
+        public abstract void addAll(Collection<? extends String> c) throws IOException;
+    }
+
+    /**
+     * Helper class for redirecting command's output to a file.
+     */
+    static class FileWriterHelper extends WriterHelper {
+        File file;
+
+        FileWriterHelper(File file, OutputKind kind) {
+            this.file = file;
+            this.kind = kind;
+        }
+
+        @Override
+        public void pipeOutput(ProcessBuilder pb) {
+            if (file != null) {
+                switch (kind) {
+                    case STD:
+                        pb.redirectInput(file);
+                        break;
+                    case ERR:
+                        pb.redirectError(file);
+                        break;
+                }
+            }
+        }
+
+        @Override
+        public void readFromStream(Process p) throws IOException {}
+
+        @Override
+        public void addAll(Collection<? extends String> c) throws IOException {
+            if (file.exists())
+                Files.write(file.toPath(), c, defaultCharset,
+                        StandardOpenOption.WRITE, StandardOpenOption.APPEND);
+            else
+                Files.write(file.toPath(), c, defaultCharset);
+        }
+    }
+
+    /**
+     * Helper class for redirecting command's output to a String list.
+     */
+    static class ListWriterHelper extends WriterHelper {
+        List<String> list;
+
+        public ListWriterHelper(List<String> list, OutputKind kind) {
+            this.kind = kind;
+            this.list = list;
+        }
+
+        @Override
+        public void pipeOutput(ProcessBuilder pb) {}
+
+        @Override
+        public void readFromStream(Process p) throws IOException {
+            BufferedReader br = null;
+            switch (kind) {
+                case STD:
+                    br = new BufferedReader(new InputStreamReader(p.getInputStream()));
+                    break;
+                case ERR:
+                    br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+                    break;
+            }
+            String line;
+            while ((line = br.readLine()) != null) {
+                list.add(line);
+            }
+        }
+
+        public void addAll(Collection<? extends String> c) {
+            list.addAll(c);
+        }
+    }
+
+    /**
+     * Simple factory class for creating a WriterHelper instance.
+     */
+    static class WriterHelperFactory {
+        static WriterHelper make(File file, OutputKind kind) {
+            return new FileWriterHelper(file, kind);
+        }
+
+        static WriterHelper make(List<String> list, OutputKind kind) {
+            return new ListWriterHelper(list, kind);
+        }
+    }
+
+    /**
+     * A generic class for holding command's arguments.
+     */
+    public static abstract class GenericArgs <T extends GenericArgs> {
+        protected static List<Set<AcceptedParams>> minAcceptedParams;
+
+        protected Set<AcceptedParams> currentParams =
+                EnumSet.<AcceptedParams>noneOf(AcceptedParams.class);
+
+        protected Expect whatToExpect;
+        protected WriterHelper stdOutput;
+        protected WriterHelper errOutput;
+        protected List<String> args = new ArrayList<>();
+        protected String[] argsArr;
+
+        protected GenericArgs() {
+            set(Expect.SUCCESS);
+        }
+
+        public T set(Expect whatToExpt) {
+            currentParams.add(AcceptedParams.EXPECT);
+            this.whatToExpect = whatToExpt;
+            return (T)this;
+        }
+
+        public T setStdOutput(List<String> stdOutput) {
+            currentParams.add(AcceptedParams.STD_OUTPUT);
+            this.stdOutput = WriterHelperFactory.make(stdOutput, OutputKind.STD);
+            return (T)this;
+        }
+
+        public T setStdOutput(File output) {
+            currentParams.add(AcceptedParams.STD_OUTPUT);
+            this.stdOutput = WriterHelperFactory.make(output, OutputKind.STD);
+            return (T)this;
+        }
+
+        public T setErrOutput(List<String> errOutput) {
+            currentParams.add(AcceptedParams.ERR_OUTPUT);
+            this.errOutput = WriterHelperFactory.make(errOutput, OutputKind.ERR);
+            return (T)this;
+        }
+
+        public T setErrOutput(File errOutput) {
+            currentParams.add(AcceptedParams.ERR_OUTPUT);
+            this.errOutput = WriterHelperFactory.make(errOutput, OutputKind.ERR);
+            return (T)this;
+        }
+
+        public T setAllArgs(String... args) {
+            currentParams.add(AcceptedParams.OPTIONS);
+            this.argsArr = args;
+            return (T) this;
+        }
+
+
+        public T appendArgs(String... args) {
+            appendArgs(Arrays.asList(args));
+            return (T)this;
+        }
+
+        public T appendArgs(Path... args) {
+            if (args != null) {
+                List<String> list = new ArrayList<>();
+                for (int i = 0; i < args.length; i++) {
+                    if (args[i] != null) {
+                        list.add(args[i].toString());
+                    }
+                }
+                appendArgs(list);
+            }
+            return (T)this;
+        }
+
+        public T appendArgs(List<String> args) {
+            if (args != null && args.size() > 0) {
+                currentParams.add(AcceptedParams.OPTIONS);
+                for (int i = 0; i < args.size(); i++) {
+                    if (args.get(i) != null) {
+                        this.args.add(args.get(i));
+                    }
+                }
+            }
+            return (T)this;
+        }
+
+        public T setOptions(List<String> options) {
+            currentParams.add(AcceptedParams.OPTIONS);
+            this.args = options;
+            return (T)this;
+        }
+
+        public T setOptions(String... options) {
+            currentParams.add(AcceptedParams.OPTIONS);
+            this.args = Arrays.asList(options);
+            return (T)this;
+        }
+
+        public boolean hasMinParams() {
+            for (Set<AcceptedParams> minSet : minAcceptedParams) {
+                if (currentParams.containsAll(minSet)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * A more specific class for holding javac-like command's arguments.
+     */
+    public static class JavaToolArgs extends GenericArgs<JavaToolArgs> {
+
+        static {
+            minAcceptedParams = new ArrayList<>();
+            minAcceptedParams.add(EnumSet.<AcceptedParams>of(
+                    AcceptedParams.EXPECT, AcceptedParams.OPTIONS));
+            minAcceptedParams.add(EnumSet.<AcceptedParams>of(
+                    AcceptedParams.EXPECT, AcceptedParams.SOURCES));
+        }
+
+        protected List<? extends JavaFileObject> sources;
+
+        public JavaToolArgs() {
+            super();
+        }
+
+        public JavaToolArgs(Expect whatToExpt) {
+            super.set(whatToExpt);
+        }
+
+        public JavaToolArgs setSources(List<? extends JavaFileObject> sources) {
+            currentParams.add(AcceptedParams.SOURCES);
+            this.sources = sources;
+            return this;
+        }
+
+        public JavaToolArgs setSources(JavaSource... sources) {
+            return setSources(Arrays.asList(sources));
+        }
+
+        public JavaToolArgs setSources(String... sources) {
+            List<JavaSource> javaSrcs = new ArrayList<>();
+            for (String source : sources) {
+                javaSrcs.add(new JavaSource(source));
+            }
+            return setSources(javaSrcs);
+        }
+    }
+
+    /**
+     * A more specific class for holding any command's arguments.
+     */
+    public static class AnyToolArgs extends GenericArgs<AnyToolArgs> {
+
+        static {
+            minAcceptedParams = new ArrayList<>();
+            minAcceptedParams.add(EnumSet.<AcceptedParams>of(
+                    AcceptedParams.EXPECT, AcceptedParams.OPTIONS));
+        }
+
+        Map<String, String> extraEnv;
+
+        public AnyToolArgs() {
+            super();
+        }
+
+        public AnyToolArgs(Expect whatToExpt) {
+            set(whatToExpt);
+        }
+
+        public AnyToolArgs set(Map<String, String> extraEnv) {
+            currentParams.add(AcceptedParams.EXTRA_ENV);
+            this.extraEnv = extraEnv;
+            return this;
+        }
+    }
+
+    /**
+     * Custom exception for bad command execution.
+     */
+    public static class CommandExecutionException extends Exception {
+        CommandExecutionException(List<String> command, Expect whatToExpt) {
+            super(createMessage(command, whatToExpt));
+        }
+
+        CommandExecutionException(Expect whatToExpt, String... command) {
+            this(Arrays.asList(command), whatToExpt);
+        }
+
+        private static String createMessage(List<String> command, Expect whatToExpt) {
+            StringBuilder sb = new StringBuilder().append("Command : ");
+            sb.append(command.toString()).append(lineSeparator);
+            switch (whatToExpt) {
+                case SUCCESS:
+                    sb.append("    has unexpectedly failed");
+                    break;
+                case FAIL:
+                    sb.append("    has been unexpectedly successful");
+                    break;
+            }
+            return sb.toString();
+        }
+    }
+
+    /**
+     * Custom exception for not equal resources.
+     */
+    public static class ResourcesNotEqualException extends Exception {
+        public ResourcesNotEqualException(List<String> res1, List<String> res2) {
+            super(createMessage(res1, res2));
+        }
+
+        public ResourcesNotEqualException(String line1, String line2) {
+            super(createMessage(line1, line2));
+        }
+
+        public ResourcesNotEqualException(Path path1, Path path2) {
+            super(createMessage(path1, path2));
+        }
+
+        private static String createMessage(Path path1, Path path2) {
+            return new StringBuilder()
+                    .append("The resources provided for comparison in paths \n")
+                    .append(path1.toString()).append(" and \n")
+                    .append(path2.toString()).append("are different").toString();
+        }
+
+        private static String createMessage(String line1, String line2) {
+            return new StringBuilder()
+                    .append("The resources provided for comparison are different at lines: \n")
+                    .append(line1).append(" and \n")
+                    .append(line2).toString();
+        }
+
+        private static String createMessage(List<String> res1, List<String> res2) {
+            return new StringBuilder()
+                    .append("The resources provided for comparison are different: \n")
+                    .append("Resource 1 is: ").append(res1).append("\n and \n")
+                    .append("Resource 2 is: ").append(res2).append("\n").toString();
+        }
+    }
+
+    /**
+     * A javac compiler caller method.
+     */
+    public static int javac(JavaToolArgs params)
+            throws CommandExecutionException, IOException {
+        if (params.hasMinParams()) {
+            if (params.argsArr != null) {
+                return genericJavaCMD(JavaCMD.JAVAC, params);
+            } else {
+                return genericJavaCMD(JavaCMD.JAVAC_API, params);
+            }
+        }
+        throw new AssertionError("javac command has been invoked with less parameters than needed");
+    }
+
+    /**
+     * A javap calling method.
+     */
+    public static String javap(JavaToolArgs params)
+            throws CommandExecutionException, IOException {
+        if (params.hasMinParams()) {
+            List<String> list = new ArrayList<>();
+            params.setErrOutput(list);
+            genericJavaCMD(JavaCMD.JAVAP, params);
+            return listToString(list);
+        }
+        throw new AssertionError("javap command has been invoked with less parameters than needed");
+    }
+
+    /**
+     * A javah calling method.
+     */
+    public static int javah(JavaToolArgs params)
+            throws CommandExecutionException, IOException {
+        if (params.hasMinParams()) {
+            return genericJavaCMD(JavaCMD.JAVAH, params);
+        }
+        throw new AssertionError("javah command has been invoked with less parameters than needed");
+    }
+
+    /**
+     * A enum class for langtools commands.
+     */
+    enum JavaCMD {
+        JAVAC {
+            @Override
+            int run(JavaToolArgs params, PrintWriter pw) {
+                return com.sun.tools.javac.Main.compile(params.argsArr, pw);
+            }
+        },
+        JAVAC_API {
+            @Override
+            int run(JavaToolArgs params, PrintWriter pw) {
+                JavacTask ct = (JavacTask)comp.getTask(pw, null, null,
+                        params.args, null, params.sources);
+                return ((JavacTaskImpl)ct).doCall().exitCode;
+            }
+
+            @Override
+            String getName() {
+                return "javac";
+            }
+
+            @Override
+            List<String> getExceptionMsgContent(JavaToolArgs params) {
+                List<String> result = super.getExceptionMsgContent(params);
+                for (JavaFileObject source : params.sources) {
+                    if (source instanceof JavaSource) {
+                        result.add(((JavaSource)source).name);
+                    }
+                }
+                return result;
+            }
+        },
+        JAVAH {
+            @Override
+            int run(JavaToolArgs params, PrintWriter pw) {
+                return com.sun.tools.javah.Main.run(params.argsArr, pw);
+            }
+        },
+        JAVAP {
+            @Override
+            int run(JavaToolArgs params, PrintWriter pw) {
+                return com.sun.tools.javap.Main.run(params.argsArr, pw);
+            }
+        };
+
+        abstract int run(JavaToolArgs params, PrintWriter pw);
+
+        String getName() {
+            return this.name().toLowerCase();
+        }
+
+        List<String> getExceptionMsgContent(JavaToolArgs params) {
+            List<String> result = new ArrayList<>();
+            result.add(getName());
+            result.addAll(params.argsArr != null ?
+                    Arrays.asList(params.argsArr) :
+                    params.args);
+            return result;
+        }
+    }
+
+    /**
+     * A helper method for executing langtools commands.
+     */
+    private static int genericJavaCMD(
+            JavaCMD cmd,
+            JavaToolArgs params)
+            throws CommandExecutionException, IOException {
+        int rc = 0;
+        StringWriter sw = null;
+        try (PrintWriter pw = (params.errOutput == null) ?
+                null : new PrintWriter(sw = new StringWriter())) {
+            rc = cmd.run(params, pw);
+        }
+        String out = (sw == null) ? null : sw.toString();
+
+        if (params.errOutput != null && (out != null) && !out.isEmpty()) {
+            params.errOutput.addAll(splitLines(out, lineSeparator));
+        }
+
+        if ( (rc == 0 && params.whatToExpect == Expect.SUCCESS) ||
+             (rc != 0 && params.whatToExpect == Expect.FAIL) ) {
+            return rc;
+        }
+
+        throw new CommandExecutionException(cmd.getExceptionMsgContent(params),
+                params.whatToExpect);
+    }
+
+    /**
+     * A jar calling method.
+     */
+    public static boolean jar(String... params) throws CommandExecutionException {
+        Main jarGenerator = new Main(System.out, System.err, "jar");
+        boolean result = jarGenerator.run(params);
+        if (!result) {
+            List<String> command = new ArrayList<>();
+            command.add("jar");
+            command.addAll(Arrays.asList(params));
+            throw new CommandExecutionException(command, Expect.SUCCESS);
+        }
+        return result;
+    }
+
+    /**
+     * A general command calling method.
+     */
+    public static int executeCommand(AnyToolArgs params)
+            throws CommandExecutionException, IOException, InterruptedException {
+        if (params.hasMinParams()) {
+            List<String> cmd = (params.args != null) ?
+                    params.args :
+                    Arrays.asList(params.argsArr);
+            return executeCommand(cmd, params.extraEnv, params.stdOutput,
+                    params.errOutput, params.whatToExpect);
+        }
+        throw new AssertionError("command has been invoked with less parameters than needed");
+    }
+
+    /**
+     * A helper method for calling a general command.
+     */
+    private static int executeCommand(
+            List<String> command,
+            Map<String, String> extraEnv,
+            WriterHelper stdOutput,
+            WriterHelper errOutput,
+            Expect whatToExpt)
+            throws IOException, InterruptedException, CommandExecutionException {
+        ProcessBuilder pb = new ProcessBuilder(command);
+
+        if (stdOutput != null) stdOutput.pipeOutput(pb);
+        if (errOutput != null) errOutput.pipeOutput(pb);
+
+        if (extraEnv != null) {
+            pb.environment().putAll(extraEnv);
+        }
+
+        Process p = pb.start();
+
+        if (stdOutput != null) stdOutput.readFromStream(p);
+        if (errOutput != null) errOutput.readFromStream(p);
+
+        int result = p.waitFor();
+        if ( (result == 0 && whatToExpt == Expect.SUCCESS) ||
+             (result != 0 && whatToExpt == Expect.FAIL) ) {
+            return result;
+        }
+
+        throw new CommandExecutionException(command, whatToExpt);
+    }
+
+    /**
+     * This set of methods can be used instead of diff when the only needed
+     * result is the equality or inequality of the two given resources.
+     *
+     * A resource can be a file or a String list.
+     */
+    public static void compareLines(Path aPath, Path otherPath, String encoding)
+            throws FileNotFoundException, IOException, ResourcesNotEqualException {
+        compareLines(aPath, otherPath, encoding, false);
+    }
+
+    public static void compareLines(
+            Path aPath, Path otherPath, String encoding, boolean trim)
+            throws FileNotFoundException, IOException, ResourcesNotEqualException {
+        Charset charset = encoding != null ?
+                Charset.forName(encoding) :
+                defaultCharset;
+        List<String> list1 = Files.readAllLines(aPath, charset);
+        List<String> list2 = Files.readAllLines(otherPath, charset);
+        compareLines(list1, list2, trim);
+    }
+
+    public static void compareLines(Path path, List<String> strings, String encoding)
+            throws FileNotFoundException, IOException, ResourcesNotEqualException {
+        compareLines(path, strings, encoding, false);
+    }
+
+    public static void compareLines(Path path, List<String> strings,
+            String encoding, boolean trim)
+            throws FileNotFoundException, IOException, ResourcesNotEqualException {
+        Charset charset = encoding != null ?
+                Charset.forName(encoding) :
+                defaultCharset;
+        List<String> list = Files.readAllLines(path, charset);
+        compareLines(list, strings, trim);
+    }
+
+    public static void compareLines(List<String> list1, List<String> list2)
+            throws ResourcesNotEqualException {
+        compareLines(list1, list2, false);
+    }
+
+    public static void compareLines(List<String> list1,
+            List<String> list2, boolean trim) throws ResourcesNotEqualException {
+        if ((list1 == list2) || (list1 == null && list2 == null)) return;
+        if (list1.size() != list2.size())
+            throw new ResourcesNotEqualException(list1, list2);
+        int i = 0;
+        int j = 0;
+        while (i < list1.size() &&
+               j < list2.size() &&
+               equals(list1.get(i), list2.get(j), trim)) {
+            i++; j++;
+        }
+        if (!(i == list1.size() && j == list2.size()))
+            throw new ResourcesNotEqualException(list1, list2);
+    }
+
+    private static boolean equals(String s1, String s2, boolean trim) {
+        return (trim ? s1.trim().equals(s2.trim()) : s1.equals(s2));
+    }
+
+    /**
+     * A set of simple grep-like methods, looks for regExpr in text.
+     * The content of text is split using the new line character as a pattern
+     * and later the regExpr is seek in every split line. If a match is found,
+     * the whole line is added to the result.
+     */
+    public static List<String> grep(String regExpr, String text, String sep) {
+        return grep(regExpr, splitLines(text, sep));
+    }
+
+    public static List<String> grep(String regExpr, List<String> text) {
+        List<String> result = new ArrayList<>();
+        Pattern pattern = Pattern.compile(regExpr);
+        for (String s : text) {
+            if (pattern.matcher(s).find()) {
+                result.add(s);
+            }
+        }
+        return result;
+    }
+
+    public static List<String> grep(String regExpr, File f)
+            throws IOException {
+        List<String> lines = Files.readAllLines(f.toPath(), defaultCharset);
+        return grep(regExpr, lines);
+    }
+
+    /**
+     * A touch-like method.
+     */
+    public static boolean touch(String fileName) {
+        File file = new File(fileName);
+        return touch(file);
+    }
+
+    public static boolean touch(File file) {
+        if (file.exists()) {
+            file.setLastModified(System.currentTimeMillis());
+            return true;
+        }
+        return false;
+    }
+
+    public static void createJavaFile(File outFile) throws IOException {
+        createJavaFile(outFile, null);
+    }
+
+    /**
+     * A method for creating a valid but very simple java file.
+     */
+    public static void createJavaFile(File outFile, File superClass)
+            throws IOException {
+        String srcStr = "public class " + getSimpleName(outFile) + " ";
+        if (superClass != null) {
+            srcStr = srcStr.concat("extends " + getSimpleName(superClass) + " ");
+        }
+        srcStr = srcStr.concat("{}");
+        try (PrintWriter ps = new PrintWriter(new FileWriter(outFile))) {
+            ps.println(srcStr);
+        }
+    }
+
+    /**
+     * Creates a java file name given its source.
+     * The file is created in the working directory, creating a directory
+     * tree if there is a package declaration.
+     */
+    public static void createJavaFileFromSource(String source) throws IOException {
+        createJavaFileFromSource(null, source);
+    }
+
+    /**
+     * Creates a java file name given its source.
+     * The file is created in the working directory, creating a directory
+     * tree if there is a package declaration or the argument initialPath
+     * has a valid path.
+     *
+     * e.i. if initialPath is foo/ and the source is:
+     * package bar;
+     *
+     * public class bazz {}
+     *
+     * this method will create the file foo/bar/bazz.java in the working
+     * directory.
+     */
+    public static void createJavaFileFromSource(Path initialPath,
+            String source) throws IOException {
+        String fileName = getJavaFileNameFromSource(source);
+        String dirTree = getDirTreeFromSource(source);
+        Path path = (dirTree != null) ?
+                Paths.get(dirTree, fileName) :
+                Paths.get(fileName);
+        path = (initialPath != null) ?
+                initialPath.resolve(path):
+                path;
+        writeFile(path, source);
+    }
+
+    static Pattern publicClassPattern =
+            Pattern.compile("public\\s+(?:class|enum|interface){1}\\s+(\\w+)");
+    static Pattern packageClassPattern =
+            Pattern.compile("(?:class|enum|interface){1}\\s+(\\w+)");
+
+    /**
+     * Extracts the java file name from the class declaration.
+     * This method is intended for simple files and uses regular expressions,
+     * so comments matching the pattern can make the method fail.
+     */
+    private static String getJavaFileNameFromSource(String source) {
+        String className = null;
+        Matcher matcher = publicClassPattern.matcher(source);
+        if (matcher.find()) {
+            className = matcher.group(1) + ".java";
+        } else {
+            matcher = packageClassPattern.matcher(source);
+            if (matcher.find()) {
+                className = matcher.group(1) + ".java";
+            } else {
+                throw new AssertionError("Could not extract the java class " +
+                        "name from the provided source");
+            }
+        }
+        return className;
+    }
+
+    static Pattern packagePattern =
+            Pattern.compile("package\\s+(((?:\\w+\\.)*)(?:\\w+))");
+
+    /**
+     * Extracts the path from the package declaration if present.
+     * This method is intended for simple files and uses regular expressions,
+     * so comments matching the pattern can make the method fail.
+     */
+    private static String getDirTreeFromSource(String source) {
+        Matcher matcher = packagePattern.matcher(source);
+        return matcher.find() ?
+            matcher.group(1).replace(".", File.separator) :
+            null;
+    }
+
+    /**
+     * A method for creating a jar's manifest file with supplied data.
+     */
+    public static void mkManifestWithClassPath(String mainClass,
+            String... classes) throws IOException {
+        List <String> lines = new ArrayList<>();
+
+        StringBuilder sb = new StringBuilder("Class-Path: ".length() +
+                classes[0].length()).append("Class-Path: ").append(classes[0]);
+        for (int i = 1; i < classes.length; i++) {
+            sb.append(" ").append(classes[i]);
+        }
+        lines.add(sb.toString());
+        if (mainClass != null) {
+            lines.add(new StringBuilder("Main-Class: ".length() +
+                      mainClass.length())
+                      .append("Main-Class: ")
+                      .append(mainClass).toString());
+        }
+        Files.write(Paths.get("MANIFEST.MF"), lines, null);
+    }
+
+    /**
+     * A utility method to obtain the file name.
+     */
+    static String getSimpleName(File inFile) {
+        return inFile.toPath().getFileName().toString();
+    }
+
+    /**
+     * A method to write to a file, the directory tree is created if needed.
+     */
+    public static File writeFile(Path path, String body) throws IOException {
+        File result;
+        if (path.getParent() != null) {
+            Files.createDirectories(path.getParent());
+        }
+        try (FileWriter out = new FileWriter(result = path.toAbsolutePath().toFile())) {
+            out.write(body);
+        }
+        return result;
+    }
+
+    public static File writeFile(String path, String body) throws IOException {
+        return writeFile(Paths.get(path), body);
+    }
+
+    /**
+     * A rm-like method, the file is deleted only if it exists.
+     */
+    public static void rm(Path path) throws Exception {
+        Files.deleteIfExists(path);
+    }
+
+    public static void rm(String filename) throws Exception {
+        rm(Paths.get(filename));
+    }
+
+    public static void rm(File f) throws Exception {
+        rm(f.toPath());
+    }
+
+    /**
+     * Copy source file to destination file.
+     */
+    public static void copyFile(File destfile, File srcfile)
+        throws IOException {
+        copyFile(destfile.toPath(), srcfile.toPath());
+    }
+
+    public static void copyFile(Path destPath, Path srcPath)
+        throws IOException {
+        Files.createDirectories(destPath);
+        Files.copy(srcPath, destPath, REPLACE_EXISTING);
+    }
+
+    /**
+     * Splits a String using the System's line separator character as splitting point.
+     */
+    public static List<String> splitLines(String lines, String sep) {
+        return Arrays.asList(lines.split(sep));
+    }
+
+    /**
+     * Converts a String list into one String by appending the System's line separator
+     * character after each component.
+     */
+    private static String listToString(List<String> lines) {
+        StringBuilder sb = new StringBuilder();
+        for (String s : lines) {
+            sb.append(s).append(lineSeparator);
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Returns true if the OS is a Windows version.
+     */
+    public static boolean isWindows() {
+        String osName = System.getProperty("os.name");
+        return osName.toUpperCase().startsWith("WINDOWS");
+    }
+
+    /**
+     * Class representing an in-memory java source file. It is able to extract
+     * the file name from simple source codes using regular expressions.
+     */
+    public static class JavaSource extends SimpleJavaFileObject {
+        String source;
+        String name;
+
+        public JavaSource(String className, String source) {
+            super(URI.create(className),
+                    JavaFileObject.Kind.SOURCE);
+            this.name = className;
+            this.source = source;
+        }
+
+        public JavaSource(String source) {
+            super(URI.create(getJavaFileNameFromSource(source)),
+                    JavaFileObject.Kind.SOURCE);
+            this.name = getJavaFileNameFromSource(source);
+            this.source = source;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/links/LinksTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,66 @@
+/*
+ * 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 4266026
+ * @summary javac no longer follows symlinks
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main LinksTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+//original test: test/tools/javac/links/links.sh
+public class LinksTest {
+
+    private static final String BSrc =
+        "package a;\n" +
+        "\n" +
+        "public class B {}";
+
+    private static final String TSrc =
+        "class T extends a.B {}";
+
+    public static void main(String args[])
+            throws Exception {
+//      mkdir tmp
+//      cp ${TESTSRC}/b/B.java tmp
+        ToolBox.writeFile(Paths.get("tmp", "B.java"), BSrc);
+
+        try {
+//        ln -s `pwd`/tmp "${TESTCLASSES}/a"
+            Files.createSymbolicLink(Paths.get("a"), Paths.get("tmp"));
+            ////"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1
+            ToolBox.JavaToolArgs javacArgs =
+                    new ToolBox.JavaToolArgs()
+                    .setOptions("-sourcepath", ".", "-d", ".").setSources(TSrc);
+            ToolBox.javac(javacArgs);
+        } catch (UnsupportedOperationException e) {
+            System.err.println("Symbolic links not supported on this system. The test can't finish");
+        }
+    }
+
+}
--- a/test/tools/javac/links/T.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2001, 2008, 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.
- */
-
-class T extends a.B {}
--- a/test/tools/javac/links/b/B.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2001, 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 a;
-
-public class B {}
--- a/test/tools/javac/links/links.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2001, 2008, 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 4266026
-# @summary javac no longer follows symlinks
-#
-# @run shell links.sh
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    NULL=/dev/null
-    PS=":"
-    FS="/"
-    ;;
-  * )
-    echo "Unrecognized system - test skipped."
-    exit 0;
-    ;;
-esac
-
-mkdir tmp
-cp ${TESTSRC}/b/B.java tmp
-
-rm -rf T.class B.class b/B.class "${TESTCLASSES}/a" "${TESTCLASSES}/classes"
-ln -s `pwd`/tmp "${TESTCLASSES}/a"
-mkdir "${TESTCLASSES}/classes"
-
-"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/main/Option_J_At_Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,70 @@
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/*
+ * 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 8006037
+ * @summary extra space in javac -help for -J and @ options
+ */
+
+public class Option_J_At_Test {
+    public static void main(String... args) throws Exception {
+        new Option_J_At_Test().run();
+    }
+
+    void run() throws Exception {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String[] help = { "-help" };
+        int rc = com.sun.tools.javac.Main.compile(help, pw);
+        pw.flush();
+        String out = sw.toString();
+        System.out.println(out);
+        check(out, "-J<flag>",     true);
+        check(out, "-J <flag>",    false);
+        check(out, "@<filename>",  true);
+        check(out, "@ <filename>", false);
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    void check(String out, String text, boolean expect) {
+        if (out.contains(text) != expect) {
+            if (expect)
+                error("expected string not found: " + text);
+            else
+                error("unexpected string found: " + text);
+        }
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- a/test/tools/javac/multicatch/7030606/DisjunctiveTypeWellFormednessTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/multicatch/7030606/DisjunctiveTypeWellFormednessTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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,21 +23,27 @@
 
 /*
  * @test
- * @bug 7030606
+ * @bug 7030606 8006694
  * @summary Project-coin: multi-catch types should be pairwise disjoint
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm DisjunctiveTypeWellFormednessTest
  */
 
-import com.sun.source.util.JavacTask;
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.Arrays;
 import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
+import com.sun.source.util.JavacTask;
 
-public class DisjunctiveTypeWellFormednessTest {
+public class DisjunctiveTypeWellFormednessTest
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum Alternative {
         EXCEPTION("Exception"),
@@ -92,40 +98,37 @@
     }
 
     public static void main(String... args) throws Exception {
-
-        //create default shared JavaCompiler - reused across multiple compilations
-        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
-
         for (Arity arity : Arity.values()) {
             for (Alternative a1 : Alternative.values()) {
                 if (arity == Arity.ONE) {
-                    new DisjunctiveTypeWellFormednessTest(a1).run(comp, fm);
+                    pool.execute(new DisjunctiveTypeWellFormednessTest(a1));
                     continue;
                 }
                 for (Alternative a2 : Alternative.values()) {
                     if (arity == Arity.TWO) {
-                        new DisjunctiveTypeWellFormednessTest(a1, a2).run(comp, fm);
+                        pool.execute(new DisjunctiveTypeWellFormednessTest(a1, a2));
                         continue;
                     }
                     for (Alternative a3 : Alternative.values()) {
                         if (arity == Arity.THREE) {
-                            new DisjunctiveTypeWellFormednessTest(a1, a2, a3).run(comp, fm);
+                            pool.execute(new DisjunctiveTypeWellFormednessTest(a1, a2, a3));
                             continue;
                         }
                         for (Alternative a4 : Alternative.values()) {
                             if (arity == Arity.FOUR) {
-                                new DisjunctiveTypeWellFormednessTest(a1, a2, a3, a4).run(comp, fm);
+                                pool.execute(new DisjunctiveTypeWellFormednessTest(a1, a2, a3, a4));
                                 continue;
                             }
                             for (Alternative a5 : Alternative.values()) {
-                                new DisjunctiveTypeWellFormednessTest(a1, a2, a3, a4, a5).run(comp, fm);
+                                pool.execute(new DisjunctiveTypeWellFormednessTest(a1, a2, a3, a4, a5));
                             }
                         }
                     }
                 }
             }
         }
+
+        checkAfterExec(false);
     }
 
     Alternative[] alternatives;
@@ -159,10 +162,16 @@
         }
     }
 
-    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+    @Override
+    public void run() {
+        JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), diagChecker,
                 null, null, Arrays.asList(source));
-        ct.analyze();
+        try {
+            ct.analyze();
+        } catch (Throwable t) {
+            processException(t);
+            return;
+        }
         check();
     }
 
@@ -202,4 +211,5 @@
             }
         }
     }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/newlines/NewLineTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * 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 4110560 4785453
+ * @summary portability : javac.properties
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main NewLineTest
+ */
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.util.List;
+
+//original test: test/tools/javac/newlines/Newlines.sh
+public class NewLineTest {
+
+    public static void main(String args[]) throws Exception {
+//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Dline.separator='@' > ${TMP1} 2>&1
+        File javacErrOutput = new File("output.txt");
+        ToolBox.AnyToolArgs cmdArgs =
+                new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
+                .appendArgs(ToolBox.javacBinary)
+                .appendArgs(ToolBox.testToolVMOpts)
+                .appendArgs("-J-Dline.separator='@'")
+                .setErrOutput(javacErrOutput);
+        ToolBox.executeCommand(cmdArgs);
+
+//        result=`cat ${TMP1} | wc -l`
+//        if [ "$result" -eq 0 ] passed
+        List<String> lines = Files.readAllLines(javacErrOutput.toPath(),
+                Charset.defaultCharset());
+        if (lines.size() != 1) {
+            throw new AssertionError("The compiler output should have one line only");
+        }
+    }
+
+}
--- a/test/tools/javac/newlines/Newlines.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#
-# Copyright (c) 2002, 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 4110560 4785453
-# @summary portability : javac.properties
-#
-# @run shell Newlines.sh
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | CYGWIN* )
-    FS="/"
-    ;;
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-TMP1=OUTPUT.txt
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Dline.separator='@' > ${TMP1} 2>&1
-cat ${TMP1}
-result=`cat ${TMP1} | wc -l`
-if [ "$result" -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- a/test/tools/javac/processing/6994946/SemanticErrorTest.2.out	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/processing/6994946/SemanticErrorTest.2.out	Tue Jul 02 10:13:00 2013 +0100
@@ -1,4 +1,3 @@
 SemanticErrorTest.java:11:46: compiler.err.repeated.interface
 - compiler.err.proc.messager: Deliberate Error
-SemanticErrorTest.java:11:46: compiler.err.repeated.interface
-2 errors
+2 errors
\ No newline at end of file
--- a/test/tools/javac/processing/model/element/TestAnonClassNames.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/processing/model/element/TestAnonClassNames.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -78,7 +78,7 @@
         @Nesting(LOCAL)
         class LocalClass{};
 
-        Object o =  new /*@Nesting(ANONYMOUS)*/ Object() { // An anonymous annotated class
+        Object o =  new @Nesting(ANONYMOUS) Object() { // An anonymous annotated class
                 public String toString() {
                     return "I have no name!";
                 }
@@ -96,10 +96,9 @@
         List<String> names = new ArrayList<String>();
         for(Class<?> clazz : classes) {
             String name = clazz.getName();
-            Nesting anno = clazz.getAnnotation(Nesting.class);
             System.out.format("%s is %s%n",
                               clazz.getName(),
-                              anno == null ? "(unset/ANONYMOUS)" : anno.value());
+                              clazz.getAnnotation(Nesting.class).value());
             testClassName(name);
             names.add(name);
         }
@@ -158,6 +157,7 @@
     }
 }
 
+@Target({ElementType.TYPE, ElementType.TYPE_USE})
 @Retention(RUNTIME)
 @interface Nesting {
     NestingKind value();
@@ -185,8 +185,8 @@
                                   typeElt.getQualifiedName().toString(),
                                   typeElt.getKind().toString(),
                                   nestingKind.toString());
-                Nesting anno = typeElt.getAnnotation(Nesting.class);
-                if ((anno == null ? NestingKind.ANONYMOUS : anno.value()) != nestingKind) {
+
+                if (typeElt.getAnnotation(Nesting.class).value() != nestingKind) {
                     throw new RuntimeException("Mismatch of expected and reported nesting kind.");
                 }
             }
--- a/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -28,7 +28,7 @@
  * @summary Modeling type implementing missing interfaces
  * @library /tools/javac/lib
  * @build JavacTestingAbstractProcessor TestMissingElement
- * @compile -proc:only -XprintRounds -processor TestMissingElement InvalidSource.java
+ * @compile/fail/ref=TestMissingElement.ref -proc:only -XprintRounds -XDrawDiagnostics -processor TestMissingElement InvalidSource.java
  */
 
 import java.util.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/TestMissingElement/TestMissingElement.ref	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,49 @@
+Round 1:
+	input files: {ExpectInterfaces, ExpectSupertype, OK, InvalidSource}
+	annotations: [ExpectSupertype, ExpectInterfaces]
+	last round: false
+Round 2:
+	input files: {}
+	annotations: []
+	last round: true
+InvalidSource.java:55:42: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:58:44: compiler.err.doesnt.exist: A
+InvalidSource.java:61:54: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.package, java.util, null)
+InvalidSource.java:64:47: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:67:44: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:70:46: compiler.err.doesnt.exist: A
+InvalidSource.java:73:55: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:76:59: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:79:46: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:79:49: compiler.err.cant.resolve.location: kindname.class, B, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:82:44: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:85:46: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:88:50: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:91:45: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:91:48: compiler.err.cant.resolve.location: kindname.class, B, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:94:49: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:97:51: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:97:57: compiler.err.cant.resolve.location: kindname.class, B, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:100:49: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:103:51: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:103:57: compiler.err.cant.resolve.location: kindname.class, B, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+InvalidSource.java:106:58: compiler.err.cant.resolve.location: kindname.class, X, , , (compiler.misc.location: kindname.class, InvalidSource, null)
+22 errors
+check supertype: InvalidSource.TestClassMissingClassA -- !:empty clss A!
+check supertype: InvalidSource.TestClassMissingClassAB -- !:empty clss (pkg A).B!
+check supertype: InvalidSource.TestClassMissingClass_juA -- !:empty clss (pkg java.util).A!
+check supertype: InvalidSource.TestClassTMissingClassAT -- !:empty clss A!<tvar T>
+check interfaces: InvalidSource.TestClassMissingIntfA -- !:empty intf A!
+check interfaces: InvalidSource.TestClassMissingIntfAB -- !:empty intf (pkg A).B!
+check interfaces: InvalidSource.TestClassMissingIntfAOK -- !:empty intf A!, intf OK
+check interfaces: InvalidSource.TestClassOKMissingIntfA -- intf OK, !:empty intf A!
+check interfaces: InvalidSource.TestClassMissingIntfA_B -- !:empty intf A!, !:empty intf B!
+check interfaces: InvalidSource.TestIntfMissingIntfA -- !:empty intf A!
+check interfaces: InvalidSource.TestIntfMissingIntfAOK -- !:empty intf A!, intf OK
+check interfaces: InvalidSource.TestIntfOKMissingIntfA -- intf OK, !:empty intf A!
+check interfaces: InvalidSource.TestIntfMissingIntfAB -- !:empty intf A!, !:empty intf B!
+check interfaces: InvalidSource.TestClassTMissingIntfAT -- !:empty intf A!<tvar T>
+check interfaces: InvalidSource.TestClassTMissingIntfAT_B -- !:empty intf A!<tvar T>, !:empty intf B!
+check interfaces: InvalidSource.TestIntfTMissingIntfAT -- !:empty intf A!<tvar T>
+check interfaces: InvalidSource.TestIntfTMissingIntfAT_B -- !:empty intf A!<tvar T>, !:empty intf B!
+check interfaces: InvalidSource.TestClassListMissingX -- intf (pkg java.util).List<!:empty clss X!>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/ElementRepAnnoTester.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,555 @@
+/*
+ * 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.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.lang.model.type.MirroredTypeException;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+
+public class ElementRepAnnoTester extends JavacTestingAbstractProcessor {
+    // All methods to test.
+    final EnumSet<TestMethod> ALL_TEST_METHODS = EnumSet.allOf(TestMethod.class);
+    int count = 0;
+    int error = 0;
+
+    public boolean process(Set<? extends TypeElement> annotations,
+            RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            List<String> superClass = Arrays.asList("A", "B", "C", "D", "E",
+                    "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P");
+            // Go through all test classes
+            for (Element element : roundEnv.getRootElements()) {
+                // For now, no testing super classes (TODO)
+                if (element.getKind() == ElementKind.CLASS
+                        && !superClass.contains(element.getSimpleName().toString())) {
+                    // Compare expected and actual values from methods.
+                    checkAnnoValues(element, ALL_TEST_METHODS);
+                    // Now, look for enclosed elements in test classes.
+                    for (Element elements : element.getEnclosedElements()) {
+                        // Look for Methods annotations.
+                        if (elements.getKind() == ElementKind.METHOD
+                                && elements.getSimpleName().toString().equals("testMethod")) {
+                            checkAnnoValues(elements, ALL_TEST_METHODS);
+                        }
+                        // Look for Field annotations.
+                        if (elements.getKind() == ElementKind.FIELD
+                                && elements.getSimpleName().toString().equals("testField")) {
+                            checkAnnoValues(elements, ALL_TEST_METHODS);
+                        }
+                    }
+                }
+            }
+
+            if (error != 0) {
+                System.out.println("Total tests : " + count);
+                System.out.println("Total test failures : " + error);
+                throw new RuntimeException();
+            } else {
+                System.out.println("ALL TESTS PASSED. " + count);
+            }
+        }
+        return true;
+    }
+
+    enum TestMethod {
+        getAnnotation,
+        getAnnotationsByType,
+        getAllAnnotationMirrors,
+        getAnnotationMirrors
+    }
+
+    protected void checkAnnoValues(Element element, EnumSet<TestMethod> testMethods) {
+        boolean baseAnnoPresent = false;
+        boolean conAnnoPresent = false;
+        ExpectedBase eb = null;
+        ExpectedContainer ec = null;
+        // Getting the expected values to compare with.
+        eb = element.getAnnotation(ExpectedBase.class);
+        ec = element.getAnnotation(ExpectedContainer.class);
+
+        if (eb == null) {
+            System.out.println("Did not find ExpectedBase Annotation in  "
+                    + element.getSimpleName().toString() + ", Test will exit");
+            throw new RuntimeException();
+        }
+        if (ec == null) {
+            System.out.println("Did not find ExpectedContainer Annotation in "
+                    + element.getSimpleName().toString() + " Test will exit");
+            throw new RuntimeException();
+        }
+        // Look if all test cases have ExpectedBase and ExpectedContainer values().
+        TypeMirror valueBase = null;
+        TypeMirror valueCon = null;
+
+        try {
+            eb.value();
+        } catch (MirroredTypeException mte) {
+            valueBase = mte.getTypeMirror();
+        }
+
+        try {
+            ec.value();
+        } catch (MirroredTypeException mte1) {
+            valueCon = mte1.getTypeMirror();
+        }
+
+        String expectedBaseAnno = valueBase.toString();
+        String expectedConAnno = valueCon.toString();
+
+        if (!expectedBaseAnno.equals("java.lang.annotation.Annotation")) {
+            baseAnnoPresent = true;
+        }
+        if (!expectedConAnno.equalsIgnoreCase("java.lang.annotation.Annotation")) {
+            conAnnoPresent = true;
+        }
+
+        // Look into TestMethod and compare method's output with expected values.
+        for (TestMethod testMethod : testMethods) {
+            boolean isBasePass = true;
+            boolean isConPass = true;
+
+            switch (testMethod) {
+                case getAnnotation:
+                    if (baseAnnoPresent) {
+                        count++;
+                        Annotation actualAnno = getAnnotationBase(element);
+                        String expectedAnno = eb.getAnnotation();
+                        isBasePass = compareAnnotation(actualAnno, expectedAnno);
+                    }
+                    if (conAnnoPresent) {
+                        count++;
+                        Annotation actualAnno = getAnnotationContainer(element);
+                        String expectedAnno = ec.getAnnotation();
+                        isConPass = compareAnnotation(actualAnno, expectedAnno);
+                    }
+                    if (!isBasePass || !isConPass) {
+                        System.out.println("FAIL in " + element.getSimpleName()
+                                + "-" + element.getKind()
+                                + " method: getAnnotation(class <T>)");
+                        error++;
+                    }
+                    break;
+
+                case getAnnotationMirrors:
+                    if (baseAnnoPresent) {
+                        count++;
+                        List<? extends AnnotationMirror> actualDeclAnnos =
+                                element.getAnnotationMirrors();
+                        String[] expectedAnnos = eb.getAnnotationMirrors();
+                        isBasePass = compareArrVals(actualDeclAnnos, expectedAnnos);
+                    }
+                    if (conAnnoPresent) {
+                        isConPass = true;
+                    }
+                    if (!isBasePass || !isConPass) {
+                        System.out.println("FAIL in " + element.getSimpleName()
+                                + "-" + element.getKind()
+                                + " method: getAnnotationMirrors()");
+                        error++;
+                    }
+                    break;
+
+                case getAnnotationsByType:
+                    if (baseAnnoPresent) {
+                        count++;
+                        Annotation[] actualAnnosArgs = getAnnotationsBase(element);
+                        String[] expectedAnnos = eb.getAnnotationsByType();
+                        isBasePass = compareArrVals(actualAnnosArgs, expectedAnnos);
+                    }
+                    if (conAnnoPresent) {
+                        count++;
+                        Annotation[] actualAnnosArgs = getAnnotationsContainer(element);
+                        String[] expectedAnnos = ec.getAnnotationsByType();
+                        isConPass = compareArrVals(actualAnnosArgs, expectedAnnos);
+                    }
+                    if (!isBasePass || !isConPass) {
+                        System.out.println("FAIL in " + element.getSimpleName()
+                                + "-" + element.getKind()
+                                + " method: getAnnotationsByType(class <T>)");
+                        error++;
+                    }
+                    break;
+
+                case getAllAnnotationMirrors:
+                    if (baseAnnoPresent) {
+                        count++;
+                        Elements elements = processingEnv.getElementUtils();
+                        List<? extends AnnotationMirror> actualAnnosMirrors =
+                                elements.getAllAnnotationMirrors(element);
+                        String[] expectedAnnos = eb.getAllAnnotationMirrors();
+                        isBasePass = compareArrVals(actualAnnosMirrors, expectedAnnos);
+                    }
+                    if (conAnnoPresent) {
+                        isConPass = true;
+                    }
+                    if (!isBasePass || !isConPass) {
+                        System.out.println("FAIL in " + element.getSimpleName()
+                                + "-" + element.getKind()
+                                + " method: getAllAnnotationMirrors(e)");
+                        error++;
+                    }
+                    break;
+            }
+        }
+    }
+    // Sort tests to be run with different anno processors.
+    final List<String> singularAnno = Arrays.asList(
+            "SingularBasicTest"
+            );
+    final List<String> singularInheritedAnno = Arrays.asList(
+            "SingularInheritedATest"
+            );
+    final List<String> repeatableAnno = Arrays.asList(
+            "RepeatableBasicTest",
+            "MixRepeatableAndOfficialContainerBasicTest",
+            "OfficialContainerBasicTest",
+            "RepeatableOfficialContainerBasicTest"
+            );
+    final List<String> repeatableInheritedAnno = Arrays.asList(
+            "RepeatableInheritedTest",
+            "RepeatableOverrideATest",
+            "RepeatableOverrideBTest",
+            "OfficialContainerInheritedTest",
+            "MixRepeatableAndOfficialContainerInheritedA1Test",
+            "MixRepeatableAndOfficialContainerInheritedB1Test",
+            "MixRepeatableAndOfficialContainerInheritedA2Test",
+            "MixRepeatableAndOfficialContainerInheritedB2Test"
+            );
+    final List<String> repeatableContainerInheritedAnno = Arrays.asList(
+            "RepeatableOfficialContainerInheritedTest"
+            );
+    final List<String> unofficialAnno = Arrays.asList(
+            "UnofficialContainerBasicTest",
+            "MixSingularAndUnofficialContainerBasicTest"
+            );
+    final List<String> unofficialInheritedAnno = Arrays.asList(
+            "UnofficialContainerInheritedTest",
+            "SingularInheritedBTest",
+            "MixSingularAndUnofficialContainerInheritedA1Test",
+            "MixSingularAndUnofficialContainerInheritedB1Test",
+            "MixSingularAndUnofficialContainerInheritedA2Test",
+            "MixSingularAndUnofficialContainerInheritedB2Test"
+            );
+    // Respective container annotation for the different test cases to test.
+    final List<String> repeatableAnnoContainer = repeatableAnno;
+    final List<String> repeatableInheritedAnnoContainer = repeatableInheritedAnno;
+    final List<String> repeatableContainerInheritedAnnoContainer =
+            repeatableContainerInheritedAnno;
+    final List<String> unofficialAnnoContainer = unofficialAnno;
+    final List<String> unofficialInheritedAnnoContainer = unofficialInheritedAnno;
+
+    // Variables to verify if all test cases have been run.
+    private Annotation specialAnno = new Annotation() {
+       @Override
+        public Class annotationType() {
+            return null;
+        }
+    };
+    private Annotation[] specialAnnoArray = new Annotation[1];
+    private List<AnnotationMirror> specialAnnoMirrors =
+            new java.util.ArrayList<AnnotationMirror>(2);
+
+    private Annotation getAnnotationBase(Element e) {
+        Annotation actualAnno = specialAnno;
+
+        if (singularAnno.contains(
+                e.getEnclosingElement().toString())
+                || singularAnno.contains(
+                e.getSimpleName().toString())
+                || unofficialAnno.contains(
+                e.getEnclosingElement().toString())
+                || unofficialAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(Foo.class);
+        }
+        if (singularInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || singularInheritedAnno.contains(
+                e.getSimpleName().toString())
+                || unofficialInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || unofficialInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(FooInherited.class);
+        }
+        if (repeatableAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(Bar.class);
+        }
+        if (repeatableInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarInherited.class);
+        }
+        if (repeatableContainerInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableContainerInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarInheritedContainer.class);
+        }
+        return actualAnno;
+    }
+
+    private Annotation getAnnotationContainer(Element e) {
+        Annotation actualAnno = specialAnno;
+
+        if (repeatableAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarContainer.class);
+        }
+        if (repeatableInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarInheritedContainer.class);
+        }
+        if (repeatableContainerInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableContainerInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(BarInheritedContainerContainer.class);
+        }
+        if (unofficialAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || unofficialAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(UnofficialContainer.class);
+        }
+        if (unofficialInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || unofficialInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnno = e.getAnnotation(UnofficialInheritedContainer.class);
+        }
+        return actualAnno;
+    }
+
+    private Annotation[] getAnnotationsBase(Element e) {
+        Annotation[] actualAnnosArgs = specialAnnoArray;
+
+        if (singularAnno.contains(
+                e.getEnclosingElement().toString())
+                || singularAnno.contains(
+                e.getSimpleName().toString())
+                || unofficialAnno.contains(
+                e.getEnclosingElement().toString())
+                || unofficialAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(Foo.class);
+        }
+        if (singularInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || singularInheritedAnno.contains(
+                e.getSimpleName().toString())
+                || unofficialInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || unofficialInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(FooInherited.class);
+        }
+        if (repeatableAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(Bar.class);
+        }
+        if (repeatableInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarInherited.class);
+        }
+        if (repeatableContainerInheritedAnno.contains(
+                e.getEnclosingElement().toString())
+                || repeatableContainerInheritedAnno.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarInheritedContainer.class);
+        }
+        return actualAnnosArgs;
+    }
+
+    private Annotation[] getAnnotationsContainer(Element e) {
+        Annotation[] actualAnnosArgs = specialAnnoArray;
+
+        if (repeatableAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarContainer.class);
+        }
+        if (repeatableInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarInheritedContainer.class);
+        }
+        if (repeatableContainerInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || repeatableContainerInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(BarInheritedContainerContainer.class);
+        }
+        if (unofficialAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || unofficialAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(UnofficialContainer.class);
+        }
+        if (unofficialInheritedAnnoContainer.contains(
+                e.getEnclosingElement().toString())
+                || unofficialInheritedAnnoContainer.contains(
+                e.getSimpleName().toString())) {
+            actualAnnosArgs = e.getAnnotationsByType(UnofficialInheritedContainer.class);
+        }
+        return actualAnnosArgs;
+    }
+
+    // Array comparison: Length should be same and all expected values
+    // should be present in actualAnnos[].
+    private boolean compareArrVals(Annotation[] actualAnnos, String[] expectedAnnos) {
+        // Look if test case was run.
+        if (actualAnnos == specialAnnoArray) {
+            return false; // no testcase matches
+        }
+        if (actualAnnos.length != expectedAnnos.length) {
+            System.out.println("Length not same. "
+                    + " actualAnnos length = " + actualAnnos.length
+                    + " expectedAnnos length = " + expectedAnnos.length);
+            printArrContents(actualAnnos);
+            printArrContents(expectedAnnos);
+            return false;
+        } else {
+            int i = 0;
+            String[] actualArr = new String[actualAnnos.length];
+            for (Annotation a : actualAnnos) {
+                actualArr[i++] = a.toString();
+            }
+            List<String> actualList = Arrays.asList(actualArr);
+            List<String> expectedList = Arrays.asList(expectedAnnos);
+
+            if (!actualList.containsAll(expectedList)) {
+                System.out.println("Array values are not same");
+                printArrContents(actualAnnos);
+                printArrContents(expectedAnnos);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    // Array comparison: Length should be same and all expected values
+    // should be present in actualAnnos List<?>.
+    private boolean compareArrVals(List<? extends AnnotationMirror> actualAnnos,
+            String[] expectedAnnos) {
+        // Look if test case was run.
+        if (actualAnnos == specialAnnoMirrors) {
+            return false; //no testcase run
+        }
+        if (actualAnnos.size() != expectedAnnos.length) {
+            System.out.println("Length not same. "
+                    + " actualAnnos length = " + actualAnnos.size()
+                    + " expectedAnnos length = " + expectedAnnos.length);
+            printArrContents(actualAnnos);
+            printArrContents(expectedAnnos);
+            return false;
+        } else {
+            int i = 0;
+            String[] actualArr = new String[actualAnnos.size()];
+            String annoTypeName = "";
+            for (AnnotationMirror annotationMirror : actualAnnos) {
+                if (annotationMirror.getAnnotationType().toString().contains("Expected")) {
+                    annoTypeName = annotationMirror.getAnnotationType().toString();
+                } else {
+                     annoTypeName = annotationMirror.toString();
+                }
+                actualArr[i++] = annoTypeName;
+            }
+            List<String> actualList = Arrays.asList(actualArr);
+            List<String> expectedList = Arrays.asList(expectedAnnos);
+
+            if (!actualList.containsAll(expectedList)) {
+                System.out.println("Array values are not same");
+                printArrContents(actualAnnos);
+                printArrContents(expectedAnnos);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private void printArrContents(Annotation[] actualAnnos) {
+        for (Annotation a : actualAnnos) {
+            System.out.println("actualAnnos values = " + a);
+        }
+    }
+
+    private void printArrContents(String[] expectedAnnos) {
+        for (String s : expectedAnnos) {
+            System.out.println("expectedAnnos values =  " + s);
+        }
+    }
+
+    private void printArrContents(List<? extends AnnotationMirror> actualAnnos) {
+        for (AnnotationMirror annotationMirror : actualAnnos) {
+            System.out.println("actualAnnos values = " + annotationMirror);
+        }
+    }
+
+    private boolean compareAnnotation(Annotation actualAnno, String expectedAnno) {
+        //String actualAnnoName = "";
+        boolean isSame = true;
+        // Look if test case was run.
+        if (actualAnno == specialAnno) {
+            return false; //no testcase run
+        }
+        if (actualAnno != null) {
+            if (!actualAnno.toString().equalsIgnoreCase(expectedAnno)) {
+                System.out.println("Anno did not match. "
+                        + " expectedAnno = " + expectedAnno
+                        + " actualAnno = " + actualAnno);
+                isSame = false;
+            } else {
+                isSame = true;
+            }
+        } else {
+            if (expectedAnno.compareToIgnoreCase("null") == 0) {
+                isSame = true;
+            } else {
+                System.out.println("Actual anno is null");
+                isSame = false;
+            }
+        }
+        return isSame;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerBasicTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,119 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Bar.class,
+        getAnnotation = "@Bar(value=0)",
+        getAnnotationsByType = {
+            "@Bar(value=0)",
+            "@Bar(value=1)",
+            "@Bar(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@Bar(0)",
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@Bar(0)",
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarContainer.class,
+        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+@Bar(value = 0)
+@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+class MixRepeatableAndOfficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "@Bar(value=0)",
+            getAnnotationsByType = {
+                "@Bar(value=0)",
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@Bar(0)",
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Bar(0)",
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @Bar(value = 0)
+    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "@Bar(value=0)",
+            getAnnotationsByType = {
+                "@Bar(value=0)",
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@Bar(0)",
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Bar(0)",
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @Bar(value = 0)
+    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+    void testMethod() {}
+   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerInheritedA1Test.java
+ */
+
+@BarInherited(value = 0)
+class E {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=0)",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInherited(0)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+class MixRepeatableAndOfficialContainerInheritedA1Test extends E {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA2Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,67 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerInheritedA2Test.java
+ */
+
+@BarInherited(value = 0)
+class N {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=3)",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)",
+            "@BarInherited(value=3)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInherited(3)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInherited(3)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+@BarInherited(value = 3)
+class MixRepeatableAndOfficialContainerInheritedA2Test extends N {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerInheritedB1Test.java
+ */
+
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+class M {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=0)",
+        getAnnotationsByType = {"@BarInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@BarInherited(0)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInherited(value = 0)
+class MixRepeatableAndOfficialContainerInheritedB1Test extends M {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixRepeatableAndOfficialContainerInheritedB2Test.java
+ */
+
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+@BarInherited(value = 3)
+class H {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=0)",
+        getAnnotationsByType = {"@BarInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@BarInherited(0)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInherited(value = 0)
+class MixRepeatableAndOfficialContainerInheritedB2Test extends H {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerBasicTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,112 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only MixSingularAndUnofficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Foo.class,
+        getAnnotation = "@Foo(value=0)",
+        getAnnotationsByType = {"@Foo(value=0)"},
+        getAllAnnotationMirrors = {
+            "@Foo(0)",
+            "@UnofficialContainer({@Foo(1), @Foo(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@Foo(0)",
+            "@UnofficialContainer({@Foo(1), @Foo(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialContainer.class,
+        getAnnotation = "@UnofficialContainer("
+        + "value=[@Foo(value=1), @Foo(value=2)])",
+        getAnnotationsByType = {"@UnofficialContainer("
+                + "value=[@Foo(value=1), @Foo(value=2)])"})
+@Foo(value = 0)
+@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+class MixSingularAndUnofficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "@Foo(value=0)",
+            getAnnotationsByType = {"@Foo(value=0)"},
+            getAllAnnotationMirrors = {
+                "@Foo(0)",
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Foo(0)",
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = UnofficialContainer.class,
+            getAnnotation = "@UnofficialContainer("
+            + "value=[@Foo(value=1), @Foo(value=2)])",
+            getAnnotationsByType = {"@UnofficialContainer("
+                    + "value=[@Foo(value=1), @Foo(value=2)])"})
+    @Foo(value = 0)
+    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "@Foo(value=0)",
+            getAnnotationsByType = {"@Foo(value=0)"},
+            getAllAnnotationMirrors = {
+                "@Foo(0)",
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Foo(0)",
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = UnofficialContainer.class,
+            getAnnotation = "@UnofficialContainer("
+            + "value=[@Foo(value=1), @Foo(value=2)])",
+            getAnnotationsByType = {"@UnofficialContainer("
+                    + "value=[@Foo(value=1), @Foo(value=2)])"})
+    @Foo(value = 0)
+    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA1Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixSingularAndUnofficialContainerInheritedA1Test.java
+ */
+
+@FooInherited(value = 0)
+class L {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=0)",
+        getAnnotationsByType = {"@FooInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(0)",
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
+class MixSingularAndUnofficialContainerInheritedA1Test extends L {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA2Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,63 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixSingularAndUnofficialContainerInheritedA2Test.java
+ */
+
+@FooInherited(value = 0)
+class K {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=3)",
+        getAnnotationsByType = {"@FooInherited(value=3)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(3)",
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "@FooInherited(3)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
+@FooInherited(value = 3)
+class MixSingularAndUnofficialContainerInheritedA2Test extends K {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB1Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixSingularAndUnofficialContainerInheritedB1Test.java
+ */
+
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1),@FooInherited(value = 2)})
+class J {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=0)",
+        getAnnotationsByType = {"@FooInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(0)",
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@FooInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+@FooInherited(value = 0)
+class MixSingularAndUnofficialContainerInheritedB1Test extends J {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB2Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * MixSingularAndUnofficialContainerInheritedB2Test.java
+ */
+
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)})
+@FooInherited(value = 3)
+class G {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=0)",
+        getAnnotationsByType = {"@FooInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(0)",
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@FooInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+@FooInherited(value = 0)
+class MixSingularAndUnofficialContainerInheritedB2Test extends G{}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerBasicTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,106 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only OfficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Bar.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@Bar(value=1)",
+            "@Bar(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarContainer.class,
+        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+class OfficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerInheritedTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only OfficialContainerInheritedTest.java
+ */
+
+@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)})
+class D {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+class OfficialContainerInheritedTest extends D {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,109 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Bar.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@Bar(value=1)",
+            "@Bar(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarContainer({@Bar(1), @Bar(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarContainer.class,
+        getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+        getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+@Bar(value = 1)
+@Bar(value = 2)
+class RepeatableBasicTest {
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @Bar(value = 1)
+    @Bar(value = 2)
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@Bar(value=1)",
+                "@Bar(value=2)"
+            },
+            getAllAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainer({@Bar(1), @Bar(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
+            getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
+    @Bar(value = 1)
+    @Bar(value = 2)
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableInheritedTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableInheritedTest.java
+ */
+
+@BarInherited(value = 1)
+@BarInherited(value = 2)
+class I {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+class RepeatableInheritedTest extends I {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerBasicTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,106 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableOfficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Bar.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {},
+        getAllAnnotationMirrors = {
+            "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarContainer.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@BarContainer(value=[@Bar(value=1)])",
+            "@BarContainer(value=[@Bar(value=2)])"})
+@BarContainer(value = {@Bar(value = 1)})
+@BarContainer(value = {@Bar(value = 2)})
+class RepeatableOfficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {},
+            getAllAnnotationMirrors = {
+                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@BarContainer(value=[@Bar(value=1)])",
+                "@BarContainer(value=[@Bar(value=2)])"})
+    @BarContainer(value = {@Bar(value = 1)})
+    @BarContainer(value = {@Bar(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Bar.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {},
+            getAllAnnotationMirrors = {
+                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = BarContainer.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {
+                "@BarContainer(value=[@Bar(value=1)])",
+                "@BarContainer(value=[@Bar(value=2)])"})
+    @BarContainer(value = {@Bar(value = 1)})
+    @BarContainer(value = {@Bar(value = 2)})
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerInheritedTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,66 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * RepeatableOfficialContainerInheritedTest.java
+ */
+
+@BarInheritedContainer(value = {@BarInherited(value = 1)})
+@BarInheritedContainer(value = {@BarInherited(value = 2)})
+class O {}
+
+@ExpectedBase(
+        value = BarInheritedContainer.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {
+            "@BarInheritedContainer(value=[@BarInherited(value=1)])",
+            "@BarInheritedContainer(value=[@BarInherited(value=2)])"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInheritedContainerContainer("
+                + "{@BarInheritedContainer({@BarInherited(1)}),"
+                + " @BarInheritedContainer({@BarInherited(2)})})",
+                "ExpectedBase",
+                "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainerContainer.class,
+        getAnnotation = "@BarInheritedContainerContainer("
+        + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)]),"
+        + " @BarInheritedContainer(value=[@BarInherited(value=2)])])",
+        getAnnotationsByType = {"@BarInheritedContainerContainer("
+                + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)]),"
+        + " @BarInheritedContainer(value=[@BarInherited(value=2)])])"})
+class RepeatableOfficialContainerInheritedTest extends O {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideATest.java
+ */
+
+@BarInherited(value = 1)
+@BarInherited(value = 2)
+class B {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=3)",
+        getAnnotationsByType = {"@BarInherited(value=3)"},
+        getAllAnnotationMirrors = {
+            "@BarInherited(3)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInherited(3)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInherited(value = 3)
+class RepeatableOverrideATest extends B {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+/*
+ * @ignore
+ * @test
+ * @bug     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideBTest.java
+ */
+
+@BarInherited(value = 0)
+class C {}
+
+@ExpectedBase(
+        value = BarInherited.class,
+        getAnnotation = "@BarInherited(value=0)",
+        getAnnotationsByType = {
+            "@BarInherited(value=1)",
+            "@BarInherited(value=2)"
+        },
+        getAllAnnotationMirrors = {
+            "@BarInherited(0)",
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = BarInheritedContainer.class,
+        getAnnotation = "@BarInheritedContainer("
+        + "value=[@BarInherited(value=1), @BarInherited(value=2)])",
+        getAnnotationsByType = {"@BarInheritedContainer("
+                + "value=[@BarInherited(value=1), @BarInherited(value=2)])"})
+@BarInherited(value = 1)
+@BarInherited(value = 2)
+class RepeatableOverrideBTest extends C {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/SingularBasicTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only SingularBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Foo.class,
+        getAnnotation = "@Foo(value=0)",
+        getAnnotationsByType = {"@Foo(value=0)"},
+        getAllAnnotationMirrors = {
+            "@Foo(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@Foo(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer
+@Foo(value = 0)
+public class SingularBasicTest {
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "@Foo(value=0)",
+            getAnnotationsByType = {"@Foo(value=0)"},
+            getAllAnnotationMirrors = {
+                "@Foo(0)",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Foo(0)",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer
+    @Foo(value = 0)
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "@Foo(value=0)",
+            getAnnotationsByType = {"@Foo(value=0)"},
+            getAllAnnotationMirrors = {
+                "@Foo(0)",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@Foo(0)",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer
+    @Foo(value = 0)
+    void testMethod() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/SingularInheritedATest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,52 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only SingularInheritedATest.java
+ */
+
+@FooInherited(value = 0)
+class A {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=0)",
+        getAnnotationsByType = {"@FooInherited(value=0)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(0)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer
+class SingularInheritedATest extends A {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/SingularInheritedBTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only SingularInheritedBTest.java
+ */
+
+@FooInherited(value = 1)
+class P {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "@FooInherited(value=2)",
+        getAnnotationsByType = {"@FooInherited(value=2)"},
+        getAllAnnotationMirrors = {
+            "@FooInherited(2)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@FooInherited(2)",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {})
+@FooInherited(value = 2)
+class SingularInheritedBTest extends P {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerBasicTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only UnofficialContainerBasicTest.java
+ */
+
+@ExpectedBase(
+        value = Foo.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {},
+        getAllAnnotationMirrors = {
+            "@UnofficialContainer({@Foo(1), @Foo(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "@UnofficialContainer({@Foo(1), @Foo(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialContainer.class,
+        getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
+        getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
+@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+class UnofficialContainerBasicTest {
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {},
+            getAllAnnotationMirrors = {
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = UnofficialContainer.class,
+            getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
+            getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
+    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+    int testField = 0;
+
+    @ExpectedBase(
+            value = Foo.class,
+            getAnnotation = "null",
+            getAnnotationsByType = {},
+            getAllAnnotationMirrors = {
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            },
+            getAnnotationMirrors = {
+                "@UnofficialContainer({@Foo(1), @Foo(2)})",
+                "ExpectedBase",
+                "ExpectedContainer"
+            })
+    @ExpectedContainer(
+            value = UnofficialContainer.class,
+            getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])",
+            getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"})
+    @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)})
+    void testMethod() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerInheritedTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,58 @@
+/*
+ * 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     8004822
+ * @author  mnunez
+ * @summary Language model api test basics for repeating annotations
+ * @library /tools/javac/lib
+ * @library supportingAnnotations
+ * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
+ * @compile -processor ElementRepAnnoTester -proc:only
+ * UnofficialContainerInheritedTest.java
+ */
+
+@UnofficialInheritedContainer(value = {@FooInherited(value = 1),@FooInherited(value = 2)})
+class F {}
+
+@ExpectedBase(
+        value = FooInherited.class,
+        getAnnotation = "null",
+        getAnnotationsByType = {},
+        getAllAnnotationMirrors = {
+            "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})",
+            "ExpectedBase",
+            "ExpectedContainer"
+        },
+        getAnnotationMirrors = {
+            "ExpectedBase",
+            "ExpectedContainer"
+        })
+@ExpectedContainer(
+        value = UnofficialInheritedContainer.class,
+        getAnnotation = "@UnofficialInheritedContainer("
+        + "value=[@FooInherited(value=1), @FooInherited(value=2)])",
+        getAnnotationsByType = {"@UnofficialInheritedContainer("
+                + "value=[@FooInherited(value=1), @FooInherited(value=2)])"})
+class UnofficialContainerInheritedTest extends F {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/Bar.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(BarContainer.class)
+public @interface Bar {
+    int value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(BarContainerContainer.class)
+public @interface BarContainer {
+    Bar[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarContainerContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface BarContainerContainer {
+    BarContainer[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInherited.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,33 @@
+/*
+ * 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.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@Repeatable(BarInheritedContainer.class)
+public @interface BarInherited {
+    int value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInheritedContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,33 @@
+/*
+ * 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.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@Repeatable(BarInheritedContainerContainer.class)
+public @interface BarInheritedContainer {
+    BarInherited[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInheritedContainerContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface BarInheritedContainerContainer {
+    BarInheritedContainer[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/ExpectedBase.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectedBase {
+    Class<? extends Annotation> value() default Annotation.class;
+    String getAnnotation() default "";
+    String[] getAllAnnotationMirrors() default {};
+    String[] getAnnotationMirrors() default {};
+    // Java SE 8 methods.
+    String[] getAnnotationsByType() default {};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/ExpectedContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * 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.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExpectedContainer {
+    Class<? extends Annotation> value() default Annotation.class;
+    String getAnnotation() default "";
+    // Java SE 8 methods.
+    String[] getAnnotationsByType() default {};
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/Foo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,30 @@
+/*
+ * 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.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Foo {
+    int value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/FooInherited.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface FooInherited {
+    int value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/UnofficialContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,30 @@
+/*
+ * 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.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface UnofficialContainer {
+    Foo[] value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/UnofficialInheritedContainer.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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.lang.annotation.*;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface UnofficialInheritedContainer {
+    FooInherited[] value();
+}
--- a/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -28,7 +28,7 @@
  * @author  Scott Seligman
  * @library /tools/javac/lib
  * @build   JavacTestingAbstractProcessor DirectSupersOfErr
- * @compile -processor DirectSupersOfErr -proc:only C1.java
+ * @compile/fail/ref=DirectSupersOfErr.ref -processor DirectSupersOfErr -proc:only -XDrawDiagnostics C1.java
  */
 
 import java.util.Set;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/util/directSupersOfErr/DirectSupersOfErr.ref	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,2 @@
+C1.java:24:18: compiler.err.cant.resolve: kindname.class, Bogus, , 
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,115 @@
+/*
+ * 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 8007574
+ * @summary Test Elements.isFunctionalInterface
+ * @author  Joseph D. Darcy
+ * @library /tools/javac/lib
+ * @build   JavacTestingAbstractProcessor TestIsFunctionalInterface
+ * @compile -processor TestIsFunctionalInterface TestIsFunctionalInterface.java
+ */
+
+import java.util.Set;
+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.*;
+import java.io.*;
+
+/**
+ * Test basic workings of Elements.isFunctionalInterface
+ */
+public class TestIsFunctionalInterface extends JavacTestingAbstractProcessor {
+    private int count = 0;
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            for(TypeElement type : typesIn(roundEnv.getElementsAnnotatedWith(ExpectedIsFunInt.class))) {
+                count++;
+                System.out.println(type);
+                if (elements.isFunctionalInterface(type) !=
+                    type.getAnnotation(ExpectedIsFunInt.class).value()) {
+                    messager.printMessage(ERROR,
+                                          "Mismatch between expected and computed isFunctionalInterface",
+                                          type);
+                }
+            }
+        } else {
+            if (count <= 0)
+                messager.printMessage(ERROR, "No types with ExpectedIsFunInt processed.");
+            }
+    return true;
+    }
+}
+
+@interface ExpectedIsFunInt {
+    boolean value();
+}
+
+// Examples below from the lambda specification documents.
+
+@ExpectedIsFunInt(false) // Equals is already an implicit member
+interface Foo1 { boolean equals(Object obj); }
+
+@ExpectedIsFunInt(true) // Bar has one abstract non-Object method
+interface Bar1 extends Foo1 { int compare(String o1, String o2); }
+
+
+@ExpectedIsFunInt(true) // Comparator has one abstract non-Object method
+interface LocalComparator<T> {
+ boolean equals(Object obj);
+ int compare(T o1, T o2);
+}
+
+@ExpectedIsFunInt(false) // Method Object.clone is not public
+interface Foo2 {
+  int m();
+  Object clone();
+}
+
+interface X1 { int m(Iterable<String> arg); }
+interface Y1 { int m(Iterable<String> arg); }
+@ExpectedIsFunInt(true) // Two methods, but they have the same signature
+interface Z1 extends X1, Y1 {}
+
+interface X2 { Iterable m(Iterable<String> arg); }
+interface Y2 { Iterable<String> m(Iterable arg); }
+@ExpectedIsFunInt(true) // Y.m is a subsignature & return-type-substitutable
+interface Z2 extends X2, Y2 {}
+
+interface Action<T> {
+    T doit();
+}
+@ExpectedIsFunInt(true)
+interface LocalExecutor { <T> T execute(Action<T> a); }
+
+interface X5 { <T> T execute(Action<T> a); }
+interface Y5 { <S> S execute(Action<S> a); }
+@ExpectedIsFunInt(true) // Functional: signatures are "the same"
+interface Exec5 extends X5, Y5 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/profiles/ProfileOptionTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,267 @@
+/*
+ * 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
+ * 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 8004182
+ * @summary Add support for profiles in javac
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.jvm.Profile;
+import com.sun.tools.javac.jvm.Target;
+
+
+public class ProfileOptionTest {
+    public static void main(String... args) throws Exception {
+        new ProfileOptionTest().run();
+    }
+
+    private final JavaCompiler javac = JavacTool.create();
+    private final StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
+
+
+    // ---------- Test cases, invoked reflectively via run. ----------
+
+    @Test
+    void testInvalidProfile_CommandLine() throws Exception {
+        JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
+        String badName = "foo";
+        List<String> opts = Arrays.asList("-profile", badName);
+        StringWriter sw = new StringWriter();
+        try {
+            JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
+                Arrays.asList(fo));
+            throw new Exception("expected exception not thrown");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+    }
+
+    @Test
+    void testInvalidProfile_API() throws Exception {
+        String badName = "foo";
+        String[] opts = { "-profile", badName };
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(opts, pw);
+
+        // sadly, command line errors are not (yet?) reported to
+        // the diag listener
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out.trim());
+
+        if (!out.contains("invalid profile: " + badName)) {
+            error("expected message not found");
+        }
+    }
+
+    @Test
+    void testTargetProfileCombinations() throws Exception {
+        JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
+        for (Target t: Target.values()) {
+            switch (t) {
+                case JDK1_1: case JDK1_2: // no equivalent -source
+                    continue;
+            }
+
+            for (Profile p: Profile.values()) {
+                List<String> opts = new ArrayList<String>();
+                opts.addAll(Arrays.asList("-source", t.name, "-target", t.name));
+                opts.add("-Xlint:-options"); // dont warn about no -bootclasspath
+                if (p != Profile.DEFAULT)
+                    opts.addAll(Arrays.asList("-profile", p.name));
+                StringWriter sw = new StringWriter();
+                JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
+                        Arrays.asList(fo));
+                task.analyze();
+
+                // sadly, command line errors are not (yet?) reported to
+                // the diag listener
+                String out = sw.toString();
+                if (!out.isEmpty())
+                    System.err.println(out.trim());
+
+                switch (t) {
+                    case JDK1_8:
+                        if (!out.isEmpty())
+                            error("unexpected output from compiler");
+                        break;
+                    default:
+                        if (p != Profile.DEFAULT
+                                && !out.contains("profile " + p.name
+                                    + " is not valid for target release " + t.name)) {
+                            error("expected message not found");
+                        }
+                }
+            }
+        }
+    }
+
+    @Test
+    void testClassesInProfiles() throws Exception {
+        for (Profile p: Profile.values()) {
+            for (Map.Entry<Profile, List<JavaFileObject>> e: testClasses.entrySet()) {
+                for (JavaFileObject fo: e.getValue()) {
+                    DiagnosticCollector<JavaFileObject> dl =
+                            new DiagnosticCollector<JavaFileObject>();
+                    List<String> opts = (p == Profile.DEFAULT)
+                            ? Collections.<String>emptyList()
+                            : Arrays.asList("-profile", p.name);
+                    JavacTask task = (JavacTask) javac.getTask(null, fm, dl, opts, null,
+                            Arrays.asList(fo));
+                    task.analyze();
+
+                    List<String> expectDiagCodes = (p.value >= e.getKey().value)
+                            ? Collections.<String>emptyList()
+                            : Arrays.asList("compiler.err.not.in.profile");
+
+                    checkDiags(opts + " " + fo.getName(), dl.getDiagnostics(), expectDiagCodes);
+                }
+            }
+        }
+    }
+
+    Map<Profile, List<JavaFileObject>> testClasses =
+            new EnumMap<Profile, List<JavaFileObject>>(Profile.class);
+
+    void initTestClasses() {
+        // The following table assumes the existence of specific classes
+        // in specific profiles, as defined in the Java SE 8 spec.
+        init(Profile.COMPACT1,
+                java.lang.String.class);
+
+        init(Profile.COMPACT2,
+                javax.xml.XMLConstants.class);
+
+        init(Profile.COMPACT3,
+                javax.script.Bindings.class,
+                com.sun.security.auth.PolicyFile.class); // specifically included in 3
+
+        init(Profile.DEFAULT,
+                java.beans.BeanInfo.class,
+                javax.management.remote.rmi._RMIServer_Stub.class); // specifically excluded in 3
+    }
+
+    void init(Profile p, Class<?>... classes) {
+        List<JavaFileObject> srcs = new ArrayList<JavaFileObject>();
+        for (Class<?> c: classes) {
+            String name = "T" + c.getSimpleName();
+            String src =
+                    "class T" + name + "{" + "\n" +
+                    "    Class<?> c = " + c.getName() + ".class;\n" +
+                    "}";
+            srcs.add(new StringJavaFileObject(name + ".java", src));
+        }
+        testClasses.put(p, srcs);
+    }
+
+    void checkDiags(String msg, List<Diagnostic<? extends JavaFileObject>> diags, List<String> expectDiagCodes) {
+        System.err.print(msg);
+        if (diags.isEmpty())
+            System.err.println(" OK");
+        else {
+            System.err.println();
+            System.err.println(diags);
+        }
+
+        List<String> foundDiagCodes = new ArrayList<String>();
+        for (Diagnostic<? extends JavaFileObject> d: diags)
+            foundDiagCodes.add(d.getCode());
+
+        if (!foundDiagCodes.equals(expectDiagCodes)) {
+            System.err.println("Found diag codes:    " + foundDiagCodes);
+            System.err.println("Expected diag codes: " + expectDiagCodes);
+            error("expected diagnostics not found");
+        }
+    }
+
+    /** Marker annotation for test cases. */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Test { }
+
+    /** Run all test cases. */
+    void run() throws Exception {
+        initTestClasses();
+
+        for (Method m: getClass().getDeclaredMethods()) {
+            Annotation a = m.getAnnotation(Test.class);
+            if (a != null) {
+                System.err.println(m.getName());
+                try {
+                    m.invoke(this, new Object[] { });
+                } catch (InvocationTargetException e) {
+                    Throwable cause = e.getCause();
+                    throw (cause instanceof Exception) ? ((Exception) cause) : e;
+                }
+                System.err.println();
+            }
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+
+    private static class StringJavaFileObject extends SimpleJavaFileObject {
+        StringJavaFileObject(String name, String text) {
+            super(URI.create(name), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+        @Override
+        public CharSequence getCharContent(boolean b) {
+            return text;
+        }
+        private String text;
+    }
+}
--- a/test/tools/javac/resolve/Pos.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/resolve/Pos.java	Tue Jul 02 10:13:00 2013 +0100
@@ -28,4 +28,4 @@
     long line() default -1;
     long col() default -1;
     boolean userDefined() default true;
-}
\ No newline at end of file
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/resolve/tests/InnerOverOuter.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+@TraceResolve
+class Test {
+
+    //no annotation here - this should NOT even be considered!
+    void m(Integer i1, Integer i2) { }
+
+    //no annotation here - this should NOT even be considered!
+    void m(Object... o) { }
+
+    @TraceResolve(keys={"compiler.err.cant.apply.symbol"})
+    class Inner {
+        @Candidate
+        void m(String s) {
+            m(1, 1); //should fail
+        }
+    }
+}
--- a/test/tools/javac/resolve/tests/PrimitiveOverReferenceVarargsAmbiguous.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/resolve/tests/PrimitiveOverReferenceVarargsAmbiguous.java	Tue Jul 02 10:13:00 2013 +0100
@@ -23,44 +23,44 @@
 
 @TraceResolve(keys={"compiler.err.ref.ambiguous"})
 class PrimitiveOverReferenceVarargsAmbiguous {
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
     static void m_byte(byte... b) {}
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS)
     static void m_byte(Byte... b) {}
 
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
     static void m_short(short... s) {}
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS)
     static void m_short(Short... s) {}
 
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
     static void m_int(int... i) {}
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS)
     static void m_int(Integer... i) {}
 
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
     static void m_long(long... l) {}
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS)
     static void m_long(Long... l) {}
 
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
     static void m_float(float... f) {}
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS)
     static void m_float(Float... f) {}
 
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
     static void m_double(double... d) {}
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS)
     static void m_double(Double... d) {}
 
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
     static void m_char(char... c) {}
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS)
     static void m_char(Character... c) {}
 
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS, mostSpecific=true)
     static void m_bool(boolean... z) {}
-    @Candidate(applicable=Phase.VARARGS, mostSpecific=false)
+    @Candidate(applicable=Phase.VARARGS)
     static void m_bool(Boolean... z) {}
 
     {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/stackmap/StackMapTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,65 @@
+/*
+ * 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 4955930
+ * @summary The "method0" StackMap attribute should have two entries instead of three
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run compile -source 6 -target 6 StackMapTest.java
+ * @run main StackMapTest
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+//original test: test/tools/javac/stackmap/T4955930.sh
+public class StackMapTest {
+
+    class Test {
+        void method0(boolean aboolean) throws Exception {
+            label_0:
+            while (true) {
+                if (aboolean) ;
+                else break label_0;
+            }
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+//    "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -source 6 -target 6 T4955930.java
+
+//    "${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -verbose T4955930 > ${TMP1}
+        Path pathToClass = Paths.get(System.getProperty("test.classes"),
+                "StackMapTest$Test.class");
+        ToolBox.JavaToolArgs javapArgs =
+                new ToolBox.JavaToolArgs().setAllArgs("-v", pathToClass.toString());
+
+//        grep "StackMapTable: number_of_entries = 2" ${TMP1}
+        if (!ToolBox.javap(javapArgs).contains("StackMapTable: number_of_entries = 2"))
+            throw new AssertionError("The number of entries of the stack map "
+                    + "table should be equal to 2");
+    }
+
+}
--- a/test/tools/javac/stackmap/T4955930.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2005, 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 4955930
- * @summary The "method0" StackMap attribute should have two entries instead of three
- * @author wtao
- *
- * @run shell T4955930.sh
- */
-
-public class T4955930 {
-
-   void method0(boolean aboolean) throws Exception {
-      label_0:
-      while (true) {
-         if (aboolean) {
-            ;
-         }
-         else {
-            break label_0;
-         }
-         System.out.println("");
-      }
-   }
-}
--- a/test/tools/javac/stackmap/T4955930.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2009, 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.
-#
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | CYGWIN* )
-    FS="/"
-    ;;
-  Windows_95 | Windows_98 | Windows_NT )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-TMP1=T4955930.javap
-
-cp "${TESTSRC}${FS}T4955930.java" .
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -source 6 -target 6 T4955930.java
-result=$?
-if [ $result -ne 0 ]
-then
-    exit $result
-fi
-
-"${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -verbose T4955930 > ${TMP1}
-grep "StackMapTable: number_of_entries = 2" ${TMP1}
-result=$?
-
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/tree/PrettySimpleStringTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,73 @@
+/*
+ * 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 8006033
+ * @summary bug in Pretty.toSimpleString
+ */
+
+import java.io.File;
+
+import javax.tools.StandardJavaFileManager;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.Pretty;
+
+public class PrettySimpleStringTest {
+    public static void main(String... args) throws Exception {
+        new PrettySimpleStringTest().run();
+    }
+
+    void run() throws Exception {
+        File testSrc = new File(System.getProperty("test.src"));
+        File thisFile = new File(testSrc, getClass().getName() + ".java");
+        JavacTool tool = JavacTool.create();
+        StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
+        JavacTask task = tool.getTask(null, fm, null, null, null,
+                fm.getJavaFileObjects(thisFile));
+        Iterable<? extends CompilationUnitTree> trees = task.parse();
+        CompilationUnitTree thisTree = trees.iterator().next();
+
+        {   // test default
+            String thisSrc = Pretty.toSimpleString((JCTree) thisTree);
+            System.err.println(thisSrc);
+            String expect = "import jav[...]} } }";
+            if (!thisSrc.equals(expect)) {
+                throw new Exception("unexpected result");
+            }
+        }
+
+        {   // test explicit length
+            String thisSrc = Pretty.toSimpleString((JCTree) thisTree, 32);
+            System.err.println(thisSrc);
+            String expect = "import java.io.Fil[...]; } } } }";
+            if (!thisSrc.equals(expect)) {
+                throw new Exception("unexpected result");
+            }
+        }
+    }
+}
--- a/test/tools/javac/tree/TreeKindTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/tree/TreeKindTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -29,7 +29,7 @@
 
 import com.sun.source.tree.*;
 
-public class TreeKindTest{
+public class TreeKindTest {
     public static void main(String... args) {
         boolean ok = true;
 
@@ -108,6 +108,11 @@
                 ok = ok & verify(k, i, i == ClassTree.class);
                 break;
 
+            case ANNOTATION:
+            case TYPE_ANNOTATION:
+                ok = ok & verify(k, i, i == AnnotationTree.class);
+                break;
+
             case OTHER:
                 ok = ok & verify(k, i, i == null);
                 break;
--- a/test/tools/javac/tree/TreePosTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/tree/TreePosTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -75,6 +75,7 @@
 import com.sun.tools.javac.code.Flags;
 import com.sun.tools.javac.tree.EndPosTable;
 import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCAnnotatedType;
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 import com.sun.tools.javac.tree.JCTree.JCNewClass;
 import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
@@ -100,7 +101,8 @@
  * @test
  * @bug 6919889
  * @summary assorted position errors in compiler syntax trees
- * @run main TreePosTest -q -r -ef ./tools/javac/typeAnnotations -ef ./tools/javap/typeAnnotations -et ANNOTATED_TYPE .
+ * OLD: -q -r -ef ./tools/javac/typeAnnotations -ef ./tools/javap/typeAnnotations -et ANNOTATED_TYPE .
+ * @run main TreePosTest -q -r .
  */
 public class TreePosTest {
     /**
@@ -367,15 +369,24 @@
                     //    e.g.    int[][] a = new int[2][];
                     check("encl.start <= start", encl, self, encl.start <= self.start);
                     check("start <= pos", encl, self, self.start <= self.pos);
-                    if (!(self.tag == TYPEARRAY
+                    if (!( (self.tag == TYPEARRAY ||
+                            isAnnotatedArray(self.tree))
                             && (encl.tag == VARDEF ||
                                 encl.tag == METHODDEF ||
-                                encl.tag == TYPEARRAY))) {
+                                encl.tag == TYPEARRAY ||
+                                isAnnotatedArray(encl.tree))
+                           ||
+                            encl.tag == ANNOTATED_TYPE && self.tag == SELECT
+                         )) {
                         check("encl.pos <= start || end <= encl.pos",
                                 encl, self, encl.pos <= self.start || self.end <= encl.pos);
                     }
                     check("pos <= end", encl, self, self.pos <= self.end);
-                    if (!(self.tag == TYPEARRAY && encl.tag == TYPEARRAY)) {
+                    if (!( (self.tag == TYPEARRAY || isAnnotatedArray(self.tree)) &&
+                            (encl.tag == TYPEARRAY || isAnnotatedArray(encl.tree))
+                           ||
+                            encl.tag == MODIFIERS && self.tag == ANNOTATION
+                         ) ) {
                         check("end <= encl.end", encl, self, self.end <= encl.end);
                     }
                 }
@@ -387,6 +398,11 @@
             encl = prevEncl;
         }
 
+        private boolean isAnnotatedArray(JCTree tree) {
+            return tree.hasTag(ANNOTATED_TYPE) &&
+                            ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
+        }
+
         @Override
         public void visitVarDef(JCVariableDecl tree) {
             // enum member declarations are desugared in the parser and have
@@ -427,7 +443,8 @@
                     viewer.addEntry(sourcefile, label, encl, self);
                 }
 
-                String s = self.tree.toString();
+                String s = "encl: " + encl.tree.toString() +
+                        "  this: " + self.tree.toString();
                 String msg = sourcefile.getName() + ": " + label + ": " +
                         "encl:" + encl + " this:" + self + "\n" +
                         s.substring(0, Math.min(80, s.length())).replaceAll("[\r\n]+", " ");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/treeannotests/AnnoTreeTests.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2010, 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
+ * @build DA TA Test TestProcessor
+ * @compile -proc:only -processor TestProcessor AnnoTreeTests.java
+ */
+
+@Test(4)
+class AnnoTreeTests {
+    // primitive types
+    // @TA("int") int i1 = 0; // TODO: Only visible via ClassFile
+    long i2 = (@TA("long") long) 0;
+
+    // simple array types
+    // @DA("short") short[] a1; // TODO: Only visible via ClassFile
+    byte @TA("byte[]") [] a2;
+    float[] a3 = (@TA("float") float[]) null;
+    double[] a4 = (double @TA("double[]") []) null;
+
+    // multi-dimensional array types
+    // (still to come)
+}
--- a/test/tools/javac/treeannotests/TestProcessor.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/treeannotests/TestProcessor.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -203,13 +203,16 @@
          * expression <i>name</i>=<i>value</i>.
          */
         String getStringValue(JCExpression e) {
-            if (e.getTag() == JCTree.ASSIGN)  {
+            if (e.hasTag(JCTree.Tag.ASSIGN)) {
                 JCAssign a = (JCAssign) e;
                 JCExpression rhs = a.rhs;
-                if (rhs.getTag() == JCTree.LITERAL) {
+                if (rhs.hasTag(JCTree.Tag.LITERAL)) {
                     JCLiteral l = (JCLiteral) rhs;
                     return (String) l.value;
                 }
+            } else if (e.hasTag(JCTree.Tag.LITERAL)) {
+                JCLiteral l = (JCLiteral) e;
+                return (String) l.value;
             }
             throw new IllegalArgumentException(e.toString());
         }
--- a/test/tools/javac/typeAnnotations/newlocations/BasicTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-
-/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6843077
- * @summary random tests for new locations
- * @author Matt Papi
- * @compile/fail/ref=BasicTest.out -XDrawDiagnostics BasicTest.java
- */
-
-import java.util.*;
-import java.io.*;
-
-@interface A {}
-@interface B {}
-@interface C {}
-@interface D {}
-
-//308: Test inverted to verify that type annotations can not be parsed yet.
-
-/**
- * Tests basic JSR 308 parser functionality. We don't really care about what
- * the parse tree looks like, just that these annotations can be parsed.
- */
-class BasicTest<T extends @A Object> extends @B LinkedList<T> implements @C List<T> {
-
-    void test() {
-
-        // Handle annotated class literals/cast types
-        Class<?> c = @A String.class;
-        Object o = (@A Object) "foo";
-
-        // Handle annotated "new" expressions (except arrays; see ArrayTest)
-        String s = new @A String("bar");
-
-        boolean b = o instanceof @A Object;
-
-
-        @A Map<@B List<@C String>, @D String> map =
-            new @A HashMap<@B List<@C String>, @D String>();
-
-        Class<? extends @A String> c2 = @A String.class;
-    }
-
-    // Handle receiver annotations
-    // Handle annotations on a qualified identifier list
-    void test2() @C @D throws @A IllegalArgumentException, @B IOException {
-
-    }
-
-    // Handle annotations on a varargs element type
-    void test3(Object @A... objs) {
-
-    }
-}
--- a/test/tools/javac/typeAnnotations/newlocations/BasicTest.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-BasicTest.java:47:27: compiler.err.illegal.start.of.type
-BasicTest.java:47:28: compiler.err.expected: '{'
-BasicTest.java:47:36: compiler.err.expected: token.identifier
-BasicTest.java:47:38: compiler.err.illegal.start.of.type
-BasicTest.java:47:45: compiler.err.expected: token.identifier
-BasicTest.java:47:47: compiler.err.expected: ';'
-BasicTest.java:47:62: compiler.err.expected: token.identifier
-BasicTest.java:47:84: compiler.err.expected: token.identifier
-BasicTest.java:52:22: compiler.err.illegal.start.of.expr
-BasicTest.java:52:31: compiler.err.expected: ';'
-BasicTest.java:52:37: compiler.err.expected: token.identifier
-BasicTest.java:53:30: compiler.err.expected: token.identifier
-BasicTest.java:53:31: compiler.err.expected: ->
-BasicTest.java:56:23: compiler.err.expected: token.identifier
-BasicTest.java:56:24: compiler.err.expected2: '(', '['
-BasicTest.java:56:25: compiler.err.expected: ';'
-BasicTest.java:56:27: compiler.err.invalid.meth.decl.ret.type.req
-BasicTest.java:56:34: compiler.err.illegal.start.of.type
-BasicTest.java:58:34: compiler.err.illegal.start.of.type
-BasicTest.java:61:16: compiler.err.illegal.start.of.type
-BasicTest.java:61:18: compiler.err.expected: ';'
-BasicTest.java:61:24: compiler.err.illegal.start.of.type
-BasicTest.java:61:26: compiler.err.expected: ';'
-BasicTest.java:61:33: compiler.err.expected: token.identifier
-BasicTest.java:61:34: compiler.err.illegal.start.of.type
-BasicTest.java:61:35: compiler.err.expected: token.identifier
-BasicTest.java:61:37: compiler.err.expected: ';'
-BasicTest.java:61:45: compiler.err.expected: token.identifier
-BasicTest.java:61:50: compiler.err.expected: token.identifier
-BasicTest.java:62:16: compiler.err.expected: token.identifier
-BasicTest.java:62:17: compiler.err.expected2: '(', '['
-BasicTest.java:62:18: compiler.err.expected: ';'
-BasicTest.java:62:28: compiler.err.illegal.start.of.type
-BasicTest.java:62:30: compiler.err.expected: ';'
-BasicTest.java:62:36: compiler.err.illegal.start.of.type
-BasicTest.java:62:38: compiler.err.expected: ';'
-BasicTest.java:62:45: compiler.err.expected: token.identifier
-BasicTest.java:62:46: compiler.err.illegal.start.of.type
-BasicTest.java:62:47: compiler.err.expected: token.identifier
-BasicTest.java:62:49: compiler.err.expected: ';'
-BasicTest.java:62:57: compiler.err.expected: token.identifier
-BasicTest.java:62:58: compiler.err.illegal.start.of.type
-BasicTest.java:62:59: compiler.err.expected: token.identifier
-BasicTest.java:64:25: compiler.err.illegal.start.of.type
-BasicTest.java:64:27: compiler.err.expected: ';'
-BasicTest.java:64:34: compiler.err.expected: token.identifier
-BasicTest.java:64:38: compiler.err.expected: token.identifier
-BasicTest.java:64:41: compiler.err.illegal.start.of.expr
-BasicTest.java:64:50: compiler.err.expected: ';'
-BasicTest.java:64:56: compiler.err.expected: token.identifier
-BasicTest.java:69:17: compiler.err.expected: ';'
-BasicTest.java:69:24: compiler.err.illegal.start.of.type
-BasicTest.java:69:30: compiler.err.expected: ';'
-BasicTest.java:69:59: compiler.err.expected: token.identifier
-BasicTest.java:69:74: compiler.err.expected: ';'
-BasicTest.java:74:22: compiler.err.expected: token.identifier
-BasicTest.java:74:24: compiler.err.expected: ';'
-BasicTest.java:74:25: compiler.err.illegal.start.of.type
-BasicTest.java:74:33: compiler.err.expected: ';'
-BasicTest.java:77:2: compiler.err.premature.eof
-60 errors
--- a/test/tools/javac/unicode/SupplementaryJavaID6.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/unicode/SupplementaryJavaID6.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, 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
@@ -21,12 +21,20 @@
  * questions.
  */
 
+/*
+ * @test
+ * @bug 4914724 4973116 5014511
+ * @summary Ensure that a supplementary character can be used as part/whole of a
+ * class name on platforms that have Unicode aware filesystems.
+ * @run main SupplementaryJavaID6
+ */
+
 public class SupplementaryJavaID6 {
     public static void main(String[] s) {
-        new SupplementaryJavaID6();
+        new SupplementaryJavaID6().test();
     }
 
-    public SupplementaryJavaID6() {
+    void test() {
         \ud801\udc00 instance = new \ud801\udc00();
         instance.\ud801\udc01();
     }
--- a/test/tools/javac/unicode/SupplementaryJavaID6.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2004, 2009, 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 4914724 4973116 5014511
-# @summary Ensure that a supplementary character can be used as part/whole of a class
-#          name on platforms that have Unicode aware filesystems.
-# @author Naoto Sato
-# @run shell SupplementaryJavaID6.sh SupplementaryJavaID6
-
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    if [ -d /usr/lib/locale/en_US.UTF-8 -o -d /usr/lib/locale/en_US.utf8 ]
-    then
-        ENV="env LANG=en_US.UTF-8"
-        PS=":"
-        FS="/"
-    else
-        echo "As there is no en_US.UTF-8 locale available on this system, the compilation of the test case may or may not fail.  Ignoring this test."
-        exit 0;
-    fi
-    ;;
-  Windows_98 | Windows_ME )
-    echo "As Windows 98/Me do not provide Unicode-aware file system, the compilation of the test case is expected to fail on these platforms.  Ignoring this test."
-    exit 0;
-    ;;
-  Windows* )
-    ENV=""
-    PS=";"
-    FS="\\"
-    ;;
-  CYGWIN* )
-    ENV=""
-    PS=";" # platform PS, not cygwin PS
-    FS="/"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-# compile
-cp "${TESTSRC}${FS}$1.java" .
-${ENV} "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath ".${PS}${TESTSRC}" $1.java
-result=$?
-
-if [ $result -ne 0 ]
-then
-  echo "Failed"
-  exit $result
-fi
-
-# run
-${ENV} "${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} $1 
-result=$?
-
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-
-# Cleanup
-${ENV} rm -f ./$1*.class
-
-exit $result
--- a/test/tools/javac/varargs/7042566/T7042566.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/varargs/7042566/T7042566.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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,10 +23,28 @@
 
 /*
  * @test
- * @bug 7042566
+ * @bug 7042566 8006694
  * @summary Unambiguous varargs method calls flagged as ambiguous
+ *  temporarily workaround combo tests are causing time out in several platforms
+ * @library ../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm T7042566
  */
 
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Locale;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
 import com.sun.source.util.JavacTask;
 import com.sun.tools.classfile.Instruction;
 import com.sun.tools.classfile.Attribute;
@@ -34,44 +52,36 @@
 import com.sun.tools.classfile.Code_attribute;
 import com.sun.tools.classfile.ConstantPool.*;
 import com.sun.tools.classfile.Method;
-import com.sun.tools.javac.api.JavacTool;
 import com.sun.tools.javac.util.List;
 
-import java.io.File;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Locale;
-import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-public class T7042566 {
+public class T7042566
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     VarargsMethod m1;
     VarargsMethod m2;
     TypeConfiguration actuals;
 
-    T7042566(TypeConfiguration m1_conf, TypeConfiguration m2_conf, TypeConfiguration actuals) {
+    T7042566(TypeConfiguration m1_conf, TypeConfiguration m2_conf,
+            TypeConfiguration actuals) {
         this.m1 = new VarargsMethod(m1_conf);
         this.m2 = new VarargsMethod(m2_conf);
         this.actuals = actuals;
     }
 
-    void compileAndCheck() throws Exception {
+    @Override
+    public void run() {
+        int id = checkCount.incrementAndGet();
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
-        JavaSource source = new JavaSource();
+        JavaSource source = new JavaSource(id);
         ErrorChecker ec = new ErrorChecker();
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, ec,
+        JavacTask ct = (JavacTask)tool.getTask(null, fm.get(), ec,
                 null, null, Arrays.asList(source));
         ct.call();
-        check(source, ec);
+        check(source, ec, id);
     }
 
-    void check(JavaSource source, ErrorChecker ec) {
-        checkCount++;
+    void check(JavaSource source, ErrorChecker ec, int id) {
         boolean resolutionError = false;
         VarargsMethod selectedMethod = null;
 
@@ -99,13 +109,13 @@
                     "\nFound error: " + ec.errorFound +
                     "\nCompiler diagnostics:\n" + ec.printDiags());
         } else if (!resolutionError) {
-            verifyBytecode(selectedMethod, source);
+            verifyBytecode(selectedMethod, source, id);
         }
     }
 
-    void verifyBytecode(VarargsMethod selected, JavaSource source) {
-        bytecodeCheckCount++;
-        File compiledTest = new File("Test.class");
+    void verifyBytecode(VarargsMethod selected, JavaSource source, int id) {
+        bytecodeCheckCount.incrementAndGet();
+        File compiledTest = new File(String.format("Test%d.class", id));
         try {
             ClassFile cf = ClassFile.read(compiledTest);
             Method testMethod = null;
@@ -118,7 +128,8 @@
             if (testMethod == null) {
                 throw new Error("Test method not found");
             }
-            Code_attribute ea = (Code_attribute)testMethod.attributes.get(Attribute.Code);
+            Code_attribute ea =
+                (Code_attribute)testMethod.attributes.get(Attribute.Code);
             if (testMethod == null) {
                 throw new Error("Code attribute for test() method not found");
             }
@@ -127,11 +138,12 @@
                 if (i.getMnemonic().equals("invokevirtual")) {
                     int cp_entry = i.getUnsignedShort(1);
                     CONSTANT_Methodref_info methRef =
-                            (CONSTANT_Methodref_info)cf.constant_pool.get(cp_entry);
+                        (CONSTANT_Methodref_info)cf.constant_pool.get(cp_entry);
                     String type = methRef.getNameAndTypeInfo().getType();
                     String sig = selected.parameterTypes.bytecodeSigStr;
                     if (!type.contains(sig)) {
-                        throw new Error("Unexpected type method call: " + type + "" +
+                        throw new Error("Unexpected type method call: " +
+                                        type + "" +
                                         "\nfound: " + sig +
                                         "\n" + source.getCharContent(true));
                     }
@@ -146,7 +158,7 @@
 
     class JavaSource extends SimpleJavaFileObject {
 
-        static final String source_template = "class Test {\n" +
+        static final String source_template = "class Test#ID {\n" +
                 "   #V1\n" +
                 "   #V2\n" +
                 "   void test() { m(#E); }\n" +
@@ -154,11 +166,13 @@
 
         String source;
 
-        public JavaSource() {
-            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
-            source = source_template.replaceAll("#V1", m1.toString()).
-                    replaceAll("#V2", m2.toString()).
-                    replaceAll("#E", actuals.expressionListStr);
+        public JavaSource(int id) {
+            super(URI.create(String.format("myfo:/Test%d.java", id)),
+                    JavaFileObject.Kind.SOURCE);
+            source = source_template.replaceAll("#V1", m1.toString())
+                    .replaceAll("#V2", m2.toString())
+                    .replaceAll("#E", actuals.expressionListStr)
+                    .replaceAll("#ID", String.valueOf(id));
         }
 
         @Override
@@ -167,26 +181,17 @@
         }
     }
 
-    /** global decls ***/
-
-    // Create a single file manager and reuse it for each compile to save time.
-    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
-
-    //statistics
-    static int checkCount = 0;
-    static int bytecodeCheckCount = 0;
-
     public static void main(String... args) throws Exception {
         for (TypeConfiguration tconf1 : TypeConfiguration.values()) {
             for (TypeConfiguration tconf2 : TypeConfiguration.values()) {
                 for (TypeConfiguration tconf3 : TypeConfiguration.values()) {
-                    new T7042566(tconf1, tconf2, tconf3).compileAndCheck();
+                    pool.execute(new T7042566(tconf1, tconf2, tconf3));
                 }
             }
         }
 
-        System.out.println("Total checks made: " + checkCount);
-        System.out.println("Bytecode checks made: " + bytecodeCheckCount);
+        outWriter.println("Bytecode checks made: " + bytecodeCheckCount.get());
+        checkAfterExec();
     }
 
     enum TypeKind {
@@ -326,14 +331,16 @@
         }
     }
 
-    static class ErrorChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class ErrorChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         boolean errorFound;
         List<String> errDiags = List.nil();
 
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
-                errDiags = errDiags.append(diagnostic.getMessage(Locale.getDefault()));
+                errDiags = errDiags
+                        .append(diagnostic.getMessage(Locale.getDefault()));
                 errorFound = true;
             }
         }
@@ -347,4 +354,8 @@
             return buf.toString();
         }
     }
+
+    //number of bytecode checks made while running combo tests
+    static AtomicInteger bytecodeCheckCount = new AtomicInteger();
+
 }
--- a/test/tools/javac/varargs/warning/Warn4.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/varargs/warning/Warn4.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,13 +23,18 @@
 
 /**
  * @test
- * @bug     6945418 6993978
+ * @bug     6945418 6993978 8006694
  * @summary Project Coin: Simplified Varargs Method Invocation
+ *  temporarily workaround combo tests are causing time out in several platforms
  * @author  mcimadamore
- * @run main Warn4
+ * @library ../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm Warn4
  */
-import com.sun.source.util.JavacTask;
-import com.sun.tools.javac.api.JavacTool;
+
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.Arrays;
 import java.util.Set;
@@ -38,16 +43,19 @@
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
+import com.sun.source.util.JavacTask;
 
-public class Warn4 {
+public class Warn4
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     final static Warning[] error = null;
     final static Warning[] none = new Warning[] {};
     final static Warning[] vararg = new Warning[] { Warning.VARARGS };
     final static Warning[] unchecked = new Warning[] { Warning.UNCHECKED };
-    final static Warning[] both = new Warning[] { Warning.VARARGS, Warning.UNCHECKED };
+    final static Warning[] both =
+            new Warning[] { Warning.VARARGS, Warning.UNCHECKED };
 
     enum Warning {
         UNCHECKED("generic.array.creation"),
@@ -59,8 +67,10 @@
             this.key = key;
         }
 
-        boolean isSuppressed(TrustMe trustMe, SourceLevel source, SuppressLevel suppressLevelClient,
-                SuppressLevel suppressLevelDecl, ModifierKind modKind) {
+        boolean isSuppressed(TrustMe trustMe, SourceLevel source,
+                SuppressLevel suppressLevelClient,
+                SuppressLevel suppressLevelDecl,
+                ModifierKind modKind) {
             switch(this) {
                 case VARARGS:
                     return source == SourceLevel.JDK_6 ||
@@ -68,7 +78,8 @@
                             trustMe == TrustMe.TRUST;
                 case UNCHECKED:
                     return suppressLevelClient == SuppressLevel.UNCHECKED ||
-                        (trustMe == TrustMe.TRUST && modKind != ModifierKind.NONE && source == SourceLevel.JDK_7);
+                        (trustMe == TrustMe.TRUST && modKind !=
+                            ModifierKind.NONE && source == SourceLevel.JDK_7);
             }
 
             SuppressLevel supLev = this == VARARGS ?
@@ -172,13 +183,13 @@
                             for (Signature vararg_meth : Signature.values()) {
                                 for (Signature client_meth : Signature.values()) {
                                     if (vararg_meth.isApplicableTo(client_meth)) {
-                                        test(sourceLevel,
+                                        pool.execute(new Warn4(sourceLevel,
                                                 trustMe,
                                                 suppressLevelClient,
                                                 suppressLevelDecl,
                                                 modKind,
                                                 vararg_meth,
-                                                client_meth);
+                                                client_meth));
                                     }
                                 }
                             }
@@ -187,63 +198,81 @@
                 }
             }
         }
+
+        checkAfterExec();
     }
 
-    // Create a single file manager and reuse it for each compile to save time.
-    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+    SourceLevel sourceLevel;
+    TrustMe trustMe;
+    SuppressLevel suppressLevelClient;
+    SuppressLevel suppressLevelDecl;
+    ModifierKind modKind;
+    Signature vararg_meth;
+    Signature client_meth;
+    DiagnosticChecker diagChecker;
 
-    static void test(SourceLevel sourceLevel, TrustMe trustMe, SuppressLevel suppressLevelClient,
-            SuppressLevel suppressLevelDecl, ModifierKind modKind, Signature vararg_meth, Signature client_meth) throws Exception {
+    public Warn4(SourceLevel sourceLevel, TrustMe trustMe,
+            SuppressLevel suppressLevelClient, SuppressLevel suppressLevelDecl,
+            ModifierKind modKind, Signature vararg_meth, Signature client_meth) {
+        this.sourceLevel = sourceLevel;
+        this.trustMe = trustMe;
+        this.suppressLevelClient = suppressLevelClient;
+        this.suppressLevelDecl = suppressLevelDecl;
+        this.modKind = modKind;
+        this.vararg_meth = vararg_meth;
+        this.client_meth = client_meth;
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    @Override
+    public void run() {
+        int id = checkCount.incrementAndGet();
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
-        JavaSource source = new JavaSource(trustMe, suppressLevelClient, suppressLevelDecl, modKind, vararg_meth, client_meth);
-        DiagnosticChecker dc = new DiagnosticChecker();
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, dc,
+        JavaSource source = new JavaSource(id);
+        JavacTask ct = (JavacTask)tool.getTask(null, fm.get(), diagChecker,
                 Arrays.asList("-Xlint:unchecked", "-source", sourceLevel.sourceKey),
                 null, Arrays.asList(source));
-        ct.generate(); //to get mandatory notes
-        check(dc.warnings, sourceLevel,
-                new boolean[] {vararg_meth.giveUnchecked(client_meth),
-                               vararg_meth.giveVarargs(client_meth)},
-                source, trustMe, suppressLevelClient, suppressLevelDecl, modKind);
+        ct.call(); //to get mandatory notes
+        check(source, new boolean[] {vararg_meth.giveUnchecked(client_meth),
+                               vararg_meth.giveVarargs(client_meth)});
     }
 
-    static void check(Set<Warning> warnings, SourceLevel sourceLevel, boolean[] warnArr, JavaSource source,
-            TrustMe trustMe, SuppressLevel suppressLevelClient, SuppressLevel suppressLevelDecl, ModifierKind modKind) {
+    void check(JavaSource source, boolean[] warnArr) {
         boolean badOutput = false;
         for (Warning wkind : Warning.values()) {
             boolean isSuppressed = wkind.isSuppressed(trustMe, sourceLevel,
                     suppressLevelClient, suppressLevelDecl, modKind);
-            System.out.println("SUPPRESSED = " + isSuppressed);
-            badOutput |= (warnArr[wkind.ordinal()] && !isSuppressed) != warnings.contains(wkind);
+            badOutput |= (warnArr[wkind.ordinal()] && !isSuppressed) !=
+                    diagChecker.warnings.contains(wkind);
         }
         if (badOutput) {
             throw new Error("invalid diagnostics for source:\n" +
                     source.getCharContent(true) +
                     "\nExpected unchecked warning: " + warnArr[0] +
                     "\nExpected unsafe vararg warning: " + warnArr[1] +
-                    "\nWarnings: " + warnings +
+                    "\nWarnings: " + diagChecker.warnings +
                     "\nSource level: " + sourceLevel);
         }
     }
 
-    static class JavaSource extends SimpleJavaFileObject {
+    class JavaSource extends SimpleJavaFileObject {
 
         String source;
 
-        public JavaSource(TrustMe trustMe, SuppressLevel suppressLevelClient, SuppressLevel suppressLevelDecl,
-                ModifierKind modKind, Signature vararg_meth, Signature client_meth) {
-            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+        public JavaSource(int id) {
+            super(URI.create(String.format("myfo:/Test%d.java", id)),
+                    JavaFileObject.Kind.SOURCE);
             String meth1 = vararg_meth.template.replace("#arity", "...");
             meth1 = meth1.replace("#name", "m");
             meth1 = meth1.replace("#body", "");
-            meth1 = trustMe.anno + "\n" + suppressLevelDecl.getSuppressAnno() + modKind.mod + meth1;
+            meth1 = trustMe.anno + "\n" + suppressLevelDecl.getSuppressAnno() +
+                    modKind.mod + meth1;
             String meth2 = client_meth.template.replace("#arity", "");
             meth2 = meth2.replace("#name", "test");
             meth2 = meth2.replace("#body", "m(arg);");
             meth2 = suppressLevelClient.getSuppressAnno() + meth2;
-            source = "import java.util.List;\n" +
-                     "class Test {\n" + meth1 +
-                     "\n" + meth2 + "\n}\n";
+            source = String.format("import java.util.List;\n" +
+                     "class Test%s {\n %s \n %s \n } \n", id, meth1, meth2);
         }
 
         @Override
@@ -252,7 +281,8 @@
         }
     }
 
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    static class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         Set<Warning> warnings = new HashSet<>();
 
@@ -267,4 +297,5 @@
             }
         }
     }
+
 }
--- a/test/tools/javac/varargs/warning/Warn5.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javac/varargs/warning/Warn5.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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,13 +23,18 @@
 
 /**
  * @test
- * @bug     6993978 7097436
+ * @bug     6993978 7097436 8006694
  * @summary Project Coin: Annotation to reduce varargs warnings
+ *  temporarily workaround combo tests are causing time out in several platforms
  * @author  mcimadamore
- * @run main Warn5
+ * @library ../../lib
+ * @build JavacTestingAbstractThreadedTest
+ * @run main/othervm Warn5
  */
-import com.sun.source.util.JavacTask;
-import com.sun.tools.javac.api.JavacTool;
+
+// use /othervm to avoid jtreg timeout issues (CODETOOLS-7900047)
+// see JDK-8006746
+
 import java.net.URI;
 import java.util.Arrays;
 import java.util.EnumSet;
@@ -37,10 +42,12 @@
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
+import com.sun.source.util.JavacTask;
 
-public class Warn5 {
+public class Warn5
+    extends JavacTestingAbstractThreadedTest
+    implements Runnable {
 
     enum XlintOption {
         NONE("none"),
@@ -161,9 +168,6 @@
         REDUNDANT_SAFEVARARGS;
     }
 
-    // Create a single file manager and reuse it for each compile to save time.
-    static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
-
     public static void main(String... args) throws Exception {
         for (SourceLevel sourceLevel : SourceLevel.values()) {
             for (XlintOption xlint : XlintOption.values()) {
@@ -173,14 +177,9 @@
                             for (MethodKind methKind : MethodKind.values()) {
                                 for (SignatureKind sig : SignatureKind.values()) {
                                     for (BodyKind body : BodyKind.values()) {
-                                        new Warn5(sourceLevel,
-                                                xlint,
-                                                trustMe,
-                                                suppressLevel,
-                                                modKind,
-                                                methKind,
-                                                sig,
-                                                body).test();
+                                        pool.execute(new Warn5(sourceLevel,
+                                                xlint, trustMe, suppressLevel,
+                                                modKind, methKind, sig, body));
                                     }
                                 }
                             }
@@ -189,6 +188,8 @@
                 }
             }
         }
+
+        checkAfterExec(false);
     }
 
     final SourceLevel sourceLevel;
@@ -202,7 +203,9 @@
     final JavaSource source;
     final DiagnosticChecker dc;
 
-    public Warn5(SourceLevel sourceLevel, XlintOption xlint, TrustMe trustMe, SuppressLevel suppressLevel, ModifierKind modKind, MethodKind methKind, SignatureKind sig, BodyKind body) {
+    public Warn5(SourceLevel sourceLevel, XlintOption xlint, TrustMe trustMe,
+            SuppressLevel suppressLevel, ModifierKind modKind,
+            MethodKind methKind, SignatureKind sig, BodyKind body) {
         this.sourceLevel = sourceLevel;
         this.xlint = xlint;
         this.trustMe = trustMe;
@@ -215,24 +218,36 @@
         this.dc = new DiagnosticChecker();
     }
 
-    void test() throws Exception {
+    @Override
+    public void run() {
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, dc,
-                Arrays.asList(xlint.getXlintOption(), "-source", sourceLevel.sourceKey), null, Arrays.asList(source));
-        ct.analyze();
+        JavacTask ct = (JavacTask)tool.getTask(null, fm.get(), dc,
+                Arrays.asList(xlint.getXlintOption(),
+                    "-source", sourceLevel.sourceKey),
+                null, Arrays.asList(source));
+        try {
+            ct.analyze();
+        } catch (Throwable t) {
+            processException(t);
+        }
         check();
     }
 
     void check() {
 
-        EnumSet<WarningKind> expectedWarnings = EnumSet.noneOf(WarningKind.class);
+        EnumSet<WarningKind> expectedWarnings =
+                EnumSet.noneOf(WarningKind.class);
 
         if (sourceLevel == SourceLevel.JDK_7 &&
                 trustMe == TrustMe.TRUST &&
                 suppressLevel != SuppressLevel.VARARGS &&
                 xlint != XlintOption.NONE &&
-                sig.isVarargs && !sig.isReifiableArg && body.hasAliasing &&
-                (methKind == MethodKind.CONSTRUCTOR || (methKind == MethodKind.METHOD && modKind != ModifierKind.NONE))) {
+                sig.isVarargs &&
+                !sig.isReifiableArg &&
+                body.hasAliasing &&
+                (methKind == MethodKind.CONSTRUCTOR ||
+                (methKind == MethodKind.METHOD &&
+                modKind != ModifierKind.NONE))) {
             expectedWarnings.add(WarningKind.UNSAFE_BODY);
         }
 
@@ -247,7 +262,8 @@
         if (sourceLevel == SourceLevel.JDK_7 &&
                 trustMe == TrustMe.TRUST &&
                 (!sig.isVarargs ||
-                (modKind == ModifierKind.NONE && methKind == MethodKind.METHOD))) {
+                (modKind == ModifierKind.NONE &&
+                methKind == MethodKind.METHOD))) {
             expectedWarnings.add(WarningKind.MALFORMED_SAFEVARARGS);
         }
 
@@ -255,7 +271,8 @@
                 trustMe == TrustMe.TRUST &&
                 xlint != XlintOption.NONE &&
                 suppressLevel != SuppressLevel.VARARGS &&
-                (modKind != ModifierKind.NONE || methKind == MethodKind.CONSTRUCTOR) &&
+                (modKind != ModifierKind.NONE ||
+                methKind == MethodKind.CONSTRUCTOR) &&
                 sig.isVarargs &&
                 sig.isReifiableArg) {
             expectedWarnings.add(WarningKind.REDUNDANT_SAFEVARARGS);
@@ -297,19 +314,23 @@
         }
     }
 
-    class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+    class DiagnosticChecker
+        implements javax.tools.DiagnosticListener<JavaFileObject> {
 
         EnumSet<WarningKind> warnings = EnumSet.noneOf(WarningKind.class);
 
         public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
             if (diagnostic.getKind() == Diagnostic.Kind.WARNING) {
-                    if (diagnostic.getCode().contains("unsafe.use.varargs.param")) {
+                    if (diagnostic.getCode().
+                            contains("unsafe.use.varargs.param")) {
                         setWarning(WarningKind.UNSAFE_BODY);
-                    } else if (diagnostic.getCode().contains("redundant.trustme")) {
+                    } else if (diagnostic.getCode().
+                            contains("redundant.trustme")) {
                         setWarning(WarningKind.REDUNDANT_SAFEVARARGS);
                     }
             } else if (diagnostic.getKind() == Diagnostic.Kind.MANDATORY_WARNING &&
-                    diagnostic.getCode().contains("varargs.non.reifiable.type")) {
+                    diagnostic.getCode().
+                        contains("varargs.non.reifiable.type")) {
                 setWarning(WarningKind.UNSAFE_DECL);
             } else if (diagnostic.getKind() == Diagnostic.Kind.ERROR &&
                     diagnostic.getCode().contains("invalid.trustme")) {
@@ -319,7 +340,8 @@
 
         void setWarning(WarningKind wk) {
             if (!warnings.add(wk)) {
-                throw new AssertionError("Duplicate warning of kind " + wk + " in source:\n" + source);
+                throw new AssertionError("Duplicate warning of kind " +
+                        wk + " in source:\n" + source);
             }
         }
 
@@ -327,4 +349,5 @@
             return warnings.contains(wk);
         }
     }
+
 }
--- a/test/tools/javadoc/6958836/Test.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javadoc/6958836/Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -61,6 +61,7 @@
         // Force en_US locale in lieu of something like -XDrawDiagnostics.
         // For some reason, this must be the first option when used.
         opts.addAll(list("-locale", "en_US"));
+        opts.add("-Xdoclint:none");
         opts.addAll(list("-classpath", System.getProperty("test.src")));
         opts.addAll(list("-d", testOutDir.getPath()));
         opts.addAll(testOpts);
--- a/test/tools/javadoc/6964914/Test.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javadoc/6964914/Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -45,6 +45,7 @@
     void javadoc(String path, String expect) {
         File testSrc = new File(System.getProperty("test.src"));
         String[] args = {
+            "-Xdoclint:none",
             "-source", "1.4", // enables certain Parser warnings
             "-bootclasspath", System.getProperty("sun.boot.class.path"),
             "-classpath", ".",
--- a/test/tools/javadoc/6964914/TestStdDoclet.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javadoc/6964914/TestStdDoclet.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -57,6 +57,7 @@
         Process p = new ProcessBuilder()
             .command(javadoc.getPath(),
                 "-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"),
+                "-Xdoclint:none",
                 "-package",
                 new File(testSrc, thisClassName + ".java").getPath())
             .redirectErrorStream(true)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javadoc/MaxWarns.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,112 @@
+/*
+ * 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 8005644
+ * @summary set default max errs and max warns
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+public class MaxWarns {
+    public static void main(String... args) throws Exception {
+        new MaxWarns().run();
+    }
+
+    void run() throws Exception {
+        final int defaultMaxWarns = 100;
+        final int genWarns = 150;
+        File f = genSrc(genWarns);
+        String out = javadoc(f);
+        check(out, defaultMaxWarns);
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    File genSrc(int count) throws IOException {
+        StringBuilder sb = new StringBuilder();
+        sb.append("package p;\n")
+            .append("public class C {\n")
+            .append("    /**\n");
+        for (int i = 0; i < count; i++)
+            sb.append("     * @param i").append(i).append(" does not exist!\n");
+        sb.append("     */\n")
+            .append("    public void m() { }\n")
+            .append("}\n");
+        File srcDir = new File("src");
+        srcDir.mkdirs();
+        File f = new File(srcDir, "C.java");
+        try (FileWriter fw = new FileWriter(f)) {
+            fw.write(sb.toString());
+        }
+        return f;
+    }
+
+    String javadoc(File f) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String[] args = { "-Xdoclint:none", "-d", "api", f.getPath() };
+        int rc = com.sun.tools.javadoc.Main.execute("javadoc", pw, pw, pw,
+                com.sun.tools.doclets.standard.Standard.class.getName(), args);
+        pw.flush();
+        return sw.toString();
+    }
+
+    void check(String out, int count) {
+        System.err.println(out);
+        Pattern warn = Pattern.compile("warning - @param argument \"i[0-9]+\" is not a parameter name");
+        Matcher m = warn.matcher(out);
+        int n = 0;
+        for (int start = 0; m.find(start); start = m.start() + 1) {
+            n++;
+        }
+        if (n != count)
+            error("unexpected number of warnings reported: " + n + "; expected: " + count);
+
+        Pattern warnCount = Pattern.compile("(?ms).*^([0-9]+) warnings$.*");
+        m = warnCount.matcher(out);
+        if (m.matches()) {
+            n = Integer.parseInt(m.group(1));
+            if (n != count)
+                error("unexpected number of warnings reported: " + n + "; expected: " + count);
+        } else
+            error("total count not found");
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
+
--- a/test/tools/javadoc/T6551367.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javadoc/T6551367.java	Tue Jul 02 10:13:00 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -46,7 +46,7 @@
             File source = new File(testSrc, file);
             int rc = execute("javadoc", "T6551367",
               T6551367.class.getClassLoader(),
-              new String[]{source.getPath(), "-d", destDir.getAbsolutePath()});
+              new String[]{"-Xdoclint:none", source.getPath(), "-d", destDir.getAbsolutePath()});
             if (rc != 0)
                 throw new Error("unexpected exit from javadoc: " + rc);
         }
--- a/test/tools/javadoc/api/basic/RunTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ b/test/tools/javadoc/api/basic/RunTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6493690
+ * @bug 6493690 8007490
  * @summary javadoc should have a javax.tools.Tool service provider
  * @build APITest
  * @run main RunTest
@@ -31,6 +31,7 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.PrintStream;
 import javax.tools.DocumentationTool;
 import javax.tools.ToolProvider;
 
@@ -46,7 +47,7 @@
      * Verify that run method can be invoked.
      */
     @Test
-    public void testRun() throws Exception {
+    public void testRunOK() throws Exception {
         File testSrc = new File(System.getProperty("test.src"));
         File srcFile = new File(testSrc, "pkg/C.java");
         File outDir = getOutDir();
@@ -77,7 +78,7 @@
      * Verify that run method can be invoked.
      */
     @Test
-    public void testRun2() throws Exception {
+    public void testRunFail() throws Exception {
         File outDir = getOutDir();
         String badfile = "badfile.java";
         String[] args = { "-d", outDir.getPath(), badfile };
@@ -100,5 +101,48 @@
         }
     }
 
+    /**
+     * Verify that null args are accepted.
+     */
+    @Test
+    public void testNullArgs() throws Exception {
+        File testSrc = new File(System.getProperty("test.src"));
+        File srcFile = new File(testSrc, "pkg/C.java");
+        File outDir = getOutDir();
+        String[] args = { "-d", outDir.getPath(), srcFile.getPath() };
+
+        ByteArrayOutputStream stdout = new ByteArrayOutputStream();
+        PrintStream prevStdout = System.out;
+        System.setOut(new PrintStream(stdout));
+
+        ByteArrayOutputStream stderr = new ByteArrayOutputStream();
+        PrintStream prevStderr = System.err;
+        System.setErr(new PrintStream(stderr));
+
+        int rc ;
+        try {
+            DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
+            rc = tool.run(null, null, null, args);
+        } finally {
+            System.setOut(prevStdout);
+            System.setErr(prevStderr);
+        }
+
+        System.err.println("stdout >>" + stdout.toString() + "<<");
+        System.err.println("stderr >>" + stderr.toString() + "<<");
+
+        if (rc == 0) {
+            System.err.println("call succeeded");
+            checkFiles(outDir, standardExpectFiles);
+            String out = stdout.toString();
+            for (String f: standardExpectFiles) {
+                String f1 = f.replace('/', File.separatorChar);
+                if (f1.endsWith(".html") && !out.contains(f1))
+                    error("expected string not found: " + f1);
+            }
+        } else {
+            error("call failed");
+        }
+    }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javadoc/doclint/DocLintTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,255 @@
+/*
+ * 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
+ * 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 8004834 8007610
+ * @summary Add doclint support into javadoc
+ */
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.tools.Diagnostic;
+import javax.tools.DocumentationTool;
+import javax.tools.DocumentationTool.DocumentationTask;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import static javax.tools.Diagnostic.Kind.*;
+
+import com.sun.tools.javac.main.Main;
+
+public class DocLintTest {
+    public static void main(String... args) throws Exception {
+        new DocLintTest().run();
+    }
+
+    DocumentationTool javadoc;
+    StandardJavaFileManager fm;
+    JavaFileObject file;
+
+    final String code =
+        /* 01 */    "/** Class comment. */\n" +
+        /* 02 */    "public class Test {\n" +
+        /* 03 */    "    /** Method comment. */\n" +
+        /* 04 */    "    public void method() { }\n" +
+        /* 05 */    "\n" +
+        /* 06 */    "    /** Syntax < error. */\n" +
+        /* 07 */    "    private void syntaxError() { }\n" +
+        /* 08 */    "\n" +
+        /* 09 */    "    /** @see DoesNotExist */\n" +
+        /* 10 */    "    protected void referenceError() { }\n" +
+        /* 11 */    "\n" +
+        /* 12 */    "    /** @return */\n" +
+        /* 13 */    "    public int emptyReturn() { return 0; }\n" +
+        /* 14 */    "}\n";
+
+    private final String rawDiags = "-XDrawDiagnostics";
+
+    private enum Message {
+        // doclint messages
+        DL_ERR6(ERROR, "Test.java:6:16: compiler.err.proc.messager: malformed HTML"),
+        DL_ERR9(ERROR, "Test.java:9:14: compiler.err.proc.messager: reference not found"),
+        DL_WRN12(WARNING, "Test.java:12:9: compiler.warn.proc.messager: no description for @return"),
+
+        // doclint messages when -XDrawDiagnostics is not in effect
+        DL_ERR9A(ERROR, "Test.java:9: error: reference not found"),
+        DL_WRN12A(WARNING, "Test.java:12: warning: no description for @return"),
+
+        // javadoc messages about bad content: these should only appear when doclint is disabled
+        JD_WRN10(WARNING, "Test.java:10: warning - Tag @see: reference not found: DoesNotExist"),
+        JD_WRN13(WARNING, "Test.java:13: warning - @return tag has no arguments."),
+
+        // javadoc messages for bad options
+        OPT_BADARG(ERROR, "javadoc: error - Invalid argument for -Xdoclint option"),
+        OPT_BADQUAL(ERROR, "javadoc: error - Access qualifiers not permitted for -Xdoclint arguments");
+
+        final Diagnostic.Kind kind;
+        final String text;
+
+        static Message get(String text) {
+            for (Message m: values()) {
+                if (m.text.equals(text))
+                    return m;
+            }
+            return null;
+        }
+
+        Message(Diagnostic.Kind kind, String text) {
+            this.kind = kind;
+            this.text = text;
+        }
+
+        @Override
+        public String toString() {
+            return "[" + kind + ",\"" + text + "\"]";
+        }
+    }
+
+    void run() throws Exception {
+        javadoc = ToolProvider.getSystemDocumentationTool();
+        fm = javadoc.getStandardFileManager(null, null, null);
+        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
+        file = new SimpleJavaFileObject(URI.create("Test.java"), JavaFileObject.Kind.SOURCE) {
+            @Override
+            public CharSequence getCharContent(boolean ignoreEncoding) {
+                return code;
+            }
+        };
+
+        test(Collections.<String>emptyList(),
+                Main.Result.ERROR,
+                EnumSet.of(Message.DL_ERR9A, Message.DL_WRN12A));
+
+        test(Arrays.asList(rawDiags),
+                Main.Result.ERROR,
+                EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
+
+        test(Arrays.asList("-Xdoclint:none"),
+                Main.Result.OK,
+                EnumSet.of(Message.JD_WRN10, Message.JD_WRN13));
+
+        test(Arrays.asList(rawDiags, "-Xdoclint"),
+                Main.Result.ERROR,
+                EnumSet.of(Message.DL_ERR9, Message.DL_WRN12));
+
+        test(Arrays.asList(rawDiags, "-Xdoclint:all/public"),
+                Main.Result.ERROR,
+                EnumSet.of(Message.OPT_BADQUAL));
+
+        test(Arrays.asList(rawDiags, "-Xdoclint:all", "-public"),
+                Main.Result.OK,
+                EnumSet.of(Message.DL_WRN12));
+
+        test(Arrays.asList(rawDiags, "-Xdoclint:syntax"),
+                Main.Result.OK,
+                EnumSet.of(Message.DL_WRN12));
+
+        test(Arrays.asList(rawDiags, "-private"),
+                Main.Result.ERROR,
+                EnumSet.of(Message.DL_ERR6, Message.DL_ERR9, Message.DL_WRN12));
+
+        test(Arrays.asList(rawDiags, "-Xdoclint:syntax", "-private"),
+                Main.Result.ERROR,
+                EnumSet.of(Message.DL_ERR6, Message.DL_WRN12));
+
+        test(Arrays.asList(rawDiags, "-Xdoclint:reference"),
+                Main.Result.ERROR,
+                EnumSet.of(Message.DL_ERR9));
+
+        test(Arrays.asList(rawDiags, "-Xdoclint:badarg"),
+                Main.Result.ERROR,
+                EnumSet.of(Message.OPT_BADARG));
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    void test(List<String> opts, Main.Result expectResult, Set<Message> expectMessages) {
+        System.err.println("test: " + opts);
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        List<JavaFileObject> files = Arrays.asList(file);
+        try {
+            DocumentationTask t = javadoc.getTask(pw, fm, null, null, opts, files);
+            boolean ok = t.call();
+            pw.close();
+            String out = sw.toString().replaceAll("[\r\n]+", "\n");
+            if (!out.isEmpty())
+                System.err.println(out);
+            if (ok && expectResult != Main.Result.OK) {
+                error("Compilation succeeded unexpectedly");
+            } else if (!ok && expectResult != Main.Result.ERROR) {
+                error("Compilation failed unexpectedly");
+            } else
+                check(out, expectMessages);
+        } catch (IllegalArgumentException e) {
+            System.err.println(e);
+            String expectOut = expectMessages.iterator().next().text;
+            if (expectResult != Main.Result.CMDERR)
+                error("unexpected exception caught");
+            else if (!e.getMessage().equals(expectOut)) {
+                error("unexpected exception message: "
+                        + e.getMessage()
+                        + " expected: " + expectOut);
+            }
+        }
+
+//        if (errors > 0)
+//            throw new Error("stop");
+    }
+
+    private void check(String out, Set<Message> expect) {
+        Pattern ignore = Pattern.compile("^(Building|Constructing|Generating|Loading|Standard|Starting| ) .*");
+        Pattern stats = Pattern.compile("^([1-9]+) (error|warning)(s?)");
+        Set<Message> found = EnumSet.noneOf(Message.class);
+        int e = 0, w = 0;
+        for (String line: out.split("[\r\n]+")) {
+            if (ignore.matcher(line).matches())
+                continue;
+
+            Matcher s = stats.matcher(line);
+            if (s.matches()) {
+                int i = Integer.valueOf(s.group(1));
+                if (s.group(2).equals("error"))
+                    e++;
+                else
+                    w++;
+                continue;
+            }
+
+            Message m = Message.get(line);
+            if (m == null)
+                error("Unexpected line: " + line);
+            else
+                found.add(m);
+        }
+        for (Message m: expect) {
+            if (!found.contains(m))
+                error("expected message not found: " + m.text);
+        }
+        for (Message m: found) {
+            if (!expect.contains(m))
+                error("unexpected message found: " + m.text);
+        }
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javah/6257087/T6257087.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,76 @@
+/*
+ * 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 6257087
+ * @summary javah doesn't produce proper signatures for inner class native methods
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main T6257087
+ */
+
+import java.nio.file.Paths;
+
+public class T6257087 {
+
+    private static final String fooBarGoldenFile =
+        "/* DO NOT EDIT THIS FILE - it is machine generated */\n" +
+        "#include <jni.h>\n" +
+        "/* Header for class foo_bar */\n" +
+        "\n" +
+        "#ifndef _Included_foo_bar\n" +
+        "#define _Included_foo_bar\n" +
+        "#ifdef __cplusplus\n" +
+        "extern \"C\" {\n" +
+        "#endif\n" +
+        "/*\n" +
+        " * Class:     foo_bar\n" +
+        " * Method:    aardvark\n" +
+        " * Signature: ()V\n" +
+        " */\n" +
+        "JNIEXPORT void JNICALL Java_foo_00024bar_aardvark\n" +
+        "  (JNIEnv *, jobject);\n" +
+        "\n" +
+        "#ifdef __cplusplus\n" +
+        "}\n" +
+        "#endif\n" +
+        "#endif";
+
+    public static void main(String[] args) throws Exception {
+        ToolBox.JavaToolArgs javahArgs =
+                new ToolBox.JavaToolArgs()
+                .setAllArgs("-cp", System.getProperty("test.classes"), "foo");
+        ToolBox.javah(javahArgs);
+
+        ToolBox.compareLines(Paths.get("foo_bar.h"),
+                ToolBox.splitLines(fooBarGoldenFile, "\n"), null, true);
+    }
+
+}
+
+class foo {
+    class bar {
+        public native void aardvark();
+    }
+}
--- a/test/tools/javah/6257087/foo.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2006, 2007, 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.
- */
-
-
-class foo {
-    class bar {
-        public native void aardvark();
-    }
-}
--- a/test/tools/javah/6257087/foo.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-#! /bin/sh -f
-
-#
-# Copyright (c) 2006, 2009, 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 6257087
-# @run shell foo.sh
-
-
-TS=${TESTSRC-.}
-TC=${TESTCLASSES-.}
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    PS=":"
-    FS="/"
-    ;;
-  CYGWIN* )
-    PS=":"
-    FS="/"
-    DIFFOPTS="--strip-trailing-cr"
-    ;;
-  Windows* )
-    PS=";"
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TC}" "${TS}${FS}foo.java" 
-"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} -classpath "${TC}" -d "${TC}" foo
-diff ${DIFFOPTS} -c "${TS}${FS}foo_bar.h" "${TC}${FS}foo_bar.h"
-result=$?
-
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- a/test/tools/javah/6257087/foo_bar.h	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class foo_bar */
-
-#ifndef _Included_foo_bar
-#define _Included_foo_bar
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class:     foo_bar
- * Method:    aardvark
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_foo_00024bar_aardvark
-  (JNIEnv *, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/tools/javah/ConstMacroTest.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2003, 2009, 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 4786406 4781221 4780341 6214324
-
-# Validates rewritten javah handling of class defined constants
-# and ensures that the appropriate macro definitions are placed
-# in the generated header file.
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-EXPECTED_JAVAH_OUT_FILE=SubClassConsts.out
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    PS=":"
-    FS="/"
-    ;;
-  CYGWIN* )
-    PS=":"
-    FS="/"
-    DIFFOPTS="--strip-trailing-cr"
-    EXPECTED_JAVAH_OUT_FILE=SubClassConsts.win
-    ;;
-  Windows* )
-    PS=";"
-    FS="\\"
-    EXPECTED_JAVAH_OUT_FILE=SubClassConsts.win
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
- esac
-
-GENERATED_HEADER_FILE=SubClassConsts.h
-HEADER_FILE_FILTERED=SubClassConsts.h.linefeed-filtered
-
-rm -rf SuperClassConsts.class SubClassConsts.class
-
-cp "${TESTSRC}${FS}SuperClassConsts.java" .
-cp "${TESTSRC}${FS}SubClassConsts.java" .
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}SubClassConsts.java"
-
-"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} SubClassConsts
-
-diff ${DIFFOPTS} "${TESTSRC}${FS}${EXPECTED_JAVAH_OUT_FILE}" "${GENERATED_HEADER_FILE}"
-result=$?
-rm ${GENERATED_HEADER_FILE}
-
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- a/test/tools/javah/MissingParamClassException.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2003, 2007, 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.
- */
-
-
-/*
- * ParamClassTest has a native method param which subclasses
- * this class
- *
- */
-
-public class MissingParamClassException extends Exception {
-    public MissingParamClassException() {
-        System.out.println("MissingParamClassException constructor called");
-    }
-}
--- a/test/tools/javah/MissingParamClassTest.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2003, 2009, 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 4942232
-
-#
-# Verifies that javah won't attempt to generate a header file
-# if a native method in a supplied class contains a parameter
-# type whose corresponding class is missing or not in the 
-# classpath
-
-TMP1=OUTPUT.txt
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | CYGWIN* )
-    PS=":"
-    FS="/"
-    ;;
-  Windows* )
-    PS=";"
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
- esac
-
-GENERATED_HEADER_FILE=ParamClassTest.h
-
-rm -f ParamClassTest.class MissingParamClassException.class ParamClassTest.h
-rm -f ${TMP1}
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}ParamClassTest.java" "${TESTSRC}${FS}MissingParamClassException.java"
-
-# Before running javah remove dependent class file
-rm -f MissingParamClassException.class 
-
-"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
-
-if [ -f $GENERATED_HEADER_FILE ]; then
-     echo "1-- Failed: $GENERATED_HEADER_FILE found"
-     rc=1
-fi
-if [ ! -s ${TMP1} ]; then
-     echo "1-- Failed: ${TMP1} is empty"
-     rc=1
-fi
-
-# Clean out work dir
-rm -f MissingParamClassException.class ParamClassTest.class
-rm -f $GENERATED_HEADER_FILE $TMP1 
-
-# Re-compile everything
-
-"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}ParamClassTest.java" "${TESTSRC}${FS}MissingParamClassException.java"
-
-
-# Before re-run of javah remove dependent class file Param.class 
-rm -f Param.class
-
-"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
-
-if [ -f $GENERATED_HEADER_FILE ]; then
-     echo "2-- Failed: $GENERATED_HEADER_FILE found"
-     rc=1
-fi
-if [ ! -s ${TMP1} ]; then
-     echo "2-- Failed: ${TMP1} is empty"
-     rc=1
-fi
-
-if [ "$rc" = "" ]; then
-    echo Passed
-else
-    echo Failed
-    exit 1
-fi
--- a/test/tools/javah/ParamClassTest.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2003, 2007, 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.
- */
-
-
-/*
- * Class containing a native method which contains a native
- * method with non primitive type
- */
-
-public class ParamClassTest {
-    public native void method(Param s);
-
-    public static void main(String args[]) {
-    }
-}
-
-class Param extends MissingParamClassException {
-    Param() {
-        System.out.println("Param constructor");
-    }
-}
--- a/test/tools/javah/SubClassConsts.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2003, 2007, 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.
- */
-
-
-/*
- * Subclass defines its own set of constants
- * It is itself serializable by virtue of extending SuperClassConsts
- *
- */
-public class SubClassConsts extends SuperClassConsts {
-
-    private final static int SUB_INT_CONSTANT = 2;
-    private final static double SUB_DOUBLE_CONSTANT = 2.25;
-    private final static float SUB_FLOAT_CONSTANT = 7.90f;
-    private final static boolean SUB_BOOLEAN_CONSTANT = true;
-
-    public SubClassConsts(String p) {
-        super(p);
-    }
-}
--- a/test/tools/javah/SubClassConsts.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class SubClassConsts */
-
-#ifndef _Included_SubClassConsts
-#define _Included_SubClassConsts
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef SubClassConsts_serialVersionUID
-#define SubClassConsts_serialVersionUID 6733861379283244755LL
-#undef SubClassConsts_SUPER_INT_CONSTANT
-#define SubClassConsts_SUPER_INT_CONSTANT 3L
-#undef SubClassConsts_SUPER_FLOAT_CONSTANT
-#define SubClassConsts_SUPER_FLOAT_CONSTANT 99.3f
-#undef SubClassConsts_SUPER_DOUBLE_CONSTANT
-#define SubClassConsts_SUPER_DOUBLE_CONSTANT 33.2
-#undef SubClassConsts_SUPER_BOOLEAN_CONSTANT
-#define SubClassConsts_SUPER_BOOLEAN_CONSTANT 0L
-#undef SubClassConsts_SUB_INT_CONSTANT
-#define SubClassConsts_SUB_INT_CONSTANT 2L
-#undef SubClassConsts_SUB_DOUBLE_CONSTANT
-#define SubClassConsts_SUB_DOUBLE_CONSTANT 2.25
-#undef SubClassConsts_SUB_FLOAT_CONSTANT
-#define SubClassConsts_SUB_FLOAT_CONSTANT 7.9f
-#undef SubClassConsts_SUB_BOOLEAN_CONSTANT
-#define SubClassConsts_SUB_BOOLEAN_CONSTANT 1L
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/tools/javah/SubClassConsts.win	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class SubClassConsts */
-
-#ifndef _Included_SubClassConsts
-#define _Included_SubClassConsts
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef SubClassConsts_serialVersionUID
-#define SubClassConsts_serialVersionUID 6733861379283244755i64
-#undef SubClassConsts_SUPER_INT_CONSTANT
-#define SubClassConsts_SUPER_INT_CONSTANT 3L
-#undef SubClassConsts_SUPER_FLOAT_CONSTANT
-#define SubClassConsts_SUPER_FLOAT_CONSTANT 99.3f
-#undef SubClassConsts_SUPER_DOUBLE_CONSTANT
-#define SubClassConsts_SUPER_DOUBLE_CONSTANT 33.2
-#undef SubClassConsts_SUPER_BOOLEAN_CONSTANT
-#define SubClassConsts_SUPER_BOOLEAN_CONSTANT 0L
-#undef SubClassConsts_SUB_INT_CONSTANT
-#define SubClassConsts_SUB_INT_CONSTANT 2L
-#undef SubClassConsts_SUB_DOUBLE_CONSTANT
-#define SubClassConsts_SUB_DOUBLE_CONSTANT 2.25
-#undef SubClassConsts_SUB_FLOAT_CONSTANT
-#define SubClassConsts_SUB_FLOAT_CONSTANT 7.9f
-#undef SubClassConsts_SUB_BOOLEAN_CONSTANT
-#define SubClassConsts_SUB_BOOLEAN_CONSTANT 1L
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/test/tools/javah/SuperClassConsts.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2003, 2007, 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.
- */
-
-
-/*
- * Parent class implements serializable and provides static initializers
- * for a bunch of primitive type class constants
- * (required for regtest 4786406, 4780341)
- */
-
-import java.io.*;
-
-public class SuperClassConsts implements Serializable {
-
-    // Define class constant values, base class is serializable
-
-    private static final long serialVersionUID = 6733861379283244755L;
-    public static final int SUPER_INT_CONSTANT = 3;
-    public final static float SUPER_FLOAT_CONSTANT = 99.3f;
-    public final static double SUPER_DOUBLE_CONSTANT  = 33.2;
-    public final static boolean SUPER_BOOLEAN_CONSTANT  = false;
-
-    // A token instance field
-    int instanceField;
-
-    public SuperClassConsts(String p) {
-    }
-
-    public native int numValues();
-
-    private void writeObject(ObjectOutputStream s)
-        throws IOException
-    {
-        System.err.println("writing state");
-    }
-
-    /**
-     * readObject is called to restore the state of the FilePermission from
-     * a stream.
-     */
-    private void readObject(ObjectInputStream s)
-         throws IOException, ClassNotFoundException
-    {
-        System.err.println("reading back state");
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javah/T4942232/MissingParamClassTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 4942232
+ * @summary Verifies that javah won't attempt to generate a header file if a
+ * native method in a supplied class contains a parameter type whose corresponding
+ * class is missing or not in the classpath
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run compile MissingParamClassTest.java
+ * @clean MissingParamClassException
+ * @run main MissingParamClassTest
+ * @run compile MissingParamClassTest.java
+ * @clean Param
+ * @run main MissingParamClassTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+
+//original test: test/tools/javah/MissingParamClassTest.sh
+public class MissingParamClassTest {
+
+    public static void main(String[] args) throws Exception {
+        //first steps done now by jtreg
+//"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}ParamClassTest.java" "${TESTSRC}${FS}MissingParamClassException.java"
+//rm -f MissingParamClassException.class
+
+//"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
+        List<String> errOutput = new ArrayList<>();
+        ToolBox.JavaToolArgs javahParams =
+            new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
+            .setAllArgs("-classpath", System.getProperty("test.classes"), "ParamClassTest")
+            .setErrOutput(errOutput);
+        ToolBox.javah(javahParams);
+
+//if [ -f $GENERATED_HEADER_FILE ]; then  fail
+//if [ ! -s ${TMP1} ]; then fail
+        if (Files.exists(Paths.get("ParamClassTest.h")) || errOutput.size() == 0)
+            throw new AssertionError("The only output generated by javah must be an error message");
+        //jtreg again
+//rm -f MissingParamClassException.class ParamClassTest.class
+//rm -f $GENERATED_HEADER_FILE $TMP1
+    }
+
+}
+
+class MissingParamClassException extends Exception {
+    public MissingParamClassException() {
+        System.out.println("MissingParamClassException constructor called");
+    }
+}
+
+class ParamClassTest {
+    public native void method(Param s);
+
+    public static void main(String args[]) {
+    }
+}
+
+class Param extends MissingParamClassException {
+    Param() {
+        System.out.println("Param constructor");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javah/constMacroTest/ConstMacroTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,117 @@
+/*
+ * 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 4786406 4781221 4780341 6214324
+ * @summary Validates rewritten javah handling of class defined constants and
+ * ensures that the appropriate macro definitions are placed in the generated
+ * header file.
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main ConstMacroTest
+ */
+
+import java.io.*;
+import java.nio.file.Paths;
+
+//original test: test/tools/javah/ConstMacroTest.sh
+public class ConstMacroTest {
+
+    private static final String subClassConstsGoldenFileTemplate =
+        "/* DO NOT EDIT THIS FILE - it is machine generated */\n" +
+        "#include <jni.h>\n" +
+        "/* Header for class SubClassConsts */\n" +
+        "\n" +
+        "#ifndef _Included_SubClassConsts\n" +
+        "#define _Included_SubClassConsts\n" +
+        "#ifdef __cplusplus\n" +
+        "extern \"C\" {\n" +
+        "#endif\n" +
+        "#undef SubClassConsts_serialVersionUID\n" +
+        "#define SubClassConsts_serialVersionUID 6733861379283244755%s\n" +
+        "#undef SubClassConsts_SUPER_INT_CONSTANT\n" +
+        "#define SubClassConsts_SUPER_INT_CONSTANT 3L\n" +
+        "#undef SubClassConsts_SUPER_FLOAT_CONSTANT\n" +
+        "#define SubClassConsts_SUPER_FLOAT_CONSTANT 99.3f\n" +
+        "#undef SubClassConsts_SUPER_DOUBLE_CONSTANT\n" +
+        "#define SubClassConsts_SUPER_DOUBLE_CONSTANT 33.2\n" +
+        "#undef SubClassConsts_SUPER_BOOLEAN_CONSTANT\n" +
+        "#define SubClassConsts_SUPER_BOOLEAN_CONSTANT 0L\n" +
+        "#undef SubClassConsts_SUB_INT_CONSTANT\n" +
+        "#define SubClassConsts_SUB_INT_CONSTANT 2L\n" +
+        "#undef SubClassConsts_SUB_DOUBLE_CONSTANT\n" +
+        "#define SubClassConsts_SUB_DOUBLE_CONSTANT 2.25\n" +
+        "#undef SubClassConsts_SUB_FLOAT_CONSTANT\n" +
+        "#define SubClassConsts_SUB_FLOAT_CONSTANT 7.9f\n" +
+        "#undef SubClassConsts_SUB_BOOLEAN_CONSTANT\n" +
+        "#define SubClassConsts_SUB_BOOLEAN_CONSTANT 1L\n" +
+        "#ifdef __cplusplus\n" +
+        "}\n" +
+        "#endif\n" +
+        "#endif";
+
+    private static final String serialVersionUIDSuffix =
+            ToolBox.isWindows() ? "i64" : "LL"; ;
+
+    public static void main(String[] args) throws Exception {
+        //first steps are now done by jtreg
+//        cp "${TESTSRC}${FS}SuperClassConsts.java" .
+//        cp "${TESTSRC}${FS}SubClassConsts.java" .
+
+//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}SubClassConsts.java"
+
+//        "${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} SubClassConsts
+        ToolBox.JavaToolArgs successParams =
+                new ToolBox.JavaToolArgs()
+                .setAllArgs("-cp", System.getProperty("test.classes"), "SubClassConsts");
+        ToolBox.javah(successParams);
+
+//        diff ${DIFFOPTS} "${TESTSRC}${FS}${EXPECTED_JAVAH_OUT_FILE}" "${GENERATED_HEADER_FILE}"
+        String subClassConstGoldenFile = String.format(subClassConstsGoldenFileTemplate,
+                serialVersionUIDSuffix);
+        ToolBox.compareLines(Paths.get("SubClassConsts.h"),
+                ToolBox.splitLines(subClassConstGoldenFile, "\n"), null, true);
+    }
+
+}
+
+class SuperClassConsts implements Serializable {
+    // Define class constant values, base class is serializable
+    private static final long serialVersionUID = 6733861379283244755L;
+    public static final int SUPER_INT_CONSTANT = 3;
+    public final static float SUPER_FLOAT_CONSTANT = 99.3f;
+    public final static double SUPER_DOUBLE_CONSTANT  = 33.2;
+    public final static boolean SUPER_BOOLEAN_CONSTANT  = false;
+    // A token instance field
+    int instanceField;
+
+    public native int numValues();
+}
+
+class SubClassConsts extends SuperClassConsts {
+    private final static int SUB_INT_CONSTANT = 2;
+    private final static double SUB_DOUBLE_CONSTANT = 2.25;
+    private final static float SUB_FLOAT_CONSTANT = 7.90f;
+    private final static boolean SUB_BOOLEAN_CONSTANT = true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/4798312/JavapShouldLoadClassesFromRTJarTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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 4798312
+ * @summary In Windows, javap doesnt load classes from rt.jar
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main JavapShouldLoadClassesFromRTJarTest
+ */
+public class JavapShouldLoadClassesFromRTJarTest {
+
+    public static void main(String[] args) throws Exception {
+//        "${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} java.lang.String
+        ToolBox.JavaToolArgs params =
+                new ToolBox.JavaToolArgs().
+                setAllArgs("-v", "java.lang.String");
+        if (ToolBox.javap(params).isEmpty())
+            throw new AssertionError("javap generated no output");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/4866831/PublicInterfaceTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,52 @@
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/*
+ * 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 4866831
+ * @summary Verify that javap marks public interfaces as public
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main PublicInterfaceTest
+ */
+
+//original test: test/tools/javap/PublicInterfaceTest.sh
+public class PublicInterfaceTest {
+    public interface Test {}
+
+    public static void main(String[] args) throws Exception {
+//        "$JAVAP" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" NotPackagePrivateInterface | grep public
+        Path pathToClass = Paths.get(System.getProperty("test.classes"),
+                "PublicInterfaceTest$Test.class");
+        ToolBox.JavaToolArgs javapParams =
+                new ToolBox.JavaToolArgs()
+                .setAllArgs(pathToClass.toString());
+        if (!ToolBox.javap(javapParams).contains("public"))
+            throw new AssertionError("The javap output does not contain \"public\"");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/8006334/JavapTaskCtorFailWithNPE.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8006334
+ * @summary javap: JavapTask constructor breaks with null pointer exception if
+ * parameter options is null
+ */
+
+import java.io.File;
+import java.util.Arrays;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.Locale;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import com.sun.tools.javap.JavapFileManager;
+import com.sun.tools.javap.JavapTask;
+
+public class JavapTaskCtorFailWithNPE {
+
+    //we will also check the output just to confirm that we get the expected one
+    private static final String expOutput =
+        "Compiled from \"JavapTaskCtorFailWithNPE.java\"\n" +
+        "public class JavapTaskCtorFailWithNPE {\n" +
+        "  public JavapTaskCtorFailWithNPE();\n" +
+        "  public static void main(java.lang.String[]);\n" +
+        "}\n";
+
+    public static void main(String[] args) {
+        new JavapTaskCtorFailWithNPE().run();
+    }
+
+    private void run() {
+        File classToCheck = new File(System.getProperty("test.classes"),
+            getClass().getSimpleName() + ".class");
+
+        DiagnosticCollector<JavaFileObject> dc =
+                new DiagnosticCollector<JavaFileObject>();
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        JavaFileManager fm = JavapFileManager.create(dc, pw);
+        JavapTask t = new JavapTask(pw, fm, dc, null,
+                Arrays.asList(classToCheck.getPath()));
+        boolean ok = t.run();
+        if (!ok)
+            throw new Error("javap failed unexpectedly");
+
+        List<Diagnostic<? extends JavaFileObject>> diags = dc.getDiagnostics();
+        for (Diagnostic<? extends JavaFileObject> d: diags) {
+            if (d.getKind() == Diagnostic.Kind.ERROR)
+                throw new AssertionError(d.getMessage(Locale.ENGLISH));
+        }
+        String lineSep = System.getProperty("line.separator");
+        String out = sw.toString().replace(lineSep, "\n");
+        if (!out.equals(expOutput)) {
+            throw new AssertionError("The output is not equal to the one expected");
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/DescriptorTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -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     8007052
+ * @summary javap should include the descriptor for a method in verbose mode
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.regex.Pattern;
+
+public class DescriptorTest {
+    public static void main(String... args) throws Exception {
+        new DescriptorTest().run();
+    }
+
+    void run() throws Exception {
+        File srcDir = new File("src");
+        srcDir.mkdirs();
+        File classesDir = new File("classes");
+        classesDir.mkdirs();
+
+        File f = writeFile(new File(srcDir, "E.java"), "enum E { A, B }");
+        javac("-d", classesDir.getPath(), f.getPath());
+        String out = javap("-p", "-v", new File(classesDir, "E.class").getPath());
+        Pattern expect = Pattern.compile("\\Qprivate E();\\E\\s+\\Qdescriptor: (Ljava/lang/String;I)V\\E");
+        checkContains(out, expect);
+    }
+
+    File writeFile(File f, String body) throws IOException {
+        try (FileWriter out = new FileWriter(f)) {
+            out.write(body);
+        }
+        return f;
+    }
+
+    void javac(String... args) throws Exception {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(args, pw);
+        pw.flush();
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out);
+        if (rc != 0)
+            throw new Exception("compilation failed");
+    }
+
+    String javap(String... args) throws Exception {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        pw.flush();
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out);
+        if (rc != 0)
+            throw new Exception("javap failed");
+        return out;
+    }
+
+    void checkContains(String s, Pattern p) throws Exception {
+        if (!p.matcher(s).find())
+            throw new Exception("expected pattern not found: " + p);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/MethodParameters.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2010, 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 8004727 8005647
+ * @summary javac should generate method parameters correctly.
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class MethodParameters {
+
+    static final String Foo_name = "Foo";
+    static final String Foo_contents =
+        ("public class Foo {\n" +
+         "  Foo() {}\n" +
+         "  Foo(int i) {}\n" +
+         "  void foo0() {}\n" +
+         "  void foo2(int j, int k) {}\n" +
+         "}").replaceAll(" +", " ");
+
+    static final String Init0_expected =
+        ("  Foo();\n" +
+         "    descriptor: ()V\n" +
+         "    flags: \n" +
+         "    Code:\n" +
+         "      stack=1, locals=1, args_size=1\n" +
+         "         0: aload_0       \n" +
+         "         1: invokespecial #1                  // Method java/lang/Object.\"<init>\":()V\n" +
+         "         4: return        \n" +
+         "      LineNumberTable:\n" +
+         "        line 2: 0").replaceAll(" +", " ");
+
+    static final String Init1_expected =
+        ("  Foo(int);\n" +
+         "    descriptor: (I)V\n" +
+         "    flags: \n" +
+         "    Code:\n" +
+         "      stack=1, locals=2, args_size=2\n" +
+         "         0: aload_0       \n" +
+         "         1: invokespecial #1                  // Method java/lang/Object.\"<init>\":()V\n" +
+         "         4: return        \n" +
+         "      LineNumberTable:\n" +
+         "        line 3: 0\n" +
+         "    MethodParameters:\n" +
+         "      Name                                Flags\n" +
+         "      i").replaceAll(" +", " ");
+
+    static final String foo0_expected =
+        ("  void foo0();\n" +
+         "    descriptor: ()V\n" +
+         "    flags: \n" +
+         "    Code:\n" +
+         "      stack=0, locals=1, args_size=1\n" +
+         "         0: return        \n" +
+         "      LineNumberTable:\n" +
+         "        line 4: 0").replaceAll(" +", " ");
+
+    static final String foo2_expected =
+        ("  void foo2(int, int);\n" +
+         "    descriptor: (II)V\n" +
+         "    flags: \n" +
+         "    Code:\n" +
+         "      stack=0, locals=3, args_size=3\n" +
+         "         0: return        \n" +
+         "      LineNumberTable:\n" +
+         "        line 5: 0\n" +
+         "    MethodParameters:\n" +
+         "      Name                                Flags\n" +
+         "      j                              \n" +
+         "      k").replaceAll(" +", " ");
+
+    static final File classesdir = new File("methodparameters");
+    static final String separator = System.getProperty("line.separator");
+
+    public static void main(String... args) throws Exception {
+        new MethodParameters().run();
+    }
+
+    void run() throws Exception {
+        classesdir.mkdir();
+        final File Foo_java =
+            writeFile(classesdir, Foo_name + ".java", Foo_contents);
+        compile("-parameters", "-d", classesdir.getPath(), Foo_java.getPath());
+        System.out.println("Run javap");
+        String output =
+            javap("-c", "-verbose", "-classpath",
+                  classesdir.getPath(), Foo_name);
+        String normalized =
+            output.replaceAll(separator, "\n").replaceAll(" +", " ");
+
+        if (!normalized.contains(Init0_expected))
+            error("Bad output for zero-parameter constructor.  Expected\n" +
+                  Init0_expected + "\n" + "but got\n" + normalized);
+        if (!normalized.contains(Init1_expected))
+           error("Bad output for one-parameter constructor.  Expected\n" +
+                 Init1_expected + "\n" + "but got\n" + normalized);
+        if (!normalized.contains(foo0_expected))
+           error("Bad output for zero-parameter method.  Expected\n" +
+                 foo0_expected + "\n" + "but got\n" + normalized);
+        if (!normalized.contains(foo2_expected))
+           error("Bad output for two-parameter method  Expected\n" +
+                 foo2_expected + "\n" + "but got\n" + normalized);
+
+        if (0 != errors)
+            throw new Exception("MethodParameters test failed with " +
+                                errors + " errors");
+    }
+
+    String javap(String... args) {
+        StringWriter sw = new StringWriter();
+        PrintWriter out = new PrintWriter(sw);
+        //sun.tools.javap.Main.entry(args);
+        int rc = com.sun.tools.javap.Main.run(args, out);
+        if (rc != 0)
+            throw new Error("javap failed. rc=" + rc);
+        out.close();
+        System.out.println(sw);
+        return sw.toString();
+    }
+
+    String compile(String... args) throws Exception {
+        System.err.println("compile: " + Arrays.asList(args));
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(args, pw);
+        pw.close();
+        String out = sw.toString();
+        if (out.length() > 0)
+            System.err.println(out);
+        if (rc != 0)
+            error("compilation failed, rc=" + rc);
+        return out;
+    }
+
+    File writeFile(File dir, String path, String body) throws IOException {
+        File f = new File(dir, path);
+        f.getParentFile().mkdirs();
+        FileWriter out = new FileWriter(f);
+        out.write(body);
+        out.close();
+        return f;
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+
+}
--- a/test/tools/javap/NotPackagePrivateInterface.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2003, 2007, 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.
- */
-
-
-/*
- * This class is used by PublicInterfaceTest.sh to generate a class
- * file with a public interface to verify javap will output the
- * "public" modifier for such interfaces.  (At the vm level, the only
- * access control properties an interface can can have are public and
- * package private.)
- */
-
-public interface NotPackagePrivateInterface {
-}
--- a/test/tools/javap/PublicInterfaceTest.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2003, 2007, 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 4866831
-# @build NotPackagePrivateInterface
-# @run shell PublicInterfaceTest.sh
-# @summary Verify that javap marks public interfaces as public
-# @author Joseph D. Darcy
-
-# Verify directory context variables are set
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-JAVAP="${TESTJAVA}/bin/javap"
-
-"$JAVAP" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" NotPackagePrivateInterface | grep public
-
-# If the exit status of grep is 0, then "public" was correctly found
-# in the output of javap.
-
-RESULT=$?
-case "$RESULT" in
-        0  )
-	exit 0;
-        ;;
-
-        * )
-        echo "The javap tool did not output \"public\" for a public interface."
-        exit 1
-esac
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/output/RepeatingTypeAnnotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,400 @@
+/*
+ * 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 8005220
+ * @summary javap must display repeating annotations
+ */
+import java.io.*;
+import java.util.*;
+
+/**
+ * This class extends the abstract {@link Tester} test-driver, and
+ * encapusulates a number of test-case classes (i.e. classes extending
+ * this class and annotated with {@code TestCase}).
+ * <p>
+ * By default (no argument), this test runs all test-cases, except
+ * if annotated with {@code ignore}.
+ * <p>
+ * Individual test cases can be executed using a run action.
+ * <p>
+ * Example: @run main RepeatingTypeAnnotations RepeatingTypeAnnotations$TC4
+ * <p>
+ * Note: when specific test-cases are run, additional debug output is
+ * produced to help debugging. Test annotated with {@code ignore}
+ * can be executed explicitly.
+ */
+public class RepeatingTypeAnnotations extends Tester {
+
+    /**
+     * Main method instantiates test and run test-cases.
+     */
+    public static void main(String... args) throws Exception {
+        Tester tester = new RepeatingTypeAnnotations();
+        tester.run(args);
+    }
+
+    /**
+     * Testcases are classes extending {@code RepeatingTypeAnnotations},
+     * and calling {@link setSrc}, followed by one or more invocations
+     * of {@link verify} in the body of the constructor.
+     */
+    public RepeatingTypeAnnotations() {
+        setSrc(new TestSource(template));
+    }
+
+    /**
+     * Common template for test cases. The line TESTCASE is
+     * replaced with the specific lines of individual tests.
+     */
+    private static final String[] template = {
+        "import java.lang.annotation.*;",
+        "class Test {",
+        "    @Repeatable(As.class)",
+        "    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
+        "    @Retention(RetentionPolicy.CLASS)",
+        "    @interface A {",
+        "        Class f() default int.class;",
+        "    }",
+
+        "    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
+        "    @Retention(RetentionPolicy.CLASS)",
+        "    @interface As { A[] value(); }",
+
+        "    @Repeatable(Bs.class)",
+        "    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
+        "    @Retention(RetentionPolicy.CLASS)",
+        "    @interface B {",
+        "        Class f() default int.class;",
+        "    }",
+
+        "    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
+        "    @Retention(RetentionPolicy.CLASS)",
+        "    @interface Bs { B[] value(); }",
+
+        "    @Repeatable(Cs.class)",
+        "    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
+        "    @Retention(RetentionPolicy.RUNTIME)",
+        "    @interface C {",
+        "        Class f() default int.class;",
+        "    }",
+
+        "    @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})",
+        "    @Retention(RetentionPolicy.RUNTIME)",
+        "    @interface Cs { C[] value(); }",
+        "TESTCASE",
+        "}"
+    };
+
+    /*
+     * The test cases covers annotation in the following locations:
+     * - static and non-static fields
+     * - local variables
+     * - constructor and method return type and parameter types
+     * - casts in class and method contexts.
+     * For the above locations the test-cases covers:
+     * - single annotation type
+     * - two annotation types with same retention
+     * - two annotation types with different retention
+     * - three annotation types, two of same retention, one different.
+     */
+
+    @TestCase
+    @ignore // 8008082:missing type annotation for cast
+    public static class TC1 extends RepeatingTypeAnnotations {
+        public TC1() {
+            setSrc("    static String so = \"hello world\";",
+                   "    public @A @A @A Object o = (@A @A @A String) Test.so;");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "0: #25(#26=[@#27(),@#27(),@#27()]): FIELD",
+                   "1: #25(#26=[@#27(),@#27(),@#27()]): CAST, offset=5");
+        }
+    }
+
+    @TestCase
+    public static class TC2 extends RepeatingTypeAnnotations {
+        public TC2() {
+            setSrc("    static String so = \"hello world\";",
+                   "    public @A @B @A Object o = (@B @A @B String) Test.so;");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "0: #25(#26=[@#27(),@#27()]): FIELD",
+                   "1: #28(): FIELD",
+                   "2: #29(#26=[@#28(),@#28()]): CAST, offset=5",
+                   "3: #27(): CAST, offset=5");
+        }
+    }
+
+    @TestCase
+    public static class TC3 extends RepeatingTypeAnnotations {
+        public TC3() {
+            setSrc("    static String so = \"hello world\";",
+                   "    public @A @A @C Object o = (@B @C @B String) Test.so;");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "0: #25(): FIELD",
+                   "1: #25(): CAST, offset=5",
+                   "RuntimeVisibleTypeAnnotations",
+                   "0: #27(#28=[@#29(),@#29()]): FIELD",
+                   "1: #30(#28=[@#31(),@#31()]): CAST, offset=5");
+        }
+    }
+
+    @TestCase
+    public static class TC4 extends RepeatingTypeAnnotations {
+        public TC4() {
+            setSrc("    static String so = \"hello world\";",
+                   "    public @A @B @C Object o = (@C @B @A String) Test.so;");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "RuntimeVisibleTypeAnnotations",
+                   "0: #25(): FIELD",
+                   "1: #25(): CAST, offset=5",
+                   "0: #27(): FIELD",
+                   "1: #28(): FIELD",
+                   "2: #28(): CAST, offset=5",
+                   "3: #27(): CAST, offset=5");
+        }
+    }
+
+    @TestCase
+    @ignore // 8008082:missing type annotation for cast
+    public static class TC5 extends RepeatingTypeAnnotations {
+        public TC5() {
+            setSrc("    static String so = \"hello world\";",
+                   "    public static @A @A @A Object o = (@B @B @B String) Test.so;");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "0: #25(#26=[@#27(),@#27(),@#27()]): FIELD",
+                   "1: #28(#26=[@#29(),@#29(),@#29()]): CAST, offset=5, type_index=0");
+        }
+    }
+
+    @TestCase
+    public static class TC6 extends RepeatingTypeAnnotations {
+        public TC6() {
+            setSrc("    static String so = \"hello world\";",
+                   "    public static @A @B @A Object o = (@B @A @B String) Test.so;");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "0: #25(#26=[@#27(),@#27()]): FIELD",
+                   "1: #28(): FIELD",
+                   "2: #29(#26=[@#28(),@#28()]): CAST, offset=5",
+                   "3: #27(): CAST, offset=5");
+        }
+    }
+
+    @TestCase
+    public static class TC7 extends RepeatingTypeAnnotations {
+        public TC7() {
+            setSrc("    static String so = \"hello world\";",
+                   "    public static @A @A @C Object o = (@B @C @B String) Test.so;");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "RuntimeVisibleTypeAnnotations",
+                   "0: #25(): FIELD",
+                   "1: #25(): CAST, offset=5",
+                   "0: #27(#28=[@#29(),@#29()]): FIELD",
+                   "1: #30(#28=[@#31(),@#31()]): CAST, offset=5");
+        }
+    }
+
+    @TestCase
+    public static class TC8 extends RepeatingTypeAnnotations {
+        public TC8() {
+            setSrc("    static String so = \"hello world\";",
+                   "    public static @A @B @C Object o = (@C @B @A String) Test.so;");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "RuntimeVisibleTypeAnnotations",
+                   "0: #25(): FIELD",
+                   "1: #25(): CAST, offset=5",
+                   "0: #27(): FIELD",
+                   "1: #28(): FIELD",
+                   "2: #28(): CAST, offset=5",
+                   "3: #27(): CAST, offset=5");
+        }
+    }
+
+    @TestCase
+    @ignore // 8008082:missing type annotation for cast
+    public static class TC9 extends RepeatingTypeAnnotations {
+        public TC9() {
+            setSrc("    public Test(@A @A @A Object o, @A int i, long l) {",
+                   "        @A @A @A String ls = (@B @B @B String) o;",
+                   "    }");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "0: #34(#35=[@#36(),@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "1: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "2: #37(#35=[@#38(),@#38(),@#38()]): CAST, offset=4, type_index=0",
+                   "3: #34(#35=[@#36(),@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}");
+        }
+    }
+
+    @TestCase
+    public static class TC10 extends RepeatingTypeAnnotations {
+        public TC10() {
+            setSrc("    public Test(@A @A @B Object o, @A @B int i, long l) {",
+                   "        @A @A @B String ls = (@B @A @B String) o;",
+                   "    }");
+            verify("RuntimeInvisibleTypeAnnotations:",
+                   "0: #34(#35=[@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "1: #37(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "2: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "3: #37(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "4: #38(#35=[@#37(),@#37()]): CAST, offset=4, type_index=0",
+                   "5: #36(): CAST, offset=4, type_index=0",
+                   "6: #34(#35=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "7: #37(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}");
+        }
+    }
+
+    @TestCase
+    public static class TC11 extends RepeatingTypeAnnotations {
+        public TC11() {
+            setSrc("    public Test(@C @C @A Object o, @A @B int i, long l) {",
+                   "        @C @C @A String ls = (@A @A @C String) o;",
+                   "    }");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "RuntimeVisibleTypeAnnotations",
+                   "0: #34(#35=[@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "1: #36(): CAST, offset=4",
+                   "2: #34(#35=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "0: #38(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "1: #38(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "2: #39(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "3: #40(#35=[@#38(),@#38()]): CAST, offset=4",
+                   "4: #38(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}");
+        }
+    }
+
+    @TestCase
+    public static class TC12 extends RepeatingTypeAnnotations {
+        public TC12() {
+            setSrc("    public Test(@A @B @C Object o, @A @C int i, long l) {",
+                   "        @A @B @C String ls = (@C @A @B String) o;",
+                   "    }");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "RuntimeVisibleTypeAnnotations",
+                   "0: #34(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "1: #34(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "2: #34(): CAST, offset=4",
+                   "3: #34(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "0: #36(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "1: #37(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "2: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "3: #36(): CAST, offset=4",
+                   "4: #37(): CAST, offset=4",
+                   "5: #36(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}",
+                   "6: #37(): LOCAL_VARIABLE, {start_pc=10, length=1, index=5}");
+        }
+    }
+
+    @TestCase
+    @ignore // 8008082:missing type annotation for cast
+    public static class TC13 extends RepeatingTypeAnnotations {
+        public TC13() {
+            setSrc("    public @A @A @A String foo(@A @A @A Object o, @A int i, long l) {",
+                   "        @A @A @A String ls = (@B @B @B String) o;",
+                   "        return (@A @A @A String) o;",
+                   "    }");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "0: #36(#37=[@#38(),@#38(),@#38()]): METHOD_RETURN",
+                   "1: #36(#37=[@#38(),@#38(),@#38()]): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "2: #38(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "3: #39(#37=[@#40(),@#40(),@#40()]): CAST, offset=0, type_index=0",
+                   "4: #36(#37=[@#38(),@#38(),@#38()]): CAST, offset=6, type_index=0",
+                   "5: #36(#37=[@#38(),@#38(),@#38()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}");
+        }
+    }
+
+    @TestCase
+    public static class TC14 extends RepeatingTypeAnnotations {
+        public TC14() {
+            setSrc("    public @A @B @B String foo(@A @A @B Object o, @A @B int i, long l) {",
+                   "        @A @A @B String ls = (@B @A @B String) o;",
+                   "        return (@A @B @B String) o;",
+                   "    }");
+            verify("RuntimeInvisibleTypeAnnotations",
+                    "0: #36(): METHOD_RETURN",
+                    "1: #37(#38=[@#39(),@#39()]): METHOD_RETURN",
+                    "2: #40(#38=[@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
+                    "3: #39(): METHOD_FORMAL_PARAMETER, param_index=0",
+                    "4: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
+                    "5: #39(): METHOD_FORMAL_PARAMETER, param_index=1",
+                    "6: #37(#38=[@#39(),@#39()]): CAST, offset=0",
+                    "7: #36(): CAST, offset=0",
+                    "8: #36(): CAST, offset=6",
+                    "9: #37(#38=[@#39(),@#39()]): CAST, offset=6",
+                    "10: #40(#38=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
+                    "11: #39(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}");
+        }
+    }
+
+    @TestCase
+    public static class TC15 extends RepeatingTypeAnnotations {
+        public TC15() {
+            setSrc("    public @A @A @C String foo(@C @C @A Object o, @A @B int i, long l) {",
+                   "        @C @C @A String ls = (@A @A @C String) o;",
+                   "        return (@C @B @B String) o;",
+                   "    }");
+            verify("RuntimeInvisibleTypeAnnotations",
+                    "RuntimeVisibleTypeAnnotations",
+                    "0: #36(): METHOD_RETURN",
+                    "1: #37(#38=[@#36(),@#36()]): METHOD_FORMAL_PARAMETER, param_index=0",
+                    "2: #36(): CAST, offset=0",
+                    "3: #36(): CAST, offset=6",
+                    "4: #37(#38=[@#36(),@#36()]): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
+                    "0: #40(#38=[@#41(),@#41()]): METHOD_RETURN",
+                    "1: #41(): METHOD_FORMAL_PARAMETER, param_index=0",
+                    "2: #41(): METHOD_FORMAL_PARAMETER, param_index=1",
+                    "3: #42(): METHOD_FORMAL_PARAMETER, param_index=1",
+                    "4: #40(#38=[@#41(),@#41()]): CAST, offset=0",
+                    "5: #43(#38=[@#42(),@#42()]): CAST, offset=6",
+                    "6: #41(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}");
+        }
+    }
+
+    @TestCase
+    public static class TC16 extends RepeatingTypeAnnotations {
+        public TC16() {
+            setSrc("    public @A @B @C String foo(@A @B @C Object o, @A @C int i, long l) {",
+                   "        @A @B @C String ls = (@C @A @B String) o;",
+                   "        return (@B @A @C String) o;",
+                   "    }");
+            verify("RuntimeInvisibleTypeAnnotations",
+                   "RuntimeVisibleTypeAnnotations",
+                   "0: #36(): METHOD_RETURN",
+                   "1: #36(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "2: #36(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "3: #36(): CAST, offset=0",
+                   "4: #36(): CAST, offset=6",
+                   "5: #36(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
+                   "0: #38(): METHOD_RETURN",
+                   "1: #39(): METHOD_RETURN",
+                   "2: #38(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "3: #39(): METHOD_FORMAL_PARAMETER, param_index=0",
+                   "4: #38(): METHOD_FORMAL_PARAMETER, param_index=1",
+                   "5: #38(): CAST, offset=0",
+                   "6: #39(): CAST, offset=0",
+                   "7: #39(): CAST, offset=6",
+                   "8: #38(): CAST, offset=6",
+                   "9: #38(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}",
+                   "10: #39(): LOCAL_VARIABLE, {start_pc=6, length=5, index=5}");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/output/Tester.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,389 @@
+/*
+ * 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.*;
+import java.util.*;
+import java.lang.annotation.*;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * {@code Tester} is an abstract test-driver that provides the logic
+ * to execute test-cases, grouped by test classes.
+ * A test class is a main class extending this class, that instantiate
+ * itself, and calls the {@link run} method, passing any command line
+ * arguments.
+ * <p>
+ * The {@code run} method, expects arguments to identify test-case classes.
+ * A test-case class is a class extending the test class, and annotated
+ * with {@code TestCase}.
+ * <p>
+ * If no test-cases are specified, the test class directory is searched for
+ * co-located test-case classes (i.e. any class extending the test class,
+ * annotated with  {@code TestCase}).
+ * <p>
+ * Besides serving to group test-cases, extending the driver allow
+ * setting up a test-case template, and possibly overwrite default
+ * test-driver behaviour.
+ */
+public abstract class Tester {
+
+    private static boolean debug = false;
+    private static final PrintStream out = System.err;
+    private static final PrintStream err = System.err;
+
+
+    protected void run(String... args) throws Exception {
+
+        final File classesdir = new File(System.getProperty("test.classes", "."));
+
+        String[] classNames = args;
+
+        // If no test-cases are specified, we regard all co-located classes
+        // as potential test-cases.
+        if (args.length == 0) {
+            final String pattern =  ".*\\.class";
+            final File classFiles[] = classesdir.listFiles(new FileFilter() {
+                    public boolean accept(File f) {
+                        return f.getName().matches(pattern);
+                    }
+                });
+            ArrayList<String> names = new ArrayList<String>(classFiles.length);
+            for (File f : classFiles) {
+                String fname = f.getName();
+                names.add(fname.substring(0, fname.length() -6));
+            }
+            classNames = names.toArray(new String[names.size()]);
+        } else {
+            debug = true;
+        }
+        // Test-cases must extend the driver type, and be marked
+        // @TestCase. Other arguments (classes) are ignored.
+        // Test-cases are instantiated, and thereby executed.
+        for (String clname : classNames) {
+            try {
+                final Class tclass = Class.forName(clname);
+                if  (!getClass().isAssignableFrom(tclass)) continue;
+                TestCase anno = (TestCase) tclass.getAnnotation(TestCase.class);
+                if (anno == null) continue;
+                if (!debug) {
+                    ignore i = (ignore) tclass.getAnnotation(ignore.class);
+                    if (i != null) {
+                        out.println("Ignore: " + clname);
+                        ignored++;
+                        continue;
+                    }
+                }
+                out.println("TestCase: " + clname);
+                cases++;
+                Tester tc = (Tester) tclass.getConstructor().newInstance();
+                if (tc.errors > 0) {
+                    error("" + tc.errors + " test points failed in " + clname);
+                    errors += tc.errors - 1;
+                    fcases++;
+                }
+            } catch(ReflectiveOperationException roe) {
+                error("Warning: " + clname + " - ReflectiveOperationException");
+                roe.printStackTrace(err);
+            } catch(Exception unknown) {
+                error("Warning: " + clname + " - uncaught exception");
+                unknown.printStackTrace(err);
+            }
+        }
+
+        String imsg = ignored > 0 ? " (" +  ignored + " ignored)" : "";
+        if (errors > 0)
+            throw new Error(errors + " error, in " + fcases + " of " + cases + " test-cases" + imsg);
+        else
+            err.println("" + cases + " test-cases executed" + imsg + ", no errors");
+    }
+
+
+    /**
+     * Test-cases must be marked with the {@code TestCase} annotation,
+     * as well as extend {@code Tester} (or an driver extension
+     * specified as the first argument to the {@code main()} method.
+     */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface TestCase { }
+
+    /**
+     * Individual test-cases failing due to product bugs, may temporarily
+     * be excluded by marking them like  this:
+     * @ignore // 1234567:bug synopsis
+     */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface ignore { }
+
+    /**
+     * Test-cases are classes extending {@code Tester}, and
+     * calling {@link setSrc}, followed by one or more invocations
+     * of {@link verify} in the body of the constructor.
+     * <p>
+     * Sets a default test-case template, which is empty except
+     * for a key of {@code "TESTCASE"}.
+     * Subclasses will typically call {@code setSrc(TestSource)}
+     * to setup a useful test-case template.
+     */
+    public Tester() {
+        this.testCase = this.getClass().getName();
+        src = new TestSource("TESTCASE");
+    }
+
+    /**
+     * Set the top-level source template.
+     */
+    protected Tester setSrc(TestSource src) {
+        this.src = src;
+        return this;
+    }
+
+    /**
+     * Convenience method for calling {@code innerSrc("TESTCASE", ...)}.
+     */
+    protected Tester setSrc(String... lines) {
+        return innerSrc("TESTCASE", lines);
+    }
+
+    /**
+     * Convenience method for calling {@code innerSrc(key, new TestSource(...))}.
+     */
+    protected Tester innerSrc(String key, String... lines) {
+        return innerSrc(key, new TestSource(lines));
+    }
+
+    /**
+     * Specialize the testcase template, setting replacement content
+     * for the specified key.
+     */
+    protected Tester innerSrc(String key, TestSource content) {
+        if (src == null) {
+            src = new TestSource(key);
+        }
+        src.setInner(key, content);
+        return this;
+    }
+
+    /**
+     * On the first invocation, call {@code execute()} to compile
+     * the test-case source and process the resulting class(se)
+     * into verifiable output.
+     * <p>
+     * Verify that the output matches each of the regular expressions
+     * given as argument.
+     * <p>
+     * Any failure to match constitutes a test failure, but doesn't
+     * abort the test-case.
+     * <p>
+     * Any exception (e.g. bad regular expression syntax) results in
+     * a test failure, and aborts the test-case.
+     */
+    protected void verify(String... expect) {
+        if (!didExecute) {
+            try {
+                execute();
+            } catch(Exception ue) {
+                throw new Error(ue);
+            } finally {
+                didExecute = true;
+            }
+        }
+        if (output == null) {
+            error("output is null");
+            return;
+        }
+        for (String e: expect) {
+            // Escape regular expressions (to allow input to be literals).
+            // Notice, characters to be escaped are themselves identified
+            // using regular expressions
+            String rc[] = { "(", ")", "[", "]", "{", "}", "$" };
+            for (String c : rc) {
+                e = e.replace(c, "\\" + c);
+            }
+            // DEBUG: Uncomment this to test modulo constant pool index.
+            // e = e.replaceAll("#[0-9]{2}", "#[0-9]{2}");
+            if (!output.matches("(?s).*" + e + ".*")) {
+                if (!didPrint) {
+                    out.println(output);
+                    didPrint = true;
+                }
+                error("not matched: '" + e + "'");
+            } else if(debug) {
+                out.println("matched: '" + e + "'");
+            }
+        }
+    }
+
+    /**
+     * Calls {@code writeTestFile()} to write out the test-case source
+     * content to a file, then call {@code compileTestFile()} to
+     * compile it, and finally run the {@link process} method to produce
+     * verifiable output. The default {@code process} method runs javap.
+     * <p>
+     * If an exception occurs, it results in a test failure, and
+     * aborts the test-case.
+     */
+    protected void execute() throws IOException {
+        err.println("TestCase: " + testCase);
+        writeTestFile();
+        compileTestFile();
+        process();
+    }
+
+    /**
+     * Generate java source from test-case.
+     * TBD: change to use javaFileObject, possibly make
+     * this class extend JavaFileObject.
+     */
+    protected void writeTestFile() throws IOException {
+        javaFile = new File("Test.java");
+        FileWriter fw = new FileWriter(javaFile);
+        BufferedWriter bw = new BufferedWriter(fw);
+        PrintWriter pw = new PrintWriter(bw);
+        for (String line : src) {
+            pw.println(line);
+            if (debug) out.println(line);
+        }
+        pw.close();
+    }
+
+    /**
+     * Compile the Java source code.
+     */
+    protected void compileTestFile() {
+        String path = javaFile.getPath();
+        String params[] =  { "-source", "1.8", "-g", path };
+        int rc = com.sun.tools.javac.Main.compile(params);
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        classFile = new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+
+    /**
+     * Process class file to generate output for verification.
+     * The default implementation simply runs javap. This might be
+     * overwritten to generate output in a different manner.
+     */
+    protected void process() {
+        String testClasses = "."; //System.getProperty("test.classes", ".");
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String[] args = { "-v", "-classpath", testClasses, "Test" };
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        if (rc != 0)
+            throw new Error("javap failed. rc=" + rc);
+        pw.close();
+        output = sw.toString();
+        if (debug) {
+            out.println(output);
+            didPrint = true;
+        }
+
+    }
+
+
+    private String testCase;
+    private TestSource src;
+    private File javaFile = null;
+    private File classFile = null;
+    private String output = null;
+    private boolean didExecute = false;
+    private boolean didPrint = false;
+
+
+    protected void error(String msg) {
+        err.println("Error: " + msg);
+        errors++;
+    }
+
+    private int cases;
+    private int fcases;
+    private int errors;
+    private int ignored;
+
+    /**
+     * The TestSource class provides a simple container for
+     * test cases. It contains an array of source code lines,
+     * where zero or more lines may be markers for nested lines.
+     * This allows representing templates, with specialization.
+     * <P>
+     * This may be generalized to support more advance combo
+     * tests, but presently it's only used with a static template,
+     * and one level of specialization.
+     */
+    public class TestSource implements Iterable<String> {
+
+        private String[] lines;
+        private Hashtable<String, TestSource> innerSrc;
+
+        public TestSource(String... lines) {
+            this.lines = lines;
+            innerSrc = new Hashtable<String, TestSource>();
+        }
+
+        public void setInner(String key, TestSource inner) {
+            innerSrc.put(key, inner);
+        }
+
+        public void setInner(String key, String... lines) {
+            innerSrc.put(key, new TestSource(lines));
+        }
+
+        public Iterator<String> iterator() {
+            return new LineIterator();
+        }
+
+        private class LineIterator implements Iterator<String> {
+
+            int nextLine = 0;
+            Iterator<String> innerIt = null;
+
+            public  boolean hasNext() {
+                return nextLine < lines.length;
+            }
+
+            public String next() {
+                if (!hasNext()) throw new NoSuchElementException();
+                String str = lines[nextLine];
+                TestSource inner = innerSrc.get(str);
+                if (inner == null) {
+                    nextLine++;
+                    return str;
+                }
+                if (innerIt == null) {
+                    innerIt = inner.iterator();
+                }
+                if (innerIt.hasNext()) {
+                    return innerIt.next();
+                }
+                innerIt = null;
+                nextLine++;
+                return next();
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        }
+    }
+}
--- a/test/tools/javap/pathsep.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2003, 2009, 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 4798312
-# @summary In Windows, javap doesnt load classes from rt.jar
-# @author gafter
-#
-# @run shell pathsep.sh
-
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | CYGWIN* )
-    FS="/"
-    ;;
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-"${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} java.lang.String
-result=$?
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/stackmap/StackmapTest.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,98 @@
+/*
+ * 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 6271292
+ * @summary Verify that javap prints StackMapTable attribute contents
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main StackmapTest
+ */
+
+import java.util.Arrays;
+import java.util.List;
+
+//original test: test/tools/javap/stackmap/T6271292.sh
+public class StackmapTest {
+
+    private static final String TestSrc =
+        "public class Test extends SuperClass {\n" +
+        "    public static void main(String[] args) {\n" +
+        "        new SuperClass((args[0].equals(\"0\")) ? 0 : 1)\n" +
+        "            .test();\n" +
+        "    }\n" +
+        "    Test(boolean b) {\n" +
+        "        super(b ? 1 : 2);\n" +
+        "    }\n" +
+        "}\n" +
+        "class SuperClass {\n" +
+        "    double d;\n" +
+        "    SuperClass(double dd) { d = dd; }\n" +
+        "    double test() {\n" +
+        "        if (d == 0)\n" +
+        "            return d;\n" +
+        "        else\n" +
+        "            return d > 0 ? d++ : d--;\n" +
+        "    }\n" +
+        "}\n";
+
+    private static final String goldenOut =
+        "frame_type = 255 /* full_frame */\n" +
+        "frame_type = 255 /* full_frame */\n" +
+        "frame_type = 73 /* same_locals_1_stack_item */\n" +
+        "frame_type = 255 /* full_frame */\n" +
+        "offset_delta = 19\n" +
+        "offset_delta = 0\n" +
+        "offset_delta = 2\n" +
+        "stack = [ uninitialized 0, uninitialized 0 ]\n" +
+        "stack = [ uninitialized 0, uninitialized 0, double ]\n" +
+        "stack = [ this ]\n" +
+        "stack = [ this, double ]\n" +
+        "locals = [ class \"[Ljava/lang/String;\" ]\n" +
+        "locals = [ class \"[Ljava/lang/String;\" ]\n" +
+        "locals = [ this, int ]\n";
+
+    public static void main(String[] args) throws Exception {
+        //        @compile T6271292.java
+        ToolBox.JavaToolArgs javacParams =
+                new ToolBox.JavaToolArgs().setSources(TestSrc);
+        ToolBox.javac(javacParams);
+
+//        "${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" -verbose T6271292 > "${JAVAPFILE}"
+        ToolBox.JavaToolArgs javapParams =
+                new ToolBox.JavaToolArgs()
+                .setAllArgs("-v", "Test.class");
+        String out = ToolBox.javap(javapParams);
+        List<String> grepResult = ToolBox.grep("frame_type", out,
+                ToolBox.lineSeparator);
+        grepResult.addAll(ToolBox.grep("offset_delta", out, ToolBox.lineSeparator));
+        grepResult.addAll(ToolBox.grep("stack = ", out, ToolBox.lineSeparator));
+        grepResult.addAll(ToolBox.grep("locals = ", out, ToolBox.lineSeparator));
+        List<String> goldenList = Arrays.asList(goldenOut.split("\n"));
+
+//        diff -w "${OUTFILE}" "${TESTSRC}${FS}T6271292.out"
+        ToolBox.compareLines(goldenList, grepResult, true);
+    }
+
+}
--- a/test/tools/javap/stackmap/T6271292.java	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2005, 2007, 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.
- */
-
-
-public class T6271292 extends SuperClass {
-
-    public static void main(String[] args) {
-        SuperClass s = new SuperClass((args[0].equals("0")) ? 0 : 1);
-        s.test();
-    }
-    T6271292(boolean b) {
-        super(b ? 1 : 2);
-    }
-}
-
-class SuperClass {
-    double d;
-    SuperClass(double dd) { d = dd; }
-
-    double test() {
-        if (d == 0) {
-            return d;
-        } else if (d > 0) {
-            return d++;
-        } else {
-            return d--;
-        }
-    }
-}
--- a/test/tools/javap/stackmap/T6271292.out	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-   frame_type = 255 /* full_frame */
-   frame_type = 255 /* full_frame */
-   frame_type = 73 /* same_locals_1_stack_item */
-   frame_type = 255 /* full_frame */
-     offset_delta = 19
-     offset_delta = 0
-     offset_delta = 2
-     stack = [ uninitialized 0, uninitialized 0 ]
-     stack = [ uninitialized 0, uninitialized 0, double ]
-     stack = [ this ]
-     stack = [ this, double ]
-     locals = [ class "[Ljava/lang/String;" ]
-     locals = [ class "[Ljava/lang/String;" ]
-     locals = [ this, int ]
--- a/test/tools/javap/stackmap/T6271292.sh	Fri Jun 28 14:26:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2005, 2009, 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 6271292
-# @compile T6271292.java
-# @run shell T6271292.sh
-# @summary Verify that javap prints StackMapTable attribute contents
-# @author Wei Tao
-    
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-printf 'TESTSRC="%s"' "${TESTSRC}" >&2 ; echo >&2
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-printf 'TESTJAVA="%s"' "${TESTJAVA}" >&2 ; echo >&2
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-printf 'TESTCLASSES="%s"' "${TESTCLASSES}" >&2 ; echo >&2
-printf 'CLASSPATH="%s"' "${CLASSPATH}" >&2 ; echo >&2
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  Windows* )
-    FS="\\"
-    ;;
-  * )
-    FS="/"
-    ;;
-esac
-
-JAVAPFILE=T6271292.javap
-OUTFILE=outfile
-
-"${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" -verbose T6271292 > "${JAVAPFILE}"
-result="$?"
-if [ "$result" -ne 0 ] 
-then
-  exit "$result"
-fi
-
-grep "frame_type" "${JAVAPFILE}" > "${OUTFILE}"
-grep "offset_delta" "${JAVAPFILE}" >> "${OUTFILE}"
-grep "stack = " "${JAVAPFILE}" >> "${OUTFILE}"
-grep "locals = " "${JAVAPFILE}" >> "${OUTFILE}"
-diff -w "${OUTFILE}" "${TESTSRC}${FS}T6271292.out"
-result="$?"
-if [ "$result" -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit "$result"
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/typeAnnotations/JSR175Annotations.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import com.sun.tools.classfile.*;
+
+/*
+ * @test JSR175Annotations
+ * @bug 6843077
+ * @summary test that only type annotations are recorded as such in classfile
+ */
+
+public class JSR175Annotations {
+    public static void main(String[] args) throws Exception {
+        new JSR175Annotations().run();
+    }
+
+    public void run() throws Exception {
+        File javaFile = writeTestFile();
+        File classFile = compileTestFile(javaFile);
+
+        ClassFile cf = ClassFile.read(classFile);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    void test(ClassFile cf, Method m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Field m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Method m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Field m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    File writeTestFile() throws IOException {
+        File f = new File("Test.java");
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+        out.println("import java.lang.annotation.*;");
+        out.println("abstract class Test { ");
+        out.println("  @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})");
+        out.println("  @Retention(RetentionPolicy.RUNTIME)");
+        out.println("  @interface A { }");
+        out.println("  @A String m;");
+        out.println("  @A String method(@A String a) {");
+        out.println("    return a;");
+        out.println("  }");
+        out.println("}");
+        out.close();
+        return f;
+    }
+
+    File compileTestFile(File f) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    void countAnnotations() {
+        int expected_visibles = 0, expected_invisibles = 0;
+        int expected_all = expected_visibles + expected_invisibles;
+
+        if (expected_all != all) {
+            errors++;
+            System.err.println("expected " + expected_all
+                    + " annotations but found " + all);
+        }
+
+        if (expected_visibles != visibles) {
+            errors++;
+            System.err.println("expected " + expected_visibles
+                    + " visibles annotations but found " + visibles);
+        }
+
+        if (expected_invisibles != invisibles) {
+            errors++;
+            System.err.println("expected " + expected_invisibles
+                    + " invisibles annotations but found " + invisibles);
+        }
+
+    }
+
+    int errors;
+    int all;
+    int visibles;
+    int invisibles;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/typeAnnotations/NewArray.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,177 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import com.sun.tools.classfile.*;
+
+/*
+ * @test NewArray
+ * @bug 6843077
+ * @summary test that all type annotations are present in the classfile
+ */
+
+public class NewArray {
+    public static void main(String[] args) throws Exception {
+        new NewArray().run();
+    }
+
+    public void run() throws Exception {
+        File javaFile = writeTestFile();
+        File classFile = compileTestFile(javaFile);
+
+        ClassFile cf = ClassFile.read(classFile);
+        test(cf);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    void test(ClassFile cf) {
+        test(cf, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Method m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Field m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, String name, boolean visible) {
+        int index = cf.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = cf.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Method m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Field m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    File writeTestFile() throws IOException {
+      File f = new File("Test.java");
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+        out.println("import java.lang.annotation.*;");
+        out.println("import java.util.*;");
+        out.println("class Test { ");
+        out.println("  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})");
+        out.println("  @interface A { }");
+
+        out.println(" void test() {");
+        out.println("  Object a = new @A String @A [5] @A  [];");
+        out.println("  Object b = new @A String @A [5] @A [3];");
+        out.println("  Object c = new @A String @A [] @A [] {};");
+        out.println(" }");
+        out.println("}");
+
+        out.close();
+        return f;
+    }
+
+    File compileTestFile(File f) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    void countAnnotations() {
+        int expected_visibles = 0, expected_invisibles = 9;
+        int expected_all = expected_visibles + expected_invisibles;
+
+        if (expected_all != all) {
+            errors++;
+            System.err.println("expected " + expected_all
+                    + " annotations but found " + all);
+        }
+
+        if (expected_visibles != visibles) {
+            errors++;
+            System.err.println("expected " + expected_visibles
+                    + " visibles annotations but found " + visibles);
+        }
+
+        if (expected_invisibles != invisibles) {
+            errors++;
+            System.err.println("expected " + expected_invisibles
+                    + " invisibles annotations but found " + invisibles);
+        }
+
+    }
+
+    int errors;
+    int all;
+    int visibles;
+    int invisibles;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/typeAnnotations/Presence.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import java.lang.annotation.ElementType;
+
+import com.sun.tools.classfile.*;
+
+/*
+ * @test Presence
+ * @bug 6843077
+ * @summary test that all type annotations are present in the classfile
+ */
+
+public class Presence {
+    public static void main(String[] args) throws Exception {
+        new Presence().run();
+    }
+
+    public void run() throws Exception {
+        File javaFile = writeTestFile();
+        File classFile = compileTestFile(javaFile);
+
+        ClassFile cf = ClassFile.read(classFile);
+        test(cf);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    void test(ClassFile cf) {
+        test(cf, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Method m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Field m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, String name, boolean visible) {
+        int index = cf.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = cf.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Method m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Field m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    File writeTestFile() throws IOException {
+        File f = new File("Test.java");
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+        out.println("import java.util.*;");
+        out.println("import java.lang.annotation.*;");
+
+        out.println("class Test<@Test.A T extends @Test.A List<@Test.A String>> { ");
+        out.println("  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})");
+        out.println("  @interface A { }");
+
+        out.println("  Map<@A String, Map<@A String, @A String>> f1;");
+
+        out.println("  <@A TM extends @A List<@A String>>");
+        out.println("  Map<@A String, @A List<@A String>>");
+        out.println("  method(@A Test<T> this, List<@A String> @A [] param1, String @A [] @A ... param2)");
+        out.println("  throws @A Exception {");
+        out.println("    @A String lc1 = null;");
+        out.println("    @A List<@A String> lc2 = null;");
+        out.println("    @A String @A [] [] @A[] lc3 = null;");
+        out.println("    List<? extends @A List<@A String>> lc4 = null;");
+        out.println("    Object lc5 = (@A List<@A String>) null;");
+        out.println("    boolean lc6 = lc1 instanceof @A String;");
+        out.println("    boolean lc7 = lc5 instanceof @A String @A [] @A [];");
+        out.println("    new @A ArrayList<@A String>();");
+        out.println("    Object lc8 = new @A String @A [4];");
+        out.println("    try {");
+        out.println("      Object lc10 = int.class;");
+        out.println("    } catch (@A Exception e) { e.toString(); }");
+        out.println("    return null;");
+        out.println("  }");
+        out.println("  void vararg1(String @A ... t) { } ");
+        out.println("}");
+        out.close();
+        return f;
+    }
+
+    File compileTestFile(File f) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    void countAnnotations() {
+        int expected_visibles = 0, expected_invisibles = 38;
+        int expected_all = expected_visibles + expected_invisibles;
+
+        if (expected_all != all) {
+            errors++;
+            System.err.println("expected " + expected_all
+                    + " annotations but found " + all);
+        }
+
+        if (expected_visibles != visibles) {
+            errors++;
+            System.err.println("expected " + expected_visibles
+                    + " visibles annotations but found " + visibles);
+        }
+
+        if (expected_invisibles != invisibles) {
+            errors++;
+            System.err.println("expected " + expected_invisibles
+                    + " invisibles annotations but found " + invisibles);
+        }
+
+    }
+
+    int errors;
+    int all;
+    int visibles;
+    int invisibles;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/typeAnnotations/PresenceInner.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,187 @@
+/*
+ * 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.io.*;
+import com.sun.tools.classfile.*;
+
+/*
+ * @test PresenceInner
+ * @bug 6843077
+ * @summary test that annotations in inner types count only once
+ */
+
+public class PresenceInner {
+    public static void main(String[] args) throws Exception {
+        new PresenceInner().run();
+    }
+
+    public void run() throws Exception {
+        File javaFile = writeTestFile();
+        File classFile = compileTestFile(javaFile);
+
+        ClassFile cf = ClassFile.read(classFile);
+        test(cf);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        // counts are zero when vising outer class
+        countAnnotations(0);
+
+        // visit inner class
+        File innerFile = new File("Test$1Inner.class");
+        ClassFile icf = ClassFile.read(innerFile);
+        test(icf);
+        for (Field f : icf.fields) {
+            test(cf, f);
+        }
+        for (Method m: icf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations(1);
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    void test(ClassFile cf) {
+        test(cf, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Method m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Field m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, String name, boolean visible) {
+        int index = cf.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = cf.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Method m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Field m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    File writeTestFile() throws IOException {
+        File f = new File("Test.java");
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+
+        out.println("import java.lang.annotation.*;");
+        out.println("class Test {");
+        out.println("  void method() {");
+        out.println("    class Inner<T extends @A Object> { }");
+        out.println("  }");
+        out.println("}");
+        out.println("@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})");
+        out.println("@interface A { }");
+        out.close();
+        System.out.println(f.getAbsolutePath());
+        return f;
+    }
+
+    File compileTestFile(File f) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    void countAnnotations(int expected_invisibles) {
+        int expected_visibles = 0;
+        int expected_all = expected_visibles + expected_invisibles;
+
+        if (expected_all != all) {
+            errors++;
+            System.err.println("expected " + expected_all
+                    + " annotations but found " + all);
+        }
+
+        if (expected_visibles != visibles) {
+            errors++;
+            System.err.println("expected " + expected_visibles
+                    + " visibles annotations but found " + visibles);
+        }
+
+        if (expected_invisibles != invisibles) {
+            errors++;
+            System.err.println("expected " + expected_invisibles
+                    + " invisibles annotations but found " + invisibles);
+        }
+
+    }
+
+    int errors;
+    int all;
+    int visibles;
+    int invisibles;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/typeAnnotations/T6855990.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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.io.*;
+
+/*
+ * @test
+ * @bug 6855990
+ * @summary InstructionDetailWriter should support new 308 annotations attribute
+ */
+
+public class T6855990 {
+    public static void main(String[] args) throws Exception {
+        new T6855990().run();
+    }
+
+    public void run() throws Exception {
+        @Simple String[] args = { "-c", "-XDdetails:typeAnnotations", "T6855990" };
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        pw.close();
+        String out = sw.toString();
+        System.out.println(out);
+        if (out.indexOf("@Simple: LOCAL_VARIABLE") == -1)
+            throw new Exception("expected output not found");
+    }
+}
+
+@interface Simple { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/typeAnnotations/TypeCasts.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,191 @@
+/*
+ * 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.io.*;
+import com.sun.tools.classfile.*;
+
+/*
+ * @test
+ * @bug 6843077
+ * @summary test that typecasts annotation are emitted if only the cast
+ *          expression is optimized away
+ */
+
+public class TypeCasts {
+    public static void main(String[] args) throws Exception {
+        new TypeCasts().run();
+    }
+
+    public void run() throws Exception {
+        File javaFile = writeTestFile();
+        File classFile = compileTestFile(javaFile);
+
+        ClassFile cf = ClassFile.read(classFile);
+        test(cf);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    void test(ClassFile cf) {
+        test(cf, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Method m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Field m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, String name, boolean visible) {
+        int index = cf.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = cf.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Method m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Field m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+
+    File writeTestFile() throws IOException {
+        File f = new File("Test.java");
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+        out.println("import java.lang.annotation.*;");
+        out.println("class Test { ");
+        out.println("  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})");
+        out.println("  @interface A { }");
+
+        out.println("  void emit() {");
+        out.println("    Object o = null;");
+        out.println("    String s = null;");
+
+        out.println("    String a0 = (@A String)o;");
+        out.println("    Object a1 = (@A Object)o;");
+
+        out.println("    String b0 = (@A String)s;");
+        out.println("    Object b1 = (@A Object)s;");
+        out.println("  }");
+
+        out.println("  void alldeadcode() {");
+        out.println("    Object o = null;");
+
+        out.println("    if (false) {");
+        out.println("      String a0 = (@A String)o;");
+        out.println("    }");
+        out.println("  }");
+
+        out.println("}");
+        out.close();
+        return f;
+    }
+
+    File compileTestFile(File f) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    void countAnnotations() {
+        int expected_visibles = 0, expected_invisibles = 4;
+        int expected_all = expected_visibles + expected_invisibles;
+
+        if (expected_all != all) {
+            errors++;
+            System.err.println("expected " + expected_all
+                    + " annotations but found " + all);
+        }
+
+        if (expected_visibles != visibles) {
+            errors++;
+            System.err.println("expected " + expected_visibles
+                    + " visibles annotations but found " + visibles);
+        }
+
+        if (expected_invisibles != invisibles) {
+            errors++;
+            System.err.println("expected " + expected_invisibles
+                    + " invisibles annotations but found " + invisibles);
+        }
+
+    }
+
+    int errors;
+    int all;
+    int visibles;
+    int invisibles;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/typeAnnotations/Visibility.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import com.sun.tools.classfile.*;
+
+/*
+ * @test Visibility
+ * @bug 6843077
+ * @summary test that type annotations are recorded in the classfile
+ */
+
+public class Visibility {
+    public static void main(String[] args) throws Exception {
+        new Visibility().run();
+    }
+
+    public void run() throws Exception {
+        File javaFile = writeTestFile();
+        File classFile = compileTestFile(javaFile);
+
+        ClassFile cf = ClassFile.read(classFile);
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    void test(ClassFile cf, Method m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Method m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    File writeTestFile() throws IOException {
+        File f = new File("Test.java");
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+        out.println("import java.lang.annotation.ElementType;");
+        out.println("import java.lang.annotation.Retention;");
+        out.println("import java.lang.annotation.RetentionPolicy;");
+        out.println("import java.lang.annotation.Target;");
+        out.println("abstract class Test { ");
+        // visible annotations: RUNTIME
+        out.println("  @Retention(RetentionPolicy.RUNTIME)");
+        out.println("  @Target(ElementType.TYPE_USE)");
+        out.println("  @interface A { }");
+        out.println("  void visible(@A Test this) { }");
+
+        // invisible annotations: CLASS
+        out.println("  @Retention(RetentionPolicy.CLASS)");
+        out.println("  @Target(ElementType.TYPE_USE)");
+        out.println("  @interface B { }");
+        out.println("  void invisible(@B Test this) { }");
+
+        // source annotations
+        out.println("  @Retention(RetentionPolicy.SOURCE)");
+        out.println("  @Target(ElementType.TYPE_USE)");
+        out.println("  @interface C { }");
+        out.println("  void source(@C Test this) { }");
+
+        // default visibility: CLASS
+        out.println("  @Target(ElementType.TYPE_USE)");
+        out.println("  @interface D { }");
+        out.println("  void def(@D Test this) { }");
+        out.println("}");
+        out.close();
+        return f;
+    }
+
+    File compileTestFile(File f) {
+      int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    void countAnnotations() {
+        int expected_all = 3, expected_visibles = 1, expected_invisibles = 2;
+
+        if (expected_all != all) {
+            errors++;
+            System.err.println("expected " + expected_all
+                    + " annotations but found " + all);
+        }
+
+        if (expected_visibles != visibles) {
+            errors++;
+            System.err.println("expected " + expected_visibles
+                    + " visibles annotations but found " + visibles);
+        }
+
+        if (expected_invisibles != invisibles) {
+            errors++;
+            System.err.println("expected " + expected_invisibles
+                    + " invisibles annotations but found " + invisibles);
+        }
+
+    }
+
+    int errors;
+    int all;
+    int visibles;
+    int invisibles;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/typeAnnotations/Wildcards.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,177 @@
+/*
+ * 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.io.*;
+import com.sun.tools.classfile.*;
+
+/*
+ * @test Wildcards
+ * @bug 6843077
+ * @summary test that annotations target wildcards get emitted to classfile
+ */
+public class Wildcards {
+    public static void main(String[] args) throws Exception {
+        new Wildcards().run();
+    }
+
+    public void run() throws Exception {
+        File javaFile = writeTestFile();
+        File classFile = compileTestFile(javaFile);
+
+        ClassFile cf = ClassFile.read(classFile);
+        test(cf);
+        for (Field f : cf.fields) {
+            test(cf, f);
+        }
+        for (Method m: cf.methods) {
+            test(cf, m);
+        }
+
+        countAnnotations();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+        System.out.println("PASSED");
+    }
+
+    void test(ClassFile cf) {
+        test(cf, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Method m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    void test(ClassFile cf, Field m) {
+        test(cf, m, Attribute.RuntimeVisibleTypeAnnotations, true);
+        test(cf, m, Attribute.RuntimeInvisibleTypeAnnotations, false);
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, String name, boolean visible) {
+        int index = cf.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = cf.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Method m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    // test the result of Attributes.getIndex according to expectations
+    // encoded in the method's name
+    void test(ClassFile cf, Field m, String name, boolean visible) {
+        int index = m.attributes.getIndex(cf.constant_pool, name);
+        if (index != -1) {
+            Attribute attr = m.attributes.get(index);
+            assert attr instanceof RuntimeTypeAnnotations_attribute;
+            RuntimeTypeAnnotations_attribute tAttr = (RuntimeTypeAnnotations_attribute)attr;
+            all += tAttr.annotations.length;
+            if (visible)
+                visibles += tAttr.annotations.length;
+            else
+                invisibles += tAttr.annotations.length;
+        }
+    }
+
+    File writeTestFile() throws IOException {
+      File f = new File("Test.java");
+        PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f)));
+        out.println("import java.lang.annotation.*;");
+        out.println("import java.util.*;");
+        out.println("class Test { ");
+        out.println("  @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})");
+        out.println("  @interface A { }");
+
+        out.println("  List<? extends @A Number> f;");
+
+        out.println("  List<? extends @A Object> test(List<? extends @A Number> p) {");
+        out.println("    List<? extends @A Object> l;");    // not counted... gets optimized away
+        out.println("    return null;");
+        out.println(" }");
+        out.println("}");
+
+        out.close();
+        return f;
+    }
+
+    File compileTestFile(File f) {
+        int rc = com.sun.tools.javac.Main.compile(new String[] { "-source", "1.8", "-g", f.getPath() });
+        if (rc != 0)
+            throw new Error("compilation failed. rc=" + rc);
+        String path = f.getPath();
+        return new File(path.substring(0, path.length() - 5) + ".class");
+    }
+
+    void countAnnotations() {
+        int expected_visibles = 0, expected_invisibles = 3;
+        int expected_all = expected_visibles + expected_invisibles;
+
+        if (expected_all != all) {
+            errors++;
+            System.err.println("expected " + expected_all
+                    + " annotations but found " + all);
+        }
+
+        if (expected_visibles != visibles) {
+            errors++;
+            System.err.println("expected " + expected_visibles
+                    + " visibles annotations but found " + visibles);
+        }
+
+        if (expected_invisibles != invisibles) {
+            errors++;
+            System.err.println("expected " + expected_invisibles
+                    + " invisibles annotations but found " + invisibles);
+        }
+
+    }
+
+    int errors;
+    int all;
+    int visibles;
+    int invisibles;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/jdeps/Basic.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,213 @@
+/*
+ * 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 8003562 8005428
+ * @summary Basic tests for jdeps tool
+ * @build Test p.Foo
+ * @run main Basic
+ */
+
+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 Basic {
+    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 Basic().run();
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    int run() throws IOException {
+        File testDir = new File(System.getProperty("test.classes", "."));
+        // test a .class file
+        test(new File(testDir, "Test.class"),
+             new String[] {"java.lang", "p"},
+             new String[] {"compact1", "not found"});
+        // test a directory
+        test(new File(testDir, "p"),
+             new String[] {"java.lang", "java.util", "java.lang.management"},
+             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"});
+        // test -p option
+        test(new File(testDir, "Test.class"),
+             new String[] {"p.Foo"},
+             new String[] {"not found"},
+             new String[] {"--verbose-level=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\\..*"});
+        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
+        test(null,
+             new String[] {"com.sun.tools.jdeps", "java.lang", "java.util",
+                           "java.util.regex", "java.io", "java.nio.file",
+                           "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"});
+        */
+        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());
+        }
+        List<String> argsWithDashP = new ArrayList<>();
+        argsWithDashP.add("-P");
+        argsWithDashP.addAll(args);
+        // test without -P
+        checkResult("dependencies", expect, jdeps(args.toArray(new String[0])).keySet());
+        // test with -P
+        checkResult("profiles", expect, profiles, jdeps(argsWithDashP.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) {
+        if (expect.length != profiles.length)
+            error("Invalid expected names and profiles");
+
+        // check the dependencies
+        checkResult(label, expect, result.keySet());
+        // check profile information
+        checkResult(label, profiles, result.values());
+        for (int i=0; i < expect.length; i++) {
+            String profile = result.get(expect[i]);
+            if (!profile.equals(profiles[i]))
+                error("Unexpected profile: '" + profile + "', expected: '" + profiles[i] + "'");
+        }
+    }
+
+    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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/jdeps/Test.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+public class Test {
+    public void test() {
+        p.Foo f = new p.Foo();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/jdeps/p/Foo.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package p;
+
+import java.util.List;
+import java.util.Collections;
+public class Foo {
+    public static List foo() {
+        return Collections.emptyList();
+    }
+
+    public Foo() {
+        // compact3
+        java.lang.management.ManagementFactory.getRuntimeMXBean();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/jdeps/profiles.properties	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,263 @@
+# This properties file is used for testing a JDK development build.
+# No need to keep this properties file up to date as long as it covers
+# the APIs used by the jdeps regression test.
+profile.1.name = compact1
+profile.1.packages = \
+    java.io \
+    java.lang \
+    java.lang.annotation \
+    java.lang.invoke \
+    java.lang.ref \
+    java.lang.reflect \
+    java.math \
+    java.net \
+    java.nio \
+    java.nio.channels \
+    java.nio.channels.spi \
+    java.nio.charset \
+    java.nio.charset.spi \
+    java.nio.file \
+    java.nio.file.attribute \
+    java.nio.file.spi \
+    java.security \
+    java.security.cert \
+    java.security.interfaces \
+    java.security.spec \
+    java.text \
+    java.text.spi \
+    java.util \
+    java.util.concurrent \
+    java.util.concurrent.atomic \
+    java.util.concurrent.locks \
+    java.util.jar \
+    java.util.logging \
+    java.util.regex \
+    java.util.spi \
+    java.util.zip \
+    javax.crypto \
+    javax.crypto.interfaces \
+    javax.crypto.spec \
+    javax.security.auth \
+    javax.security.auth.callback \
+    javax.security.auth.login \
+    javax.security.auth.spi \
+    javax.security.auth.x500 \
+    javax.net \
+    javax.net.ssl \
+    javax.security.cert \
+    \
+    com.sun.net.ssl \
+    com.sun.nio.file \
+    com.sun.nio.sctp \
+    com.sun.security.auth \
+    com.sun.security.auth.login
+
+profile.2.name = compact2
+profile.2.packages = \
+    java.sql \
+    javax.sql \
+    javax.xml \
+    javax.xml.datatype \
+    javax.xml.namespace \
+    javax.xml.parsers \
+    javax.xml.stream \
+    javax.xml.stream.events \
+    javax.xml.stream.util \
+    javax.xml.transform \
+    javax.xml.transform.dom \
+    javax.xml.transform.sax \
+    javax.xml.transform.stax \
+    javax.xml.transform.stream \
+    javax.xml.validation \
+    javax.xml.xpath \
+    org.w3c.dom \
+    org.w3c.dom.bootstrap \
+    org.w3c.dom.events \
+    org.w3c.dom.ls \
+    org.xml.sax \
+    org.xml.sax.ext \
+    org.xml.sax.helpers \
+    java.rmi \
+    java.rmi.activation \
+    java.rmi.dgc \
+    java.rmi.registry \
+    java.rmi.server \
+    javax.rmi.ssl \
+    javax.transaction \
+    javax.transaction.xa \
+    \
+    com.sun.net.httpserver \
+    com.sun.net.httpserver.spi
+
+profile.3.name = compact3
+profile.3.packages = \
+    java.lang.instrument \
+    java.lang.management \
+    java.security.acl \
+    java.util.prefs \
+    javax.management \
+    javax.management.loading \
+    javax.management.modelmbean \
+    javax.management.monitor \
+    javax.management.openmbean \
+    javax.management.relation \
+    javax.management.remote \
+    javax.management.remote.rmi \
+    javax.management.timer \
+    javax.naming \
+    javax.naming.directory \
+    javax.naming.event \
+    javax.naming.ldap \
+    javax.naming.spi \
+    javax.sql.rowset \
+    javax.sql.rowset.serial \
+    javax.sql.rowset.spi \
+    javax.security.auth.kerberos \
+    javax.security.sasl \
+    javax.script \
+    javax.smartcardio \
+    javax.xml.crypto \
+    javax.xml.crypto.dom \
+    javax.xml.crypto.dsig \
+    javax.xml.crypto.dsig.dom \
+    javax.xml.crypto.dsig.keyinfo \
+    javax.xml.crypto.dsig.spec \
+    javax.annotation.processing \
+    javax.lang.model \
+    javax.lang.model.element \
+    javax.lang.model.type \
+    javax.lang.model.util \
+    javax.tools \
+    javax.tools.annotation \
+    org.ietf.jgss \
+    \
+    com.sun.management \
+    com.sun.security.auth.callback \
+    com.sun.security.auth.module \
+    com.sun.security.jgss
+
+profile.4.name = Full JRE
+profile.4.packages = \
+    java.applet \
+    java.awt \
+    java.awt.color \
+    java.awt.datatransfer \
+    java.awt.dnd \
+    java.awt.dnd.peer \
+    java.awt.event \
+    java.awt.font \
+    java.awt.geom \
+    java.awt.im \
+    java.awt.im.spi \
+    java.awt.image \
+    java.awt.image.renderable \
+    java.awt.peer \
+    java.awt.print \
+    java.beans \
+    java.beans.beancontext \
+    javax.accessibility \
+    javax.imageio \
+    javax.imageio.event \
+    javax.imageio.metadata \
+    javax.imageio.plugins.bmp \
+    javax.imageio.plugins.jpeg \
+    javax.imageio.spi \
+    javax.imageio.stream \
+    javax.print \
+    javax.print.attribute \
+    javax.print.attribute.standard \
+    javax.print.event \
+    javax.sound.midi \
+    javax.sound.midi.spi \
+    javax.sound.sampled \
+    javax.sound.sampled.spi \
+    javax.swing \
+    javax.swing.border \
+    javax.swing.colorchooser \
+    javax.swing.event \
+    javax.swing.filechooser \
+    javax.swing.plaf \
+    javax.swing.plaf.basic \
+    javax.swing.plaf.metal \
+    javax.swing.plaf.multi \
+    javax.swing.plaf.nimbus \
+    javax.swing.plaf.synth \
+    javax.swing.table \
+    javax.swing.text \
+    javax.swing.text.html \
+    javax.swing.text.html.parser \
+    javax.swing.text.rtf \
+    javax.swing.tree \
+    javax.swing.undo \
+    javax.activation \
+    javax.jws \
+    javax.jws.soap \
+    javax.rmi \
+    javax.rmi.CORBA \
+    javax.xml.bind \
+    javax.xml.bind.annotation \
+    javax.xml.bind.annotation.adapters \
+    javax.xml.bind.attachment \
+    javax.xml.bind.helpers \
+    javax.xml.bind.util \
+    javax.xml.soap \
+    javax.xml.ws \
+    javax.xml.ws.handler \
+    javax.xml.ws.handler.soap \
+    javax.xml.ws.http \
+    javax.xml.ws.soap \
+    javax.xml.ws.spi \
+    javax.xml.ws.spi.http \
+    javax.xml.ws.wsaddressing \
+    javax.annotation \
+    org.omg.CORBA \
+    org.omg.CORBA.DynAnyPackage \
+    org.omg.CORBA.ORBPackage \
+    org.omg.CORBA.TypeCodePackage \
+    org.omg.CORBA.portable \
+    org.omg.CORBA_2_3 \
+    org.omg.CORBA_2_3.portable \
+    org.omg.CosNaming \
+    org.omg.CosNaming.NamingContextExtPackage \
+    org.omg.CosNaming.NamingContextPackage \
+    org.omg.Dynamic \
+    org.omg.DynamicAny \
+    org.omg.DynamicAny.DynAnyFactoryPackage \
+    org.omg.DynamicAny.DynAnyPackage \
+    org.omg.IOP \
+    org.omg.IOP.CodecFactoryPackage \
+    org.omg.IOP.CodecPackage \
+    org.omg.Messaging \
+    org.omg.PortableInterceptor \
+    org.omg.PortableInterceptor.ORBInitInfoPackage \
+    org.omg.PortableServer \
+    org.omg.PortableServer.CurrentPackage \
+    org.omg.PortableServer.POAManagerPackage \
+    org.omg.PortableServer.POAPackage \
+    org.omg.PortableServer.ServantLocatorPackage \
+    org.omg.PortableServer.portable \
+    org.omg.SendingContext \
+    org.omg.stub.java.rmi \
+    org.omg.stub.javax.management.remote.rmi
+
+# Remaining JDK supported API
+profile.5.name = JDK tools
+profile.5.packages = \
+    com.sun.jdi \
+    com.sun.jdi.connect \
+    com.sun.jdi.connect.spi \
+    com.sun.jdi.event \
+    com.sun.jdi.request \
+    com.sun.javadoc \
+    com.sun.tools.doclets \
+    com.sun.tools.doctree \
+    com.sun.source.tree \
+    com.sun.source.util \
+    com.sun.tools.attach \
+    com.sun.tools.attach.spi \
+    com.sun.tools.jconsole \
+    com.sun.tools.javac \
+    com.sun.tools.javah \
+    com.sun.tools.javap \
+    com.sun.tools.javadoc \
+    com.sun.servicetag
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/sjavac/SJavac.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,573 @@
+/*
+ * 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.util.*;
+import java.io.*;
+import java.net.*;
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.nio.charset.*;
+
+import com.sun.tools.sjavac.Main;
+
+public
+class SJavac {
+
+    public static void main(String... args) throws Exception {
+        SJavac s = new SJavac();
+        s.test();
+    }
+
+    FileSystem defaultfs = FileSystems.getDefault();
+
+    // Where to put generated sources that will
+    // test aspects of sjavac, ie JTWork/scratch/gensrc
+    Path gensrc;
+    // More gensrc dirs are used to test merging of serveral source roots.
+    Path gensrc2;
+    Path gensrc3;
+
+    // Where to put compiled classes.
+    Path bin;
+    // Where to put c-header files.
+    Path headers;
+
+    // The sjavac compiler.
+    Main main = new Main();
+
+    // Remember the previous bin and headers state here.
+    Map<String,Long> previous_bin_state;
+    Map<String,Long> previous_headers_state;
+
+    public void test() throws Exception {
+        gensrc = defaultfs.getPath("gensrc");
+        gensrc2 = defaultfs.getPath("gensrc2");
+        gensrc3 = defaultfs.getPath("gensrc3");
+        bin = defaultfs.getPath("bin");
+        headers = defaultfs.getPath("headers");
+
+        Files.createDirectory(gensrc);
+        Files.createDirectory(gensrc2);
+        Files.createDirectory(gensrc3);
+        Files.createDirectory(bin);
+        Files.createDirectory(headers);
+
+        initialCompile();
+        incrementalCompileNoChanges();
+        incrementalCompileDroppingClasses();
+        incrementalCompileWithChange();
+        incrementalCompileDropAllNatives();
+        incrementalCompileAddNative();
+        incrementalCompileChangeNative();
+        compileWithOverrideSource();
+        compileWithInvisibleSources();
+        compileCircularSources();
+
+        delete(gensrc);
+        delete(gensrc2);
+        delete(gensrc3);
+        delete(bin);
+    }
+
+    void initialCompile() throws Exception {
+        System.out.println("\nInitial compile of gensrc.");
+        System.out.println("----------------------------");
+        populate(gensrc,
+            "alfa/AINT.java",
+            "package alfa; public interface AINT { void aint(); }",
+
+            "alfa/A.java",
+            "package alfa; public class A implements AINT { "+
+                 "public final static int DEFINITION = 17; public void aint() { } }",
+
+            "alfa/AA.java",
+            "package alfa;"+
+            "// A package private class, not contributing to the public api.\n"+
+            "class AA {"+
+            "   // A properly nested static inner class.\n"+
+            "    static class AAA { }\n"+
+            "    // A properly nested inner class.\n"+
+            "    class AAAA { }\n"+
+            "    Runnable foo() {\n"+
+            "        // A proper anonymous class.\n"+
+            "        return new Runnable() { public void run() { } };\n"+
+            "    }\n"+
+            "    AAA aaa;\n"+
+            "    AAAA aaaa;\n"+
+            "    AAAAA aaaaa;\n"+
+            "}\n"+
+            "class AAAAA {\n"+
+            "    // A bad auxiliary class, but no one is referencing it\n"+
+            "    // from outside of this source file, therefore it is ok.\n"+
+            "}\n",
+
+            "beta/BINT.java",
+            "package beta;public interface BINT { void foo(); }",
+
+            "beta/B.java",
+            "package beta; import alfa.A; public class B {"+
+            "private int b() { return A.DEFINITION; } native void foo(); }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                "--server:portfile=testserver,background=false", "--log=debug");
+        previous_bin_state = collectState(bin);
+        previous_headers_state = collectState(headers);
+    }
+
+    void incrementalCompileNoChanges() throws Exception {
+        System.out.println("\nTesting that no change in sources implies no change in binaries.");
+        System.out.println("------------------------------------------------------------------");
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                "--server:portfile=testserver,background=false", "--log=debug");
+        Map<String,Long> new_bin_state = collectState(bin);
+        verifyEqual(new_bin_state, previous_bin_state);
+        Map<String,Long> new_headers_state = collectState(headers);
+        verifyEqual(previous_headers_state, new_headers_state);
+    }
+
+    void incrementalCompileDroppingClasses() throws Exception {
+        System.out.println("\nTesting that deleting AA.java deletes all");
+        System.out.println("generated inner class as well as AA.class");
+        System.out.println("-----------------------------------------");
+        removeFrom(gensrc, "alfa/AA.java");
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                "--server:portfile=testserver,background=false", "--log=debug");
+        Map<String,Long> new_bin_state = collectState(bin);
+        verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state,
+                                       "bin/alfa/AA$1.class",
+                                       "bin/alfa/AA$AAAA.class",
+                                       "bin/alfa/AA$AAA.class",
+                                       "bin/alfa/AAAAA.class",
+                                       "bin/alfa/AA.class");
+
+        previous_bin_state = new_bin_state;
+        Map<String,Long> new_headers_state = collectState(headers);
+        verifyEqual(previous_headers_state, new_headers_state);
+    }
+
+    void incrementalCompileWithChange() throws Exception {
+        System.out.println("\nNow update the A.java file with a new timestamps and");
+        System.out.println("new final static definition. This should trigger a recompile,");
+        System.out.println("not only of alfa, but also beta.");
+        System.out.println("But check that the generated native header was not updated!");
+        System.out.println("Since we did not modify the native api of B.");
+        System.out.println("-------------------------------------------------------------");
+
+        populate(gensrc,"alfa/A.java",
+                       "package alfa; public class A implements AINT { "+
+                 "public final static int DEFINITION = 18; public void aint() { } private void foo() { } }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                "--server:portfile=testserver,background=false", "--log=debug");
+        Map<String,Long> new_bin_state = collectState(bin);
+
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/alfa/A.class",
+                         "bin/alfa/AINT.class",
+                         "bin/beta/B.class",
+                         "bin/beta/BINT.class",
+                         "bin/javac_state");
+        previous_bin_state = new_bin_state;
+
+        Map<String,Long> new_headers_state = collectState(headers);
+        verifyEqual(new_headers_state, previous_headers_state);
+    }
+
+    void incrementalCompileDropAllNatives() throws Exception {
+        System.out.println("\nNow update the B.java file with one less native method,");
+        System.out.println("ie it has no longer any methods!");
+        System.out.println("Verify that beta_B.h is removed!");
+        System.out.println("---------------------------------------------------------");
+
+        populate(gensrc,"beta/B.java",
+                       "package beta; import alfa.A; public class B {"+
+                       "private int b() { return A.DEFINITION; } }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                "--server:portfile=testserver,background=false", "--log=debug");
+        Map<String,Long> new_bin_state = collectState(bin);
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/beta/B.class",
+                         "bin/beta/BINT.class",
+                         "bin/javac_state");
+        previous_bin_state = new_bin_state;
+
+        Map<String,Long> new_headers_state = collectState(headers);
+        verifyThatFilesHaveBeenRemoved(previous_headers_state, new_headers_state,
+                                       "headers/beta_B.h");
+        previous_headers_state = new_headers_state;
+    }
+
+    void incrementalCompileAddNative() throws Exception {
+        System.out.println("\nNow update the B.java file with a final static annotated with @Native.");
+        System.out.println("Verify that beta_B.h is added again!");
+        System.out.println("------------------------------------------------------------------------");
+
+        populate(gensrc,"beta/B.java",
+                       "package beta; import alfa.A; public class B {"+
+                       "private int b() { return A.DEFINITION; } "+
+                 "@java.lang.annotation.Native final static int alfa = 42; }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                "--server:portfile=testserver,background=false", "--log=debug");
+        Map<String,Long> new_bin_state = collectState(bin);
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/beta/B.class",
+                         "bin/beta/BINT.class",
+                         "bin/javac_state");
+        previous_bin_state = new_bin_state;
+
+        Map<String,Long> new_headers_state = collectState(headers);
+        verifyThatFilesHaveBeenAdded(previous_headers_state, new_headers_state,
+                                     "headers/beta_B.h");
+        previous_headers_state = new_headers_state;
+    }
+
+    void incrementalCompileChangeNative() throws Exception {
+        System.out.println("\nNow update the B.java file with a new value for the final static"+
+                           " annotated with @Native.");
+        System.out.println("Verify that beta_B.h is rewritten again!");
+        System.out.println("-------------------------------------------------------------------");
+
+        populate(gensrc,"beta/B.java",
+                       "package beta; import alfa.A; public class B {"+
+                       "private int b() { return A.DEFINITION; } "+
+                 "@java.lang.annotation.Native final static int alfa = 43; }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1",
+                "--server:portfile=testserver,background=false", "--log=debug");
+        Map<String,Long> new_bin_state = collectState(bin);
+        verifyNewerFiles(previous_bin_state, new_bin_state,
+                         "bin/beta/B.class",
+                         "bin/beta/BINT.class",
+                         "bin/javac_state");
+        previous_bin_state = new_bin_state;
+
+        Map<String,Long> new_headers_state = collectState(headers);
+        verifyNewerFiles(previous_headers_state, new_headers_state,
+                         "headers/beta_B.h");
+        previous_headers_state = new_headers_state;
+    }
+
+    void compileWithOverrideSource() throws Exception {
+        System.out.println("\nNow verify that we can override sources to be compiled.");
+        System.out.println("Compile gensrc and gensrc2. However do not compile broken beta.B in gensrc,");
+        System.out.println("only compile ok beta.B in gensrc2.");
+        System.out.println("---------------------------------------------------------------------------");
+
+        delete(gensrc);
+        delete(gensrc2);
+        delete(bin);
+        previous_bin_state = collectState(bin);
+
+        populate(gensrc,"alfa/A.java",
+                 "package alfa; import beta.B; import gamma.C; public class A { B b; C c; }",
+                 "beta/B.java",
+                 "package beta; public class B { broken",
+                 "gamma/C.java",
+                 "package gamma; public class C { }");
+
+        populate(gensrc2,
+                 "beta/B.java",
+                 "package beta; public class B { }");
+
+        compile("-x", "beta", "gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1",
+                "--server:portfile=testserver,background=false");
+        Map<String,Long> new_bin_state = collectState(bin);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                                     "bin/alfa/A.class",
+                                     "bin/beta/B.class",
+                                     "bin/gamma/C.class",
+                                     "bin/javac_state");
+
+        System.out.println("----- Compile with exluded beta went well!");
+        delete(bin);
+        compileExpectFailure("gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1",
+                             "--server:portfile=testserver,background=false");
+
+        System.out.println("----- Compile without exluded beta failed, as expected! Good!");
+        delete(bin);
+    }
+
+    void compileWithInvisibleSources() throws Exception {
+        System.out.println("\nNow verify that we can make sources invisible to linking (sourcepath).");
+        System.out.println("Compile gensrc and link against gensrc2 and gensrc3, however");
+        System.out.println("gensrc2 contains broken code in beta.B, thus we must exclude that package");
+        System.out.println("fortunately gensrc3 contains a proper beta.B.");
+        System.out.println("------------------------------------------------------------------------");
+
+        // Start with a fresh gensrcs and bin.
+        delete(gensrc);
+        delete(gensrc2);
+        delete(gensrc3);
+        delete(bin);
+        previous_bin_state = collectState(bin);
+
+        populate(gensrc,"alfa/A.java",
+                 "package alfa; import beta.B; import gamma.C; public class A { B b; C c; }");
+        populate(gensrc2,"beta/B.java",
+                 "package beta; public class B { broken",
+                 "gamma/C.java",
+                 "package gamma; public class C { }");
+        populate(gensrc3, "beta/B.java",
+                 "package beta; public class B { }");
+
+        compile("gensrc", "-x", "beta", "-sourcepath", "gensrc2",
+                "-sourcepath", "gensrc3", "-d", "bin", "-h", "headers", "-j", "1",
+                "--server:portfile=testserver,background=false");
+
+        System.out.println("The first compile went well!");
+        Map<String,Long> new_bin_state = collectState(bin);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                                     "bin/alfa/A.class",
+                                     "bin/javac_state");
+
+        System.out.println("----- Compile with exluded beta went well!");
+        delete(bin);
+        compileExpectFailure("gensrc", "-sourcepath", "gensrc2", "-sourcepath", "gensrc3",
+                             "-d", "bin", "-h", "headers", "-j", "1",
+                             "--server:portfile=testserver,background=false");
+
+        System.out.println("----- Compile without exluded beta failed, as expected! Good!");
+        delete(bin);
+    }
+
+    void compileCircularSources() throws Exception {
+        System.out.println("\nNow verify that circular sources split on multiple cores can be compiled.");
+        System.out.println("---------------------------------------------------------------------------");
+
+        // Start with a fresh gensrcs and bin.
+        delete(gensrc);
+        delete(gensrc2);
+        delete(gensrc3);
+        delete(bin);
+        previous_bin_state = collectState(bin);
+
+        populate(gensrc,"alfa/A.java",
+                 "package alfa; public class A { beta.B b; }",
+                 "beta/B.java",
+                 "package beta; public class B { gamma.C c; }",
+                 "gamma/C.java",
+                 "package gamma; public class C { alfa.A a; }");
+
+        compile("gensrc", "-d", "bin", "-h", "headers", "-j", "3",
+                "--server:portfile=testserver,background=false","--log=debug");
+        Map<String,Long> new_bin_state = collectState(bin);
+        verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state,
+                                     "bin/alfa/A.class",
+                                     "bin/beta/B.class",
+                                     "bin/gamma/C.class",
+                                     "bin/javac_state");
+        delete(bin);
+    }
+
+    void removeFrom(Path dir, String... args) throws IOException {
+        for (String filename : args) {
+            Path p = dir.resolve(filename);
+            Files.delete(p);
+        }
+    }
+
+    void populate(Path src, String... args) throws IOException {
+        if (!Files.exists(src)) {
+            Files.createDirectory(src);
+        }
+        String[] a = args;
+        for (int i = 0; i<a.length; i+=2) {
+            String filename = a[i];
+            String content = a[i+1];
+            Path p = src.resolve(filename);
+            Files.createDirectories(p.getParent());
+            PrintWriter out = new PrintWriter(Files.newBufferedWriter(p,
+                                                                      Charset.defaultCharset()));
+            out.println(content);
+            out.close();
+        }
+    }
+
+    void delete(Path root) throws IOException {
+        if (!Files.exists(root)) return;
+        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
+                 @Override
+                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException
+                 {
+                     Files.delete(file);
+                     return FileVisitResult.CONTINUE;
+                 }
+
+                 @Override
+                 public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException
+                 {
+                     if (e == null) {
+                         if (!dir.equals(root)) Files.delete(dir);
+                         return FileVisitResult.CONTINUE;
+                     } else {
+                         // directory iteration failed
+                         throw e;
+                     }
+                 }
+            });
+    }
+
+    void compile(String... args) throws Exception {
+        int rc = main.go(args, System.out, System.err);
+        if (rc != 0) throw new Exception("Error during compile!");
+
+        // Wait a second, to get around the (temporary) problem with
+        // second resolution in the Java file api. But do not do this
+        // on windows where the timestamps work.
+        long in_a_sec = System.currentTimeMillis()+1000;
+        while (in_a_sec > System.currentTimeMillis()) {
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+            }
+        }
+    }
+
+    void compileExpectFailure(String... args) throws Exception {
+        int rc = main.go(args, System.out, System.err);
+        if (rc == 0) throw new Exception("Expected error during compile! Did not fail!");
+    }
+
+    Map<String,Long> collectState(Path dir) throws IOException
+    {
+        final Map<String,Long> files = new HashMap<>();
+        Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
+                 @Override
+                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
+                   throws IOException
+                 {
+                     files.put(file.toString(),new Long(Files.getLastModifiedTime(file).toMillis()));
+                     return FileVisitResult.CONTINUE;
+                 }
+            });
+        return files;
+    }
+
+    void verifyThatFilesHaveBeenRemoved(Map<String,Long> from,
+                                        Map<String,Long> to,
+                                        String... args) throws Exception {
+
+        Set<String> froms = from.keySet();
+        Set<String> tos = to.keySet();
+
+        if (froms.equals(tos)) {
+            throw new Exception("Expected new state to have fewer files than previous state!");
+        }
+
+        for (String t : tos) {
+            if (!froms.contains(t)) {
+                throw new Exception("Expected "+t+" to exist in previous state!");
+            }
+        }
+
+        for (String f : args) {
+            f = f.replace("/", File.separator);
+            if (!froms.contains(f)) {
+                throw new Exception("Expected "+f+" to exist in previous state!");
+            }
+            if (tos.contains(f)) {
+                throw new Exception("Expected "+f+" to have been removed from the new state!");
+            }
+        }
+
+        if (froms.size() - args.length != tos.size()) {
+            throw new Exception("There are more removed files than the expected list!");
+        }
+    }
+
+    void verifyThatFilesHaveBeenAdded(Map<String,Long> from,
+                                      Map<String,Long> to,
+                                      String... args) throws Exception {
+
+        Set<String> froms = from.keySet();
+        Set<String> tos = to.keySet();
+
+        if (froms.equals(tos)) {
+            throw new Exception("Expected new state to have more files than previous state!");
+        }
+
+        for (String t : froms) {
+            if (!tos.contains(t)) {
+                throw new Exception("Expected "+t+" to exist in new state!");
+            }
+        }
+
+        for (String f : args) {
+            f = f.replace("/", File.separator);
+            if (!tos.contains(f)) {
+                throw new Exception("Expected "+f+" to have been added to new state!");
+            }
+            if (froms.contains(f)) {
+                throw new Exception("Expected "+f+" to not exist in previous state!");
+            }
+        }
+
+        if (froms.size() + args.length != tos.size()) {
+            throw new Exception("There are more added files than the expected list!");
+        }
+    }
+
+    void verifyNewerFiles(Map<String,Long> from,
+                          Map<String,Long> to,
+                          String... args) throws Exception {
+        if (!from.keySet().equals(to.keySet())) {
+            throw new Exception("Expected the set of files to be identical!");
+        }
+        Set<String> files = new HashSet<String>();
+        for (String s : args) {
+            files.add(s.replace("/", File.separator));
+        }
+        for (String fn : from.keySet()) {
+            long f = from.get(fn);
+            long t = to.get(fn);
+            if (files.contains(fn)) {
+                if (t <= f) {
+                    throw new Exception("Expected "+fn+" to have a more recent timestamp!");
+                }
+            } else {
+                if (t != f) {
+                    throw new Exception("Expected "+fn+" to have the same timestamp!");
+                }
+            }
+        }
+    }
+
+    String print(Map<String,Long> m) {
+        StringBuilder b = new StringBuilder();
+        Set<String> keys = m.keySet();
+        for (String k : keys) {
+            b.append(k+" "+m.get(k)+"\n");
+        }
+        return b.toString();
+    }
+
+    void verifyEqual(Map<String,Long> from, Map<String,Long> to) throws Exception {
+        if (!from.equals(to)) {
+            System.out.println("FROM---"+print(from));
+            System.out.println("TO-----"+print(to));
+            throw new Exception("The dir should not differ! But it does!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/sjavac/SJavacWrapper.java	Tue Jul 02 10:13:00 2013 +0100
@@ -0,0 +1,67 @@
+/*
+ * 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
+ * @summary Test all aspects of sjavac.
+ *
+ * @bug 8004658
+ * @summary Add internal smart javac wrapper to solve JEP 139
+ *
+ * @run main SJavacWrapper
+ */
+
+import java.io.*;
+import java.lang.reflect.Method;
+import java.net.*;
+
+
+public
+class SJavacWrapper {
+
+    public static void main(String... args) throws Exception {
+        URL url = SJavacWrapper.class.getClassLoader().getResource("com/sun/tools/sjavac/Main.class");
+        if (url == null) {
+            // No sjavac in the classpath.
+            System.out.println("sjavac not available: pass by default");
+            return;
+        }
+
+        File testSrc = new File(System.getProperty("test.src"));
+        File sjavac_java = new File(testSrc, "SJavac.java");
+        File testClasses = new File(System.getProperty("test.classes"));
+        File sjavac_class = new File(testClasses, "SJavac.class");
+        if (sjavac_class.lastModified() < sjavac_java.lastModified()) {
+            String[] javac_args = { "-d", testClasses.getPath(), sjavac_java.getPath() };
+            System.err.println("Recompiling SJavac.java");
+            int rc = com.sun.tools.javac.Main.compile(javac_args);
+            if (rc != 0)
+                throw new Exception("compilation failed");
+        }
+
+        Class<?> sjavac = Class.forName("SJavac");
+        Method sjavac_main = sjavac.getMethod("main", String[].class);
+        sjavac_main.invoke(null, new Object[] { args });
+    }
+
+}