changeset 990:de8bb6fa070c

Merge
author lana
date Sun, 10 Apr 2011 10:25:12 -0700
parents aa4f494c17ef (current diff) 26b065bb4ee7 (diff)
children 53f212bed4f4
files
diffstat 79 files changed, 3872 insertions(+), 434 deletions(-) [+]
line wrap: on
line diff
--- a/make/build.xml	Thu Apr 07 15:21:22 2011 -0700
+++ b/make/build.xml	Sun Apr 10 10:25:12 2011 -0700
@@ -806,6 +806,9 @@
                         <exclude name="**/*.java"/>
                         <exclude name="**/*.properties"/>
                         <exclude name="**/*-template"/>
+                        <exclude name="**/*.rej"/>
+                        <exclude name="**/*.orig"/>
+                        <exclude name="**/overview.html"/>
                         <exclude name="**/package.html"/>
                     </fileset>
                 </copy>
--- a/src/share/classes/com/sun/tools/classfile/Type.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/classfile/Type.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -41,6 +41,11 @@
  */
 public abstract class Type {
     protected Type() { }
+
+    public boolean isObject() {
+        return false;
+    }
+
     public abstract <R,D> R accept(Visitor<R,D> visitor, D data);
 
     protected static void append(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
@@ -262,6 +267,13 @@
             return sb.toString();
         }
 
+        @Override
+        public boolean isObject() {
+            return (outerType == null)
+                    && name.equals("java/lang/Object")
+                    && (typeArgs == null || typeArgs.isEmpty());
+        }
+
         public final ClassType outerType;
         public final String name;
         public final List<Type> typeArgs;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -154,8 +154,8 @@
         div.addStyle(HtmlStyle.header);
         if (pkgname.length() > 0) {
             Content pkgNameContent = new StringContent(pkgname);
-            Content pkgNamePara = HtmlTree.P(HtmlStyle.subTitle, pkgNameContent);
-            div.addContent(pkgNamePara);
+            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
+            div.addContent(pkgNameDiv);
         }
         LinkInfoImpl linkInfo = new LinkInfoImpl(
                 LinkInfoImpl.CONTEXT_CLASS_HEADER, annotationType, false);
@@ -216,12 +216,15 @@
         pre.addContent(modifiers);
         LinkInfoImpl linkInfo = new LinkInfoImpl(
                 LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false);
-        Content name = new RawHtml (annotationType.name() +
-                getTypeParameterLinks(linkInfo));
+        Content annotationName = new StringContent(annotationType.name());
+        Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo));
         if (configuration().linksource) {
-            addSrcLink(annotationType, name, pre);
+            addSrcLink(annotationType, annotationName, pre);
+            pre.addContent(parameterLinks);
         } else {
-            pre.addContent(HtmlTree.STRONG(name));
+            Content span = HtmlTree.SPAN(HtmlStyle.strong, annotationName);
+            span.addContent(parameterLinks);
+            pre.addContent(span);
         }
         annotationInfoTree.addContent(pre);
     }
--- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -161,8 +161,8 @@
         div.addStyle(HtmlStyle.header);
         if (pkgname.length() > 0) {
             Content pkgNameContent = new StringContent(pkgname);
-            Content pkgNamePara = HtmlTree.P(HtmlStyle.subTitle, pkgNameContent);
-            div.addContent(pkgNamePara);
+            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
+            div.addContent(pkgNameDiv);
         }
         LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl.CONTEXT_CLASS_HEADER,
                 classDoc, false);
@@ -228,12 +228,15 @@
                 LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false);
         //Let's not link to ourselves in the signature.
         linkInfo.linkToSelf = false;
-        Content name = new RawHtml (classDoc.name() +
-                getTypeParameterLinks(linkInfo));
+        Content className = new StringContent(classDoc.name());
+        Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo));
         if (configuration().linksource) {
-            addSrcLink(classDoc, name, pre);
+            addSrcLink(classDoc, className, pre);
+            pre.addContent(parameterLinks);
         } else {
-            pre.addContent(HtmlTree.STRONG(name));
+            Content span = HtmlTree.SPAN(HtmlStyle.strong, className);
+            span.addContent(parameterLinks);
+            pre.addContent(span);
         }
         if (!isInterface) {
             Type superclass = Util.getFirstVisibleSuperClass(classDoc,
--- a/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Sun Apr 10 10:25:12 2011 -0700
@@ -114,13 +114,10 @@
         Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Frame_Alert"));
         noframes.addContent(noframesHead);
-        Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message"));
+        Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message",
+                getHyperLinkString(configuration.topFile,
+                configuration.getText("doclet.Non_Frame_Version"))));
         noframes.addContent(p);
-        noframes.addContent(new HtmlTree(HtmlTag.BR));
-        noframes.addContent(getResource("doclet.Link_To"));
-        Content link = getHyperLink(configuration.topFile,
-                getResource("doclet.Non_Frame_Version"));
-        noframes.addContent(link);
         contentTree.addContent(noframes);
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -96,7 +96,7 @@
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title,
                 getResource("doclet.Help_line_1"));
         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
-        Content line2 = HtmlTree.P(HtmlStyle.subTitle,
+        Content line2 = HtmlTree.DIV(HtmlStyle.subTitle,
                 getResource("doclet.Help_line_2"));
         div.addContent(line2);
         contentTree.addContent(div);
--- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -69,9 +69,6 @@
         StringBuffer label = new StringBuffer(
             classLinkInfo.getClassLinkLabel(m_writer.configuration));
         classLinkInfo.displayLength += label.length();
-        if (noLabel && classLinkInfo.excludeTypeParameterLinks) {
-            label.append(getTypeParameterLinks(linkInfo).toString());
-        }
         Configuration configuration = ConfigurationImpl.getInstance();
         LinkOutputImpl linkOutput = new LinkOutputImpl();
         if (classDoc.isIncluded()) {
--- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -408,10 +408,6 @@
 
             case CONTEXT_PACKAGE:
             case CONTEXT_CLASS_USE:
-                excludeTypeBoundsLinks = true;
-                excludeTypeParameterLinks = true;
-                break;
-
             case CONTEXT_CLASS_HEADER:
             case CONTEXT_CLASS_SIGNATURE:
                 excludeTypeParameterLinks = true;
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -163,10 +163,10 @@
      */
     protected void addOverviewHeader(Content body) {
         if (root.inlineTags().length > 0) {
-            HtmlTree p = new HtmlTree(HtmlTag.P);
-            p.addStyle(HtmlStyle.subTitle);
-            addSummaryComment(root, p);
-            Content div = HtmlTree.DIV(HtmlStyle.header, p);
+            HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV);
+            subTitleDiv.addStyle(HtmlStyle.subTitle);
+            addSummaryComment(root, subTitleDiv);
+            Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv);
             Content see = seeLabel;
             see.addContent(" ");
             Content descPara = HtmlTree.P(see);
@@ -188,10 +188,10 @@
     protected void addOverviewComment(Content htmltree) {
         if (root.inlineTags().length > 0) {
             htmltree.addContent(getMarkerAnchor("overview_description"));
-            HtmlTree p = new HtmlTree(HtmlTag.P);
-            p.addStyle(HtmlStyle.subTitle);
-            addInlineComment(root, p);
-            htmltree.addContent(p);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.subTitle);
+            addInlineComment(root, div);
+            htmltree.addContent(div);
         }
     }
 
--- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -115,10 +115,10 @@
         tHeading.addContent(packageHead);
         div.addContent(tHeading);
         if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
-            HtmlTree p = new HtmlTree(HtmlTag.P);
-            p.addStyle(HtmlStyle.subTitle);
-            addSummaryComment(packageDoc, p);
-            div.addContent(p);
+            HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV);
+            subTitleDiv.addStyle(HtmlStyle.subTitle);
+            addSummaryComment(packageDoc, subTitleDiv);
+            div.addContent(subTitleDiv);
             Content space = getSpace();
             Content descLink = getHyperLink("", "package_description",
                     descriptionLabel, "", "");
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -188,8 +188,8 @@
         nextclassLabel = getResource("doclet.Next_Class");
         summaryLabel = getResource("doclet.Summary");
         detailLabel = getResource("doclet.Detail");
-        framesLabel = getResource("doclet.FRAMES");
-        noframesLabel = getResource("doclet.NO_FRAMES");
+        framesLabel = getResource("doclet.Frames");
+        noframesLabel = getResource("doclet.No_Frames");
         treeLabel = getResource("doclet.Tree");
         classLabel = getResource("doclet.Class");
         deprecatedLabel = getResource("doclet.navDeprecated");
--- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Sun Apr 10 10:25:12 2011 -0700
@@ -11,54 +11,30 @@
 doclet.Interface_Hierarchy=Interface Hierarchy
 doclet.Enum_Hierarchy=Enum Hierarchy
 doclet.Annotation_Type_Hierarchy=Annotation Type Hierarchy
-# The following ALL CAPS words should be translated. It is used as "Previous" link on javadoc.
-doclet.Prev=PREV
-# The following ALL CAPS words should be translated. It is used as "Next" link on javadoc.
-doclet.Next=NEXT
-# The following ALL CAPS words should be translated. It is used as "Previous Class" link on javadoc.
-doclet.Prev_Class=PREV CLASS
-# The following ALL CAPS words should be translated. It is used as "Next Class" link on javadoc.
-doclet.Next_Class=NEXT CLASS
-# The following ALL CAPS words should be translated. It is used as "Previous Package" link on javadoc.
-doclet.Prev_Package=PREV PACKAGE
-# The following ALL CAPS words should be translated. It is used as "Next Package" link on javadoc.
-doclet.Next_Package=NEXT PACKAGE
-# The following ALL CAPS words should be translated. It is used as "Previous Letter" link on javadoc alphabetical index.
-doclet.Prev_Letter=PREV LETTER
-# The following ALL CAPS words should be translated. It is used as "Next Letter" link on javadoc alphabetical index.
-doclet.Next_Letter=NEXT LETTER
-# The following ALL CAPS words should be translated. It is used as "Show List" link on javadoc.
-doclet.Show_Lists=SHOW LISTS
-# The following ALL CAPS words should be translated. It is used as "Hide List" link on javadoc.
-doclet.Hide_Lists=HIDE LISTS
+doclet.Prev=Prev
+doclet.Next=Next
+doclet.Prev_Class=Prev Class
+doclet.Next_Class=Next Class
+doclet.Prev_Package=Prev Package
+doclet.Next_Package=Next Package
+doclet.Prev_Letter=Prev Letter
+doclet.Next_Letter=Next Letter
 doclet.Href_Class_Title=class in {0}
 doclet.Href_Interface_Title=interface in {0}
 doclet.Href_Annotation_Title=annotation in {0}
 doclet.Href_Enum_Title=enum in {0}
 doclet.Href_Type_Param_Title=type parameter in {0}
 doclet.Href_Class_Or_Interface_Title=class or interface in {0}
-# The following ALL CAPS words should be translated. It's used as SUMMARY: NESTED | FIELD | CONSTR | METHOD, meaning Nested Class Summary, Field Summary, Constructor Summary, or Method Summary.
-doclet.Summary=SUMMARY:
-# The following ALL CAPS words should be translated. It is used as DETAIL: FIELD | CONSTR | METHOD, meaning Field Detail, Constructor Detail, or Method Detail.
-doclet.Detail=DETAIL:
-# The following ALL CAPS words should be translated. It is used as "Nested" (Nested Class Summary) link on javadoc.
-doclet.navNested=NESTED
-# The following ALL CAPS words should be translated. It is used as "Optional" (Optional Element Summary) link on javadoc.
-doclet.navAnnotationTypeOptionalMember=OPTIONAL
-# The following ALL CAPS words should be translated. It is used as "Required" (Required Element Summary) link on javadoc.
-doclet.navAnnotationTypeRequiredMember=REQUIRED
-# The following ALL CAPS words should be translated. It is used as "Element" (Required Element Summary) link on javadoc.
-doclet.navAnnotationTypeMember=ELEMENT
-# The following ALL CAPS words should be translated. It is used as "Field" (Field Detail) link on javadoc.
-doclet.navField=FIELD
-# The following ALL CAPS words should be translated. It is used as "Enum Constants" link on javadoc.
-doclet.navEnum=ENUM CONSTANTS
-# The following ALL CAPS words should be translated. It is used as "Constructor" (Constructor Detail) link on javadoc.
-doclet.navConstructor=CONSTR
-# The following ALL CAPS words should be translated. It is used as "Method" (Method Detail) link on javadoc.
-doclet.navMethod=METHOD
-# The following resource does not seem to be used anymore.
-doclet.navFactoryMethod=FACTORY
+doclet.Summary=Summary:
+doclet.Detail=Detail:
+doclet.navNested=Nested
+doclet.navAnnotationTypeOptionalMember=Optional
+doclet.navAnnotationTypeRequiredMember=Required
+doclet.navAnnotationTypeMember=Element
+doclet.navField=Field
+doclet.navEnum=Enum Constants
+doclet.navConstructor=Constr
+doclet.navMethod=Method
 doclet.Index=Index
 doclet.Window_Single_Index=Index
 doclet.Window_Split_Index={0}-Index
@@ -66,12 +42,6 @@
 doclet.Skip_navigation_links=Skip navigation links
 doclet.New_Page=NewPage
 doclet.None=None
-# The following resource does not seem to be used anymore
-doclet.CLASSES=CLASSES
-# The following resource does not seem to be used anymore
-doclet.MEMBERS=MEMBERS
-# The following resource does not seem to be used anymore
-doclet.NONE=NONE
 doclet.Factory_Method_Detail=Static Factory Method Detail
 doclet.navDeprecated=Deprecated
 doclet.Deprecated_List=Deprecated List
@@ -136,10 +106,7 @@
 doclet.Option=Option
 doclet.Or=Or
 doclet.Frames=Frames
-# The following ALL CAPS words should be translated. It is used as "FRAMES" javadoc navigation link to indicate displaying the page with HTML frames.
-doclet.FRAMES=FRAMES
-# The following ALL CAPS words should be translated. It is used as "NO FRAMES" javadoc navigation link to indicate displaying the page without HTML frames.
-doclet.NO_FRAMES=NO FRAMES
+doclet.No_Frames=No Frames
 doclet.Package_Hierarchies=Package Hierarchies:
 doclet.Hierarchy_For_Package=Hierarchy For Package {0}
 doclet.Source_Code=Source Code:
@@ -147,11 +114,10 @@
 doclet.Cannot_handle_no_packages=Cannot handle no packages.
 doclet.Frame_Alert=Frame Alert
 doclet.Overview-Member-Frame=Overview Member Frame
-doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
+doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to {0}.
 doclet.No_Script_Message=JavaScript is disabled on your browser.
-doclet.Non_Frame_Version=Non-frame version.
+doclet.Non_Frame_Version=Non-frame version
 doclet.Frame_Version=Frame version
-doclet.Link_To=Link to
 doclet.Following_From_Class=Following copied from class: {0}
 doclet.Following_From_Interface=Following copied from interface: {0}
 doclet.Description_From_Interface=Description copied from interface:
@@ -200,7 +166,6 @@
 doclet.Help_annotation_type_line_1=Each annotation type has its own separate page with the following sections:
 doclet.Help_annotation_type_line_2=Annotation Type declaration
 doclet.Help_annotation_type_line_3=Annotation Type description
-doclet.The=The
 doclet.Style_line_1=Javadoc style sheet
 doclet.Style_line_2=Define colors, fonts and other style attributes here to override the defaults
 doclet.Style_line_3=Page background color
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Sun Apr 10 10:25:12 2011 -0700
@@ -142,19 +142,19 @@
 .subNav ul.navList {
     float:left;
     margin:0;
-    font-size:0.7em;
+    font-size:0.8em;
     width:350px;
 }
 ul.subNavList {
     float:left;
     margin:0;
-    font-size:0.7em;
+    font-size:0.8em;
     width:350px;
 }
 ul.subNavList li{
     list-style:none;
     float:left;
-    font-size:90%;
+    font-size:98%;
 }
 /*
 Page header and footer styles
@@ -183,8 +183,6 @@
 .subTitle {
     margin:0;
     padding-top:10px;
-    font-size:0.75em;
-    font-weight:bold;
 }
 /*
 Page layout container styles
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,593 @@
+/*
+ * 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.javac.api;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.lang.model.element.NestingKind;
+import javax.tools.Diagnostic;
+import javax.tools.FileObject;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.util.ClientCodeException;
+import com.sun.tools.javac.util.Context;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.lang.model.element.Modifier;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaFileObject.Kind;
+
+/**
+ *  Wrap objects to enable unchecked exceptions to be caught and handled.
+ *
+ *  For each method, exceptions are handled as follows:
+ *  <ul>
+ *  <li>Checked exceptions are left alone and propogate upwards in the
+ *      obvious way, since they are an expected aspect of the method's
+ *      specification.
+ *  <li>Unchecked exceptions which have already been caught and wrapped in
+ *      ClientCodeException are left alone to continue propogating upwards.
+ *  <li>All other unchecked exceptions (i.e. subtypes of RuntimeException
+ *      and Error) and caught, and rethrown as a ClientCodeException with
+ *      its cause set to the original exception.
+ *  </ul>
+ *
+ *  The intent is that ClientCodeException can be caught at an appropriate point
+ *  in the program and can be distinguished from any unanticipated unchecked
+ *  exceptions arising in the main body of the code (i.e. bugs.) When the
+ *  ClientCodeException has been caught, either a suitable message can be
+ *  generated, or if appropriate, the original cause can be rethrown.
+ *
+ *  <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 ClientCodeWrapper {
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.TYPE)
+    public @interface Trusted { }
+
+    public static ClientCodeWrapper instance(Context context) {
+        ClientCodeWrapper instance = context.get(ClientCodeWrapper.class);
+        if (instance == null)
+            instance = new ClientCodeWrapper(context);
+        return instance;
+    }
+
+    /**
+     * A map to cache the results of whether or not a specific classes can
+     * be "trusted", and thus does not need to be wrapped.
+     */
+    Map<Class<?>, Boolean> trustedClasses;
+
+    protected ClientCodeWrapper(Context context) {
+        trustedClasses = new HashMap<Class<?>, Boolean>();
+    }
+
+    public JavaFileManager wrap(JavaFileManager fm) {
+        if (isTrusted(fm))
+            return fm;
+        return new WrappedJavaFileManager(fm);
+    }
+
+    public FileObject wrap(FileObject fo) {
+        if (isTrusted(fo))
+            return fo;
+        return new WrappedFileObject(fo);
+    }
+
+    FileObject unwrap(FileObject fo) {
+        if (fo instanceof WrappedFileObject)
+            return ((WrappedFileObject) fo).clientFileObject;
+        else
+            return fo;
+    }
+
+    public JavaFileObject wrap(JavaFileObject fo) {
+        if (isTrusted(fo))
+            return fo;
+        return new WrappedJavaFileObject(fo);
+    }
+
+    public Iterable<JavaFileObject> wrapJavaFileObjects(Iterable<? extends JavaFileObject> list) {
+        List<JavaFileObject> wrapped = new ArrayList<JavaFileObject>();
+        for (JavaFileObject fo : list)
+            wrapped.add(wrap(fo));
+        return Collections.unmodifiableList(wrapped);
+    }
+
+    JavaFileObject unwrap(JavaFileObject fo) {
+        if (fo instanceof WrappedJavaFileObject)
+            return ((JavaFileObject) ((WrappedJavaFileObject) fo).clientFileObject);
+        else
+            return fo;
+    }
+
+    <T> DiagnosticListener<T> wrap(DiagnosticListener<T> dl) {
+        if (isTrusted(dl))
+            return dl;
+        return new WrappedDiagnosticListener<T>(dl);
+    }
+
+    TaskListener wrap(TaskListener tl) {
+        if (isTrusted(tl))
+            return tl;
+        return new WrappedTaskListener(tl);
+    }
+
+    protected boolean isTrusted(Object o) {
+        Class<?> c = o.getClass();
+        Boolean trusted = trustedClasses.get(c);
+        if (trusted == null) {
+            trusted = c.getName().startsWith("com.sun.tools.javac.")
+                    || c.isAnnotationPresent(Trusted.class);
+            trustedClasses.put(c, trusted);
+        }
+        return trusted;
+    }
+
+    // <editor-fold defaultstate="collapsed" desc="Wrapper classes">
+
+    // FIXME: all these classes should be converted to use multi-catch when
+    // that is available in the bootstrap compiler.
+
+    protected class WrappedJavaFileManager implements JavaFileManager {
+        protected JavaFileManager clientJavaFileManager;
+        WrappedJavaFileManager(JavaFileManager clientJavaFileManager) {
+            clientJavaFileManager.getClass(); // null check
+            this.clientJavaFileManager = clientJavaFileManager;
+        }
+
+        @Override
+        public ClassLoader getClassLoader(Location location) {
+            try {
+                return clientJavaFileManager.getClassLoader(location);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException {
+            try {
+                return wrapJavaFileObjects(clientJavaFileManager.list(location, packageName, kinds, recurse));
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public String inferBinaryName(Location location, JavaFileObject file) {
+            try {
+                return clientJavaFileManager.inferBinaryName(location, unwrap(file));
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public boolean isSameFile(FileObject a, FileObject b) {
+            try {
+                return clientJavaFileManager.isSameFile(unwrap(a), unwrap(b));
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public boolean handleOption(String current, Iterator<String> remaining) {
+            try {
+                return clientJavaFileManager.handleOption(current, remaining);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public boolean hasLocation(Location location) {
+            try {
+                return clientJavaFileManager.hasLocation(location);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException {
+            try {
+                return wrap(clientJavaFileManager.getJavaFileForInput(location, className, kind));
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException {
+            try {
+                return wrap(clientJavaFileManager.getJavaFileForOutput(location, className, kind, unwrap(sibling)));
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException {
+            try {
+                return wrap(clientJavaFileManager.getFileForInput(location, packageName, relativeName));
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
+            try {
+                return wrap(clientJavaFileManager.getFileForOutput(location, packageName, relativeName, unwrap(sibling)));
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public void flush() throws IOException {
+            try {
+                clientJavaFileManager.flush();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public void close() throws IOException {
+            try {
+                clientJavaFileManager.close();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public int isSupportedOption(String option) {
+            try {
+                return clientJavaFileManager.isSupportedOption(option);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+    }
+
+    protected class WrappedFileObject implements FileObject {
+        protected FileObject clientFileObject;
+        WrappedFileObject(FileObject clientFileObject) {
+            clientFileObject.getClass(); // null check
+            this.clientFileObject = clientFileObject;
+        }
+
+        @Override
+        public URI toUri() {
+            try {
+                return clientFileObject.toUri();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public String getName() {
+            try {
+                return clientFileObject.getName();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public InputStream openInputStream() throws IOException {
+            try {
+                return clientFileObject.openInputStream();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public OutputStream openOutputStream() throws IOException {
+            try {
+                return clientFileObject.openOutputStream();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
+            try {
+                return clientFileObject.openReader(ignoreEncodingErrors);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+            try {
+                return clientFileObject.getCharContent(ignoreEncodingErrors);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public Writer openWriter() throws IOException {
+            try {
+                return clientFileObject.openWriter();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public long getLastModified() {
+            try {
+                return clientFileObject.getLastModified();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public boolean delete() {
+            try {
+                return clientFileObject.delete();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+    }
+
+    protected class WrappedJavaFileObject extends WrappedFileObject implements JavaFileObject {
+        WrappedJavaFileObject(JavaFileObject clientJavaFileObject) {
+            super(clientJavaFileObject);
+        }
+
+        @Override
+        public Kind getKind() {
+            try {
+                return ((JavaFileObject)clientFileObject).getKind();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public boolean isNameCompatible(String simpleName, Kind kind) {
+            try {
+                return ((JavaFileObject)clientFileObject).isNameCompatible(simpleName, kind);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public NestingKind getNestingKind() {
+            try {
+                return ((JavaFileObject)clientFileObject).getNestingKind();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public Modifier getAccessLevel() {
+            try {
+                return ((JavaFileObject)clientFileObject).getAccessLevel();
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+    }
+
+    protected class WrappedDiagnosticListener<T> implements DiagnosticListener<T> {
+        protected DiagnosticListener<T> clientDiagnosticListener;
+        WrappedDiagnosticListener(DiagnosticListener<T> clientDiagnosticListener) {
+            clientDiagnosticListener.getClass(); // null check
+            this.clientDiagnosticListener = clientDiagnosticListener;
+        }
+
+        @Override
+        public void report(Diagnostic<? extends T> diagnostic) {
+            try {
+                clientDiagnosticListener.report(diagnostic);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+    }
+
+    protected class WrappedTaskListener implements TaskListener {
+        protected TaskListener clientTaskListener;
+        WrappedTaskListener(TaskListener clientTaskListener) {
+            clientTaskListener.getClass(); // null check
+            this.clientTaskListener = clientTaskListener;
+        }
+
+        @Override
+        public void started(TaskEvent ev) {
+            try {
+                clientTaskListener.started(ev);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override
+        public void finished(TaskEvent ev) {
+            try {
+                clientTaskListener.finished(ev);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException e) {
+                throw new ClientCodeException(e);
+            } catch (Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+    }
+
+    // </editor-fold>
+}
--- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Sun Apr 10 10:25:12 2011 -0700
@@ -65,7 +65,7 @@
  * @author Jonathan Gibbons
  */
 public class JavacTaskImpl extends JavacTask {
-    private JavacTool tool;
+    private ClientCodeWrapper ccw;
     private Main compilerMain;
     private JavaCompiler compiler;
     private Locale locale;
@@ -80,12 +80,11 @@
 
     private Integer result = null;
 
-    JavacTaskImpl(JavacTool tool,
-                Main compilerMain,
+    JavacTaskImpl(Main compilerMain,
                 String[] args,
                 Context context,
                 List<JavaFileObject> fileObjects) {
-        this.tool = tool;
+        this.ccw = ClientCodeWrapper.instance(context);
         this.compilerMain = compilerMain;
         this.args = args;
         this.context = context;
@@ -94,17 +93,15 @@
         // null checks
         compilerMain.getClass();
         args.getClass();
-        context.getClass();
         fileObjects.getClass();
     }
 
-    JavacTaskImpl(JavacTool tool,
-                Main compilerMain,
+    JavacTaskImpl(Main compilerMain,
                 Iterable<String> flags,
                 Context context,
                 Iterable<String> classes,
                 Iterable<? extends JavaFileObject> fileObjects) {
-        this(tool, compilerMain, toArray(flags, classes), context, toList(fileObjects));
+        this(compilerMain, toArray(flags, classes), context, toList(fileObjects));
     }
 
     static private String[] toArray(Iterable<String> flags, Iterable<String> classes) {
@@ -131,7 +128,7 @@
         if (!used.getAndSet(true)) {
             initContext();
             notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
-            compilerMain.setFatalErrors(true);
+            compilerMain.setAPIMode(true);
             result = compilerMain.compile(args, context, fileObjects, processors);
             cleanup();
             return result == 0;
@@ -185,31 +182,9 @@
         if (context.get(TaskListener.class) != null)
             context.put(TaskListener.class, (TaskListener)null);
         if (taskListener != null)
-            context.put(TaskListener.class, wrap(taskListener));
+            context.put(TaskListener.class, ccw.wrap(taskListener));
         //initialize compiler's default locale
-        JavacMessages.instance(context).setCurrentLocale(locale);
-    }
-    // where
-    private TaskListener wrap(final TaskListener tl) {
-        tl.getClass(); // null check
-        return new TaskListener() {
-            public void started(TaskEvent e) {
-                try {
-                    tl.started(e);
-                } catch (Throwable t) {
-                    throw new ClientCodeException(t);
-                }
-            }
-
-            public void finished(TaskEvent e) {
-                try {
-                    tl.finished(e);
-                } catch (Throwable t) {
-                    throw new ClientCodeException(t);
-                }
-            }
-
-        };
+        context.put(Locale.class, locale);
     }
 
     void cleanup() {
--- a/src/share/classes/com/sun/tools/javac/api/JavacTool.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/api/JavacTool.java	Sun Apr 10 10:25:12 2011 -0700
@@ -28,8 +28,10 @@
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.Writer;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.EnumSet;
@@ -47,12 +49,11 @@
 import com.sun.tools.javac.main.Main;
 import com.sun.tools.javac.main.RecognizedOptions.GrumpyHelper;
 import com.sun.tools.javac.main.RecognizedOptions;
+import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.JavacMessages;
 import com.sun.tools.javac.util.Options;
 import com.sun.tools.javac.util.Pair;
-import java.nio.charset.Charset;
 
 /**
  * TODO: describe com.sun.tools.javac.api.Tool
@@ -145,10 +146,13 @@
         Locale locale,
         Charset charset) {
         Context context = new Context();
-        JavacMessages.instance(context).setCurrentLocale(locale);
+        context.put(Locale.class, locale);
         if (diagnosticListener != null)
             context.put(DiagnosticListener.class, diagnosticListener);
-        context.put(Log.outKey, new PrintWriter(System.err, true)); // FIXME
+        PrintWriter pw = (charset == null)
+                ? new PrintWriter(System.err, true)
+                : new PrintWriter(new OutputStreamWriter(System.err, charset), true);
+        context.put(Log.outKey, pw);
         return new JavacFileManager(context, true, charset);
     }
 
@@ -159,38 +163,45 @@
                              Iterable<String> classes,
                              Iterable<? extends JavaFileObject> compilationUnits)
     {
-        final String kindMsg = "All compilation units must be of SOURCE kind";
-        if (options != null)
-            for (String option : options)
-                option.getClass(); // null check
-        if (classes != null) {
-            for (String cls : classes)
-                if (!SourceVersion.isName(cls)) // implicit null check
-                    throw new IllegalArgumentException("Not a valid class name: " + cls);
-        }
-        if (compilationUnits != null) {
-            for (JavaFileObject cu : compilationUnits) {
-                if (cu.getKind() != JavaFileObject.Kind.SOURCE) // implicit null check
-                    throw new IllegalArgumentException(kindMsg);
-            }
-        }
+        try {
+            Context context = new Context();
+            ClientCodeWrapper ccw = ClientCodeWrapper.instance(context);
 
-        Context context = new Context();
-
-        if (diagnosticListener != null)
-            context.put(DiagnosticListener.class, diagnosticListener);
+            final String kindMsg = "All compilation units must be of SOURCE kind";
+            if (options != null)
+                for (String option : options)
+                    option.getClass(); // null check
+            if (classes != null) {
+                for (String cls : classes)
+                    if (!SourceVersion.isName(cls)) // implicit null check
+                        throw new IllegalArgumentException("Not a valid class name: " + cls);
+            }
+            if (compilationUnits != null) {
+                compilationUnits = ccw.wrapJavaFileObjects(compilationUnits); // implicit null check
+                for (JavaFileObject cu : compilationUnits) {
+                    if (cu.getKind() != JavaFileObject.Kind.SOURCE)
+                        throw new IllegalArgumentException(kindMsg);
+                }
+            }
 
-        if (out == null)
-            context.put(Log.outKey, new PrintWriter(System.err, true));
-        else
-            context.put(Log.outKey, new PrintWriter(out, true));
+            if (diagnosticListener != null)
+                context.put(DiagnosticListener.class, ccw.wrap(diagnosticListener));
+
+            if (out == null)
+                context.put(Log.outKey, new PrintWriter(System.err, true));
+            else
+                context.put(Log.outKey, new PrintWriter(out, true));
 
-        if (fileManager == null)
-            fileManager = getStandardFileManager(diagnosticListener, null, null);
-        context.put(JavaFileManager.class, fileManager);
-        processOptions(context, fileManager, options);
-        Main compiler = new Main("javacTask", context.get(Log.outKey));
-        return new JavacTaskImpl(this, compiler, options, context, classes, compilationUnits);
+            if (fileManager == null)
+                fileManager = getStandardFileManager(diagnosticListener, null, null);
+            fileManager = ccw.wrap(fileManager);
+            context.put(JavaFileManager.class, fileManager);
+            processOptions(context, fileManager, options);
+            Main compiler = new Main("javacTask", context.get(Log.outKey));
+            return new JavacTaskImpl(compiler, options, context, classes, compilationUnits);
+        } catch (ClientCodeException ex) {
+            throw new RuntimeException(ex.getCause());
+        }
     }
 
     private static void processOptions(Context context,
--- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Sun Apr 10 10:25:12 2011 -0700
@@ -125,12 +125,11 @@
     public final Type stringBuilderType;
     public final Type cloneableType;
     public final Type serializableType;
-    public final Type transientMethodHandleType; // transient - 292
     public final Type methodHandleType;
-    public final Type transientPolymorphicSignatureType; // transient - 292
     public final Type polymorphicSignatureType;
     public final Type throwableType;
     public final Type errorType;
+    public final Type interruptedExceptionType;
     public final Type illegalArgumentExceptionType;
     public final Type exceptionType;
     public final Type runtimeExceptionType;
@@ -435,12 +434,11 @@
         cloneableType = enterClass("java.lang.Cloneable");
         throwableType = enterClass("java.lang.Throwable");
         serializableType = enterClass("java.io.Serializable");
-        transientMethodHandleType = enterClass("java.dyn.MethodHandle"); // transient - 292
         methodHandleType = enterClass("java.lang.invoke.MethodHandle");
-        transientPolymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature"); // transient - 292
         polymorphicSignatureType = enterClass("java.lang.invoke.MethodHandle$PolymorphicSignature");
         errorType = enterClass("java.lang.Error");
         illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
+        interruptedExceptionType = enterClass("java.lang.InterruptedException");
         exceptionType = enterClass("java.lang.Exception");
         runtimeExceptionType = enterClass("java.lang.RuntimeException");
         classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException");
@@ -480,9 +478,9 @@
                              autoCloseableType.tsym);
         trustMeType = enterClass("java.lang.SafeVarargs");
 
+        synthesizeEmptyInterfaceIfMissing(autoCloseableType);
         synthesizeEmptyInterfaceIfMissing(cloneableType);
         synthesizeEmptyInterfaceIfMissing(serializableType);
-        synthesizeEmptyInterfaceIfMissing(transientPolymorphicSignatureType); // transient - 292
         synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType);
         synthesizeBoxTypeIfMissing(doubleType);
         synthesizeBoxTypeIfMissing(floatType);
--- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Sun Apr 10 10:25:12 2011 -0700
@@ -2461,6 +2461,22 @@
             }
         };
 
+    public Type createMethodTypeWithReturn(Type original, Type newReturn) {
+        return original.accept(methodWithReturn, newReturn);
+    }
+    // where
+        private final MapVisitor<Type> methodWithReturn = new MapVisitor<Type>() {
+            public Type visitType(Type t, Type newReturn) {
+                throw new IllegalArgumentException("Not a method type: " + t);
+            }
+            public Type visitMethodType(MethodType t, Type newReturn) {
+                return new MethodType(t.argtypes, newReturn, t.thrown, t.tsym);
+            }
+            public Type visitForAll(ForAll t, Type newReturn) {
+                return new ForAll(t.tvars, t.qtype.accept(this, newReturn));
+            }
+        };
+
     // <editor-fold defaultstate="collapsed" desc="createErrorType">
     public Type createErrorType(Type originalType) {
         return new ErrorType(originalType, syms.errSymbol);
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1089,6 +1089,10 @@
             if (resource.getTag() == JCTree.VARDEF) {
                 attribStat(resource, tryEnv);
                 chk.checkType(resource, resource.type, syms.autoCloseableType, "try.not.applicable.to.type");
+
+                //check that resource type cannot throw InterruptedException
+                checkAutoCloseable(resource.pos(), localEnv, resource.type);
+
                 VarSymbol var = (VarSymbol)TreeInfo.symbolFor(resource);
                 var.setData(ElementKind.RESOURCE_VARIABLE);
             } else {
@@ -1127,6 +1131,35 @@
         result = null;
     }
 
+    void checkAutoCloseable(DiagnosticPosition pos, Env<AttrContext> env, Type resource) {
+        if (!resource.isErroneous() &&
+                types.asSuper(resource, syms.autoCloseableType.tsym) != null) {
+            Symbol close = syms.noSymbol;
+            boolean prevDeferDiags = log.deferDiagnostics;
+            Queue<JCDiagnostic> prevDeferredDiags = log.deferredDiagnostics;
+            try {
+                log.deferDiagnostics = true;
+                log.deferredDiagnostics = ListBuffer.lb();
+                close = rs.resolveQualifiedMethod(pos,
+                        env,
+                        resource,
+                        names.close,
+                        List.<Type>nil(),
+                        List.<Type>nil());
+            }
+            finally {
+                log.deferDiagnostics = prevDeferDiags;
+                log.deferredDiagnostics = prevDeferredDiags;
+            }
+            if (close.kind == MTH &&
+                    close.overrides(syms.autoCloseableClose, resource.tsym, types, true) &&
+                    chk.isHandled(syms.interruptedExceptionType, types.memberType(resource, close).getThrownTypes()) &&
+                    env.info.lint.isEnabled(LintCategory.TRY)) {
+                log.warning(LintCategory.TRY, pos, "try.resource.throws.interrupted.exc", resource);
+            }
+        }
+    }
+
     public void visitConditional(JCConditional tree) {
         attribExpr(tree.cond, env, syms.booleanType);
         attribExpr(tree.truepart, env);
@@ -1580,7 +1613,7 @@
         // Attribute clazz expression and store
         // symbol + type back into the attributed tree.
         Type clazztype = attribType(clazz, env);
-        Pair<Scope,Scope> mapping = getSyntheticScopeMapping(clazztype, cdef != null);
+        Pair<Scope,Scope> mapping = getSyntheticScopeMapping(clazztype);
         clazztype = chk.checkDiamond(tree, clazztype);
         chk.validate(clazz, localEnv);
         if (tree.encl != null) {
@@ -1778,62 +1811,48 @@
                         Pair<Scope, Scope> mapping,
                         List<Type> argtypes,
                         List<Type> typeargtypes) {
-        if (clazztype.isErroneous() || mapping == erroneousMapping) {
+        if (clazztype.isErroneous() ||
+                clazztype.isInterface() ||
+                mapping == erroneousMapping) {
             //if the type of the instance creation expression is erroneous,
-            //or something prevented us to form a valid mapping, return the
-            //(possibly erroneous) type unchanged
+            //or if it's an interface, or if something prevented us to form a valid
+            //mapping, return the (possibly erroneous) type unchanged
             return clazztype;
         }
-        else if (clazztype.isInterface()) {
-            //if the type of the instance creation expression is an interface
-            //skip the method resolution step (JLS 15.12.2.7). The type to be
-            //inferred is of the kind <X1,X2, ... Xn>C<X1,X2, ... Xn>
-            clazztype = new ForAll(clazztype.tsym.type.allparams(), clazztype.tsym.type) {
-                @Override
-                public List<Type> getConstraints(TypeVar tv, ConstraintKind ck) {
-                    switch (ck) {
-                        case EXTENDS: return types.getBounds(tv);
-                        default: return List.nil();
-                    }
-                }
-                @Override
-                public Type inst(List<Type> inferred, Types types) throws Infer.NoInstanceException {
-                    // check that inferred bounds conform to their bounds
-                    infer.checkWithinBounds(tvars,
-                           types.subst(tvars, tvars, inferred), Warner.noWarnings);
-                    return super.inst(inferred, types);
-                }
-            };
+
+        //dup attribution environment and augment the set of inference variables
+        Env<AttrContext> localEnv = env.dup(tree);
+        localEnv.info.tvars = clazztype.tsym.type.getTypeArguments();
+
+        //if the type of the instance creation expression is a class type
+        //apply method resolution inference (JLS 15.12.2.7). The return type
+        //of the resolved constructor will be a partially instantiated type
+        ((ClassSymbol) clazztype.tsym).members_field = mapping.snd;
+        Symbol constructor;
+        try {
+            constructor = rs.resolveDiamond(tree.pos(),
+                    localEnv,
+                    clazztype.tsym.type,
+                    argtypes,
+                    typeargtypes);
+        } finally {
+            ((ClassSymbol) clazztype.tsym).members_field = mapping.fst;
+        }
+        if (constructor.kind == MTH) {
+            ClassType ct = new ClassType(clazztype.getEnclosingType(),
+                    clazztype.tsym.type.getTypeArguments(),
+                    clazztype.tsym);
+            clazztype = checkMethod(ct,
+                    constructor,
+                    localEnv,
+                    tree.args,
+                    argtypes,
+                    typeargtypes,
+                    localEnv.info.varArgs).getReturnType();
         } else {
-            //if the type of the instance creation expression is a class type
-            //apply method resolution inference (JLS 15.12.2.7). The return type
-            //of the resolved constructor will be a partially instantiated type
-            ((ClassSymbol) clazztype.tsym).members_field = mapping.snd;
-            Symbol constructor;
-            try {
-                constructor = rs.resolveDiamond(tree.pos(),
-                        env,
-                        clazztype.tsym.type,
-                        argtypes,
-                        typeargtypes);
-            } finally {
-                ((ClassSymbol) clazztype.tsym).members_field = mapping.fst;
-            }
-            if (constructor.kind == MTH) {
-                ClassType ct = new ClassType(clazztype.getEnclosingType(),
-                        clazztype.tsym.type.getTypeArguments(),
-                        clazztype.tsym);
-                clazztype = checkMethod(ct,
-                        constructor,
-                        env,
-                        tree.args,
-                        argtypes,
-                        typeargtypes,
-                        env.info.varArgs).getReturnType();
-            } else {
-                clazztype = syms.errType;
-            }
+            clazztype = syms.errType;
         }
+
         if (clazztype.tag == FORALL && !pt.isErroneous()) {
             //if the resolved constructor's return type has some uninferred
             //type-variables, infer them using the expected type and declared
@@ -1863,34 +1882,28 @@
      *  inference. The inferred return type of the synthetic constructor IS
      *  the inferred type for the diamond operator.
      */
-    private Pair<Scope, Scope> getSyntheticScopeMapping(Type ctype, boolean overrideProtectedAccess) {
+    private Pair<Scope, Scope> getSyntheticScopeMapping(Type ctype) {
         if (ctype.tag != CLASS) {
             return erroneousMapping;
         }
+
         Pair<Scope, Scope> mapping =
                 new Pair<Scope, Scope>(ctype.tsym.members(), new Scope(ctype.tsym));
-        List<Type> typevars = ctype.tsym.type.getTypeArguments();
+
+        //for each constructor in the original scope, create a synthetic constructor
+        //whose return type is the type of the class in which the constructor is
+        //declared, and insert it into the new scope.
         for (Scope.Entry e = mapping.fst.lookup(names.init);
                 e.scope != null;
                 e = e.next()) {
-            MethodSymbol newConstr = (MethodSymbol) e.sym.clone(ctype.tsym);
-            if (overrideProtectedAccess && (newConstr.flags() & PROTECTED) != 0) {
-                //make protected constructor public (this is required for
-                //anonymous inner class creation expressions using diamond)
-                newConstr.flags_field |= PUBLIC;
-                newConstr.flags_field &= ~PROTECTED;
-            }
-            newConstr.name = names.init;
-            List<Type> oldTypeargs = List.nil();
-            if (newConstr.type.tag == FORALL) {
-                oldTypeargs = ((ForAll) newConstr.type).tvars;
-            }
-            newConstr.type = new MethodType(newConstr.type.getParameterTypes(),
-                    new ClassType(ctype.getEnclosingType(), ctype.tsym.type.getTypeArguments(), ctype.tsym),
-                    newConstr.type.getThrownTypes(),
-                    syms.methodClass);
-            newConstr.type = new ForAll(typevars.prependList(oldTypeargs), newConstr.type);
-            mapping.snd.enter(newConstr);
+            Type synthRestype = new ClassType(ctype.getEnclosingType(),
+                        ctype.tsym.type.getTypeArguments(),
+                        ctype.tsym);
+            MethodSymbol synhConstr = new MethodSymbol(e.sym.flags(),
+                    names.init,
+                    types.createMethodTypeWithReturn(e.sym.type, synthRestype),
+                    e.sym.owner);
+            mapping.snd.enter(synhConstr);
         }
         return mapping;
     }
@@ -2276,6 +2289,7 @@
                 sitesym.kind == VAR &&
                 ((VarSymbol)sitesym).isResourceVariable() &&
                 sym.kind == MTH &&
+                sym.name.equals(names.close) &&
                 sym.overrides(syms.autoCloseableClose, sitesym.type.tsym, types, true) &&
                 env.info.lint.isEnabled(LintCategory.TRY)) {
             log.warning(LintCategory.TRY, tree, "try.explicit.close.call");
@@ -2901,7 +2915,23 @@
             ctype = chk.checkType(typeTree.pos(),
                           chk.checkClassType(typeTree.pos(), ctype),
                           syms.throwableType);
-            multicatchTypes.append(ctype);
+            if (!ctype.isErroneous()) {
+                //check that alternatives of a disjunctive type are pairwise
+                //unrelated w.r.t. subtyping
+                if (chk.intersects(ctype,  multicatchTypes.toList())) {
+                    for (Type t : multicatchTypes) {
+                        boolean sub = types.isSubtype(ctype, t);
+                        boolean sup = types.isSubtype(t, ctype);
+                        if (sub || sup) {
+                            //assume 'a' <: 'b'
+                            Type a = sub ? ctype : t;
+                            Type b = sub ? t : ctype;
+                            log.error(typeTree.pos(), "multicatch.types.must.be.disjoint", a, b);
+                        }
+                    }
+                }
+                multicatchTypes.append(ctype);
+            }
         }
         tree.type = result = check(tree, types.lub(multicatchTypes.toList()), TYP, pkind, pt);
     }
@@ -3173,6 +3203,9 @@
         // method conform to the method they implement.
         chk.checkImplementations(tree);
 
+        //check that a resource implementing AutoCloseable cannot throw InterruptedException
+        checkAutoCloseable(tree.pos(), env, c.type);
+
         for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
             // Attribute declaration
             attribStat(l.head, env);
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Sun Apr 10 10:25:12 2011 -0700
@@ -676,7 +676,7 @@
                     "cant.apply.diamond.1",
                     t, diags.fragment("diamond.and.anon.class", t));
             return types.createErrorType(t);
-        } else if (!t.tsym.type.isParameterized()) {
+        } else if (t.tsym.type.getTypeArguments().isEmpty()) {
             log.error(tree.clazz.pos(),
                 "cant.apply.diamond.1",
                 t, diags.fragment("diamond.non.generic", t));
--- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Sun Apr 10 10:25:12 2011 -0700
@@ -788,8 +788,7 @@
             // Internally to java.lang.invoke, a @PolymorphicSignature annotation
             // acts like a classfile attribute.
             if (!c.type.isErroneous() &&
-                    (types.isSameType(c.type, syms.polymorphicSignatureType) ||
-                     types.isSameType(c.type, syms.transientPolymorphicSignatureType))) {
+                types.isSameType(c.type, syms.polymorphicSignatureType)) {
                 if (!target.hasMethodHandles()) {
                     // Somebody is compiling JDK7 source code to a JDK6 target.
                     // Make it an error, since it is unlikely but important.
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Sun Apr 10 10:25:12 2011 -0700
@@ -338,7 +338,11 @@
 
         // tvars is the list of formal type variables for which type arguments
         // need to inferred.
-        List<Type> tvars = env.info.tvars;
+        List<Type> tvars = null;
+        if (env.info.tvars != null) {
+            tvars = types.newInstances(env.info.tvars);
+            mt = types.subst(mt, env.info.tvars, tvars);
+        }
         if (typeargtypes == null) typeargtypes = List.nil();
         if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
             // This is not a polymorphic method, but typeargs are supplied
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1162,6 +1162,9 @@
         ClassSymbol c = readClassSymbol(nextChar());
         NameAndType nt = (NameAndType)readPool(nextChar());
 
+        if (c.members_field == null)
+            throw badClassFile("bad.enclosing.class", self, c);
+
         MethodSymbol m = findMethod(nt, c.members_field, self.flags());
         if (nt != null && m == null)
             throw badClassFile("bad.enclosing.method", self);
@@ -1318,8 +1321,7 @@
                 else
                     proxies.append(proxy);
                 if (majorVersion >= V51.major &&
-                        (proxy.type.tsym == syms.polymorphicSignatureType.tsym ||
-                         proxy.type.tsym == syms.transientPolymorphicSignatureType.tsym)) {
+                    proxy.type.tsym == syms.polymorphicSignatureType.tsym) {
                     sym.flags_field |= POLYMORPHIC_SIGNATURE;
                 }
             }
--- a/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/main/Main.java	Sun Apr 10 10:25:12 2011 -0700
@@ -65,9 +65,11 @@
     PrintWriter out;
 
     /**
-     * If true, any command line arg errors will cause an exception.
+     * If true, certain errors will cause an exception, such as command line
+     * arg errors, or exceptions in user provided code.
      */
-    boolean fatalErrors;
+    boolean apiMode;
+
 
     /** Result codes.
      */
@@ -163,7 +165,7 @@
     /** Report a usage error.
      */
     void error(String key, Object... args) {
-        if (fatalErrors) {
+        if (apiMode) {
             String msg = getLocalizedString(key, args);
             throw new PropagatedException(new IllegalStateException(msg));
         }
@@ -192,8 +194,8 @@
         this.options = options;
     }
 
-    public void setFatalErrors(boolean fatalErrors) {
-        this.fatalErrors = fatalErrors;
+    public void setAPIMode(boolean apiMode) {
+        this.apiMode = apiMode;
     }
 
     /** Process command line arguments: store all command line options
@@ -440,7 +442,9 @@
         } catch (FatalError ex) {
             feMessage(ex);
             return EXIT_SYSERR;
-        } catch(AnnotationProcessingError ex) {
+        } catch (AnnotationProcessingError ex) {
+            if (apiMode)
+                throw new RuntimeException(ex.getCause());
             apMessage(ex);
             return EXIT_SYSERR;
         } catch (ClientCodeException ex) {
@@ -458,7 +462,13 @@
                 bugMessage(ex);
             return EXIT_ABNORMAL;
         } finally {
-            if (comp != null) comp.close();
+            if (comp != null) {
+                try {
+                    comp.close();
+                } catch (ClientCodeException ex) {
+                    throw new RuntimeException(ex.getCause());
+                }
+            }
             filenames = null;
             options = null;
         }
--- a/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Sun Apr 10 10:25:12 2011 -0700
@@ -37,6 +37,7 @@
 import java.nio.CharBuffer;
 import java.nio.charset.CharsetDecoder;
 import java.nio.file.Files;
+import java.nio.file.LinkOption;
 import java.nio.file.Path;
 import java.nio.file.attribute.BasicFileAttributes;
 import javax.lang.model.element.Modifier;
@@ -170,7 +171,7 @@
         if (pn.equalsIgnoreCase(sn)) {
             try {
                 // allow for Windows
-                return path.toRealPath(false).getFileName().toString().equals(sn);
+                return path.toRealPath(LinkOption.NOFOLLOW_LINKS).getFileName().toString().equals(sn);
             } catch (IOException e) {
             }
         }
--- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Sun Apr 10 10:25:12 2011 -0700
@@ -971,7 +971,7 @@
             if ((mode & EXPR) != 0) {
                 mode = EXPR;
                 S.nextToken();
-                if (S.token() == LT) typeArgs = typeArguments();
+                if (S.token() == LT) typeArgs = typeArguments(false);
                 t = creator(pos, typeArgs);
                 typeArgs = null;
             } else return illegal();
@@ -1036,7 +1036,7 @@
                             mode = EXPR;
                             int pos1 = S.pos();
                             S.nextToken();
-                            if (S.token() == LT) typeArgs = typeArguments();
+                            if (S.token() == LT) typeArgs = typeArguments(false);
                             t = innerCreator(pos1, typeArgs, t);
                             typeArgs = null;
                             break loop;
@@ -1116,7 +1116,7 @@
                     mode = EXPR;
                     int pos2 = S.pos();
                     S.nextToken();
-                    if (S.token() == LT) typeArgs = typeArguments();
+                    if (S.token() == LT) typeArgs = typeArguments(false);
                     t = innerCreator(pos2, typeArgs, t);
                     typeArgs = null;
                 } else {
@@ -1146,7 +1146,7 @@
         } else {
             int pos = S.pos();
             accept(DOT);
-            typeArgs = (S.token() == LT) ? typeArguments() : null;
+            typeArgs = (S.token() == LT) ? typeArguments(false) : null;
             t = toP(F.at(pos).Select(t, ident()));
             t = argumentsOpt(typeArgs, t);
         }
@@ -1206,7 +1206,7 @@
             (mode & NOPARAMS) == 0) {
             mode = TYPE;
             checkGenerics();
-            return typeArguments(t);
+            return typeArguments(t, false);
         } else {
             return t;
         }
@@ -1223,51 +1223,54 @@
                 illegal();
             }
             mode = useMode;
-            return typeArguments();
+            return typeArguments(false);
         }
         return null;
     }
 
     /**  TypeArguments  = "<" TypeArgument {"," TypeArgument} ">"
      */
-    List<JCExpression> typeArguments() {
-        ListBuffer<JCExpression> args = lb();
+    List<JCExpression> typeArguments(boolean diamondAllowed) {
         if (S.token() == LT) {
             S.nextToken();
-            if (S.token() == GT && (mode & DIAMOND) != 0) {
+            if (S.token() == GT && diamondAllowed) {
                 checkDiamond();
+                mode |= DIAMOND;
                 S.nextToken();
                 return List.nil();
-            }
-            args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
-            while (S.token() == COMMA) {
-                S.nextToken();
+            } else {
+                ListBuffer<JCExpression> args = ListBuffer.lb();
                 args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
-            }
-            switch (S.token()) {
-            case GTGTGTEQ:
-                S.token(GTGTEQ);
-                break;
-            case GTGTEQ:
-                S.token(GTEQ);
-                break;
-            case GTEQ:
-                S.token(EQ);
-                break;
-            case GTGTGT:
-                S.token(GTGT);
-                break;
-            case GTGT:
-                S.token(GT);
-                break;
-            default:
-                accept(GT);
-                break;
+                while (S.token() == COMMA) {
+                    S.nextToken();
+                    args.append(((mode & EXPR) == 0) ? typeArgument() : parseType());
+                }
+                switch (S.token()) {
+                case GTGTGTEQ:
+                    S.token(GTGTEQ);
+                    break;
+                case GTGTEQ:
+                    S.token(GTEQ);
+                    break;
+                case GTEQ:
+                    S.token(EQ);
+                    break;
+                case GTGTGT:
+                    S.token(GTGT);
+                    break;
+                case GTGT:
+                    S.token(GT);
+                    break;
+                default:
+                    accept(GT);
+                    break;
+                }
+                return args.toList();
             }
         } else {
             syntaxError(S.pos(), "expected", LT);
+            return List.nil();
         }
-        return args.toList();
     }
 
     /** TypeArgument = Type
@@ -1303,9 +1306,9 @@
         }
     }
 
-    JCTypeApply typeArguments(JCExpression t) {
+    JCTypeApply typeArguments(JCExpression t, boolean diamondAllowed) {
         int pos = S.pos();
-        List<JCExpression> args = typeArguments();
+        List<JCExpression> args = typeArguments(diamondAllowed);
         return toP(F.at(pos).TypeApply(t, args));
     }
 
@@ -1370,18 +1373,25 @@
         }
         JCExpression t = qualident();
         int oldmode = mode;
-        mode = TYPE | DIAMOND;
+        mode = TYPE;
+        boolean diamondFound = false;
         if (S.token() == LT) {
             checkGenerics();
-            t = typeArguments(t);
+            t = typeArguments(t, true);
+            diamondFound = (mode & DIAMOND) != 0;
         }
         while (S.token() == DOT) {
+            if (diamondFound) {
+                //cannot select after a diamond
+                illegal(S.pos());
+            }
             int pos = S.pos();
             S.nextToken();
             t = toP(F.at(pos).Select(t, ident()));
             if (S.token() == LT) {
                 checkGenerics();
-                t = typeArguments(t);
+                t = typeArguments(t, true);
+                diamondFound = (mode & DIAMOND) != 0;
             }
         }
         mode = oldmode;
@@ -1416,9 +1426,8 @@
         JCExpression t = toP(F.at(S.pos()).Ident(ident()));
         if (S.token() == LT) {
             int oldmode = mode;
-            mode |= DIAMOND;
             checkGenerics();
-            t = typeArguments(t);
+            t = typeArguments(t, true);
             mode = oldmode;
         }
         return classCreatorRest(newpos, encl, typeArgs, t);
--- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Sun Apr 10 10:25:12 2011 -0700
@@ -34,8 +34,8 @@
 import java.io.File;
 import java.io.PrintWriter;
 import java.io.IOException;
+import java.io.StringWriter;
 import java.net.MalformedURLException;
-import java.io.StringWriter;
 
 import javax.annotation.processing.*;
 import javax.lang.model.SourceVersion;
@@ -58,6 +58,7 @@
 import com.sun.tools.javac.file.FSInfo;
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.jvm.*;
+import com.sun.tools.javac.jvm.ClassReader.BadClassFile;
 import com.sun.tools.javac.main.JavaCompiler;
 import com.sun.tools.javac.main.JavaCompiler.CompileState;
 import com.sun.tools.javac.model.JavacElements;
@@ -67,6 +68,7 @@
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.util.Abort;
 import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.ClientCodeException;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Convert;
 import com.sun.tools.javac.util.FatalError;
@@ -432,6 +434,8 @@
                             log.error("proc.processor.cant.instantiate", processorName);
                             return false;
                         }
+                    } catch(ClientCodeException e) {
+                        throw e;
                     } catch(Throwable t) {
                         throw new AnnotationProcessingError(t);
                     }
@@ -527,6 +531,8 @@
                         supportedOptionNames.add(optionName);
                 }
 
+            } catch (ClientCodeException e) {
+                throw e;
             } catch (Throwable t) {
                 throw new AnnotationProcessingError(t);
             }
@@ -785,11 +791,16 @@
                                          RoundEnvironment renv) {
         try {
             return proc.process(tes, renv);
+        } catch (BadClassFile ex) {
+            log.error("proc.cant.access.1", ex.sym, ex.getDetailValue());
+            return false;
         } catch (CompletionFailure ex) {
             StringWriter out = new StringWriter();
             ex.printStackTrace(new PrintWriter(out));
             log.error("proc.cant.access", ex.sym, ex.getDetailValue(), out.toString());
             return false;
+        } catch (ClientCodeException e) {
+            throw e;
         } catch (Throwable t) {
             throw new AnnotationProcessingError(t);
         }
@@ -1061,6 +1072,11 @@
             PrintWriter out = context.get(Log.outKey);
             Assert.checkNonNull(out);
             next.put(Log.outKey, out);
+            Locale locale = context.get(Locale.class);
+            if (locale != null)
+                next.put(Locale.class, locale);
+            Assert.checkNonNull(messages);
+            next.put(JavacMessages.messagesKey, messages);
 
             final boolean shareNames = true;
             if (shareNames) {
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Sun Apr 10 10:25:12 2011 -0700
@@ -302,6 +302,11 @@
 compiler.err.multicatch.parameter.may.not.be.assigned=\
     multi-catch parameter {0} may not be assigned
 
+# 0: type, 1: type
+compiler.err.multicatch.types.must.be.disjoint=\
+    Alternatives in a multi-catch statement cannot be related by subclassing\n\
+    Alternative {0} is a subclass of alternative {1}
+
 compiler.err.finally.without.try=\
     ''finally'' without ''try''
 
@@ -606,12 +611,18 @@
 
 # Errors related to annotation processing
 
+# 0: symbol, 1: string, 2: stack-trace
 compiler.err.proc.cant.access=\
     cannot access {0}\n\
     {1}\n\
     Consult the following stack trace for details.\n\
     {2}
 
+# 0: symbol, 1: string
+compiler.err.proc.cant.access.1=\
+    cannot access {0}\n\
+    {1}
+
 # 0: string
 compiler.err.proc.cant.find.class=\
     Could not find class file for ''{0}''.
@@ -1239,6 +1250,10 @@
 compiler.warn.try.resource.not.referenced=\
     auto-closeable resource {0} is never referenced in body of corresponding try statement
 
+# 0: type
+compiler.warn.try.resource.throws.interrupted.exc=\
+    auto-closeable resource {0} has a member method close() that could throw InterruptedException
+
 compiler.warn.unchecked.assign=\
     unchecked assignment: {0} to {1}
 
@@ -1415,8 +1430,13 @@
 compiler.misc.bad.class.signature=\
     bad class signature: {0}
 
+#0: symbol, 1: symbol
+compiler.misc.bad.enclosing.class=\
+    bad enclosing class for {0}: {1}
+
+# 0: symbol
 compiler.misc.bad.enclosing.method=\
-    bad enclosing method attribute: {0}
+    bad enclosing method attribute for class {0}
 
 compiler.misc.bad.runtime.invisible.param.annotations=\
     bad RuntimeInvisibleParameterAnnotations attribute: {0}
--- a/src/share/classes/com/sun/tools/javac/util/JavacMessages.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/util/JavacMessages.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -44,7 +44,7 @@
  */
 public class JavacMessages implements Messages {
     /** The context key for the JavacMessages object. */
-    protected static final Context.Key<JavacMessages> messagesKey =
+    public static final Context.Key<JavacMessages> messagesKey =
         new Context.Key<JavacMessages>();
 
     /** Get the JavacMessages instance for this context. */
@@ -77,7 +77,7 @@
     /** Creates a JavacMessages object.
      */
     public JavacMessages(Context context) {
-        this(defaultBundleName);
+        this(defaultBundleName, context.get(Locale.class));
         context.put(messagesKey, this);
     }
 
@@ -85,10 +85,17 @@
      * @param bundleName the name to identify the resource buundle of localized messages.
      */
     public JavacMessages(String bundleName) throws MissingResourceException {
+        this(bundleName, null);
+    }
+
+    /** Creates a JavacMessages object.
+     * @param bundleName the name to identify the resource buundle of localized messages.
+     */
+    public JavacMessages(String bundleName, Locale locale) throws MissingResourceException {
         bundleNames = List.nil();
         bundleCache = new HashMap<Locale, SoftReference<List<ResourceBundle>>>();
         add(bundleName);
-        setCurrentLocale(Locale.getDefault());
+        setCurrentLocale(locale);
     }
 
     public JavacMessages() throws MissingResourceException {
--- a/src/share/classes/com/sun/tools/javac/util/Log.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/util/Log.java	Sun Apr 10 10:25:12 2011 -0700
@@ -425,13 +425,8 @@
      */
     protected void writeDiagnostic(JCDiagnostic diag) {
         if (diagListener != null) {
-            try {
-                diagListener.report(diag);
-                return;
-            }
-            catch (Throwable t) {
-                throw new ClientCodeException(t);
-            }
+            diagListener.report(diag);
+            return;
         }
 
         PrintWriter writer = getWriterForDiagnosticType(diag.getType());
--- a/src/share/classes/com/sun/tools/javac/util/Names.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javac/util/Names.java	Sun Apr 10 10:25:12 2011 -0700
@@ -73,7 +73,6 @@
     public final Name java_io_Serializable;
     public final Name serialVersionUID;
     public final Name java_lang_Enum;
-    public final Name transient_java_dyn_MethodHandle; // transient - 292
     public final Name java_lang_invoke_MethodHandle;
     public final Name package_info;
     public final Name ConstantValue;
@@ -184,7 +183,6 @@
         java_lang_Cloneable = fromString("java.lang.Cloneable");
         java_io_Serializable = fromString("java.io.Serializable");
         java_lang_Enum = fromString("java.lang.Enum");
-        transient_java_dyn_MethodHandle = fromString("java.dyn.MethodHandle"); //transient - 292
         java_lang_invoke_MethodHandle = fromString("java.lang.invoke.MethodHandle");
         package_info = fromString("package-info");
         serialVersionUID = fromString("serialVersionUID");
--- a/src/share/classes/com/sun/tools/javap/ClassWriter.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/src/share/classes/com/sun/tools/javap/ClassWriter.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -48,6 +48,13 @@
 import com.sun.tools.classfile.Signature_attribute;
 import com.sun.tools.classfile.SourceFile_attribute;
 import com.sun.tools.classfile.Type;
+import com.sun.tools.classfile.Type.ArrayType;
+import com.sun.tools.classfile.Type.ClassSigType;
+import com.sun.tools.classfile.Type.ClassType;
+import com.sun.tools.classfile.Type.MethodType;
+import com.sun.tools.classfile.Type.SimpleType;
+import com.sun.tools.classfile.Type.TypeParamType;
+import com.sun.tools.classfile.Type.WildcardType;
 
 import static com.sun.tools.classfile.AccessFlags.*;
 
@@ -166,8 +173,10 @@
             // use info from class file header
             if (classFile.isClass() && classFile.super_class != 0 ) {
                 String sn = getJavaSuperclassName(cf);
-                print(" extends ");
-                print(sn);
+                if (!sn.equals("java.lang.Object")) {
+                    print(" extends ");
+                    print(sn);
+                }
             }
             for (int i = 0; i < classFile.interfaces.length; i++) {
                 print(i == 0 ? (classFile.isClass() ? " implements " : " extends ") : ",");
@@ -176,13 +185,14 @@
         } else {
             try {
                 Type t = sigAttr.getParsedSignature().getType(constant_pool);
+                JavaTypePrinter p = new JavaTypePrinter(classFile.isInterface());
                 // The signature parser cannot disambiguate between a
                 // FieldType and a ClassSignatureType that only contains a superclass type.
-                if (t instanceof Type.ClassSigType)
-                    print(getJavaName(t.toString()));
-                else {
+                if (t instanceof Type.ClassSigType) {
+                    print(p.print(t));
+                } else if (options.verbose || !t.isObject()) {
                     print(" extends ");
-                    print(getJavaName(t.toString()));
+                    print(p.print(t));
                 }
             } catch (ConstantPoolException e) {
                 print(report(e));
@@ -210,6 +220,124 @@
         indent(-1);
         println("}");
     }
+    // where
+        class JavaTypePrinter implements Type.Visitor<StringBuilder,StringBuilder> {
+            boolean isInterface;
+
+            JavaTypePrinter(boolean isInterface) {
+                this.isInterface = isInterface;
+            }
+
+            String print(Type t) {
+                return t.accept(this, new StringBuilder()).toString();
+            }
+
+            public StringBuilder visitSimpleType(SimpleType type, StringBuilder sb) {
+                sb.append(getJavaName(type.name));
+                return sb;
+            }
+
+            public StringBuilder visitArrayType(ArrayType type, StringBuilder sb) {
+                append(sb, type.elemType);
+                sb.append("[]");
+                return sb;
+            }
+
+            public StringBuilder visitMethodType(MethodType type, StringBuilder sb) {
+                appendIfNotEmpty(sb, "<", type.typeParamTypes, "> ");
+                append(sb, type.returnType);
+                append(sb, " (", type.paramTypes, ")");
+                appendIfNotEmpty(sb, " throws ", type.throwsTypes, "");
+                return sb;
+            }
+
+            public StringBuilder visitClassSigType(ClassSigType type, StringBuilder sb) {
+                appendIfNotEmpty(sb, "<", type.typeParamTypes, ">");
+                if (isInterface) {
+                    appendIfNotEmpty(sb, " extends ", type.superinterfaceTypes, "");
+                } else {
+                    if (type.superclassType != null
+                            && (options.verbose || !type.superclassType.isObject())) {
+                        sb.append(" extends ");
+                        append(sb, type.superclassType);
+                    }
+                    appendIfNotEmpty(sb, " implements ", type.superinterfaceTypes, "");
+                }
+                return sb;
+            }
+
+            public StringBuilder visitClassType(ClassType type, StringBuilder sb) {
+                if (type.outerType != null) {
+                    append(sb, type.outerType);
+                    sb.append(".");
+                }
+                sb.append(getJavaName(type.name));
+                appendIfNotEmpty(sb, "<", type.typeArgs, ">");
+                return sb;
+            }
+
+            public StringBuilder visitTypeParamType(TypeParamType type, StringBuilder sb) {
+                sb.append(type.name);
+                String sep = " extends ";
+                if (type.classBound != null
+                        && (options.verbose || !type.classBound.isObject())) {
+                    sb.append(sep);
+                    append(sb, type.classBound);
+                    sep = " & ";
+                }
+                if (type.interfaceBounds != null) {
+                    for (Type bound: type.interfaceBounds) {
+                        sb.append(sep);
+                        append(sb, bound);
+                        sep = " & ";
+                    }
+                }
+                return sb;
+            }
+
+            public StringBuilder visitWildcardType(WildcardType type, StringBuilder sb) {
+                switch (type.kind) {
+                    case UNBOUNDED:
+                        sb.append("?");
+                        break;
+                    case EXTENDS:
+                        sb.append("? extends ");
+                        append(sb, type.boundType);
+                        break;
+                    case SUPER:
+                        sb.append("? super ");
+                        append(sb, type.boundType);
+                        break;
+                    default:
+                        throw new AssertionError();
+                }
+                return sb;
+            }
+
+            private void append(StringBuilder sb, Type t) {
+                t.accept(this, sb);
+            }
+
+            private void append(StringBuilder sb, String prefix, List<? extends Type> list, String suffix) {
+                sb.append(prefix);
+                String sep = "";
+                for (Type t: list) {
+                    sb.append(sep);
+                    append(sb, t);
+                    sep = ", ";
+                }
+                sb.append(suffix);
+            }
+
+            private void appendIfNotEmpty(StringBuilder sb, String prefix, List<? extends Type> list, String suffix) {
+                if (!isEmpty(list))
+                    append(sb, prefix, list, suffix);
+            }
+
+            private boolean isEmpty(List<? extends Type> list) {
+                return (list == null || list.isEmpty());
+            }
+        }
 
     protected void writeFields() {
         for (Field f: classFile.fields) {
@@ -298,7 +426,7 @@
             try {
                 methodType = (Type.MethodType) methodSig.getType(constant_pool);
                 methodExceptions = methodType.throwsTypes;
-                if (methodExceptions != null && methodExceptions.size() == 0)
+                if (methodExceptions != null && methodExceptions.isEmpty())
                     methodExceptions = null;
             } catch (ConstantPoolException e) {
                 // report error?
--- a/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -27,8 +27,7 @@
  * @summary  <DESC>
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestDeprecatedDocs
+ * @build    JavadocTester TestDeprecatedDocs
  * @run main TestDeprecatedDocs
  */
 
@@ -77,7 +76,7 @@
         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"},
 
         {TARGET_FILE2, "<pre>@Deprecated" + NL +
-                 "public class <strong>DeprecatedClassByAnnotation</strong>" + NL +
+                 "public class <span class=\"strong\">DeprecatedClassByAnnotation</span>" + NL +
                  "extends java.lang.Object</pre>"},
 
         {TARGET_FILE2, "<pre>@Deprecated" + NL +
--- a/test/com/sun/javadoc/testHref/TestHref.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/com/sun/javadoc/testHref/TestHref.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -27,8 +27,7 @@
  * @summary  Verify that spaces do not appear in hrefs and anchors.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestHref
+ * @build    JavadocTester TestHref
  * @run main TestHref
  */
 
@@ -81,7 +80,7 @@
 
         //Signature does not link to the page itself.
         {BUG_ID + FS + "pkg" + FS + "C4.html",
-            "public abstract class <strong>C4&lt;E extends C4&lt;E&gt;&gt;</strong>"
+            "public abstract class <span class=\"strong\">C4&lt;E extends C4&lt;E&gt;&gt;</span>"
         },
     };
     private static final String[][] NEGATED_TEST =
--- a/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,8 +29,7 @@
  * @summary This test verifies the nesting of definition list tags.
  * @author Bhavesh Patel
  * @library ../lib/
- * @build JavadocTester
- * @build TestHtmlDefinitionListTag
+ * @build JavadocTester TestHtmlDefinitionListTag
  * @run main TestHtmlDefinitionListTag
  */
 
@@ -43,7 +42,8 @@
     // Optional Element should print properly nested definition list tags
     // for default value.
     private static final String[][] TEST_ALL = {
-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<pre>public class <strong>C1</strong>" + NL +
+        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<pre>public class " +
+                 "<span class=\"strong\">C1</span>" + NL +
                  "extends java.lang.Object" + NL + "implements java.io.Serializable</pre>"},
         {BUG_ID + FS + "pkg1" + FS + "C4.html", "<dl>" + NL +
                  "<dt>Default:</dt>" + NL + "<dd>true</dd>" + NL +
--- a/test/com/sun/javadoc/testJavascript/TestJavascript.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/com/sun/javadoc/testJavascript/TestJavascript.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4665566 4855876
+ * @bug      4665566 4855876 7025314
  * @summary  Verify that the output has the right javascript.
  * @author   jamieh
  * @library  ../lib/
@@ -45,9 +45,9 @@
     //Input for string search tests.
     private static final String[][] TEST = {
         {BUG_ID + FS + "pkg" + FS + "C.html",
-            "<a href=\"../index.html?pkg/C.html\" target=\"_top\">FRAMES</a>"},
+            "<a href=\"../index.html?pkg/C.html\" target=\"_top\">Frames</a>"},
         {BUG_ID + FS + "TestJavascript.html",
-            "<a href=\"index.html?TestJavascript.html\" target=\"_top\">FRAMES</a>"},
+            "<a href=\"index.html?TestJavascript.html\" target=\"_top\">Frames</a>"},
         {BUG_ID + FS + "index.html",
             "<script type=\"text/javascript\">" + NL +
                         "    targetPage = \"\" + window.location.search;" + NL +
--- a/test/com/sun/javadoc/testLinkOption/TestLinkOption.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/com/sun/javadoc/testLinkOption/TestLinkOption.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -28,8 +28,7 @@
  * right files.
  * @author jamieh
  * @library ../lib/
- * @build JavadocTester
- * @build TestLinkOption
+ * @build JavadocTester TestLinkOption
  * @run main TestLinkOption
  */
 
@@ -62,7 +61,7 @@
                                 "Object</a>&nbsp;p3)"
         },
         {BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html",
-                "<pre>public abstract class <strong>StringBuilderChild</strong>" + NL +
+                "<pre>public abstract class <span class=\"strong\">StringBuilderChild</span>" + NL +
                 "extends <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" " +
                 "title=\"class or interface in java.lang\">Object</a></pre>"
         },
--- a/test/com/sun/javadoc/testNavagation/TestNavagation.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/com/sun/javadoc/testNavagation/TestNavagation.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4131628 4664607
+ * @bug      4131628 4664607 7025314
  * @summary  Make sure the Next/Prev Class links iterate through all types.
  *           Make sure the navagation is 2 columns, not 3.
  * @author   jamieh
@@ -45,20 +45,20 @@
 
     //Input for string search tests.
     private static final String[][] TEST = {
-        {BUG_ID + FS + "pkg" + FS + "A.html", "<li>PREV CLASS</li>"},
+        {BUG_ID + FS + "pkg" + FS + "A.html", "<li>Prev Class</li>"},
         {BUG_ID + FS + "pkg" + FS + "A.html",
-            "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">NEXT CLASS</span></a>"},
+            "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Next Class</span></a>"},
         {BUG_ID + FS + "pkg" + FS + "C.html",
-            "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"strong\">PREV CLASS</span></a>"},
+            "<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"strong\">Prev Class</span></a>"},
         {BUG_ID + FS + "pkg" + FS + "C.html",
-            "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">NEXT CLASS</span></a>"},
+            "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Next Class</span></a>"},
         {BUG_ID + FS + "pkg" + FS + "E.html",
-            "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">PREV CLASS</span></a>"},
+            "<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"strong\">Prev Class</span></a>"},
         {BUG_ID + FS + "pkg" + FS + "E.html",
-            "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"strong\">NEXT CLASS</span></a>"},
+            "<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"strong\">Next Class</span></a>"},
         {BUG_ID + FS + "pkg" + FS + "I.html",
-            "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">PREV CLASS</span></a>"},
-        {BUG_ID + FS + "pkg" + FS + "I.html", "<li>NEXT CLASS</li>"},
+            "<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"strong\">Prev Class</span></a>"},
+        {BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"},
         // Test for 4664607
         {BUG_ID + FS + "pkg" + FS + "I.html",
             "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a><a name=\"navbar_top_firstrow\">" + NL +
--- a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,14 +23,13 @@
 
 /*
  * @test
- * @bug      4789689 4905985 4927164 4827184 4993906 5004549
+ * @bug      4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344
  * @summary  Run Javadoc on a set of source files that demonstrate new
  *           language features.  Check the output to ensure that the new
  *           language features are properly documented.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestNewLanguageFeatures
+ * @build    JavadocTester TestNewLanguageFeatures
  * @run main TestNewLanguageFeatures
  */
 
@@ -53,9 +52,10 @@
             //Make sure enum header is correct.
             {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Coin</h2>"},
             //Make sure enum signature is correct.
-            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<pre>public enum <strong>Coin</strong>" + NL +
-                "extends java.lang.Enum&lt;<a href=\"../pkg/Coin.html\" " +
-                "title=\"enum in pkg\">Coin</a>&gt;</pre>"
+            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<pre>public enum " +
+                     "<span class=\"strong\">Coin</span>" + NL +
+                     "extends java.lang.Enum&lt;<a href=\"../pkg/Coin.html\" " +
+                     "title=\"enum in pkg\">Coin</a>&gt;</pre>"
             },
             //Check for enum constant section
             {BUG_ID + FS + "pkg" + FS + "Coin.html", "<caption><span>Enum Constants" +
@@ -118,8 +118,8 @@
 
             //Signature of subclass that has type parameters.
             {BUG_ID + FS + "pkg" + FS + "TypeParameterSubClass.html",
-                "<pre>public class <strong>TypeParameterSubClass&lt;T extends " +
-                "java.lang.String&gt;</strong>" + NL + "extends " +
+                "<pre>public class <span class=\"strong\">TypeParameterSubClass&lt;T extends " +
+                "java.lang.String&gt;</span>" + NL + "extends " +
                 "<a href=\"../pkg/TypeParameterSuperClass.html\" title=\"class in pkg\">" +
                 "TypeParameterSuperClass</a>&lt;T&gt;</pre>"},
 
@@ -155,20 +155,20 @@
             //=================================
             //Make sure the summary links are correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
-                "<li>SUMMARY:&nbsp;</li>" + NL +
+                "<li>Summary:&nbsp;</li>" + NL +
                 "<li><a href=\"#annotation_type_required_element_summary\">" +
-                "REQUIRED</a>&nbsp;|&nbsp;</li>" + NL + "<li>" +
-                "<a href=\"#annotation_type_optional_element_summary\">OPTIONAL</a></li>"},
+                "Required</a>&nbsp;|&nbsp;</li>" + NL + "<li>" +
+                "<a href=\"#annotation_type_optional_element_summary\">Optional</a></li>"},
             //Make sure the detail links are correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
-                "<li>DETAIL:&nbsp;</li>" + NL +
-                "<li><a href=\"#annotation_type_element_detail\">ELEMENT</a></li>"},
+                "<li>Detail:&nbsp;</li>" + NL +
+                "<li><a href=\"#annotation_type_element_detail\">Element</a></li>"},
             //Make sure the heading is correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
                 "Annotation Type AnnotationType</h2>"},
             //Make sure the signature is correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
-                "public @interface <strong>AnnotationType</strong>"},
+                "public @interface <span class=\"strong\">AnnotationType</span>"},
             //Make sure member summary headings are correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
                 "<h3>Required Element Summary</h3>"},
@@ -198,8 +198,8 @@
                 "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
                 "=\"Class Annotation\"," + NL +
                 "                <a href=\"../pkg/AnnotationType.html#required()\">" +
-                "required</a>=1994)" + NL + "public class <strong>" +
-                "AnnotationTypeUsage</strong>" + NL + "extends java.lang.Object</pre>"},
+                "required</a>=1994)" + NL + "public class <span class=\"strong\">" +
+                "AnnotationTypeUsage</span>" + NL + "extends java.lang.Object</pre>"},
 
             //FIELD
             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
@@ -299,7 +299,7 @@
             {BUG_ID + FS + "pkg1" + FS + "B.html",
                 "<pre><a href=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</a>"},
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "public interface <strong>B</strong></pre>"},
+                "public interface <span class=\"strong\">B</span></pre>"},
 
 
             //==============================================================
@@ -320,9 +320,11 @@
                      "Foo</a></span><span class=\"tabEnd\">&nbsp;</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
-                     "ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1" +
-                     "&lt;T extends Foo & Foo2&gt;</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest1.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest1</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" +
+                     "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" +
+                     "Foo2</a>&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -370,10 +372,11 @@
                     "</span></caption>"
            },
            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
-                    "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
-                    "ClassUseTest1.html\" title=\"class in pkg2\">" +
-                    "ClassUseTest1&lt;T extends Foo & Foo2&gt;</a></strong>" +
-                    "</code>&nbsp;</td>"
+                    "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest1.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest1</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" +
+                     "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" +
+                     "Foo2</a>&gt;</strong></code>&nbsp;</td>"
            },
            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
                     "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -398,10 +401,11 @@
                      "&nbsp;</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
-                     "ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2&lt;T " +
-                     "extends ParamTest&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class " +
-                     "in pkg2\">Foo3</a>&gt;&gt;</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest2.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest2</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" +
+                     "ParamTest</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
+                     "Foo3</a>&gt;&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -452,11 +456,11 @@
                      "Foo3</a></span><span class=\"tabEnd\">&nbsp;</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../" +
-                     "pkg2/ClassUseTest2.html\" title=\"class in pkg2\">" +
-                     "ClassUseTest2&lt;T extends ParamTest&lt;<a href=\"../../" +
-                     "pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</a>&gt;&gt;" +
-                     "</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest2.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest2</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" +
+                     "ParamTest</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
+                     "Foo3</a>&gt;&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -496,10 +500,12 @@
                      "&nbsp;</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
-                     "ClassUseTest3.html\" title=\"class in pkg2\">" +
-                     "ClassUseTest3&lt;T extends ParamTest2&lt;java.util.List" +
-                     "&lt;? extends Foo4&gt;&gt;&gt;</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest3.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest3</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
+                     "ParamTest2</a>&lt;java.util.List&lt;? extends " +
+                     "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
+                     "Foo4</a>&gt;&gt;&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -532,10 +538,12 @@
                      "</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../" +
-                     "pkg2/ClassUseTest3.html\" title=\"class in pkg2\">" +
-                     "ClassUseTest3&lt;T extends ParamTest2&lt;java.util.List" +
-                     "&lt;? extends Foo4&gt;&gt;&gt;</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest3.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest3</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
+                     "ParamTest2</a>&lt;java.util.List&lt;? extends " +
+                     "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
+                     "Foo4</a>&gt;&gt;&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,71 @@
+/*
+ * 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 7001086
+ * @summary Test Non-frame warning.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestNonFrameWarning
+ * @run main TestNonFrameWarning
+ */
+
+public class TestNonFrameWarning extends JavadocTester {
+
+    private static final String BUG_ID = "7001086";
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "index.html",
+            "<p>This document is designed to be viewed using the frames feature. " +
+            "If you see this message, you are using a non-frame-capable web client. " +
+            "Link to <a href=\"pkg/package-summary.html\">Non-frame version</a>.</p>"
+        }
+    };
+    private static final String[] ARGS = new String[]{
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestNonFrameWarning tester = new TestNonFrameWarning();
+        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/testNonFrameWarning/pkg/C.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+/**
+ * Source file for C
+ */
+public class C {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testSubTitle/TestSubTitle.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,83 @@
+/*
+ * 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 7010342
+ * @summary Test for correct sub title generation.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester
+ * @build TestSubTitle
+ * @run main TestSubTitle
+ */
+
+public class TestSubTitle extends JavadocTester {
+
+    private static final String BUG_ID = "7010342";
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg" + FS + "package-summary.html",
+            "<div class=\"subTitle\">" + NL + "<div class=\"block\">This is the " +
+            "description of package pkg.</div>" + NL + "</div>"
+        },
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<div class=\"subTitle\">pkg</div>"
+        }
+    };
+    private static final String[][] NEG_TEST = {
+        {BUG_ID + FS + "pkg" + FS + "package-summary.html",
+            "<p class=\"subTitle\">" + NL + "<div class=\"block\">This is the " +
+            "description of package pkg.</div>" + NL + "</p>"
+        },
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<p class=\"subTitle\">pkg</p>"
+        }
+    };
+    private static final String[] ARGS = new String[]{
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestSubTitle tester = new TestSubTitle();
+        run(tester, ARGS, TEST, NEG_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/testSubTitle/pkg/C.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+/**
+ * Source file for C
+ */
+public class C {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testSubTitle/pkg/package.html	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,8 @@
+<html lang="en">
+<head>
+    <title>Package Summary</title>
+</head>
+<body>
+This is the description of package pkg.
+</body>
+</html>
--- a/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,55 +23,77 @@
 
 /*
  * @test
- * @bug      4927167 4974929
+ * @bug      4927167 4974929 7010344
  * @summary  When the type parameters are more than 10 characters in length,
  *           make sure there is a line break between type params and return type
- *           in member summary.
+ *           in member summary. Also, test for type parameter links in package-summary and
+ *           class-use pages. The class/annotation pages should check for type
+ *           parameter links in the class/annotation signature section when -linksource is set.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestTypeParameters
+ * @build    JavadocTester TestTypeParameters
  * @run main TestTypeParameters
  */
 
 public class TestTypeParameters extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "4927167-4974929";
+    private static final String BUG_ID = "4927167-4974929-7010344";
 
     //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR,
-            "pkg"
+    private static final String[] ARGS1 = new String[]{
+        "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR,
+        "pkg"
+    };
+    private static final String[] ARGS2 = new String[]{
+        "-d", BUG_ID, "-linksource", "-source", "1.5", "-sourcepath", SRC_DIR,
+        "pkg"
     };
 
     //Input for string search tests.
-    private static final String[][] TEST =
-    {
+    private static final String[][] TEST1 = {
         {BUG_ID + FS + "pkg" + FS + "C.html",
             "<td class=\"colFirst\"><code>&lt;W extends java.lang.String,V extends " +
-            "java.util.List&gt;&nbsp;<br>java.lang.Object</code></td>"},
+            "java.util.List&gt;&nbsp;<br>java.lang.Object</code></td>"
+        },
         {BUG_ID + FS + "pkg" + FS + "C.html",
-            "<code>&lt;T&gt;&nbsp;java.lang.Object</code>"},
+            "<code>&lt;T&gt;&nbsp;java.lang.Object</code>"
+        },
         {BUG_ID + FS + "pkg" + FS + "package-summary.html",
-            "C&lt;E extends Parent&gt;"},
+            "C</a>&lt;E extends <a href=\"../pkg/Parent.html\" " +
+            "title=\"class in pkg\">Parent</a>&gt;"
+        },
+        {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "Foo4.html",
+            "<a href=\"../../pkg/ClassUseTest3.html\" title=\"class in pkg\">" +
+            "ClassUseTest3</a>&lt;T extends <a href=\"../../pkg/ParamTest2.html\" " +
+            "title=\"class in pkg\">ParamTest2</a>&lt;java.util.List&lt;? extends " +
+            "<a href=\"../../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>&gt;&gt;&gt;"
+        },
         //Nested type parameters
         {BUG_ID + FS + "pkg" + FS + "C.html",
             "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL +
             "<!--   -->" + NL +
-            "</a>"},
-
+            "</a>"
+        },
+    };
+    private static final String[][] TEST2 = {
+        {BUG_ID + FS + "pkg" + FS + "ClassUseTest3.html",
+            "public class <a href=\"../src-html/pkg/ClassUseTest3.html#line.28\">" +
+            "ClassUseTest3</a>&lt;T extends <a href=\"../pkg/ParamTest2.html\" " +
+            "title=\"class in pkg\">ParamTest2</a>&lt;java.util.List&lt;? extends " +
+            "<a href=\"../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>&gt;&gt;&gt;"
+        }
     };
     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) {
         TestTypeParameters tester = new TestTypeParameters();
-        run(tester, ARGS, TEST, NEGATED_TEST);
+        run(tester, ARGS1, TEST1, NEGATED_TEST);
+        run(tester, ARGS2, TEST2, NEGATED_TEST);
         tester.printSummary();
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testTypeParams/pkg/ClassUseTest3.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+import java.util.*;
+
+public class ClassUseTest3 <T extends ParamTest2<List<? extends Foo4>>> {
+
+    public ClassUseTest3(Set<Foo4> p) {}
+
+    public <T extends ParamTest2<List<? extends Foo4>>> ParamTest2<List<? extends Foo4>> method(T t) {
+        return null;
+    }
+
+    public void method(Set<Foo4> p) {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testTypeParams/pkg/Foo4.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public class Foo4 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testTypeParams/pkg/ParamTest2.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public class ParamTest2<E> {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/TryWithResources/InterruptedExceptionTest.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,234 @@
+/*
+ * 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 7027157
+ * @summary Project Coin: javac warnings for AutoCloseable.close throwing InterruptedException
+ */
+
+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 InterruptedExceptionTest {
+
+    enum XlintOption {
+        NONE("none"),
+        TRY("try");
+
+        String opt;
+
+        XlintOption(String opt) {
+            this.opt = opt;
+        }
+
+        String getXlintOption() {
+            return "-Xlint:" + opt;
+        }
+    }
+
+    enum SuppressLevel {
+        NONE,
+        SUPPRESS;
+
+        String getSuppressAnno() {
+            return this == SUPPRESS ?
+                "@SuppressWarnings(\"try\")" :
+                "";
+        }
+    }
+
+    enum ClassKind {
+        ABSTRACT_CLASS("abstract class", "implements", false),
+        CLASS("class", "implements", true),
+        INTERFACE("interface", "extends", false);
+
+        String kindName;
+        String extendsClause;
+        boolean hasBody;
+
+        private ClassKind(String kindName, String extendsClause, boolean hasBody) {
+            this.kindName = kindName;
+            this.extendsClause = extendsClause;
+            this.hasBody = hasBody;
+        }
+
+        String getBody() {
+            return hasBody ? "{}" : ";";
+        }
+    }
+
+    enum ExceptionKind {
+        NONE("", false),
+        EXCEPTION("Exception", true),
+        INTERRUPTED_EXCEPTION("InterruptedException", true),
+        ILLEGAL_ARGUMENT_EXCEPTION("IllegalArgumentException", false),
+        X("X", false);
+
+        String exName;
+        boolean shouldWarn;
+
+        private ExceptionKind(String exName, boolean shouldWarn) {
+            this.exName = exName;
+            this.shouldWarn = shouldWarn;
+        }
+
+        String getThrowsClause() {
+            return this == NONE ? "" : "throws " + exName;
+        }
+
+        String getTypeArguments(ExceptionKind decl) {
+            return (decl != X || this == NONE) ? "" : "<" + exName + ">";
+        }
+
+        String getTypeParameter() {
+            return this == X ? "<X extends Exception>" : "";
+        }
+    }
+
+    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 (XlintOption xlint : XlintOption.values()) {
+            for (SuppressLevel suppress_decl : SuppressLevel.values()) {
+                for (SuppressLevel suppress_use : SuppressLevel.values()) {
+                    for (ClassKind ck : ClassKind.values()) {
+                        for (ExceptionKind ek_decl : ExceptionKind.values()) {
+                            for (ExceptionKind ek_use : ExceptionKind.values()) {
+                                new InterruptedExceptionTest(xlint, suppress_decl,
+                                        suppress_use, ck, ek_decl, ek_use).run(comp, fm);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    XlintOption xlint;
+    SuppressLevel suppress_decl;
+    SuppressLevel suppress_use;
+    ClassKind ck;
+    ExceptionKind ek_decl;
+    ExceptionKind ek_use;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    InterruptedExceptionTest(XlintOption xlint, SuppressLevel suppress_decl, SuppressLevel suppress_use,
+            ClassKind ck, ExceptionKind ek_decl, ExceptionKind ek_use) {
+        this.xlint = xlint;
+        this.suppress_decl = suppress_decl;
+        this.suppress_use = suppress_use;
+        this.ck = ck;
+        this.ek_decl = ek_decl;
+        this.ek_use = ek_use;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "#S1 #CK Resource#G #EC AutoCloseable {\n" +
+                              "public void close() #TK #BK\n" +
+                          "}\n" +
+                          "class Test {\n" +
+                              "#S2 <X> void test() {\n" +
+                                 "try (Resource#PK r = null) { }\n" +
+                              "}\n" +
+                          "}\n";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replace("#S1", suppress_decl.getSuppressAnno())
+                    .replace("#S2", suppress_use.getSuppressAnno())
+                    .replace("#CK", ck.kindName)
+                    .replace("#EC", ck.extendsClause)
+                    .replace("#G", ek_decl.getTypeParameter())
+                    .replace("#TK", ek_decl.getThrowsClause())
+                    .replace("#BK", ck.getBody())
+                    .replace("#PK", ek_use.getTypeArguments(ek_decl));
+        }
+
+        @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(xlint.getXlintOption()), null, Arrays.asList(source));
+        ct.analyze();
+        check();
+    }
+
+    void check() {
+
+        boolean shouldWarnDecl = ek_decl.shouldWarn &&
+                xlint == XlintOption.TRY &&
+                suppress_decl != SuppressLevel.SUPPRESS;
+
+        boolean shouldWarnUse = (ek_decl.shouldWarn ||
+                ((ek_use.shouldWarn || ek_use == ExceptionKind.NONE) && ek_decl == ExceptionKind.X)) &&
+                xlint == XlintOption.TRY &&
+                suppress_use != SuppressLevel.SUPPRESS;
+
+        int foundWarnings = 0;
+
+        if (shouldWarnDecl) foundWarnings++;
+        if (shouldWarnUse) foundWarnings++;
+
+        if (foundWarnings != diagChecker.tryWarnFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nOptions: " + xlint.getXlintOption() +
+                "\nFound warnings: " + diagChecker.tryWarnFound +
+                "\nExpected decl warning: " + shouldWarnDecl +
+                "\nExpected use warning: " + shouldWarnUse);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        int tryWarnFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.WARNING &&
+                    diagnostic.getCode().contains("try.resource.throws.interrupted.exc")) {
+                tryWarnFound++;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/TryWithResources/T7032633.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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 7032633
+ * @summary javac -Xlint:all warns about flush() within try on an auto-closeable resource
+ * @compile -Xlint:try -Werror T7032633.java
+ */
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class T7032633 {
+    void test() throws IOException {
+        try (OutputStream out = System.out) {
+            out.flush();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/api/T6437138.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,61 @@
+/*
+ * 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     6437138
+ * @summary JSR 199: Compiler doesn't diagnose crash in user code
+ */
+
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.*;
+import static javax.tools.JavaFileObject.Kind.*;
+
+
+public class T6437138 {
+    static class JFO extends SimpleJavaFileObject {
+        public JFO(URI uri, JavaFileObject.Kind kind) {
+            super(uri, kind);
+        }
+        // getCharContent not impl, will throw UnsupportedOperationException
+    }
+
+    public static void main(String... arg) throws Exception {
+        try {
+            JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
+            JavaFileObject jfo = new JFO(new URI("JFOTest04.java"),SOURCE);
+            JavaCompiler.CompilationTask ct = javac.getTask(null,null,null,null,
+                        null, Arrays.asList(jfo));
+            ct.call();
+            throw new Exception("no exception thrown by JavaCompiler.CompilationTask");
+        } catch (RuntimeException e) {
+            if (e.getCause() instanceof UnsupportedOperationException) {
+                System.err.println("RuntimeException(UnsupportedOperationException) caught as expected");
+                return;
+            }
+            throw new Exception("unexpected exception caught", e);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/api/TestClientCodeWrapper.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,604 @@
+/*
+ * 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 6437138 6482554
+ * @summary JSR 199: Compiler doesn't diagnose crash in user code
+ * @library ../lib
+ * @build JavacTestingAbstractProcessor TestClientCodeWrapper
+ * @run main TestClientCodeWrapper
+ */
+
+import java.io.*;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+import com.sun.source.util.*;
+import com.sun.tools.javac.api.*;
+import javax.tools.JavaFileObject.Kind;
+
+public class TestClientCodeWrapper extends JavacTestingAbstractProcessor {
+    public static void main(String... args) throws Exception {
+        new TestClientCodeWrapper().run();
+    }
+
+    /**
+     * Run a series of compilations, each with a different user-provided object
+     * configured to throw an exception when a specific method is invoked.
+     * Then, verify the exception is thrown as expected.
+     *
+     * Some methods are not invoked from the compiler, and are excluded from the test.
+     */
+    void run() throws Exception {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        defaultFileManager = compiler.getStandardFileManager(null, null, null);
+
+        for (Method m: getMethodsExcept(JavaFileManager.class, "close", "getJavaFileForInput")) {
+            test(m);
+        }
+
+        for (Method m: getMethodsExcept(FileObject.class, "delete")) {
+            test(m);
+        }
+
+        for (Method m: getMethods(JavaFileObject.class)) {
+            test(m);
+        }
+
+        for (Method m: getMethodsExcept(Processor.class, "getCompletions")) {
+            test(m);
+        }
+
+        for (Method m: DiagnosticListener.class.getDeclaredMethods()) {
+            test(m);
+        }
+
+        for (Method m: TaskListener.class.getDeclaredMethods()) {
+            test(m);
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    /** Get a sorted set of the methods declared on a class. */
+    Set<Method> getMethods(Class<?> clazz) {
+        return getMethodsExcept(clazz, new String[0]);
+    }
+
+    /** Get a sorted set of the methods declared on a class, excluding
+     *  specified methods by name. */
+    Set<Method> getMethodsExcept(Class<?> clazz, String... exclude) {
+        Set<Method> methods = new TreeSet<Method>(new Comparator<Method>() {
+            public int compare(Method m1, Method m2) {
+                return m1.toString().compareTo(m2.toString());
+            }
+        });
+        Set<String> e = new HashSet<String>(Arrays.asList(exclude));
+        for (Method m: clazz.getDeclaredMethods()) {
+            if (!e.contains(m.getName()))
+                methods.add(m);
+        }
+        return methods;
+    }
+
+    /**
+     * Test a method in a user supplied component, to verify javac's handling
+     * of any exceptions thrown by that method.
+     */
+    void test(Method m) throws Exception {
+        testNum++;
+
+        File extDirs = new File("empty-extdirs");
+        extDirs.mkdirs();
+
+        File testClasses = new File("test" + testNum);
+        testClasses.mkdirs();
+        defaultFileManager.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(testClasses));
+
+        System.err.println("test " + testNum + ": "
+                + m.getDeclaringClass().getSimpleName() + "." + m.getName());
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+
+        List<String> javacOptions = Arrays.asList(
+                "-extdirs", extDirs.getPath(), // for use by filemanager handleOption
+                "-processor", TestClientCodeWrapper.class.getName()
+                );
+
+        List<String> classes = Collections.emptyList();
+
+        JavacTool tool = JavacTool.create();
+        try {
+            JavacTask task = tool.getTask(pw,
+                    getFileManager(m, defaultFileManager),
+                    getDiagnosticListener(m, pw),
+                    javacOptions,
+                    classes,
+                    getCompilationUnits(m));
+
+            if (isDeclaredIn(m, Processor.class))
+                task.setProcessors(getProcessors(m));
+
+            if (isDeclaredIn(m, TaskListener.class))
+                task.setTaskListener(getTaskListener(m, pw));
+
+            boolean ok = task.call();
+            error("compilation " + (ok ? "succeeded" : "failed") + " unexpectedly");
+        } catch (RuntimeException e) {
+            System.err.println("caught " + e);
+            if (e.getClass() == RuntimeException.class) {
+                Throwable cause = e.getCause();
+                if (cause instanceof UserError) {
+                    String expect = m.getName();
+                    String found = cause.getMessage();
+                    checkEqual("exception messaqe", expect, found);
+                } else {
+                    cause.printStackTrace(System.err);
+                    error("Unexpected exception: " + cause);
+                }
+            } else {
+                e.printStackTrace(System.err);
+                error("Unexpected exception: " + e);
+            }
+        }
+
+        pw.close();
+        String out = sw.toString();
+        System.err.println(out);
+    }
+
+    /** Get a file manager to use for the test compilation. */
+    JavaFileManager getFileManager(Method m, JavaFileManager defaultFileManager) {
+        return isDeclaredIn(m, JavaFileManager.class, FileObject.class, JavaFileObject.class)
+                ? new UserFileManager(m, defaultFileManager)
+                : defaultFileManager;
+    }
+
+    /** Get a diagnostic listener to use for the test compilation. */
+    DiagnosticListener<JavaFileObject> getDiagnosticListener(Method m, PrintWriter out) {
+        return isDeclaredIn(m, DiagnosticListener.class)
+                ? new UserDiagnosticListener(m, out)
+                : null;
+    }
+
+    /** Get a set of file objects to use for the test compilation. */
+    Iterable<? extends JavaFileObject> getCompilationUnits(Method m) {
+        File testSrc = new File(System.getProperty("test.src"));
+        File thisSrc = new File(testSrc, TestClientCodeWrapper.class.getName() + ".java");
+        Iterable<? extends JavaFileObject> files = defaultFileManager.getJavaFileObjects(thisSrc);
+        if (isDeclaredIn(m, FileObject.class, JavaFileObject.class))
+            return Arrays.asList(new UserFileObject(m, files.iterator().next()));
+        else
+            return files;
+    }
+
+    /** Get a set of annotation processors to use for the test compilation. */
+    Iterable<? extends Processor> getProcessors(Method m) {
+        return Arrays.asList(new UserProcessor(m));
+    }
+
+    /** Get a task listener to use for the test compilation. */
+    TaskListener getTaskListener(Method m, PrintWriter out) {
+        return new UserTaskListener(m, out);
+    }
+
+    /** Check if two values are .equal, and report an error if not. */
+    <T> void checkEqual(String label, T expect, T found) {
+        if (!expect.equals(found))
+            error("Unexpected value for " + label + ": " + found + "; expected: " + expect);
+    }
+
+    /** Report an error. */
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    /** Check if a method is declared in any of a set of classes */
+    static boolean isDeclaredIn(Method m, Class<?>... classes) {
+        Class<?> dc = m.getDeclaringClass();
+        for (Class<?> c: classes) {
+            if (c == dc) return true;
+        }
+        return false;
+    }
+
+    /** Throw an intentional error if the method has a given name. */
+    static void throwUserExceptionIfNeeded(Method m, String name) {
+        if (m != null && m.getName().equals(name))
+            throw new UserError(name);
+    }
+
+    StandardJavaFileManager defaultFileManager;
+    int testNum;
+    int errors;
+
+    //--------------------------------------------------------------------------
+
+    /**
+     * Processor used to trigger use of methods not normally used by javac.
+     */
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        boolean firstRound = false;
+        for (Element e: roundEnv.getRootElements()) {
+            if (e.getSimpleName().contentEquals(TestClientCodeWrapper.class.getSimpleName()))
+                firstRound = true;
+        }
+        if (firstRound) {
+            try {
+                FileObject f1 = filer.getResource(StandardLocation.CLASS_PATH, "",
+                    TestClientCodeWrapper.class.getName() + ".java");
+                f1.openInputStream().close();
+                f1.openReader(false).close();
+
+                FileObject f2 = filer.createResource(
+                        StandardLocation.CLASS_OUTPUT, "", "f2.txt", (Element[]) null);
+                f2.openOutputStream().close();
+
+                FileObject f3 = filer.createResource(
+                        StandardLocation.CLASS_OUTPUT, "", "f3.txt", (Element[]) null);
+                f3.openWriter().close();
+
+                JavaFileObject f4 = filer.createSourceFile("f4", (Element[]) null);
+                f4.openWriter().close();
+                f4.getNestingKind();
+                f4.getAccessLevel();
+
+                messager.printMessage(Diagnostic.Kind.NOTE, "informational note",
+                        roundEnv.getRootElements().iterator().next());
+
+            } catch (IOException e) {
+                throw new UserError(e);
+            }
+        }
+        return true;
+    }
+
+    //--------------------------------------------------------------------------
+
+    // <editor-fold defaultstate="collapsed" desc="User classes">
+
+    static class UserError extends Error {
+        private static final long serialVersionUID = 1L;
+        UserError(String msg) {
+            super(msg);
+        }
+        UserError(Throwable t) {
+            super(t);
+        }
+    }
+
+    static class UserFileManager extends ForwardingJavaFileManager<JavaFileManager> {
+        Method fileManagerMethod;
+        Method fileObjectMethod;
+
+        UserFileManager(Method m, JavaFileManager delegate) {
+            super(delegate);
+            if (isDeclaredIn(m, JavaFileManager.class)) {
+                fileManagerMethod = m;
+            } else if (isDeclaredIn(m, FileObject.class, JavaFileObject.class)) {
+                fileObjectMethod = m;
+            } else
+                assert false;
+        }
+
+        @Override
+        public ClassLoader getClassLoader(Location location) {
+            throwUserExceptionIfNeeded(fileManagerMethod, "getClassLoader");
+            return super.getClassLoader(location);
+        }
+
+        @Override
+        public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException {
+            throwUserExceptionIfNeeded(fileManagerMethod, "list");
+            return wrap(super.list(location, packageName, kinds, recurse));
+        }
+
+        @Override
+        public String inferBinaryName(Location location, JavaFileObject file) {
+            throwUserExceptionIfNeeded(fileManagerMethod, "inferBinaryName");
+            return super.inferBinaryName(location, unwrap(file));
+        }
+
+        @Override
+        public boolean isSameFile(FileObject a, FileObject b) {
+            throwUserExceptionIfNeeded(fileManagerMethod, "isSameFile");
+            return super.isSameFile(unwrap(a), unwrap(b));
+        }
+
+        @Override
+        public boolean handleOption(String current, Iterator<String> remaining) {
+            throwUserExceptionIfNeeded(fileManagerMethod, "handleOption");
+            return super.handleOption(current, remaining);
+        }
+
+        @Override
+        public boolean hasLocation(Location location) {
+            throwUserExceptionIfNeeded(fileManagerMethod, "hasLocation");
+            return super.hasLocation(location);
+        }
+
+        @Override
+        public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException {
+            throwUserExceptionIfNeeded(fileManagerMethod, "getJavaFileForInput");
+            return wrap(super.getJavaFileForInput(location, className, kind));
+        }
+
+        @Override
+        public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException {
+            throwUserExceptionIfNeeded(fileManagerMethod, "getJavaFileForOutput");
+            return wrap(super.getJavaFileForOutput(location, className, kind, sibling));
+        }
+
+        @Override
+        public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException {
+            throwUserExceptionIfNeeded(fileManagerMethod, "getFileForInput");
+            return wrap(super.getFileForInput(location, packageName, relativeName));
+        }
+
+        @Override
+        public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
+            throwUserExceptionIfNeeded(fileManagerMethod, "getFileForOutput");
+            return wrap(super.getFileForOutput(location, packageName, relativeName, sibling));
+        }
+
+        @Override
+        public void flush() throws IOException {
+            throwUserExceptionIfNeeded(fileManagerMethod, "flush");
+            super.flush();
+        }
+
+        @Override
+        public void close() throws IOException {
+            throwUserExceptionIfNeeded(fileManagerMethod, "close");
+            super.close();
+        }
+
+        @Override
+        public int isSupportedOption(String option) {
+            throwUserExceptionIfNeeded(fileManagerMethod, "isSupportedOption");
+            return super.isSupportedOption(option);
+        }
+
+        public FileObject wrap(FileObject fo) {
+            if (fileObjectMethod == null)
+                return fo;
+            return new UserFileObject(fileObjectMethod, (JavaFileObject)fo);
+        }
+
+        FileObject unwrap(FileObject fo) {
+            if (fo instanceof UserFileObject)
+                return ((UserFileObject) fo).unwrap();
+            else
+                return fo;
+        }
+
+        public JavaFileObject wrap(JavaFileObject fo) {
+            if (fileObjectMethod == null)
+                return fo;
+            return new UserFileObject(fileObjectMethod, fo);
+        }
+
+        public Iterable<JavaFileObject> wrap(Iterable<? extends JavaFileObject> list) {
+            List<JavaFileObject> wrapped = new ArrayList<JavaFileObject>();
+            for (JavaFileObject fo : list)
+                wrapped.add(wrap(fo));
+            return Collections.unmodifiableList(wrapped);
+        }
+
+        JavaFileObject unwrap(JavaFileObject fo) {
+            if (fo instanceof UserFileObject)
+                return ((UserFileObject) fo).unwrap();
+            else
+                return fo;
+        }
+    }
+
+    static class UserFileObject extends ForwardingJavaFileObject<JavaFileObject> {
+        Method method;
+
+        UserFileObject(Method m, JavaFileObject delegate) {
+            super(delegate);
+            assert isDeclaredIn(m, FileObject.class, JavaFileObject.class);
+            this.method = m;
+        }
+
+        JavaFileObject unwrap() {
+            return fileObject;
+        }
+
+        @Override
+        public Kind getKind() {
+            throwUserExceptionIfNeeded(method, "getKind");
+            return super.getKind();
+        }
+
+        @Override
+        public boolean isNameCompatible(String simpleName, Kind kind) {
+            throwUserExceptionIfNeeded(method, "isNameCompatible");
+            return super.isNameCompatible(simpleName, kind);
+        }
+
+        @Override
+        public NestingKind getNestingKind() {
+            throwUserExceptionIfNeeded(method, "getNestingKind");
+            return super.getNestingKind();
+        }
+
+        @Override
+        public Modifier getAccessLevel() {
+            throwUserExceptionIfNeeded(method, "getAccessLevel");
+            return super.getAccessLevel();
+        }
+
+        @Override
+        public URI toUri() {
+            throwUserExceptionIfNeeded(method, "toUri");
+            return super.toUri();
+        }
+
+        @Override
+        public String getName() {
+            throwUserExceptionIfNeeded(method, "getName");
+            return super.getName();
+        }
+
+        @Override
+        public InputStream openInputStream() throws IOException {
+            throwUserExceptionIfNeeded(method, "openInputStream");
+            return super.openInputStream();
+        }
+
+        @Override
+        public OutputStream openOutputStream() throws IOException {
+            throwUserExceptionIfNeeded(method, "openOutputStream");
+            return super.openOutputStream();
+        }
+
+        @Override
+        public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
+            throwUserExceptionIfNeeded(method, "openReader");
+            return super.openReader(ignoreEncodingErrors);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+            throwUserExceptionIfNeeded(method, "getCharContent");
+            return super.getCharContent(ignoreEncodingErrors);
+        }
+
+        @Override
+        public Writer openWriter() throws IOException {
+            throwUserExceptionIfNeeded(method, "openWriter");
+            return super.openWriter();
+        }
+
+        @Override
+        public long getLastModified() {
+            throwUserExceptionIfNeeded(method, "getLastModified");
+            return super.getLastModified();
+        }
+
+        @Override
+        public boolean delete() {
+            throwUserExceptionIfNeeded(method, "delete");
+            return super.delete();
+        }
+
+    }
+
+    static class UserProcessor extends JavacTestingAbstractProcessor {
+        Method method;
+
+        UserProcessor(Method m) {
+            assert isDeclaredIn(m, Processor.class);
+            method = m;
+        }
+
+        @Override
+        public Set<String> getSupportedOptions() {
+            throwUserExceptionIfNeeded(method, "getSupportedOptions");
+            return super.getSupportedOptions();
+        }
+
+        @Override
+        public Set<String> getSupportedAnnotationTypes() {
+            throwUserExceptionIfNeeded(method, "getSupportedAnnotationTypes");
+            return super.getSupportedAnnotationTypes();
+        }
+
+        @Override
+        public SourceVersion getSupportedSourceVersion() {
+            throwUserExceptionIfNeeded(method, "getSupportedSourceVersion");
+            return super.getSupportedSourceVersion();
+        }
+
+        @Override
+        public void init(ProcessingEnvironment processingEnv) {
+            throwUserExceptionIfNeeded(method, "init");
+            super.init(processingEnv);
+        }
+
+        @Override
+        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+            throwUserExceptionIfNeeded(method, "process");
+            return true;
+        }
+
+        @Override
+        public Iterable<? extends Completion> getCompletions(Element element, AnnotationMirror annotation, ExecutableElement member, String userText) {
+            throwUserExceptionIfNeeded(method, "getCompletions");
+            return super.getCompletions(element, annotation, member, userText);
+        }
+    }
+
+    static class UserDiagnosticListener implements DiagnosticListener<JavaFileObject> {
+        Method method;
+        PrintWriter out;
+
+        UserDiagnosticListener(Method m, PrintWriter out) {
+            assert isDeclaredIn(m, DiagnosticListener.class);
+            this.method = m;
+            this.out = out;
+        }
+
+        @Override
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            throwUserExceptionIfNeeded(method, "report");
+            out.println("report: " + diagnostic);
+        }
+    }
+
+    static class UserTaskListener implements TaskListener {
+        Method method;
+        PrintWriter out;
+
+        UserTaskListener(Method m, PrintWriter out) {
+            assert isDeclaredIn(m, TaskListener.class);
+            this.method = m;
+            this.out = out;
+        }
+
+        @Override
+        public void started(TaskEvent e) {
+            throwUserExceptionIfNeeded(method, "started");
+            out.println("started: " + e);
+        }
+
+        @Override
+        public void finished(TaskEvent e) {
+            throwUserExceptionIfNeeded(method, "finished");
+            out.println("finished: " + e);
+        }
+    }
+
+    // </editor-fold>
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/classreader/T7031108.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,149 @@
+/*
+ * 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 7031108
+ * @summary NPE in javac.jvm.ClassReader.findMethod in PackageElement.enclosedElements from AP in incr build
+ * @library ../lib
+ * @build JavacTestingAbstractProcessor T7031108
+ * @run main T7031108
+ */
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+import javax.tools.JavaCompiler.CompilationTask;
+
+public class T7031108 extends JavacTestingAbstractProcessor {
+    public static void main(String... args) throws Exception {
+        new T7031108().run();
+    }
+
+    /* Class containing a local class definition;
+     * compiled class file will have an EnclosedMethod attribute.
+     */
+    static final JavaSource pC =
+            new JavaSource("p/C.java",
+                  "package p;\n"
+                + "class C {\n"
+                + "    void m() {\n"
+                + "        new Runnable() {\n"
+                + "            public void run() {\n"
+                + "                new Runnable() {\n"
+                + "                    public void run() { }\n"
+                + "                };\n"
+                + "            }\n"
+                + "        };\n"
+                + "    }\n"
+                + "}");
+
+    /* Dummy source file to compile while running anno processor. */
+    static final JavaSource dummy =
+            new JavaSource("Dummy.java",
+                "class Dummy { }");
+
+    void run() throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        // step 1: compile test classes
+        File cwd = new File(".");
+        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(cwd));
+        compile(comp, fm, null, null, pC);
+
+        // step 2: verify functioning of processor
+        fm.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH,
+                fm.getLocation(StandardLocation.CLASS_PATH));
+        fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(cwd));
+        compile(comp, fm, null, getClass().getName(), dummy);
+
+        File pC_class = new File(new File("p"), "C.class");
+        pC_class.delete();
+
+        DiagnosticCollector<JavaFileObject> dc = new DiagnosticCollector<JavaFileObject>();
+        compile(comp, fm, dc, getClass().getName(), dummy);
+        List<Diagnostic<? extends JavaFileObject>> diags =dc.getDiagnostics();
+
+        System.err.println(diags);
+        switch (diags.size()) {
+            case 0:
+                throw new Exception("no diagnostics received");
+            case 1:
+                String code = diags.get(0).getCode();
+                String expect = "compiler.err.proc.cant.access.1";
+                if (!expect.equals(code))
+                    throw new Exception("unexpected diag code: " + code
+                            + ", expected: " + expect);
+                break;
+            default:
+                throw new Exception("unexpected diags received");
+        }
+    }
+
+    void compile(JavaCompiler comp, JavaFileManager fm,
+            DiagnosticListener<JavaFileObject> dl,
+            String processor, JavaFileObject... files) throws Exception {
+        System.err.println("compile processor:" + processor + ", files:" + Arrays.asList(files));
+        List<String> opts = new ArrayList<String>();
+        if (processor != null) {
+            // opts.add("-verbose");
+            opts.addAll(Arrays.asList("-processor", processor));
+        }
+        CompilationTask task = comp.getTask(null, fm, dl, opts, null, Arrays.asList(files));
+        boolean ok = task.call();
+        if (dl == null && !ok)
+            throw new Exception("compilation failed");
+    }
+
+    static class JavaSource extends SimpleJavaFileObject {
+        JavaSource(String name, String text) {
+            super(URI.create("js://" + name), JavaFileObject.Kind.SOURCE);
+            this.text = text;
+        }
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return text;
+        }
+        final String text;
+    }
+
+    // annotation processor method
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            PackageElement p = elements.getPackageElement("p");
+            List<? extends Element> elems = p.getEnclosedElements();
+            System.err.println("contents of package p: " + elems);
+            if (elems.size() != 1 || !elems.get(0).getSimpleName().contentEquals("C")) {
+                messager.printMessage(Diagnostic.Kind.ERROR, "unexpected package contents");
+            }
+        }
+        return true;
+    }
+}
+
--- a/test/tools/javac/diags/examples.not-yet.txt	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/tools/javac/diags/examples.not-yet.txt	Sun Apr 10 10:25:12 2011 -0700
@@ -27,6 +27,7 @@
 compiler.err.prob.found.req.1                           # Check: DEAD, in unused method
 compiler.err.proc.bad.config.file                       # JavacProcessingEnvironment
 compiler.err.proc.cant.access                           # completion failure
+compiler.err.proc.cant.access.1                         # completion failure, no stack trace
 compiler.err.proc.cant.create.loader                    # security exception from service loader
 compiler.err.proc.no.service                            # JavacProcessingEnvironment: no service loader available
 compiler.err.proc.processor.bad.option.name             # cannot happen? masked by javac.err.invalid.A.key
@@ -49,6 +50,7 @@
 compiler.misc.bad.class.signature                       # bad class file
 compiler.misc.bad.const.pool.tag                        # bad class file
 compiler.misc.bad.const.pool.tag.at                     # bad class file
+compiler.misc.bad.enclosing.class                       # bad class file
 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/MulticatchTypesMustBeDisjoint.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.multicatch.types.must.be.disjoint
+
+class MulticatchTypesMustBeDisjoint {
+    class E1 extends Exception { }
+    class E2 extends E1 { }
+
+    void e1() throws E1 { }
+    void e2() throws E2 { }
+
+    void m() {
+        try {
+            e1();
+            e2();
+        } catch (E1 | E2 e) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/TryResourceThrowsInterruptedExc.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.try.resource.throws.interrupted.exc
+// options: -Xlint:try
+
+class TryResourceThrowsInterruptedException implements AutoCloseable {
+    public void close() throws InterruptedException {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,252 @@
+/*
+ * 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 7030150
+ * @summary Type inference for generic instance creation failed for formal type parameter
+ */
+
+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 GenericConstructorAndDiamondTest {
+
+    enum BoundKind {
+        NO_BOUND(""),
+        STRING_BOUND("extends String"),
+        INTEGER_BOUND("extends Integer");
+
+        String boundStr;
+
+        private BoundKind(String boundStr) {
+            this.boundStr = boundStr;
+        }
+
+        boolean matches(TypeArgumentKind tak) {
+            switch (tak) {
+                case NONE: return true;
+                case STRING: return this != INTEGER_BOUND;
+                case INTEGER: return this != STRING_BOUND;
+                default: return false;
+            }
+        }
+    }
+
+    enum ConstructorKind {
+        NON_GENERIC("Foo(Object o) {}"),
+        GENERIC_NO_BOUND("<T> Foo(T t) {}"),
+        GENERIC_STRING_BOUND("<T extends String> Foo(T t) {}"),
+        GENERIC_INTEGER_BOUND("<T extends Integer> Foo(T t) {}");
+
+        String constrStr;
+
+        private ConstructorKind(String constrStr) {
+            this.constrStr = constrStr;
+        }
+
+        boolean matches(ArgumentKind ak) {
+            switch (ak) {
+                case STRING: return this != GENERIC_INTEGER_BOUND;
+                case INTEGER: return this != GENERIC_STRING_BOUND;
+                default: return false;
+            }
+        }
+    }
+
+    enum TypeArgArity {
+        ONE(1),
+        TWO(2),
+        THREE(3);
+
+        int n;
+
+        private TypeArgArity(int n) {
+            this.n = n;
+        }
+    }
+
+    enum TypeArgumentKind {
+        NONE(""),
+        STRING("String"),
+        INTEGER("Integer");
+
+        String typeargStr;
+
+        private TypeArgumentKind(String typeargStr) {
+            this.typeargStr = typeargStr;
+        }
+
+        String getArgs(TypeArgArity arity) {
+            if (this == NONE) return "";
+            else {
+                StringBuilder buf = new StringBuilder();
+                String sep = "";
+                for (int i = 0 ; i < arity.n ; i++) {
+                    buf.append(sep);
+                    buf.append(typeargStr);
+                    sep = ",";
+                }
+                return "<" + buf.toString() + ">";
+            }
+        }
+
+        boolean matches(ArgumentKind ak) {
+            switch (ak) {
+                case STRING: return this != INTEGER;
+                case INTEGER: return this != STRING;
+                default: return false;
+            }
+        }
+    }
+
+    enum ArgumentKind {
+        STRING("\"\""),
+        INTEGER("1");
+
+        String argStr;
+
+        private ArgumentKind(String argStr) {
+            this.argStr = argStr;
+        }
+    }
+
+    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 (BoundKind boundKind : BoundKind.values()) {
+            for (ConstructorKind constructorKind : ConstructorKind.values()) {
+                for (TypeArgumentKind declArgKind : TypeArgumentKind.values()) {
+                    for (TypeArgArity arity : TypeArgArity.values()) {
+                        for (TypeArgumentKind useArgKind : TypeArgumentKind.values()) {
+                            for (ArgumentKind argKind : ArgumentKind.values()) {
+                                new GenericConstructorAndDiamondTest(boundKind, constructorKind,
+                                        declArgKind, arity, useArgKind, argKind).run(comp, fm);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    BoundKind boundKind;
+    ConstructorKind constructorKind;
+    TypeArgumentKind declTypeArgumentKind;
+    TypeArgArity useTypeArgArity;
+    TypeArgumentKind useTypeArgumentKind;
+    ArgumentKind argumentKind;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    GenericConstructorAndDiamondTest(BoundKind boundKind, ConstructorKind constructorKind,
+            TypeArgumentKind declTypeArgumentKind, TypeArgArity useTypeArgArity,
+            TypeArgumentKind useTypeArgumentKind, ArgumentKind argumentKind) {
+        this.boundKind = boundKind;
+        this.constructorKind = constructorKind;
+        this.declTypeArgumentKind = declTypeArgumentKind;
+        this.useTypeArgArity = useTypeArgArity;
+        this.useTypeArgumentKind = useTypeArgumentKind;
+        this.argumentKind = argumentKind;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "class Foo<X #BK> {\n" +
+                              "#CK\n" +
+                          "}\n" +
+                          "class Test {\n" +
+                              "void test() {\n" +
+                                 "Foo#TA1 f = new #TA2 Foo<>(#A);\n" +
+                              "}\n" +
+                          "}\n";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replace("#BK", boundKind.boundStr).
+                    replace("#CK", constructorKind.constrStr)
+                    .replace("#TA1", declTypeArgumentKind.getArgs(TypeArgArity.ONE))
+                    .replace("#TA2", useTypeArgumentKind.getArgs(useTypeArgArity))
+                    .replace("#A", argumentKind.argStr);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        ct.analyze();
+        check();
+    }
+
+    void check() {
+        boolean badActual = !constructorKind.matches(argumentKind);
+
+        boolean badArity = constructorKind != ConstructorKind.NON_GENERIC &&
+                useTypeArgumentKind != TypeArgumentKind.NONE &&
+                useTypeArgArity != TypeArgArity.ONE;
+
+        boolean badMethodTypeArg = constructorKind != ConstructorKind.NON_GENERIC &&
+                !useTypeArgumentKind.matches(argumentKind);
+
+        boolean badGenericType = !boundKind.matches(declTypeArgumentKind);
+
+        boolean shouldFail = badActual || badArity || badMethodTypeArg || badGenericType;
+
+        if (shouldFail != diagChecker.errorFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + shouldFail);
+        }
+    }
+
+    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/generics/diamond/7030150/Neg01.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7030150
+ * @summary Type inference for generic instance creation failed for formal type parameter
+ *          check that explicit type-argument that causes resolution failure is rejected
+ * @compile/fail/ref=Neg01.out -XDrawDiagnostics Neg01.java
+ */
+
+class Neg01 {
+
+    static class Foo<X> {
+        <T> Foo(T t) {}
+    }
+
+    Foo<Integer> fi1 = new <String> Foo<>(1);
+    Foo<Integer> fi2 = new <String> Foo<Integer>(1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030150/Neg01.out	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,3 @@
+Neg01.java:15:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg01.Foo), (compiler.misc.infer.no.conforming.assignment.exists: X, int, java.lang.String)
+Neg01.java:16:24: compiler.err.cant.apply.symbol.1: kindname.constructor, Foo, T, int, kindname.class, Neg01.Foo<X>, (compiler.misc.no.conforming.assignment.exists: int, java.lang.String)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030150/Neg02.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7030150
+ * @summary Type inference for generic instance creation failed for formal type parameter
+ *          check that compiler rejects bad number of explicit type-arguments
+ * @compile/fail/ref=Neg02.out -XDrawDiagnostics Neg02.java
+ */
+
+class Neg02 {
+
+    static class Foo<X> {
+        <T> Foo(T t) {}
+    }
+
+    Foo<Integer> fi1 = new <String, Integer> Foo<>("");
+    Foo<Integer> fi2 = new <String, Integer> Foo<Integer>("");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030150/Neg02.out	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,3 @@
+Neg02.java:15:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg02.Foo), (compiler.misc.arg.length.mismatch)
+Neg02.java:16:24: compiler.err.cant.apply.symbol.1: kindname.constructor, Foo, T, java.lang.String, kindname.class, Neg02.Foo<X>, (compiler.misc.arg.length.mismatch)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030150/Neg03.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7030150
+ * @summary Type inference for generic instance creation failed for formal type parameter
+ *          check that explicit type-argument that does not conform to bound is rejected
+ * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java
+ */
+
+class Neg03 {
+
+    static class Foo<X> {
+        <T extends Integer> Foo(T t) {}
+    }
+
+    Foo<Integer> fi1 = new <String> Foo<>(1);
+    Foo<Integer> fi2 = new <String> Foo<Integer>(1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030150/Neg03.out	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,3 @@
+Neg03.java:15:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg03.Foo), (compiler.misc.explicit.param.do.not.conform.to.bounds: java.lang.String, java.lang.Integer)
+Neg03.java:16:24: compiler.err.cant.apply.symbol.1: kindname.constructor, Foo, T, int, kindname.class, Neg03.Foo<X>, (compiler.misc.explicit.param.do.not.conform.to.bounds: java.lang.String, java.lang.Integer)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030150/Pos01.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,44 @@
+/*
+ * 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 7030150
+ * @summary Type inference for generic instance creation failed for formal type parameter
+ *          check that redundant type-arguments on non-generic constructor are accepted
+ * @compile Pos01.java
+ */
+
+class Pos01 {
+
+    static class Foo<X> {
+        Foo(X t) {}
+    }
+
+    Foo<Integer> fi1 = new Foo<>(1);
+    Foo<Integer> fi2 = new Foo<Integer>(1);
+    Foo<Integer> fi3 = new <String> Foo<>(1);
+    Foo<Integer> fi4 = new <String> Foo<Integer>(1);
+    Foo<Integer> fi5 = new <String, String> Foo<>(1);
+    Foo<Integer> fi6 = new <String, String> Foo<Integer>(1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030150/Pos02.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,40 @@
+/*
+ * 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 7030150
+ * @summary Type inference for generic instance creation failed for formal type parameter
+ *          check that diamond in return context works w/o problems
+ * @compile Pos02.java
+ */
+
+class Pos02<X> {
+
+    Pos02(X x) {}
+
+
+    Pos02<X> test(X x) {
+        return new Pos02<>(x);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030687/ParserTest.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,175 @@
+/*
+ * 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 7030687
+ * @summary Diamond: compiler accepts erroneous code where diamond is used with non-generic inner class
+ */
+
+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 ParserTest {
+
+    enum TypeArgumentKind {
+        NONE(""),
+        EXPLICIT("<String>"),
+        DIAMOND("<>");
+
+        String typeargStr;
+
+        private TypeArgumentKind(String typeargStr) {
+            this.typeargStr = typeargStr;
+        }
+    }
+
+    enum TypeQualifierArity {
+        ONE(1, "A1#TA1"),
+        TWO(2, "A1#TA1.A2#TA2"),
+        THREE(3, "A1#TA1.A2#TA2.A3#TA3"),
+        FOUR(4, "A1#TA1.A2#TA2.A3#TA3.A4#TA4");
+
+        int n;
+        String qualifierStr;
+
+        private TypeQualifierArity(int n, String qualifierStr) {
+            this.n = n;
+            this.qualifierStr = qualifierStr;
+        }
+
+        String getType(TypeArgumentKind... typeArgumentKinds) {
+            String res = qualifierStr;
+            for (int i = 1 ; i <= typeArgumentKinds.length ; i++) {
+                res = res.replace("#TA" + i, typeArgumentKinds[i-1].typeargStr);
+            }
+            return res;
+        }
+    }
+
+    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 (TypeQualifierArity arity : TypeQualifierArity.values()) {
+            for (TypeArgumentKind tak1 : TypeArgumentKind.values()) {
+                if (arity == TypeQualifierArity.ONE) {
+                    new ParserTest(arity, tak1).run(comp, fm);
+                    continue;
+                }
+                for (TypeArgumentKind tak2 : TypeArgumentKind.values()) {
+                    if (arity == TypeQualifierArity.TWO) {
+                        new ParserTest(arity, tak1, tak2).run(comp, fm);
+                        continue;
+                    }
+                    for (TypeArgumentKind tak3 : TypeArgumentKind.values()) {
+                        if (arity == TypeQualifierArity.THREE) {
+                            new ParserTest(arity, tak1, tak2, tak3).run(comp, fm);
+                            continue;
+                        }
+                        for (TypeArgumentKind tak4 : TypeArgumentKind.values()) {
+                            new ParserTest(arity, tak1, tak2, tak3, tak4).run(comp, fm);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    TypeQualifierArity qualifierArity;
+    TypeArgumentKind[] typeArgumentKinds;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    ParserTest(TypeQualifierArity qualifierArity, TypeArgumentKind... typeArgumentKinds) {
+        this.qualifierArity = qualifierArity;
+        this.typeArgumentKinds = typeArgumentKinds;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "class Test {\n" +
+                              "R res = new #T();\n" +
+                          "}\n";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replace("#T", qualifierArity.getType(typeArgumentKinds));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        ct.parse();
+        check();
+    }
+
+    void check() {
+
+        boolean errorExpected = false;
+
+        for (int i = 0 ; i < qualifierArity.n - 1 ; i++) {
+            if (typeArgumentKinds[i] == TypeArgumentKind.DIAMOND) {
+                errorExpected = true;
+                break;
+            }
+        }
+
+        if (errorExpected != diagChecker.errorFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + errorExpected);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030687/T7030687.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7030687
+ * @summary Diamond: compiler accepts erroneous code where diamond is used with non-generic inner class
+ * @compile/fail/ref=T7030687.out -XDrawDiagnostics T7030687.java
+ */
+
+class T7030687<X> {
+    class Member { }
+    static class Nested {}
+
+    void test() {
+        class Local {}
+
+        Member m = new Member<>();
+        Nested n = new Nested<>();
+        Local l = new Local<>();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/7030687/T7030687.out	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,4 @@
+T7030687.java:15:30: compiler.err.cant.apply.diamond.1: T7030687<X>.Member, (compiler.misc.diamond.non.generic: T7030687<X>.Member)
+T7030687.java:16:30: compiler.err.cant.apply.diamond.1: T7030687.Nested, (compiler.misc.diamond.non.generic: T7030687.Nested)
+T7030687.java:17:28: compiler.err.cant.apply.diamond.1: Local, (compiler.misc.diamond.non.generic: Local)
+3 errors
--- a/test/tools/javac/meth/InvokeMH.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/tools/javac/meth/InvokeMH.java	Sun Apr 10 10:25:12 2011 -0700
@@ -42,7 +42,7 @@
 
 package meth;
 
-import java.dyn.MethodHandle;
+import java.lang.invoke.MethodHandle;
 
 public class InvokeMH {
     void test(MethodHandle mh_SiO,
--- a/test/tools/javac/meth/TestCP.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/tools/javac/meth/TestCP.java	Sun Apr 10 10:25:12 2011 -0700
@@ -35,7 +35,7 @@
 import com.sun.tools.classfile.ConstantPool.*;
 import com.sun.tools.classfile.Method;
 
-import java.dyn.*;
+import java.lang.invoke.*;
 import java.io.*;
 
 public class TestCP {
--- a/test/tools/javac/meth/XlintWarn.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/tools/javac/meth/XlintWarn.java	Sun Apr 10 10:25:12 2011 -0700
@@ -30,7 +30,7 @@
  * @compile -Werror -Xlint:cast XlintWarn.java
  */
 
-import java.dyn.*;
+import java.lang.invoke.*;
 
 class XlintWarn {
     void test(MethodHandle mh) throws Throwable {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/multicatch/7030606/DisjunctiveTypeWellFormednessTest.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,205 @@
+/*
+ * 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 7030606
+ * @summary Project-coin: multi-catch types should be pairwise disjoint
+ */
+
+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 DisjunctiveTypeWellFormednessTest {
+
+    enum Alternative {
+        EXCEPTION("Exception"),
+        RUNTIME_EXCEPTION("RuntimeException"),
+        IO_EXCEPTION("java.io.IOException"),
+        FILE_NOT_FOUND_EXCEPTION("java.io.FileNotFoundException"),
+        ILLEGAL_ARGUMENT_EXCEPTION("IllegalArgumentException");
+
+        String exceptionStr;
+
+        private Alternative(String exceptionStr) {
+            this.exceptionStr = exceptionStr;
+        }
+
+        static String makeDisjunctiveType(Alternative... alternatives) {
+            StringBuilder buf = new StringBuilder();
+            String sep = "";
+            for (Alternative alternative : alternatives) {
+                buf.append(sep);
+                buf.append(alternative.exceptionStr);
+                sep = "|";
+            }
+            return buf.toString();
+        }
+
+        boolean disjoint(Alternative that) {
+            return disjoint[this.ordinal()][that.ordinal()];
+        }
+
+        static boolean[][] disjoint = {
+            //                              Exception    RuntimeException    IOException    FileNotFoundException    IllegalArgumentException
+            /*Exception*/                {  false,       false,              false,         false,                   false },
+            /*RuntimeException*/         {  false,       false,              true,          true,                    false },
+            /*IOException*/              {  false,       true,               false,         false,                   true },
+            /*FileNotFoundException*/    {  false,       true,               false,         false,                   true },
+            /*IllegalArgumentException*/ {  false,       false,              true,          true,                    false }
+        };
+    }
+
+    enum Arity {
+        ONE(1),
+        TWO(2),
+        THREE(3),
+        FOUR(4),
+        FIVE(5);
+
+        int n;
+
+        private Arity(int n) {
+            this.n = n;
+        }
+    }
+
+    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);
+                    continue;
+                }
+                for (Alternative a2 : Alternative.values()) {
+                    if (arity == Arity.TWO) {
+                        new DisjunctiveTypeWellFormednessTest(a1, a2).run(comp, fm);
+                        continue;
+                    }
+                    for (Alternative a3 : Alternative.values()) {
+                        if (arity == Arity.THREE) {
+                            new DisjunctiveTypeWellFormednessTest(a1, a2, a3).run(comp, fm);
+                            continue;
+                        }
+                        for (Alternative a4 : Alternative.values()) {
+                            if (arity == Arity.FOUR) {
+                                new DisjunctiveTypeWellFormednessTest(a1, a2, a3, a4).run(comp, fm);
+                                continue;
+                            }
+                            for (Alternative a5 : Alternative.values()) {
+                                new DisjunctiveTypeWellFormednessTest(a1, a2, a3, a4, a5).run(comp, fm);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    Alternative[] alternatives;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    DisjunctiveTypeWellFormednessTest(Alternative... alternatives) {
+        this.alternatives = alternatives;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String template = "class Test {\n" +
+                              "void test() {\n" +
+                                 "try {} catch (#T e) {}\n" +
+                              "}\n" +
+                          "}\n";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template.replace("#T", Alternative.makeDisjunctiveType(alternatives));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        ct.analyze();
+        check();
+    }
+
+    void check() {
+
+        int non_disjoint = 0;
+        int i = 0;
+        for (Alternative a1 : alternatives) {
+            int j = 0;
+            for (Alternative a2 : alternatives) {
+                if (i == j) continue;
+                if (!a1.disjoint(a2)) {
+                    non_disjoint++;
+                    break;
+                }
+                j++;
+            }
+            i++;
+        }
+
+        if (non_disjoint != diagChecker.errorsFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound errors: " + diagChecker.errorsFound +
+                "\nExpected errors: " + non_disjoint);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        int errorsFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR &&
+                    diagnostic.getCode().startsWith("compiler.err.multicatch.types.must.be.disjoint")) {
+                errorsFound++;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/multicatch/7030606/T7030606.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,57 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7030606
+ *
+ * @summary Project-coin: multi-catch types should be pairwise disjoint
+ * @compile/fail/ref=T7030606.out -XDrawDiagnostics T7030606.java
+ */
+
+class T7030606 {
+    class E1 extends Exception { }
+    class E2 extends E1 { }
+
+    void e1() throws E1 { }
+    void e2() throws E2 { }
+
+    void m1() {
+        try {
+            e1();
+            e2();
+        } catch (NonExistentType | E2 | E1 e) { }
+    }
+
+    void m2() {
+        try {
+            e1();
+            e2();
+        } catch (NonExistentType | E1 | E2 e) { }
+    }
+
+    void m3() {
+        try {
+            e1();
+            e2();
+        } catch (E2 | NonExistentType | E1 e) { }
+    }
+
+    void m4() {
+        try {
+            e1();
+            e2();
+        } catch (E1 | NonExistentType | E2 e) { }
+    }
+
+    void m5() {
+        try {
+            e1();
+            e2();
+        } catch (E2 | E1 | NonExistentType e) { }
+    }
+
+    void m6() {
+        try {
+            e1();
+            e2();
+        } catch (E1 | E2 | NonExistentType  e) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/multicatch/7030606/T7030606.out	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,13 @@
+T7030606.java:20:18: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null)
+T7030606.java:20:41: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1
+T7030606.java:27:18: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null)
+T7030606.java:27:41: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1
+T7030606.java:34:23: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null)
+T7030606.java:34:41: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1
+T7030606.java:41:23: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null)
+T7030606.java:41:41: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1
+T7030606.java:48:23: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1
+T7030606.java:48:28: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null)
+T7030606.java:55:23: compiler.err.multicatch.types.must.be.disjoint: T7030606.E2, T7030606.E1
+T7030606.java:55:28: compiler.err.cant.resolve.location: kindname.class, NonExistentType, , , (compiler.misc.location: kindname.class, T7030606, null)
+12 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/util/T6597678.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,105 @@
+/*
+ * 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 6597678
+ * @summary Ensure Messages propogated between rounds
+ * @library ../lib
+ * @build JavacTestingAbstractProcessor T6597678
+ * @run main T6597678
+ */
+
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedOptions;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+
+
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.JavacMessages;
+
+public class T6597678 extends JavacTestingAbstractProcessor {
+    public static void main(String... args) throws Exception {
+        new T6597678().run();
+    }
+
+
+    void run() throws Exception {
+        String myName = T6597678.class.getSimpleName();
+        File testSrc = new File(System.getProperty("test.src"));
+        File file = new File(testSrc, myName + ".java");
+
+        compile(
+            "-proc:only",
+            "-processor", myName,
+            file.getPath());
+    }
+
+    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.isEmpty())
+            System.err.println(out);
+        if (rc != 0)
+            throw new Exception("compilation failed unexpectedly: rc=" + rc);
+    }
+
+    //---------------
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
+        Locale locale = context.get(Locale.class);
+        JavacMessages messages = context.get(JavacMessages.messagesKey);
+
+        round++;
+        if (round == 1) {
+            initialLocale = locale;
+            initialMessages = messages;
+        } else {
+            checkEqual("locale", locale, initialLocale);
+            checkEqual("messages", messages, initialMessages);
+        }
+
+        return true;
+    }
+
+    <T> void checkEqual(String label, T actual, T expected) {
+        if (actual != expected)
+            messager.printMessage(Diagnostic.Kind.ERROR,
+                    "Unexpected value for " + label
+                    + "; expected: " + expected
+                    + "; found: " + actual);
+    }
+
+    int round = 0;
+    Locale initialLocale;
+    JavacMessages initialMessages;
+}
--- a/test/tools/javap/6937244/T6937244A.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/tools/javap/6937244/T6937244A.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -49,8 +49,8 @@
         int count = 0;
 
         for (String line: out.split("[\r\n]+")) {
-            if (line.contains("extends")) {
-                verify(line, "extends java.lang.Object implements java.util.List<java.lang.String>");
+            if (line.contains("implements")) {
+                verify(line, "implements java.util.List<java.lang.String>");
                 count++;
             }
 
--- a/test/tools/javap/T4880663.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/tools/javap/T4880663.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4880663 6715757
+ * @bug 4880663 6715757 7031005
  * @summary javap could output whitespace between class name and opening brace
  *          javap prints "extends java.lang.Object"
  */
@@ -39,7 +39,7 @@
     public void run() throws IOException {
         File javaFile = writeTestFile();
         File classFile = compileTestFile(javaFile);
-        verify(classFile, "class Test extends java.lang.Object {");
+        verify(classFile, "class Test {");
 
         if (errors > 0)
             throw new Error(errors + " found.");
--- a/test/tools/javap/T4880672.java	Thu Apr 07 15:21:22 2011 -0700
+++ b/test/tools/javap/T4880672.java	Sun Apr 10 10:25:12 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @bug 4880672
+ * @bug 4880672 7031005
  * @summary javap does not output inner interfaces of an interface
  */
 
@@ -39,7 +39,7 @@
 
     void run() {
         verify("java.util.Map", "public interface java.util.Map$Entry");
-        verify("T4880672", "class T4880672$A$B extends java.lang.Object");
+        verify("T4880672", "class T4880672$A$B");
         verify("C", ""); // must not give error if no InnerClasses attribute
         if (errors > 0)
             throw new Error(errors + " found.");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javap/TestSuperclass.java	Sun Apr 10 10:25:12 2011 -0700
@@ -0,0 +1,178 @@
+/*
+ * 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 7031005
+ * @summary javap prints "extends java.lang.Object"
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.Arrays;
+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;
+
+public class TestSuperclass {
+    enum ClassKind {
+        CLASS("class"),
+        INTERFACE("interface");
+        ClassKind(String keyword) {
+            this.keyword = keyword;
+        }
+        final String keyword;
+    }
+
+    enum GenericKind {
+        NO(""),
+        YES("<T>");
+        GenericKind(String typarams) {
+            this.typarams = typarams;
+        }
+        final String typarams;
+    }
+
+    enum SuperKind {
+        NONE(null),
+        SUPER("Super");
+        SuperKind(String name) {
+            this.name = name;
+        }
+        String extend() {
+            return (name == null) ? "" : "extends " + name;
+        }
+        String decl(ClassKind ck) {
+            return (name == null) ? "" : ck.keyword + " " + name + " { }";
+        }
+        final String name;
+    }
+
+    public static void main(String... args) throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+        int errors = 0;
+
+        for (ClassKind ck: ClassKind.values()) {
+            for (GenericKind gk: GenericKind.values()) {
+                for (SuperKind sk: SuperKind.values()) {
+                    errors += new TestSuperclass(ck, gk, sk).run(comp, fm);
+                }
+            }
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    final ClassKind ck;
+    final GenericKind gk;
+    final SuperKind sk;
+
+    TestSuperclass(ClassKind ck, GenericKind gk, SuperKind sk) {
+        this.ck = ck;
+        this.gk = gk;
+        this.sk = sk;
+    }
+
+    int run(JavaCompiler comp, StandardJavaFileManager fm) throws IOException {
+        System.err.println("test: ck:" + ck + " gk:" + gk + " sk:" + sk);
+        File testDir = new File(ck + "-" + gk + "-" + sk);
+        testDir.mkdirs();
+        fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(testDir));
+
+        JavaSource js = new JavaSource();
+        System.err.println(js.getCharContent(false));
+        CompilationTask t = comp.getTask(null, fm, null, null, null, Arrays.asList(js));
+        if (!t.call())
+            throw new Error("compilation failed");
+
+        File testClass = new File(testDir, "Test.class");
+        String out = javap(testClass);
+
+        // Extract class sig from first line of Java source
+        String expect = js.source.replaceAll("(?s)^(.* Test[^{]+?) *\\{.*", "$1");
+
+        // Extract class sig from line from javap output
+        String found = out.replaceAll("(?s).*\n(.* Test[^{]+?) *\\{.*", "$1");
+
+        checkEqual("class signature", expect, found);
+
+        return errors;
+    }
+
+    String javap(File file) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        String[] args = { file.getPath() };
+        int rc = com.sun.tools.javap.Main.run(args, pw);
+        pw.close();
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out);
+        if (rc != 0)
+            throw new Error("javap failed: rc=" + rc);
+        return out;
+    }
+
+    void checkEqual(String label, String expect, String found) {
+        if (!expect.equals(found))
+            error("Unexpected " + label + " found: '" + found + "', expected: '" + expect + "'");
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+
+    class JavaSource extends SimpleJavaFileObject {
+        static final String template =
+                  "#CK Test#GK #EK { }\n"
+                + "#SK\n";
+        final String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = template
+                    .replace("#CK", ck.keyword)
+                    .replace("#GK", gk.typarams)
+                    .replace("#EK", sk.extend())
+                    .replace("#SK", sk.decl(ck));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+}