Merge
authorjgodinez
Tue, 03 May 2011 22:17:58 -0700
changeset 9609 c256c93c5f41
parent 9398 5d86d0c7692e (current diff)
parent 9608 385a828ba236 (diff)
child 9610 ac6200e8bf05
child 9718 b3cd7279c463
Merge
langtools/test/tools/javac/generics/diamond/7030150/Neg01.java
langtools/test/tools/javac/generics/diamond/7030150/Neg01.out
langtools/test/tools/javac/generics/diamond/7030150/Neg02.java
langtools/test/tools/javac/generics/diamond/7030150/Neg02.out
langtools/test/tools/javac/generics/diamond/7030150/Neg03.java
langtools/test/tools/javac/generics/diamond/7030150/Neg03.out
langtools/test/tools/javac/generics/diamond/7030150/Pos01.java
langtools/test/tools/javac/generics/diamond/7030150/Pos02.java
--- a/langtools/src/share/classes/com/sun/source/util/Trees.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/source/util/Trees.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
@@ -38,6 +38,7 @@
 import javax.tools.Diagnostic;
 import javax.tools.JavaCompiler.CompilationTask;
 
+import com.sun.source.tree.CatchTree;
 import com.sun.source.tree.ClassTree;
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.tree.MethodTree;
@@ -207,4 +208,11 @@
     public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg,
             com.sun.source.tree.Tree t,
             com.sun.source.tree.CompilationUnitTree root);
+
+    /**
+     * Gets the lub of an exception parameter declared in a catch clause.
+     * @param tree the tree for the catch clause
+     * @return The lub of the exception parameter
+     */
+    public abstract TypeMirror getLub(CatchTree tree);
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Tue May 03 22:17:58 2011 -0700
@@ -149,11 +149,20 @@
         ClassUseMapper mapper = new ClassUseMapper(configuration.root, classtree);
         ClassDoc[] classes = configuration.root.classes();
         for (int i = 0; i < classes.length; i++) {
-            ClassUseWriter.generate(configuration, mapper, classes[i]);
+            // If -nodeprecated option is set and the containing package is marked
+            // as deprecated, do not generate the class-use page. We will still generate
+            // the class-use page if the class is marked as deprecated but the containing
+            // package is not since it could still be linked from that package-use page.
+            if (!(configuration.nodeprecated &&
+                    Util.isDeprecated(classes[i].containingPackage())))
+                ClassUseWriter.generate(configuration, mapper, classes[i]);
         }
         PackageDoc[] pkgs = configuration.packages;
         for (int i = 0; i < pkgs.length; i++) {
-            PackageUseWriter.generate(configuration, mapper, pkgs[i]);
+            // If -nodeprecated option is set and the package is marked
+            // as deprecated, do not generate the package-use page.
+            if (!(configuration.nodeprecated && Util.isDeprecated(pkgs[i])))
+                PackageUseWriter.generate(configuration, mapper, pkgs[i]);
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2009, 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
@@ -31,6 +31,7 @@
 import com.sun.javadoc.*;
 import java.util.*;
 import java.io.*;
+import java.net.*;
 
 /**
  * Configure the output based on the command line options.
@@ -48,6 +49,7 @@
  * @author Robert Field.
  * @author Atul Dambalkar.
  * @author Jamie Ho
+ * @author Bhavesh Patel (Modified)
  */
 public class ConfigurationImpl extends Configuration {
 
@@ -110,6 +112,11 @@
     public String stylesheetfile = "";
 
     /**
+     * Argument for command line option "-Xdocrootparent".
+     */
+    public String docrootparent = "";
+
+    /**
      * True if command line option "-nohelp" is used. Default value is false.
      */
     public boolean nohelp = false;
@@ -239,6 +246,8 @@
                 stylesheetfile =  os[1];
             } else  if (opt.equals("-charset")) {
                 charset =  os[1];
+            } else if (opt.equals("-xdocrootparent")) {
+                docrootparent = os[1];
             } else  if (opt.equals("-nohelp")) {
                 nohelp = true;
             } else  if (opt.equals("-splitindex")) {
@@ -322,7 +331,8 @@
                    option.equals("-helpfile") ||
                    option.equals("-stylesheetfile") ||
                    option.equals("-charset") ||
-                   option.equals("-overview")) {
+                   option.equals("-overview") ||
+                   option.equals("-xdocrootparent")) {
             return 2;
         } else {
             return 0;
@@ -372,6 +382,13 @@
                     return false;
                 }
                 nohelp = true;
+            } else if (opt.equals("-xdocrootparent")) {
+                try {
+                    new URL(os[1]);
+                } catch (MalformedURLException e) {
+                    reporter.printError(getText("doclet.MalformedURL", os[1]));
+                    return false;
+                }
             } else if (opt.equals("-overview")) {
                 if (nooverview == true) {
                     reporter.printError(getText("doclet.Option_conflict",
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java	Tue May 03 22:17:58 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
@@ -42,15 +42,15 @@
 public class DeprecatedListWriter extends SubWriterHolderWriter {
 
     private static final String[] ANCHORS = new String[] {
-        "interface", "class", "enum", "exception", "error", "annotation_type",
-         "field", "method", "constructor", "enum_constant",
+        "package", "interface", "class", "enum", "exception", "error",
+        "annotation_type", "field", "method", "constructor", "enum_constant",
         "annotation_type_member"
     };
 
     private static final String[] HEADING_KEYS = new String[] {
-        "doclet.Deprecated_Interfaces", "doclet.Deprecated_Classes",
-        "doclet.Deprecated_Enums", "doclet.Deprecated_Exceptions",
-        "doclet.Deprecated_Errors",
+        "doclet.Deprecated_Packages", "doclet.Deprecated_Interfaces",
+        "doclet.Deprecated_Classes", "doclet.Deprecated_Enums",
+        "doclet.Deprecated_Exceptions", "doclet.Deprecated_Errors",
         "doclet.Deprecated_Annotation_Types",
         "doclet.Deprecated_Fields",
         "doclet.Deprecated_Methods", "doclet.Deprecated_Constructors",
@@ -59,9 +59,9 @@
     };
 
     private static final String[] SUMMARY_KEYS = new String[] {
-        "doclet.deprecated_interfaces", "doclet.deprecated_classes",
-        "doclet.deprecated_enums", "doclet.deprecated_exceptions",
-        "doclet.deprecated_errors",
+        "doclet.deprecated_packages", "doclet.deprecated_interfaces",
+        "doclet.deprecated_classes", "doclet.deprecated_enums",
+        "doclet.deprecated_exceptions", "doclet.deprecated_errors",
         "doclet.deprecated_annotation_types",
         "doclet.deprecated_fields",
         "doclet.deprecated_methods", "doclet.deprecated_constructors",
@@ -70,7 +70,7 @@
     };
 
     private static final String[] HEADER_KEYS = new String[] {
-        "doclet.Interface", "doclet.Class",
+        "doclet.Package", "doclet.Interface", "doclet.Class",
         "doclet.Enum", "doclet.Exceptions",
         "doclet.Errors",
         "doclet.AnnotationType",
@@ -116,7 +116,7 @@
             DeprecatedListWriter depr =
                    new DeprecatedListWriter(configuration, filename);
             depr.generateDeprecatedListFile(
-                   new DeprecatedAPIListBuilder(configuration.root));
+                   new DeprecatedAPIListBuilder(configuration));
             depr.close();
         } catch (IOException exc) {
             configuration.standardmessage.error(
@@ -149,8 +149,14 @@
                 memberTableHeader[0] = configuration.getText("doclet.0_and_1",
                         configuration.getText(HEADER_KEYS[i]),
                         configuration.getText("doclet.Description"));
-                writers[i].addDeprecatedAPI(deprapi.getList(i),
-                        HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
+                // DeprecatedAPIListBuilder.PACKAGE == 0, so if i == 0, it is
+                // a PackageDoc.
+                if (i == DeprecatedAPIListBuilder.PACKAGE)
+                    addPackageDeprecatedAPI(deprapi.getList(i),
+                            HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
+                else
+                    writers[i - 1].addDeprecatedAPI(deprapi.getList(i),
+                            HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
             }
         }
         body.addContent(div);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Tue May 03 22:17:58 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
@@ -198,23 +198,27 @@
             PackageIndexFrameWriter.generate(configuration);
         }
         PackageDoc prev = null, next;
-        for(int i = 0; i < packages.length; i++) {
-            PackageFrameWriter.generate(configuration, packages[i]);
-            next = (i + 1 < packages.length && packages[i+1].name().length() > 0) ?
-                packages[i+1] : null;
-            //If the next package is unnamed package, skip 2 ahead if possible
-            next = (i + 2 < packages.length && next == null) ?
-                packages[i+2]: next;
-            AbstractBuilder packageSummaryBuilder = configuration.
-                getBuilderFactory().getPackageSummaryBuilder(
-                packages[i], prev, next);
-            packageSummaryBuilder.build();
-            if (configuration.createtree) {
-                PackageTreeWriter.generate(configuration,
-                        packages[i], prev, next,
-                        configuration.nodeprecated);
+        for (int i = 0; i < packages.length; i++) {
+            // if -nodeprecated option is set and the package is marked as
+            // deprecated, do not generate the package-summary.html, package-frame.html
+            // and package-tree.html pages for that package.
+            if (!(configuration.nodeprecated && Util.isDeprecated(packages[i]))) {
+                PackageFrameWriter.generate(configuration, packages[i]);
+                next = (i + 1 < packages.length &&
+                        packages[i + 1].name().length() > 0) ? packages[i + 1] : null;
+                //If the next package is unnamed package, skip 2 ahead if possible
+                next = (i + 2 < packages.length && next == null) ? packages[i + 2] : next;
+                AbstractBuilder packageSummaryBuilder =
+                        configuration.getBuilderFactory().getPackageSummaryBuilder(
+                        packages[i], prev, next);
+                packageSummaryBuilder.build();
+                if (configuration.createtree) {
+                    PackageTreeWriter.generate(configuration,
+                            packages[i], prev, next,
+                            configuration.nodeprecated);
+                }
+                prev = packages[i];
             }
-            prev = packages[i];
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 03 22:17:58 2011 -0700
@@ -159,22 +159,42 @@
         StringBuilder buf = new StringBuilder();
         int previndex = 0;
         while (true) {
-            // Search for lowercase version of {@docRoot}
-            index = lowerHtml.indexOf("{@docroot}", previndex);
-            // If next {@docRoot} tag not found, append rest of htmlstr and exit loop
-            if (index < 0) {
-                buf.append(htmlstr.substring(previndex));
-                break;
-            }
-            // If next {@docroot} tag found, append htmlstr up to start of tag
-            buf.append(htmlstr.substring(previndex, index));
-            previndex = index + 10;  // length for {@docroot} string
-            // Insert relative path where {@docRoot} was located
-            buf.append(relativepathNoSlash);
-            // Append slash if next character is not a slash
-            if (relativepathNoSlash.length() > 0 && previndex < htmlstr.length()
-                    && htmlstr.charAt(previndex) != '/') {
-                buf.append(DirectoryManager.URL_FILE_SEPARATOR);
+            if (configuration.docrootparent.length() > 0) {
+                // Search for lowercase version of {@docRoot}/..
+                index = lowerHtml.indexOf("{@docroot}/..", previndex);
+                // If next {@docRoot}/.. pattern not found, append rest of htmlstr and exit loop
+                if (index < 0) {
+                    buf.append(htmlstr.substring(previndex));
+                    break;
+                }
+                // If next {@docroot}/.. pattern found, append htmlstr up to start of tag
+                buf.append(htmlstr.substring(previndex, index));
+                previndex = index + 13;  // length for {@docroot}/.. string
+                // Insert docrootparent absolute path where {@docRoot}/.. was located
+
+                buf.append(configuration.docrootparent);
+                // Append slash if next character is not a slash
+                if (previndex < htmlstr.length() && htmlstr.charAt(previndex) != '/') {
+                    buf.append(DirectoryManager.URL_FILE_SEPARATOR);
+                }
+            } else {
+                // Search for lowercase version of {@docRoot}
+                index = lowerHtml.indexOf("{@docroot}", previndex);
+                // If next {@docRoot} tag not found, append rest of htmlstr and exit loop
+                if (index < 0) {
+                    buf.append(htmlstr.substring(previndex));
+                    break;
+                }
+                // If next {@docroot} tag found, append htmlstr up to start of tag
+                buf.append(htmlstr.substring(previndex, index));
+                previndex = index + 10;  // length for {@docroot} string
+                // Insert relative path where {@docRoot} was located
+                buf.append(relativepathNoSlash);
+                // Append slash if next character is not a slash
+                if (relativepathNoSlash.length() > 0 && previndex < htmlstr.length() &&
+                        htmlstr.charAt(previndex) != '/') {
+                    buf.append(DirectoryManager.URL_FILE_SEPARATOR);
+                }
             }
         }
         return buf.toString();
@@ -1395,6 +1415,44 @@
     }
 
     /**
+     * Add package deprecation information to the documentation tree
+     *
+     * @param deprPkgs list of deprecated packages
+     * @param headingKey the caption for the deprecated package table
+     * @param tableSummary the summary for the deprecated package table
+     * @param tableHeader table headers for the deprecated package table
+     * @param contentTree the content tree to which the deprecated package table will be added
+     */
+    protected void addPackageDeprecatedAPI(List<Doc> deprPkgs, String headingKey,
+            String tableSummary, String[] tableHeader, Content contentTree) {
+        if (deprPkgs.size() > 0) {
+            Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
+                    getTableCaption(configuration().getText(headingKey)));
+            table.addContent(getSummaryTableHeader(tableHeader, "col"));
+            Content tbody = new HtmlTree(HtmlTag.TBODY);
+            for (int i = 0; i < deprPkgs.size(); i++) {
+                PackageDoc pkg = (PackageDoc) deprPkgs.get(i);
+                HtmlTree td = HtmlTree.TD(HtmlStyle.colOne,
+                        getPackageLink(pkg, getPackageName(pkg)));
+                if (pkg.tags("deprecated").length > 0) {
+                    addInlineDeprecatedComment(pkg, pkg.tags("deprecated")[0], td);
+                }
+                HtmlTree tr = HtmlTree.TR(td);
+                if (i % 2 == 0) {
+                    tr.addStyle(HtmlStyle.altColor);
+                } else {
+                    tr.addStyle(HtmlStyle.rowColor);
+                }
+                tbody.addContent(tr);
+            }
+            table.addContent(tbody);
+            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
+            Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
+            contentTree.addContent(ul);
+        }
+    }
+
+    /**
      * Prine table header information about color, column span and the font.
      *
      * @param color Background color.
@@ -2120,7 +2178,7 @@
                 }
             }
             text = (isplaintext) ?
-                refMemName : getCode() + refMemName + getCodeEnd();
+                refMemName : getCode() + Util.escapeHtmlChars(refMemName) + getCodeEnd();
 
             result.append(getDocLink(LinkInfoImpl.CONTEXT_SEE_TAG, containing,
                 refMem, (label.length() == 0)? text: label, false));
@@ -2280,6 +2338,7 @@
     public String commentTagsToString(Tag holderTag, Doc doc, Tag[] tags,
             boolean isFirstSentence) {
         StringBuilder result = new StringBuilder();
+        boolean textTagChange = false;
         // Array of all possible inline tags for this javadoc run
         configuration.tagletManager.checkTags(doc, tags, true);
         for (int i = 0; i < tags.length; i++) {
@@ -2295,13 +2354,26 @@
                 result.append(output == null ? "" : output.toString());
                 if (originalLength == 0 && isFirstSentence && tagelem.name().equals("@inheritDoc") && result.length() > 0) {
                     break;
+                } else if (configuration.docrootparent.length() > 0 &&
+                        tagelem.name().equals("@docRoot") &&
+                        ((tags[i + 1]).text()).startsWith("/..")) {
+                    //If Xdocrootparent switch ON, set the flag to remove the /.. occurance after
+                    //{@docRoot} tag in the very next Text tag.
+                    textTagChange = true;
+                    continue;
                 } else {
-                        continue;
+                    continue;
                 }
             } else {
+                String text = tagelem.text();
+                //If Xdocrootparent switch ON, remove the /.. occurance after {@docRoot} tag.
+                if (textTagChange) {
+                    text = text.replaceFirst("/..", "");
+                    textTagChange = false;
+                }
                 //This is just a regular text tag.  The text may contain html links (<a>)
                 //or inline tag {@docRoot}, which will be handled as special cases.
-                String text = redirectRelativeLinks(tagelem.holder(), tagelem.text());
+                text = redirectRelativeLinks(tagelem.holder(), text);
 
                 // Replace @docRoot only if not represented by an instance of DocRootTaglet,
                 // that is, only if it was not present in a source file doc comment.
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Tue May 03 22:17:58 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
@@ -93,7 +93,7 @@
             packgen = new PackageFrameWriter(configuration, packageDoc);
             String pkgName = Util.getPackageName(packageDoc);
             Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
-            Content pkgNameContent = new StringContent(pkgName);
+            Content pkgNameContent = new RawHtml(pkgName);
             Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
                     packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent));
             body.addContent(heading);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Tue May 03 22:17:58 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
@@ -80,7 +80,10 @@
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
         for(int i = 0; i < packages.length; i++) {
-            if (packages[i] != null) {
+            // Do not list the package if -nodeprecated option is set and the
+            // package is marked as deprecated.
+            if (packages[i] != null &&
+                    (!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
                 ul.addContent(getPackage(packages[i]));
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Tue May 03 22:17:58 2011 -0700
@@ -137,6 +137,8 @@
     protected void addPackagesList(PackageDoc[] packages, Content tbody) {
         for (int i = 0; i < packages.length; i++) {
             if (packages[i] != null && packages[i].name().length() > 0) {
+                if (configuration.nodeprecated && Util.isDeprecated(packages[i]))
+                    continue;
                 Content packageLinkContent = getPackageLink(packages[i],
                         getPackageName(packages[i]));
                 Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Tue May 03 22:17:58 2011 -0700
@@ -242,11 +242,16 @@
      */
     protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
         Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
-                getHyperLink("", pkg.name(), new StringContent(Util.getPackageName(pkg))));
+                getHyperLink("", Util.getPackageName(pkg),
+                new RawHtml(Util.getPackageName(pkg))));
         contentTree.addContent(tdFirst);
         HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
         tdLast.addStyle(HtmlStyle.colLast);
-        addSummaryComment(pkg, tdLast);
+        if (pkg != null && pkg.name().length() != 0) {
+            addSummaryComment(pkg, tdLast);
+        } else {
+            tdLast.addContent(getSpace());
+        }
         contentTree.addContent(tdLast);
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Tue May 03 22:17:58 2011 -0700
@@ -114,11 +114,12 @@
         Content packageHead = new RawHtml(heading);
         tHeading.addContent(packageHead);
         div.addContent(tHeading);
+        addDeprecationInfo(div);
         if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
-            HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV);
-            subTitleDiv.addStyle(HtmlStyle.subTitle);
-            addSummaryComment(packageDoc, subTitleDiv);
-            div.addContent(subTitleDiv);
+            HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
+            docSummaryDiv.addStyle(HtmlStyle.docSummary);
+            addSummaryComment(packageDoc, docSummaryDiv);
+            div.addContent(docSummaryDiv);
             Content space = getSpace();
             Content descLink = getHyperLink("", "package_description",
                     descriptionLabel, "", "");
@@ -139,6 +140,28 @@
     }
 
     /**
+     * Add the package deprecation information to the documentation tree.
+     *
+     * @param div the content tree to which the deprecation information will be added
+     */
+    public void addDeprecationInfo(Content div) {
+        Tag[] deprs = packageDoc.tags("deprecated");
+        if (Util.isDeprecated(packageDoc)) {
+            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
+            deprDiv.addStyle(HtmlStyle.deprecatedContent);
+            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase);
+            deprDiv.addContent(deprPhrase);
+            if (deprs.length > 0) {
+                Tag[] commentTags = deprs[0].inlineTags();
+                if (commentTags.length > 0) {
+                    addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv);
+                }
+            }
+            div.addContent(deprDiv);
+        }
+    }
+
+    /**
      * {@inheritDoc}
      */
     public Content getSummaryHeader() {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Tue May 03 22:17:58 2011 -0700
@@ -82,12 +82,20 @@
         }
         PackageDoc[] pds = rd.specifiedPackages();
         for (int i = 0; i < pds.length; i++) {
-            convertPackage(configuration, pds[i], outputdir);
+            // If -nodeprecated option is set and the package is marked as deprecated,
+            // do not convert the package files to HTML.
+            if (!(configuration.nodeprecated && Util.isDeprecated(pds[i])))
+                convertPackage(configuration, pds[i], outputdir);
         }
         ClassDoc[] cds = rd.specifiedClasses();
         for (int i = 0; i < cds.length; i++) {
-            convertClass(configuration, cds[i],
-                    getPackageOutputDir(outputdir, cds[i].containingPackage()));
+            // If -nodeprecated option is set and the class is marked as deprecated
+            // or the containing package is deprecated, do not convert the
+            // package files to HTML.
+            if (!(configuration.nodeprecated &&
+                    (Util.isDeprecated(cds[i]) || Util.isDeprecated(cds[i].containingPackage()))))
+                convertClass(configuration, cds[i],
+                        getPackageOutputDir(outputdir, cds[i].containingPackage()));
         }
     }
 
@@ -106,7 +114,12 @@
         String classOutputdir = getPackageOutputDir(outputdir, pd);
         ClassDoc[] cds = pd.allClasses();
         for (int i = 0; i < cds.length; i++) {
-            convertClass(configuration, cds[i], classOutputdir);
+            // If -nodeprecated option is set and the class is marked as deprecated,
+            // do not convert the package files to HTML. We do not check for
+            // containing package deprecation since it is already check in
+            // the calling method above.
+            if (!(configuration.nodeprecated && Util.isDeprecated(cds[i])))
+                convertClass(configuration, cds[i], classOutputdir);
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Tue May 03 22:17:58 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
@@ -59,7 +59,10 @@
      * {@inheritDoc}
      */
     public TagletOutput getDocRootOutput() {
-        return new TagletOutputImpl(htmlWriter.relativepathNoSlash);
+        if (htmlWriter.configuration.docrootparent.length() > 0)
+            return new TagletOutputImpl(htmlWriter.configuration.docrootparent);
+        else
+            return new TagletOutputImpl(htmlWriter.relativepathNoSlash);
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Tue May 03 22:17:58 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
@@ -132,7 +132,11 @@
             HtmlTree ul = new HtmlTree(HtmlTag.UL);
             ul.addStyle(HtmlStyle.horizontal);
             for (int i = 0; i < packages.length; i++) {
-                if (packages[i].name().length() == 0) {
+                // If the package name length is 0 or if -nodeprecated option
+                // is set and the package is marked as deprecated, do not include
+                // the page in the list of package hierarchies.
+                if (packages[i].name().length() == 0 ||
+                        (configuration.nodeprecated && Util.isDeprecated(packages[i]))) {
                     continue;
                 }
                 String link = pathString(packages[i], "package-tree.html");
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java	Tue May 03 22:17:58 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
@@ -46,6 +46,7 @@
     contentContainer,
     description,
     details,
+    docSummary,
     header,
     horizontal,
     footer,
@@ -67,6 +68,7 @@
     subNavList,
     subTitle,
     summary,
+    deprecatedContent,
     tabEnd,
     title,
     topNav;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties	Tue May 03 22:17:58 2011 -0700
@@ -68,6 +68,7 @@
 doclet.see.malformed_tag=Tag {0}: Malformed: {1}
 doclet.Inherited_API_Summary=Inherited API Summary
 doclet.Deprecated_API=Deprecated API
+doclet.Deprecated_Packages=Deprecated Packages
 doclet.Deprecated_Classes=Deprecated Classes
 doclet.Deprecated_Enums=Deprecated Enums
 doclet.Deprecated_Interfaces=Deprecated Interfaces
@@ -79,6 +80,7 @@
 doclet.Deprecated_Methods=Deprecated Methods
 doclet.Deprecated_Enum_Constants=Deprecated Enum Constants
 doclet.Deprecated_Annotation_Type_Members=Deprecated Annotation Type Elements
+doclet.deprecated_packages=deprecated packages
 doclet.deprecated_classes=deprecated classes
 doclet.deprecated_enums=deprecated enums
 doclet.deprecated_interfaces=deprecated interfaces
@@ -245,6 +247,7 @@
   -tag <name>:<locations>:<header>  Specify single argument custom tags\n\
   -taglet                           The fully qualified name of Taglet to register\n\
   -tagletpath                       The path to Taglets\n\
+  -Xdocrootparent <url>             Replaces all appearances of @docRoot followed by /.. in doc comments with <url>\n\
   -charset <charset>                Charset for cross-platform viewing of generated documentation.\n\
   -helpfile <file>                  Include file that help link links to\n\
   -linksource                       Generate source in HTML\n\
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, 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
@@ -419,7 +419,7 @@
             docencoding = encoding;
         }
 
-        classDocCatalog = new ClassDocCatalog(root.specifiedClasses());
+        classDocCatalog = new ClassDocCatalog(root.specifiedClasses(), this);
         initTagletManager(customTagStrs);
     }
 
@@ -677,15 +677,18 @@
     }
 
     /**
-     * Return true if the doc element is getting documented, depending upon
-     * -nodeprecated option and @deprecated tag used. Return true if
-     * -nodeprecated is not used or @deprecated tag is not used.
+     * Return true if the ClassDoc element is getting documented, depending upon
+     * -nodeprecated option and the deprecation information. Return true if
+     * -nodeprecated is not used. Return false if -nodeprecated is used and if
+     * either ClassDoc element is deprecated or the containing package is deprecated.
+     *
+     * @param cd the ClassDoc for which the page generation is checked
      */
-    public boolean isGeneratedDoc(Doc doc) {
+    public boolean isGeneratedDoc(ClassDoc cd) {
         if (!nodeprecated) {
             return true;
         }
-        return (doc.tags("deprecated")).length == 0;
+        return !(Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage()));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Tue May 03 22:17:58 2011 -0700
@@ -2,17 +2,10 @@
 /*
 Overall document style
 */
-* {
-    margin:0;
-    padding:0;
-}
 body {
     font-family:Helvetica, Arial, sans-serif;
     color:#000000;
 }
-p {
-    margin:20px 0;
-}
 pre {
     font-size:1.0em;
 }
@@ -30,35 +23,18 @@
 }
 ul {
     margin:10px 0 10px 20px;
-}
-li {
-    list-style:disc;
-}
-dl dt {
-    font-size:0.95em;
-    font-weight:bold;
-    margin:10px 0 0 0;
-}
-dl dd {
-    margin:10px 0 10px 20px;
-}
-dl dd ul {
-    margin-left:0;
-}
-dl dd ul li {
-    list-style:none;
-    margin:10px 0 10px 0;
+    list-style-type:disc;
 }
 caption {
     background: #CCCCFF;
     color:#000000;
-    text-align: left;
-    font-size: 150%;
-    font-weight: bold;
-    border-left: 2px ridge;
-    border-right: 2px ridge;
-    border-top: 2px ridge;
-    padding-left: 5px;
+    text-align:left;
+    font-size:150%;
+    font-weight:bold;
+    border-left:2px ridge;
+    border-right:2px ridge;
+    border-top:2px ridge;
+    padding-left:5px;
     width:auto;
 }
 /*
@@ -70,11 +46,11 @@
     color:#000000;
 }
 .legalCopy {
-    margin:7px;
+    margin:7px 0;
 }
 .bar {
     font-size:1em;
-    margin:10px 0 0 10px;
+    margin:10px 0 0 2px;
 }
 .bar a {
     font-weight:normal;
@@ -84,24 +60,21 @@
 */
 .topNav {
     border-top:2px solid #C0C0C0;
-    margin:7px;
     padding:7px 0;
     height:2.8em;
-    width:99%;
+    width:100%;
     min-width:600px;
 }
 .bottomNav {
     border-top:2px solid #C0C0C0;
-    margin:7px;
     padding:7px 0;
     height:2.8em;
-    width:99%;
+    width:100%;
 }
 .subNav {
     border-bottom:2px solid #C0C0C0;
     float:left;
-    width:99%;
-    margin:7px;
+    width:100%;
     min-width:600px;
 }
 .subNav div {
@@ -120,7 +93,7 @@
 /* Navigation bar list styles */
 .topNav ul.navList, .bottomNav ul.navList {
     background-color:#EEEEFF;
-    padding:7px 5px;
+    padding:4px 4px;
     margin:0;
     float:left;
     width:80%;
@@ -128,7 +101,7 @@
 ul.navList li{
     list-style:none;
     float:left;
-    padding:3px 4px;
+    padding:0 4px;
     color:#000000;
     font-size:0.98em;
 }
@@ -142,14 +115,16 @@
 .subNav ul.navList {
     float:left;
     margin:0;
+    padding:0;
     font-size:0.8em;
     width:350px;
 }
 ul.subNavList {
     float:left;
-    margin:0;
     font-size:0.8em;
     width:350px;
+    margin:0;
+    padding:0;
 }
 ul.subNavList li{
     list-style:none;
@@ -161,16 +136,16 @@
 */
 .header, .footer {
     clear:both;
-    margin:0 7px;
+    padding:10px 0;
 }
 .indexHeader {
     font-size:0.9em;
-    margin:10px 0 7px 10px;
+    margin:10px 0 0 2px;
 }
 .header ul {
     padding-left:20px;
 }
-/* Header and footer title styles */ 
+/* Header and footer title styles */
 .header h1.title {
     font-size:1.4em;
     text-align:center;
@@ -181,7 +156,16 @@
     margin:0;
 }
 .subTitle {
+    padding-top:10px;
+}
+/*
+Content styles
+*/
+.deprecatedContent {
     margin:0;
+    padding:10px 0;
+}
+.docSummary {
     padding-top:10px;
 }
 /*
@@ -190,11 +174,11 @@
 .contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer,
 .constantValuesContainer {
     clear:both;
-    padding:10px 10px;
     position:relative;
+    padding-bottom:20px;
 }
 .indexContainer {
-    padding:0 0 10px 10px;
+    padding:0 0 0 2px;
     font-size:0.9em;
 }
 /*
@@ -221,7 +205,8 @@
 .indexContainer h2 {
     font-weight:normal;
     font-size:1.0em;
-    padding:10px 0 0 0;
+    padding:5px 0 0 0;
+    margin:10px 0 0 0;
 }
 .contentContainer h2 {
     margin:10px 0;
@@ -263,7 +248,7 @@
     background:#CCCCFF;
     border:0;
     border:2px ridge;
-    padding-left:5px;
+    margin:0;
 }
 div.summary ul.blockList ul.blockList ul.blockList li.blockList h3 {
     background:#EEEEFF;
@@ -274,23 +259,22 @@
 div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
     font-size:1.15em;
     font-weight:bold;
-    padding:0 0 10px 0;
+    padding:0 0 5px 0;
+    margin:0;
 }
 /*
 Table styles
 */
 .contentContainer table {
-    border-collapse: collapse ;
+    border-collapse:collapse ;
     width:100%;
 }
 .contentContainer table td, .contentContainer table th {
     border:2px ridge;
-    padding:3px;
 }
 /* Constant values page table styles */
 .constantValuesContainer table {
-    border-collapse: collapse ;
-    margin:0 0 10px 0;
+    border-collapse:collapse;
 }
 .constantValuesContainer table caption{
     font-size:0.95em;
@@ -303,12 +287,9 @@
 }
 /* Class-use/Package-use page table styles */
 .classUseContainer table {
-    border-collapse: collapse ;
+    border-collapse:collapse ;
     width:100%;
-    margin:0 0 15px 0;
-}
-.classUseContainer ul li ul li table {
-    margin-bottom:30px;
+    margin:0 0 10px 0;
 }
 .classUseContainer ul li ul li table caption{
     font-size:0.95em;
@@ -365,6 +346,7 @@
 /* Container specific list styles */
 .indexContainer ul {
     margin:0;
+    padding:0;
 }
 .indexContainer ul li {
     list-style:none;
@@ -376,6 +358,7 @@
     list-style:none;
     border:0;
     border-bottom:2px ridge;
+    height:1%;
 }
 .serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockListLast {
     list-style:none;
@@ -395,6 +378,7 @@
 div.details ul.blockList ul.blockList ul.blockList li.blockList {
     border:0;
     border-bottom:2px ridge;
+    height:1%;
 }
 /* Definition list styles */
 ul.blockList li.blockList dl{
@@ -413,9 +397,17 @@
 ul.blockList li.blockList pre{
     margin:0 0 15px 0;
 }
+.description dl dt {
+    font-size:0.95em;
+    font-weight:bold;
+    margin:5px 0 0 0;
+}
+.description dl dd {
+    margin:10px 0 10px 20px;
+}
 /* List content styles */
 ul.blockList li.blockList ul.blockList li.blockList pre{
-    margin:10px 0 15px 0;
+    margin:10px 0 10px 0;
 }
 ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList pre,
 ul.blockList li.blockList ul.blockList li.blockList ul.blockListLast li.blockList pre{
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/DeprecatedTaglet.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/DeprecatedTaglet.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 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
@@ -47,13 +47,6 @@
     /**
      * {@inheritDoc}
      */
-    public boolean inPackage() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
         return writer.deprecatedTagOutput(holder);
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,9 @@
 
 package com.sun.tools.doclets.internal.toolkit.util;
 
+import java.util.*;
 import com.sun.javadoc.*;
-import java.util.*;
+import com.sun.tools.doclets.internal.toolkit.Configuration;
 
 /**
  * This class acts as an artificial PackageDoc for classes specified
@@ -88,13 +89,16 @@
       */
      private Map<String,Set<ClassDoc>> interfaces;
 
+     private Configuration configuration;
+
      /**
       * Construct a new ClassDocCatalog.
       *
       * @param classdocs the array of ClassDocs to catalog
       */
-     public ClassDocCatalog (ClassDoc[] classdocs) {
+     public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) {
          init();
+         this.configuration = config;
          for (int i = 0; i < classdocs.length; i++) {
              addClassDoc(classdocs[i]);
          }
@@ -151,9 +155,10 @@
       private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) {
 
           PackageDoc pkg = classdoc.containingPackage();
-          if (pkg.isIncluded()) {
-              //No need to catalog this class since it's package is
-              //included on the command line
+          if (pkg.isIncluded() || (configuration.nodeprecated && Util.isDeprecated(pkg))) {
+              //No need to catalog this class if it's package is
+              //included on the command line or if -nodeprecated option is set
+              // and the containing package is marked as deprecated.
               return;
           }
           String key = Util.getPackageName(pkg);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, 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
@@ -122,8 +122,12 @@
      */
     private void buildTree(ClassDoc[] classes, Configuration configuration) {
         for (int i = 0; i < classes.length; i++) {
+            // In the tree page (e.g overview-tree.html) do not include
+            // information of classes which are deprecated or are a part of a
+            // deprecated package.
             if (configuration.nodeprecated &&
-                    classes[i].tags("deprecated").length > 0) {
+                    (Util.isDeprecated(classes[i]) ||
+                    Util.isDeprecated(classes[i].containingPackage()))) {
                 continue;
             }
             if (classes[i].isEnum()) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, 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
@@ -27,27 +27,29 @@
 
 import com.sun.javadoc.*;
 import java.util.*;
+import com.sun.tools.doclets.internal.toolkit.Configuration;
 
 /**
- * Build list of all the deprecated classes, constructors, fields and methods.
+ * Build list of all the deprecated packages, classes, constructors, fields and methods.
  *
  * @author Atul M Dambalkar
  */
 public class DeprecatedAPIListBuilder {
 
-    public static final int NUM_TYPES = 11;
+    public static final int NUM_TYPES = 12;
 
-    public static final int INTERFACE = 0;
-    public static final int CLASS = 1;
-    public static final int ENUM = 2;
-    public static final int EXCEPTION = 3;
-    public static final int ERROR = 4;
-    public static final int ANNOTATION_TYPE = 5;
-    public static final int FIELD = 6;
-    public static final int METHOD = 7;
-    public static final int CONSTRUCTOR = 8;
-    public static final int ENUM_CONSTANT = 9;
-    public static final int ANNOTATION_TYPE_MEMBER = 10;
+    public static final int PACKAGE = 0;
+    public static final int INTERFACE = 1;
+    public static final int CLASS = 2;
+    public static final int ENUM = 3;
+    public static final int EXCEPTION = 4;
+    public static final int ERROR = 5;
+    public static final int ANNOTATION_TYPE = 6;
+    public static final int FIELD = 7;
+    public static final int METHOD = 8;
+    public static final int CONSTRUCTOR = 9;
+    public static final int ENUM_CONSTANT = 10;
+    public static final int ANNOTATION_TYPE_MEMBER = 11;
 
     /**
      * List of deprecated type Lists.
@@ -58,25 +60,33 @@
     /**
      * Constructor.
      *
-     * @param root Root of the tree.
+     * @param configuration the current configuration of the doclet
      */
-    public DeprecatedAPIListBuilder(RootDoc root) {
+    public DeprecatedAPIListBuilder(Configuration configuration) {
         deprecatedLists = new ArrayList<List<Doc>>();
         for (int i = 0; i < NUM_TYPES; i++) {
             deprecatedLists.add(i, new ArrayList<Doc>());
         }
-        buildDeprecatedAPIInfo(root);
+        buildDeprecatedAPIInfo(configuration);
     }
 
     /**
      * Build the sorted list of all the deprecated APIs in this run.
-     * Build separate lists for deprecated classes, constructors, methods and
-     * fields.
+     * Build separate lists for deprecated packages, classes, constructors,
+     * methods and fields.
      *
-     * @param root Root of the tree.
+     * @param configuration the current configuration of the doclet.
      */
-    private void buildDeprecatedAPIInfo(RootDoc root) {
-        ClassDoc[] classes = root.classes();
+    private void buildDeprecatedAPIInfo(Configuration configuration) {
+        PackageDoc[] packages = configuration.packages;
+        PackageDoc pkg;
+        for (int c = 0; c < packages.length; c++) {
+            pkg = packages[c];
+            if (Util.isDeprecated(pkg)) {
+                getList(PACKAGE).add(pkg);
+            }
+        }
+        ClassDoc[] classes = configuration.root.classes();
         for (int i = 0; i < classes.length; i++) {
             ClassDoc cd = classes[i];
             if (Util.isDeprecated(cd)) {
@@ -90,7 +100,7 @@
                     getList(ENUM).add(cd);
                 } else if (cd.isError()) {
                     getList(ERROR).add(cd);
-                }else if (cd.isAnnotationType()) {
+                } else if (cd.isAnnotationType()) {
                     getList(ANNOTATION_TYPE).add(cd);
                 }
             }
@@ -102,7 +112,7 @@
             }
             if (cd.isAnnotationType()) {
                 composeDeprecatedList(getList(ANNOTATION_TYPE_MEMBER),
-                    ((AnnotationTypeDoc) cd).elements());
+                        ((AnnotationTypeDoc) cd).elements());
             }
         }
         sortDeprecatedLists();
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, 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
@@ -207,7 +207,17 @@
      * Should this doc element be added to the index map?
      */
     protected boolean shouldAddToIndexMap(Doc element) {
-        return !(noDeprecated && element.tags("deprecated").length > 0);
+        if (element instanceof PackageDoc)
+            // Do not add to index map if -nodeprecated option is set and the
+            // package is marked as deprecated.
+            return !(noDeprecated && Util.isDeprecated(element));
+        else
+            // Do not add to index map if -nodeprecated option is set and if the
+            // Doc is marked as deprecated or the containing package is marked as
+            // deprecated.
+            return !(noDeprecated &&
+                    (Util.isDeprecated(element) ||
+                    Util.isDeprecated(((ProgramElementDoc)element).containingPackage())));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2003, 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
@@ -76,13 +76,16 @@
 
     protected void generatePackageListFile(RootDoc root) {
         PackageDoc[] packages = configuration.packages;
-        String[] names = new String[packages.length];
+        ArrayList<String> names = new ArrayList<String>();
         for (int i = 0; i < packages.length; i++) {
-            names[i] = packages[i].name();
+            // if the -nodeprecated option is set and the package is marked as
+            // deprecated, do not include it in the packages list.
+            if (!(configuration.nodeprecated && Util.isDeprecated(packages[i])))
+                names.add(packages[i].name());
         }
-        Arrays.sort(names);
-        for (int i = 0; i < packages.length; i++) {
-            println(names[i]);
+        Collections.sort(names);
+        for (int i = 0; i < names.size(); i++) {
+            println(names.get(i));
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue May 03 22:17:58 2011 -0700
@@ -861,11 +861,15 @@
      * @param doc the Doc to check.
      * @return true if the given Doc is deprecated.
      */
-    public static boolean isDeprecated(ProgramElementDoc doc) {
+    public static boolean isDeprecated(Doc doc) {
         if (doc.tags("deprecated").length > 0) {
             return true;
         }
-        AnnotationDesc[] annotationDescList = doc.annotations();
+        AnnotationDesc[] annotationDescList;
+        if (doc instanceof PackageDoc)
+            annotationDescList = ((PackageDoc)doc).annotations();
+        else
+            annotationDescList = ((ProgramElementDoc)doc).annotations();
         for (int i = 0; i < annotationDescList.length; i++) {
             if (annotationDescList[i].annotationType().qualifiedName().equals(
                    java.lang.Deprecated.class.getName())){
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
@@ -34,11 +34,13 @@
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
 import javax.lang.model.type.TypeMirror;
 import javax.tools.Diagnostic;
 import javax.tools.JavaCompiler;
 import javax.tools.JavaFileObject;
 
+import com.sun.source.tree.CatchTree;
 import com.sun.source.tree.CompilationUnitTree;
 import com.sun.source.tree.Scope;
 import com.sun.source.tree.Tree;
@@ -49,7 +51,7 @@
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.TypeSymbol;
 import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.UnionClassType;
 import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Enter;
@@ -430,4 +432,16 @@
                 log.useSource(oldSource);
         }
     }
+
+    @Override
+    public TypeMirror getLub(CatchTree tree) {
+        JCCatch ct = (JCCatch) tree;
+        JCVariableDecl v = ct.param;
+        if (v.type != null && v.type.getKind() == TypeKind.UNION) {
+            UnionClassType ut = (UnionClassType) v.type;
+            return ut.getLub();
+        } else {
+            return v.type;
+        }
+    }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java	Tue May 03 22:17:58 2011 -0700
@@ -649,7 +649,7 @@
                 public Iterator<Symbol> iterator() {
                     return new CompoundScopeIterator(subScopes) {
                         Iterator<Symbol> nextIterator(Scope s) {
-                            return s.getElements().iterator();
+                            return s.getElements(sf).iterator();
                         }
                     };
                 }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Tue May 03 22:17:58 2011 -0700
@@ -186,6 +186,9 @@
     public boolean allowSimplifiedVarargs() {
         return compareTo(JDK1_7) >= 0;
     }
+    public boolean allowObjectToPrimitiveCast() {
+        return compareTo(JDK1_7) >= 0;
+    }
     public static SourceVersion toSourceVersion(Source source) {
         switch(source) {
         case JDK1_2:
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Tue May 03 22:17:58 2011 -0700
@@ -25,6 +25,8 @@
 
 package com.sun.tools.javac.code;
 
+import java.util.Collections;
+
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.code.Symbol.*;
 
@@ -741,6 +743,38 @@
         }
     }
 
+    // a clone of a ClassType that knows about the alternatives of a union type.
+    public static class UnionClassType extends ClassType implements UnionType {
+        final List<? extends Type> alternatives_field;
+
+        public UnionClassType(ClassType ct, List<? extends Type> alternatives) {
+            super(ct.outer_field, ct.typarams_field, ct.tsym);
+            allparams_field = ct.allparams_field;
+            supertype_field = ct.supertype_field;
+            interfaces_field = ct.interfaces_field;
+            all_interfaces_field = ct.interfaces_field;
+            alternatives_field = alternatives;
+        }
+
+        public Type getLub() {
+            return tsym.type;
+        }
+
+        public java.util.List<? extends TypeMirror> getAlternatives() {
+            return Collections.unmodifiableList(alternatives_field);
+        }
+
+        @Override
+        public TypeKind getKind() {
+            return TypeKind.UNION;
+        }
+
+        @Override
+        public <R, P> R accept(TypeVisitor<R, P> v, P p) {
+            return v.visitUnion(this, p);
+        }
+    }
+
     public static class ArrayType extends Type
             implements javax.lang.model.type.ArrayType {
 
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Tue May 03 22:17:58 2011 -0700
@@ -74,8 +74,9 @@
     final JavacMessages messages;
     final Names names;
     final boolean allowBoxing;
+    final boolean allowCovariantReturns;
+    final boolean allowObjectToPrimitiveCast;
     final ClassReader reader;
-    final Source source;
     final Check chk;
     List<Warner> warnStack = List.nil();
     final Name capturedName;
@@ -92,9 +93,11 @@
         context.put(typesKey, this);
         syms = Symtab.instance(context);
         names = Names.instance(context);
-        allowBoxing = Source.instance(context).allowBoxing();
+        Source source = Source.instance(context);
+        allowBoxing = source.allowBoxing();
+        allowCovariantReturns = source.allowCovariantReturns();
+        allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
         reader = ClassReader.instance(context);
-        source = Source.instance(context);
         chk = Check.instance(context);
         capturedName = names.fromString("<captured wildcard>");
         messages = JavacMessages.instance(context);
@@ -409,6 +412,7 @@
                     return
                         s.tag == BOT || s.tag == CLASS ||
                         s.tag == ARRAY || s.tag == TYPEVAR;
+                case WILDCARD: //we shouldn't be here - avoids crash (see 7034495)
                 case NONE:
                     return false;
                 default:
@@ -949,8 +953,9 @@
             return true;
 
         if (t.isPrimitive() != s.isPrimitive())
-            return allowBoxing && (isConvertible(t, s, warn) || isConvertible(s, t, warn));
-
+            return allowBoxing && (
+                    isConvertible(t, s, warn)
+                    || (allowObjectToPrimitiveCast && isConvertible(s, t, warn)));
         if (warn != warnStack.head) {
             try {
                 warnStack = warnStack.prepend(warn);
@@ -2309,7 +2314,7 @@
             if (elemtype == t.elemtype)
                 return t;
             else
-                return new ArrayType(elemtype, t.tsym);
+                return new ArrayType(upperBound(elemtype), t.tsym);
         }
 
         @Override
@@ -3070,7 +3075,7 @@
 
         if (hasSameArgs(r1, r2))
             return covariantReturnType(r1.getReturnType(), r2res, warner);
-        if (!source.allowCovariantReturns())
+        if (!allowCovariantReturns)
             return false;
         if (isSubtypeUnchecked(r1.getReturnType(), r2res, warner))
             return true;
@@ -3087,7 +3092,7 @@
     public boolean covariantReturnType(Type t, Type s, Warner warner) {
         return
             isSameType(t, s) ||
-            source.allowCovariantReturns() &&
+            allowCovariantReturns &&
             !t.isPrimitive() &&
             !s.isPrimitive() &&
             isAssignable(t, s, warner);
@@ -3293,7 +3298,7 @@
         }
         if (giveWarning && !isReifiable(reverse ? from : to))
             warn.warn(LintCategory.UNCHECKED);
-        if (!source.allowCovariantReturns())
+        if (!allowCovariantReturns)
             // reject if there is a common method signature with
             // incompatible return types.
             chk.checkCompatibleAbstracts(warn.pos(), from, to);
@@ -3320,7 +3325,7 @@
         Type t2 = to;
         if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments()))
             return false;
-        if (!source.allowCovariantReturns())
+        if (!allowCovariantReturns)
             // reject if there is a common method signature with
             // incompatible return types.
             chk.checkCompatibleAbstracts(warn.pos(), from, to);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Tue May 03 22:17:58 2011 -0700
@@ -168,11 +168,11 @@
             }
             JCIdent left = (JCIdent)assign.lhs;
             Symbol method = rs.resolveQualifiedMethod(left.pos(),
-                                                      env,
-                                                      a.type,
-                                                      left.name,
-                                                      List.<Type>nil(),
-                                                      null);
+                                                          env,
+                                                          a.type,
+                                                          left.name,
+                                                          List.<Type>nil(),
+                                                          null);
             left.sym = method;
             left.type = method.type;
             if (method.owner != a.type.tsym)
@@ -190,6 +190,15 @@
     Attribute enterAttributeValue(Type expected,
                                   JCExpression tree,
                                   Env<AttrContext> env) {
+        //first, try completing the attribution value sym - if a completion
+        //error is thrown, we should recover gracefully, and display an
+        //ordinary resolution diagnostic.
+        try {
+            expected.tsym.complete();
+        } catch(CompletionFailure e) {
+            log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym);
+            return new Attribute.Error(expected);
+        }
         if (expected.isPrimitive() || types.isSameType(expected, syms.stringType)) {
             Type result = attr.attribExpr(tree, env, expected);
             if (result.isErroneous())
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue May 03 22:17:58 2011 -0700
@@ -2910,6 +2910,7 @@
 
     public void visitTypeUnion(JCTypeUnion tree) {
         ListBuffer<Type> multicatchTypes = ListBuffer.lb();
+        ListBuffer<Type> all_multicatchTypes = null; // lazy, only if needed
         for (JCExpression typeTree : tree.alternatives) {
             Type ctype = attribType(typeTree, env);
             ctype = chk.checkType(typeTree.pos(),
@@ -2931,9 +2932,23 @@
                     }
                 }
                 multicatchTypes.append(ctype);
+                if (all_multicatchTypes != null)
+                    all_multicatchTypes.append(ctype);
+            } else {
+                if (all_multicatchTypes == null) {
+                    all_multicatchTypes = ListBuffer.lb();
+                    all_multicatchTypes.appendList(multicatchTypes);
+                }
+                all_multicatchTypes.append(ctype);
             }
         }
-        tree.type = result = check(tree, types.lub(multicatchTypes.toList()), TYP, pkind, pt);
+        Type t = check(tree, types.lub(multicatchTypes.toList()), TYP, pkind, pt);
+        if (t.tag == CLASS) {
+            List<Type> alternatives =
+                ((all_multicatchTypes == null) ? multicatchTypes : all_multicatchTypes).toList();
+            t = new UnionClassType((ClassType) t, alternatives);
+        }
+        tree.type = result = t;
     }
 
     public void visitTypeParameter(JCTypeParameter tree) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue May 03 22:17:58 2011 -0700
@@ -681,6 +681,12 @@
                 "cant.apply.diamond.1",
                 t, diags.fragment("diamond.non.generic", t));
             return types.createErrorType(t);
+        } else if (tree.typeargs != null &&
+                tree.typeargs.nonEmpty()) {
+            log.error(tree.clazz.pos(),
+                "cant.apply.diamond.1",
+                t, diags.fragment("diamond.and.explicit.params", t));
+            return types.createErrorType(t);
         } else {
             return t;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Tue May 03 22:17:58 2011 -0700
@@ -1153,8 +1153,7 @@
         if (chk.subset(exc, caughtInTry)) {
             log.error(pos, "except.already.caught", exc);
         } else if (!chk.isUnchecked(pos, exc) &&
-                exc.tsym != syms.throwableType.tsym &&
-                exc.tsym != syms.exceptionType.tsym &&
+                !isExceptionOrThrowable(exc) &&
                 !chk.intersects(exc, thrownInTry)) {
             log.error(pos, "except.never.thrown.in.try", exc);
         } else if (allowImprovedCatchAnalysis) {
@@ -1163,7 +1162,8 @@
             // unchecked exception, the result list would not be empty, as the augmented
             // thrown set includes { RuntimeException, Error }; if 'exc' was a checked
             // exception, that would have been covered in the branch above
-            if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty()) {
+            if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty() &&
+                    !isExceptionOrThrowable(exc)) {
                 String key = catchableThrownTypes.length() == 1 ?
                         "unreachable.catch" :
                         "unreachable.catch.1";
@@ -1171,6 +1171,12 @@
             }
         }
     }
+    //where
+        private boolean isExceptionOrThrowable(Type exc) {
+            return exc.tsym == syms.throwableType.tsym ||
+                exc.tsym == syms.exceptionType.tsym;
+        }
+
 
     public void visitConditional(JCConditional tree) {
         scanCond(tree.cond);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue May 03 22:17:58 2011 -0700
@@ -1609,18 +1609,31 @@
             // type.tsym.flatName() should == proxy.enumFlatName
             TypeSymbol enumTypeSym = proxy.enumType.tsym;
             VarSymbol enumerator = null;
-            for (Scope.Entry e = enumTypeSym.members().lookup(proxy.enumerator);
-                 e.scope != null;
-                 e = e.next()) {
-                if (e.sym.kind == VAR) {
-                    enumerator = (VarSymbol)e.sym;
-                    break;
+            CompletionFailure failure = null;
+            try {
+                for (Scope.Entry e = enumTypeSym.members().lookup(proxy.enumerator);
+                     e.scope != null;
+                     e = e.next()) {
+                    if (e.sym.kind == VAR) {
+                        enumerator = (VarSymbol)e.sym;
+                        break;
+                    }
                 }
             }
+            catch (CompletionFailure ex) {
+                failure = ex;
+            }
             if (enumerator == null) {
-                log.error("unknown.enum.constant",
-                          currentClassFile, enumTypeSym, proxy.enumerator);
-                result = new Attribute.Error(enumTypeSym.type);
+                if (failure != null) {
+                    log.warning("unknown.enum.constant.reason",
+                              currentClassFile, enumTypeSym, proxy.enumerator,
+                              failure.getDiagnostic());
+                } else {
+                    log.warning("unknown.enum.constant",
+                              currentClassFile, enumTypeSym, proxy.enumerator);
+                }
+                result = new Attribute.Enum(enumTypeSym.type,
+                        new VarSymbol(0, proxy.enumerator, syms.botType, enumTypeSym));
             } else {
                 result = new Attribute.Enum(enumTypeSym.type, enumerator);
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java	Tue May 03 22:17:58 2011 -0700
@@ -479,7 +479,12 @@
             state.pop(1);// index
             Type a = state.stack[state.stacksize-1];
             state.pop(1);
-            state.push(types.erasure(types.elemtype(a))); }
+            //sometimes 'null type' is treated as a one-dimensional array type
+            //see Gen.visitLiteral - we should handle this case accordingly
+            Type stackType = a.tag == BOT ?
+                syms.objectType :
+                types.erasure(types.elemtype(a));
+            state.push(stackType); }
             break;
         case goto_:
             markDead();
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Tue May 03 22:17:58 2011 -0700
@@ -72,11 +72,11 @@
     }
 
     public Element asElement(TypeMirror t) {
-        Type type = cast(Type.class, t);
-        switch (type.tag) {
-            case TypeTags.CLASS:
-            case TypeTags.ERROR:
-            case TypeTags.TYPEVAR:
+        switch (t.getKind()) {
+            case DECLARED:
+            case ERROR:
+            case TYPEVAR:
+                Type type = cast(Type.class, t);
                 return type.asElement();
             default:
                 return null;
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue May 03 22:17:58 2011 -0700
@@ -762,9 +762,6 @@
 compiler.err.unclosed.str.lit=\
     unclosed string literal
 
-compiler.err.unknown.enum.constant=\
-    in class file {0}: unknown enum constant {1}.{2}
-
 # 0: name
 compiler.err.unsupported.encoding=\
     unsupported encoding: {0}
@@ -1307,6 +1304,15 @@
 compiler.warn.annotation.method.not.found.reason=\
     Cannot find annotation method ''{1}()'' in type ''{0}'': {2}
 
+# 0: symbol, 1: name
+compiler.warn.unknown.enum.constant=\
+    unknown enum constant {1}.{2}
+
+# 0: symbol, 1: name, 2: message segment
+compiler.warn.unknown.enum.constant.reason=\
+    unknown enum constant {1}.{2}\n\
+    reason: {3}
+
 # 0: type, 1: type
 compiler.warn.raw.class.use=\
     found raw type: {0}\n\
@@ -1618,6 +1624,9 @@
 compiler.misc.diamond.non.generic=\
     cannot use ''<>'' with non-generic class {0}
 
+compiler.misc.diamond.and.explicit.params=\
+    cannot use ''<>'' with explicit type parameters for constructor
+
 # 0: type, 1: list of type
 compiler.misc.explicit.param.do.not.conform.to.bounds=\
     explicit type argument {0} does not conform to declared bound(s) {1}
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/legacy.properties	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/legacy.properties	Tue May 03 22:17:58 2011 -0700
@@ -266,6 +266,8 @@
 com.sun.swing.internal.plaf.basic.resources = tiger legacy
 com.sun.swing.internal.plaf.metal.resources = tiger legacy
 com.sun.swing.internal.plaf.synth.resources = tiger legacy
+com.sun.tracing = tiger legacy
+com.sun.tracing.dtrace = tiger legacy
 java.applet = tiger legacy
 java.awt = tiger legacy
 java.awt.color = tiger legacy
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,101 @@
+/*
+ * 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 6553182
+ * @summary This test verifies the -Xdocrootparent option.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestDocRootLink
+ * @run main TestDocRootLink
+ */
+public class TestDocRootLink extends JavadocTester {
+
+    private static final String BUG_ID = "6553182";
+    private static final String[][] TEST1 = {
+        {BUG_ID + FS + "pkg1" + FS + "C1.html",
+            "<a href=\"../../technotes/guides/index.html\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+            "<a href=\"../../technotes/guides/index.html\">"
+        }
+    };
+    private static final String[][] NEGATED_TEST1 = {
+        {BUG_ID + FS + "pkg1" + FS + "C1.html",
+            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
+            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
+        }
+    };
+    private static final String[][] TEST2 = {
+        {BUG_ID + FS + "pkg2" + FS + "C2.html",
+            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
+        },
+        {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
+            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
+        }
+    };
+    private static final String[][] NEGATED_TEST2 = {
+        {BUG_ID + FS + "pkg2" + FS + "C2.html",
+            "<a href=\"../../technotes/guides/index.html\">"
+        },
+        {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
+            "<a href=\"../../technotes/guides/index.html\">"
+        }
+    };
+    private static final String[] ARGS1 =
+            new String[]{
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"
+    };
+    private static final String[] ARGS2 =
+            new String[]{
+        "-d", BUG_ID, "-Xdocrootparent", "http://download.oracle.com/javase/7/docs", "-sourcepath", SRC_DIR, "pkg2"
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestDocRootLink tester = new TestDocRootLink();
+        run(tester, ARGS1, TEST1, NEGATED_TEST1);
+        run(tester, ARGS2, TEST2, NEGATED_TEST2);
+        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/langtools/test/com/sun/javadoc/testDocRootLink/pkg1/C1.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+/**
+ * Class 1. This is a test.
+ * Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. Lets see if this works
+ * or not.
+ */
+public class C1 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testDocRootLink/pkg1/package.html	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,18 @@
+<html>
+<head>
+<title>javax.management package</title>
+</head>
+<body bgcolor="white">
+This is a test.
+      <p id="spec">
+    @see <a href="{@docRoot}/../technotes/guides/index.html">
+      Test document 1</a>
+      in particular the
+      <a href="{@docRoot}/../technotes/guides/index.html">
+
+      Test document 2.</a>
+
+	@since 1.5
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testDocRootLink/pkg2/C2.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg2;
+
+/**
+ * Class 1. This is a test.
+ * Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. Lets see if this works
+ * or not.
+ */
+public class C2 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testDocRootLink/pkg2/package.html	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,18 @@
+<html>
+<head>
+<title>javax.management package</title>
+</head>
+<body bgcolor="white">
+This is a test.
+      <p id="spec">
+    @see <a href="{@docRoot}/../technotes/guides/index.html">
+      Test document 1</a>
+      in particular the
+      <a href="{@docRoot}/../technotes/guides/index.html">
+
+      Test document 2.</a>
+
+	@since 1.5
+
+</body>
+</html>
--- a/langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java	Tue May 03 22:17:58 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,20 +23,19 @@
 
 /*
  * @test
- * @bug      4934778 4777599
+ * @bug      4934778 4777599 6553182
  * @summary  Make sure that the -help option works properly.  Make sure
  *           the help link appears in the documentation.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestHelpOption
+ * @build    JavadocTester TestHelpOption
  * @run main TestHelpOption
  */
 
 public class TestHelpOption extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "4934778-4777599";
+    private static final String BUG_ID = "4934778-4777599-6553182";
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
@@ -79,6 +78,7 @@
         {STANDARD_OUTPUT, "-tag "},
         {STANDARD_OUTPUT, "-taglet "},
         {STANDARD_OUTPUT, "-tagletpath "},
+        {STANDARD_OUTPUT, "-Xdocrootparent "},
         {STANDARD_OUTPUT, "-charset "},
         {STANDARD_OUTPUT, "-helpfile "},
         {STANDARD_OUTPUT, "-linksource "},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,78 @@
+/*
+ * 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      6758050
+ * @summary  Test HTML output for nested generic types.
+ * @author   bpatel
+ * @library  ../lib/
+ * @build    JavadocTester TestNestedGenerics
+ * @run main TestNestedGenerics
+ */
+
+public class TestNestedGenerics extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "6758050";
+
+    //Javadoc arguments.
+    private static final String[] ARGS = new String[]{
+        "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR,
+        "pkg"
+    };
+
+    //Input for string search tests.
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg" + FS + "NestedGenerics.html",
+            "<div class=\"block\">Contains <a " +
+            "href=\"../pkg/NestedGenerics.html#foo(java.util.Map)\"><code>foo" +
+            "(java.util.Map&lt;A, java.util.Map&lt;A, A&gt;&gt;)</code></a></div>"
+        }
+    };
+    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) {
+        TestNestedGenerics tester = new TestNestedGenerics();
+        run(tester, ARGS, TEST, NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testNestedGenerics/pkg/NestedGenerics.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+import java.util.Map;
+
+/** Contains {@link #foo} */
+public class NestedGenerics {
+  public static <A> void foo(Map<A, Map<A, A>> map) {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/C2.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+/**
+ * Another test class.
+ *
+ * @author Bhavesh Patel
+ */
+public class C2 {
+
+    public static enum ModalExclusionType {
+        /**
+         * Test comment.
+         */
+        NO_EXCLUDE,
+        /**
+         * Another comment.
+         */
+        APPLICATION_EXCLUDE
+    };
+
+    /**
+     * A string constant.
+     */
+    public static final String CONSTANT1 = "C2";
+
+    /**
+     * A sample method.
+     *
+     * @param param some parameter.
+     */
+    public void method(String param) {
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/FooDepr.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+import java.util.*;
+
+/**
+* Test Deprecated class
+* @deprecated This class is Deprecated.
+*/
+public class FooDepr {
+
+    public void method(Vector<Object> o){}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,103 @@
+/*
+ * 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      6492694
+ * @summary  Test package deprecation.
+ * @author   bpatel
+ * @library  ../lib/
+ * @build    JavadocTester TestPackageDeprecation
+ * @run main TestPackageDeprecation
+ */
+
+public class TestPackageDeprecation extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "6492694";
+
+    //Javadoc arguments.
+    private static final String[] ARGS1 = new String[]{
+        "-d", BUG_ID + "-1", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1",
+        SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java"
+    };
+    private static final String[] ARGS2 = new String[]{
+        "-d", BUG_ID + "-2", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "-nodeprecated",
+        "pkg", "pkg1", SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java"
+    };
+
+    //Input for string search tests.
+    private static final String[][] TEST1 = {
+        {BUG_ID + "-1" + FS + "pkg1" + FS + "package-summary.html",
+            "<div class=\"deprecatedContent\"><span class=\"strong\">Deprecated.</span>" + NL +
+            "<div class=\"block\"><i>This package is Deprecated.</i></div>"
+        },
+        {BUG_ID + "-1" + FS + "deprecated-list.html",
+            "<li><a href=\"#package\">Deprecated Packages</a></li>"
+        }
+    };
+    private static final String[][] TEST2 = NO_TEST;
+    private static final String[][] NEGATED_TEST1 = NO_TEST;
+    private static final String[][] NEGATED_TEST2 = {
+        {BUG_ID + "-2" + FS + "overview-summary.html", "pkg1"},
+        {BUG_ID + "-2" + FS + "allclasses-frame.html", "FooDepr"}
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestPackageDeprecation tester = new TestPackageDeprecation();
+        run(tester, ARGS1, TEST1, NEGATED_TEST1);
+        run(tester, ARGS2, TEST2, NEGATED_TEST2);
+        if ((new java.io.File(BUG_ID + "-2" + FS + "pkg1" + FS +
+                "package-summary.html")).exists()) {
+            throw new Error("Test Fails: packages summary should not be" +
+                    "generated for deprecated package.");
+        } else {
+            System.out.println("Test passes:  package-summary.html not found.");
+        }
+        if ((new java.io.File(BUG_ID + "-2" + FS + "FooDepr.html")).exists()) {
+            throw new Error("Test Fails: FooDepr should not be" +
+                    "generated as it is deprecated.");
+        } else {
+            System.out.println("Test passes:  FooDepr.html not found.");
+        }
+        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/langtools/test/com/sun/javadoc/testPackageDeprecation/pkg/A.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,35 @@
+/*
+ * 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 A {
+   /** Test constant. */
+   public static final String DEMO= "y";
+   public static final String THIS_IS_OK= "(x)";
+
+   public String DEMO_STRING = "<Hello World>";
+
+   public A() {
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/pkg1/ClassUseTest1.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+public class ClassUseTest1 <T extends Foo & Foo2> {
+
+    public <T extends Foo & Foo2> T method(T t) {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/pkg1/Foo.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+import java.util.*;
+
+/**
+* Test Deprecated class
+* @deprecated This class is Deprecated.
+*/
+public class Foo {
+
+    public void method(Vector<Object> o){}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/pkg1/Foo2.java	Tue May 03 22:17:58 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 pkg1;
+
+public interface Foo2 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testPackageDeprecation/pkg1/package-info.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Test pkg1 used.
+ * @deprecated This package is Deprecated.
+ */
+package pkg1;
--- a/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java	Tue May 03 22:17:58 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
@@ -23,19 +23,18 @@
 
 /*
  * @test
- * @bug      4494033
+ * @bug      4494033 7028815
  * @summary  Run tests on doclet stylesheet.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestStylesheet
+ * @build    JavadocTester TestStylesheet
  * @run main TestStylesheet
  */
 
 public class TestStylesheet extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "4494033";
+    private static final String BUG_ID = "4494033-7028815";
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
@@ -56,15 +55,18 @@
                 "body {" + NL + "    font-family:Helvetica, Arial, sans-serif;" + NL +
                 "    color:#000000;" + NL + "}"},
         {BUG_ID + FS + "stylesheet.css",
-                "dl dd ul li {" + NL + "    list-style:none;" + NL +
-                "    margin:10px 0 10px 0;" + NL + "}"},
+                "ul {" + NL + "    margin:10px 0 10px 20px;" + NL +
+                "    list-style-type:disc;" + NL + "}"},
         // Test whether a link to the stylesheet file is inserted properly
         // in the class documentation.
         {BUG_ID + FS + "pkg" + FS + "A.html",
                 "<link rel=\"stylesheet\" type=\"text/css\" " +
                 "href=\"../stylesheet.css\" title=\"Style\">"}
     };
-    private static final String[][] NEGATED_TEST = NO_TEST;
+    private static final String[][] NEGATED_TEST = {
+        {BUG_ID + FS + "stylesheet.css",
+                "* {" + NL + "    margin:0;" + NL + "    padding:0;" + NL + "}"}
+    };
 
     /**
      * The entry point of the test.
--- a/langtools/test/com/sun/javadoc/testSubTitle/TestSubTitle.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testSubTitle/TestSubTitle.java	Tue May 03 22:17:58 2011 -0700
@@ -37,8 +37,7 @@
     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>"
+            "<div class=\"block\">This is the description of package pkg.</div>"
         },
         {BUG_ID + FS + "pkg" + FS + "C.html",
             "<div class=\"subTitle\">pkg</div>"
--- a/langtools/test/tools/javac/6558548/T6558548.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/6558548/T6558548.java	Tue May 03 22:17:58 2011 -0700
@@ -1,9 +1,9 @@
 /*
  * @test /nodynamiccopyright/
- * @bug     6558548
+ * @bug     6558548 7039937
  * @summary The compiler needs to be aligned with clarified specification of throws
  * @compile/fail/ref=T6558548_latest.out -XDrawDiagnostics T6558548.java
- * @compile/fail/ref=T6558548_6.out -source 6 -XDrawDiagnostics T6558548.java
+ * @compile/fail/ref=T6558548_6.out -source 6 -Xlint:-options -XDrawDiagnostics T6558548.java
  */
 
 class T6558548 {
@@ -12,7 +12,7 @@
     void checked() throws InterruptedException {}
     void runtime() throws IllegalArgumentException {}
 
-    void m1() {
+    void m1a() {
         try {
             throw new java.io.FileNotFoundException();
         }
@@ -20,7 +20,7 @@
         catch(java.io.IOException exc) { } // 6: ok; latest: unreachable
     }
 
-    void m1a() {
+    void m1b() {
         try {
             throw new java.io.IOException();
         }
@@ -28,11 +28,20 @@
         catch(java.io.IOException exc) { } //ok
     }
 
-    void m2() {
+    void m1c() {
         try {
-            nothing();
+            throw new java.io.FileNotFoundException();
         }
-        catch(Exception exc) { } // ok
+        catch(java.io.FileNotFoundException exc) { }
+        catch(Exception ex) { } //ok (Exception/Throwable always allowed)
+    }
+
+    void m1d() {
+        try {
+            throw new java.io.FileNotFoundException();
+        }
+        catch(java.io.FileNotFoundException exc) { }
+        catch(Throwable ex) { } //ok (Exception/Throwable always allowed)
     }
 
     void m3() {
@@ -131,7 +140,7 @@
             runtime();
         }
         catch(RuntimeException exc) { }
-        catch(Exception exc) { } //6: ok; latest: unreachable
+        catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m17() {
@@ -139,7 +148,7 @@
             nothing();
         }
         catch(RuntimeException exc) { }
-        catch(Exception exc) { } //6: ok; latest: unreachable
+        catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m18() {
@@ -148,7 +157,7 @@
         }
         catch(RuntimeException exc) { }
         catch(InterruptedException exc) { }
-        catch(Exception exc) { } //6: ok; latest: unreachable
+        catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m19() {
@@ -157,7 +166,7 @@
         }
         catch(RuntimeException exc) { }
         catch(InterruptedException exc) { } //never thrown in try
-        catch(Exception exc) { } //6: ok; latest: unreachable
+        catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m20() {
@@ -166,7 +175,7 @@
         }
         catch(RuntimeException exc) { }
         catch(InterruptedException exc) { } //never thrown in try
-        catch(Exception exc) { } //6: ok; latest: unreachable
+        catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m21() {
@@ -182,7 +191,7 @@
             runtime();
         }
         catch(RuntimeException exc) { }
-        catch(Exception exc) { } // 6: ok; latest: unreachable
+        catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m23() {
@@ -190,7 +199,7 @@
             nothing();
         }
         catch(RuntimeException exc) { }
-        catch(Exception exc) { } // 6: ok; latest: unreachable
+        catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m24() {
@@ -208,7 +217,7 @@
         }
         catch(RuntimeException exc) { }
         catch(Error exc) { }
-        catch(Throwable exc) { } //6: ok; latest: unreachable
+        catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m26() {
@@ -217,7 +226,7 @@
         }
         catch(RuntimeException exc) { }
         catch(Error exc) { }
-        catch(Throwable exc) { } //6: ok; latest: unreachable
+        catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m27() {
@@ -227,7 +236,7 @@
         catch(RuntimeException exc) { }
         catch(Error exc) { }
         catch(InterruptedException exc) { }
-        catch(Throwable exc) { } //6: ok; latest: unreachable
+        catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m28() {
@@ -237,7 +246,7 @@
         catch(RuntimeException exc) { }
         catch(Error exc) { }
         catch(InterruptedException exc) { } //never thrown in try
-        catch(Throwable exc) { } //6: ok; latest: unreachable
+        catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m29() {
@@ -247,7 +256,7 @@
         catch(RuntimeException exc) { }
         catch(Error exc) { }
         catch(InterruptedException exc) { } //never thrown in try
-        catch(Throwable exc) { } //6: ok; latest: unreachable
+        catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m30() {
@@ -265,7 +274,7 @@
         }
         catch(RuntimeException exc) { }
         catch(Error exc) { }
-        catch(Throwable exc) { } //6: ok; latest: unreachable
+        catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m32() {
@@ -274,7 +283,7 @@
         }
         catch(RuntimeException exc) { }
         catch(Error exc) { }
-        catch(Throwable exc) { } //6: ok; latest: unreachable
+        catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed)
     }
 
     void m33() {
--- a/langtools/test/tools/javac/6558548/T6558548_6.out	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/6558548/T6558548_6.out	Tue May 03 22:17:58 2011 -0700
@@ -1,9 +1,7 @@
-- compiler.warn.source.no.bootclasspath: 1.6
-T6558548.java:159:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
 T6558548.java:168:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:239:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:249:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:291:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:298:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:177:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:248:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:258:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:300:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:307:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
 6 errors
-1 warning
--- a/langtools/test/tools/javac/6558548/T6558548_latest.out	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/6558548/T6558548_latest.out	Tue May 03 22:17:58 2011 -0700
@@ -1,23 +1,9 @@
 T6558548.java:20:9: compiler.warn.unreachable.catch: java.io.FileNotFoundException
-T6558548.java:134:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
-T6558548.java:142:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
-T6558548.java:151:9: compiler.warn.unreachable.catch.1: java.lang.InterruptedException,java.lang.RuntimeException
-T6558548.java:159:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:160:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
 T6558548.java:168:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:169:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
-T6558548.java:185:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
-T6558548.java:193:9: compiler.warn.unreachable.catch: java.lang.RuntimeException
-T6558548.java:211:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
-T6558548.java:220:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
-T6558548.java:230:9: compiler.warn.unreachable.catch.1: java.lang.InterruptedException,java.lang.RuntimeException,java.lang.Error
-T6558548.java:239:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:240:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
-T6558548.java:249:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:250:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
-T6558548.java:268:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
-T6558548.java:277:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error
-T6558548.java:291:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
-T6558548.java:298:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:177:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:248:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:258:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:300:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
+T6558548.java:307:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException
 6 errors
-15 warnings
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T7040104.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,72 @@
+/*
+ * 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 7040104
+ * @summary javac NPE on Object a[]; Object o = (a=null)[0];
+ */
+
+public class T7040104 {
+    public static void main(String[] args) {
+        T7040104 t = new T7040104();
+        t.test1();
+        t.test2();
+        t.test3();
+        if (t.npeCount != 3) {
+            throw new AssertionError();
+        }
+    }
+
+    int npeCount = 0;
+
+    void test1() {
+        Object a[];
+        try {
+            Object o = (a = null)[0];
+        }
+        catch (NullPointerException npe) {
+            npeCount++;
+        }
+    }
+
+    void test2() {
+        Object a[][];
+        try {
+            Object o = (a = null)[0][0];
+        }
+        catch (NullPointerException npe) {
+            npeCount++;
+        }
+    }
+
+    void test3() {
+        Object a[][][];
+        try {
+            Object o = (a = null)[0][0][0];
+        }
+        catch (NullPointerException npe) {
+            npeCount++;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/6550655/T6550655.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,191 @@
+/*
+ * 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     6550655
+ * @summary javac crashes when compiling against an annotated class
+ */
+
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaCompiler.CompilationTask;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class T6550655 {
+
+    JavaCompiler javacTool;
+    File testDir;
+    TestKind testKind;
+    EnumActionKind actionKind;
+
+    String testSource = "enum E { NORTH, SOUTH, WEST, EAST; }\n" +
+                        "@I(val = E.NORTH)class A {}\n" +
+                        "@interface I { E val(); }";
+
+    T6550655(JavaCompiler javacTool, File testDir, TestKind testKind, EnumActionKind actionKind) {
+        this.javacTool = javacTool;
+        this.testDir = testDir;
+        this.testKind = testKind;
+        this.actionKind = actionKind;
+    }
+
+    void test() {
+        testDir.mkdirs();
+        compile(null, new JavaSource("Test.java", testSource));
+        actionKind.doAction(this);
+        compile(new DiagnosticChecker(), testKind.source);
+    }
+
+    void compile(DiagnosticChecker dc, JavaSource... sources) {
+        try {
+            CompilationTask ct = javacTool.getTask(null, null, dc,
+                    Arrays.asList("-d", testDir.getAbsolutePath(), "-cp", testDir.getAbsolutePath()),
+                    null, Arrays.asList(sources));
+            ct.call();
+        }
+        catch (Exception e) {
+            error("Internal compilation error");
+        }
+    }
+
+    void replaceEnum(String newSource) {
+        compile(null, new JavaSource("Replace.java", newSource));
+    };
+
+    void removeEnum() {
+        File enumClass = new File(testDir, "E.class");
+        if (!enumClass.exists()) {
+            error("Expected file E.class does not exists in folder " + testDir);
+        }
+        enumClass.delete();
+    };
+
+    void error(String msg) {
+        System.err.println(msg);
+        nerrors++;
+    }
+
+    class DiagnosticChecker implements DiagnosticListener<JavaFileObject> {
+
+        String[][] expectedKeys = new String[][] {
+         //             DIRECT,                                         INDIRECT
+        {/*REPLACE1*/   "compiler.err.cant.resolve.location"     ,      "compiler.warn.unknown.enum.constant" },
+        {/*REPLACE2*/   "compiler.err.cant.resolve.location.args",      "compiler.warn.annotation.method.not.found" },
+        {/*REMOVE*/     "compiler.err.cant.resolve"              ,      "compiler.warn.unknown.enum.constant.reason" } };
+
+        String keyToIgnore = "compiler.err.attribute.value.must.be.constant";
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            String expectedCode = expectedKeys[actionKind.ordinal()][testKind.ordinal()];
+            if (!diagnostic.getCode().equals(keyToIgnore) &&
+                    !diagnostic.getCode().equals(expectedCode)) {
+                error("Unexpected diagnostic" +
+                      "\nfound " + diagnostic.getCode() +
+                      "\nexpected " + expectedCode +
+                      "\ntestKind " + testKind +
+                      "\nactionKind " + actionKind);
+            }
+        }
+    }
+
+    //global declarations
+
+    enum EnumActionKind {
+        REPLACE1("enum E { SOUTH, WEST, EAST; }") {
+            @Override
+            void doAction(T6550655 test) {
+                test.replaceEnum(optionalSource);
+            }
+        },
+        REPLACE2("@interface I { E valNew() default E.EAST; }") {
+            @Override
+            void doAction(T6550655 test) {
+                test.replaceEnum(optionalSource);
+            }
+        },
+        REMOVE(null) {
+            @Override
+            void doAction(T6550655 test) { test.removeEnum(); }
+        };
+
+        String optionalSource;
+
+        private EnumActionKind(String optionalSource) {
+            this.optionalSource = optionalSource;
+        }
+
+        abstract void doAction(T6550655 test);
+    }
+
+    enum TestKind {
+        DIRECT("@I(val = E.NORTH)class C1 {}"),
+        INDIRECT("class C2 { A a; }");
+
+        JavaSource source;
+
+        private TestKind(final String code) {
+            this.source = new JavaSource("Test.java", code);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        String SCRATCH_DIR = System.getProperty("user.dir");
+        JavaCompiler javacTool = ToolProvider.getSystemJavaCompiler();
+        int n = 0;
+        for (TestKind testKind : TestKind.values()) {
+            for (EnumActionKind actionKind : EnumActionKind.values()) {
+                File testDir = new File(SCRATCH_DIR, "test"+n);
+                new T6550655(javacTool, testDir, testKind, actionKind).test();
+                n++;
+            }
+        }
+        if (nerrors > 0) {
+            throw new AssertionError("Some errors have been detected");
+        }
+    }
+
+    static class JavaSource extends SimpleJavaFileObject {
+
+        String source;
+
+        public JavaSource(String filename, String source) {
+            super(URI.create("myfo:/" + filename), JavaFileObject.Kind.SOURCE);
+            this.source = source;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    static int nerrors = 0;
+}
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt	Tue May 03 22:17:58 2011 -0700
@@ -41,7 +41,6 @@
 compiler.err.type.var.more.than.once.in.result          # UNUSED
 compiler.err.undetermined.type
 compiler.err.unexpected.type
-compiler.err.unknown.enum.constant                      # in bad class file
 compiler.err.unsupported.cross.fp.lit                   # Scanner: host system dependent
 compiler.err.wrong.target.for.polymorphic.signature.definition     # Transitional 292
 compiler.misc.assignment.from.super-bound
@@ -112,3 +111,5 @@
 compiler.warn.unchecked.assign                          # DEAD, replaced by compiler.misc.unchecked.assign
 compiler.warn.unchecked.cast.to.type                    # DEAD, replaced by compiler.misc.unchecked.cast.to.type
 compiler.warn.unexpected.archive.file                   # Paths: zip file with unknown extn
+compiler.warn.unknown.enum.constant                     # in bad class file
+compiler.warn.unknown.enum.constant.reason              # in bad class file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/DiamondAndExplicitParams.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,34 @@
+/*
+ * 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.misc.diamond.and.explicit.params
+// key: compiler.err.cant.apply.diamond.1
+
+class DiamondAndAnonClass {
+    static class Foo<X> {
+        <Z> Foo() {}
+    }
+    void m() {
+        Foo<String> foo = new <Integer> Foo<>();
+    }
+}
--- a/langtools/test/tools/javac/diags/examples/UnreachableCatch1.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples/UnreachableCatch1.java	Tue May 03 22:17:58 2011 -0700
@@ -23,14 +23,21 @@
 
 // key: compiler.warn.unreachable.catch.1
 
+import java.io.*;
+
 class UnreachableCatch1 {
 
     void test() {
         try {
-            throw new IllegalArgumentException();
+            if (true) {
+                throw new FileNotFoundException();
+            }
+            else {
+                throw new EOFException();
+            }
         }
-        catch(Error err) { }
-        catch(RuntimeException rex) { }
-        catch(Throwable t) { } //unreachable
+        catch(FileNotFoundException fnf) { }
+        catch(EOFException eof) { }
+        catch(IOException ex) { } //unreachable
     }
 }
--- a/langtools/test/tools/javac/generics/7034511/T7034511a.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/generics/7034511/T7034511a.java	Tue May 03 22:17:58 2011 -0700
@@ -1,6 +1,7 @@
 /*
  * @test /nodynamiccopyright/
- * @bug     7034511
+ * @ignore backing out 7034511, see 7040883
+ * @bug     7034511 7040883
  * @summary Loophole in typesafety
  * @compile/fail/ref=T7034511a.out -XDrawDiagnostics T7034511a.java
  */
--- a/langtools/test/tools/javac/generics/7034511/T7034511b.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/generics/7034511/T7034511b.java	Tue May 03 22:17:58 2011 -0700
@@ -1,6 +1,7 @@
 /*
  * @test /nodynamiccopyright/
- * @bug     7034511
+ * @ignore backing out 7034511, see 7040883
+ * @bug     7034511 7040883
  * @summary Loophole in typesafety
  * @compile/fail/ref=T7034511b.out -XDrawDiagnostics T7034511b.java
  */
--- a/langtools/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java	Tue May 03 22:17:58 2011 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7030150
+ * @bug 7030150 7039931
  * @summary Type inference for generic instance creation failed for formal type parameter
  */
 
@@ -125,6 +125,14 @@
                 default: return false;
             }
         }
+
+        boolean matches(TypeArgumentKind other) {
+            switch (other) {
+                case STRING: return this != INTEGER;
+                case INTEGER: return this != STRING;
+                default: return true;
+            }
+        }
     }
 
     enum ArgumentKind {
@@ -149,9 +157,11 @@
                 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);
+                            for (TypeArgumentKind diamondArgKind : TypeArgumentKind.values()) {
+                                for (ArgumentKind argKind : ArgumentKind.values()) {
+                                    new GenericConstructorAndDiamondTest(boundKind, constructorKind,
+                                            declArgKind, arity, useArgKind, diamondArgKind, argKind).run(comp, fm);
+                                }
                             }
                         }
                     }
@@ -165,18 +175,21 @@
     TypeArgumentKind declTypeArgumentKind;
     TypeArgArity useTypeArgArity;
     TypeArgumentKind useTypeArgumentKind;
+    TypeArgumentKind diamondTypeArgumentKind;
     ArgumentKind argumentKind;
     JavaSource source;
     DiagnosticChecker diagChecker;
 
     GenericConstructorAndDiamondTest(BoundKind boundKind, ConstructorKind constructorKind,
             TypeArgumentKind declTypeArgumentKind, TypeArgArity useTypeArgArity,
-            TypeArgumentKind useTypeArgumentKind, ArgumentKind argumentKind) {
+            TypeArgumentKind useTypeArgumentKind, TypeArgumentKind diamondTypeArgumentKind,
+            ArgumentKind argumentKind) {
         this.boundKind = boundKind;
         this.constructorKind = constructorKind;
         this.declTypeArgumentKind = declTypeArgumentKind;
         this.useTypeArgArity = useTypeArgArity;
         this.useTypeArgumentKind = useTypeArgumentKind;
+        this.diamondTypeArgumentKind = diamondTypeArgumentKind;
         this.argumentKind = argumentKind;
         this.source = new JavaSource();
         this.diagChecker = new DiagnosticChecker();
@@ -189,7 +202,7 @@
                           "}\n" +
                           "class Test {\n" +
                               "void test() {\n" +
-                                 "Foo#TA1 f = new #TA2 Foo<>(#A);\n" +
+                                 "Foo#TA1 f = new #TA2 Foo<#TA3>(#A);\n" +
                               "}\n" +
                           "}\n";
 
@@ -201,6 +214,7 @@
                     replace("#CK", constructorKind.constrStr)
                     .replace("#TA1", declTypeArgumentKind.getArgs(TypeArgArity.ONE))
                     .replace("#TA2", useTypeArgumentKind.getArgs(useTypeArgArity))
+                    .replace("#TA3", diamondTypeArgumentKind.typeargStr)
                     .replace("#A", argumentKind.argStr);
         }
 
@@ -227,9 +241,15 @@
         boolean badMethodTypeArg = constructorKind != ConstructorKind.NON_GENERIC &&
                 !useTypeArgumentKind.matches(argumentKind);
 
-        boolean badGenericType = !boundKind.matches(declTypeArgumentKind);
+        boolean badExplicitParams = (useTypeArgumentKind != TypeArgumentKind.NONE &&
+                diamondTypeArgumentKind == TypeArgumentKind.NONE) ||
+                !boundKind.matches(diamondTypeArgumentKind);
 
-        boolean shouldFail = badActual || badArity || badMethodTypeArg || badGenericType;
+        boolean badGenericType = !boundKind.matches(declTypeArgumentKind) ||
+                !diamondTypeArgumentKind.matches(declTypeArgumentKind);
+
+        boolean shouldFail = badActual || badArity ||
+                badMethodTypeArg || badExplicitParams || badGenericType;
 
         if (shouldFail != diagChecker.errorFound) {
             throw new Error("invalid diagnostics for source:\n" +
--- a/langtools/test/tools/javac/generics/diamond/7030150/Neg01.java	Wed Jul 05 17:43:08 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*
- * @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);
-}
--- a/langtools/test/tools/javac/generics/diamond/7030150/Neg01.out	Wed Jul 05 17:43:08 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-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
--- a/langtools/test/tools/javac/generics/diamond/7030150/Neg02.java	Wed Jul 05 17:43:08 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*
- * @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>("");
-}
--- a/langtools/test/tools/javac/generics/diamond/7030150/Neg02.out	Wed Jul 05 17:43:08 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-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
--- a/langtools/test/tools/javac/generics/diamond/7030150/Neg03.java	Wed Jul 05 17:43:08 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*
- * @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);
-}
--- a/langtools/test/tools/javac/generics/diamond/7030150/Neg03.out	Wed Jul 05 17:43:08 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-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
--- a/langtools/test/tools/javac/generics/diamond/7030150/Pos01.java	Wed Jul 05 17:43:08 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * 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);
-}
--- a/langtools/test/tools/javac/generics/diamond/7030150/Pos02.java	Wed Jul 05 17:43:08 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * 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/langtools/test/tools/javac/generics/typevars/T7040883.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     7040883 7034511
+ * @summary Compilation error: "length in Array is defined in an inaccessible class or interface"
+ * @compile T7040883.java
+ */
+
+public class T7040883 {
+
+    <Z> Z[] getListeners(Class<Z> z) { return null; }
+
+    void test(String s) {
+        int i = getListeners(s.getClass()).length;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/wildcards/7034495/T7034495.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     7034495
+ * @summary Javac asserts on usage of wildcards in bounds
+ * @compile/fail/ref=T7034495.out -XDrawDiagnostics T7034495.java
+ */
+class T7034495 {
+
+    interface A<T> {
+        T foo();
+    }
+
+    interface B<T> {
+        T foo();
+    }
+
+    interface C<T extends A<?> & B<?>> { }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/wildcards/7034495/T7034495.out	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,2 @@
+T7034495.java:40:17: compiler.err.types.incompatible.diff.ret: T7034495.B<?>, T7034495.A<?>, foo()
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/multicatch/Neg07.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,50 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 7039822
+ * @summary Verify typing of lub of exception parameter w.r.t getClass
+ * @author Joseph D. Darcy
+ * @compile/fail/ref=Neg07.out -XDrawDiagnostics Neg07.java
+ */
+
+public class Neg07 {
+    private static void test(int i) {
+        try {
+            thrower(i);
+        } catch (SonException | DaughterException e) {
+            Class<? extends HasFoo> clazz2 = e.getClass(); // Rejected!
+            HasFoo m = e;
+            e.foo();
+        }
+    }
+
+    private static interface HasFoo {
+        void foo();
+    }
+
+    static void thrower(int i) throws SonException, DaughterException {
+        if (i == 0)
+            throw new SonException();
+        else
+            throw new DaughterException();
+    }
+
+    private static class ParentException extends RuntimeException {}
+
+    private static class SonException
+        extends ParentException
+        implements HasFoo {
+
+        public void foo() {
+            System.out.println("SonException.foo");
+        }
+    }
+
+    private static class DaughterException
+        extends ParentException
+        implements HasFoo {
+
+        public void foo() {
+            System.out.println("DaughterException.foo");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/multicatch/Neg07.out	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,2 @@
+Neg07.java:14:56: compiler.err.prob.found.req: (compiler.misc.incompatible.types), java.lang.Class<compiler.misc.type.captureof: 1, ? extends Neg07.ParentException>, java.lang.Class<? extends Neg07.HasFoo>
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/multicatch/Pos10.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,103 @@
+/*
+ * 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 7039822
+ * @summary Verify lub of an exception parameter can be an intersection type
+ * @author Joseph D. Darcy
+ */
+
+public class Pos10 {
+    public static void main(String... args) {
+        test(0);
+        test(1);
+
+        if (record != 0b11)
+            throw new RuntimeException("Unexpected exception execution: " +
+                                       record);
+        if (closeRecord != 0b11)
+            throw new RuntimeException("Unexpected close execution: " +
+                                       closeRecord);
+    }
+
+    private static int record = 0;
+    private static int closeRecord = 0;
+
+    private static void test(int i) {
+        try {
+            thrower(i);
+        } catch (SonException | DaughterException e) {
+            Class<? extends ParentException> clazz = e.getClass();
+            HasFoo m = e;
+            e.foo();
+
+            try (AutoCloseable ac = e) {
+                e.toString();
+            } catch(Exception except) {
+                throw new RuntimeException(except);
+            }
+        }
+    }
+
+    private static interface HasFoo {
+        void foo();
+    }
+
+    private static void thrower(int i) throws SonException, DaughterException {
+        if (i == 0)
+            throw new SonException();
+        else
+            throw new DaughterException();
+    }
+
+    private static class ParentException extends RuntimeException {}
+
+    private static class SonException
+        extends ParentException
+        implements HasFoo, AutoCloseable {
+
+        public void foo() {
+            record |= 0b01;
+        }
+
+        @Override
+        public void close() {
+            closeRecord |= 0b01;
+        }
+    }
+
+    private static class DaughterException
+        extends ParentException
+        implements HasFoo, AutoCloseable {
+
+        public void foo() {
+            record |= 0b10;
+        }
+
+        @Override
+        public  void close() {
+            closeRecord |= 0b10;
+        }
+    }
+}
--- a/langtools/test/tools/javac/multicatch/model/Model01.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/multicatch/model/Model01.java	Tue May 03 22:17:58 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
@@ -43,6 +43,6 @@
             else
                 throw new B2();
         }
-        catch(B1 | B2 ex) { }
+        catch(@UnionTypeInfo({"Test.B1", "Test.B2"}) B1 | B2 ex) { }
     }
 }
--- a/langtools/test/tools/javac/multicatch/model/ModelChecker.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/multicatch/model/ModelChecker.java	Tue May 03 22:17:58 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
@@ -30,7 +30,7 @@
  * @compile -processor ModelChecker Model01.java
  */
 
-import com.sun.source.tree.VariableTree;
+import com.sun.source.tree.CatchTree;
 import com.sun.source.util.TreePathScanner;
 import com.sun.source.util.Trees;
 import com.sun.source.util.TreePath;
@@ -41,6 +41,12 @@
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.UnionType;
+import javax.lang.model.type.UnknownTypeException;
+import javax.lang.model.util.SimpleTypeVisitor6;
+import javax.lang.model.util.SimpleTypeVisitor7;
 
 @SupportedAnnotationTypes("Check")
 public class ModelChecker extends JavacTestingAbstractProcessor {
@@ -69,20 +75,59 @@
         }
 
         @Override
-        public Void visitVariable(VariableTree node, Void p) {
-            Element ex = trees.getElement(getCurrentPath());
+        public Void visitCatch(CatchTree node, Void p) {
+            TreePath param = new TreePath(getCurrentPath(), node.getParameter());
+            Element ex = trees.getElement(param);
+            validateUnionTypeInfo(ex);
             if (ex.getSimpleName().contentEquals("ex")) {
                 assertTrue(ex.getKind() == ElementKind.EXCEPTION_PARAMETER, "Expected EXCEPTION_PARAMETER - found " + ex.getKind());
-                for (Element e : types.asElement(ex.asType()).getEnclosedElements()) {
+                for (Element e : types.asElement(trees.getLub(node)).getEnclosedElements()) {
                     Member m = e.getAnnotation(Member.class);
                     if (m != null) {
                         assertTrue(e.getKind() == m.value(), "Expected " + m.value() + " - found " + e.getKind());
                     }
                 }
-                assertTrue(assertionCount == 3, "Expected 3 assertions - found " + assertionCount);
+                assertTrue(assertionCount == 9, "Expected 9 assertions - found " + assertionCount);
             }
-            return super.visitVariable(node, p);
+            return super.visitCatch(node, p);
+        }
+    }
+
+    private void validateUnionTypeInfo(Element ex) {
+        UnionTypeInfo ut = ex.getAnnotation(UnionTypeInfo.class);
+        assertTrue(ut != null, "UnionType annotation must be present");
+
+        TypeMirror expectedUnionType = ex.asType();
+        assertTrue(expectedUnionType.getKind() == TypeKind.UNION, "UNION kind expected");
+
+        try {
+            new SimpleTypeVisitor6<Void, Void>(){}.visit(expectedUnionType);
+            throw new RuntimeException("Expected UnknownTypeException not thrown.");
+        } catch (UnknownTypeException ute) {
+            ; // Expected
         }
+
+        UnionType unionType = new SimpleTypeVisitor7<UnionType, Void>(){
+            @Override
+            protected UnionType defaultAction(TypeMirror e, Void p) {return null;}
+
+            @Override
+            public UnionType visitUnion(UnionType t, Void p) {return t;}
+        }.visit(expectedUnionType);
+        assertTrue(unionType != null, "Must get a non-null union type.");
+
+        assertTrue(ut.value().length == unionType.getAlternatives().size(), "Cardinalities do not match");
+
+        String[] typeNames = ut.value();
+        for(int i = 0; i < typeNames.length; i++) {
+            TypeMirror typeFromAnnotation = nameToType(typeNames[i]);
+            assertTrue(types.isSameType(typeFromAnnotation, unionType.getAlternatives().get(i)),
+                       "Types were not equal.");
+        }
+    }
+
+    private TypeMirror nameToType(String name) {
+        return elements.getTypeElement(name).asType();
     }
 
     private static void assertTrue(boolean cond, String msg) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/multicatch/model/UnionTypeInfo.java	Tue May 03 22:17:58 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.
+ */
+
+/**
+ * Used by ModelChecker to validate the modeling information of a union type.
+ */
+@interface UnionTypeInfo {
+    String[] value();
+}
--- a/langtools/test/tools/javac/processing/model/TestSymtabItems.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/processing/model/TestSymtabItems.java	Tue May 03 22:17:58 2011 -0700
@@ -44,6 +44,7 @@
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.main.JavaCompiler;
 import com.sun.tools.javac.model.JavacTypes;
 import com.sun.tools.javac.util.Context;
 
@@ -62,6 +63,7 @@
         JavacFileManager.preRegister(c);
         Symtab syms = Symtab.instance(c);
         JavacTypes types = JavacTypes.instance(c);
+        JavaCompiler.instance(c);  // will init ClassReader.sourceCompleter
 
 //        print("noSymbol", syms.noSymbol);
 //        print("errSymbol", syms.errSymbol);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/type/TestUnionType.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,208 @@
+/*
+ * 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     7029150
+ * @summary Test support for union types
+ * @library ../../../lib
+ */
+
+import java.net.URI;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+import javax.lang.model.util.*;
+import javax.tools.*;
+
+import com.sun.source.tree.*;
+import com.sun.source.util.*;
+
+
+public class TestUnionType extends JavacTestingAbstractProcessor {
+    enum TestKind {
+        SingleType("E1", "E1",
+                "VariableTree: E1 e",
+                "VariableTree: elem EXCEPTION_PARAMETER e",
+                "VariableTree: elem.type DECLARED",
+                "VariableTree: elem.type.elem CLASS E1",
+                "VariableTree: type DECLARED",
+                "VariableTree: type.elem CLASS E1",
+                "VariableTree: type.elem.type DECLARED"),
+
+        ValidTypes("E1, E2", "E1 | E2",
+                "VariableTree: E1 | E2 e",
+                "VariableTree: elem EXCEPTION_PARAMETER e",
+                "VariableTree: elem.type UNION Test.E1,Test.E2",
+                "VariableTree: elem.type.elem null",
+                "VariableTree: type UNION Test.E1,Test.E2",
+                "VariableTree: type.elem null"),
+
+        InvalidTypes("E1, E2", "E1 | EMissing",
+                "VariableTree: E1 | EMissing e",
+                "VariableTree: elem EXCEPTION_PARAMETER e",
+                "VariableTree: elem.type UNION Test.E1,EMissing",
+                "VariableTree: elem.type.elem null",
+                "VariableTree: type UNION Test.E1,EMissing",
+                "VariableTree: type.elem null"),
+
+        Uncaught("E1", "E1 | E2",
+                "VariableTree: E1 | E2 e",
+                "VariableTree: elem EXCEPTION_PARAMETER e",
+                "VariableTree: elem.type UNION Test.E1,Test.E2",
+                "VariableTree: elem.type.elem null",
+                "VariableTree: type UNION Test.E1,Test.E2",
+                "VariableTree: type.elem null");
+
+        TestKind(String throwsTypes, String catchTypes, String... gold) {
+            this.throwsTypes = throwsTypes;
+            this.catchTypes = catchTypes;
+            this.gold = Arrays.asList(gold);
+        }
+
+        final String throwsTypes;
+        final String catchTypes;
+        final List<String> gold;
+    }
+
+    static class TestFileObject extends SimpleJavaFileObject {
+        public static final String template =
+                  "class Test {\n"
+                + "    class E1 extends Exception { }\n"
+                + "    class E2 extends Exception { }\n"
+                + "    void doSomething() throws #T { }\n"
+                + "    void test() {\n"
+                + "        try {\n"
+                + "            doSomething();\n"
+                + "        } catch (#C e) {\n"
+                + "        }\n"
+                + "    }\n"
+                + "}\n";
+
+        public TestFileObject(TestKind tk) {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            this.tk = tk;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return template
+                    .replace("#T", tk.throwsTypes)
+                    .replace("#C", tk.catchTypes);
+        }
+        final TestKind tk;
+    }
+
+    public static void main(String... args) throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        List<String> options = Arrays.asList("-proc:only");
+        for (TestKind tk: TestKind.values()) {
+            System.err.println("Test: " + tk);
+            TestUnionType p = new TestUnionType();
+            JavaFileObject fo = new TestFileObject(tk);
+            JavaCompiler.CompilationTask task = comp.getTask(null, null, null, options, null, Arrays.asList(fo));
+            task.setProcessors(Arrays.asList(p));
+            boolean ok = task.call();
+            System.err.println("compilation " + (ok ? "passed" : "failed"));
+            if (!ok)
+                throw new Exception("compilation failed unexpectedly");
+            if (!p.log.equals(tk.gold)) {
+                System.err.println("Expected output:");
+                for (String g: tk.gold)
+                    System.err.println(g);
+                throw new Exception("unexpected output from test");
+            }
+            System.err.println();
+        }
+    }
+
+    Trees trees;
+    List<String> log;
+
+    @Override
+    public void init(ProcessingEnvironment env) {
+        super.init(env);
+        trees = Trees.instance(env);
+        log = new ArrayList<String>();
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            for (Element e: roundEnv.getRootElements()) {
+                scan(trees.getPath(e));
+            }
+        }
+        return true;
+    }
+
+    void scan(TreePath path) {
+        new Scanner().scan(path, null);
+    }
+
+    class Scanner extends TreePathScanner<Void,Void> {
+        @Override
+        public Void visitVariable(VariableTree tree, Void ignore) {
+            TreePath p = getCurrentPath();
+            Element e = trees.getElement(p);
+            if (e.getKind() == ElementKind.EXCEPTION_PARAMETER) {
+                log("VariableTree: " + tree);
+                log("VariableTree: elem " + print(e));
+                log("VariableTree: elem.type " + print(e.asType()));
+                log("VariableTree: elem.type.elem " + print(types.asElement(e.asType())));
+                TypeMirror tm = trees.getTypeMirror(p);
+                log("VariableTree: type " + print(tm));
+                log("VariableTree: type.elem " + print(types.asElement(tm)));
+                if (types.asElement(tm) != null)
+                    log("VariableTree: type.elem.type " + print(types.asElement(tm).asType()));
+            }
+            return super.visitVariable(tree, null);
+        }
+
+        String print(TypeMirror tm) {
+            return (tm == null) ? null : new TypePrinter().visit(tm);
+        }
+
+        String print(Element e) {
+            return (e == null) ? null : (e.getKind() + " " + e.getSimpleName());
+        }
+
+        void log(String msg) {
+            System.err.println(msg);
+            log.add(msg);
+        }
+    }
+
+    class TypePrinter extends SimpleTypeVisitor7<String, Void> {
+        @Override
+        protected String defaultAction(TypeMirror tm, Void ignore) {
+            return String.valueOf(tm.getKind());
+        }
+
+        @Override
+        public String visitUnion(UnionType t, Void ignore) {
+            return (t.getKind() + " " + t.getAlternatives());
+        }
+    }
+}
--- a/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java	Wed Jul 05 17:43:08 2017 +0200
+++ b/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java	Tue May 03 22:17:58 2011 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7017664
+ * @bug 7017664 7036906
  * @summary Basher for CompoundScopes
  */
 
@@ -127,8 +127,17 @@
                     }
                 }
                 log("testing scope: " + root);
-                checkElems(root);
-                checkShadowed(root);
+                checkElems(root, null);
+                checkElems(root, new OddFilter());
+                checkShadowed(root, null);
+                checkShadowed(root, new OddFilter());
+            }
+        }
+
+        class OddFilter implements Filter<Symbol> {
+            public boolean accepts(Symbol s) {
+                Name numPart = s.name.subName(1, s.name.length());
+                return Integer.parseInt(numPart.toString()) % 2 != 0;
             }
         }
 
@@ -165,15 +174,20 @@
          * Check that CompoundScope.getElements() correctly visits all symbols
          * in all subscopes (in the correct order)
          */
-        void checkElems(CompoundScope cs) {
-            List<Symbol> allSymbols = elems;
+        void checkElems(CompoundScope cs, Filter<Symbol> sf) {
             int count = 0;
-            for (Symbol s : cs.getElements()) {
+            ListBuffer<Symbol> found = ListBuffer.lb();
+            List<Symbol> allSymbols = sf == null ?
+                    elems :
+                    filter(elems, sf);
+            int expectedCount = allSymbols.length();
+            for (Symbol s : sf == null ? cs.getElements() : cs.getElements(sf)) {
                 checkSameSymbols(s, allSymbols.head);
                 allSymbols = allSymbols.tail;
+                found.append(s);
                 count++;
             }
-            if (count != elems.size()) {
+            if (count != expectedCount) {
                 error("CompoundScope.getElements() did not returned enough symbols");
             }
         }
@@ -182,22 +196,35 @@
          * Check that CompoundScope.getElements() correctly visits all symbols
          * with a given name in all subscopes (in the correct order)
          */
-        void checkShadowed(CompoundScope cs) {
+        void checkShadowed(CompoundScope cs, Filter<Symbol> sf) {
             for (Map.Entry<Name, List<Symbol>> shadowedEntry : shadowedMap.entrySet()) {
                 int count = 0;
-                List<Symbol> shadowed = shadowedEntry.getValue();
+                List<Symbol> shadowed = sf == null ?
+                    shadowedEntry.getValue() :
+                    filter(shadowedEntry.getValue(), sf);
+                int expectedCount = shadowed.length();
                 Name name = shadowedEntry.getKey();
-                for (Symbol s : cs.getElementsByName(name)) {
+                for (Symbol s : sf == null ? cs.getElementsByName(name) : cs.getElementsByName(name, sf)) {
                     checkSameSymbols(s, shadowed.head);
                     shadowed = shadowed.tail;
                     count++;
                 }
-                if (count != shadowedEntry.getValue().size()) {
+                if (count != expectedCount) {
                     error("CompoundScope.lookup() did not returned enough symbols for name " + name);
                 }
             }
         }
 
+        List<Symbol> filter(List<Symbol> elems, Filter<Symbol> sf) {
+            ListBuffer<Symbol> res = ListBuffer.lb();
+            for (Symbol s : elems) {
+                if (sf.accepts(s)) {
+                    res.append(s);
+                }
+            }
+            return res.toList();
+        }
+
         void checkSameSymbols(Symbol found, Symbol req) {
             if (found != req) {
                 error("Symbol mismatch - found    : " + found + ":" + found.hashCode() + "\n" +
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/types/CastObjectToPrimitiveTest.java	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7038363
+ * @summary cast from object to primitive should be for source >= 1.7
+ * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 5 CastObjectToPrimitiveTest.java
+ * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 6 CastObjectToPrimitiveTest.java
+ * @compile CastObjectToPrimitiveTest.java
+ */
+
+class CastObjectToPrimitiveTest {
+    void m() {
+        Object o = 42;
+        int i = (int) o;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/types/CastObjectToPrimitiveTest.out	Tue May 03 22:17:58 2011 -0700
@@ -0,0 +1,2 @@
+CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), java.lang.Object, int
+1 error