Mon, 10 Jun 2013 17:04:18 -0700
Merge
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Thu Jun 06 09:55:26 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Mon Jun 10 17:04:18 2013 -0700 1.3 @@ -324,8 +324,19 @@ 1.4 option.startsWith("-xdoclint:")) { 1.5 return 1; 1.6 } else if (option.equals("-help")) { 1.7 + // Uugh: first, this should not be hidden inside optionLength, 1.8 + // and second, we should not be writing directly to stdout. 1.9 + // But we have no access to a DocErrorReporter, which would 1.10 + // allow use of reporter.printNotice 1.11 System.out.println(getText("doclet.usage")); 1.12 return 1; 1.13 + } else if (option.equals("-x")) { 1.14 + // Uugh: first, this should not be hidden inside optionLength, 1.15 + // and second, we should not be writing directly to stdout. 1.16 + // But we have no access to a DocErrorReporter, which would 1.17 + // allow use of reporter.printNotice 1.18 + System.out.println(getText("doclet.X.usage")); 1.19 + return 1; 1.20 } else if (option.equals("-footer") || 1.21 option.equals("-header") || 1.22 option.equals("-packagesheader") ||
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Thu Jun 06 09:55:26 2013 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Mon Jun 10 17:04:18 2013 -0700 2.3 @@ -186,45 +186,50 @@ 2.4 doclet.Same_package_name_used=Package name format used twice: {0} 2.5 doclet.exception_encountered=Exception encountered while processing {1}\n{0} 2.6 doclet.usage=Provided by Standard doclet:\n\ 2.7 - -d <directory> Destination directory for output files\n\ 2.8 - -use Create class and package usage pages\n\ 2.9 - -version Include @version paragraphs\n\ 2.10 - -author Include @author paragraphs\n\ 2.11 - -docfilessubdirs Recursively copy doc-file subdirectories\n\ 2.12 - -splitindex Split index into one file per letter\n\ 2.13 - -windowtitle <text> Browser window title for the documenation\n\ 2.14 - -doctitle <html-code> Include title for the overview page\n\ 2.15 - -header <html-code> Include header text for each page\n\ 2.16 - -footer <html-code> Include footer text for each page\n\ 2.17 - -top <html-code> Include top text for each page\n\ 2.18 - -bottom <html-code> Include bottom text for each page\n\ 2.19 - -link <url> Create links to javadoc output at <url>\n\ 2.20 - -linkoffline <url> <url2> Link to docs at <url> using package list at <url2>\n\ 2.21 - -excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.\n\ 2.22 - -group <name> <p1>:<p2>.. Group specified packages together in overview page\n\ 2.23 - -nocomment Supress description and tags, generate only declarations.\n\ 2.24 - -nodeprecated Do not include @deprecated information\n\ 2.25 - -noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.\n\ 2.26 - -nosince Do not include @since information\n\ 2.27 - -notimestamp Do not include hidden time stamp\n\ 2.28 - -nodeprecatedlist Do not generate deprecated list\n\ 2.29 - -notree Do not generate class hierarchy\n\ 2.30 - -noindex Do not generate index\n\ 2.31 - -nohelp Do not generate help link\n\ 2.32 - -nonavbar Do not generate navigation bar\n\ 2.33 - -serialwarn Generate warning about @serial tag\n\ 2.34 - -tag <name>:<locations>:<header> Specify single argument custom tags\n\ 2.35 - -taglet The fully qualified name of Taglet to register\n\ 2.36 - -tagletpath The path to Taglets\n\ 2.37 - -Xdocrootparent <url> Replaces all appearances of @docRoot followed by /.. in doc comments with <url>\n\ 2.38 - -charset <charset> Charset for cross-platform viewing of generated documentation.\n\ 2.39 - -helpfile <file> Include file that help link links to\n\ 2.40 - -linksource Generate source in HTML\n\ 2.41 - -sourcetab <tab length> Specify the number of spaces each tab takes up in the source\n\ 2.42 - -keywords Include HTML meta tags with package, class and member info\n\ 2.43 - -stylesheetfile <path> File to change style of the generated documentation\n\ 2.44 - -docencoding <name> Output encoding name 2.45 +\ -d <directory> Destination directory for output files\n\ 2.46 +\ -use Create class and package usage pages\n\ 2.47 +\ -version Include @version paragraphs\n\ 2.48 +\ -author Include @author paragraphs\n\ 2.49 +\ -docfilessubdirs Recursively copy doc-file subdirectories\n\ 2.50 +\ -splitindex Split index into one file per letter\n\ 2.51 +\ -windowtitle <text> Browser window title for the documentation\n\ 2.52 +\ -doctitle <html-code> Include title for the overview page\n\ 2.53 +\ -header <html-code> Include header text for each page\n\ 2.54 +\ -footer <html-code> Include footer text for each page\n\ 2.55 +\ -top <html-code> Include top text for each page\n\ 2.56 +\ -bottom <html-code> Include bottom text for each page\n\ 2.57 +\ -link <url> Create links to javadoc output at <url>\n\ 2.58 +\ -linkoffline <url> <url2> Link to docs at <url> using package list at <url2>\n\ 2.59 +\ -excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.\n\ 2.60 +\ -group <name> <p1>:<p2>.. Group specified packages together in overview page\n\ 2.61 +\ -nocomment Suppress description and tags, generate only declarations.\n\ 2.62 +\ -nodeprecated Do not include @deprecated information\n\ 2.63 +\ -noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.\n\ 2.64 +\ -nosince Do not include @since information\n\ 2.65 +\ -notimestamp Do not include hidden time stamp\n\ 2.66 +\ -nodeprecatedlist Do not generate deprecated list\n\ 2.67 +\ -notree Do not generate class hierarchy\n\ 2.68 +\ -noindex Do not generate index\n\ 2.69 +\ -nohelp Do not generate help link\n\ 2.70 +\ -nonavbar Do not generate navigation bar\n\ 2.71 +\ -serialwarn Generate warning about @serial tag\n\ 2.72 +\ -tag <name>:<locations>:<header> Specify single argument custom tags\n\ 2.73 +\ -taglet The fully qualified name of Taglet to register\n\ 2.74 +\ -tagletpath The path to Taglets\n\ 2.75 +\ -charset <charset> Charset for cross-platform viewing of generated documentation.\n\ 2.76 +\ -helpfile <file> Include file that help link links to\n\ 2.77 +\ -linksource Generate source in HTML\n\ 2.78 +\ -sourcetab <tab length> Specify the number of spaces each tab takes up in the source\n\ 2.79 +\ -keywords Include HTML meta tags with package, class and member info\n\ 2.80 +\ -stylesheetfile <path> File to change style of the generated documentation\n\ 2.81 +\ -docencoding <name> Specify the character encoding for the output 2.82 2.83 2.84 - 2.85 - 2.86 +# L10N: do not localize these words: all none accessibility html missing reference syntax 2.87 +doclet.X.usage=Provided by standard doclet:\n\ 2.88 +\ -Xdocrootparent <url> Replaces all appearances of @docRoot followed\n\ 2.89 +\ by /.. in doc comments with <url>\n\ 2.90 +\ -Xdoclint Enable recommended checks for problems in javadoc comments\n\ 2.91 +\ -Xdoclint:(all|none|[-]<group>) \n\ 2.92 +\ Enable or disable specific checks for problems in javadoc comments,\n\ 2.93 +\ where <group> is one of accessibility, html, missing, reference, or syntax.\n
3.1 --- a/src/share/classes/com/sun/tools/doclint/Checker.java Thu Jun 06 09:55:26 2013 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclint/Checker.java Mon Jun 10 17:04:18 2013 -0700 3.3 @@ -531,6 +531,17 @@ 3.4 } 3.5 } 3.6 break; 3.7 + 3.8 + case VALUE: 3.9 + if (currTag == HtmlTag.LI) { 3.10 + String v = getAttrValue(tree); 3.11 + if (v == null || v.isEmpty()) { 3.12 + env.messages.error(HTML, tree, "dc.attr.lacks.value"); 3.13 + } else if (!validNumber.matcher(v).matches()) { 3.14 + env.messages.error(HTML, tree, "dc.attr.not.number"); 3.15 + } 3.16 + } 3.17 + break; 3.18 } 3.19 } 3.20 } 3.21 @@ -543,6 +554,8 @@ 3.22 // http://www.w3.org/TR/html401/types.html#type-name 3.23 private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*"); 3.24 3.25 + private static final Pattern validNumber = Pattern.compile("-?[0-9]+"); 3.26 + 3.27 // pattern to remove leading {@docRoot}/? 3.28 private static final Pattern docRoot = Pattern.compile("(?i)(\\{@docRoot *\\}/?)?(.*)"); 3.29
4.1 --- a/src/share/classes/com/sun/tools/doclint/DocLint.java Thu Jun 06 09:55:26 2013 -0700 4.2 +++ b/src/share/classes/com/sun/tools/doclint/DocLint.java Mon Jun 10 17:04:18 2013 -0700 4.3 @@ -77,13 +77,14 @@ 4.4 4.5 // <editor-fold defaultstate="collapsed" desc="Command-line entry point"> 4.6 public static void main(String... args) { 4.7 + DocLint dl = new DocLint(); 4.8 try { 4.9 - new DocLint().run(args); 4.10 + dl.run(args); 4.11 } catch (BadArgs e) { 4.12 System.err.println(e.getMessage()); 4.13 System.exit(1); 4.14 } catch (IOException e) { 4.15 - System.err.println(e); 4.16 + System.err.println(dl.localize("dc.main.ioerror", e.getLocalizedMessage())); 4.17 System.exit(2); 4.18 } 4.19 } 4.20 @@ -92,9 +93,10 @@ 4.21 4.22 // <editor-fold defaultstate="collapsed" desc="Simple API"> 4.23 4.24 - public static class BadArgs extends Exception { 4.25 + public class BadArgs extends Exception { 4.26 private static final long serialVersionUID = 0; 4.27 BadArgs(String code, Object... args) { 4.28 + super(localize(code, args)); 4.29 this.code = code; 4.30 this.args = args; 4.31 } 4.32 @@ -124,7 +126,7 @@ 4.33 4.34 if (javacFiles.isEmpty()) { 4.35 if (!needHelp) 4.36 - out.println("no files given"); 4.37 + out.println(localize("dc.main.no.files.given")); 4.38 } 4.39 4.40 JavacTool tool = JavacTool.create(); 4.41 @@ -204,49 +206,9 @@ 4.42 } 4.43 4.44 void showHelp(PrintWriter out) { 4.45 - out.println("Usage:"); 4.46 - out.println(" doclint [options] source-files..."); 4.47 - out.println(""); 4.48 - out.println("Options:"); 4.49 - out.println(" -Xmsgs "); 4.50 - out.println(" Same as -Xmsgs:all"); 4.51 - out.println(" -Xmsgs:values"); 4.52 - out.println(" Specify categories of issues to be checked, where 'values'"); 4.53 - out.println(" is a comma-separated list of any of the following:"); 4.54 - out.println(" reference show places where comments contain incorrect"); 4.55 - out.println(" references to Java source code elements"); 4.56 - out.println(" syntax show basic syntax errors within comments"); 4.57 - out.println(" html show issues with HTML tags and attributes"); 4.58 - out.println(" accessibility show issues for accessibility"); 4.59 - out.println(" missing show issues with missing documentation"); 4.60 - out.println(" all all of the above"); 4.61 - out.println(" Precede a value with '-' to negate it"); 4.62 - out.println(" Categories may be qualified by one of:"); 4.63 - out.println(" /public /protected /package /private"); 4.64 - out.println(" For positive categories (not beginning with '-')"); 4.65 - out.println(" the qualifier applies to that access level and above."); 4.66 - out.println(" For negative categories (beginning with '-')"); 4.67 - out.println(" the qualifier applies to that access level and below."); 4.68 - out.println(" If a qualifier is missing, the category applies to"); 4.69 - out.println(" all access levels."); 4.70 - out.println(" For example, -Xmsgs:all,-syntax/private"); 4.71 - out.println(" This will enable all messages, except syntax errors"); 4.72 - out.println(" in the doc comments of private methods."); 4.73 - out.println(" If no -Xmsgs options are provided, the default is"); 4.74 - out.println(" equivalent to -Xmsgs:all/protected, meaning that"); 4.75 - out.println(" all messages are reported for protected and public"); 4.76 - out.println(" declarations only. "); 4.77 - out.println(" -stats"); 4.78 - out.println(" Report statistics on the reported issues."); 4.79 - out.println(" -h -help --help -usage -?"); 4.80 - out.println(" Show this message."); 4.81 - out.println(""); 4.82 - out.println("The following javac options are also supported"); 4.83 - out.println(" -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns"); 4.84 - out.println(""); 4.85 - out.println("To run doclint on part of a project, put the compiled classes for your"); 4.86 - out.println("project on the classpath (or bootclasspath), then specify the source files"); 4.87 - out.println("to be checked on the command line."); 4.88 + String msg = localize("dc.main.usage"); 4.89 + for (String line: msg.split("\n")) 4.90 + out.println(line); 4.91 } 4.92 4.93 List<File> splitPath(String path) { 4.94 @@ -353,6 +315,11 @@ 4.95 return false; 4.96 } 4.97 4.98 + private String localize(String code, Object... args) { 4.99 + Messages m = (env != null) ? env.messages : new Messages(null); 4.100 + return m.localize(code, args); 4.101 + } 4.102 + 4.103 // <editor-fold defaultstate="collapsed" desc="DeclScanner"> 4.104 4.105 static abstract class DeclScanner extends TreePathScanner<Void, Void> {
5.1 --- a/src/share/classes/com/sun/tools/doclint/HtmlTag.java Thu Jun 06 09:55:26 2013 -0700 5.2 +++ b/src/share/classes/com/sun/tools/doclint/HtmlTag.java Mon Jun 10 17:04:18 2013 -0700 5.3 @@ -131,7 +131,8 @@ 5.4 attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)), 5.5 5.6 LI(BlockType.LIST_ITEM, EndKind.OPTIONAL, 5.7 - EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), 5.8 + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE), 5.9 + attrs(AttrKind.OK, VALUE)), 5.10 5.11 LINK(BlockType.OTHER, EndKind.NONE), 5.12 5.13 @@ -339,6 +340,7 @@ 5.14 TARGET, 5.15 TYPE, 5.16 VALIGN, 5.17 + VALUE, 5.18 VSPACE, 5.19 WIDTH; 5.20
6.1 --- a/src/share/classes/com/sun/tools/doclint/resources/doclint.properties Thu Jun 06 09:55:26 2013 -0700 6.2 +++ b/src/share/classes/com/sun/tools/doclint/resources/doclint.properties Mon Jun 10 17:04:18 2013 -0700 6.3 @@ -26,6 +26,7 @@ 6.4 dc.anchor.already.defined = anchor already defined: {0} 6.5 dc.anchor.value.missing = no value given for anchor 6.6 dc.attr.lacks.value = attribute lacks value 6.7 +dc.attr.not.number = attribute value is not a number 6.8 dc.attr.obsolete = attribute obsolete: {0} 6.9 dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0} 6.10 dc.attr.repeated = repeated attribute: {0} 6.11 @@ -66,3 +67,50 @@ 6.12 dc.tag.start.unmatched = end tag missing: </{0}> 6.13 dc.tag.unknown = unknown tag: {0} 6.14 dc.text.not.allowed = text not allowed in <{0}> element 6.15 + 6.16 +dc.main.ioerror=IO error: {0} 6.17 +dc.main.no.files.given=No files given 6.18 +dc.main.usage=\ 6.19 +Usage:\n\ 6.20 +\ doclint [options] source-files...\n\ 6.21 +\n\ 6.22 +Options:\n\ 6.23 +\ -Xmsgs \n\ 6.24 +\ Same as -Xmsgs:all\n\ 6.25 +\ -Xmsgs:values\n\ 6.26 +\ Specify categories of issues to be checked, where ''values''\n\ 6.27 +\ is a comma-separated list of any of the following:\n\ 6.28 +\ reference show places where comments contain incorrect\n\ 6.29 +\ references to Java source code elements\n\ 6.30 +\ syntax show basic syntax errors within comments\n\ 6.31 +\ html show issues with HTML tags and attributes\n\ 6.32 +\ accessibility show issues for accessibility\n\ 6.33 +\ missing show issues with missing documentation\n\ 6.34 +\ all all of the above\n\ 6.35 +\ Precede a value with ''-'' to negate it\n\ 6.36 +\ Categories may be qualified by one of:\n\ 6.37 +\ /public /protected /package /private\n\ 6.38 +\ For positive categories (not beginning with ''-'')\n\ 6.39 +\ the qualifier applies to that access level and above.\n\ 6.40 +\ For negative categories (beginning with ''-'')\n\ 6.41 +\ the qualifier applies to that access level and below.\n\ 6.42 +\ If a qualifier is missing, the category applies to\n\ 6.43 +\ all access levels.\n\ 6.44 +\ For example, -Xmsgs:all,-syntax/private\n\ 6.45 +\ This will enable all messages, except syntax errors\n\ 6.46 +\ in the doc comments of private methods.\n\ 6.47 +\ If no -Xmsgs options are provided, the default is\n\ 6.48 +\ equivalent to -Xmsgs:all/protected, meaning that\n\ 6.49 +\ all messages are reported for protected and public\n\ 6.50 +\ declarations only. \n\ 6.51 +\ -stats\n\ 6.52 +\ Report statistics on the reported issues.\n\ 6.53 +\ -h -help --help -usage -?\n\ 6.54 +\ Show this message.\n\ 6.55 +\n\ 6.56 +The following javac options are also supported\n\ 6.57 +\ -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns\n\ 6.58 +\n\ 6.59 +To run doclint on part of a project, put the compiled classes for your\n\ 6.60 +project on the classpath (or bootclasspath), then specify the source files\n\ 6.61 +to be checked on the command line.
7.1 --- a/src/share/classes/com/sun/tools/javac/code/Lint.java Thu Jun 06 09:55:26 2013 -0700 7.2 +++ b/src/share/classes/com/sun/tools/javac/code/Lint.java Mon Jun 10 17:04:18 2013 -0700 7.3 @@ -68,19 +68,11 @@ 7.4 7.5 /** 7.6 * Returns the result of combining the values in this object with 7.7 - * the given annotations. 7.8 + * the metadata on the given symbol. 7.9 */ 7.10 - public Lint augment(Annotations annots) { 7.11 - return augmentor.augment(this, annots.getDeclarationAttributes()); 7.12 - } 7.13 - 7.14 - /** 7.15 - * Returns the result of combining the values in this object with 7.16 - * the given annotations and flags. 7.17 - */ 7.18 - public Lint augment(Annotations annots, long flags) { 7.19 - Lint l = augmentor.augment(this, annots.getDeclarationAttributes()); 7.20 - if ((flags & DEPRECATED) != 0) { 7.21 + public Lint augment(Symbol sym) { 7.22 + Lint l = augmentor.augment(this, sym.getDeclarationAttributes()); 7.23 + if (sym.isDeprecated()) { 7.24 if (l == this) 7.25 l = new Lint(this); 7.26 l.values.remove(LintCategory.DEPRECATION);
8.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Jun 06 09:55:26 2013 -0700 8.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java Mon Jun 10 17:04:18 2013 -0700 8.3 @@ -32,6 +32,7 @@ 8.4 import javax.tools.JavaFileObject; 8.5 8.6 import com.sun.tools.javac.code.Type.*; 8.7 +import com.sun.tools.javac.comp.Annotate; 8.8 import com.sun.tools.javac.comp.Attr; 8.9 import com.sun.tools.javac.comp.AttrContext; 8.10 import com.sun.tools.javac.comp.Env; 8.11 @@ -74,35 +75,6 @@ 8.12 */ 8.13 public long flags() { return flags_field; } 8.14 8.15 - /** The attributes of this symbol are contained in this 8.16 - * Annotations. The Annotations instance is NOT immutable. 8.17 - */ 8.18 - public final Annotations annotations = new Annotations(this); 8.19 - 8.20 - /** An accessor method for the attributes of this symbol. 8.21 - * Attributes of class symbols should be accessed through the accessor 8.22 - * method to make sure that the class symbol is loaded. 8.23 - */ 8.24 - public List<Attribute.Compound> getRawAttributes() { 8.25 - return annotations.getDeclarationAttributes(); 8.26 - } 8.27 - 8.28 - /** An accessor method for the type attributes of this symbol. 8.29 - * Attributes of class symbols should be accessed through the accessor 8.30 - * method to make sure that the class symbol is loaded. 8.31 - */ 8.32 - public List<Attribute.TypeCompound> getRawTypeAttributes() { 8.33 - return annotations.getTypeAttributes(); 8.34 - } 8.35 - 8.36 - /** Fetch a particular annotation from a symbol. */ 8.37 - public Attribute.Compound attribute(Symbol anno) { 8.38 - for (Attribute.Compound a : getRawAttributes()) { 8.39 - if (a.type.tsym == anno) return a; 8.40 - } 8.41 - return null; 8.42 - } 8.43 - 8.44 /** The name of this symbol in Utf8 representation. 8.45 */ 8.46 public Name name; 8.47 @@ -123,6 +95,146 @@ 8.48 */ 8.49 public Type erasure_field; 8.50 8.51 + // <editor-fold defaultstate="collapsed" desc="annotations"> 8.52 + 8.53 + /** The attributes of this symbol are contained in this 8.54 + * Annotations. The Annotations instance is NOT immutable. 8.55 + */ 8.56 + protected Annotations annotations; 8.57 + 8.58 + /** An accessor method for the attributes of this symbol. 8.59 + * Attributes of class symbols should be accessed through the accessor 8.60 + * method to make sure that the class symbol is loaded. 8.61 + */ 8.62 + public List<Attribute.Compound> getRawAttributes() { 8.63 + return (annotations == null) 8.64 + ? List.<Attribute.Compound>nil() 8.65 + : annotations.getDeclarationAttributes(); 8.66 + } 8.67 + 8.68 + /** An accessor method for the type attributes of this symbol. 8.69 + * Attributes of class symbols should be accessed through the accessor 8.70 + * method to make sure that the class symbol is loaded. 8.71 + */ 8.72 + public List<Attribute.TypeCompound> getRawTypeAttributes() { 8.73 + return (annotations == null) 8.74 + ? List.<Attribute.TypeCompound>nil() 8.75 + : annotations.getTypeAttributes(); 8.76 + } 8.77 + 8.78 + /** Fetch a particular annotation from a symbol. */ 8.79 + public Attribute.Compound attribute(Symbol anno) { 8.80 + for (Attribute.Compound a : getRawAttributes()) { 8.81 + if (a.type.tsym == anno) return a; 8.82 + } 8.83 + return null; 8.84 + } 8.85 + 8.86 + public boolean annotationsPendingCompletion() { 8.87 + return annotations == null ? false : annotations.pendingCompletion(); 8.88 + } 8.89 + 8.90 + public void appendAttributes(List<Attribute.Compound> l) { 8.91 + if (l.nonEmpty()) { 8.92 + initedAnnos().append(l); 8.93 + } 8.94 + } 8.95 + 8.96 + public void appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) { 8.97 + if (l.nonEmpty()) { 8.98 + initedAnnos().appendClassInitTypeAttributes(l); 8.99 + } 8.100 + } 8.101 + 8.102 + public void appendInitTypeAttributes(List<Attribute.TypeCompound> l) { 8.103 + if (l.nonEmpty()) { 8.104 + initedAnnos().appendInitTypeAttributes(l); 8.105 + } 8.106 + } 8.107 + 8.108 + public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx) { 8.109 + initedAnnos().appendTypeAttributesWithCompletion(ctx); 8.110 + } 8.111 + 8.112 + public void appendUniqueTypeAttributes(List<Attribute.TypeCompound> l) { 8.113 + if (l.nonEmpty()) { 8.114 + initedAnnos().appendUniqueTypes(l); 8.115 + } 8.116 + } 8.117 + 8.118 + public List<Attribute.TypeCompound> getClassInitTypeAttributes() { 8.119 + return (annotations == null) 8.120 + ? List.<Attribute.TypeCompound>nil() 8.121 + : annotations.getClassInitTypeAttributes(); 8.122 + } 8.123 + 8.124 + public List<Attribute.TypeCompound> getInitTypeAttributes() { 8.125 + return (annotations == null) 8.126 + ? List.<Attribute.TypeCompound>nil() 8.127 + : annotations.getInitTypeAttributes(); 8.128 + } 8.129 + 8.130 + public List<Attribute.Compound> getDeclarationAttributes() { 8.131 + return (annotations == null) 8.132 + ? List.<Attribute.Compound>nil() 8.133 + : annotations.getDeclarationAttributes(); 8.134 + } 8.135 + 8.136 + public boolean hasAnnotations() { 8.137 + return (annotations != null && !annotations.isEmpty()); 8.138 + } 8.139 + 8.140 + public boolean hasTypeAnnotations() { 8.141 + return (annotations != null && !annotations.isTypesEmpty()); 8.142 + } 8.143 + 8.144 + public void prependAttributes(List<Attribute.Compound> l) { 8.145 + if (l.nonEmpty()) { 8.146 + initedAnnos().prepend(l); 8.147 + } 8.148 + } 8.149 + 8.150 + public void resetAnnotations() { 8.151 + initedAnnos().reset(); 8.152 + } 8.153 + 8.154 + public void setAttributes(Symbol other) { 8.155 + if (annotations != null || other.annotations != null) { 8.156 + initedAnnos().setAttributes(other.annotations); 8.157 + } 8.158 + } 8.159 + 8.160 + public void setDeclarationAttributes(List<Attribute.Compound> a) { 8.161 + if (annotations != null || a.nonEmpty()) { 8.162 + initedAnnos().setDeclarationAttributes(a); 8.163 + } 8.164 + } 8.165 + 8.166 + public void setDeclarationAttributesWithCompletion(final Annotate.AnnotateRepeatedContext<Attribute.Compound> ctx) { 8.167 + initedAnnos().setDeclarationAttributesWithCompletion(ctx); 8.168 + } 8.169 + 8.170 + public void setTypeAttributes(List<Attribute.TypeCompound> a) { 8.171 + if (annotations != null || a.nonEmpty()) { 8.172 + if (annotations == null) 8.173 + annotations = new Annotations(this); 8.174 + annotations.setTypeAttributes(a); 8.175 + } 8.176 + } 8.177 + 8.178 + private Annotations initedAnnos() { 8.179 + if (annotations == null) 8.180 + annotations = new Annotations(this); 8.181 + return annotations; 8.182 + } 8.183 + 8.184 + /** This method is intended for debugging only. */ 8.185 + public Annotations getAnnotations() { 8.186 + return annotations; 8.187 + } 8.188 + 8.189 + // </editor-fold> 8.190 + 8.191 /** Construct a symbol with given kind, flags, name, type and owner. 8.192 */ 8.193 public Symbol(int kind, long flags, Name name, Type type, Symbol owner) { 8.194 @@ -207,6 +319,10 @@ 8.195 } 8.196 } 8.197 8.198 + public boolean isDeprecated() { 8.199 + return (flags_field & DEPRECATED) != 0; 8.200 + } 8.201 + 8.202 public boolean isStatic() { 8.203 return 8.204 (flags() & STATIC) != 0 || 8.205 @@ -726,8 +842,9 @@ 8.206 } 8.207 8.208 private void mergeAttributes() { 8.209 - if (annotations.isEmpty() && 8.210 - !package_info.annotations.isEmpty()) { 8.211 + if (annotations == null && 8.212 + package_info.annotations != null) { 8.213 + annotations = new Annotations(this); 8.214 annotations.setAttributes(package_info.annotations); 8.215 } 8.216 }
9.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Jun 06 09:55:26 2013 -0700 9.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Mon Jun 10 17:04:18 2013 -0700 9.3 @@ -271,8 +271,8 @@ 9.4 } 9.5 } 9.6 9.7 - sym.annotations.reset(); 9.8 - sym.annotations.setDeclarationAttributes(declAnnos.toList()); 9.9 + sym.resetAnnotations(); 9.10 + sym.setDeclarationAttributes(declAnnos.toList()); 9.11 9.12 if (typeAnnos.isEmpty()) { 9.13 return; 9.14 @@ -284,7 +284,7 @@ 9.15 // When type is null, put the type annotations to the symbol. 9.16 // This is used for constructor return annotations, for which 9.17 // no appropriate type exists. 9.18 - sym.annotations.appendUniqueTypes(typeAnnotations); 9.19 + sym.appendUniqueTypeAttributes(typeAnnotations); 9.20 return; 9.21 } 9.22 9.23 @@ -318,7 +318,7 @@ 9.24 sym.type = type; 9.25 } 9.26 9.27 - sym.annotations.appendUniqueTypes(typeAnnotations); 9.28 + sym.appendUniqueTypeAttributes(typeAnnotations); 9.29 9.30 if (sym.getKind() == ElementKind.PARAMETER || 9.31 sym.getKind() == ElementKind.LOCAL_VARIABLE || 9.32 @@ -326,7 +326,7 @@ 9.33 sym.getKind() == ElementKind.EXCEPTION_PARAMETER) { 9.34 // Make sure all type annotations from the symbol are also 9.35 // on the owner. 9.36 - sym.owner.annotations.appendUniqueTypes(sym.getRawTypeAttributes()); 9.37 + sym.owner.appendUniqueTypeAttributes(sym.getRawTypeAttributes()); 9.38 } 9.39 } 9.40 9.41 @@ -855,7 +855,7 @@ 9.42 Assert.error("Found unexpected type annotation for variable: " + v + " with kind: " + v.getKind()); 9.43 } 9.44 if (v.getKind() != ElementKind.FIELD) { 9.45 - v.owner.annotations.appendUniqueTypes(v.getRawTypeAttributes()); 9.46 + v.owner.appendUniqueTypeAttributes(v.getRawTypeAttributes()); 9.47 } 9.48 return; 9.49
10.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Jun 06 09:55:26 2013 -0700 10.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Jun 10 17:04:18 2013 -0700 10.3 @@ -757,11 +757,10 @@ 10.4 // env.info.enclVar.attributes_field might not yet have been evaluated, and so might be 10.5 // null. In that case, calling augment will throw an NPE. To avoid this, for now we 10.6 // revert to the jdk 6 behavior and ignore the (unevaluated) attributes. 10.7 - if (env.info.enclVar.annotations.pendingCompletion()) { 10.8 + if (env.info.enclVar.annotationsPendingCompletion()) { 10.9 env.info.lint = lintEnv.info.lint; 10.10 } else { 10.11 - env.info.lint = lintEnv.info.lint.augment(env.info.enclVar.annotations, 10.12 - env.info.enclVar.flags()); 10.13 + env.info.lint = lintEnv.info.lint.augment(env.info.enclVar); 10.14 } 10.15 10.16 Lint prevLint = chk.setLint(env.info.lint); 10.17 @@ -881,7 +880,7 @@ 10.18 MethodSymbol m = tree.sym; 10.19 boolean isDefaultMethod = (m.flags() & DEFAULT) != 0; 10.20 10.21 - Lint lint = env.info.lint.augment(m.annotations, m.flags()); 10.22 + Lint lint = env.info.lint.augment(m); 10.23 Lint prevLint = chk.setLint(lint); 10.24 MethodSymbol prevMethod = chk.setMethod(m); 10.25 try { 10.26 @@ -1052,7 +1051,7 @@ 10.27 } 10.28 10.29 VarSymbol v = tree.sym; 10.30 - Lint lint = env.info.lint.augment(v.annotations, v.flags()); 10.31 + Lint lint = env.info.lint.augment(v); 10.32 Lint prevLint = chk.setLint(lint); 10.33 10.34 // Check that the variable's declared type is well-formed. 10.35 @@ -1121,9 +1120,9 @@ 10.36 ClassSymbol cs = (ClassSymbol)env.info.scope.owner; 10.37 List<Attribute.TypeCompound> tas = localEnv.info.scope.owner.getRawTypeAttributes(); 10.38 if ((tree.flags & STATIC) != 0) { 10.39 - cs.annotations.appendClassInitTypeAttributes(tas); 10.40 + cs.appendClassInitTypeAttributes(tas); 10.41 } else { 10.42 - cs.annotations.appendInitTypeAttributes(tas); 10.43 + cs.appendInitTypeAttributes(tas); 10.44 } 10.45 } 10.46 10.47 @@ -4118,7 +4117,7 @@ 10.48 lintEnv = lintEnv.next; 10.49 10.50 // Having found the enclosing lint value, we can initialize the lint value for this class 10.51 - env.info.lint = lintEnv.info.lint.augment(c.annotations, c.flags()); 10.52 + env.info.lint = lintEnv.info.lint.augment(c); 10.53 10.54 Lint prevLint = chk.setLint(env.info.lint); 10.55 JavaFileObject prev = log.useSource(c.sourcefile);
11.1 --- a/src/share/classes/com/sun/tools/javac/comp/Enter.java Thu Jun 06 09:55:26 2013 -0700 11.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Enter.java Mon Jun 10 17:04:18 2013 -0700 11.3 @@ -161,7 +161,7 @@ 11.4 Env<AttrContext> lintEnv = localEnv; 11.5 while (lintEnv.info.lint == null) 11.6 lintEnv = lintEnv.next; 11.7 - localEnv.info.lint = lintEnv.info.lint.augment(sym.annotations, sym.flags()); 11.8 + localEnv.info.lint = lintEnv.info.lint.augment(sym); 11.9 return localEnv; 11.10 } 11.11
12.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Thu Jun 06 09:55:26 2013 -0700 12.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Mon Jun 10 17:04:18 2013 -0700 12.3 @@ -434,7 +434,7 @@ 12.4 Lint lintPrev = lint; 12.5 12.6 pendingExits = new ListBuffer<PendingExit>(); 12.7 - lint = lint.augment(tree.sym.annotations); 12.8 + lint = lint.augment(tree.sym); 12.9 12.10 try { 12.11 // process all the static initializers 12.12 @@ -470,7 +470,7 @@ 12.13 if (tree.body == null) return; 12.14 Lint lintPrev = lint; 12.15 12.16 - lint = lint.augment(tree.sym.annotations); 12.17 + lint = lint.augment(tree.sym); 12.18 12.19 Assert.check(pendingExits.isEmpty()); 12.20 12.21 @@ -496,7 +496,7 @@ 12.22 public void visitVarDef(JCVariableDecl tree) { 12.23 if (tree.init != null) { 12.24 Lint lintPrev = lint; 12.25 - lint = lint.augment(tree.sym.annotations); 12.26 + lint = lint.augment(tree.sym); 12.27 try{ 12.28 scan(tree.init); 12.29 } finally { 12.30 @@ -808,9 +808,10 @@ 12.31 */ 12.32 void markThrown(JCTree tree, Type exc) { 12.33 if (!chk.isUnchecked(tree.pos(), exc)) { 12.34 - if (!chk.isHandled(exc, caught)) 12.35 + if (!chk.isHandled(exc, caught)) { 12.36 pendingExits.append(new FlowPendingExit(tree, exc)); 12.37 - thrown = chk.incl(exc, thrown); 12.38 + } 12.39 + thrown = chk.incl(exc, thrown); 12.40 } 12.41 } 12.42 12.43 @@ -835,7 +836,7 @@ 12.44 } 12.45 classDef = tree; 12.46 thrown = List.nil(); 12.47 - lint = lint.augment(tree.sym.annotations); 12.48 + lint = lint.augment(tree.sym); 12.49 12.50 try { 12.51 // process all the static initializers 12.52 @@ -915,7 +916,7 @@ 12.53 List<Type> mthrown = tree.sym.type.getThrownTypes(); 12.54 Lint lintPrev = lint; 12.55 12.56 - lint = lint.augment(tree.sym.annotations); 12.57 + lint = lint.augment(tree.sym); 12.58 12.59 Assert.check(pendingExits.isEmpty()); 12.60 12.61 @@ -954,7 +955,7 @@ 12.62 public void visitVarDef(JCVariableDecl tree) { 12.63 if (tree.init != null) { 12.64 Lint lintPrev = lint; 12.65 - lint = lint.augment(tree.sym.annotations); 12.66 + lint = lint.augment(tree.sym); 12.67 try{ 12.68 scan(tree.init); 12.69 } finally { 12.70 @@ -1066,8 +1067,9 @@ 12.71 names.close, 12.72 List.<Type>nil(), 12.73 List.<Type>nil()); 12.74 + Type mt = types.memberType(resource.type, closeMethod); 12.75 if (closeMethod.kind == MTH) { 12.76 - for (Type t : ((MethodSymbol)closeMethod).getThrownTypes()) { 12.77 + for (Type t : mt.getThrownTypes()) { 12.78 markThrown(resource, t); 12.79 } 12.80 } 12.81 @@ -1578,7 +1580,7 @@ 12.82 firstadr = nextadr; 12.83 } 12.84 classDef = tree; 12.85 - lint = lint.augment(tree.sym.annotations); 12.86 + lint = lint.augment(tree.sym); 12.87 12.88 try { 12.89 // define all the static fields 12.90 @@ -1646,7 +1648,7 @@ 12.91 int returnadrPrev = returnadr; 12.92 Lint lintPrev = lint; 12.93 12.94 - lint = lint.augment(tree.sym.annotations); 12.95 + lint = lint.augment(tree.sym); 12.96 12.97 Assert.check(pendingExits.isEmpty()); 12.98 12.99 @@ -1698,7 +1700,7 @@ 12.100 if (track && tree.sym.owner.kind == MTH) newVar(tree.sym); 12.101 if (tree.init != null) { 12.102 Lint lintPrev = lint; 12.103 - lint = lint.augment(tree.sym.annotations); 12.104 + lint = lint.augment(tree.sym); 12.105 try{ 12.106 scanExpr(tree.init); 12.107 if (track) letInit(tree.pos(), tree.sym);
13.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Thu Jun 06 09:55:26 2013 -0700 13.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Mon Jun 10 17:04:18 2013 -0700 13.3 @@ -218,8 +218,8 @@ 13.4 //we need to skip capture? 13.5 Warner retWarn = new Warner(); 13.6 if (!resultInfo.checkContext.compatible(qtype1, resultInfo.checkContext.inferenceContext().asFree(to), retWarn) || 13.7 - //unchecked conversion is not allowed 13.8 - retWarn.hasLint(Lint.LintCategory.UNCHECKED)) { 13.9 + //unchecked conversion is not allowed in source 7 mode 13.10 + (!allowGraphInference && retWarn.hasLint(Lint.LintCategory.UNCHECKED))) { 13.11 throw inferenceException 13.12 .setMessage("infer.no.conforming.instance.exists", 13.13 inferenceContext.restvars(), mt.getReturnType(), to);
14.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Jun 06 09:55:26 2013 -0700 14.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Mon Jun 10 17:04:18 2013 -0700 14.3 @@ -249,8 +249,8 @@ 14.4 } 14.5 } 14.6 if (lambdaTypeAnnos.nonEmpty()) { 14.7 - owner.annotations.setTypeAttributes(ownerTypeAnnos.toList()); 14.8 - sym.annotations.setTypeAttributes(lambdaTypeAnnos.toList()); 14.9 + owner.setTypeAttributes(ownerTypeAnnos.toList()); 14.10 + sym.setTypeAttributes(lambdaTypeAnnos.toList()); 14.11 } 14.12 } 14.13 14.14 @@ -389,15 +389,15 @@ 14.15 if (lambdaContext.getSymbolMap(PARAM).containsKey(tree.sym)) { 14.16 Symbol translatedSym = lambdaContext.getSymbolMap(PARAM).get(tree.sym); 14.17 result = make.Ident(translatedSym).setType(tree.type); 14.18 - translatedSym.annotations.setTypeAttributes(tree.sym.getRawTypeAttributes()); 14.19 + translatedSym.setTypeAttributes(tree.sym.getRawTypeAttributes()); 14.20 } else if (lambdaContext.getSymbolMap(LOCAL_VAR).containsKey(tree.sym)) { 14.21 Symbol translatedSym = lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym); 14.22 result = make.Ident(translatedSym).setType(tree.type); 14.23 - translatedSym.annotations.setTypeAttributes(tree.sym.getRawTypeAttributes()); 14.24 + translatedSym.setTypeAttributes(tree.sym.getRawTypeAttributes()); 14.25 } else if (lambdaContext.getSymbolMap(TYPE_VAR).containsKey(tree.sym)) { 14.26 Symbol translatedSym = lambdaContext.getSymbolMap(TYPE_VAR).get(tree.sym); 14.27 result = make.Ident(translatedSym).setType(translatedSym.type); 14.28 - translatedSym.annotations.setTypeAttributes(tree.sym.getRawTypeAttributes()); 14.29 + translatedSym.setTypeAttributes(tree.sym.getRawTypeAttributes()); 14.30 } else if (lambdaContext.getSymbolMap(CAPTURED_VAR).containsKey(tree.sym)) { 14.31 Symbol translatedSym = lambdaContext.getSymbolMap(CAPTURED_VAR).get(tree.sym); 14.32 result = make.Ident(translatedSym).setType(tree.type); 14.33 @@ -1715,8 +1715,8 @@ 14.34 ret = makeSyntheticVar(FINAL, name, types.erasure(sym.type), translatedSym); 14.35 } 14.36 if (ret != sym) { 14.37 - ret.annotations.setDeclarationAttributes(sym.getRawAttributes()); 14.38 - ret.annotations.setTypeAttributes(sym.getRawTypeAttributes()); 14.39 + ret.setDeclarationAttributes(sym.getRawAttributes()); 14.40 + ret.setTypeAttributes(sym.getRawTypeAttributes()); 14.41 } 14.42 return ret; 14.43 }
15.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu Jun 06 09:55:26 2013 -0700 15.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Mon Jun 10 17:04:18 2013 -0700 15.3 @@ -2360,7 +2360,7 @@ 15.4 null, List.<JCExpression>nil(), List.<JCTree>nil()); 15.5 ClassSymbol c = tree.packge.package_info; 15.6 c.flags_field |= flags; 15.7 - c.annotations.setAttributes(tree.packge.annotations); 15.8 + c.setAttributes(tree.packge); 15.9 ClassType ctype = (ClassType) c.type; 15.10 ctype.supertype_field = syms.objectType; 15.11 ctype.interfaces_field = List.nil(); 15.12 @@ -2378,7 +2378,7 @@ 15.13 return tree.packageAnnotations.nonEmpty(); 15.14 case NONEMPTY: 15.15 for (Attribute.Compound a : 15.16 - tree.packge.annotations.getDeclarationAttributes()) { 15.17 + tree.packge.getDeclarationAttributes()) { 15.18 Attribute.RetentionPolicy p = types.getRetention(a); 15.19 if (p != Attribute.RetentionPolicy.SOURCE) 15.20 return true;
16.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Jun 06 09:55:26 2013 -0700 16.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Mon Jun 10 17:04:18 2013 -0700 16.3 @@ -712,7 +712,7 @@ 16.4 16.5 public Env<AttrContext> getMethodEnv(JCMethodDecl tree, Env<AttrContext> env) { 16.6 Env<AttrContext> mEnv = methodEnv(tree, env); 16.7 - mEnv.info.lint = mEnv.info.lint.augment(tree.sym.annotations, tree.sym.flags()); 16.8 + mEnv.info.lint = mEnv.info.lint.augment(tree.sym); 16.9 for (List<JCTypeParameter> l = tree.typarams; l.nonEmpty(); l = l.tail) 16.10 mEnv.info.scope.enterIfAbsent(l.head.type.tsym); 16.11 for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) 16.12 @@ -753,7 +753,7 @@ 16.13 return; 16.14 } 16.15 if (s.kind != PCK) { 16.16 - s.annotations.reset(); // mark Annotations as incomplete for now 16.17 + s.resetAnnotations(); // mark Annotations as incomplete for now 16.18 } 16.19 annotate.normal(new Annotate.Annotator() { 16.20 @Override 16.21 @@ -763,10 +763,10 @@ 16.22 16.23 @Override 16.24 public void enterAnnotation() { 16.25 - Assert.check(s.kind == PCK || s.annotations.pendingCompletion()); 16.26 + Assert.check(s.kind == PCK || s.annotationsPendingCompletion()); 16.27 JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); 16.28 try { 16.29 - if (!s.annotations.isEmpty() && 16.30 + if (s.hasAnnotations() && 16.31 annotations.nonEmpty()) 16.32 log.error(annotations.head.pos, 16.33 "already.annotated", 16.34 @@ -832,7 +832,7 @@ 16.35 } 16.36 } 16.37 16.38 - s.annotations.setDeclarationAttributesWithCompletion( 16.39 + s.setDeclarationAttributesWithCompletion( 16.40 annotate.new AnnotateRepeatedContext<Attribute.Compound>(env, annotated, pos, log, false)); 16.41 } 16.42 16.43 @@ -996,8 +996,9 @@ 16.44 long ctorFlags = 0; 16.45 boolean based = false; 16.46 boolean addConstructor = true; 16.47 + JCNewClass nc = null; 16.48 if (c.name.isEmpty()) { 16.49 - JCNewClass nc = (JCNewClass)env.next.tree; 16.50 + nc = (JCNewClass)env.next.tree; 16.51 if (nc.constructor != null) { 16.52 addConstructor = nc.constructor.kind != ERR; 16.53 Type superConstrType = types.memberType(c.type, 16.54 @@ -1013,7 +1014,10 @@ 16.55 } 16.56 } 16.57 if (addConstructor) { 16.58 + MethodSymbol basedConstructor = nc != null ? 16.59 + (MethodSymbol)nc.constructor : null; 16.60 JCTree constrDef = DefaultConstructor(make.at(tree.pos), c, 16.61 + basedConstructor, 16.62 typarams, argtypes, thrown, 16.63 ctorFlags, based); 16.64 tree.defs = tree.defs.prepend(constrDef); 16.65 @@ -1103,7 +1107,7 @@ 16.66 } 16.67 16.68 if (s != null) { 16.69 - s.annotations.appendTypeAttributesWithCompletion( 16.70 + s.appendTypeAttributesWithCompletion( 16.71 annotate.new AnnotateRepeatedContext<Attribute.TypeCompound>(env, annotated, pos, log, true)); 16.72 } 16.73 } 16.74 @@ -1399,34 +1403,78 @@ 16.75 */ 16.76 JCTree DefaultConstructor(TreeMaker make, 16.77 ClassSymbol c, 16.78 + MethodSymbol baseInit, 16.79 List<Type> typarams, 16.80 List<Type> argtypes, 16.81 List<Type> thrown, 16.82 long flags, 16.83 boolean based) { 16.84 - List<JCVariableDecl> params = make.Params(argtypes, syms.noSymbol); 16.85 - List<JCStatement> stats = List.nil(); 16.86 - if (c.type != syms.objectType) 16.87 - stats = stats.prepend(SuperCall(make, typarams, params, based)); 16.88 + JCTree result; 16.89 if ((c.flags() & ENUM) != 0 && 16.90 (types.supertype(c.type).tsym == syms.enumSym)) { 16.91 // constructors of true enums are private 16.92 flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR; 16.93 } else 16.94 flags |= (c.flags() & AccessFlags) | GENERATEDCONSTR; 16.95 - if (c.name.isEmpty()) flags |= ANONCONSTR; 16.96 - JCTree result = make.MethodDef( 16.97 - make.Modifiers(flags), 16.98 - names.init, 16.99 - null, 16.100 - make.TypeParams(typarams), 16.101 - params, 16.102 - make.Types(thrown), 16.103 - make.Block(0, stats), 16.104 - null); 16.105 + if (c.name.isEmpty()) { 16.106 + flags |= ANONCONSTR; 16.107 + } 16.108 + Type mType = new MethodType(argtypes, null, thrown, c); 16.109 + Type initType = typarams.nonEmpty() ? 16.110 + new ForAll(typarams, mType) : 16.111 + mType; 16.112 + MethodSymbol init = new MethodSymbol(flags, names.init, 16.113 + initType, c); 16.114 + init.params = createDefaultConstructorParams(make, baseInit, init, 16.115 + argtypes, based); 16.116 + List<JCVariableDecl> params = make.Params(argtypes, init); 16.117 + List<JCStatement> stats = List.nil(); 16.118 + if (c.type != syms.objectType) { 16.119 + stats = stats.prepend(SuperCall(make, typarams, params, based)); 16.120 + } 16.121 + result = make.MethodDef(init, make.Block(0, stats)); 16.122 return result; 16.123 } 16.124 16.125 + private List<VarSymbol> createDefaultConstructorParams( 16.126 + TreeMaker make, 16.127 + MethodSymbol baseInit, 16.128 + MethodSymbol init, 16.129 + List<Type> argtypes, 16.130 + boolean based) { 16.131 + List<VarSymbol> initParams = null; 16.132 + List<Type> argTypesList = argtypes; 16.133 + if (based) { 16.134 + /* In this case argtypes will have an extra type, compared to baseInit, 16.135 + * corresponding to the type of the enclosing instance i.e.: 16.136 + * 16.137 + * Inner i = outer.new Inner(1){} 16.138 + * 16.139 + * in the above example argtypes will be (Outer, int) and baseInit 16.140 + * will have parameter's types (int). So in this case we have to add 16.141 + * first the extra type in argtypes and then get the names of the 16.142 + * parameters from baseInit. 16.143 + */ 16.144 + initParams = List.nil(); 16.145 + VarSymbol param = new VarSymbol(0, make.paramName(0), argtypes.head, init); 16.146 + initParams = initParams.append(param); 16.147 + argTypesList = argTypesList.tail; 16.148 + } 16.149 + if (baseInit != null && baseInit.params != null && 16.150 + baseInit.params.nonEmpty() && argTypesList.nonEmpty()) { 16.151 + initParams = (initParams == null) ? List.<VarSymbol>nil() : initParams; 16.152 + List<VarSymbol> baseInitParams = baseInit.params; 16.153 + while (baseInitParams.nonEmpty() && argTypesList.nonEmpty()) { 16.154 + VarSymbol param = new VarSymbol(baseInitParams.head.flags(), 16.155 + baseInitParams.head.name, argTypesList.head, init); 16.156 + initParams = initParams.append(param); 16.157 + baseInitParams = baseInitParams.tail; 16.158 + argTypesList = argTypesList.tail; 16.159 + } 16.160 + } 16.161 + return initParams; 16.162 + } 16.163 + 16.164 /** Generate call to superclass constructor. This is: 16.165 * 16.166 * super(id_0, ..., id_n)
17.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Jun 06 09:55:26 2013 -0700 17.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Jun 10 17:04:18 2013 -0700 17.3 @@ -349,7 +349,7 @@ 17.4 : isAccessible(env, t.tsym, checkInner); 17.5 } 17.6 17.7 - /** Is symbol accessible as a member of given type in given evironment? 17.8 + /** Is symbol accessible as a member of given type in given environment? 17.9 * @param env The current environment. 17.10 * @param site The type of which the tested symbol is regarded 17.11 * as a member. 17.12 @@ -490,11 +490,11 @@ 17.13 }; 17.14 17.15 /** Try to instantiate the type of a method so that it fits 17.16 - * given type arguments and argument types. If succesful, return 17.17 + * given type arguments and argument types. If successful, return 17.18 * the method's instantiated type, else return null. 17.19 * The instantiation will take into account an additional leading 17.20 * formal parameter if the method is an instance method seen as a member 17.21 - * of un underdetermined site In this case, we treat site as an additional 17.22 + * of an under determined site. In this case, we treat site as an additional 17.23 * parameter and the parameters of the class containing the method as 17.24 * additional type variables that get instantiated. 17.25 *
18.1 --- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Thu Jun 06 09:55:26 2013 -0700 18.2 +++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Mon Jun 10 17:04:18 2013 -0700 18.3 @@ -258,6 +258,12 @@ 18.4 meth.name, 18.5 bridgeType, 18.6 origin); 18.7 + /* once JDK-6996415 is solved it should be checked if this approach can 18.8 + * be applied to method addOverrideBridgesIfNeeded 18.9 + */ 18.10 + bridge.params = createBridgeParams(impl, bridge, bridgeType); 18.11 + bridge.setAttributes(impl); 18.12 + 18.13 if (!hypothetical) { 18.14 JCMethodDecl md = make.MethodDef(bridge, null); 18.15 18.16 @@ -292,6 +298,26 @@ 18.17 overridden.put(bridge, meth); 18.18 } 18.19 18.20 + private List<VarSymbol> createBridgeParams(MethodSymbol impl, MethodSymbol bridge, 18.21 + Type bridgeType) { 18.22 + List<VarSymbol> bridgeParams = null; 18.23 + if (impl.params != null) { 18.24 + bridgeParams = List.nil(); 18.25 + List<VarSymbol> implParams = impl.params; 18.26 + Type.MethodType mType = (Type.MethodType)bridgeType; 18.27 + List<Type> argTypes = mType.argtypes; 18.28 + while (implParams.nonEmpty() && argTypes.nonEmpty()) { 18.29 + VarSymbol param = new VarSymbol(implParams.head.flags() | SYNTHETIC, 18.30 + implParams.head.name, argTypes.head, bridge); 18.31 + param.setAttributes(implParams.head); 18.32 + bridgeParams = bridgeParams.append(param); 18.33 + implParams = implParams.tail; 18.34 + argTypes = argTypes.tail; 18.35 + } 18.36 + } 18.37 + return bridgeParams; 18.38 + } 18.39 + 18.40 /** Add bridge if given symbol is a non-private, non-static member 18.41 * of the given class, which is either defined in the class or non-final 18.42 * inherited, and one of the two following conditions holds:
19.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Jun 06 09:55:26 2013 -0700 19.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Jun 10 17:04:18 2013 -0700 19.3 @@ -1896,12 +1896,11 @@ 19.4 JavaFileObject previousClassFile = currentClassFile; 19.5 try { 19.6 currentClassFile = classFile; 19.7 - Annotations annotations = sym.annotations; 19.8 List<Attribute.Compound> newList = deproxyCompoundList(l); 19.9 - if (annotations.pendingCompletion()) { 19.10 - annotations.setDeclarationAttributes(newList); 19.11 + if (sym.annotationsPendingCompletion()) { 19.12 + sym.setDeclarationAttributes(newList); 19.13 } else { 19.14 - annotations.append(newList); 19.15 + sym.appendAttributes(newList); 19.16 } 19.17 } finally { 19.18 currentClassFile = previousClassFile; 19.19 @@ -1935,7 +1934,7 @@ 19.20 try { 19.21 currentClassFile = classFile; 19.22 List<Attribute.TypeCompound> newList = deproxyTypeCompoundList(proxies); 19.23 - sym.annotations.setTypeAttributes(newList.prependList(sym.getRawTypeAttributes())); 19.24 + sym.setTypeAttributes(newList.prependList(sym.getRawTypeAttributes())); 19.25 } finally { 19.26 currentClassFile = previousClassFile; 19.27 }
20.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Jun 06 09:55:26 2013 -0700 20.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Mon Jun 10 17:04:18 2013 -0700 20.3 @@ -31,7 +31,6 @@ 20.4 import java.util.Set; 20.5 import java.util.HashSet; 20.6 20.7 -import javax.lang.model.type.TypeKind; 20.8 import javax.tools.JavaFileManager; 20.9 import javax.tools.FileObject; 20.10 import javax.tools.JavaFileObject; 20.11 @@ -39,9 +38,6 @@ 20.12 import com.sun.tools.javac.code.*; 20.13 import com.sun.tools.javac.code.Attribute.RetentionPolicy; 20.14 import com.sun.tools.javac.code.Attribute.TypeCompound; 20.15 -import static com.sun.tools.javac.code.BoundKind.EXTENDS; 20.16 -import static com.sun.tools.javac.code.BoundKind.SUPER; 20.17 -import static com.sun.tools.javac.code.BoundKind.UNBOUND; 20.18 import com.sun.tools.javac.code.Symbol.*; 20.19 import com.sun.tools.javac.code.Type.*; 20.20 import com.sun.tools.javac.code.Types.UniqueType; 20.21 @@ -674,13 +670,15 @@ 20.22 int writeParameterAttrs(MethodSymbol m) { 20.23 boolean hasVisible = false; 20.24 boolean hasInvisible = false; 20.25 - if (m.params != null) for (VarSymbol s : m.params) { 20.26 - for (Attribute.Compound a : s.getRawAttributes()) { 20.27 - switch (types.getRetention(a)) { 20.28 - case SOURCE: break; 20.29 - case CLASS: hasInvisible = true; break; 20.30 - case RUNTIME: hasVisible = true; break; 20.31 - default: ;// /* fail soft */ throw new AssertionError(vis); 20.32 + if (m.params != null) { 20.33 + for (VarSymbol s : m.params) { 20.34 + for (Attribute.Compound a : s.getRawAttributes()) { 20.35 + switch (types.getRetention(a)) { 20.36 + case SOURCE: break; 20.37 + case CLASS: hasInvisible = true; break; 20.38 + case RUNTIME: hasVisible = true; break; 20.39 + default: ;// /* fail soft */ throw new AssertionError(vis); 20.40 + } 20.41 } 20.42 } 20.43 } 20.44 @@ -1026,6 +1024,7 @@ 20.45 char flags = (char) adjustFlags(inner.flags_field); 20.46 if ((flags & INTERFACE) != 0) flags |= ABSTRACT; // Interfaces are always ABSTRACT 20.47 if (inner.name.isEmpty()) flags &= ~FINAL; // Anonymous class: unset FINAL flag 20.48 + flags &= ~STRICTFP; //inner classes should not have the strictfp flag set. 20.49 if (dumpInnerClassModifiers) { 20.50 PrintWriter pw = log.getWriter(Log.WriterKind.ERROR); 20.51 pw.println("INNERCLASS " + inner.name);
21.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Code.java Thu Jun 06 09:55:26 2013 -0700 21.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java Mon Jun 10 17:04:18 2013 -0700 21.3 @@ -1960,8 +1960,7 @@ 21.4 } 21.5 21.6 private void fillLocalVarPosition(LocalVar lv) { 21.7 - if (lv == null || lv.sym == null 21.8 - || lv.sym.annotations.isTypesEmpty()) 21.9 + if (lv == null || lv.sym == null || !lv.sym.hasTypeAnnotations()) 21.10 return; 21.11 for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) { 21.12 TypeAnnotationPosition p = ta.position; 21.13 @@ -1979,7 +1978,7 @@ 21.14 for (int i = 0; i < varBufferSize; ++i) { 21.15 LocalVar lv = varBuffer[i]; 21.16 if (lv == null || lv.sym == null 21.17 - || lv.sym.annotations.isTypesEmpty() 21.18 + || !lv.sym.hasTypeAnnotations() 21.19 || !lv.sym.isExceptionParameter()) 21.20 continue; 21.21 21.22 @@ -2028,7 +2027,7 @@ 21.23 // 2) it is an exception type and it contains type annotations 21.24 if (!varDebugInfo && 21.25 (!var.sym.isExceptionParameter() || 21.26 - var.sym.annotations.isTypesEmpty())) return; 21.27 + var.sym.hasTypeAnnotations())) return; 21.28 if ((var.sym.flags() & Flags.SYNTHETIC) != 0) return; 21.29 if (varBuffer == null) 21.30 varBuffer = new LocalVar[20];
22.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Jun 06 09:55:26 2013 -0700 22.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Mon Jun 10 17:04:18 2013 -0700 22.3 @@ -518,7 +518,7 @@ 22.4 // Insert any instance initializers into all constructors. 22.5 if (initCode.length() != 0) { 22.6 List<JCStatement> inits = initCode.toList(); 22.7 - initTAs.addAll(c.annotations.getInitTypeAttributes()); 22.8 + initTAs.addAll(c.getInitTypeAttributes()); 22.9 List<Attribute.TypeCompound> initTAlist = initTAs.toList(); 22.10 for (JCTree t : methodDefs) { 22.11 normalizeMethod((JCMethodDecl)t, inits, initTAlist); 22.12 @@ -541,9 +541,9 @@ 22.13 methodDefs.append(make.MethodDef(clinit, block)); 22.14 22.15 if (!clinitTAs.isEmpty()) 22.16 - clinit.annotations.appendUniqueTypes(clinitTAs.toList()); 22.17 - if (!c.annotations.getClassInitTypeAttributes().isEmpty()) 22.18 - clinit.annotations.appendUniqueTypes(c.annotations.getClassInitTypeAttributes()); 22.19 + clinit.appendUniqueTypeAttributes(clinitTAs.toList()); 22.20 + if (!c.getClassInitTypeAttributes().isEmpty()) 22.21 + clinit.appendUniqueTypeAttributes(c.getClassInitTypeAttributes()); 22.22 } 22.23 // Return all method definitions. 22.24 return methodDefs.toList(); 22.25 @@ -560,7 +560,7 @@ 22.26 nonfieldTAs.add(ta); 22.27 } 22.28 } 22.29 - sym.annotations.setTypeAttributes(fieldTAs.toList()); 22.30 + sym.setTypeAttributes(fieldTAs.toList()); 22.31 return nonfieldTAs.toList(); 22.32 } 22.33 22.34 @@ -618,7 +618,7 @@ 22.35 if (md.body.endpos == Position.NOPOS) 22.36 md.body.endpos = TreeInfo.endPos(md.body.stats.last()); 22.37 22.38 - md.sym.annotations.appendUniqueTypes(initTAs); 22.39 + md.sym.appendUniqueTypeAttributes(initTAs); 22.40 } 22.41 } 22.42
23.1 --- a/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java Thu Jun 06 09:55:26 2013 -0700 23.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java Mon Jun 10 17:04:18 2013 -0700 23.3 @@ -160,7 +160,7 @@ 23.4 for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) { 23.5 if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0) 23.6 return true; 23.7 - for (Attribute.Compound a: i.sym.annotations.getDeclarationAttributes()) { 23.8 + for (Attribute.Compound a: i.sym.getDeclarationAttributes()) { 23.9 if (a.type.tsym == syms.nativeHeaderType.tsym) 23.10 return true; 23.11 }
24.1 --- a/src/share/classes/com/sun/tools/javac/resources/javac.properties Thu Jun 06 09:55:26 2013 -0700 24.2 +++ b/src/share/classes/com/sun/tools/javac/resources/javac.properties Mon Jun 10 17:04:18 2013 -0700 24.3 @@ -1,5 +1,5 @@ 24.4 # 24.5 -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 24.6 +# Copyright (c) 1999, 2013, 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 @@ -146,11 +146,15 @@ 24.11 Enable or disable specific warnings 24.12 javac.opt.Xdoclint=\ 24.13 Enable recommended checks for problems in javadoc comments 24.14 +# L10N: do not localize: all none 24.15 javac.opt.Xdoclint.subopts = \ 24.16 - (all|[-]<group>)[/<access>] 24.17 + (all|none|[-]<group>)[/<access>] 24.18 + 24.19 +# L10N: do not localize: accessibility html missing reference syntax 24.20 +# L10N: do not localize: public protected package private 24.21 javac.opt.Xdoclint.custom=\n\ 24.22 \ Enable or disable specific checks for problems in javadoc comments,\n\ 24.23 -\ where <group> is one of accessibility, html, reference, or syntax,\n\ 24.24 +\ where <group> is one of accessibility, html, missing, reference, or syntax,\n\ 24.25 \ and <access> is one of public, protected, package, or private. 24.26 javac.opt.Xstdout=\ 24.27 Redirect standard output
25.1 --- a/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Thu Jun 06 09:55:26 2013 -0700 25.2 +++ b/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Mon Jun 10 17:04:18 2013 -0700 25.3 @@ -1,5 +1,5 @@ 25.4 /* 25.5 - * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. 25.6 + * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. 25.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.8 * 25.9 * This code is free software; you can redistribute it and/or modify it 25.10 @@ -225,11 +225,11 @@ 25.11 } 25.12 ClassSymbol cs = (ClassSymbol) sym; 25.13 if (addLegacyAnnotation) { 25.14 - cs.annotations.prepend(List.of(proprietaryAnno)); 25.15 + cs.prependAttributes(List.of(proprietaryAnno)); 25.16 } 25.17 int p = profiles.getProfile(cs.fullname.toString().replace(".", "/")); 25.18 if (0 < p && p < profileAnnos.length) 25.19 - cs.annotations.prepend(List.of(profileAnnos[p])); 25.20 + cs.prependAttributes(List.of(profileAnnos[p])); 25.21 writeClass(pool, cs, writer); 25.22 } 25.23
26.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Thu Jun 06 09:55:26 2013 -0700 26.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Mon Jun 10 17:04:18 2013 -0700 26.3 @@ -1131,6 +1131,14 @@ 26.4 26.5 private static class TypeAnnotationFinder extends TreeScanner { 26.6 public boolean foundTypeAnno = false; 26.7 + 26.8 + @Override 26.9 + public void scan(JCTree tree) { 26.10 + if (foundTypeAnno || tree == null) 26.11 + return; 26.12 + super.scan(tree); 26.13 + } 26.14 + 26.15 public void visitAnnotation(JCAnnotation tree) { 26.16 foundTypeAnno = foundTypeAnno || tree.hasTag(TYPE_ANNOTATION); 26.17 }
27.1 --- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Thu Jun 06 09:55:26 2013 -0700 27.2 +++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Mon Jun 10 17:04:18 2013 -0700 27.3 @@ -125,6 +125,13 @@ 27.4 return sb.toString(); 27.5 } 27.6 27.7 + @Override 27.8 + public String formatMessage(JCDiagnostic diag, Locale l) { 27.9 + nameSimplifier = new ClassNameSimplifier(); 27.10 + preprocessDiagnostic(diag); 27.11 + return super.formatMessage(diag, l); 27.12 + } 27.13 + 27.14 /** 27.15 * Sets the type/symbol printer used by this formatter. 27.16 * @param printer the rich printer to be set
28.1 --- a/src/share/classes/com/sun/tools/javadoc/Start.java Thu Jun 06 09:55:26 2013 -0700 28.2 +++ b/src/share/classes/com/sun/tools/javadoc/Start.java Mon Jun 10 17:04:18 2013 -0700 28.3 @@ -1,5 +1,5 @@ 28.4 /* 28.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 28.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 28.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.8 * 28.9 * This code is free software; you can redistribute it and/or modify it 28.10 @@ -156,21 +156,8 @@ 28.11 usage(true); 28.12 } 28.13 28.14 - 28.15 - /** 28.16 - * Usage 28.17 - */ 28.18 - private void usage(boolean exit) { 28.19 - // RFE: it would be better to replace the following with code to 28.20 - // write a header, then help for each option, then a footer. 28.21 - messager.notice("main.usage"); 28.22 - 28.23 - // let doclet print usage information (does nothing on error) 28.24 - if (docletInvoker != null) { 28.25 - docletInvoker.optionLength("-help"); 28.26 - } 28.27 - 28.28 - if (exit) exit(); 28.29 + void usage(boolean exit) { 28.30 + usage("main.usage", "-help", null, exit); 28.31 } 28.32 28.33 @Override 28.34 @@ -178,11 +165,28 @@ 28.35 Xusage(true); 28.36 } 28.37 28.38 - /** 28.39 - * Usage 28.40 - */ 28.41 - private void Xusage(boolean exit) { 28.42 - messager.notice("main.Xusage"); 28.43 + void Xusage(boolean exit) { 28.44 + usage("main.Xusage", "-X", "main.Xusage.foot", exit); 28.45 + } 28.46 + 28.47 + private void usage(String main, String doclet, String foot, boolean exit) { 28.48 + // RFE: it would be better to replace the following with code to 28.49 + // write a header, then help for each option, then a footer. 28.50 + messager.notice(main); 28.51 + 28.52 + // let doclet print usage information (does nothing on error) 28.53 + if (docletInvoker != null) { 28.54 + // RFE: this is a pretty bad way to get the doclet to show 28.55 + // help info. Moreover, the output appears on stdout, 28.56 + // and <i>not</i> on any of the standard streams passed 28.57 + // to javadoc, and in particular, not to the noticeWriter 28.58 + // But, to fix this, we need to fix the Doclet API. 28.59 + docletInvoker.optionLength(doclet); 28.60 + } 28.61 + 28.62 + if (foot != null) 28.63 + messager.notice(foot); 28.64 + 28.65 if (exit) exit(); 28.66 } 28.67
29.1 --- a/src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties Thu Jun 06 09:55:26 2013 -0700 29.2 +++ b/src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties Mon Jun 10 17:04:18 2013 -0700 29.3 @@ -1,5 +1,5 @@ 29.4 # 29.5 -# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 29.6 +# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 29.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.8 # 29.9 # This code is free software; you can redistribute it and/or modify it 29.10 @@ -27,35 +27,39 @@ 29.11 main.error={0} error 29.12 main.warnings={0} warnings 29.13 main.warning={0} warning 29.14 -main.usage=usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\ 29.15 - -overview <file> Read overview documentation from HTML file\n\ 29.16 - -public Show only public classes and members\n\ 29.17 - -protected Show protected/public classes and members (default)\n\ 29.18 - -package Show package/protected/public classes and members\n\ 29.19 - -private Show all classes and members\n\ 29.20 - -help Display command line options and exit\n\ 29.21 - -doclet <class> Generate output via alternate doclet\n\ 29.22 - -docletpath <path> Specify where to find doclet class files\n\ 29.23 - -sourcepath <pathlist> Specify where to find source files\n\ 29.24 - -classpath <pathlist> Specify where to find user class files\n\ 29.25 - -exclude <pkglist> Specify a list of packages to exclude\n\ 29.26 - -subpackages <subpkglist> Specify subpackages to recursively load\n\ 29.27 - -breakiterator Compute 1st sentence with BreakIterator\n\ 29.28 - -bootclasspath <pathlist> Override location of class files loaded\n\ 29.29 -\t\t\t by the bootstrap class loader\n\ 29.30 - -source <release> Provide source compatibility with specified release\n\ 29.31 - -extdirs <dirlist> Override location of installed extensions\n\ 29.32 - -verbose Output messages about what Javadoc is doing\n\ 29.33 - -locale <name> Locale to be used, e.g. en_US or en_US_WIN\n\ 29.34 - -encoding <name> Source file encoding name\n\ 29.35 - -quiet Do not display status messages\n\ 29.36 - -J<flag> Pass <flag> directly to the runtime system\n\ 29.37 - -X Print a synopsis of nonstandard options\n 29.38 + 29.39 +main.usage=Usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\ 29.40 +\ -overview <file> Read overview documentation from HTML file\n\ 29.41 +\ -public Show only public classes and members\n\ 29.42 +\ -protected Show protected/public classes and members (default)\n\ 29.43 +\ -package Show package/protected/public classes and members\n\ 29.44 +\ -private Show all classes and members\n\ 29.45 +\ -help Display command line options and exit\n\ 29.46 +\ -doclet <class> Generate output via alternate doclet\n\ 29.47 +\ -docletpath <path> Specify where to find doclet class files\n\ 29.48 +\ -sourcepath <pathlist> Specify where to find source files\n\ 29.49 +\ -classpath <pathlist> Specify where to find user class files\n\ 29.50 +\ -exclude <pkglist> Specify a list of packages to exclude\n\ 29.51 +\ -subpackages <subpkglist> Specify subpackages to recursively load\n\ 29.52 +\ -breakiterator Compute first sentence with BreakIterator\n\ 29.53 +\ -bootclasspath <pathlist> Override location of class files loaded\n\ 29.54 +\ by the bootstrap class loader\n\ 29.55 +\ -source <release> Provide source compatibility with specified release\n\ 29.56 +\ -extdirs <dirlist> Override location of installed extensions\n\ 29.57 +\ -verbose Output messages about what Javadoc is doing\n\ 29.58 +\ -locale <name> Locale to be used, e.g. en_US or en_US_WIN\n\ 29.59 +\ -encoding <name> Source file encoding name\n\ 29.60 +\ -quiet Do not display status messages\n\ 29.61 +\ -J<flag> Pass <flag> directly to the runtime system\n\ 29.62 +\ -X Print a synopsis of nonstandard options and exit\n 29.63 + 29.64 main.Xusage=\ 29.65 - -Xmaxerrs <number> Set the maximum number of errors to print\n\ 29.66 - -Xmaxwarns <number> Set the maximum number of warnings to print\n\ 29.67 -\n\ 29.68 +\ -Xmaxerrs <number> Set the maximum number of errors to print\n\ 29.69 +\ -Xmaxwarns <number> Set the maximum number of warnings to print\n 29.70 + 29.71 +main.Xusage.foot=\ 29.72 These options are non-standard and subject to change without notice. 29.73 + 29.74 main.option.already.seen=The {0} option may be specified no more than once. 29.75 main.requires_argument=option {0} requires an argument. 29.76 main.locale_first=option -locale must be first on the command line.
30.1 --- a/test/com/sun/javadoc/testHelpOption/TestHelpOption.java Thu Jun 06 09:55:26 2013 -0700 30.2 +++ b/test/com/sun/javadoc/testHelpOption/TestHelpOption.java Mon Jun 10 17:04:18 2013 -0700 30.3 @@ -1,5 +1,5 @@ 30.4 /* 30.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 30.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 30.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.8 * 30.9 * This code is free software; you can redistribute it and/or modify it 30.10 @@ -78,7 +78,6 @@ 30.11 {STANDARD_OUTPUT, "-tag "}, 30.12 {STANDARD_OUTPUT, "-taglet "}, 30.13 {STANDARD_OUTPUT, "-tagletpath "}, 30.14 - {STANDARD_OUTPUT, "-Xdocrootparent "}, 30.15 {STANDARD_OUTPUT, "-charset "}, 30.16 {STANDARD_OUTPUT, "-helpfile "}, 30.17 {STANDARD_OUTPUT, "-linksource "},
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 31.2 +++ b/test/com/sun/javadoc/testXOption/TestXOption.java Mon Jun 10 17:04:18 2013 -0700 31.3 @@ -0,0 +1,85 @@ 31.4 +/* 31.5 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.7 + * 31.8 + * This code is free software; you can redistribute it and/or modify it 31.9 + * under the terms of the GNU General Public License version 2 only, as 31.10 + * published by the Free Software Foundation. 31.11 + * 31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 31.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 31.15 + * version 2 for more details (a copy is included in the LICENSE file that 31.16 + * accompanied this code). 31.17 + * 31.18 + * You should have received a copy of the GNU General Public License version 31.19 + * 2 along with this work; if not, write to the Free Software Foundation, 31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 31.21 + * 31.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 31.23 + * or visit www.oracle.com if you need additional information or have any 31.24 + * questions. 31.25 + */ 31.26 + 31.27 +/* 31.28 + * @test 31.29 + * @bug 8007687 31.30 + * @summary Make sure that the -X option works properly. 31.31 + * @library ../lib/ 31.32 + * @build JavadocTester TestXOption 31.33 + * @run main TestXOption 31.34 + */ 31.35 + 31.36 +public class TestXOption extends JavadocTester { 31.37 + 31.38 + //Test information. 31.39 + private static final String BUG_ID = "8007687"; 31.40 + 31.41 + //Javadoc arguments. 31.42 + private static final String[] ARGS = new String[] { 31.43 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "-X", 31.44 + SRC_DIR + FS + "TestXOption.java" 31.45 + }; 31.46 + 31.47 + private static final String[] ARGS2 = new String[] { 31.48 + "-d", BUG_ID, "-sourcepath", SRC_DIR, 31.49 + SRC_DIR + FS + "TestXOption.java" 31.50 + }; 31.51 + 31.52 + private static final String[][] TEST = { 31.53 + {NOTICE_OUTPUT, "-Xmaxerrs "}, 31.54 + {NOTICE_OUTPUT, "-Xmaxwarns "}, 31.55 + {STANDARD_OUTPUT, "-Xdocrootparent "}, 31.56 + {STANDARD_OUTPUT, "-Xdoclint "}, 31.57 + {STANDARD_OUTPUT, "-Xdoclint:"}, 31.58 + }; 31.59 + private static final String[][] NEGATED_TEST = NO_TEST; 31.60 + 31.61 + //The help option should not crash the doclet. 31.62 + private static final int EXPECTED_EXIT_CODE = 0; 31.63 + 31.64 + /** 31.65 + * The entry point of the test. 31.66 + * @param args the array of command line arguments. 31.67 + */ 31.68 + public static void main(String[] args) { 31.69 + TestXOption tester = new TestXOption(); 31.70 + int actualExitCode = run(tester, ARGS, TEST, NEGATED_TEST); 31.71 + tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode); 31.72 + tester.printSummary(); 31.73 + } 31.74 + 31.75 + /** 31.76 + * {@inheritDoc} 31.77 + */ 31.78 + public String getBugId() { 31.79 + return BUG_ID; 31.80 + } 31.81 + 31.82 + /** 31.83 + * {@inheritDoc} 31.84 + */ 31.85 + public String getBugName() { 31.86 + return getClass().getName(); 31.87 + } 31.88 +}
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/test/tools/doclint/ResourceTest.java Mon Jun 10 17:04:18 2013 -0700 32.3 @@ -0,0 +1,81 @@ 32.4 +/* 32.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.7 + * 32.8 + * This code is free software; you can redistribute it and/or modify it 32.9 + * under the terms of the GNU General Public License version 2 only, as 32.10 + * published by the Free Software Foundation. 32.11 + * 32.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 32.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 32.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 32.15 + * version 2 for more details (a copy is included in the LICENSE file that 32.16 + * accompanied this code). 32.17 + * 32.18 + * You should have received a copy of the GNU General Public License version 32.19 + * 2 along with this work; if not, write to the Free Software Foundation, 32.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 32.21 + * 32.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 32.23 + * or visit www.oracle.com if you need additional information or have any 32.24 + * questions. 32.25 + */ 32.26 + 32.27 +/* 32.28 + * @test 32.29 + * @bug 8006615 32.30 + * @summary move remaining messages into resource bundle 32.31 + */ 32.32 + 32.33 +import java.io.IOException; 32.34 +import java.io.PrintWriter; 32.35 +import java.io.StringWriter; 32.36 +import java.util.Arrays; 32.37 +import java.util.List; 32.38 +import java.util.Locale; 32.39 + 32.40 +import com.sun.tools.doclint.DocLint; 32.41 + 32.42 +public class ResourceTest { 32.43 + public static void main(String... args) throws Exception { 32.44 + Locale prev = Locale.getDefault(); 32.45 + Locale.setDefault(Locale.ENGLISH); 32.46 + try { 32.47 + new ResourceTest().run(); 32.48 + } finally { 32.49 + Locale.setDefault(prev); 32.50 + } 32.51 + } 32.52 + 32.53 + public void run() throws Exception { 32.54 + test(Arrays.asList("-help"), 32.55 + Arrays.asList("Usage:", "Options")); 32.56 + test(Arrays.asList("-foo"), 32.57 + Arrays.asList("bad option: -foo")); 32.58 + } 32.59 + 32.60 + void test(List<String> opts, List<String> expects) throws Exception { 32.61 + StringWriter sw = new StringWriter(); 32.62 + PrintWriter pw = new PrintWriter(sw); 32.63 + try { 32.64 + new DocLint().run(pw, opts.toArray(new String[opts.size()])); 32.65 + } catch (DocLint.BadArgs e) { 32.66 + pw.println("BadArgs: " + e.getMessage()); 32.67 + } catch (IOException e) { 32.68 + pw.println("IOException: " + e.getMessage()); 32.69 + } finally { 32.70 + pw.close(); 32.71 + } 32.72 + 32.73 + String out = sw.toString(); 32.74 + if (!out.isEmpty()) { 32.75 + System.err.println(out); 32.76 + } 32.77 + 32.78 + for (String e: expects) { 32.79 + if (!out.contains(e)) 32.80 + throw new Exception("expected string not found: " + e); 32.81 + } 32.82 + } 32.83 +} 32.84 +
33.1 --- a/test/tools/doclint/html/ListTagsTest.java Thu Jun 06 09:55:26 2013 -0700 33.2 +++ b/test/tools/doclint/html/ListTagsTest.java Mon Jun 10 17:04:18 2013 -0700 33.3 @@ -1,33 +1,10 @@ 33.4 /* 33.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 33.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.7 - * 33.8 - * This code is free software; you can redistribute it and/or modify it 33.9 - * under the terms of the GNU General Public License version 2 only, as 33.10 - * published by the Free Software Foundation. 33.11 - * 33.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 33.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 33.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 33.15 - * version 2 for more details (a copy is included in the LICENSE file that 33.16 - * accompanied this code). 33.17 - * 33.18 - * You should have received a copy of the GNU General Public License version 33.19 - * 2 along with this work; if not, write to the Free Software Foundation, 33.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 33.21 - * 33.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 33.23 - * or visit www.oracle.com if you need additional information or have any 33.24 - * questions. 33.25 - */ 33.26 - 33.27 -/* 33.28 - * @test 33.29 - * @bug 8006251 33.30 + * @test /nodynamiccopyright/ 33.31 + * @bug 8006251 8013405 33.32 * @summary test list tags 33.33 * @library .. 33.34 * @build DocLintTester 33.35 - * @run main DocLintTester -Xmsgs ListTagsTest.java 33.36 + * @run main DocLintTester -Xmsgs -ref ListTagsTest.out ListTagsTest.java 33.37 */ 33.38 33.39 /** */ 33.40 @@ -35,6 +12,9 @@ 33.41 /** 33.42 * <dl> <dt> abc <dd> def </dl> 33.43 * <ol> <li> abc </ol> 33.44 + * <ol> <li value="1"> abc </ol> 33.45 + * <ol> <li value> bad </ol> 33.46 + * <ol> <li value="a"> bad </ol> 33.47 * <ul> <li> abc </ul> 33.48 */ 33.49 public void supportedTags() { }
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 34.2 +++ b/test/tools/doclint/html/ListTagsTest.out Mon Jun 10 17:04:18 2013 -0700 34.3 @@ -0,0 +1,7 @@ 34.4 +ListTagsTest.java:16: error: attribute lacks value 34.5 + * <ol> <li value> bad </ol> 34.6 + ^ 34.7 +ListTagsTest.java:17: error: attribute value is not a number 34.8 + * <ol> <li value="a"> bad </ol> 34.9 + ^ 34.10 +2 errors
35.1 --- a/test/tools/doclint/tool/RunTest.java Thu Jun 06 09:55:26 2013 -0700 35.2 +++ b/test/tools/doclint/tool/RunTest.java Mon Jun 10 17:04:18 2013 -0700 35.3 @@ -173,7 +173,7 @@ 35.4 pw.close(); 35.5 String out = sw.toString(); 35.6 35.7 - String expect = "no files given"; 35.8 + String expect = "No files given"; 35.9 if (!Objects.equals(out.trim(), expect)) { 35.10 error("unexpected output"); 35.11 System.err.println("EXPECT>>" + expect + "<<");
36.1 --- a/test/tools/javac/6567415/T6567415.java Thu Jun 06 09:55:26 2013 -0700 36.2 +++ b/test/tools/javac/6567415/T6567415.java Mon Jun 10 17:04:18 2013 -0700 36.3 @@ -1,5 +1,5 @@ 36.4 /* 36.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 36.6 + * Copyright (c) 2010, 2013 Oracle and/or its affiliates. All rights reserved. 36.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.8 * 36.9 * This code is free software; you can redistribute it and/or modify it 36.10 @@ -137,7 +137,7 @@ 36.11 } 36.12 }; 36.13 t.start(); 36.14 - t.join(1000*10); 36.15 + t.join(1000*60); 36.16 System.out.println(t.getState()); 36.17 if (t.isAlive()) { 36.18 throw new RuntimeException("Error: compilation is looping");
37.1 --- a/test/tools/javac/6889255/T6889255.java Thu Jun 06 09:55:26 2013 -0700 37.2 +++ b/test/tools/javac/6889255/T6889255.java Mon Jun 10 17:04:18 2013 -0700 37.3 @@ -1,5 +1,5 @@ 37.4 /* 37.5 - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 37.6 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 37.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.8 * 37.9 * This code is free software; you can redistribute it and/or modify it 37.10 @@ -429,9 +429,9 @@ 37.11 // -- no Code attribute for the LocalVariableTable attribute 37.12 if ((v.owner.flags() & Flags.ABSTRACT) != 0) 37.13 return "arg" + (i - 1); 37.14 - // bridge methods use xN 37.15 + // bridge methods use argN. No LVT for them anymore 37.16 if ((v.owner.flags() & Flags.BRIDGE) != 0) 37.17 - return "x" + (i - 1); 37.18 + return "arg" + (i - 1); 37.19 37.20 // The rest of this method assumes the local conventions in the test program 37.21 Type t = v.type;
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 38.2 +++ b/test/tools/javac/Diagnostics/7116676/T7116676.java Mon Jun 10 17:04:18 2013 -0700 38.3 @@ -0,0 +1,109 @@ 38.4 +/* 38.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 38.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.7 + * 38.8 + * This code is free software; you can redistribute it and/or modify it 38.9 + * under the terms of the GNU General Public License version 2 only, as 38.10 + * published by the Free Software Foundation. 38.11 + * 38.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 38.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 38.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 38.15 + * version 2 for more details (a copy is included in the LICENSE file that 38.16 + * accompanied this code). 38.17 + * 38.18 + * You should have received a copy of the GNU General Public License version 38.19 + * 2 along with this work; if not, write to the Free Software Foundation, 38.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 38.21 + * 38.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 38.23 + * or visit www.oracle.com if you need additional information or have any 38.24 + * questions. 38.25 + */ 38.26 + 38.27 +/* 38.28 + * @test 38.29 + * @bug 7116676 38.30 + * @summary RichDiagnosticFormatter throws NPE when formatMessage is called directly 38.31 + */ 38.32 + 38.33 +import com.sun.source.util.JavacTask; 38.34 +import com.sun.tools.javac.api.ClientCodeWrapper.Trusted; 38.35 +import com.sun.tools.javac.api.DiagnosticFormatter; 38.36 +import com.sun.tools.javac.api.JavacTaskImpl; 38.37 +import com.sun.tools.javac.util.Assert; 38.38 +import com.sun.tools.javac.util.JCDiagnostic; 38.39 +import com.sun.tools.javac.util.Log; 38.40 +import java.io.IOException; 38.41 +import java.net.URI; 38.42 +import java.util.ArrayList; 38.43 +import java.util.Arrays; 38.44 +import java.util.List; 38.45 +import java.util.Locale; 38.46 +import javax.tools.Diagnostic; 38.47 +import javax.tools.DiagnosticListener; 38.48 +import javax.tools.JavaCompiler; 38.49 +import javax.tools.JavaFileObject; 38.50 +import javax.tools.SimpleJavaFileObject; 38.51 +import javax.tools.ToolProvider; 38.52 + 38.53 +public class T7116676 { 38.54 + 38.55 + public static void main(String[] args) throws Exception { 38.56 + T7116676 test = new T7116676(); 38.57 + test.testThroughFormatterFormat(); 38.58 + } 38.59 + 38.60 + static class JavaSource extends SimpleJavaFileObject { 38.61 + private String text = "package test;\n" + 38.62 + "public class Test {\n" + 38.63 + " private void t(java.util.List<? extends String> l) {\n" + 38.64 + " t(java.util.Collections.singleton(l));\n" + 38.65 + "} }"; 38.66 + 38.67 + public JavaSource() { 38.68 + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); 38.69 + } 38.70 + @Override 38.71 + public CharSequence getCharContent(boolean ignoreEncodingErrors) { 38.72 + return text; 38.73 + } 38.74 + } 38.75 + 38.76 + void assertEquals(String req, String found) { 38.77 + if (!found.equals(req)) { 38.78 + throw new AssertionError(String.format("Error. Found: \n\n%s ; Expected: \n\n%s", found, req)); 38.79 + } 38.80 + } 38.81 + 38.82 + public void testThroughFormatterFormat() throws IOException { 38.83 + final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); 38.84 + DiagnosticChecker dc = new DiagnosticChecker("compiler.err.prob.found.req"); 38.85 + JavacTask ct = (JavacTask)tool.getTask(null, null, dc, null, null, Arrays.asList(new JavaSource())); 38.86 + ct.analyze(); 38.87 + DiagnosticFormatter<JCDiagnostic> formatter = 38.88 + Log.instance(((JavacTaskImpl) ct).getContext()).getDiagnosticFormatter(); 38.89 + String msg = formatter.formatMessage(dc.diag, Locale.getDefault()); 38.90 + //no redundant package qualifiers 38.91 + Assert.check(msg.indexOf("java.") == -1, msg); 38.92 + } 38.93 + 38.94 + @Trusted 38.95 + private static final class DiagnosticChecker implements DiagnosticListener<JavaFileObject> { 38.96 + 38.97 + String expectedKey; 38.98 + JCDiagnostic diag; 38.99 + 38.100 + DiagnosticChecker(String expectedKey) { 38.101 + this.expectedKey = expectedKey; 38.102 + } 38.103 + 38.104 + @Override 38.105 + public void report(Diagnostic<? extends JavaFileObject> diagnostic) { 38.106 + JCDiagnostic diag = (JCDiagnostic)diagnostic; 38.107 + if (diagnostic.getCode().equals(expectedKey)) { 38.108 + this.diag = diag; 38.109 + } 38.110 + } 38.111 + } 38.112 +}
39.1 --- a/test/tools/javac/MethodParameters/ClassFileVisitor.java Thu Jun 06 09:55:26 2013 -0700 39.2 +++ b/test/tools/javac/MethodParameters/ClassFileVisitor.java Mon Jun 10 17:04:18 2013 -0700 39.3 @@ -21,10 +21,8 @@ 39.4 * questions. 39.5 */ 39.6 39.7 +import java.io.*; 39.8 import com.sun.tools.classfile.*; 39.9 -import java.io.*; 39.10 -import javax.lang.model.element.*; 39.11 -import java.util.*; 39.12 39.13 /** 39.14 * The {@code ClassFileVisitor} reads a class file using the 39.15 @@ -150,6 +148,7 @@ 39.16 public int mNumParams; 39.17 public boolean mSynthetic; 39.18 public boolean mIsConstructor; 39.19 + public boolean mIsBridge; 39.20 public String prefix; 39.21 39.22 void visitMethod(Method method, StringBuilder sb) throws Exception { 39.23 @@ -162,6 +161,7 @@ 39.24 mSynthetic = method.access_flags.is(AccessFlags.ACC_SYNTHETIC); 39.25 mIsConstructor = mName.equals("<init>"); 39.26 prefix = cname + "." + mName + "() - "; 39.27 + mIsBridge = method.access_flags.is(AccessFlags.ACC_BRIDGE); 39.28 39.29 sb.append(cname).append(".").append(mName).append("("); 39.30 39.31 @@ -316,13 +316,16 @@ 39.32 } 39.33 expect = "this\\$[0-n]*"; 39.34 } 39.35 - } else if (isAnon) { 39.36 - // not an implementation gurantee, but okay for now 39.37 - expect = "x[0-n]*"; 39.38 } 39.39 } else if (isEnum && mNumParams == 1 && index == 0 && mName.equals("valueOf")) { 39.40 expect = "name"; 39.41 allowMandated = true; 39.42 + } else if (mIsBridge) { 39.43 + allowSynthetic = true; 39.44 + /* you can't expect an special name for bridges' parameters. 39.45 + * The name of the original parameters are now copied. 39.46 + */ 39.47 + expect = null; 39.48 } 39.49 if (mandated) sb.append("!"); 39.50 if (synthetic) sb.append("!!");
40.1 --- a/test/tools/javac/MethodParameters/ReflectionVisitor.java Thu Jun 06 09:55:26 2013 -0700 40.2 +++ b/test/tools/javac/MethodParameters/ReflectionVisitor.java Mon Jun 10 17:04:18 2013 -0700 40.3 @@ -22,8 +22,6 @@ 40.4 */ 40.5 40.6 import java.io.*; 40.7 -import java.util.*; 40.8 -import java.net.*; 40.9 import java.lang.reflect.*; 40.10 40.11 /** 40.12 @@ -151,9 +149,6 @@ 40.13 } 40.14 expect = "this\\$[0-n]*"; 40.15 } 40.16 - } else if (isAnon) { 40.17 - // not an implementation gurantee, but okay for now 40.18 - expect = "x[0-n]*"; 40.19 } 40.20 40.21 // Check expected flags 40.22 @@ -253,7 +248,7 @@ 40.23 String expect = m.isSynthetic() ? ("arg" + i) : ((++c) + param); 40.24 param = p.getName(); 40.25 sb.append(sep).append(param); 40.26 - if (!expect.equals(param)) { 40.27 + if (!m.isBridge() && !expect.equals(param)) { 40.28 error(prefix + "param[" + i + "]='" 40.29 + param + "' expected '" + expect + "'"); 40.30 break;
41.1 --- a/test/tools/javac/MethodParameters/Tester.java Thu Jun 06 09:55:26 2013 -0700 41.2 +++ b/test/tools/javac/MethodParameters/Tester.java Mon Jun 10 17:04:18 2013 -0700 41.3 @@ -22,7 +22,6 @@ 41.4 */ 41.5 41.6 import java.io.*; 41.7 -import java.util.*; 41.8 import java.lang.reflect.Constructor; 41.9 41.10 /**
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 42.2 +++ b/test/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java Mon Jun 10 17:04:18 2013 -0700 42.3 @@ -0,0 +1,103 @@ 42.4 +/* 42.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 42.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 42.7 + * 42.8 + * This code is free software; you can redistribute it and/or modify it 42.9 + * under the terms of the GNU General Public License version 2 only, as 42.10 + * published by the Free Software Foundation. 42.11 + * 42.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 42.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 42.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 42.15 + * version 2 for more details (a copy is included in the LICENSE file that 42.16 + * accompanied this code). 42.17 + * 42.18 + * You should have received a copy of the GNU General Public License version 42.19 + * 2 along with this work; if not, write to the Free Software Foundation, 42.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 42.21 + * 42.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 42.23 + * or visit www.oracle.com if you need additional information or have any 42.24 + * questions. 42.25 + */ 42.26 + 42.27 +/* 42.28 + * @test 42.29 + * @bug 6695379 42.30 + * @summary Copy method annotations and parameter annotations to synthetic 42.31 + * bridge methods 42.32 + * @run main AnnotationsAreNotCopiedToBridgeMethodsTest 42.33 + */ 42.34 + 42.35 +import java.lang.annotation.ElementType; 42.36 +import java.lang.annotation.Target; 42.37 +import java.io.BufferedInputStream; 42.38 +import java.lang.annotation.Retention; 42.39 +import java.lang.annotation.RetentionPolicy; 42.40 +import java.nio.file.Files; 42.41 +import java.nio.file.Path; 42.42 +import java.nio.file.Paths; 42.43 + 42.44 +import com.sun.tools.classfile.AccessFlags; 42.45 +import com.sun.tools.classfile.Attribute; 42.46 +import com.sun.tools.classfile.Attributes; 42.47 +import com.sun.tools.classfile.ClassFile; 42.48 +import com.sun.tools.classfile.Method; 42.49 +import com.sun.tools.javac.util.Assert; 42.50 + 42.51 +public class AnnotationsAreNotCopiedToBridgeMethodsTest { 42.52 + 42.53 + public static void main(String[] args) throws Exception { 42.54 + new AnnotationsAreNotCopiedToBridgeMethodsTest().run(); 42.55 + } 42.56 + 42.57 + void run() throws Exception { 42.58 + checkClassFile(Paths.get(System.getProperty("test.classes"), 42.59 + this.getClass().getSimpleName() + "$CovariantReturnType.class")); 42.60 + checkClassFile(Paths.get(System.getProperty("test.classes"), 42.61 + this.getClass().getSimpleName() + 42.62 + "$CovariantReturnType$VisibilityChange.class")); 42.63 + } 42.64 + 42.65 + void checkClassFile(final Path cfilePath) throws Exception { 42.66 + ClassFile classFile = ClassFile.read( 42.67 + new BufferedInputStream(Files.newInputStream(cfilePath))); 42.68 + for (Method method : classFile.methods) { 42.69 + if (method.access_flags.is(AccessFlags.ACC_BRIDGE)) { 42.70 + checkForAttr(method.attributes, 42.71 + "Annotations hasn't been copied to bridge method", 42.72 + Attribute.RuntimeVisibleAnnotations, 42.73 + Attribute.RuntimeVisibleParameterAnnotations); 42.74 + } 42.75 + } 42.76 + } 42.77 + 42.78 + void checkForAttr(Attributes attrs, String errorMsg, String... attrNames) { 42.79 + for (String attrName : attrNames) { 42.80 + Assert.checkNonNull(attrs.get(attrName), errorMsg); 42.81 + } 42.82 + } 42.83 + 42.84 + @Target(value = {ElementType.PARAMETER}) 42.85 + @Retention(RetentionPolicy.RUNTIME) 42.86 + @interface ParamAnnotation {} 42.87 + 42.88 + @Target(value = {ElementType.METHOD}) 42.89 + @Retention(RetentionPolicy.RUNTIME) 42.90 + @interface MethodAnnotation {} 42.91 + 42.92 + abstract class T<A,B> { 42.93 + B m(A a){return null;} 42.94 + } 42.95 + 42.96 + class CovariantReturnType extends T<Integer, Integer> { 42.97 + @MethodAnnotation 42.98 + Integer m(@ParamAnnotation Integer i) { 42.99 + return i; 42.100 + } 42.101 + 42.102 + public class VisibilityChange extends CovariantReturnType {} 42.103 + 42.104 + } 42.105 + 42.106 +}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 43.2 +++ b/test/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java Mon Jun 10 17:04:18 2013 -0700 43.3 @@ -0,0 +1,71 @@ 43.4 +/* 43.5 + * Copyright (c) 2013, 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. Oracle designates this 43.11 + * particular file as subject to the "Classpath" exception as provided 43.12 + * by Oracle in the LICENSE file that accompanied this code. 43.13 + * 43.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 43.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 43.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 43.17 + * version 2 for more details (a copy is included in the LICENSE file that 43.18 + * accompanied this code). 43.19 + * 43.20 + * You should have received a copy of the GNU General Public License version 43.21 + * 2 along with this work; if not, write to the Free Software Foundation, 43.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 43.23 + * 43.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 43.25 + * or visit www.oracle.com if you need additional information or have any 43.26 + * questions. 43.27 + */ 43.28 + 43.29 +/* 43.30 + * @test 43.31 + * @bug 7165659 43.32 + * @summary javac incorrectly sets strictfp access flag on inner-classes 43.33 + */ 43.34 + 43.35 +import java.io.File; 43.36 + 43.37 +import com.sun.tools.classfile.AccessFlags; 43.38 +import com.sun.tools.classfile.Attribute; 43.39 +import com.sun.tools.classfile.ClassFile; 43.40 +import com.sun.tools.classfile.InnerClasses_attribute; 43.41 +import com.sun.tools.classfile.InnerClasses_attribute.Info; 43.42 +import com.sun.tools.javac.util.Assert; 43.43 + 43.44 +public class InnerClassAttrMustNotHaveStrictFPFlagTest { 43.45 + 43.46 + public static void main(String[] args) throws Exception { 43.47 + new InnerClassAttrMustNotHaveStrictFPFlagTest().run(); 43.48 + } 43.49 + 43.50 + private void run() throws Exception { 43.51 + File classPath = new File(System.getProperty("test.classes"), getClass().getSimpleName() + ".class"); 43.52 + analyzeClassFile(classPath); 43.53 + } 43.54 + 43.55 + void analyzeClassFile(File path) throws Exception { 43.56 + ClassFile classFile = ClassFile.read(path); 43.57 + InnerClasses_attribute innerClasses = 43.58 + (InnerClasses_attribute) classFile.attributes.get(Attribute.InnerClasses); 43.59 + for (Info classInfo : innerClasses.classes) { 43.60 + Assert.check(!classInfo.inner_class_access_flags.is(AccessFlags.ACC_STRICT), 43.61 + "Inner classes attribute must not have the ACC_STRICT flag set"); 43.62 + } 43.63 + } 43.64 + 43.65 + strictfp void m() { 43.66 + new Runnable() { 43.67 + @Override 43.68 + public void run() {} 43.69 + }; 43.70 + } 43.71 + 43.72 + static strictfp class Strict extends InnerClassAttrMustNotHaveStrictFPFlagTest {} 43.73 + 43.74 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 44.2 +++ b/test/tools/javac/T7179353/GenericsAndTWRCompileErrorTest.java Mon Jun 10 17:04:18 2013 -0700 44.3 @@ -0,0 +1,42 @@ 44.4 +/* 44.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 44.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 44.7 + * 44.8 + * This code is free software; you can redistribute it and/or modify it 44.9 + * under the terms of the GNU General Public License version 2 only, as 44.10 + * published by the Free Software Foundation. 44.11 + * 44.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 44.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 44.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 44.15 + * version 2 for more details (a copy is included in the LICENSE file that 44.16 + * accompanied this code). 44.17 + * 44.18 + * You should have received a copy of the GNU General Public License version 44.19 + * 2 along with this work; if not, write to the Free Software Foundation, 44.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 44.21 + * 44.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 44.23 + * or visit www.oracle.com if you need additional information or have any 44.24 + * questions. 44.25 + */ 44.26 + 44.27 +/* 44.28 + * @test 44.29 + * @bug 7179353 44.30 + * @summary try-with-resources fails to compile with generic exception parameters 44.31 + * @compile GenericsAndTWRCompileErrorTest.java 44.32 + */ 44.33 + 44.34 +public class GenericsAndTWRCompileErrorTest { 44.35 + 44.36 + public static class Resource<E extends Exception> implements AutoCloseable { 44.37 + public void close() throws E { } 44.38 + } 44.39 + 44.40 + public <E extends Exception> void test() throws E { 44.41 + try (Resource<E> r = new Resource<E>()) { 44.42 + 44.43 + } 44.44 + } 44.45 +}
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 45.2 +++ b/test/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java Mon Jun 10 17:04:18 2013 -0700 45.3 @@ -0,0 +1,239 @@ 45.4 +/* 45.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 45.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 45.7 + * 45.8 + * This code is free software; you can redistribute it and/or modify it 45.9 + * under the terms of the GNU General Public License version 2 only, as 45.10 + * published by the Free Software Foundation. 45.11 + * 45.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 45.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 45.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 45.15 + * version 2 for more details (a copy is included in the LICENSE file that 45.16 + * accompanied this code). 45.17 + * 45.18 + * You should have received a copy of the GNU General Public License version 45.19 + * 2 along with this work; if not, write to the Free Software Foundation, 45.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 45.21 + * 45.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 45.23 + * or visit www.oracle.com if you need additional information or have any 45.24 + * questions. 45.25 + */ 45.26 + 45.27 +/* 45.28 + * @test 45.29 + * @bug 8010737 45.30 + * @summary javac, known parameter's names should be copied to automatically 45.31 + * generated constructors for inner classes 45.32 + * @run main ParameterNamesAreNotCopiedToAnonymousInitTest check_class_file check_init_symbol 45.33 + */ 45.34 + 45.35 +import java.io.File; 45.36 +import java.io.IOException; 45.37 +import java.lang.annotation.ElementType; 45.38 +import java.lang.annotation.Target; 45.39 +import java.nio.file.Paths; 45.40 +import java.util.Arrays; 45.41 + 45.42 +import javax.tools.JavaCompiler; 45.43 +import javax.tools.JavaFileObject; 45.44 +import javax.tools.StandardJavaFileManager; 45.45 +import javax.tools.ToolProvider; 45.46 + 45.47 +import com.sun.source.tree.CompilationUnitTree; 45.48 +import com.sun.source.tree.Tree; 45.49 +import com.sun.source.util.JavacTask; 45.50 +import com.sun.source.util.TaskEvent; 45.51 +import com.sun.source.util.TaskListener; 45.52 +import com.sun.tools.classfile.ClassFile; 45.53 +import com.sun.tools.classfile.Method; 45.54 +import com.sun.tools.javac.api.BasicJavacTask; 45.55 +import com.sun.tools.javac.code.Attribute.Compound; 45.56 +import com.sun.tools.javac.code.Symbol.ClassSymbol; 45.57 +import com.sun.tools.javac.code.Symbol.VarSymbol; 45.58 +import com.sun.tools.javac.tree.JCTree; 45.59 +import com.sun.tools.javac.tree.TreeScanner; 45.60 +import com.sun.tools.javac.util.Assert; 45.61 +import com.sun.tools.javac.util.Context; 45.62 +import com.sun.tools.javac.util.List; 45.63 +import com.sun.tools.javac.util.Names; 45.64 + 45.65 +public class ParameterNamesAreNotCopiedToAnonymousInitTest { 45.66 + 45.67 + static final String noParamsErrorMsg = 45.68 + "Test most be invoked with at least one parameter: check_class_file " + 45.69 + "and/or check_init_symbol"; 45.70 + static final String wrongParamsErrorMsg = 45.71 + "Accepted arguments are: check_class_file and check_init_symbol"; 45.72 + static final String paramNameNotCopiedAssertionMsg = 45.73 + "The param name hasn't been copied to the init method"; 45.74 + static final String noAnnotationsForParameterMsg = 45.75 + "No annotations for seek parameter"; 45.76 + static final String seekMethodNotFound = 45.77 + "The seek init method was not found or conditions were not met"; 45.78 + static final String nonNullParamPositionsMsg = 45.79 + "Parameter positions shold not be null"; 45.80 + static final String compilationFailed = 45.81 + "Compilation failed"; 45.82 + static final String seekMethodNotFoundMsg = 45.83 + "The seek method was not found"; 45.84 + 45.85 + static final String ParamAnnotationClassName = 45.86 + ParameterNamesAreNotCopiedToAnonymousInitTest.class.getSimpleName() + "." + 45.87 + ParamAnnotation.class.getSimpleName(); 45.88 + 45.89 + public static void main(String[] args) throws Exception { 45.90 + if (args.length == 0) { 45.91 + throw new Error(noParamsErrorMsg); 45.92 + } 45.93 + new ParameterNamesAreNotCopiedToAnonymousInitTest().run(args); 45.94 + } 45.95 + 45.96 + void run(String[] args) throws Exception { 45.97 + for (String arg : args) { 45.98 + if (arg.equals("check_class_file")) { 45.99 + checkClassFile(new File(Paths.get(System.getProperty("test.classes"), 45.100 + this.getClass().getName() + "$initParams$1.class").toUri()), 1); 45.101 + checkClassFile(new File(Paths.get(System.getProperty("test.classes"), 45.102 + this.getClass().getName() + "$Generics$1.class").toUri()), 2); 45.103 + } else if (arg.equals("check_init_symbol")) { 45.104 + checkInitSymbol("m1", Arrays.asList(0), Arrays.asList("i")); 45.105 + checkInitSymbol("m2", Arrays.asList(0, 1), Arrays.asList("t1", "t2")); 45.106 + } else { 45.107 + error(wrongParamsErrorMsg); 45.108 + } 45.109 + } 45.110 + } 45.111 + 45.112 + void checkClassFile(final File cfile, int numberOfParams) throws Exception { 45.113 + ClassFile classFile = ClassFile.read(cfile); 45.114 + boolean methodFound = false; 45.115 + for (Method method : classFile.methods) { 45.116 + if (method.getName(classFile.constant_pool).equals("<init>")) { 45.117 + methodFound = true; 45.118 + } 45.119 + } 45.120 + Assert.check(methodFound, seekMethodNotFoundMsg); 45.121 + } 45.122 + 45.123 + /* This method expect a non-null ordered list of integers, listing the 45.124 + * position of the parameters to be checked on the init method. Position 0 45.125 + * corresponds to the first parameter. 45.126 + * 45.127 + * As we are looking for a constructor of an anonymous class, the 45.128 + * classOwnerName parameter must be the name of the method where the 45.129 + * anonymous class is declared. 45.130 + */ 45.131 + void checkInitSymbol( 45.132 + final String classOwnerName, 45.133 + final java.util.List<Integer> paramsToCheck, 45.134 + final java.util.List<String> paramNames) 45.135 + throws IOException { 45.136 + Assert.checkNonNull(paramsToCheck, nonNullParamPositionsMsg); 45.137 + JavaCompiler c = ToolProvider.getSystemJavaCompiler(); 45.138 + StandardJavaFileManager fm = c.getStandardFileManager(null, null, null); 45.139 + Iterable<? extends JavaFileObject> fos = 45.140 + fm.getJavaFileObjectsFromFiles( 45.141 + Arrays.asList(new File(System.getProperty("test.src"), 45.142 + this.getClass().getName() + ".java"))); 45.143 + JavacTask task = (JavacTask) c.getTask(null, fm, null, 45.144 + Arrays.asList("-d", System.getProperty("user.dir")), null, fos); 45.145 + 45.146 + BasicJavacTask impl = (BasicJavacTask)task; 45.147 + Context context = impl.getContext(); 45.148 + final Names names = Names.instance(context); 45.149 + 45.150 + task.addTaskListener(new TaskListener() { 45.151 + 45.152 + @Override 45.153 + public void started(TaskEvent e) {} 45.154 + 45.155 + @Override 45.156 + public void finished(TaskEvent e) { 45.157 + class TheTreeScanner extends TreeScanner { 45.158 + boolean foundAndCorrect = false; 45.159 + 45.160 + @Override 45.161 + public void visitMethodDef(JCTree.JCMethodDecl tree) { 45.162 + ClassSymbol clazz = (ClassSymbol)tree.sym.owner; 45.163 + if (clazz.owner.name.toString().equals(classOwnerName) && 45.164 + tree.sym.name == names.init) { 45.165 + 45.166 + int currentParamPos = 0; 45.167 + int paramArrayIndex = 0; 45.168 + 45.169 + List<VarSymbol> params = tree.sym.params; 45.170 + while (params.nonEmpty() && paramArrayIndex < paramsToCheck.size()) { 45.171 + VarSymbol param = params.head; 45.172 + if (currentParamPos == paramsToCheck.get(paramArrayIndex)) { 45.173 + if (!param.name.toString() 45.174 + .equals(paramNames.get(paramArrayIndex))) { 45.175 + error(paramNameNotCopiedAssertionMsg); 45.176 + } 45.177 + paramArrayIndex++; 45.178 + } 45.179 + currentParamPos++; 45.180 + params = params.tail; 45.181 + } 45.182 + foundAndCorrect = paramArrayIndex >= paramsToCheck.size(); 45.183 + } 45.184 + super.visitMethodDef(tree); 45.185 + } 45.186 + } 45.187 + 45.188 + if (e.getKind() == TaskEvent.Kind.ANALYZE) { 45.189 + CompilationUnitTree compUnitTree = e.getCompilationUnit(); 45.190 + boolean foundAndCorrect = false; 45.191 + for (Tree tree : compUnitTree.getTypeDecls()) { 45.192 + TheTreeScanner scanner = new TheTreeScanner(); 45.193 + scanner.scan((JCTree) tree); 45.194 + foundAndCorrect = foundAndCorrect | scanner.foundAndCorrect; 45.195 + } 45.196 + if (!foundAndCorrect) { 45.197 + error(seekMethodNotFound); 45.198 + } 45.199 + } 45.200 + } 45.201 + }); 45.202 + 45.203 + if (!task.call()) { 45.204 + error(compilationFailed); 45.205 + } 45.206 + } 45.207 + 45.208 + void error(String msg) { 45.209 + throw new AssertionError(msg); 45.210 + } 45.211 + 45.212 + @Target(value = {ElementType.PARAMETER}) 45.213 + @interface ParamAnnotation {} 45.214 + 45.215 + /* If more cases are added in the future, it should be taken into account 45.216 + * that method checkInitSymbol locates the inner class looking for its 45.217 + * container method, which in the cases below are m1 and m2. So new cases 45.218 + * must have different names for container methods or method checkInitSymbol 45.219 + * should be changed. 45.220 + */ 45.221 + public class initParams { 45.222 + public initParams(@ParamAnnotation int i) {} 45.223 + 45.224 + public void m1() { 45.225 + new initParams(2) {}; 45.226 + } 45.227 + } 45.228 + 45.229 + class Generics<T1> { 45.230 + T1 obj1; 45.231 + Object obj2; 45.232 + <T2> Generics(@ParamAnnotation T1 t1, @ParamAnnotation T2 t2) { 45.233 + obj1 = t1; 45.234 + obj2 = t2; 45.235 + } 45.236 + 45.237 + void m2() { 45.238 + Generics<Integer> a = new <String>Generics<Integer>( 45.239 + new Integer(11), "foo") {}; 45.240 + } 45.241 + } 45.242 +}
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 46.2 +++ b/test/tools/javac/generics/inference/8015505/T8015505.java Mon Jun 10 17:04:18 2013 -0700 46.3 @@ -0,0 +1,18 @@ 46.4 +/** 46.5 + * @test /nodynamiccopyright/ 46.6 + * @bug 8015505 46.7 + * @summary Spurious inference error when return type of generic method requires unchecked conversion to target 46.8 + * @compile/fail/ref=T8015505.out -Xlint:-options -source 7 -XDrawDiagnostics T8015505.java 46.9 + * @compile T8015505.java 46.10 + */ 46.11 + 46.12 +import java.util.List; 46.13 + 46.14 +class T8015505 { 46.15 + 46.16 + <Z> List m() { return null; } 46.17 + 46.18 + void test() { 46.19 + List<?> l = m(); 46.20 + } 46.21 +}
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 47.2 +++ b/test/tools/javac/generics/inference/8015505/T8015505.out Mon Jun 10 17:04:18 2013 -0700 47.3 @@ -0,0 +1,2 @@ 47.4 +T8015505.java:16:22: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: Z, java.util.List, java.util.List<?>) 47.5 +1 error
48.1 --- a/test/tools/javac/generics/rawOverride/7062745/GenericOverrideTest.java Thu Jun 06 09:55:26 2013 -0700 48.2 +++ b/test/tools/javac/generics/rawOverride/7062745/GenericOverrideTest.java Mon Jun 10 17:04:18 2013 -0700 48.3 @@ -46,6 +46,17 @@ 48.4 extends JavacTestingAbstractThreadedTest 48.5 implements Runnable { 48.6 48.7 + enum SourceLevel { 48.8 + SOURCE_7("-source", "7"), 48.9 + SOURCE_DEFAULT(); 48.10 + 48.11 + String[] opts; 48.12 + 48.13 + SourceLevel(String... opts) { 48.14 + this.opts = opts; 48.15 + } 48.16 + } 48.17 + 48.18 enum SignatureKind { 48.19 NON_GENERIC(""), 48.20 GENERIC("<X>"); 48.21 @@ -112,12 +123,13 @@ 48.22 } 48.23 } 48.24 48.25 - boolean assignableTo(TypeArgumentKind that, SignatureKind sig) { 48.26 + boolean assignableTo(TypeArgumentKind that, SignatureKind sig, SourceLevel level) { 48.27 switch (this) { 48.28 case NONE: 48.29 //this case needs to workaround to javac's impl of 15.12.2.8 being too strict 48.30 - //ideally should be just 'return true' (see 7067746) 48.31 - return sig == SignatureKind.NON_GENERIC || that == NONE; 48.32 + //ideally should be just 'return true' (see 7067746/8015505) 48.33 + return level == SourceLevel.SOURCE_DEFAULT || 48.34 + sig == SignatureKind.NON_GENERIC || that == NONE; 48.35 case UNBOUND: 48.36 return that == this || that == NONE; 48.37 case INTEGER: 48.38 @@ -143,10 +155,12 @@ 48.39 for (TypeArgumentKind ta3 : TypeArgumentKind.values()) { 48.40 if (!ta3.compatibleWith(SignatureKind.NON_GENERIC)) 48.41 continue; 48.42 - pool.execute( 48.43 - new GenericOverrideTest(sig1, 48.44 - rt1, ta1, sig2, rt2, 48.45 - ta2, rt3, ta3)); 48.46 + for (SourceLevel level : SourceLevel.values()) { 48.47 + pool.execute( 48.48 + new GenericOverrideTest(sig1, 48.49 + rt1, ta1, sig2, rt2, 48.50 + ta2, rt3, ta3, level)); 48.51 + } 48.52 } 48.53 } 48.54 } 48.55 @@ -162,12 +176,13 @@ 48.56 SignatureKind sig1, sig2; 48.57 ReturnTypeKind rt1, rt2, rt3; 48.58 TypeArgumentKind ta1, ta2, ta3; 48.59 + SourceLevel level; 48.60 JavaSource source; 48.61 DiagnosticChecker diagChecker; 48.62 48.63 GenericOverrideTest(SignatureKind sig1, ReturnTypeKind rt1, TypeArgumentKind ta1, 48.64 SignatureKind sig2, ReturnTypeKind rt2, TypeArgumentKind ta2, 48.65 - ReturnTypeKind rt3, TypeArgumentKind ta3) { 48.66 + ReturnTypeKind rt3, TypeArgumentKind ta3, SourceLevel level) { 48.67 this.sig1 = sig1; 48.68 this.sig2 = sig2; 48.69 this.rt1 = rt1; 48.70 @@ -176,6 +191,7 @@ 48.71 this.ta1 = ta1; 48.72 this.ta2 = ta2; 48.73 this.ta3 = ta3; 48.74 + this.level = level; 48.75 this.source = new JavaSource(); 48.76 this.diagChecker = new DiagnosticChecker(); 48.77 } 48.78 @@ -213,7 +229,8 @@ 48.79 @Override 48.80 public void run() { 48.81 JavacTask ct = (JavacTask)comp.getTask(null, fm.get(), diagChecker, 48.82 - null, null, Arrays.asList(source)); 48.83 + level.opts != null ? Arrays.asList(level.opts) : null, 48.84 + null, Arrays.asList(source)); 48.85 try { 48.86 ct.analyze(); 48.87 } catch (Throwable ex) { 48.88 @@ -271,7 +288,7 @@ 48.89 SignatureKind mssig = mostSpecific == 1 ? sig1 : sig2; 48.90 48.91 if (!msrt.moreSpecificThan(rt3) || 48.92 - !msta.assignableTo(ta3, mssig)) { 48.93 + !msta.assignableTo(ta3, mssig, level)) { 48.94 errorExpected = true; 48.95 } 48.96 }
49.1 --- a/test/tools/javac/lambda/TargetType53.java Thu Jun 06 09:55:26 2013 -0700 49.2 +++ b/test/tools/javac/lambda/TargetType53.java Mon Jun 10 17:04:18 2013 -0700 49.3 @@ -26,7 +26,6 @@ 49.4 * @bug 8007464 49.5 * @summary Add graph inference support 49.6 * smoke test for graph inference 49.7 - * @ignore 8008682: Core stream API classes 49.8 * @compile TargetType53.java 49.9 */ 49.10 import java.util.*;
50.1 --- a/test/tools/javac/lambda/TargetType54.java Thu Jun 06 09:55:26 2013 -0700 50.2 +++ b/test/tools/javac/lambda/TargetType54.java Mon Jun 10 17:04:18 2013 -0700 50.3 @@ -26,7 +26,6 @@ 50.4 * @bug 8007464 50.5 * @summary Add graph inference support 50.6 * smoke test for graph inference 50.7 - * @ignore 8008682: Core stream API classes 50.8 * @compile TargetType54.java 50.9 */ 50.10 import java.util.stream.*;
51.1 --- a/test/tools/javac/lambda/TargetType58.java Thu Jun 06 09:55:26 2013 -0700 51.2 +++ b/test/tools/javac/lambda/TargetType58.java Mon Jun 10 17:04:18 2013 -0700 51.3 @@ -26,7 +26,6 @@ 51.4 * @bug 8007464 51.5 * @summary Add graph inference support 51.6 * more smoke tests for graph inference 51.7 - * @ignore 8008682: Core stream API classes 51.8 * @compile TargetType58.java 51.9 */ 51.10 import java.util.*;
52.1 --- a/test/tools/javac/lambda/TargetType59.java Thu Jun 06 09:55:26 2013 -0700 52.2 +++ b/test/tools/javac/lambda/TargetType59.java Mon Jun 10 17:04:18 2013 -0700 52.3 @@ -26,7 +26,6 @@ 52.4 * @bug 8007464 52.5 * @summary Add graph inference support 52.6 * more smoke tests for graph inference 52.7 - * @ignore 8008682: Core stream API classes 52.8 * @compile TargetType59.java 52.9 */ 52.10 import java.util.*;
53.1 --- a/test/tools/javac/lambda/TargetType62.java Thu Jun 06 09:55:26 2013 -0700 53.2 +++ b/test/tools/javac/lambda/TargetType62.java Mon Jun 10 17:04:18 2013 -0700 53.3 @@ -26,7 +26,6 @@ 53.4 * @bug 8007464 53.5 * @summary Add graph inference support 53.6 * check that new wildcards inference strategy doesn't run into 7190296 53.7 - * @ignore 8008682: Core stream API classes 53.8 * @compile TargetType62.java 53.9 */ 53.10 import java.util.*;
54.1 --- a/test/tools/javac/lib/DPrinter.java Thu Jun 06 09:55:26 2013 -0700 54.2 +++ b/test/tools/javac/lib/DPrinter.java Mon Jun 10 17:04:18 2013 -0700 54.3 @@ -403,7 +403,7 @@ 54.4 printType("type", sym.type, Details.SUMMARY); 54.5 printType("erasure", sym.erasure_field, Details.SUMMARY); 54.6 sym.accept(symVisitor, null); 54.7 - printAnnotations("annotations", sym.annotations, Details.SUMMARY); 54.8 + printAnnotations("annotations", sym.getAnnotations(), Details.SUMMARY); 54.9 indent(-1); 54.10 } 54.11 }