Tue, 03 May 2011 22:17:58 -0700
Merge
test/tools/javac/generics/diamond/7030150/Neg01.java | file | annotate | diff | comparison | revisions | |
test/tools/javac/generics/diamond/7030150/Neg01.out | file | annotate | diff | comparison | revisions | |
test/tools/javac/generics/diamond/7030150/Neg02.java | file | annotate | diff | comparison | revisions | |
test/tools/javac/generics/diamond/7030150/Neg02.out | file | annotate | diff | comparison | revisions | |
test/tools/javac/generics/diamond/7030150/Neg03.java | file | annotate | diff | comparison | revisions | |
test/tools/javac/generics/diamond/7030150/Neg03.out | file | annotate | diff | comparison | revisions | |
test/tools/javac/generics/diamond/7030150/Pos01.java | file | annotate | diff | comparison | revisions | |
test/tools/javac/generics/diamond/7030150/Pos02.java | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/classes/com/sun/source/util/Trees.java Mon May 02 09:38:22 2011 -0700 1.2 +++ b/src/share/classes/com/sun/source/util/Trees.java Tue May 03 22:17:58 2011 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -38,6 +38,7 @@ 1.11 import javax.tools.Diagnostic; 1.12 import javax.tools.JavaCompiler.CompilationTask; 1.13 1.14 +import com.sun.source.tree.CatchTree; 1.15 import com.sun.source.tree.ClassTree; 1.16 import com.sun.source.tree.CompilationUnitTree; 1.17 import com.sun.source.tree.MethodTree; 1.18 @@ -207,4 +208,11 @@ 1.19 public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg, 1.20 com.sun.source.tree.Tree t, 1.21 com.sun.source.tree.CompilationUnitTree root); 1.22 + 1.23 + /** 1.24 + * Gets the lub of an exception parameter declared in a catch clause. 1.25 + * @param tree the tree for the catch clause 1.26 + * @return The lub of the exception parameter 1.27 + */ 1.28 + public abstract TypeMirror getLub(CatchTree tree); 1.29 }
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Mon May 02 09:38:22 2011 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java Tue May 03 22:17:58 2011 -0700 2.3 @@ -149,11 +149,20 @@ 2.4 ClassUseMapper mapper = new ClassUseMapper(configuration.root, classtree); 2.5 ClassDoc[] classes = configuration.root.classes(); 2.6 for (int i = 0; i < classes.length; i++) { 2.7 - ClassUseWriter.generate(configuration, mapper, classes[i]); 2.8 + // If -nodeprecated option is set and the containing package is marked 2.9 + // as deprecated, do not generate the class-use page. We will still generate 2.10 + // the class-use page if the class is marked as deprecated but the containing 2.11 + // package is not since it could still be linked from that package-use page. 2.12 + if (!(configuration.nodeprecated && 2.13 + Util.isDeprecated(classes[i].containingPackage()))) 2.14 + ClassUseWriter.generate(configuration, mapper, classes[i]); 2.15 } 2.16 PackageDoc[] pkgs = configuration.packages; 2.17 for (int i = 0; i < pkgs.length; i++) { 2.18 - PackageUseWriter.generate(configuration, mapper, pkgs[i]); 2.19 + // If -nodeprecated option is set and the package is marked 2.20 + // as deprecated, do not generate the package-use page. 2.21 + if (!(configuration.nodeprecated && Util.isDeprecated(pkgs[i]))) 2.22 + PackageUseWriter.generate(configuration, mapper, pkgs[i]); 2.23 } 2.24 } 2.25
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Mon May 02 09:38:22 2011 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Tue May 03 22:17:58 2011 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -31,6 +31,7 @@ 3.11 import com.sun.javadoc.*; 3.12 import java.util.*; 3.13 import java.io.*; 3.14 +import java.net.*; 3.15 3.16 /** 3.17 * Configure the output based on the command line options. 3.18 @@ -48,6 +49,7 @@ 3.19 * @author Robert Field. 3.20 * @author Atul Dambalkar. 3.21 * @author Jamie Ho 3.22 + * @author Bhavesh Patel (Modified) 3.23 */ 3.24 public class ConfigurationImpl extends Configuration { 3.25 3.26 @@ -110,6 +112,11 @@ 3.27 public String stylesheetfile = ""; 3.28 3.29 /** 3.30 + * Argument for command line option "-Xdocrootparent". 3.31 + */ 3.32 + public String docrootparent = ""; 3.33 + 3.34 + /** 3.35 * True if command line option "-nohelp" is used. Default value is false. 3.36 */ 3.37 public boolean nohelp = false; 3.38 @@ -239,6 +246,8 @@ 3.39 stylesheetfile = os[1]; 3.40 } else if (opt.equals("-charset")) { 3.41 charset = os[1]; 3.42 + } else if (opt.equals("-xdocrootparent")) { 3.43 + docrootparent = os[1]; 3.44 } else if (opt.equals("-nohelp")) { 3.45 nohelp = true; 3.46 } else if (opt.equals("-splitindex")) { 3.47 @@ -322,7 +331,8 @@ 3.48 option.equals("-helpfile") || 3.49 option.equals("-stylesheetfile") || 3.50 option.equals("-charset") || 3.51 - option.equals("-overview")) { 3.52 + option.equals("-overview") || 3.53 + option.equals("-xdocrootparent")) { 3.54 return 2; 3.55 } else { 3.56 return 0; 3.57 @@ -372,6 +382,13 @@ 3.58 return false; 3.59 } 3.60 nohelp = true; 3.61 + } else if (opt.equals("-xdocrootparent")) { 3.62 + try { 3.63 + new URL(os[1]); 3.64 + } catch (MalformedURLException e) { 3.65 + reporter.printError(getText("doclet.MalformedURL", os[1])); 3.66 + return false; 3.67 + } 3.68 } else if (opt.equals("-overview")) { 3.69 if (nooverview == true) { 3.70 reporter.printError(getText("doclet.Option_conflict",
4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Mon May 02 09:38:22 2011 -0700 4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Tue May 03 22:17:58 2011 -0700 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -42,15 +42,15 @@ 4.11 public class DeprecatedListWriter extends SubWriterHolderWriter { 4.12 4.13 private static final String[] ANCHORS = new String[] { 4.14 - "interface", "class", "enum", "exception", "error", "annotation_type", 4.15 - "field", "method", "constructor", "enum_constant", 4.16 + "package", "interface", "class", "enum", "exception", "error", 4.17 + "annotation_type", "field", "method", "constructor", "enum_constant", 4.18 "annotation_type_member" 4.19 }; 4.20 4.21 private static final String[] HEADING_KEYS = new String[] { 4.22 - "doclet.Deprecated_Interfaces", "doclet.Deprecated_Classes", 4.23 - "doclet.Deprecated_Enums", "doclet.Deprecated_Exceptions", 4.24 - "doclet.Deprecated_Errors", 4.25 + "doclet.Deprecated_Packages", "doclet.Deprecated_Interfaces", 4.26 + "doclet.Deprecated_Classes", "doclet.Deprecated_Enums", 4.27 + "doclet.Deprecated_Exceptions", "doclet.Deprecated_Errors", 4.28 "doclet.Deprecated_Annotation_Types", 4.29 "doclet.Deprecated_Fields", 4.30 "doclet.Deprecated_Methods", "doclet.Deprecated_Constructors", 4.31 @@ -59,9 +59,9 @@ 4.32 }; 4.33 4.34 private static final String[] SUMMARY_KEYS = new String[] { 4.35 - "doclet.deprecated_interfaces", "doclet.deprecated_classes", 4.36 - "doclet.deprecated_enums", "doclet.deprecated_exceptions", 4.37 - "doclet.deprecated_errors", 4.38 + "doclet.deprecated_packages", "doclet.deprecated_interfaces", 4.39 + "doclet.deprecated_classes", "doclet.deprecated_enums", 4.40 + "doclet.deprecated_exceptions", "doclet.deprecated_errors", 4.41 "doclet.deprecated_annotation_types", 4.42 "doclet.deprecated_fields", 4.43 "doclet.deprecated_methods", "doclet.deprecated_constructors", 4.44 @@ -70,7 +70,7 @@ 4.45 }; 4.46 4.47 private static final String[] HEADER_KEYS = new String[] { 4.48 - "doclet.Interface", "doclet.Class", 4.49 + "doclet.Package", "doclet.Interface", "doclet.Class", 4.50 "doclet.Enum", "doclet.Exceptions", 4.51 "doclet.Errors", 4.52 "doclet.AnnotationType", 4.53 @@ -116,7 +116,7 @@ 4.54 DeprecatedListWriter depr = 4.55 new DeprecatedListWriter(configuration, filename); 4.56 depr.generateDeprecatedListFile( 4.57 - new DeprecatedAPIListBuilder(configuration.root)); 4.58 + new DeprecatedAPIListBuilder(configuration)); 4.59 depr.close(); 4.60 } catch (IOException exc) { 4.61 configuration.standardmessage.error( 4.62 @@ -149,8 +149,14 @@ 4.63 memberTableHeader[0] = configuration.getText("doclet.0_and_1", 4.64 configuration.getText(HEADER_KEYS[i]), 4.65 configuration.getText("doclet.Description")); 4.66 - writers[i].addDeprecatedAPI(deprapi.getList(i), 4.67 - HEADING_KEYS[i], memberTableSummary, memberTableHeader, div); 4.68 + // DeprecatedAPIListBuilder.PACKAGE == 0, so if i == 0, it is 4.69 + // a PackageDoc. 4.70 + if (i == DeprecatedAPIListBuilder.PACKAGE) 4.71 + addPackageDeprecatedAPI(deprapi.getList(i), 4.72 + HEADING_KEYS[i], memberTableSummary, memberTableHeader, div); 4.73 + else 4.74 + writers[i - 1].addDeprecatedAPI(deprapi.getList(i), 4.75 + HEADING_KEYS[i], memberTableSummary, memberTableHeader, div); 4.76 } 4.77 } 4.78 body.addContent(div);
5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Mon May 02 09:38:22 2011 -0700 5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Tue May 03 22:17:58 2011 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -198,23 +198,27 @@ 5.11 PackageIndexFrameWriter.generate(configuration); 5.12 } 5.13 PackageDoc prev = null, next; 5.14 - for(int i = 0; i < packages.length; i++) { 5.15 - PackageFrameWriter.generate(configuration, packages[i]); 5.16 - next = (i + 1 < packages.length && packages[i+1].name().length() > 0) ? 5.17 - packages[i+1] : null; 5.18 - //If the next package is unnamed package, skip 2 ahead if possible 5.19 - next = (i + 2 < packages.length && next == null) ? 5.20 - packages[i+2]: next; 5.21 - AbstractBuilder packageSummaryBuilder = configuration. 5.22 - getBuilderFactory().getPackageSummaryBuilder( 5.23 - packages[i], prev, next); 5.24 - packageSummaryBuilder.build(); 5.25 - if (configuration.createtree) { 5.26 - PackageTreeWriter.generate(configuration, 5.27 - packages[i], prev, next, 5.28 - configuration.nodeprecated); 5.29 + for (int i = 0; i < packages.length; i++) { 5.30 + // if -nodeprecated option is set and the package is marked as 5.31 + // deprecated, do not generate the package-summary.html, package-frame.html 5.32 + // and package-tree.html pages for that package. 5.33 + if (!(configuration.nodeprecated && Util.isDeprecated(packages[i]))) { 5.34 + PackageFrameWriter.generate(configuration, packages[i]); 5.35 + next = (i + 1 < packages.length && 5.36 + packages[i + 1].name().length() > 0) ? packages[i + 1] : null; 5.37 + //If the next package is unnamed package, skip 2 ahead if possible 5.38 + next = (i + 2 < packages.length && next == null) ? packages[i + 2] : next; 5.39 + AbstractBuilder packageSummaryBuilder = 5.40 + configuration.getBuilderFactory().getPackageSummaryBuilder( 5.41 + packages[i], prev, next); 5.42 + packageSummaryBuilder.build(); 5.43 + if (configuration.createtree) { 5.44 + PackageTreeWriter.generate(configuration, 5.45 + packages[i], prev, next, 5.46 + configuration.nodeprecated); 5.47 + } 5.48 + prev = packages[i]; 5.49 } 5.50 - prev = packages[i]; 5.51 } 5.52 } 5.53
6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Mon May 02 09:38:22 2011 -0700 6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Tue May 03 22:17:58 2011 -0700 6.3 @@ -159,22 +159,42 @@ 6.4 StringBuilder buf = new StringBuilder(); 6.5 int previndex = 0; 6.6 while (true) { 6.7 - // Search for lowercase version of {@docRoot} 6.8 - index = lowerHtml.indexOf("{@docroot}", previndex); 6.9 - // If next {@docRoot} tag not found, append rest of htmlstr and exit loop 6.10 - if (index < 0) { 6.11 - buf.append(htmlstr.substring(previndex)); 6.12 - break; 6.13 - } 6.14 - // If next {@docroot} tag found, append htmlstr up to start of tag 6.15 - buf.append(htmlstr.substring(previndex, index)); 6.16 - previndex = index + 10; // length for {@docroot} string 6.17 - // Insert relative path where {@docRoot} was located 6.18 - buf.append(relativepathNoSlash); 6.19 - // Append slash if next character is not a slash 6.20 - if (relativepathNoSlash.length() > 0 && previndex < htmlstr.length() 6.21 - && htmlstr.charAt(previndex) != '/') { 6.22 - buf.append(DirectoryManager.URL_FILE_SEPARATOR); 6.23 + if (configuration.docrootparent.length() > 0) { 6.24 + // Search for lowercase version of {@docRoot}/.. 6.25 + index = lowerHtml.indexOf("{@docroot}/..", previndex); 6.26 + // If next {@docRoot}/.. pattern not found, append rest of htmlstr and exit loop 6.27 + if (index < 0) { 6.28 + buf.append(htmlstr.substring(previndex)); 6.29 + break; 6.30 + } 6.31 + // If next {@docroot}/.. pattern found, append htmlstr up to start of tag 6.32 + buf.append(htmlstr.substring(previndex, index)); 6.33 + previndex = index + 13; // length for {@docroot}/.. string 6.34 + // Insert docrootparent absolute path where {@docRoot}/.. was located 6.35 + 6.36 + buf.append(configuration.docrootparent); 6.37 + // Append slash if next character is not a slash 6.38 + if (previndex < htmlstr.length() && htmlstr.charAt(previndex) != '/') { 6.39 + buf.append(DirectoryManager.URL_FILE_SEPARATOR); 6.40 + } 6.41 + } else { 6.42 + // Search for lowercase version of {@docRoot} 6.43 + index = lowerHtml.indexOf("{@docroot}", previndex); 6.44 + // If next {@docRoot} tag not found, append rest of htmlstr and exit loop 6.45 + if (index < 0) { 6.46 + buf.append(htmlstr.substring(previndex)); 6.47 + break; 6.48 + } 6.49 + // If next {@docroot} tag found, append htmlstr up to start of tag 6.50 + buf.append(htmlstr.substring(previndex, index)); 6.51 + previndex = index + 10; // length for {@docroot} string 6.52 + // Insert relative path where {@docRoot} was located 6.53 + buf.append(relativepathNoSlash); 6.54 + // Append slash if next character is not a slash 6.55 + if (relativepathNoSlash.length() > 0 && previndex < htmlstr.length() && 6.56 + htmlstr.charAt(previndex) != '/') { 6.57 + buf.append(DirectoryManager.URL_FILE_SEPARATOR); 6.58 + } 6.59 } 6.60 } 6.61 return buf.toString(); 6.62 @@ -1395,6 +1415,44 @@ 6.63 } 6.64 6.65 /** 6.66 + * Add package deprecation information to the documentation tree 6.67 + * 6.68 + * @param deprPkgs list of deprecated packages 6.69 + * @param headingKey the caption for the deprecated package table 6.70 + * @param tableSummary the summary for the deprecated package table 6.71 + * @param tableHeader table headers for the deprecated package table 6.72 + * @param contentTree the content tree to which the deprecated package table will be added 6.73 + */ 6.74 + protected void addPackageDeprecatedAPI(List<Doc> deprPkgs, String headingKey, 6.75 + String tableSummary, String[] tableHeader, Content contentTree) { 6.76 + if (deprPkgs.size() > 0) { 6.77 + Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, 6.78 + getTableCaption(configuration().getText(headingKey))); 6.79 + table.addContent(getSummaryTableHeader(tableHeader, "col")); 6.80 + Content tbody = new HtmlTree(HtmlTag.TBODY); 6.81 + for (int i = 0; i < deprPkgs.size(); i++) { 6.82 + PackageDoc pkg = (PackageDoc) deprPkgs.get(i); 6.83 + HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, 6.84 + getPackageLink(pkg, getPackageName(pkg))); 6.85 + if (pkg.tags("deprecated").length > 0) { 6.86 + addInlineDeprecatedComment(pkg, pkg.tags("deprecated")[0], td); 6.87 + } 6.88 + HtmlTree tr = HtmlTree.TR(td); 6.89 + if (i % 2 == 0) { 6.90 + tr.addStyle(HtmlStyle.altColor); 6.91 + } else { 6.92 + tr.addStyle(HtmlStyle.rowColor); 6.93 + } 6.94 + tbody.addContent(tr); 6.95 + } 6.96 + table.addContent(tbody); 6.97 + Content li = HtmlTree.LI(HtmlStyle.blockList, table); 6.98 + Content ul = HtmlTree.UL(HtmlStyle.blockList, li); 6.99 + contentTree.addContent(ul); 6.100 + } 6.101 + } 6.102 + 6.103 + /** 6.104 * Prine table header information about color, column span and the font. 6.105 * 6.106 * @param color Background color. 6.107 @@ -2120,7 +2178,7 @@ 6.108 } 6.109 } 6.110 text = (isplaintext) ? 6.111 - refMemName : getCode() + refMemName + getCodeEnd(); 6.112 + refMemName : getCode() + Util.escapeHtmlChars(refMemName) + getCodeEnd(); 6.113 6.114 result.append(getDocLink(LinkInfoImpl.CONTEXT_SEE_TAG, containing, 6.115 refMem, (label.length() == 0)? text: label, false)); 6.116 @@ -2280,6 +2338,7 @@ 6.117 public String commentTagsToString(Tag holderTag, Doc doc, Tag[] tags, 6.118 boolean isFirstSentence) { 6.119 StringBuilder result = new StringBuilder(); 6.120 + boolean textTagChange = false; 6.121 // Array of all possible inline tags for this javadoc run 6.122 configuration.tagletManager.checkTags(doc, tags, true); 6.123 for (int i = 0; i < tags.length; i++) { 6.124 @@ -2295,13 +2354,26 @@ 6.125 result.append(output == null ? "" : output.toString()); 6.126 if (originalLength == 0 && isFirstSentence && tagelem.name().equals("@inheritDoc") && result.length() > 0) { 6.127 break; 6.128 + } else if (configuration.docrootparent.length() > 0 && 6.129 + tagelem.name().equals("@docRoot") && 6.130 + ((tags[i + 1]).text()).startsWith("/..")) { 6.131 + //If Xdocrootparent switch ON, set the flag to remove the /.. occurance after 6.132 + //{@docRoot} tag in the very next Text tag. 6.133 + textTagChange = true; 6.134 + continue; 6.135 } else { 6.136 - continue; 6.137 + continue; 6.138 } 6.139 } else { 6.140 + String text = tagelem.text(); 6.141 + //If Xdocrootparent switch ON, remove the /.. occurance after {@docRoot} tag. 6.142 + if (textTagChange) { 6.143 + text = text.replaceFirst("/..", ""); 6.144 + textTagChange = false; 6.145 + } 6.146 //This is just a regular text tag. The text may contain html links (<a>) 6.147 //or inline tag {@docRoot}, which will be handled as special cases. 6.148 - String text = redirectRelativeLinks(tagelem.holder(), tagelem.text()); 6.149 + text = redirectRelativeLinks(tagelem.holder(), text); 6.150 6.151 // Replace @docRoot only if not represented by an instance of DocRootTaglet, 6.152 // that is, only if it was not present in a source file doc comment.
7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Mon May 02 09:38:22 2011 -0700 7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Tue May 03 22:17:58 2011 -0700 7.3 @@ -1,5 +1,5 @@ 7.4 /* 7.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 7.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 7.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.8 * 7.9 * This code is free software; you can redistribute it and/or modify it 7.10 @@ -93,7 +93,7 @@ 7.11 packgen = new PackageFrameWriter(configuration, packageDoc); 7.12 String pkgName = Util.getPackageName(packageDoc); 7.13 Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName)); 7.14 - Content pkgNameContent = new StringContent(pkgName); 7.15 + Content pkgNameContent = new RawHtml(pkgName); 7.16 Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, 7.17 packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent)); 7.18 body.addContent(heading);
8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Mon May 02 09:38:22 2011 -0700 8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Tue May 03 22:17:58 2011 -0700 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -80,7 +80,10 @@ 8.11 HtmlTree ul = new HtmlTree(HtmlTag.UL); 8.12 ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString()); 8.13 for(int i = 0; i < packages.length; i++) { 8.14 - if (packages[i] != null) { 8.15 + // Do not list the package if -nodeprecated option is set and the 8.16 + // package is marked as deprecated. 8.17 + if (packages[i] != null && 8.18 + (!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) { 8.19 ul.addContent(getPackage(packages[i])); 8.20 } 8.21 }
9.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Mon May 02 09:38:22 2011 -0700 9.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Tue May 03 22:17:58 2011 -0700 9.3 @@ -137,6 +137,8 @@ 9.4 protected void addPackagesList(PackageDoc[] packages, Content tbody) { 9.5 for (int i = 0; i < packages.length; i++) { 9.6 if (packages[i] != null && packages[i].name().length() > 0) { 9.7 + if (configuration.nodeprecated && Util.isDeprecated(packages[i])) 9.8 + continue; 9.9 Content packageLinkContent = getPackageLink(packages[i], 9.10 getPackageName(packages[i])); 9.11 Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
10.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Mon May 02 09:38:22 2011 -0700 10.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java Tue May 03 22:17:58 2011 -0700 10.3 @@ -242,11 +242,16 @@ 10.4 */ 10.5 protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException { 10.6 Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst, 10.7 - getHyperLink("", pkg.name(), new StringContent(Util.getPackageName(pkg)))); 10.8 + getHyperLink("", Util.getPackageName(pkg), 10.9 + new RawHtml(Util.getPackageName(pkg)))); 10.10 contentTree.addContent(tdFirst); 10.11 HtmlTree tdLast = new HtmlTree(HtmlTag.TD); 10.12 tdLast.addStyle(HtmlStyle.colLast); 10.13 - addSummaryComment(pkg, tdLast); 10.14 + if (pkg != null && pkg.name().length() != 0) { 10.15 + addSummaryComment(pkg, tdLast); 10.16 + } else { 10.17 + tdLast.addContent(getSpace()); 10.18 + } 10.19 contentTree.addContent(tdLast); 10.20 } 10.21
11.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Mon May 02 09:38:22 2011 -0700 11.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Tue May 03 22:17:58 2011 -0700 11.3 @@ -114,11 +114,12 @@ 11.4 Content packageHead = new RawHtml(heading); 11.5 tHeading.addContent(packageHead); 11.6 div.addContent(tHeading); 11.7 + addDeprecationInfo(div); 11.8 if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) { 11.9 - HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV); 11.10 - subTitleDiv.addStyle(HtmlStyle.subTitle); 11.11 - addSummaryComment(packageDoc, subTitleDiv); 11.12 - div.addContent(subTitleDiv); 11.13 + HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV); 11.14 + docSummaryDiv.addStyle(HtmlStyle.docSummary); 11.15 + addSummaryComment(packageDoc, docSummaryDiv); 11.16 + div.addContent(docSummaryDiv); 11.17 Content space = getSpace(); 11.18 Content descLink = getHyperLink("", "package_description", 11.19 descriptionLabel, "", ""); 11.20 @@ -139,6 +140,28 @@ 11.21 } 11.22 11.23 /** 11.24 + * Add the package deprecation information to the documentation tree. 11.25 + * 11.26 + * @param div the content tree to which the deprecation information will be added 11.27 + */ 11.28 + public void addDeprecationInfo(Content div) { 11.29 + Tag[] deprs = packageDoc.tags("deprecated"); 11.30 + if (Util.isDeprecated(packageDoc)) { 11.31 + HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV); 11.32 + deprDiv.addStyle(HtmlStyle.deprecatedContent); 11.33 + Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); 11.34 + deprDiv.addContent(deprPhrase); 11.35 + if (deprs.length > 0) { 11.36 + Tag[] commentTags = deprs[0].inlineTags(); 11.37 + if (commentTags.length > 0) { 11.38 + addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv); 11.39 + } 11.40 + } 11.41 + div.addContent(deprDiv); 11.42 + } 11.43 + } 11.44 + 11.45 + /** 11.46 * {@inheritDoc} 11.47 */ 11.48 public Content getSummaryHeader() {
12.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Mon May 02 09:38:22 2011 -0700 12.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java Tue May 03 22:17:58 2011 -0700 12.3 @@ -82,12 +82,20 @@ 12.4 } 12.5 PackageDoc[] pds = rd.specifiedPackages(); 12.6 for (int i = 0; i < pds.length; i++) { 12.7 - convertPackage(configuration, pds[i], outputdir); 12.8 + // If -nodeprecated option is set and the package is marked as deprecated, 12.9 + // do not convert the package files to HTML. 12.10 + if (!(configuration.nodeprecated && Util.isDeprecated(pds[i]))) 12.11 + convertPackage(configuration, pds[i], outputdir); 12.12 } 12.13 ClassDoc[] cds = rd.specifiedClasses(); 12.14 for (int i = 0; i < cds.length; i++) { 12.15 - convertClass(configuration, cds[i], 12.16 - getPackageOutputDir(outputdir, cds[i].containingPackage())); 12.17 + // If -nodeprecated option is set and the class is marked as deprecated 12.18 + // or the containing package is deprecated, do not convert the 12.19 + // package files to HTML. 12.20 + if (!(configuration.nodeprecated && 12.21 + (Util.isDeprecated(cds[i]) || Util.isDeprecated(cds[i].containingPackage())))) 12.22 + convertClass(configuration, cds[i], 12.23 + getPackageOutputDir(outputdir, cds[i].containingPackage())); 12.24 } 12.25 } 12.26 12.27 @@ -106,7 +114,12 @@ 12.28 String classOutputdir = getPackageOutputDir(outputdir, pd); 12.29 ClassDoc[] cds = pd.allClasses(); 12.30 for (int i = 0; i < cds.length; i++) { 12.31 - convertClass(configuration, cds[i], classOutputdir); 12.32 + // If -nodeprecated option is set and the class is marked as deprecated, 12.33 + // do not convert the package files to HTML. We do not check for 12.34 + // containing package deprecation since it is already check in 12.35 + // the calling method above. 12.36 + if (!(configuration.nodeprecated && Util.isDeprecated(cds[i]))) 12.37 + convertClass(configuration, cds[i], classOutputdir); 12.38 } 12.39 } 12.40
13.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Mon May 02 09:38:22 2011 -0700 13.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Tue May 03 22:17:58 2011 -0700 13.3 @@ -1,5 +1,5 @@ 13.4 /* 13.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 13.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 13.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.8 * 13.9 * This code is free software; you can redistribute it and/or modify it 13.10 @@ -59,7 +59,10 @@ 13.11 * {@inheritDoc} 13.12 */ 13.13 public TagletOutput getDocRootOutput() { 13.14 - return new TagletOutputImpl(htmlWriter.relativepathNoSlash); 13.15 + if (htmlWriter.configuration.docrootparent.length() > 0) 13.16 + return new TagletOutputImpl(htmlWriter.configuration.docrootparent); 13.17 + else 13.18 + return new TagletOutputImpl(htmlWriter.relativepathNoSlash); 13.19 } 13.20 13.21 /**
14.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Mon May 02 09:38:22 2011 -0700 14.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java Tue May 03 22:17:58 2011 -0700 14.3 @@ -1,5 +1,5 @@ 14.4 /* 14.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 14.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 14.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.8 * 14.9 * This code is free software; you can redistribute it and/or modify it 14.10 @@ -132,7 +132,11 @@ 14.11 HtmlTree ul = new HtmlTree(HtmlTag.UL); 14.12 ul.addStyle(HtmlStyle.horizontal); 14.13 for (int i = 0; i < packages.length; i++) { 14.14 - if (packages[i].name().length() == 0) { 14.15 + // If the package name length is 0 or if -nodeprecated option 14.16 + // is set and the package is marked as deprecated, do not include 14.17 + // the page in the list of package hierarchies. 14.18 + if (packages[i].name().length() == 0 || 14.19 + (configuration.nodeprecated && Util.isDeprecated(packages[i]))) { 14.20 continue; 14.21 } 14.22 String link = pathString(packages[i], "package-tree.html");
15.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Mon May 02 09:38:22 2011 -0700 15.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Tue May 03 22:17:58 2011 -0700 15.3 @@ -1,5 +1,5 @@ 15.4 /* 15.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 15.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 15.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.8 * 15.9 * This code is free software; you can redistribute it and/or modify it 15.10 @@ -46,6 +46,7 @@ 15.11 contentContainer, 15.12 description, 15.13 details, 15.14 + docSummary, 15.15 header, 15.16 horizontal, 15.17 footer, 15.18 @@ -67,6 +68,7 @@ 15.19 subNavList, 15.20 subTitle, 15.21 summary, 15.22 + deprecatedContent, 15.23 tabEnd, 15.24 title, 15.25 topNav;
16.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Mon May 02 09:38:22 2011 -0700 16.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Tue May 03 22:17:58 2011 -0700 16.3 @@ -68,6 +68,7 @@ 16.4 doclet.see.malformed_tag=Tag {0}: Malformed: {1} 16.5 doclet.Inherited_API_Summary=Inherited API Summary 16.6 doclet.Deprecated_API=Deprecated API 16.7 +doclet.Deprecated_Packages=Deprecated Packages 16.8 doclet.Deprecated_Classes=Deprecated Classes 16.9 doclet.Deprecated_Enums=Deprecated Enums 16.10 doclet.Deprecated_Interfaces=Deprecated Interfaces 16.11 @@ -79,6 +80,7 @@ 16.12 doclet.Deprecated_Methods=Deprecated Methods 16.13 doclet.Deprecated_Enum_Constants=Deprecated Enum Constants 16.14 doclet.Deprecated_Annotation_Type_Members=Deprecated Annotation Type Elements 16.15 +doclet.deprecated_packages=deprecated packages 16.16 doclet.deprecated_classes=deprecated classes 16.17 doclet.deprecated_enums=deprecated enums 16.18 doclet.deprecated_interfaces=deprecated interfaces 16.19 @@ -245,6 +247,7 @@ 16.20 -tag <name>:<locations>:<header> Specify single argument custom tags\n\ 16.21 -taglet The fully qualified name of Taglet to register\n\ 16.22 -tagletpath The path to Taglets\n\ 16.23 + -Xdocrootparent <url> Replaces all appearances of @docRoot followed by /.. in doc comments with <url>\n\ 16.24 -charset <charset> Charset for cross-platform viewing of generated documentation.\n\ 16.25 -helpfile <file> Include file that help link links to\n\ 16.26 -linksource Generate source in HTML\n\
17.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Mon May 02 09:38:22 2011 -0700 17.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Tue May 03 22:17:58 2011 -0700 17.3 @@ -1,5 +1,5 @@ 17.4 /* 17.5 - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. 17.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 * 17.9 * This code is free software; you can redistribute it and/or modify it 17.10 @@ -419,7 +419,7 @@ 17.11 docencoding = encoding; 17.12 } 17.13 17.14 - classDocCatalog = new ClassDocCatalog(root.specifiedClasses()); 17.15 + classDocCatalog = new ClassDocCatalog(root.specifiedClasses(), this); 17.16 initTagletManager(customTagStrs); 17.17 } 17.18 17.19 @@ -677,15 +677,18 @@ 17.20 } 17.21 17.22 /** 17.23 - * Return true if the doc element is getting documented, depending upon 17.24 - * -nodeprecated option and @deprecated tag used. Return true if 17.25 - * -nodeprecated is not used or @deprecated tag is not used. 17.26 + * Return true if the ClassDoc element is getting documented, depending upon 17.27 + * -nodeprecated option and the deprecation information. Return true if 17.28 + * -nodeprecated is not used. Return false if -nodeprecated is used and if 17.29 + * either ClassDoc element is deprecated or the containing package is deprecated. 17.30 + * 17.31 + * @param cd the ClassDoc for which the page generation is checked 17.32 */ 17.33 - public boolean isGeneratedDoc(Doc doc) { 17.34 + public boolean isGeneratedDoc(ClassDoc cd) { 17.35 if (!nodeprecated) { 17.36 return true; 17.37 } 17.38 - return (doc.tags("deprecated")).length == 0; 17.39 + return !(Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage())); 17.40 } 17.41 17.42 /**
18.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Mon May 02 09:38:22 2011 -0700 18.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Tue May 03 22:17:58 2011 -0700 18.3 @@ -2,17 +2,10 @@ 18.4 /* 18.5 Overall document style 18.6 */ 18.7 -* { 18.8 - margin:0; 18.9 - padding:0; 18.10 -} 18.11 body { 18.12 font-family:Helvetica, Arial, sans-serif; 18.13 color:#000000; 18.14 } 18.15 -p { 18.16 - margin:20px 0; 18.17 -} 18.18 pre { 18.19 font-size:1.0em; 18.20 } 18.21 @@ -30,35 +23,18 @@ 18.22 } 18.23 ul { 18.24 margin:10px 0 10px 20px; 18.25 -} 18.26 -li { 18.27 - list-style:disc; 18.28 -} 18.29 -dl dt { 18.30 - font-size:0.95em; 18.31 - font-weight:bold; 18.32 - margin:10px 0 0 0; 18.33 -} 18.34 -dl dd { 18.35 - margin:10px 0 10px 20px; 18.36 -} 18.37 -dl dd ul { 18.38 - margin-left:0; 18.39 -} 18.40 -dl dd ul li { 18.41 - list-style:none; 18.42 - margin:10px 0 10px 0; 18.43 + list-style-type:disc; 18.44 } 18.45 caption { 18.46 background: #CCCCFF; 18.47 color:#000000; 18.48 - text-align: left; 18.49 - font-size: 150%; 18.50 - font-weight: bold; 18.51 - border-left: 2px ridge; 18.52 - border-right: 2px ridge; 18.53 - border-top: 2px ridge; 18.54 - padding-left: 5px; 18.55 + text-align:left; 18.56 + font-size:150%; 18.57 + font-weight:bold; 18.58 + border-left:2px ridge; 18.59 + border-right:2px ridge; 18.60 + border-top:2px ridge; 18.61 + padding-left:5px; 18.62 width:auto; 18.63 } 18.64 /* 18.65 @@ -70,11 +46,11 @@ 18.66 color:#000000; 18.67 } 18.68 .legalCopy { 18.69 - margin:7px; 18.70 + margin:7px 0; 18.71 } 18.72 .bar { 18.73 font-size:1em; 18.74 - margin:10px 0 0 10px; 18.75 + margin:10px 0 0 2px; 18.76 } 18.77 .bar a { 18.78 font-weight:normal; 18.79 @@ -84,24 +60,21 @@ 18.80 */ 18.81 .topNav { 18.82 border-top:2px solid #C0C0C0; 18.83 - margin:7px; 18.84 padding:7px 0; 18.85 height:2.8em; 18.86 - width:99%; 18.87 + width:100%; 18.88 min-width:600px; 18.89 } 18.90 .bottomNav { 18.91 border-top:2px solid #C0C0C0; 18.92 - margin:7px; 18.93 padding:7px 0; 18.94 height:2.8em; 18.95 - width:99%; 18.96 + width:100%; 18.97 } 18.98 .subNav { 18.99 border-bottom:2px solid #C0C0C0; 18.100 float:left; 18.101 - width:99%; 18.102 - margin:7px; 18.103 + width:100%; 18.104 min-width:600px; 18.105 } 18.106 .subNav div { 18.107 @@ -120,7 +93,7 @@ 18.108 /* Navigation bar list styles */ 18.109 .topNav ul.navList, .bottomNav ul.navList { 18.110 background-color:#EEEEFF; 18.111 - padding:7px 5px; 18.112 + padding:4px 4px; 18.113 margin:0; 18.114 float:left; 18.115 width:80%; 18.116 @@ -128,7 +101,7 @@ 18.117 ul.navList li{ 18.118 list-style:none; 18.119 float:left; 18.120 - padding:3px 4px; 18.121 + padding:0 4px; 18.122 color:#000000; 18.123 font-size:0.98em; 18.124 } 18.125 @@ -142,14 +115,16 @@ 18.126 .subNav ul.navList { 18.127 float:left; 18.128 margin:0; 18.129 + padding:0; 18.130 font-size:0.8em; 18.131 width:350px; 18.132 } 18.133 ul.subNavList { 18.134 float:left; 18.135 - margin:0; 18.136 font-size:0.8em; 18.137 width:350px; 18.138 + margin:0; 18.139 + padding:0; 18.140 } 18.141 ul.subNavList li{ 18.142 list-style:none; 18.143 @@ -161,16 +136,16 @@ 18.144 */ 18.145 .header, .footer { 18.146 clear:both; 18.147 - margin:0 7px; 18.148 + padding:10px 0; 18.149 } 18.150 .indexHeader { 18.151 font-size:0.9em; 18.152 - margin:10px 0 7px 10px; 18.153 + margin:10px 0 0 2px; 18.154 } 18.155 .header ul { 18.156 padding-left:20px; 18.157 } 18.158 -/* Header and footer title styles */ 18.159 +/* Header and footer title styles */ 18.160 .header h1.title { 18.161 font-size:1.4em; 18.162 text-align:center; 18.163 @@ -181,7 +156,16 @@ 18.164 margin:0; 18.165 } 18.166 .subTitle { 18.167 + padding-top:10px; 18.168 +} 18.169 +/* 18.170 +Content styles 18.171 +*/ 18.172 +.deprecatedContent { 18.173 margin:0; 18.174 + padding:10px 0; 18.175 +} 18.176 +.docSummary { 18.177 padding-top:10px; 18.178 } 18.179 /* 18.180 @@ -190,11 +174,11 @@ 18.181 .contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, 18.182 .constantValuesContainer { 18.183 clear:both; 18.184 - padding:10px 10px; 18.185 position:relative; 18.186 + padding-bottom:20px; 18.187 } 18.188 .indexContainer { 18.189 - padding:0 0 10px 10px; 18.190 + padding:0 0 0 2px; 18.191 font-size:0.9em; 18.192 } 18.193 /* 18.194 @@ -221,7 +205,8 @@ 18.195 .indexContainer h2 { 18.196 font-weight:normal; 18.197 font-size:1.0em; 18.198 - padding:10px 0 0 0; 18.199 + padding:5px 0 0 0; 18.200 + margin:10px 0 0 0; 18.201 } 18.202 .contentContainer h2 { 18.203 margin:10px 0; 18.204 @@ -263,7 +248,7 @@ 18.205 background:#CCCCFF; 18.206 border:0; 18.207 border:2px ridge; 18.208 - padding-left:5px; 18.209 + margin:0; 18.210 } 18.211 div.summary ul.blockList ul.blockList ul.blockList li.blockList h3 { 18.212 background:#EEEEFF; 18.213 @@ -274,23 +259,22 @@ 18.214 div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { 18.215 font-size:1.15em; 18.216 font-weight:bold; 18.217 - padding:0 0 10px 0; 18.218 + padding:0 0 5px 0; 18.219 + margin:0; 18.220 } 18.221 /* 18.222 Table styles 18.223 */ 18.224 .contentContainer table { 18.225 - border-collapse: collapse ; 18.226 + border-collapse:collapse ; 18.227 width:100%; 18.228 } 18.229 .contentContainer table td, .contentContainer table th { 18.230 border:2px ridge; 18.231 - padding:3px; 18.232 } 18.233 /* Constant values page table styles */ 18.234 .constantValuesContainer table { 18.235 - border-collapse: collapse ; 18.236 - margin:0 0 10px 0; 18.237 + border-collapse:collapse; 18.238 } 18.239 .constantValuesContainer table caption{ 18.240 font-size:0.95em; 18.241 @@ -303,12 +287,9 @@ 18.242 } 18.243 /* Class-use/Package-use page table styles */ 18.244 .classUseContainer table { 18.245 - border-collapse: collapse ; 18.246 + border-collapse:collapse ; 18.247 width:100%; 18.248 - margin:0 0 15px 0; 18.249 -} 18.250 -.classUseContainer ul li ul li table { 18.251 - margin-bottom:30px; 18.252 + margin:0 0 10px 0; 18.253 } 18.254 .classUseContainer ul li ul li table caption{ 18.255 font-size:0.95em; 18.256 @@ -365,6 +346,7 @@ 18.257 /* Container specific list styles */ 18.258 .indexContainer ul { 18.259 margin:0; 18.260 + padding:0; 18.261 } 18.262 .indexContainer ul li { 18.263 list-style:none; 18.264 @@ -376,6 +358,7 @@ 18.265 list-style:none; 18.266 border:0; 18.267 border-bottom:2px ridge; 18.268 + height:1%; 18.269 } 18.270 .serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockListLast { 18.271 list-style:none; 18.272 @@ -395,6 +378,7 @@ 18.273 div.details ul.blockList ul.blockList ul.blockList li.blockList { 18.274 border:0; 18.275 border-bottom:2px ridge; 18.276 + height:1%; 18.277 } 18.278 /* Definition list styles */ 18.279 ul.blockList li.blockList dl{ 18.280 @@ -413,9 +397,17 @@ 18.281 ul.blockList li.blockList pre{ 18.282 margin:0 0 15px 0; 18.283 } 18.284 +.description dl dt { 18.285 + font-size:0.95em; 18.286 + font-weight:bold; 18.287 + margin:5px 0 0 0; 18.288 +} 18.289 +.description dl dd { 18.290 + margin:10px 0 10px 20px; 18.291 +} 18.292 /* List content styles */ 18.293 ul.blockList li.blockList ul.blockList li.blockList pre{ 18.294 - margin:10px 0 15px 0; 18.295 + margin:10px 0 10px 0; 18.296 } 18.297 ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList pre, 18.298 ul.blockList li.blockList ul.blockList li.blockList ul.blockListLast li.blockList pre{
19.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/DeprecatedTaglet.java Mon May 02 09:38:22 2011 -0700 19.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/DeprecatedTaglet.java Tue May 03 22:17:58 2011 -0700 19.3 @@ -1,5 +1,5 @@ 19.4 /* 19.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 19.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 19.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.8 * 19.9 * This code is free software; you can redistribute it and/or modify it 19.10 @@ -47,13 +47,6 @@ 19.11 /** 19.12 * {@inheritDoc} 19.13 */ 19.14 - public boolean inPackage() { 19.15 - return false; 19.16 - } 19.17 - 19.18 - /** 19.19 - * {@inheritDoc} 19.20 - */ 19.21 public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) { 19.22 return writer.deprecatedTagOutput(holder); 19.23 }
20.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java Mon May 02 09:38:22 2011 -0700 20.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java Tue May 03 22:17:58 2011 -0700 20.3 @@ -1,5 +1,5 @@ 20.4 /* 20.5 - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. 20.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. 20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 * 20.9 * This code is free software; you can redistribute it and/or modify it 20.10 @@ -25,8 +25,9 @@ 20.11 20.12 package com.sun.tools.doclets.internal.toolkit.util; 20.13 20.14 +import java.util.*; 20.15 import com.sun.javadoc.*; 20.16 -import java.util.*; 20.17 +import com.sun.tools.doclets.internal.toolkit.Configuration; 20.18 20.19 /** 20.20 * This class acts as an artificial PackageDoc for classes specified 20.21 @@ -88,13 +89,16 @@ 20.22 */ 20.23 private Map<String,Set<ClassDoc>> interfaces; 20.24 20.25 + private Configuration configuration; 20.26 + 20.27 /** 20.28 * Construct a new ClassDocCatalog. 20.29 * 20.30 * @param classdocs the array of ClassDocs to catalog 20.31 */ 20.32 - public ClassDocCatalog (ClassDoc[] classdocs) { 20.33 + public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) { 20.34 init(); 20.35 + this.configuration = config; 20.36 for (int i = 0; i < classdocs.length; i++) { 20.37 addClassDoc(classdocs[i]); 20.38 } 20.39 @@ -151,9 +155,10 @@ 20.40 private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) { 20.41 20.42 PackageDoc pkg = classdoc.containingPackage(); 20.43 - if (pkg.isIncluded()) { 20.44 - //No need to catalog this class since it's package is 20.45 - //included on the command line 20.46 + if (pkg.isIncluded() || (configuration.nodeprecated && Util.isDeprecated(pkg))) { 20.47 + //No need to catalog this class if it's package is 20.48 + //included on the command line or if -nodeprecated option is set 20.49 + // and the containing package is marked as deprecated. 20.50 return; 20.51 } 20.52 String key = Util.getPackageName(pkg);
21.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java Mon May 02 09:38:22 2011 -0700 21.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java Tue May 03 22:17:58 2011 -0700 21.3 @@ -1,5 +1,5 @@ 21.4 /* 21.5 - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. 21.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 * 21.9 * This code is free software; you can redistribute it and/or modify it 21.10 @@ -122,8 +122,12 @@ 21.11 */ 21.12 private void buildTree(ClassDoc[] classes, Configuration configuration) { 21.13 for (int i = 0; i < classes.length; i++) { 21.14 + // In the tree page (e.g overview-tree.html) do not include 21.15 + // information of classes which are deprecated or are a part of a 21.16 + // deprecated package. 21.17 if (configuration.nodeprecated && 21.18 - classes[i].tags("deprecated").length > 0) { 21.19 + (Util.isDeprecated(classes[i]) || 21.20 + Util.isDeprecated(classes[i].containingPackage()))) { 21.21 continue; 21.22 } 21.23 if (classes[i].isEnum()) {
22.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java Mon May 02 09:38:22 2011 -0700 22.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java Tue May 03 22:17:58 2011 -0700 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. 22.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -27,27 +27,29 @@ 22.11 22.12 import com.sun.javadoc.*; 22.13 import java.util.*; 22.14 +import com.sun.tools.doclets.internal.toolkit.Configuration; 22.15 22.16 /** 22.17 - * Build list of all the deprecated classes, constructors, fields and methods. 22.18 + * Build list of all the deprecated packages, classes, constructors, fields and methods. 22.19 * 22.20 * @author Atul M Dambalkar 22.21 */ 22.22 public class DeprecatedAPIListBuilder { 22.23 22.24 - public static final int NUM_TYPES = 11; 22.25 + public static final int NUM_TYPES = 12; 22.26 22.27 - public static final int INTERFACE = 0; 22.28 - public static final int CLASS = 1; 22.29 - public static final int ENUM = 2; 22.30 - public static final int EXCEPTION = 3; 22.31 - public static final int ERROR = 4; 22.32 - public static final int ANNOTATION_TYPE = 5; 22.33 - public static final int FIELD = 6; 22.34 - public static final int METHOD = 7; 22.35 - public static final int CONSTRUCTOR = 8; 22.36 - public static final int ENUM_CONSTANT = 9; 22.37 - public static final int ANNOTATION_TYPE_MEMBER = 10; 22.38 + public static final int PACKAGE = 0; 22.39 + public static final int INTERFACE = 1; 22.40 + public static final int CLASS = 2; 22.41 + public static final int ENUM = 3; 22.42 + public static final int EXCEPTION = 4; 22.43 + public static final int ERROR = 5; 22.44 + public static final int ANNOTATION_TYPE = 6; 22.45 + public static final int FIELD = 7; 22.46 + public static final int METHOD = 8; 22.47 + public static final int CONSTRUCTOR = 9; 22.48 + public static final int ENUM_CONSTANT = 10; 22.49 + public static final int ANNOTATION_TYPE_MEMBER = 11; 22.50 22.51 /** 22.52 * List of deprecated type Lists. 22.53 @@ -58,25 +60,33 @@ 22.54 /** 22.55 * Constructor. 22.56 * 22.57 - * @param root Root of the tree. 22.58 + * @param configuration the current configuration of the doclet 22.59 */ 22.60 - public DeprecatedAPIListBuilder(RootDoc root) { 22.61 + public DeprecatedAPIListBuilder(Configuration configuration) { 22.62 deprecatedLists = new ArrayList<List<Doc>>(); 22.63 for (int i = 0; i < NUM_TYPES; i++) { 22.64 deprecatedLists.add(i, new ArrayList<Doc>()); 22.65 } 22.66 - buildDeprecatedAPIInfo(root); 22.67 + buildDeprecatedAPIInfo(configuration); 22.68 } 22.69 22.70 /** 22.71 * Build the sorted list of all the deprecated APIs in this run. 22.72 - * Build separate lists for deprecated classes, constructors, methods and 22.73 - * fields. 22.74 + * Build separate lists for deprecated packages, classes, constructors, 22.75 + * methods and fields. 22.76 * 22.77 - * @param root Root of the tree. 22.78 + * @param configuration the current configuration of the doclet. 22.79 */ 22.80 - private void buildDeprecatedAPIInfo(RootDoc root) { 22.81 - ClassDoc[] classes = root.classes(); 22.82 + private void buildDeprecatedAPIInfo(Configuration configuration) { 22.83 + PackageDoc[] packages = configuration.packages; 22.84 + PackageDoc pkg; 22.85 + for (int c = 0; c < packages.length; c++) { 22.86 + pkg = packages[c]; 22.87 + if (Util.isDeprecated(pkg)) { 22.88 + getList(PACKAGE).add(pkg); 22.89 + } 22.90 + } 22.91 + ClassDoc[] classes = configuration.root.classes(); 22.92 for (int i = 0; i < classes.length; i++) { 22.93 ClassDoc cd = classes[i]; 22.94 if (Util.isDeprecated(cd)) { 22.95 @@ -90,7 +100,7 @@ 22.96 getList(ENUM).add(cd); 22.97 } else if (cd.isError()) { 22.98 getList(ERROR).add(cd); 22.99 - }else if (cd.isAnnotationType()) { 22.100 + } else if (cd.isAnnotationType()) { 22.101 getList(ANNOTATION_TYPE).add(cd); 22.102 } 22.103 } 22.104 @@ -102,7 +112,7 @@ 22.105 } 22.106 if (cd.isAnnotationType()) { 22.107 composeDeprecatedList(getList(ANNOTATION_TYPE_MEMBER), 22.108 - ((AnnotationTypeDoc) cd).elements()); 22.109 + ((AnnotationTypeDoc) cd).elements()); 22.110 } 22.111 } 22.112 sortDeprecatedLists();
23.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java Mon May 02 09:38:22 2011 -0700 23.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java Tue May 03 22:17:58 2011 -0700 23.3 @@ -1,5 +1,5 @@ 23.4 /* 23.5 - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. 23.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 23.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.8 * 23.9 * This code is free software; you can redistribute it and/or modify it 23.10 @@ -207,7 +207,17 @@ 23.11 * Should this doc element be added to the index map? 23.12 */ 23.13 protected boolean shouldAddToIndexMap(Doc element) { 23.14 - return !(noDeprecated && element.tags("deprecated").length > 0); 23.15 + if (element instanceof PackageDoc) 23.16 + // Do not add to index map if -nodeprecated option is set and the 23.17 + // package is marked as deprecated. 23.18 + return !(noDeprecated && Util.isDeprecated(element)); 23.19 + else 23.20 + // Do not add to index map if -nodeprecated option is set and if the 23.21 + // Doc is marked as deprecated or the containing package is marked as 23.22 + // deprecated. 23.23 + return !(noDeprecated && 23.24 + (Util.isDeprecated(element) || 23.25 + Util.isDeprecated(((ProgramElementDoc)element).containingPackage()))); 23.26 } 23.27 23.28 /**
24.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Mon May 02 09:38:22 2011 -0700 24.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java Tue May 03 22:17:58 2011 -0700 24.3 @@ -1,5 +1,5 @@ 24.4 /* 24.5 - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. 24.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.8 * 24.9 * This code is free software; you can redistribute it and/or modify it 24.10 @@ -76,13 +76,16 @@ 24.11 24.12 protected void generatePackageListFile(RootDoc root) { 24.13 PackageDoc[] packages = configuration.packages; 24.14 - String[] names = new String[packages.length]; 24.15 + ArrayList<String> names = new ArrayList<String>(); 24.16 for (int i = 0; i < packages.length; i++) { 24.17 - names[i] = packages[i].name(); 24.18 + // if the -nodeprecated option is set and the package is marked as 24.19 + // deprecated, do not include it in the packages list. 24.20 + if (!(configuration.nodeprecated && Util.isDeprecated(packages[i]))) 24.21 + names.add(packages[i].name()); 24.22 } 24.23 - Arrays.sort(names); 24.24 - for (int i = 0; i < packages.length; i++) { 24.25 - println(names[i]); 24.26 + Collections.sort(names); 24.27 + for (int i = 0; i < names.size(); i++) { 24.28 + println(names.get(i)); 24.29 } 24.30 } 24.31 }
25.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Mon May 02 09:38:22 2011 -0700 25.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Tue May 03 22:17:58 2011 -0700 25.3 @@ -861,11 +861,15 @@ 25.4 * @param doc the Doc to check. 25.5 * @return true if the given Doc is deprecated. 25.6 */ 25.7 - public static boolean isDeprecated(ProgramElementDoc doc) { 25.8 + public static boolean isDeprecated(Doc doc) { 25.9 if (doc.tags("deprecated").length > 0) { 25.10 return true; 25.11 } 25.12 - AnnotationDesc[] annotationDescList = doc.annotations(); 25.13 + AnnotationDesc[] annotationDescList; 25.14 + if (doc instanceof PackageDoc) 25.15 + annotationDescList = ((PackageDoc)doc).annotations(); 25.16 + else 25.17 + annotationDescList = ((ProgramElementDoc)doc).annotations(); 25.18 for (int i = 0; i < annotationDescList.length; i++) { 25.19 if (annotationDescList[i].annotationType().qualifiedName().equals( 25.20 java.lang.Deprecated.class.getName())){
26.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Mon May 02 09:38:22 2011 -0700 26.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Tue May 03 22:17:58 2011 -0700 26.3 @@ -1,5 +1,5 @@ 26.4 /* 26.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 26.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 26.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.8 * 26.9 * This code is free software; you can redistribute it and/or modify it 26.10 @@ -34,11 +34,13 @@ 26.11 import javax.lang.model.element.ExecutableElement; 26.12 import javax.lang.model.element.TypeElement; 26.13 import javax.lang.model.type.DeclaredType; 26.14 +import javax.lang.model.type.TypeKind; 26.15 import javax.lang.model.type.TypeMirror; 26.16 import javax.tools.Diagnostic; 26.17 import javax.tools.JavaCompiler; 26.18 import javax.tools.JavaFileObject; 26.19 26.20 +import com.sun.source.tree.CatchTree; 26.21 import com.sun.source.tree.CompilationUnitTree; 26.22 import com.sun.source.tree.Scope; 26.23 import com.sun.source.tree.Tree; 26.24 @@ -49,7 +51,7 @@ 26.25 import com.sun.tools.javac.code.Symbol.ClassSymbol; 26.26 import com.sun.tools.javac.code.Symbol.TypeSymbol; 26.27 import com.sun.tools.javac.code.Symbol; 26.28 -import com.sun.tools.javac.code.Type; 26.29 +import com.sun.tools.javac.code.Type.UnionClassType; 26.30 import com.sun.tools.javac.comp.Attr; 26.31 import com.sun.tools.javac.comp.AttrContext; 26.32 import com.sun.tools.javac.comp.Enter; 26.33 @@ -430,4 +432,16 @@ 26.34 log.useSource(oldSource); 26.35 } 26.36 } 26.37 + 26.38 + @Override 26.39 + public TypeMirror getLub(CatchTree tree) { 26.40 + JCCatch ct = (JCCatch) tree; 26.41 + JCVariableDecl v = ct.param; 26.42 + if (v.type != null && v.type.getKind() == TypeKind.UNION) { 26.43 + UnionClassType ut = (UnionClassType) v.type; 26.44 + return ut.getLub(); 26.45 + } else { 26.46 + return v.type; 26.47 + } 26.48 + } 26.49 }
27.1 --- a/src/share/classes/com/sun/tools/javac/code/Scope.java Mon May 02 09:38:22 2011 -0700 27.2 +++ b/src/share/classes/com/sun/tools/javac/code/Scope.java Tue May 03 22:17:58 2011 -0700 27.3 @@ -649,7 +649,7 @@ 27.4 public Iterator<Symbol> iterator() { 27.5 return new CompoundScopeIterator(subScopes) { 27.6 Iterator<Symbol> nextIterator(Scope s) { 27.7 - return s.getElements().iterator(); 27.8 + return s.getElements(sf).iterator(); 27.9 } 27.10 }; 27.11 }
28.1 --- a/src/share/classes/com/sun/tools/javac/code/Source.java Mon May 02 09:38:22 2011 -0700 28.2 +++ b/src/share/classes/com/sun/tools/javac/code/Source.java Tue May 03 22:17:58 2011 -0700 28.3 @@ -186,6 +186,9 @@ 28.4 public boolean allowSimplifiedVarargs() { 28.5 return compareTo(JDK1_7) >= 0; 28.6 } 28.7 + public boolean allowObjectToPrimitiveCast() { 28.8 + return compareTo(JDK1_7) >= 0; 28.9 + } 28.10 public static SourceVersion toSourceVersion(Source source) { 28.11 switch(source) { 28.12 case JDK1_2:
29.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java Mon May 02 09:38:22 2011 -0700 29.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Tue May 03 22:17:58 2011 -0700 29.3 @@ -25,6 +25,8 @@ 29.4 29.5 package com.sun.tools.javac.code; 29.6 29.7 +import java.util.Collections; 29.8 + 29.9 import com.sun.tools.javac.util.*; 29.10 import com.sun.tools.javac.code.Symbol.*; 29.11 29.12 @@ -741,6 +743,38 @@ 29.13 } 29.14 } 29.15 29.16 + // a clone of a ClassType that knows about the alternatives of a union type. 29.17 + public static class UnionClassType extends ClassType implements UnionType { 29.18 + final List<? extends Type> alternatives_field; 29.19 + 29.20 + public UnionClassType(ClassType ct, List<? extends Type> alternatives) { 29.21 + super(ct.outer_field, ct.typarams_field, ct.tsym); 29.22 + allparams_field = ct.allparams_field; 29.23 + supertype_field = ct.supertype_field; 29.24 + interfaces_field = ct.interfaces_field; 29.25 + all_interfaces_field = ct.interfaces_field; 29.26 + alternatives_field = alternatives; 29.27 + } 29.28 + 29.29 + public Type getLub() { 29.30 + return tsym.type; 29.31 + } 29.32 + 29.33 + public java.util.List<? extends TypeMirror> getAlternatives() { 29.34 + return Collections.unmodifiableList(alternatives_field); 29.35 + } 29.36 + 29.37 + @Override 29.38 + public TypeKind getKind() { 29.39 + return TypeKind.UNION; 29.40 + } 29.41 + 29.42 + @Override 29.43 + public <R, P> R accept(TypeVisitor<R, P> v, P p) { 29.44 + return v.visitUnion(this, p); 29.45 + } 29.46 + } 29.47 + 29.48 public static class ArrayType extends Type 29.49 implements javax.lang.model.type.ArrayType { 29.50
30.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Mon May 02 09:38:22 2011 -0700 30.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Tue May 03 22:17:58 2011 -0700 30.3 @@ -74,8 +74,9 @@ 30.4 final JavacMessages messages; 30.5 final Names names; 30.6 final boolean allowBoxing; 30.7 + final boolean allowCovariantReturns; 30.8 + final boolean allowObjectToPrimitiveCast; 30.9 final ClassReader reader; 30.10 - final Source source; 30.11 final Check chk; 30.12 List<Warner> warnStack = List.nil(); 30.13 final Name capturedName; 30.14 @@ -92,9 +93,11 @@ 30.15 context.put(typesKey, this); 30.16 syms = Symtab.instance(context); 30.17 names = Names.instance(context); 30.18 - allowBoxing = Source.instance(context).allowBoxing(); 30.19 + Source source = Source.instance(context); 30.20 + allowBoxing = source.allowBoxing(); 30.21 + allowCovariantReturns = source.allowCovariantReturns(); 30.22 + allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast(); 30.23 reader = ClassReader.instance(context); 30.24 - source = Source.instance(context); 30.25 chk = Check.instance(context); 30.26 capturedName = names.fromString("<captured wildcard>"); 30.27 messages = JavacMessages.instance(context); 30.28 @@ -409,6 +412,7 @@ 30.29 return 30.30 s.tag == BOT || s.tag == CLASS || 30.31 s.tag == ARRAY || s.tag == TYPEVAR; 30.32 + case WILDCARD: //we shouldn't be here - avoids crash (see 7034495) 30.33 case NONE: 30.34 return false; 30.35 default: 30.36 @@ -949,8 +953,9 @@ 30.37 return true; 30.38 30.39 if (t.isPrimitive() != s.isPrimitive()) 30.40 - return allowBoxing && (isConvertible(t, s, warn) || isConvertible(s, t, warn)); 30.41 - 30.42 + return allowBoxing && ( 30.43 + isConvertible(t, s, warn) 30.44 + || (allowObjectToPrimitiveCast && isConvertible(s, t, warn))); 30.45 if (warn != warnStack.head) { 30.46 try { 30.47 warnStack = warnStack.prepend(warn); 30.48 @@ -2309,7 +2314,7 @@ 30.49 if (elemtype == t.elemtype) 30.50 return t; 30.51 else 30.52 - return new ArrayType(elemtype, t.tsym); 30.53 + return new ArrayType(upperBound(elemtype), t.tsym); 30.54 } 30.55 30.56 @Override 30.57 @@ -3070,7 +3075,7 @@ 30.58 30.59 if (hasSameArgs(r1, r2)) 30.60 return covariantReturnType(r1.getReturnType(), r2res, warner); 30.61 - if (!source.allowCovariantReturns()) 30.62 + if (!allowCovariantReturns) 30.63 return false; 30.64 if (isSubtypeUnchecked(r1.getReturnType(), r2res, warner)) 30.65 return true; 30.66 @@ -3087,7 +3092,7 @@ 30.67 public boolean covariantReturnType(Type t, Type s, Warner warner) { 30.68 return 30.69 isSameType(t, s) || 30.70 - source.allowCovariantReturns() && 30.71 + allowCovariantReturns && 30.72 !t.isPrimitive() && 30.73 !s.isPrimitive() && 30.74 isAssignable(t, s, warner); 30.75 @@ -3293,7 +3298,7 @@ 30.76 } 30.77 if (giveWarning && !isReifiable(reverse ? from : to)) 30.78 warn.warn(LintCategory.UNCHECKED); 30.79 - if (!source.allowCovariantReturns()) 30.80 + if (!allowCovariantReturns) 30.81 // reject if there is a common method signature with 30.82 // incompatible return types. 30.83 chk.checkCompatibleAbstracts(warn.pos(), from, to); 30.84 @@ -3320,7 +3325,7 @@ 30.85 Type t2 = to; 30.86 if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments())) 30.87 return false; 30.88 - if (!source.allowCovariantReturns()) 30.89 + if (!allowCovariantReturns) 30.90 // reject if there is a common method signature with 30.91 // incompatible return types. 30.92 chk.checkCompatibleAbstracts(warn.pos(), from, to);
31.1 --- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java Mon May 02 09:38:22 2011 -0700 31.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Annotate.java Tue May 03 22:17:58 2011 -0700 31.3 @@ -168,11 +168,11 @@ 31.4 } 31.5 JCIdent left = (JCIdent)assign.lhs; 31.6 Symbol method = rs.resolveQualifiedMethod(left.pos(), 31.7 - env, 31.8 - a.type, 31.9 - left.name, 31.10 - List.<Type>nil(), 31.11 - null); 31.12 + env, 31.13 + a.type, 31.14 + left.name, 31.15 + List.<Type>nil(), 31.16 + null); 31.17 left.sym = method; 31.18 left.type = method.type; 31.19 if (method.owner != a.type.tsym) 31.20 @@ -190,6 +190,15 @@ 31.21 Attribute enterAttributeValue(Type expected, 31.22 JCExpression tree, 31.23 Env<AttrContext> env) { 31.24 + //first, try completing the attribution value sym - if a completion 31.25 + //error is thrown, we should recover gracefully, and display an 31.26 + //ordinary resolution diagnostic. 31.27 + try { 31.28 + expected.tsym.complete(); 31.29 + } catch(CompletionFailure e) { 31.30 + log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym); 31.31 + return new Attribute.Error(expected); 31.32 + } 31.33 if (expected.isPrimitive() || types.isSameType(expected, syms.stringType)) { 31.34 Type result = attr.attribExpr(tree, env, expected); 31.35 if (result.isErroneous())
32.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon May 02 09:38:22 2011 -0700 32.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue May 03 22:17:58 2011 -0700 32.3 @@ -2910,6 +2910,7 @@ 32.4 32.5 public void visitTypeUnion(JCTypeUnion tree) { 32.6 ListBuffer<Type> multicatchTypes = ListBuffer.lb(); 32.7 + ListBuffer<Type> all_multicatchTypes = null; // lazy, only if needed 32.8 for (JCExpression typeTree : tree.alternatives) { 32.9 Type ctype = attribType(typeTree, env); 32.10 ctype = chk.checkType(typeTree.pos(), 32.11 @@ -2931,9 +2932,23 @@ 32.12 } 32.13 } 32.14 multicatchTypes.append(ctype); 32.15 + if (all_multicatchTypes != null) 32.16 + all_multicatchTypes.append(ctype); 32.17 + } else { 32.18 + if (all_multicatchTypes == null) { 32.19 + all_multicatchTypes = ListBuffer.lb(); 32.20 + all_multicatchTypes.appendList(multicatchTypes); 32.21 + } 32.22 + all_multicatchTypes.append(ctype); 32.23 } 32.24 } 32.25 - tree.type = result = check(tree, types.lub(multicatchTypes.toList()), TYP, pkind, pt); 32.26 + Type t = check(tree, types.lub(multicatchTypes.toList()), TYP, pkind, pt); 32.27 + if (t.tag == CLASS) { 32.28 + List<Type> alternatives = 32.29 + ((all_multicatchTypes == null) ? multicatchTypes : all_multicatchTypes).toList(); 32.30 + t = new UnionClassType((ClassType) t, alternatives); 32.31 + } 32.32 + tree.type = result = t; 32.33 } 32.34 32.35 public void visitTypeParameter(JCTypeParameter tree) {
33.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Mon May 02 09:38:22 2011 -0700 33.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Tue May 03 22:17:58 2011 -0700 33.3 @@ -681,6 +681,12 @@ 33.4 "cant.apply.diamond.1", 33.5 t, diags.fragment("diamond.non.generic", t)); 33.6 return types.createErrorType(t); 33.7 + } else if (tree.typeargs != null && 33.8 + tree.typeargs.nonEmpty()) { 33.9 + log.error(tree.clazz.pos(), 33.10 + "cant.apply.diamond.1", 33.11 + t, diags.fragment("diamond.and.explicit.params", t)); 33.12 + return types.createErrorType(t); 33.13 } else { 33.14 return t; 33.15 }
34.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Mon May 02 09:38:22 2011 -0700 34.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Tue May 03 22:17:58 2011 -0700 34.3 @@ -1153,8 +1153,7 @@ 34.4 if (chk.subset(exc, caughtInTry)) { 34.5 log.error(pos, "except.already.caught", exc); 34.6 } else if (!chk.isUnchecked(pos, exc) && 34.7 - exc.tsym != syms.throwableType.tsym && 34.8 - exc.tsym != syms.exceptionType.tsym && 34.9 + !isExceptionOrThrowable(exc) && 34.10 !chk.intersects(exc, thrownInTry)) { 34.11 log.error(pos, "except.never.thrown.in.try", exc); 34.12 } else if (allowImprovedCatchAnalysis) { 34.13 @@ -1163,7 +1162,8 @@ 34.14 // unchecked exception, the result list would not be empty, as the augmented 34.15 // thrown set includes { RuntimeException, Error }; if 'exc' was a checked 34.16 // exception, that would have been covered in the branch above 34.17 - if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty()) { 34.18 + if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty() && 34.19 + !isExceptionOrThrowable(exc)) { 34.20 String key = catchableThrownTypes.length() == 1 ? 34.21 "unreachable.catch" : 34.22 "unreachable.catch.1"; 34.23 @@ -1171,6 +1171,12 @@ 34.24 } 34.25 } 34.26 } 34.27 + //where 34.28 + private boolean isExceptionOrThrowable(Type exc) { 34.29 + return exc.tsym == syms.throwableType.tsym || 34.30 + exc.tsym == syms.exceptionType.tsym; 34.31 + } 34.32 + 34.33 34.34 public void visitConditional(JCConditional tree) { 34.35 scanCond(tree.cond);
35.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon May 02 09:38:22 2011 -0700 35.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Tue May 03 22:17:58 2011 -0700 35.3 @@ -1609,18 +1609,31 @@ 35.4 // type.tsym.flatName() should == proxy.enumFlatName 35.5 TypeSymbol enumTypeSym = proxy.enumType.tsym; 35.6 VarSymbol enumerator = null; 35.7 - for (Scope.Entry e = enumTypeSym.members().lookup(proxy.enumerator); 35.8 - e.scope != null; 35.9 - e = e.next()) { 35.10 - if (e.sym.kind == VAR) { 35.11 - enumerator = (VarSymbol)e.sym; 35.12 - break; 35.13 + CompletionFailure failure = null; 35.14 + try { 35.15 + for (Scope.Entry e = enumTypeSym.members().lookup(proxy.enumerator); 35.16 + e.scope != null; 35.17 + e = e.next()) { 35.18 + if (e.sym.kind == VAR) { 35.19 + enumerator = (VarSymbol)e.sym; 35.20 + break; 35.21 + } 35.22 } 35.23 } 35.24 + catch (CompletionFailure ex) { 35.25 + failure = ex; 35.26 + } 35.27 if (enumerator == null) { 35.28 - log.error("unknown.enum.constant", 35.29 - currentClassFile, enumTypeSym, proxy.enumerator); 35.30 - result = new Attribute.Error(enumTypeSym.type); 35.31 + if (failure != null) { 35.32 + log.warning("unknown.enum.constant.reason", 35.33 + currentClassFile, enumTypeSym, proxy.enumerator, 35.34 + failure.getDiagnostic()); 35.35 + } else { 35.36 + log.warning("unknown.enum.constant", 35.37 + currentClassFile, enumTypeSym, proxy.enumerator); 35.38 + } 35.39 + result = new Attribute.Enum(enumTypeSym.type, 35.40 + new VarSymbol(0, proxy.enumerator, syms.botType, enumTypeSym)); 35.41 } else { 35.42 result = new Attribute.Enum(enumTypeSym.type, enumerator); 35.43 }
36.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Code.java Mon May 02 09:38:22 2011 -0700 36.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java Tue May 03 22:17:58 2011 -0700 36.3 @@ -479,7 +479,12 @@ 36.4 state.pop(1);// index 36.5 Type a = state.stack[state.stacksize-1]; 36.6 state.pop(1); 36.7 - state.push(types.erasure(types.elemtype(a))); } 36.8 + //sometimes 'null type' is treated as a one-dimensional array type 36.9 + //see Gen.visitLiteral - we should handle this case accordingly 36.10 + Type stackType = a.tag == BOT ? 36.11 + syms.objectType : 36.12 + types.erasure(types.elemtype(a)); 36.13 + state.push(stackType); } 36.14 break; 36.15 case goto_: 36.16 markDead();
37.1 --- a/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Mon May 02 09:38:22 2011 -0700 37.2 +++ b/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Tue May 03 22:17:58 2011 -0700 37.3 @@ -72,11 +72,11 @@ 37.4 } 37.5 37.6 public Element asElement(TypeMirror t) { 37.7 - Type type = cast(Type.class, t); 37.8 - switch (type.tag) { 37.9 - case TypeTags.CLASS: 37.10 - case TypeTags.ERROR: 37.11 - case TypeTags.TYPEVAR: 37.12 + switch (t.getKind()) { 37.13 + case DECLARED: 37.14 + case ERROR: 37.15 + case TYPEVAR: 37.16 + Type type = cast(Type.class, t); 37.17 return type.asElement(); 37.18 default: 37.19 return null;
38.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Mon May 02 09:38:22 2011 -0700 38.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Tue May 03 22:17:58 2011 -0700 38.3 @@ -762,9 +762,6 @@ 38.4 compiler.err.unclosed.str.lit=\ 38.5 unclosed string literal 38.6 38.7 -compiler.err.unknown.enum.constant=\ 38.8 - in class file {0}: unknown enum constant {1}.{2} 38.9 - 38.10 # 0: name 38.11 compiler.err.unsupported.encoding=\ 38.12 unsupported encoding: {0} 38.13 @@ -1307,6 +1304,15 @@ 38.14 compiler.warn.annotation.method.not.found.reason=\ 38.15 Cannot find annotation method ''{1}()'' in type ''{0}'': {2} 38.16 38.17 +# 0: symbol, 1: name 38.18 +compiler.warn.unknown.enum.constant=\ 38.19 + unknown enum constant {1}.{2} 38.20 + 38.21 +# 0: symbol, 1: name, 2: message segment 38.22 +compiler.warn.unknown.enum.constant.reason=\ 38.23 + unknown enum constant {1}.{2}\n\ 38.24 + reason: {3} 38.25 + 38.26 # 0: type, 1: type 38.27 compiler.warn.raw.class.use=\ 38.28 found raw type: {0}\n\ 38.29 @@ -1618,6 +1624,9 @@ 38.30 compiler.misc.diamond.non.generic=\ 38.31 cannot use ''<>'' with non-generic class {0} 38.32 38.33 +compiler.misc.diamond.and.explicit.params=\ 38.34 + cannot use ''<>'' with explicit type parameters for constructor 38.35 + 38.36 # 0: type, 1: list of type 38.37 compiler.misc.explicit.param.do.not.conform.to.bounds=\ 38.38 explicit type argument {0} does not conform to declared bound(s) {1}
39.1 --- a/src/share/classes/com/sun/tools/javac/resources/legacy.properties Mon May 02 09:38:22 2011 -0700 39.2 +++ b/src/share/classes/com/sun/tools/javac/resources/legacy.properties Tue May 03 22:17:58 2011 -0700 39.3 @@ -266,6 +266,8 @@ 39.4 com.sun.swing.internal.plaf.basic.resources = tiger legacy 39.5 com.sun.swing.internal.plaf.metal.resources = tiger legacy 39.6 com.sun.swing.internal.plaf.synth.resources = tiger legacy 39.7 +com.sun.tracing = tiger legacy 39.8 +com.sun.tracing.dtrace = tiger legacy 39.9 java.applet = tiger legacy 39.10 java.awt = tiger legacy 39.11 java.awt.color = tiger legacy
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 40.2 +++ b/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java Tue May 03 22:17:58 2011 -0700 40.3 @@ -0,0 +1,101 @@ 40.4 +/* 40.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 40.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 40.7 + * 40.8 + * This code is free software; you can redistribute it and/or modify it 40.9 + * under the terms of the GNU General Public License version 2 only, as 40.10 + * published by the Free Software Foundation. 40.11 + * 40.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 40.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 40.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 40.15 + * version 2 for more details (a copy is included in the LICENSE file that 40.16 + * accompanied this code). 40.17 + * 40.18 + * You should have received a copy of the GNU General Public License version 40.19 + * 2 along with this work; if not, write to the Free Software Foundation, 40.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 40.21 + * 40.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 40.23 + * or visit www.oracle.com if you need additional information or have any 40.24 + * questions. 40.25 + */ 40.26 + 40.27 +/* 40.28 + * @test 40.29 + * @bug 6553182 40.30 + * @summary This test verifies the -Xdocrootparent option. 40.31 + * @author Bhavesh Patel 40.32 + * @library ../lib/ 40.33 + * @build JavadocTester TestDocRootLink 40.34 + * @run main TestDocRootLink 40.35 + */ 40.36 +public class TestDocRootLink extends JavadocTester { 40.37 + 40.38 + private static final String BUG_ID = "6553182"; 40.39 + private static final String[][] TEST1 = { 40.40 + {BUG_ID + FS + "pkg1" + FS + "C1.html", 40.41 + "<a href=\"../../technotes/guides/index.html\">" 40.42 + }, 40.43 + {BUG_ID + FS + "pkg1" + FS + "package-summary.html", 40.44 + "<a href=\"../../technotes/guides/index.html\">" 40.45 + } 40.46 + }; 40.47 + private static final String[][] NEGATED_TEST1 = { 40.48 + {BUG_ID + FS + "pkg1" + FS + "C1.html", 40.49 + "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">" 40.50 + }, 40.51 + {BUG_ID + FS + "pkg1" + FS + "package-summary.html", 40.52 + "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">" 40.53 + } 40.54 + }; 40.55 + private static final String[][] TEST2 = { 40.56 + {BUG_ID + FS + "pkg2" + FS + "C2.html", 40.57 + "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">" 40.58 + }, 40.59 + {BUG_ID + FS + "pkg2" + FS + "package-summary.html", 40.60 + "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">" 40.61 + } 40.62 + }; 40.63 + private static final String[][] NEGATED_TEST2 = { 40.64 + {BUG_ID + FS + "pkg2" + FS + "C2.html", 40.65 + "<a href=\"../../technotes/guides/index.html\">" 40.66 + }, 40.67 + {BUG_ID + FS + "pkg2" + FS + "package-summary.html", 40.68 + "<a href=\"../../technotes/guides/index.html\">" 40.69 + } 40.70 + }; 40.71 + private static final String[] ARGS1 = 40.72 + new String[]{ 40.73 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1" 40.74 + }; 40.75 + private static final String[] ARGS2 = 40.76 + new String[]{ 40.77 + "-d", BUG_ID, "-Xdocrootparent", "http://download.oracle.com/javase/7/docs", "-sourcepath", SRC_DIR, "pkg2" 40.78 + }; 40.79 + 40.80 + /** 40.81 + * The entry point of the test. 40.82 + * @param args the array of command line arguments. 40.83 + */ 40.84 + public static void main(String[] args) { 40.85 + TestDocRootLink tester = new TestDocRootLink(); 40.86 + run(tester, ARGS1, TEST1, NEGATED_TEST1); 40.87 + run(tester, ARGS2, TEST2, NEGATED_TEST2); 40.88 + tester.printSummary(); 40.89 + } 40.90 + 40.91 + /** 40.92 + * {@inheritDoc} 40.93 + */ 40.94 + public String getBugId() { 40.95 + return BUG_ID; 40.96 + } 40.97 + 40.98 + /** 40.99 + * {@inheritDoc} 40.100 + */ 40.101 + public String getBugName() { 40.102 + return getClass().getName(); 40.103 + } 40.104 +}
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 41.2 +++ b/test/com/sun/javadoc/testDocRootLink/pkg1/C1.java Tue May 03 22:17:58 2011 -0700 41.3 @@ -0,0 +1,31 @@ 41.4 +/* 41.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 41.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41.7 + * 41.8 + * This code is free software; you can redistribute it and/or modify it 41.9 + * under the terms of the GNU General Public License version 2 only, as 41.10 + * published by the Free Software Foundation. 41.11 + * 41.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 41.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 41.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 41.15 + * version 2 for more details (a copy is included in the LICENSE file that 41.16 + * accompanied this code). 41.17 + * 41.18 + * You should have received a copy of the GNU General Public License version 41.19 + * 2 along with this work; if not, write to the Free Software Foundation, 41.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 41.21 + * 41.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 41.23 + * or visit www.oracle.com if you need additional information or have any 41.24 + * questions. 41.25 + */ 41.26 + 41.27 +package pkg1; 41.28 + 41.29 +/** 41.30 + * Class 1. This is a test. 41.31 + * Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. Lets see if this works 41.32 + * or not. 41.33 + */ 41.34 +public class C1 {}
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 42.2 +++ b/test/com/sun/javadoc/testDocRootLink/pkg1/package.html Tue May 03 22:17:58 2011 -0700 42.3 @@ -0,0 +1,18 @@ 42.4 +<html> 42.5 +<head> 42.6 +<title>javax.management package</title> 42.7 +</head> 42.8 +<body bgcolor="white"> 42.9 +This is a test. 42.10 + <p id="spec"> 42.11 + @see <a href="{@docRoot}/../technotes/guides/index.html"> 42.12 + Test document 1</a> 42.13 + in particular the 42.14 + <a href="{@docRoot}/../technotes/guides/index.html"> 42.15 + 42.16 + Test document 2.</a> 42.17 + 42.18 + @since 1.5 42.19 + 42.20 +</body> 42.21 +</html>
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 43.2 +++ b/test/com/sun/javadoc/testDocRootLink/pkg2/C2.java Tue May 03 22:17:58 2011 -0700 43.3 @@ -0,0 +1,31 @@ 43.4 +/* 43.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 43.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 43.7 + * 43.8 + * This code is free software; you can redistribute it and/or modify it 43.9 + * under the terms of the GNU General Public License version 2 only, as 43.10 + * published by the Free Software Foundation. 43.11 + * 43.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 43.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 43.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 43.15 + * version 2 for more details (a copy is included in the LICENSE file that 43.16 + * accompanied this code). 43.17 + * 43.18 + * You should have received a copy of the GNU General Public License version 43.19 + * 2 along with this work; if not, write to the Free Software Foundation, 43.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 43.21 + * 43.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 43.23 + * or visit www.oracle.com if you need additional information or have any 43.24 + * questions. 43.25 + */ 43.26 + 43.27 +package pkg2; 43.28 + 43.29 +/** 43.30 + * Class 1. This is a test. 43.31 + * Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. Lets see if this works 43.32 + * or not. 43.33 + */ 43.34 +public class C2 {}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 44.2 +++ b/test/com/sun/javadoc/testDocRootLink/pkg2/package.html Tue May 03 22:17:58 2011 -0700 44.3 @@ -0,0 +1,18 @@ 44.4 +<html> 44.5 +<head> 44.6 +<title>javax.management package</title> 44.7 +</head> 44.8 +<body bgcolor="white"> 44.9 +This is a test. 44.10 + <p id="spec"> 44.11 + @see <a href="{@docRoot}/../technotes/guides/index.html"> 44.12 + Test document 1</a> 44.13 + in particular the 44.14 + <a href="{@docRoot}/../technotes/guides/index.html"> 44.15 + 44.16 + Test document 2.</a> 44.17 + 44.18 + @since 1.5 44.19 + 44.20 +</body> 44.21 +</html>
45.1 --- a/test/com/sun/javadoc/testHelpOption/TestHelpOption.java Mon May 02 09:38:22 2011 -0700 45.2 +++ b/test/com/sun/javadoc/testHelpOption/TestHelpOption.java Tue May 03 22:17:58 2011 -0700 45.3 @@ -1,5 +1,5 @@ 45.4 /* 45.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 45.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 45.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 45.8 * 45.9 * This code is free software; you can redistribute it and/or modify it 45.10 @@ -23,20 +23,19 @@ 45.11 45.12 /* 45.13 * @test 45.14 - * @bug 4934778 4777599 45.15 + * @bug 4934778 4777599 6553182 45.16 * @summary Make sure that the -help option works properly. Make sure 45.17 * the help link appears in the documentation. 45.18 * @author jamieh 45.19 * @library ../lib/ 45.20 - * @build JavadocTester 45.21 - * @build TestHelpOption 45.22 + * @build JavadocTester TestHelpOption 45.23 * @run main TestHelpOption 45.24 */ 45.25 45.26 public class TestHelpOption extends JavadocTester { 45.27 45.28 //Test information. 45.29 - private static final String BUG_ID = "4934778-4777599"; 45.30 + private static final String BUG_ID = "4934778-4777599-6553182"; 45.31 45.32 //Javadoc arguments. 45.33 private static final String[] ARGS = new String[] { 45.34 @@ -79,6 +78,7 @@ 45.35 {STANDARD_OUTPUT, "-tag "}, 45.36 {STANDARD_OUTPUT, "-taglet "}, 45.37 {STANDARD_OUTPUT, "-tagletpath "}, 45.38 + {STANDARD_OUTPUT, "-Xdocrootparent "}, 45.39 {STANDARD_OUTPUT, "-charset "}, 45.40 {STANDARD_OUTPUT, "-helpfile "}, 45.41 {STANDARD_OUTPUT, "-linksource "},
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 46.2 +++ b/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java Tue May 03 22:17:58 2011 -0700 46.3 @@ -0,0 +1,78 @@ 46.4 +/* 46.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 46.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 46.7 + * 46.8 + * This code is free software; you can redistribute it and/or modify it 46.9 + * under the terms of the GNU General Public License version 2 only, as 46.10 + * published by the Free Software Foundation. 46.11 + * 46.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 46.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 46.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 46.15 + * version 2 for more details (a copy is included in the LICENSE file that 46.16 + * accompanied this code). 46.17 + * 46.18 + * You should have received a copy of the GNU General Public License version 46.19 + * 2 along with this work; if not, write to the Free Software Foundation, 46.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 46.21 + * 46.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 46.23 + * or visit www.oracle.com if you need additional information or have any 46.24 + * questions. 46.25 + */ 46.26 + 46.27 +/* 46.28 + * @test 46.29 + * @bug 6758050 46.30 + * @summary Test HTML output for nested generic types. 46.31 + * @author bpatel 46.32 + * @library ../lib/ 46.33 + * @build JavadocTester TestNestedGenerics 46.34 + * @run main TestNestedGenerics 46.35 + */ 46.36 + 46.37 +public class TestNestedGenerics extends JavadocTester { 46.38 + 46.39 + //Test information. 46.40 + private static final String BUG_ID = "6758050"; 46.41 + 46.42 + //Javadoc arguments. 46.43 + private static final String[] ARGS = new String[]{ 46.44 + "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR, 46.45 + "pkg" 46.46 + }; 46.47 + 46.48 + //Input for string search tests. 46.49 + private static final String[][] TEST = { 46.50 + {BUG_ID + FS + "pkg" + FS + "NestedGenerics.html", 46.51 + "<div class=\"block\">Contains <a " + 46.52 + "href=\"../pkg/NestedGenerics.html#foo(java.util.Map)\"><code>foo" + 46.53 + "(java.util.Map<A, java.util.Map<A, A>>)</code></a></div>" 46.54 + } 46.55 + }; 46.56 + private static final String[][] NEGATED_TEST = NO_TEST; 46.57 + 46.58 + /** 46.59 + * The entry point of the test. 46.60 + * @param args the array of command line arguments. 46.61 + */ 46.62 + public static void main(String[] args) { 46.63 + TestNestedGenerics tester = new TestNestedGenerics(); 46.64 + run(tester, ARGS, TEST, NEGATED_TEST); 46.65 + tester.printSummary(); 46.66 + } 46.67 + 46.68 + /** 46.69 + * {@inheritDoc} 46.70 + */ 46.71 + public String getBugId() { 46.72 + return BUG_ID; 46.73 + } 46.74 + 46.75 + /** 46.76 + * {@inheritDoc} 46.77 + */ 46.78 + public String getBugName() { 46.79 + return getClass().getName(); 46.80 + } 46.81 +}
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 47.2 +++ b/test/com/sun/javadoc/testNestedGenerics/pkg/NestedGenerics.java Tue May 03 22:17:58 2011 -0700 47.3 @@ -0,0 +1,31 @@ 47.4 +/* 47.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 47.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 47.7 + * 47.8 + * This code is free software; you can redistribute it and/or modify it 47.9 + * under the terms of the GNU General Public License version 2 only, as 47.10 + * published by the Free Software Foundation. 47.11 + * 47.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 47.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 47.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 47.15 + * version 2 for more details (a copy is included in the LICENSE file that 47.16 + * accompanied this code). 47.17 + * 47.18 + * You should have received a copy of the GNU General Public License version 47.19 + * 2 along with this work; if not, write to the Free Software Foundation, 47.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 47.21 + * 47.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 47.23 + * or visit www.oracle.com if you need additional information or have any 47.24 + * questions. 47.25 + */ 47.26 + 47.27 +package pkg; 47.28 + 47.29 +import java.util.Map; 47.30 + 47.31 +/** Contains {@link #foo} */ 47.32 +public class NestedGenerics { 47.33 + public static <A> void foo(Map<A, Map<A, A>> map) {} 47.34 +}
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 48.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/C2.java Tue May 03 22:17:58 2011 -0700 48.3 @@ -0,0 +1,55 @@ 48.4 +/* 48.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 48.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 48.7 + * 48.8 + * This code is free software; you can redistribute it and/or modify it 48.9 + * under the terms of the GNU General Public License version 2 only, as 48.10 + * published by the Free Software Foundation. 48.11 + * 48.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 48.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 48.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 48.15 + * version 2 for more details (a copy is included in the LICENSE file that 48.16 + * accompanied this code). 48.17 + * 48.18 + * You should have received a copy of the GNU General Public License version 48.19 + * 2 along with this work; if not, write to the Free Software Foundation, 48.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 48.21 + * 48.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 48.23 + * or visit www.oracle.com if you need additional information or have any 48.24 + * questions. 48.25 + */ 48.26 + 48.27 +/** 48.28 + * Another test class. 48.29 + * 48.30 + * @author Bhavesh Patel 48.31 + */ 48.32 +public class C2 { 48.33 + 48.34 + public static enum ModalExclusionType { 48.35 + /** 48.36 + * Test comment. 48.37 + */ 48.38 + NO_EXCLUDE, 48.39 + /** 48.40 + * Another comment. 48.41 + */ 48.42 + APPLICATION_EXCLUDE 48.43 + }; 48.44 + 48.45 + /** 48.46 + * A string constant. 48.47 + */ 48.48 + public static final String CONSTANT1 = "C2"; 48.49 + 48.50 + /** 48.51 + * A sample method. 48.52 + * 48.53 + * @param param some parameter. 48.54 + */ 48.55 + public void method(String param) { 48.56 + 48.57 + } 48.58 +}
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 49.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/FooDepr.java Tue May 03 22:17:58 2011 -0700 49.3 @@ -0,0 +1,34 @@ 49.4 +/* 49.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 49.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 49.7 + * 49.8 + * This code is free software; you can redistribute it and/or modify it 49.9 + * under the terms of the GNU General Public License version 2 only, as 49.10 + * published by the Free Software Foundation. 49.11 + * 49.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 49.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 49.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 49.15 + * version 2 for more details (a copy is included in the LICENSE file that 49.16 + * accompanied this code). 49.17 + * 49.18 + * You should have received a copy of the GNU General Public License version 49.19 + * 2 along with this work; if not, write to the Free Software Foundation, 49.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 49.21 + * 49.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 49.23 + * or visit www.oracle.com if you need additional information or have any 49.24 + * questions. 49.25 + */ 49.26 + 49.27 +import java.util.*; 49.28 + 49.29 +/** 49.30 +* Test Deprecated class 49.31 +* @deprecated This class is Deprecated. 49.32 +*/ 49.33 +public class FooDepr { 49.34 + 49.35 + public void method(Vector<Object> o){} 49.36 + 49.37 +}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 50.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java Tue May 03 22:17:58 2011 -0700 50.3 @@ -0,0 +1,103 @@ 50.4 +/* 50.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 50.7 + * 50.8 + * This code is free software; you can redistribute it and/or modify it 50.9 + * under the terms of the GNU General Public License version 2 only, as 50.10 + * published by the Free Software Foundation. 50.11 + * 50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 50.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 50.15 + * version 2 for more details (a copy is included in the LICENSE file that 50.16 + * accompanied this code). 50.17 + * 50.18 + * You should have received a copy of the GNU General Public License version 50.19 + * 2 along with this work; if not, write to the Free Software Foundation, 50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 50.21 + * 50.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 50.23 + * or visit www.oracle.com if you need additional information or have any 50.24 + * questions. 50.25 + */ 50.26 + 50.27 +/* 50.28 + * @test 50.29 + * @bug 6492694 50.30 + * @summary Test package deprecation. 50.31 + * @author bpatel 50.32 + * @library ../lib/ 50.33 + * @build JavadocTester TestPackageDeprecation 50.34 + * @run main TestPackageDeprecation 50.35 + */ 50.36 + 50.37 +public class TestPackageDeprecation extends JavadocTester { 50.38 + 50.39 + //Test information. 50.40 + private static final String BUG_ID = "6492694"; 50.41 + 50.42 + //Javadoc arguments. 50.43 + private static final String[] ARGS1 = new String[]{ 50.44 + "-d", BUG_ID + "-1", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1", 50.45 + SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java" 50.46 + }; 50.47 + private static final String[] ARGS2 = new String[]{ 50.48 + "-d", BUG_ID + "-2", "-source", "1.5", "-sourcepath", SRC_DIR, "-use", "-nodeprecated", 50.49 + "pkg", "pkg1", SRC_DIR + FS + "C2.java", SRC_DIR + FS + "FooDepr.java" 50.50 + }; 50.51 + 50.52 + //Input for string search tests. 50.53 + private static final String[][] TEST1 = { 50.54 + {BUG_ID + "-1" + FS + "pkg1" + FS + "package-summary.html", 50.55 + "<div class=\"deprecatedContent\"><span class=\"strong\">Deprecated.</span>" + NL + 50.56 + "<div class=\"block\"><i>This package is Deprecated.</i></div>" 50.57 + }, 50.58 + {BUG_ID + "-1" + FS + "deprecated-list.html", 50.59 + "<li><a href=\"#package\">Deprecated Packages</a></li>" 50.60 + } 50.61 + }; 50.62 + private static final String[][] TEST2 = NO_TEST; 50.63 + private static final String[][] NEGATED_TEST1 = NO_TEST; 50.64 + private static final String[][] NEGATED_TEST2 = { 50.65 + {BUG_ID + "-2" + FS + "overview-summary.html", "pkg1"}, 50.66 + {BUG_ID + "-2" + FS + "allclasses-frame.html", "FooDepr"} 50.67 + }; 50.68 + 50.69 + /** 50.70 + * The entry point of the test. 50.71 + * @param args the array of command line arguments. 50.72 + */ 50.73 + public static void main(String[] args) { 50.74 + TestPackageDeprecation tester = new TestPackageDeprecation(); 50.75 + run(tester, ARGS1, TEST1, NEGATED_TEST1); 50.76 + run(tester, ARGS2, TEST2, NEGATED_TEST2); 50.77 + if ((new java.io.File(BUG_ID + "-2" + FS + "pkg1" + FS + 50.78 + "package-summary.html")).exists()) { 50.79 + throw new Error("Test Fails: packages summary should not be" + 50.80 + "generated for deprecated package."); 50.81 + } else { 50.82 + System.out.println("Test passes: package-summary.html not found."); 50.83 + } 50.84 + if ((new java.io.File(BUG_ID + "-2" + FS + "FooDepr.html")).exists()) { 50.85 + throw new Error("Test Fails: FooDepr should not be" + 50.86 + "generated as it is deprecated."); 50.87 + } else { 50.88 + System.out.println("Test passes: FooDepr.html not found."); 50.89 + } 50.90 + tester.printSummary(); 50.91 + } 50.92 + 50.93 + /** 50.94 + * {@inheritDoc} 50.95 + */ 50.96 + public String getBugId() { 50.97 + return BUG_ID; 50.98 + } 50.99 + 50.100 + /** 50.101 + * {@inheritDoc} 50.102 + */ 50.103 + public String getBugName() { 50.104 + return getClass().getName(); 50.105 + } 50.106 +}
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 51.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg/A.java Tue May 03 22:17:58 2011 -0700 51.3 @@ -0,0 +1,35 @@ 51.4 +/* 51.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 51.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 51.7 + * 51.8 + * This code is free software; you can redistribute it and/or modify it 51.9 + * under the terms of the GNU General Public License version 2 only, as 51.10 + * published by the Free Software Foundation. 51.11 + * 51.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 51.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 51.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 51.15 + * version 2 for more details (a copy is included in the LICENSE file that 51.16 + * accompanied this code). 51.17 + * 51.18 + * You should have received a copy of the GNU General Public License version 51.19 + * 2 along with this work; if not, write to the Free Software Foundation, 51.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 51.21 + * 51.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 51.23 + * or visit www.oracle.com if you need additional information or have any 51.24 + * questions. 51.25 + */ 51.26 + 51.27 +package pkg; 51.28 + 51.29 +public class A { 51.30 + /** Test constant. */ 51.31 + public static final String DEMO= "y"; 51.32 + public static final String THIS_IS_OK= "(x)"; 51.33 + 51.34 + public String DEMO_STRING = "<Hello World>"; 51.35 + 51.36 + public A() { 51.37 + } 51.38 +}
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 52.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg1/ClassUseTest1.java Tue May 03 22:17:58 2011 -0700 52.3 @@ -0,0 +1,31 @@ 52.4 +/* 52.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 52.7 + * 52.8 + * This code is free software; you can redistribute it and/or modify it 52.9 + * under the terms of the GNU General Public License version 2 only, as 52.10 + * published by the Free Software Foundation. 52.11 + * 52.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 52.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 52.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 52.15 + * version 2 for more details (a copy is included in the LICENSE file that 52.16 + * accompanied this code). 52.17 + * 52.18 + * You should have received a copy of the GNU General Public License version 52.19 + * 2 along with this work; if not, write to the Free Software Foundation, 52.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 52.21 + * 52.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 52.23 + * or visit www.oracle.com if you need additional information or have any 52.24 + * questions. 52.25 + */ 52.26 + 52.27 +package pkg1; 52.28 + 52.29 +public class ClassUseTest1 <T extends Foo & Foo2> { 52.30 + 52.31 + public <T extends Foo & Foo2> T method(T t) { 52.32 + return null; 52.33 + } 52.34 +}
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 53.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg1/Foo.java Tue May 03 22:17:58 2011 -0700 53.3 @@ -0,0 +1,36 @@ 53.4 +/* 53.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 53.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 53.7 + * 53.8 + * This code is free software; you can redistribute it and/or modify it 53.9 + * under the terms of the GNU General Public License version 2 only, as 53.10 + * published by the Free Software Foundation. 53.11 + * 53.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 53.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 53.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 53.15 + * version 2 for more details (a copy is included in the LICENSE file that 53.16 + * accompanied this code). 53.17 + * 53.18 + * You should have received a copy of the GNU General Public License version 53.19 + * 2 along with this work; if not, write to the Free Software Foundation, 53.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 53.21 + * 53.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 53.23 + * or visit www.oracle.com if you need additional information or have any 53.24 + * questions. 53.25 + */ 53.26 + 53.27 +package pkg1; 53.28 + 53.29 +import java.util.*; 53.30 + 53.31 +/** 53.32 +* Test Deprecated class 53.33 +* @deprecated This class is Deprecated. 53.34 +*/ 53.35 +public class Foo { 53.36 + 53.37 + public void method(Vector<Object> o){} 53.38 + 53.39 +}
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 54.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg1/Foo2.java Tue May 03 22:17:58 2011 -0700 54.3 @@ -0,0 +1,26 @@ 54.4 +/* 54.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 54.7 + * 54.8 + * This code is free software; you can redistribute it and/or modify it 54.9 + * under the terms of the GNU General Public License version 2 only, as 54.10 + * published by the Free Software Foundation. 54.11 + * 54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 54.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 54.15 + * version 2 for more details (a copy is included in the LICENSE file that 54.16 + * accompanied this code). 54.17 + * 54.18 + * You should have received a copy of the GNU General Public License version 54.19 + * 2 along with this work; if not, write to the Free Software Foundation, 54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 54.21 + * 54.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 54.23 + * or visit www.oracle.com if you need additional information or have any 54.24 + * questions. 54.25 + */ 54.26 + 54.27 +package pkg1; 54.28 + 54.29 +public interface Foo2 {}
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 55.2 +++ b/test/com/sun/javadoc/testPackageDeprecation/pkg1/package-info.java Tue May 03 22:17:58 2011 -0700 55.3 @@ -0,0 +1,28 @@ 55.4 +/* 55.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 55.7 + * 55.8 + * This code is free software; you can redistribute it and/or modify it 55.9 + * under the terms of the GNU General Public License version 2 only, as 55.10 + * published by the Free Software Foundation. 55.11 + * 55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 55.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 55.15 + * version 2 for more details (a copy is included in the LICENSE file that 55.16 + * accompanied this code). 55.17 + * 55.18 + * You should have received a copy of the GNU General Public License version 55.19 + * 2 along with this work; if not, write to the Free Software Foundation, 55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 55.21 + * 55.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 55.23 + * or visit www.oracle.com if you need additional information or have any 55.24 + * questions. 55.25 + */ 55.26 + 55.27 +/** 55.28 + * Test pkg1 used. 55.29 + * @deprecated This package is Deprecated. 55.30 + */ 55.31 +package pkg1;
56.1 --- a/test/com/sun/javadoc/testStylesheet/TestStylesheet.java Mon May 02 09:38:22 2011 -0700 56.2 +++ b/test/com/sun/javadoc/testStylesheet/TestStylesheet.java Tue May 03 22:17:58 2011 -0700 56.3 @@ -1,5 +1,5 @@ 56.4 /* 56.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 56.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. 56.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 56.8 * 56.9 * This code is free software; you can redistribute it and/or modify it 56.10 @@ -23,19 +23,18 @@ 56.11 56.12 /* 56.13 * @test 56.14 - * @bug 4494033 56.15 + * @bug 4494033 7028815 56.16 * @summary Run tests on doclet stylesheet. 56.17 * @author jamieh 56.18 * @library ../lib/ 56.19 - * @build JavadocTester 56.20 - * @build TestStylesheet 56.21 + * @build JavadocTester TestStylesheet 56.22 * @run main TestStylesheet 56.23 */ 56.24 56.25 public class TestStylesheet extends JavadocTester { 56.26 56.27 //Test information. 56.28 - private static final String BUG_ID = "4494033"; 56.29 + private static final String BUG_ID = "4494033-7028815"; 56.30 56.31 //Javadoc arguments. 56.32 private static final String[] ARGS = new String[] { 56.33 @@ -56,15 +55,18 @@ 56.34 "body {" + NL + " font-family:Helvetica, Arial, sans-serif;" + NL + 56.35 " color:#000000;" + NL + "}"}, 56.36 {BUG_ID + FS + "stylesheet.css", 56.37 - "dl dd ul li {" + NL + " list-style:none;" + NL + 56.38 - " margin:10px 0 10px 0;" + NL + "}"}, 56.39 + "ul {" + NL + " margin:10px 0 10px 20px;" + NL + 56.40 + " list-style-type:disc;" + NL + "}"}, 56.41 // Test whether a link to the stylesheet file is inserted properly 56.42 // in the class documentation. 56.43 {BUG_ID + FS + "pkg" + FS + "A.html", 56.44 "<link rel=\"stylesheet\" type=\"text/css\" " + 56.45 "href=\"../stylesheet.css\" title=\"Style\">"} 56.46 }; 56.47 - private static final String[][] NEGATED_TEST = NO_TEST; 56.48 + private static final String[][] NEGATED_TEST = { 56.49 + {BUG_ID + FS + "stylesheet.css", 56.50 + "* {" + NL + " margin:0;" + NL + " padding:0;" + NL + "}"} 56.51 + }; 56.52 56.53 /** 56.54 * The entry point of the test.
57.1 --- a/test/com/sun/javadoc/testSubTitle/TestSubTitle.java Mon May 02 09:38:22 2011 -0700 57.2 +++ b/test/com/sun/javadoc/testSubTitle/TestSubTitle.java Tue May 03 22:17:58 2011 -0700 57.3 @@ -37,8 +37,7 @@ 57.4 private static final String BUG_ID = "7010342"; 57.5 private static final String[][] TEST = { 57.6 {BUG_ID + FS + "pkg" + FS + "package-summary.html", 57.7 - "<div class=\"subTitle\">" + NL + "<div class=\"block\">This is the " + 57.8 - "description of package pkg.</div>" + NL + "</div>" 57.9 + "<div class=\"block\">This is the description of package pkg.</div>" 57.10 }, 57.11 {BUG_ID + FS + "pkg" + FS + "C.html", 57.12 "<div class=\"subTitle\">pkg</div>"
58.1 --- a/test/tools/javac/6558548/T6558548.java Mon May 02 09:38:22 2011 -0700 58.2 +++ b/test/tools/javac/6558548/T6558548.java Tue May 03 22:17:58 2011 -0700 58.3 @@ -1,9 +1,9 @@ 58.4 /* 58.5 * @test /nodynamiccopyright/ 58.6 - * @bug 6558548 58.7 + * @bug 6558548 7039937 58.8 * @summary The compiler needs to be aligned with clarified specification of throws 58.9 * @compile/fail/ref=T6558548_latest.out -XDrawDiagnostics T6558548.java 58.10 - * @compile/fail/ref=T6558548_6.out -source 6 -XDrawDiagnostics T6558548.java 58.11 + * @compile/fail/ref=T6558548_6.out -source 6 -Xlint:-options -XDrawDiagnostics T6558548.java 58.12 */ 58.13 58.14 class T6558548 { 58.15 @@ -12,7 +12,7 @@ 58.16 void checked() throws InterruptedException {} 58.17 void runtime() throws IllegalArgumentException {} 58.18 58.19 - void m1() { 58.20 + void m1a() { 58.21 try { 58.22 throw new java.io.FileNotFoundException(); 58.23 } 58.24 @@ -20,7 +20,7 @@ 58.25 catch(java.io.IOException exc) { } // 6: ok; latest: unreachable 58.26 } 58.27 58.28 - void m1a() { 58.29 + void m1b() { 58.30 try { 58.31 throw new java.io.IOException(); 58.32 } 58.33 @@ -28,11 +28,20 @@ 58.34 catch(java.io.IOException exc) { } //ok 58.35 } 58.36 58.37 - void m2() { 58.38 + void m1c() { 58.39 try { 58.40 - nothing(); 58.41 + throw new java.io.FileNotFoundException(); 58.42 } 58.43 - catch(Exception exc) { } // ok 58.44 + catch(java.io.FileNotFoundException exc) { } 58.45 + catch(Exception ex) { } //ok (Exception/Throwable always allowed) 58.46 + } 58.47 + 58.48 + void m1d() { 58.49 + try { 58.50 + throw new java.io.FileNotFoundException(); 58.51 + } 58.52 + catch(java.io.FileNotFoundException exc) { } 58.53 + catch(Throwable ex) { } //ok (Exception/Throwable always allowed) 58.54 } 58.55 58.56 void m3() { 58.57 @@ -131,7 +140,7 @@ 58.58 runtime(); 58.59 } 58.60 catch(RuntimeException exc) { } 58.61 - catch(Exception exc) { } //6: ok; latest: unreachable 58.62 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.63 } 58.64 58.65 void m17() { 58.66 @@ -139,7 +148,7 @@ 58.67 nothing(); 58.68 } 58.69 catch(RuntimeException exc) { } 58.70 - catch(Exception exc) { } //6: ok; latest: unreachable 58.71 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.72 } 58.73 58.74 void m18() { 58.75 @@ -148,7 +157,7 @@ 58.76 } 58.77 catch(RuntimeException exc) { } 58.78 catch(InterruptedException exc) { } 58.79 - catch(Exception exc) { } //6: ok; latest: unreachable 58.80 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.81 } 58.82 58.83 void m19() { 58.84 @@ -157,7 +166,7 @@ 58.85 } 58.86 catch(RuntimeException exc) { } 58.87 catch(InterruptedException exc) { } //never thrown in try 58.88 - catch(Exception exc) { } //6: ok; latest: unreachable 58.89 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.90 } 58.91 58.92 void m20() { 58.93 @@ -166,7 +175,7 @@ 58.94 } 58.95 catch(RuntimeException exc) { } 58.96 catch(InterruptedException exc) { } //never thrown in try 58.97 - catch(Exception exc) { } //6: ok; latest: unreachable 58.98 + catch(Exception exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.99 } 58.100 58.101 void m21() { 58.102 @@ -182,7 +191,7 @@ 58.103 runtime(); 58.104 } 58.105 catch(RuntimeException exc) { } 58.106 - catch(Exception exc) { } // 6: ok; latest: unreachable 58.107 + catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed) 58.108 } 58.109 58.110 void m23() { 58.111 @@ -190,7 +199,7 @@ 58.112 nothing(); 58.113 } 58.114 catch(RuntimeException exc) { } 58.115 - catch(Exception exc) { } // 6: ok; latest: unreachable 58.116 + catch(Exception exc) { } // 6: ok; latest: ok (Exception/Throwable always allowed) 58.117 } 58.118 58.119 void m24() { 58.120 @@ -208,7 +217,7 @@ 58.121 } 58.122 catch(RuntimeException exc) { } 58.123 catch(Error exc) { } 58.124 - catch(Throwable exc) { } //6: ok; latest: unreachable 58.125 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.126 } 58.127 58.128 void m26() { 58.129 @@ -217,7 +226,7 @@ 58.130 } 58.131 catch(RuntimeException exc) { } 58.132 catch(Error exc) { } 58.133 - catch(Throwable exc) { } //6: ok; latest: unreachable 58.134 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.135 } 58.136 58.137 void m27() { 58.138 @@ -227,7 +236,7 @@ 58.139 catch(RuntimeException exc) { } 58.140 catch(Error exc) { } 58.141 catch(InterruptedException exc) { } 58.142 - catch(Throwable exc) { } //6: ok; latest: unreachable 58.143 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.144 } 58.145 58.146 void m28() { 58.147 @@ -237,7 +246,7 @@ 58.148 catch(RuntimeException exc) { } 58.149 catch(Error exc) { } 58.150 catch(InterruptedException exc) { } //never thrown in try 58.151 - catch(Throwable exc) { } //6: ok; latest: unreachable 58.152 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.153 } 58.154 58.155 void m29() { 58.156 @@ -247,7 +256,7 @@ 58.157 catch(RuntimeException exc) { } 58.158 catch(Error exc) { } 58.159 catch(InterruptedException exc) { } //never thrown in try 58.160 - catch(Throwable exc) { } //6: ok; latest: unreachable 58.161 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.162 } 58.163 58.164 void m30() { 58.165 @@ -265,7 +274,7 @@ 58.166 } 58.167 catch(RuntimeException exc) { } 58.168 catch(Error exc) { } 58.169 - catch(Throwable exc) { } //6: ok; latest: unreachable 58.170 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.171 } 58.172 58.173 void m32() { 58.174 @@ -274,7 +283,7 @@ 58.175 } 58.176 catch(RuntimeException exc) { } 58.177 catch(Error exc) { } 58.178 - catch(Throwable exc) { } //6: ok; latest: unreachable 58.179 + catch(Throwable exc) { } //6: ok; latest: ok (Exception/Throwable always allowed) 58.180 } 58.181 58.182 void m33() {
59.1 --- a/test/tools/javac/6558548/T6558548_6.out Mon May 02 09:38:22 2011 -0700 59.2 +++ b/test/tools/javac/6558548/T6558548_6.out Tue May 03 22:17:58 2011 -0700 59.3 @@ -1,9 +1,7 @@ 59.4 -- compiler.warn.source.no.bootclasspath: 1.6 59.5 -T6558548.java:159:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.6 T6558548.java:168:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.7 -T6558548.java:239:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.8 -T6558548.java:249:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.9 -T6558548.java:291:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.10 -T6558548.java:298:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.11 +T6558548.java:177:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.12 +T6558548.java:248:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.13 +T6558548.java:258:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.14 +T6558548.java:300:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.15 +T6558548.java:307:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 59.16 6 errors 59.17 -1 warning
60.1 --- a/test/tools/javac/6558548/T6558548_latest.out Mon May 02 09:38:22 2011 -0700 60.2 +++ b/test/tools/javac/6558548/T6558548_latest.out Tue May 03 22:17:58 2011 -0700 60.3 @@ -1,23 +1,9 @@ 60.4 T6558548.java:20:9: compiler.warn.unreachable.catch: java.io.FileNotFoundException 60.5 -T6558548.java:134:9: compiler.warn.unreachable.catch: java.lang.RuntimeException 60.6 -T6558548.java:142:9: compiler.warn.unreachable.catch: java.lang.RuntimeException 60.7 -T6558548.java:151:9: compiler.warn.unreachable.catch.1: java.lang.InterruptedException,java.lang.RuntimeException 60.8 -T6558548.java:159:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.9 -T6558548.java:160:9: compiler.warn.unreachable.catch: java.lang.RuntimeException 60.10 T6558548.java:168:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.11 -T6558548.java:169:9: compiler.warn.unreachable.catch: java.lang.RuntimeException 60.12 -T6558548.java:185:9: compiler.warn.unreachable.catch: java.lang.RuntimeException 60.13 -T6558548.java:193:9: compiler.warn.unreachable.catch: java.lang.RuntimeException 60.14 -T6558548.java:211:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error 60.15 -T6558548.java:220:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error 60.16 -T6558548.java:230:9: compiler.warn.unreachable.catch.1: java.lang.InterruptedException,java.lang.RuntimeException,java.lang.Error 60.17 -T6558548.java:239:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.18 -T6558548.java:240:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error 60.19 -T6558548.java:249:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.20 -T6558548.java:250:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error 60.21 -T6558548.java:268:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error 60.22 -T6558548.java:277:9: compiler.warn.unreachable.catch.1: java.lang.RuntimeException,java.lang.Error 60.23 -T6558548.java:291:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.24 -T6558548.java:298:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.25 +T6558548.java:177:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.26 +T6558548.java:248:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.27 +T6558548.java:258:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.28 +T6558548.java:300:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.29 +T6558548.java:307:9: compiler.err.except.never.thrown.in.try: java.lang.InterruptedException 60.30 6 errors 60.31 -15 warnings 60.32 +1 warning
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 61.2 +++ b/test/tools/javac/T7040104.java Tue May 03 22:17:58 2011 -0700 61.3 @@ -0,0 +1,72 @@ 61.4 +/* 61.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.7 + * 61.8 + * This code is free software; you can redistribute it and/or modify it 61.9 + * under the terms of the GNU General Public License version 2 only, as 61.10 + * published by the Free Software Foundation. 61.11 + * 61.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 61.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 61.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 61.15 + * version 2 for more details (a copy is included in the LICENSE file that 61.16 + * accompanied this code). 61.17 + * 61.18 + * You should have received a copy of the GNU General Public License version 61.19 + * 2 along with this work; if not, write to the Free Software Foundation, 61.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 61.21 + * 61.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 61.23 + * or visit www.oracle.com if you need additional information or have any 61.24 + * questions. 61.25 + */ 61.26 + 61.27 +/* 61.28 + * @test 61.29 + * @bug 7040104 61.30 + * @summary javac NPE on Object a[]; Object o = (a=null)[0]; 61.31 + */ 61.32 + 61.33 +public class T7040104 { 61.34 + public static void main(String[] args) { 61.35 + T7040104 t = new T7040104(); 61.36 + t.test1(); 61.37 + t.test2(); 61.38 + t.test3(); 61.39 + if (t.npeCount != 3) { 61.40 + throw new AssertionError(); 61.41 + } 61.42 + } 61.43 + 61.44 + int npeCount = 0; 61.45 + 61.46 + void test1() { 61.47 + Object a[]; 61.48 + try { 61.49 + Object o = (a = null)[0]; 61.50 + } 61.51 + catch (NullPointerException npe) { 61.52 + npeCount++; 61.53 + } 61.54 + } 61.55 + 61.56 + void test2() { 61.57 + Object a[][]; 61.58 + try { 61.59 + Object o = (a = null)[0][0]; 61.60 + } 61.61 + catch (NullPointerException npe) { 61.62 + npeCount++; 61.63 + } 61.64 + } 61.65 + 61.66 + void test3() { 61.67 + Object a[][][]; 61.68 + try { 61.69 + Object o = (a = null)[0][0][0]; 61.70 + } 61.71 + catch (NullPointerException npe) { 61.72 + npeCount++; 61.73 + } 61.74 + } 61.75 +}
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 62.2 +++ b/test/tools/javac/annotations/6550655/T6550655.java Tue May 03 22:17:58 2011 -0700 62.3 @@ -0,0 +1,191 @@ 62.4 +/* 62.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 62.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 62.7 + * 62.8 + * This code is free software; you can redistribute it and/or modify it 62.9 + * under the terms of the GNU General Public License version 2 only, as 62.10 + * published by the Free Software Foundation. 62.11 + * 62.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 62.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 62.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 62.15 + * version 2 for more details (a copy is included in the LICENSE file that 62.16 + * accompanied this code). 62.17 + * 62.18 + * You should have received a copy of the GNU General Public License version 62.19 + * 2 along with this work; if not, write to the Free Software Foundation, 62.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 62.21 + * 62.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 62.23 + * or visit www.oracle.com if you need additional information or have any 62.24 + * questions. 62.25 + */ 62.26 + 62.27 +/** 62.28 + * @test 62.29 + * @bug 6550655 62.30 + * @summary javac crashes when compiling against an annotated class 62.31 + */ 62.32 + 62.33 +import java.io.File; 62.34 +import java.net.URI; 62.35 +import java.util.Arrays; 62.36 + 62.37 +import javax.tools.Diagnostic; 62.38 +import javax.tools.DiagnosticListener; 62.39 +import javax.tools.JavaCompiler; 62.40 +import javax.tools.JavaCompiler.CompilationTask; 62.41 +import javax.tools.JavaFileObject; 62.42 +import javax.tools.SimpleJavaFileObject; 62.43 +import javax.tools.ToolProvider; 62.44 + 62.45 +public class T6550655 { 62.46 + 62.47 + JavaCompiler javacTool; 62.48 + File testDir; 62.49 + TestKind testKind; 62.50 + EnumActionKind actionKind; 62.51 + 62.52 + String testSource = "enum E { NORTH, SOUTH, WEST, EAST; }\n" + 62.53 + "@I(val = E.NORTH)class A {}\n" + 62.54 + "@interface I { E val(); }"; 62.55 + 62.56 + T6550655(JavaCompiler javacTool, File testDir, TestKind testKind, EnumActionKind actionKind) { 62.57 + this.javacTool = javacTool; 62.58 + this.testDir = testDir; 62.59 + this.testKind = testKind; 62.60 + this.actionKind = actionKind; 62.61 + } 62.62 + 62.63 + void test() { 62.64 + testDir.mkdirs(); 62.65 + compile(null, new JavaSource("Test.java", testSource)); 62.66 + actionKind.doAction(this); 62.67 + compile(new DiagnosticChecker(), testKind.source); 62.68 + } 62.69 + 62.70 + void compile(DiagnosticChecker dc, JavaSource... sources) { 62.71 + try { 62.72 + CompilationTask ct = javacTool.getTask(null, null, dc, 62.73 + Arrays.asList("-d", testDir.getAbsolutePath(), "-cp", testDir.getAbsolutePath()), 62.74 + null, Arrays.asList(sources)); 62.75 + ct.call(); 62.76 + } 62.77 + catch (Exception e) { 62.78 + error("Internal compilation error"); 62.79 + } 62.80 + } 62.81 + 62.82 + void replaceEnum(String newSource) { 62.83 + compile(null, new JavaSource("Replace.java", newSource)); 62.84 + }; 62.85 + 62.86 + void removeEnum() { 62.87 + File enumClass = new File(testDir, "E.class"); 62.88 + if (!enumClass.exists()) { 62.89 + error("Expected file E.class does not exists in folder " + testDir); 62.90 + } 62.91 + enumClass.delete(); 62.92 + }; 62.93 + 62.94 + void error(String msg) { 62.95 + System.err.println(msg); 62.96 + nerrors++; 62.97 + } 62.98 + 62.99 + class DiagnosticChecker implements DiagnosticListener<JavaFileObject> { 62.100 + 62.101 + String[][] expectedKeys = new String[][] { 62.102 + // DIRECT, INDIRECT 62.103 + {/*REPLACE1*/ "compiler.err.cant.resolve.location" , "compiler.warn.unknown.enum.constant" }, 62.104 + {/*REPLACE2*/ "compiler.err.cant.resolve.location.args", "compiler.warn.annotation.method.not.found" }, 62.105 + {/*REMOVE*/ "compiler.err.cant.resolve" , "compiler.warn.unknown.enum.constant.reason" } }; 62.106 + 62.107 + String keyToIgnore = "compiler.err.attribute.value.must.be.constant"; 62.108 + 62.109 + public void report(Diagnostic<? extends JavaFileObject> diagnostic) { 62.110 + String expectedCode = expectedKeys[actionKind.ordinal()][testKind.ordinal()]; 62.111 + if (!diagnostic.getCode().equals(keyToIgnore) && 62.112 + !diagnostic.getCode().equals(expectedCode)) { 62.113 + error("Unexpected diagnostic" + 62.114 + "\nfound " + diagnostic.getCode() + 62.115 + "\nexpected " + expectedCode + 62.116 + "\ntestKind " + testKind + 62.117 + "\nactionKind " + actionKind); 62.118 + } 62.119 + } 62.120 + } 62.121 + 62.122 + //global declarations 62.123 + 62.124 + enum EnumActionKind { 62.125 + REPLACE1("enum E { SOUTH, WEST, EAST; }") { 62.126 + @Override 62.127 + void doAction(T6550655 test) { 62.128 + test.replaceEnum(optionalSource); 62.129 + } 62.130 + }, 62.131 + REPLACE2("@interface I { E valNew() default E.EAST; }") { 62.132 + @Override 62.133 + void doAction(T6550655 test) { 62.134 + test.replaceEnum(optionalSource); 62.135 + } 62.136 + }, 62.137 + REMOVE(null) { 62.138 + @Override 62.139 + void doAction(T6550655 test) { test.removeEnum(); } 62.140 + }; 62.141 + 62.142 + String optionalSource; 62.143 + 62.144 + private EnumActionKind(String optionalSource) { 62.145 + this.optionalSource = optionalSource; 62.146 + } 62.147 + 62.148 + abstract void doAction(T6550655 test); 62.149 + } 62.150 + 62.151 + enum TestKind { 62.152 + DIRECT("@I(val = E.NORTH)class C1 {}"), 62.153 + INDIRECT("class C2 { A a; }"); 62.154 + 62.155 + JavaSource source; 62.156 + 62.157 + private TestKind(final String code) { 62.158 + this.source = new JavaSource("Test.java", code); 62.159 + } 62.160 + } 62.161 + 62.162 + public static void main(String[] args) throws Exception { 62.163 + String SCRATCH_DIR = System.getProperty("user.dir"); 62.164 + JavaCompiler javacTool = ToolProvider.getSystemJavaCompiler(); 62.165 + int n = 0; 62.166 + for (TestKind testKind : TestKind.values()) { 62.167 + for (EnumActionKind actionKind : EnumActionKind.values()) { 62.168 + File testDir = new File(SCRATCH_DIR, "test"+n); 62.169 + new T6550655(javacTool, testDir, testKind, actionKind).test(); 62.170 + n++; 62.171 + } 62.172 + } 62.173 + if (nerrors > 0) { 62.174 + throw new AssertionError("Some errors have been detected"); 62.175 + } 62.176 + } 62.177 + 62.178 + static class JavaSource extends SimpleJavaFileObject { 62.179 + 62.180 + String source; 62.181 + 62.182 + public JavaSource(String filename, String source) { 62.183 + super(URI.create("myfo:/" + filename), JavaFileObject.Kind.SOURCE); 62.184 + this.source = source; 62.185 + } 62.186 + 62.187 + @Override 62.188 + public CharSequence getCharContent(boolean ignoreEncodingErrors) { 62.189 + return source; 62.190 + } 62.191 + } 62.192 + 62.193 + static int nerrors = 0; 62.194 +}
63.1 --- a/test/tools/javac/diags/examples.not-yet.txt Mon May 02 09:38:22 2011 -0700 63.2 +++ b/test/tools/javac/diags/examples.not-yet.txt Tue May 03 22:17:58 2011 -0700 63.3 @@ -41,7 +41,6 @@ 63.4 compiler.err.type.var.more.than.once.in.result # UNUSED 63.5 compiler.err.undetermined.type 63.6 compiler.err.unexpected.type 63.7 -compiler.err.unknown.enum.constant # in bad class file 63.8 compiler.err.unsupported.cross.fp.lit # Scanner: host system dependent 63.9 compiler.err.wrong.target.for.polymorphic.signature.definition # Transitional 292 63.10 compiler.misc.assignment.from.super-bound 63.11 @@ -112,3 +111,5 @@ 63.12 compiler.warn.unchecked.assign # DEAD, replaced by compiler.misc.unchecked.assign 63.13 compiler.warn.unchecked.cast.to.type # DEAD, replaced by compiler.misc.unchecked.cast.to.type 63.14 compiler.warn.unexpected.archive.file # Paths: zip file with unknown extn 63.15 +compiler.warn.unknown.enum.constant # in bad class file 63.16 +compiler.warn.unknown.enum.constant.reason # in bad class file
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 64.2 +++ b/test/tools/javac/diags/examples/DiamondAndExplicitParams.java Tue May 03 22:17:58 2011 -0700 64.3 @@ -0,0 +1,34 @@ 64.4 +/* 64.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 64.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 64.7 + * 64.8 + * This code is free software; you can redistribute it and/or modify it 64.9 + * under the terms of the GNU General Public License version 2 only, as 64.10 + * published by the Free Software Foundation. 64.11 + * 64.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 64.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 64.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 64.15 + * version 2 for more details (a copy is included in the LICENSE file that 64.16 + * accompanied this code). 64.17 + * 64.18 + * You should have received a copy of the GNU General Public License version 64.19 + * 2 along with this work; if not, write to the Free Software Foundation, 64.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 64.21 + * 64.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 64.23 + * or visit www.oracle.com if you need additional information or have any 64.24 + * questions. 64.25 + */ 64.26 + 64.27 +// key: compiler.misc.diamond.and.explicit.params 64.28 +// key: compiler.err.cant.apply.diamond.1 64.29 + 64.30 +class DiamondAndAnonClass { 64.31 + static class Foo<X> { 64.32 + <Z> Foo() {} 64.33 + } 64.34 + void m() { 64.35 + Foo<String> foo = new <Integer> Foo<>(); 64.36 + } 64.37 +}
65.1 --- a/test/tools/javac/diags/examples/UnreachableCatch1.java Mon May 02 09:38:22 2011 -0700 65.2 +++ b/test/tools/javac/diags/examples/UnreachableCatch1.java Tue May 03 22:17:58 2011 -0700 65.3 @@ -23,14 +23,21 @@ 65.4 65.5 // key: compiler.warn.unreachable.catch.1 65.6 65.7 +import java.io.*; 65.8 + 65.9 class UnreachableCatch1 { 65.10 65.11 void test() { 65.12 try { 65.13 - throw new IllegalArgumentException(); 65.14 + if (true) { 65.15 + throw new FileNotFoundException(); 65.16 + } 65.17 + else { 65.18 + throw new EOFException(); 65.19 + } 65.20 } 65.21 - catch(Error err) { } 65.22 - catch(RuntimeException rex) { } 65.23 - catch(Throwable t) { } //unreachable 65.24 + catch(FileNotFoundException fnf) { } 65.25 + catch(EOFException eof) { } 65.26 + catch(IOException ex) { } //unreachable 65.27 } 65.28 }
66.1 --- a/test/tools/javac/generics/7034511/T7034511a.java Mon May 02 09:38:22 2011 -0700 66.2 +++ b/test/tools/javac/generics/7034511/T7034511a.java Tue May 03 22:17:58 2011 -0700 66.3 @@ -1,6 +1,7 @@ 66.4 /* 66.5 * @test /nodynamiccopyright/ 66.6 - * @bug 7034511 66.7 + * @ignore backing out 7034511, see 7040883 66.8 + * @bug 7034511 7040883 66.9 * @summary Loophole in typesafety 66.10 * @compile/fail/ref=T7034511a.out -XDrawDiagnostics T7034511a.java 66.11 */
67.1 --- a/test/tools/javac/generics/7034511/T7034511b.java Mon May 02 09:38:22 2011 -0700 67.2 +++ b/test/tools/javac/generics/7034511/T7034511b.java Tue May 03 22:17:58 2011 -0700 67.3 @@ -1,6 +1,7 @@ 67.4 /* 67.5 * @test /nodynamiccopyright/ 67.6 - * @bug 7034511 67.7 + * @ignore backing out 7034511, see 7040883 67.8 + * @bug 7034511 7040883 67.9 * @summary Loophole in typesafety 67.10 * @compile/fail/ref=T7034511b.out -XDrawDiagnostics T7034511b.java 67.11 */
68.1 --- a/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java Mon May 02 09:38:22 2011 -0700 68.2 +++ b/test/tools/javac/generics/diamond/7030150/GenericConstructorAndDiamondTest.java Tue May 03 22:17:58 2011 -0700 68.3 @@ -23,7 +23,7 @@ 68.4 68.5 /* 68.6 * @test 68.7 - * @bug 7030150 68.8 + * @bug 7030150 7039931 68.9 * @summary Type inference for generic instance creation failed for formal type parameter 68.10 */ 68.11 68.12 @@ -125,6 +125,14 @@ 68.13 default: return false; 68.14 } 68.15 } 68.16 + 68.17 + boolean matches(TypeArgumentKind other) { 68.18 + switch (other) { 68.19 + case STRING: return this != INTEGER; 68.20 + case INTEGER: return this != STRING; 68.21 + default: return true; 68.22 + } 68.23 + } 68.24 } 68.25 68.26 enum ArgumentKind { 68.27 @@ -149,9 +157,11 @@ 68.28 for (TypeArgumentKind declArgKind : TypeArgumentKind.values()) { 68.29 for (TypeArgArity arity : TypeArgArity.values()) { 68.30 for (TypeArgumentKind useArgKind : TypeArgumentKind.values()) { 68.31 - for (ArgumentKind argKind : ArgumentKind.values()) { 68.32 - new GenericConstructorAndDiamondTest(boundKind, constructorKind, 68.33 - declArgKind, arity, useArgKind, argKind).run(comp, fm); 68.34 + for (TypeArgumentKind diamondArgKind : TypeArgumentKind.values()) { 68.35 + for (ArgumentKind argKind : ArgumentKind.values()) { 68.36 + new GenericConstructorAndDiamondTest(boundKind, constructorKind, 68.37 + declArgKind, arity, useArgKind, diamondArgKind, argKind).run(comp, fm); 68.38 + } 68.39 } 68.40 } 68.41 } 68.42 @@ -165,18 +175,21 @@ 68.43 TypeArgumentKind declTypeArgumentKind; 68.44 TypeArgArity useTypeArgArity; 68.45 TypeArgumentKind useTypeArgumentKind; 68.46 + TypeArgumentKind diamondTypeArgumentKind; 68.47 ArgumentKind argumentKind; 68.48 JavaSource source; 68.49 DiagnosticChecker diagChecker; 68.50 68.51 GenericConstructorAndDiamondTest(BoundKind boundKind, ConstructorKind constructorKind, 68.52 TypeArgumentKind declTypeArgumentKind, TypeArgArity useTypeArgArity, 68.53 - TypeArgumentKind useTypeArgumentKind, ArgumentKind argumentKind) { 68.54 + TypeArgumentKind useTypeArgumentKind, TypeArgumentKind diamondTypeArgumentKind, 68.55 + ArgumentKind argumentKind) { 68.56 this.boundKind = boundKind; 68.57 this.constructorKind = constructorKind; 68.58 this.declTypeArgumentKind = declTypeArgumentKind; 68.59 this.useTypeArgArity = useTypeArgArity; 68.60 this.useTypeArgumentKind = useTypeArgumentKind; 68.61 + this.diamondTypeArgumentKind = diamondTypeArgumentKind; 68.62 this.argumentKind = argumentKind; 68.63 this.source = new JavaSource(); 68.64 this.diagChecker = new DiagnosticChecker(); 68.65 @@ -189,7 +202,7 @@ 68.66 "}\n" + 68.67 "class Test {\n" + 68.68 "void test() {\n" + 68.69 - "Foo#TA1 f = new #TA2 Foo<>(#A);\n" + 68.70 + "Foo#TA1 f = new #TA2 Foo<#TA3>(#A);\n" + 68.71 "}\n" + 68.72 "}\n"; 68.73 68.74 @@ -201,6 +214,7 @@ 68.75 replace("#CK", constructorKind.constrStr) 68.76 .replace("#TA1", declTypeArgumentKind.getArgs(TypeArgArity.ONE)) 68.77 .replace("#TA2", useTypeArgumentKind.getArgs(useTypeArgArity)) 68.78 + .replace("#TA3", diamondTypeArgumentKind.typeargStr) 68.79 .replace("#A", argumentKind.argStr); 68.80 } 68.81 68.82 @@ -227,9 +241,15 @@ 68.83 boolean badMethodTypeArg = constructorKind != ConstructorKind.NON_GENERIC && 68.84 !useTypeArgumentKind.matches(argumentKind); 68.85 68.86 - boolean badGenericType = !boundKind.matches(declTypeArgumentKind); 68.87 + boolean badExplicitParams = (useTypeArgumentKind != TypeArgumentKind.NONE && 68.88 + diamondTypeArgumentKind == TypeArgumentKind.NONE) || 68.89 + !boundKind.matches(diamondTypeArgumentKind); 68.90 68.91 - boolean shouldFail = badActual || badArity || badMethodTypeArg || badGenericType; 68.92 + boolean badGenericType = !boundKind.matches(declTypeArgumentKind) || 68.93 + !diamondTypeArgumentKind.matches(declTypeArgumentKind); 68.94 + 68.95 + boolean shouldFail = badActual || badArity || 68.96 + badMethodTypeArg || badExplicitParams || badGenericType; 68.97 68.98 if (shouldFail != diagChecker.errorFound) { 68.99 throw new Error("invalid diagnostics for source:\n" +
69.1 --- a/test/tools/javac/generics/diamond/7030150/Neg01.java Mon May 02 09:38:22 2011 -0700 69.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 69.3 @@ -1,17 +0,0 @@ 69.4 -/* 69.5 - * @test /nodynamiccopyright/ 69.6 - * @bug 7030150 69.7 - * @summary Type inference for generic instance creation failed for formal type parameter 69.8 - * check that explicit type-argument that causes resolution failure is rejected 69.9 - * @compile/fail/ref=Neg01.out -XDrawDiagnostics Neg01.java 69.10 - */ 69.11 - 69.12 -class Neg01 { 69.13 - 69.14 - static class Foo<X> { 69.15 - <T> Foo(T t) {} 69.16 - } 69.17 - 69.18 - Foo<Integer> fi1 = new <String> Foo<>(1); 69.19 - Foo<Integer> fi2 = new <String> Foo<Integer>(1); 69.20 -}
70.1 --- a/test/tools/javac/generics/diamond/7030150/Neg01.out Mon May 02 09:38:22 2011 -0700 70.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 70.3 @@ -1,3 +0,0 @@ 70.4 -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) 70.5 -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) 70.6 -2 errors
71.1 --- a/test/tools/javac/generics/diamond/7030150/Neg02.java Mon May 02 09:38:22 2011 -0700 71.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 71.3 @@ -1,17 +0,0 @@ 71.4 -/* 71.5 - * @test /nodynamiccopyright/ 71.6 - * @bug 7030150 71.7 - * @summary Type inference for generic instance creation failed for formal type parameter 71.8 - * check that compiler rejects bad number of explicit type-arguments 71.9 - * @compile/fail/ref=Neg02.out -XDrawDiagnostics Neg02.java 71.10 - */ 71.11 - 71.12 -class Neg02 { 71.13 - 71.14 - static class Foo<X> { 71.15 - <T> Foo(T t) {} 71.16 - } 71.17 - 71.18 - Foo<Integer> fi1 = new <String, Integer> Foo<>(""); 71.19 - Foo<Integer> fi2 = new <String, Integer> Foo<Integer>(""); 71.20 -}
72.1 --- a/test/tools/javac/generics/diamond/7030150/Neg02.out Mon May 02 09:38:22 2011 -0700 72.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 72.3 @@ -1,3 +0,0 @@ 72.4 -Neg02.java:15:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg02.Foo), (compiler.misc.arg.length.mismatch) 72.5 -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) 72.6 -2 errors
73.1 --- a/test/tools/javac/generics/diamond/7030150/Neg03.java Mon May 02 09:38:22 2011 -0700 73.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 73.3 @@ -1,17 +0,0 @@ 73.4 -/* 73.5 - * @test /nodynamiccopyright/ 73.6 - * @bug 7030150 73.7 - * @summary Type inference for generic instance creation failed for formal type parameter 73.8 - * check that explicit type-argument that does not conform to bound is rejected 73.9 - * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java 73.10 - */ 73.11 - 73.12 -class Neg03 { 73.13 - 73.14 - static class Foo<X> { 73.15 - <T extends Integer> Foo(T t) {} 73.16 - } 73.17 - 73.18 - Foo<Integer> fi1 = new <String> Foo<>(1); 73.19 - Foo<Integer> fi2 = new <String> Foo<Integer>(1); 73.20 -}
74.1 --- a/test/tools/javac/generics/diamond/7030150/Neg03.out Mon May 02 09:38:22 2011 -0700 74.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 74.3 @@ -1,3 +0,0 @@ 74.4 -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) 74.5 -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) 74.6 -2 errors
75.1 --- a/test/tools/javac/generics/diamond/7030150/Pos01.java Mon May 02 09:38:22 2011 -0700 75.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 75.3 @@ -1,44 +0,0 @@ 75.4 -/* 75.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 75.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 75.7 - * 75.8 - * This code is free software; you can redistribute it and/or modify it 75.9 - * under the terms of the GNU General Public License version 2 only, as 75.10 - * published by the Free Software Foundation. 75.11 - * 75.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 75.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 75.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 75.15 - * version 2 for more details (a copy is included in the LICENSE file that 75.16 - * accompanied this code). 75.17 - * 75.18 - * You should have received a copy of the GNU General Public License version 75.19 - * 2 along with this work; if not, write to the Free Software Foundation, 75.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 75.21 - * 75.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 75.23 - * or visit www.oracle.com if you need additional information or have any 75.24 - * questions. 75.25 - */ 75.26 - 75.27 -/* 75.28 - * @test 75.29 - * @bug 7030150 75.30 - * @summary Type inference for generic instance creation failed for formal type parameter 75.31 - * check that redundant type-arguments on non-generic constructor are accepted 75.32 - * @compile Pos01.java 75.33 - */ 75.34 - 75.35 -class Pos01 { 75.36 - 75.37 - static class Foo<X> { 75.38 - Foo(X t) {} 75.39 - } 75.40 - 75.41 - Foo<Integer> fi1 = new Foo<>(1); 75.42 - Foo<Integer> fi2 = new Foo<Integer>(1); 75.43 - Foo<Integer> fi3 = new <String> Foo<>(1); 75.44 - Foo<Integer> fi4 = new <String> Foo<Integer>(1); 75.45 - Foo<Integer> fi5 = new <String, String> Foo<>(1); 75.46 - Foo<Integer> fi6 = new <String, String> Foo<Integer>(1); 75.47 -}
76.1 --- a/test/tools/javac/generics/diamond/7030150/Pos02.java Mon May 02 09:38:22 2011 -0700 76.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 76.3 @@ -1,40 +0,0 @@ 76.4 -/* 76.5 - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 76.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 76.7 - * 76.8 - * This code is free software; you can redistribute it and/or modify it 76.9 - * under the terms of the GNU General Public License version 2 only, as 76.10 - * published by the Free Software Foundation. 76.11 - * 76.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 76.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 76.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 76.15 - * version 2 for more details (a copy is included in the LICENSE file that 76.16 - * accompanied this code). 76.17 - * 76.18 - * You should have received a copy of the GNU General Public License version 76.19 - * 2 along with this work; if not, write to the Free Software Foundation, 76.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 76.21 - * 76.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 76.23 - * or visit www.oracle.com if you need additional information or have any 76.24 - * questions. 76.25 - */ 76.26 - 76.27 -/* 76.28 - * @test 76.29 - * @bug 7030150 76.30 - * @summary Type inference for generic instance creation failed for formal type parameter 76.31 - * check that diamond in return context works w/o problems 76.32 - * @compile Pos02.java 76.33 - */ 76.34 - 76.35 -class Pos02<X> { 76.36 - 76.37 - Pos02(X x) {} 76.38 - 76.39 - 76.40 - Pos02<X> test(X x) { 76.41 - return new Pos02<>(x); 76.42 - } 76.43 -}
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 77.2 +++ b/test/tools/javac/generics/typevars/T7040883.java Tue May 03 22:17:58 2011 -0700 77.3 @@ -0,0 +1,38 @@ 77.4 +/* 77.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 77.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 77.7 + * 77.8 + * This code is free software; you can redistribute it and/or modify it 77.9 + * under the terms of the GNU General Public License version 2 only, as 77.10 + * published by the Free Software Foundation. 77.11 + * 77.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 77.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 77.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 77.15 + * version 2 for more details (a copy is included in the LICENSE file that 77.16 + * accompanied this code). 77.17 + * 77.18 + * You should have received a copy of the GNU General Public License version 77.19 + * 2 along with this work; if not, write to the Free Software Foundation, 77.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 77.21 + * 77.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 77.23 + * or visit www.oracle.com if you need additional information or have any 77.24 + * questions. 77.25 + */ 77.26 + 77.27 +/* 77.28 + * @test 77.29 + * @bug 7040883 7034511 77.30 + * @summary Compilation error: "length in Array is defined in an inaccessible class or interface" 77.31 + * @compile T7040883.java 77.32 + */ 77.33 + 77.34 +public class T7040883 { 77.35 + 77.36 + <Z> Z[] getListeners(Class<Z> z) { return null; } 77.37 + 77.38 + void test(String s) { 77.39 + int i = getListeners(s.getClass()).length; 77.40 + } 77.41 +}
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 78.2 +++ b/test/tools/javac/generics/wildcards/7034495/T7034495.java Tue May 03 22:17:58 2011 -0700 78.3 @@ -0,0 +1,42 @@ 78.4 +/* 78.5 + * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. 78.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 78.7 + * 78.8 + * This code is free software; you can redistribute it and/or modify it 78.9 + * under the terms of the GNU General Public License version 2 only, as 78.10 + * published by the Free Software Foundation. 78.11 + * 78.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 78.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 78.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 78.15 + * version 2 for more details (a copy is included in the LICENSE file that 78.16 + * accompanied this code). 78.17 + * 78.18 + * You should have received a copy of the GNU General Public License version 78.19 + * 2 along with this work; if not, write to the Free Software Foundation, 78.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 78.21 + * 78.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 78.23 + * or visit www.oracle.com if you need additional information or have any 78.24 + * questions. 78.25 + */ 78.26 + 78.27 +/* 78.28 + * @test 78.29 + * @bug 7034495 78.30 + * @summary Javac asserts on usage of wildcards in bounds 78.31 + * @compile/fail/ref=T7034495.out -XDrawDiagnostics T7034495.java 78.32 + */ 78.33 +class T7034495 { 78.34 + 78.35 + interface A<T> { 78.36 + T foo(); 78.37 + } 78.38 + 78.39 + interface B<T> { 78.40 + T foo(); 78.41 + } 78.42 + 78.43 + interface C<T extends A<?> & B<?>> { } 78.44 + 78.45 +}
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 79.2 +++ b/test/tools/javac/generics/wildcards/7034495/T7034495.out Tue May 03 22:17:58 2011 -0700 79.3 @@ -0,0 +1,2 @@ 79.4 +T7034495.java:40:17: compiler.err.types.incompatible.diff.ret: T7034495.B<?>, T7034495.A<?>, foo() 79.5 +1 error
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 80.2 +++ b/test/tools/javac/multicatch/Neg07.java Tue May 03 22:17:58 2011 -0700 80.3 @@ -0,0 +1,50 @@ 80.4 +/* 80.5 + * @test /nodynamiccopyright/ 80.6 + * @bug 7039822 80.7 + * @summary Verify typing of lub of exception parameter w.r.t getClass 80.8 + * @author Joseph D. Darcy 80.9 + * @compile/fail/ref=Neg07.out -XDrawDiagnostics Neg07.java 80.10 + */ 80.11 + 80.12 +public class Neg07 { 80.13 + private static void test(int i) { 80.14 + try { 80.15 + thrower(i); 80.16 + } catch (SonException | DaughterException e) { 80.17 + Class<? extends HasFoo> clazz2 = e.getClass(); // Rejected! 80.18 + HasFoo m = e; 80.19 + e.foo(); 80.20 + } 80.21 + } 80.22 + 80.23 + private static interface HasFoo { 80.24 + void foo(); 80.25 + } 80.26 + 80.27 + static void thrower(int i) throws SonException, DaughterException { 80.28 + if (i == 0) 80.29 + throw new SonException(); 80.30 + else 80.31 + throw new DaughterException(); 80.32 + } 80.33 + 80.34 + private static class ParentException extends RuntimeException {} 80.35 + 80.36 + private static class SonException 80.37 + extends ParentException 80.38 + implements HasFoo { 80.39 + 80.40 + public void foo() { 80.41 + System.out.println("SonException.foo"); 80.42 + } 80.43 + } 80.44 + 80.45 + private static class DaughterException 80.46 + extends ParentException 80.47 + implements HasFoo { 80.48 + 80.49 + public void foo() { 80.50 + System.out.println("DaughterException.foo"); 80.51 + } 80.52 + } 80.53 +}
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 81.2 +++ b/test/tools/javac/multicatch/Neg07.out Tue May 03 22:17:58 2011 -0700 81.3 @@ -0,0 +1,2 @@ 81.4 +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> 81.5 +1 error
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 82.2 +++ b/test/tools/javac/multicatch/Pos10.java Tue May 03 22:17:58 2011 -0700 82.3 @@ -0,0 +1,103 @@ 82.4 +/* 82.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 82.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 82.7 + * 82.8 + * This code is free software; you can redistribute it and/or modify it 82.9 + * under the terms of the GNU General Public License version 2 only, as 82.10 + * published by the Free Software Foundation. 82.11 + * 82.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 82.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 82.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 82.15 + * version 2 for more details (a copy is included in the LICENSE file that 82.16 + * accompanied this code). 82.17 + * 82.18 + * You should have received a copy of the GNU General Public License version 82.19 + * 2 along with this work; if not, write to the Free Software Foundation, 82.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 82.21 + * 82.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 82.23 + * or visit www.oracle.com if you need additional information or have any 82.24 + * questions. 82.25 + */ 82.26 + 82.27 +/* 82.28 + * @test 82.29 + * @bug 7039822 82.30 + * @summary Verify lub of an exception parameter can be an intersection type 82.31 + * @author Joseph D. Darcy 82.32 + */ 82.33 + 82.34 +public class Pos10 { 82.35 + public static void main(String... args) { 82.36 + test(0); 82.37 + test(1); 82.38 + 82.39 + if (record != 0b11) 82.40 + throw new RuntimeException("Unexpected exception execution: " + 82.41 + record); 82.42 + if (closeRecord != 0b11) 82.43 + throw new RuntimeException("Unexpected close execution: " + 82.44 + closeRecord); 82.45 + } 82.46 + 82.47 + private static int record = 0; 82.48 + private static int closeRecord = 0; 82.49 + 82.50 + private static void test(int i) { 82.51 + try { 82.52 + thrower(i); 82.53 + } catch (SonException | DaughterException e) { 82.54 + Class<? extends ParentException> clazz = e.getClass(); 82.55 + HasFoo m = e; 82.56 + e.foo(); 82.57 + 82.58 + try (AutoCloseable ac = e) { 82.59 + e.toString(); 82.60 + } catch(Exception except) { 82.61 + throw new RuntimeException(except); 82.62 + } 82.63 + } 82.64 + } 82.65 + 82.66 + private static interface HasFoo { 82.67 + void foo(); 82.68 + } 82.69 + 82.70 + private static void thrower(int i) throws SonException, DaughterException { 82.71 + if (i == 0) 82.72 + throw new SonException(); 82.73 + else 82.74 + throw new DaughterException(); 82.75 + } 82.76 + 82.77 + private static class ParentException extends RuntimeException {} 82.78 + 82.79 + private static class SonException 82.80 + extends ParentException 82.81 + implements HasFoo, AutoCloseable { 82.82 + 82.83 + public void foo() { 82.84 + record |= 0b01; 82.85 + } 82.86 + 82.87 + @Override 82.88 + public void close() { 82.89 + closeRecord |= 0b01; 82.90 + } 82.91 + } 82.92 + 82.93 + private static class DaughterException 82.94 + extends ParentException 82.95 + implements HasFoo, AutoCloseable { 82.96 + 82.97 + public void foo() { 82.98 + record |= 0b10; 82.99 + } 82.100 + 82.101 + @Override 82.102 + public void close() { 82.103 + closeRecord |= 0b10; 82.104 + } 82.105 + } 82.106 +}
83.1 --- a/test/tools/javac/multicatch/model/Model01.java Mon May 02 09:38:22 2011 -0700 83.2 +++ b/test/tools/javac/multicatch/model/Model01.java Tue May 03 22:17:58 2011 -0700 83.3 @@ -1,5 +1,5 @@ 83.4 /* 83.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 83.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 83.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 83.8 * 83.9 * This code is free software; you can redistribute it and/or modify it 83.10 @@ -43,6 +43,6 @@ 83.11 else 83.12 throw new B2(); 83.13 } 83.14 - catch(B1 | B2 ex) { } 83.15 + catch(@UnionTypeInfo({"Test.B1", "Test.B2"}) B1 | B2 ex) { } 83.16 } 83.17 }
84.1 --- a/test/tools/javac/multicatch/model/ModelChecker.java Mon May 02 09:38:22 2011 -0700 84.2 +++ b/test/tools/javac/multicatch/model/ModelChecker.java Tue May 03 22:17:58 2011 -0700 84.3 @@ -1,5 +1,5 @@ 84.4 /* 84.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 84.6 + * Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved. 84.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 84.8 * 84.9 * This code is free software; you can redistribute it and/or modify it 84.10 @@ -30,7 +30,7 @@ 84.11 * @compile -processor ModelChecker Model01.java 84.12 */ 84.13 84.14 -import com.sun.source.tree.VariableTree; 84.15 +import com.sun.source.tree.CatchTree; 84.16 import com.sun.source.util.TreePathScanner; 84.17 import com.sun.source.util.Trees; 84.18 import com.sun.source.util.TreePath; 84.19 @@ -41,6 +41,12 @@ 84.20 import javax.lang.model.element.Element; 84.21 import javax.lang.model.element.ElementKind; 84.22 import javax.lang.model.element.TypeElement; 84.23 +import javax.lang.model.type.TypeMirror; 84.24 +import javax.lang.model.type.TypeKind; 84.25 +import javax.lang.model.type.UnionType; 84.26 +import javax.lang.model.type.UnknownTypeException; 84.27 +import javax.lang.model.util.SimpleTypeVisitor6; 84.28 +import javax.lang.model.util.SimpleTypeVisitor7; 84.29 84.30 @SupportedAnnotationTypes("Check") 84.31 public class ModelChecker extends JavacTestingAbstractProcessor { 84.32 @@ -69,22 +75,61 @@ 84.33 } 84.34 84.35 @Override 84.36 - public Void visitVariable(VariableTree node, Void p) { 84.37 - Element ex = trees.getElement(getCurrentPath()); 84.38 + public Void visitCatch(CatchTree node, Void p) { 84.39 + TreePath param = new TreePath(getCurrentPath(), node.getParameter()); 84.40 + Element ex = trees.getElement(param); 84.41 + validateUnionTypeInfo(ex); 84.42 if (ex.getSimpleName().contentEquals("ex")) { 84.43 assertTrue(ex.getKind() == ElementKind.EXCEPTION_PARAMETER, "Expected EXCEPTION_PARAMETER - found " + ex.getKind()); 84.44 - for (Element e : types.asElement(ex.asType()).getEnclosedElements()) { 84.45 + for (Element e : types.asElement(trees.getLub(node)).getEnclosedElements()) { 84.46 Member m = e.getAnnotation(Member.class); 84.47 if (m != null) { 84.48 assertTrue(e.getKind() == m.value(), "Expected " + m.value() + " - found " + e.getKind()); 84.49 } 84.50 } 84.51 - assertTrue(assertionCount == 3, "Expected 3 assertions - found " + assertionCount); 84.52 + assertTrue(assertionCount == 9, "Expected 9 assertions - found " + assertionCount); 84.53 } 84.54 - return super.visitVariable(node, p); 84.55 + return super.visitCatch(node, p); 84.56 } 84.57 } 84.58 84.59 + private void validateUnionTypeInfo(Element ex) { 84.60 + UnionTypeInfo ut = ex.getAnnotation(UnionTypeInfo.class); 84.61 + assertTrue(ut != null, "UnionType annotation must be present"); 84.62 + 84.63 + TypeMirror expectedUnionType = ex.asType(); 84.64 + assertTrue(expectedUnionType.getKind() == TypeKind.UNION, "UNION kind expected"); 84.65 + 84.66 + try { 84.67 + new SimpleTypeVisitor6<Void, Void>(){}.visit(expectedUnionType); 84.68 + throw new RuntimeException("Expected UnknownTypeException not thrown."); 84.69 + } catch (UnknownTypeException ute) { 84.70 + ; // Expected 84.71 + } 84.72 + 84.73 + UnionType unionType = new SimpleTypeVisitor7<UnionType, Void>(){ 84.74 + @Override 84.75 + protected UnionType defaultAction(TypeMirror e, Void p) {return null;} 84.76 + 84.77 + @Override 84.78 + public UnionType visitUnion(UnionType t, Void p) {return t;} 84.79 + }.visit(expectedUnionType); 84.80 + assertTrue(unionType != null, "Must get a non-null union type."); 84.81 + 84.82 + assertTrue(ut.value().length == unionType.getAlternatives().size(), "Cardinalities do not match"); 84.83 + 84.84 + String[] typeNames = ut.value(); 84.85 + for(int i = 0; i < typeNames.length; i++) { 84.86 + TypeMirror typeFromAnnotation = nameToType(typeNames[i]); 84.87 + assertTrue(types.isSameType(typeFromAnnotation, unionType.getAlternatives().get(i)), 84.88 + "Types were not equal."); 84.89 + } 84.90 + } 84.91 + 84.92 + private TypeMirror nameToType(String name) { 84.93 + return elements.getTypeElement(name).asType(); 84.94 + } 84.95 + 84.96 private static void assertTrue(boolean cond, String msg) { 84.97 assertionCount++; 84.98 if (!cond)
85.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 85.2 +++ b/test/tools/javac/multicatch/model/UnionTypeInfo.java Tue May 03 22:17:58 2011 -0700 85.3 @@ -0,0 +1,29 @@ 85.4 +/* 85.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 85.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 85.7 + * 85.8 + * This code is free software; you can redistribute it and/or modify it 85.9 + * under the terms of the GNU General Public License version 2 only, as 85.10 + * published by the Free Software Foundation. 85.11 + * 85.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 85.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 85.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 85.15 + * version 2 for more details (a copy is included in the LICENSE file that 85.16 + * accompanied this code). 85.17 + * 85.18 + * You should have received a copy of the GNU General Public License version 85.19 + * 2 along with this work; if not, write to the Free Software Foundation, 85.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 85.21 + * 85.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 85.23 + * or visit www.oracle.com if you need additional information or have any 85.24 + * questions. 85.25 + */ 85.26 + 85.27 +/** 85.28 + * Used by ModelChecker to validate the modeling information of a union type. 85.29 + */ 85.30 +@interface UnionTypeInfo { 85.31 + String[] value(); 85.32 +}
86.1 --- a/test/tools/javac/processing/model/TestSymtabItems.java Mon May 02 09:38:22 2011 -0700 86.2 +++ b/test/tools/javac/processing/model/TestSymtabItems.java Tue May 03 22:17:58 2011 -0700 86.3 @@ -44,6 +44,7 @@ 86.4 import com.sun.tools.javac.code.Symbol.ClassSymbol; 86.5 import com.sun.tools.javac.code.Symtab; 86.6 import com.sun.tools.javac.file.JavacFileManager; 86.7 +import com.sun.tools.javac.main.JavaCompiler; 86.8 import com.sun.tools.javac.model.JavacTypes; 86.9 import com.sun.tools.javac.util.Context; 86.10 86.11 @@ -62,6 +63,7 @@ 86.12 JavacFileManager.preRegister(c); 86.13 Symtab syms = Symtab.instance(c); 86.14 JavacTypes types = JavacTypes.instance(c); 86.15 + JavaCompiler.instance(c); // will init ClassReader.sourceCompleter 86.16 86.17 // print("noSymbol", syms.noSymbol); 86.18 // print("errSymbol", syms.errSymbol);
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/test/tools/javac/processing/model/type/TestUnionType.java Tue May 03 22:17:58 2011 -0700 87.3 @@ -0,0 +1,208 @@ 87.4 +/* 87.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 87.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 87.7 + * 87.8 + * This code is free software; you can redistribute it and/or modify it 87.9 + * under the terms of the GNU General Public License version 2 only, as 87.10 + * published by the Free Software Foundation. 87.11 + * 87.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 87.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 87.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 87.15 + * version 2 for more details (a copy is included in the LICENSE file that 87.16 + * accompanied this code). 87.17 + * 87.18 + * You should have received a copy of the GNU General Public License version 87.19 + * 2 along with this work; if not, write to the Free Software Foundation, 87.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 87.21 + * 87.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 87.23 + * or visit www.oracle.com if you need additional information or have any 87.24 + * questions. 87.25 + */ 87.26 + 87.27 +/* 87.28 + * @test 87.29 + * @bug 7029150 87.30 + * @summary Test support for union types 87.31 + * @library ../../../lib 87.32 + */ 87.33 + 87.34 +import java.net.URI; 87.35 +import java.util.*; 87.36 +import javax.annotation.processing.*; 87.37 +import javax.lang.model.element.*; 87.38 +import javax.lang.model.type.*; 87.39 +import javax.lang.model.util.*; 87.40 +import javax.tools.*; 87.41 + 87.42 +import com.sun.source.tree.*; 87.43 +import com.sun.source.util.*; 87.44 + 87.45 + 87.46 +public class TestUnionType extends JavacTestingAbstractProcessor { 87.47 + enum TestKind { 87.48 + SingleType("E1", "E1", 87.49 + "VariableTree: E1 e", 87.50 + "VariableTree: elem EXCEPTION_PARAMETER e", 87.51 + "VariableTree: elem.type DECLARED", 87.52 + "VariableTree: elem.type.elem CLASS E1", 87.53 + "VariableTree: type DECLARED", 87.54 + "VariableTree: type.elem CLASS E1", 87.55 + "VariableTree: type.elem.type DECLARED"), 87.56 + 87.57 + ValidTypes("E1, E2", "E1 | E2", 87.58 + "VariableTree: E1 | E2 e", 87.59 + "VariableTree: elem EXCEPTION_PARAMETER e", 87.60 + "VariableTree: elem.type UNION Test.E1,Test.E2", 87.61 + "VariableTree: elem.type.elem null", 87.62 + "VariableTree: type UNION Test.E1,Test.E2", 87.63 + "VariableTree: type.elem null"), 87.64 + 87.65 + InvalidTypes("E1, E2", "E1 | EMissing", 87.66 + "VariableTree: E1 | EMissing e", 87.67 + "VariableTree: elem EXCEPTION_PARAMETER e", 87.68 + "VariableTree: elem.type UNION Test.E1,EMissing", 87.69 + "VariableTree: elem.type.elem null", 87.70 + "VariableTree: type UNION Test.E1,EMissing", 87.71 + "VariableTree: type.elem null"), 87.72 + 87.73 + Uncaught("E1", "E1 | E2", 87.74 + "VariableTree: E1 | E2 e", 87.75 + "VariableTree: elem EXCEPTION_PARAMETER e", 87.76 + "VariableTree: elem.type UNION Test.E1,Test.E2", 87.77 + "VariableTree: elem.type.elem null", 87.78 + "VariableTree: type UNION Test.E1,Test.E2", 87.79 + "VariableTree: type.elem null"); 87.80 + 87.81 + TestKind(String throwsTypes, String catchTypes, String... gold) { 87.82 + this.throwsTypes = throwsTypes; 87.83 + this.catchTypes = catchTypes; 87.84 + this.gold = Arrays.asList(gold); 87.85 + } 87.86 + 87.87 + final String throwsTypes; 87.88 + final String catchTypes; 87.89 + final List<String> gold; 87.90 + } 87.91 + 87.92 + static class TestFileObject extends SimpleJavaFileObject { 87.93 + public static final String template = 87.94 + "class Test {\n" 87.95 + + " class E1 extends Exception { }\n" 87.96 + + " class E2 extends Exception { }\n" 87.97 + + " void doSomething() throws #T { }\n" 87.98 + + " void test() {\n" 87.99 + + " try {\n" 87.100 + + " doSomething();\n" 87.101 + + " } catch (#C e) {\n" 87.102 + + " }\n" 87.103 + + " }\n" 87.104 + + "}\n"; 87.105 + 87.106 + public TestFileObject(TestKind tk) { 87.107 + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); 87.108 + this.tk = tk; 87.109 + } 87.110 + 87.111 + @Override 87.112 + public CharSequence getCharContent(boolean ignoreEncodingErrors) { 87.113 + return template 87.114 + .replace("#T", tk.throwsTypes) 87.115 + .replace("#C", tk.catchTypes); 87.116 + } 87.117 + final TestKind tk; 87.118 + } 87.119 + 87.120 + public static void main(String... args) throws Exception { 87.121 + JavaCompiler comp = ToolProvider.getSystemJavaCompiler(); 87.122 + List<String> options = Arrays.asList("-proc:only"); 87.123 + for (TestKind tk: TestKind.values()) { 87.124 + System.err.println("Test: " + tk); 87.125 + TestUnionType p = new TestUnionType(); 87.126 + JavaFileObject fo = new TestFileObject(tk); 87.127 + JavaCompiler.CompilationTask task = comp.getTask(null, null, null, options, null, Arrays.asList(fo)); 87.128 + task.setProcessors(Arrays.asList(p)); 87.129 + boolean ok = task.call(); 87.130 + System.err.println("compilation " + (ok ? "passed" : "failed")); 87.131 + if (!ok) 87.132 + throw new Exception("compilation failed unexpectedly"); 87.133 + if (!p.log.equals(tk.gold)) { 87.134 + System.err.println("Expected output:"); 87.135 + for (String g: tk.gold) 87.136 + System.err.println(g); 87.137 + throw new Exception("unexpected output from test"); 87.138 + } 87.139 + System.err.println(); 87.140 + } 87.141 + } 87.142 + 87.143 + Trees trees; 87.144 + List<String> log; 87.145 + 87.146 + @Override 87.147 + public void init(ProcessingEnvironment env) { 87.148 + super.init(env); 87.149 + trees = Trees.instance(env); 87.150 + log = new ArrayList<String>(); 87.151 + } 87.152 + 87.153 + @Override 87.154 + public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { 87.155 + if (!roundEnv.processingOver()) { 87.156 + for (Element e: roundEnv.getRootElements()) { 87.157 + scan(trees.getPath(e)); 87.158 + } 87.159 + } 87.160 + return true; 87.161 + } 87.162 + 87.163 + void scan(TreePath path) { 87.164 + new Scanner().scan(path, null); 87.165 + } 87.166 + 87.167 + class Scanner extends TreePathScanner<Void,Void> { 87.168 + @Override 87.169 + public Void visitVariable(VariableTree tree, Void ignore) { 87.170 + TreePath p = getCurrentPath(); 87.171 + Element e = trees.getElement(p); 87.172 + if (e.getKind() == ElementKind.EXCEPTION_PARAMETER) { 87.173 + log("VariableTree: " + tree); 87.174 + log("VariableTree: elem " + print(e)); 87.175 + log("VariableTree: elem.type " + print(e.asType())); 87.176 + log("VariableTree: elem.type.elem " + print(types.asElement(e.asType()))); 87.177 + TypeMirror tm = trees.getTypeMirror(p); 87.178 + log("VariableTree: type " + print(tm)); 87.179 + log("VariableTree: type.elem " + print(types.asElement(tm))); 87.180 + if (types.asElement(tm) != null) 87.181 + log("VariableTree: type.elem.type " + print(types.asElement(tm).asType())); 87.182 + } 87.183 + return super.visitVariable(tree, null); 87.184 + } 87.185 + 87.186 + String print(TypeMirror tm) { 87.187 + return (tm == null) ? null : new TypePrinter().visit(tm); 87.188 + } 87.189 + 87.190 + String print(Element e) { 87.191 + return (e == null) ? null : (e.getKind() + " " + e.getSimpleName()); 87.192 + } 87.193 + 87.194 + void log(String msg) { 87.195 + System.err.println(msg); 87.196 + log.add(msg); 87.197 + } 87.198 + } 87.199 + 87.200 + class TypePrinter extends SimpleTypeVisitor7<String, Void> { 87.201 + @Override 87.202 + protected String defaultAction(TypeMirror tm, Void ignore) { 87.203 + return String.valueOf(tm.getKind()); 87.204 + } 87.205 + 87.206 + @Override 87.207 + public String visitUnion(UnionType t, Void ignore) { 87.208 + return (t.getKind() + " " + t.getAlternatives()); 87.209 + } 87.210 + } 87.211 +}
88.1 --- a/test/tools/javac/scope/7017664/CompoundScopeTest.java Mon May 02 09:38:22 2011 -0700 88.2 +++ b/test/tools/javac/scope/7017664/CompoundScopeTest.java Tue May 03 22:17:58 2011 -0700 88.3 @@ -23,7 +23,7 @@ 88.4 88.5 /* 88.6 * @test 88.7 - * @bug 7017664 88.8 + * @bug 7017664 7036906 88.9 * @summary Basher for CompoundScopes 88.10 */ 88.11 88.12 @@ -127,8 +127,17 @@ 88.13 } 88.14 } 88.15 log("testing scope: " + root); 88.16 - checkElems(root); 88.17 - checkShadowed(root); 88.18 + checkElems(root, null); 88.19 + checkElems(root, new OddFilter()); 88.20 + checkShadowed(root, null); 88.21 + checkShadowed(root, new OddFilter()); 88.22 + } 88.23 + } 88.24 + 88.25 + class OddFilter implements Filter<Symbol> { 88.26 + public boolean accepts(Symbol s) { 88.27 + Name numPart = s.name.subName(1, s.name.length()); 88.28 + return Integer.parseInt(numPart.toString()) % 2 != 0; 88.29 } 88.30 } 88.31 88.32 @@ -165,15 +174,20 @@ 88.33 * Check that CompoundScope.getElements() correctly visits all symbols 88.34 * in all subscopes (in the correct order) 88.35 */ 88.36 - void checkElems(CompoundScope cs) { 88.37 - List<Symbol> allSymbols = elems; 88.38 + void checkElems(CompoundScope cs, Filter<Symbol> sf) { 88.39 int count = 0; 88.40 - for (Symbol s : cs.getElements()) { 88.41 + ListBuffer<Symbol> found = ListBuffer.lb(); 88.42 + List<Symbol> allSymbols = sf == null ? 88.43 + elems : 88.44 + filter(elems, sf); 88.45 + int expectedCount = allSymbols.length(); 88.46 + for (Symbol s : sf == null ? cs.getElements() : cs.getElements(sf)) { 88.47 checkSameSymbols(s, allSymbols.head); 88.48 allSymbols = allSymbols.tail; 88.49 + found.append(s); 88.50 count++; 88.51 } 88.52 - if (count != elems.size()) { 88.53 + if (count != expectedCount) { 88.54 error("CompoundScope.getElements() did not returned enough symbols"); 88.55 } 88.56 } 88.57 @@ -182,22 +196,35 @@ 88.58 * Check that CompoundScope.getElements() correctly visits all symbols 88.59 * with a given name in all subscopes (in the correct order) 88.60 */ 88.61 - void checkShadowed(CompoundScope cs) { 88.62 + void checkShadowed(CompoundScope cs, Filter<Symbol> sf) { 88.63 for (Map.Entry<Name, List<Symbol>> shadowedEntry : shadowedMap.entrySet()) { 88.64 int count = 0; 88.65 - List<Symbol> shadowed = shadowedEntry.getValue(); 88.66 + List<Symbol> shadowed = sf == null ? 88.67 + shadowedEntry.getValue() : 88.68 + filter(shadowedEntry.getValue(), sf); 88.69 + int expectedCount = shadowed.length(); 88.70 Name name = shadowedEntry.getKey(); 88.71 - for (Symbol s : cs.getElementsByName(name)) { 88.72 + for (Symbol s : sf == null ? cs.getElementsByName(name) : cs.getElementsByName(name, sf)) { 88.73 checkSameSymbols(s, shadowed.head); 88.74 shadowed = shadowed.tail; 88.75 count++; 88.76 } 88.77 - if (count != shadowedEntry.getValue().size()) { 88.78 + if (count != expectedCount) { 88.79 error("CompoundScope.lookup() did not returned enough symbols for name " + name); 88.80 } 88.81 } 88.82 } 88.83 88.84 + List<Symbol> filter(List<Symbol> elems, Filter<Symbol> sf) { 88.85 + ListBuffer<Symbol> res = ListBuffer.lb(); 88.86 + for (Symbol s : elems) { 88.87 + if (sf.accepts(s)) { 88.88 + res.append(s); 88.89 + } 88.90 + } 88.91 + return res.toList(); 88.92 + } 88.93 + 88.94 void checkSameSymbols(Symbol found, Symbol req) { 88.95 if (found != req) { 88.96 error("Symbol mismatch - found : " + found + ":" + found.hashCode() + "\n" +
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 89.2 +++ b/test/tools/javac/types/CastObjectToPrimitiveTest.java Tue May 03 22:17:58 2011 -0700 89.3 @@ -0,0 +1,38 @@ 89.4 +/* 89.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 89.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 89.7 + * 89.8 + * This code is free software; you can redistribute it and/or modify it 89.9 + * under the terms of the GNU General Public License version 2 only, as 89.10 + * published by the Free Software Foundation. 89.11 + * 89.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 89.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 89.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 89.15 + * version 2 for more details (a copy is included in the LICENSE file that 89.16 + * accompanied this code). 89.17 + * 89.18 + * You should have received a copy of the GNU General Public License version 89.19 + * 2 along with this work; if not, write to the Free Software Foundation, 89.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 89.21 + * 89.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 89.23 + * or visit www.oracle.com if you need additional information or have any 89.24 + * questions. 89.25 + */ 89.26 + 89.27 +/* 89.28 + * @test 89.29 + * @bug 7038363 89.30 + * @summary cast from object to primitive should be for source >= 1.7 89.31 + * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 5 CastObjectToPrimitiveTest.java 89.32 + * @compile/fail/ref=CastObjectToPrimitiveTest.out -XDrawDiagnostics -Xlint:-options -source 6 CastObjectToPrimitiveTest.java 89.33 + * @compile CastObjectToPrimitiveTest.java 89.34 + */ 89.35 + 89.36 +class CastObjectToPrimitiveTest { 89.37 + void m() { 89.38 + Object o = 42; 89.39 + int i = (int) o; 89.40 + } 89.41 +}
90.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 90.2 +++ b/test/tools/javac/types/CastObjectToPrimitiveTest.out Tue May 03 22:17:58 2011 -0700 90.3 @@ -0,0 +1,2 @@ 90.4 +CastObjectToPrimitiveTest.java:36:23: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), java.lang.Object, int 90.5 +1 error