# HG changeset patch # User lana # Date 1404927733 25200 # Node ID cf09dddb6caf624db36b457c4786e96a87a052d2 # Parent b67086d205bbf709c3b7e1a09c10a64ad3871c71# Parent a2e7f254f8868769f5dca49e849ab5326d6ba1d6 Merge diff -r b67086d205bb -r cf09dddb6caf langtools/.hgignore --- a/langtools/.hgignore Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/.hgignore Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,6 @@ ^build/ ^dist/ +^.idea /nbproject/private/ ^.hgtip .DS_Store diff -r b67086d205bb -r cf09dddb6caf langtools/make/build.xml --- a/langtools/make/build.xml Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/make/build.xml Wed Jul 09 10:42:13 2014 -0700 @@ -752,6 +752,17 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/make/intellij/codeStyleSettings.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/make/intellij/codeStyleSettings.xml Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,17 @@ + + + + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/make/intellij/compiler.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/make/intellij/compiler.xml Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,30 @@ + + + + + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/make/intellij/inspectionProfiles/langtools.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/make/intellij/inspectionProfiles/langtools.xml Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,26 @@ + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/make/intellij/inspectionProfiles/profiles_settings.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/make/intellij/inspectionProfiles/profiles_settings.xml Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,7 @@ + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/make/intellij/langtools.iml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/make/intellij/langtools.iml Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/make/intellij/misc.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/make/intellij/misc.xml Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/make/intellij/modules.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/make/intellij/modules.xml Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,9 @@ + + + + + + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/make/intellij/vcs.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/make/intellij/vcs.xml Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,7 @@ + + + + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/make/intellij/workspace.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/make/intellij/workspace.xml Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/javadoc/AnnotatedType.java --- a/langtools/src/share/classes/com/sun/javadoc/AnnotatedType.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/javadoc/AnnotatedType.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,15 @@ */ public interface AnnotatedType extends Type { + /** + * Returns the annotations associated with this type. + * @return the annotations associated with this type + */ AnnotationDesc[] annotations(); + /** + * Returns the underlying type. + * @return the underlying type + */ Type underlyingType(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/AttributeTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/AttributeTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/AttributeTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,10 +35,36 @@ */ @jdk.Exported public interface AttributeTree extends DocTree { + /** + * The kind of an attribute value. + */ @jdk.Exported - enum ValueKind { EMPTY, UNQUOTED, SINGLE, DOUBLE } + enum ValueKind { + /** The attribute value is empty. */ + EMPTY, + /** The attribute value is not enclosed in quotes. */ + UNQUOTED, + /** The attribute value is enclosed in single quotation marks. */ + SINGLE, + /** The attribute value is enclosed in double quotation marks. */ + DOUBLE + } + /** + * Returns the name of the attribute. + * @return the name of the attribute + */ Name getName(); + + /** + * Returns the kind of the attribute. + * @return the kind of the attribute. + */ ValueKind getValueKind(); + + /** + * Returns the value of the attribute, or {@code null} if the kind is EMPTY. + * @return the value of the attribute. + */ List getValue(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/AuthorTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/AuthorTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/AuthorTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,9 @@ */ @jdk.Exported public interface AuthorTree extends BlockTagTree { + /** + * Returns the name of the author. + * @return the name + */ List getName(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/BlockTagTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/BlockTagTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/BlockTagTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,5 +33,9 @@ */ @jdk.Exported public interface BlockTagTree extends DocTree { + /** + * Returns the name of the tag. + * @return the name of the tag + */ String getTagName(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/CommentTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/CommentTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/CommentTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,10 @@ */ @jdk.Exported public interface CommentTree extends DocTree { + /** + * Returns the text of the comment. + * @return the comment text + */ String getBody(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/DeprecatedTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/DeprecatedTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/DeprecatedTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,9 @@ */ @jdk.Exported public interface DeprecatedTree extends BlockTagTree { + /** + * Returns the description explaining why an item is deprecated. + * @return the description + */ List getBody(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/DocCommentTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/DocCommentTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/DocCommentTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,22 @@ */ @jdk.Exported public interface DocCommentTree extends DocTree { + /** + * Returns the first sentence of a documentation comment. + * @return the first sentence of a documentation comment + */ List getFirstSentence(); + + /** + * Returns the body of a documentation comment, + * appearing after the first sentence, and before any block tags. + * @return the body of a documentation comment + */ List getBody(); + + /** + * Returns the block tags for a documentation comment. + * @return the block tags of a documentation comment + */ List getBlockTags(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/DocTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/DocTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/DocTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,9 @@ */ @jdk.Exported public interface DocTree { + /** + * Enumerates all kinds of trees. + */ @jdk.Exported enum Kind { /** @@ -227,6 +230,9 @@ */ OTHER; + /** + * The name of the tag, if any, associated with this kind of node. + */ public final String tagName; Kind() { @@ -239,7 +245,7 @@ } /** - * Gets the kind of this tree. + * Returns the kind of this tree. * * @return the kind of this tree. */ @@ -251,6 +257,9 @@ * * @param result type of this operation. * @param type of additional data. + * @param visitor the visitor to be called + * @param data a parameter value to be passed to the visitor method + * @return the value returned from the visitor method */ R accept(DocTreeVisitor visitor, D data); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/DocTreeVisitor.java --- a/langtools/src/share/classes/com/sun/source/doctree/DocTreeVisitor.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/DocTreeVisitor.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,33 +56,238 @@ */ @jdk.Exported public interface DocTreeVisitor { + + /** + * Visits an AttributeTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitAttribute(AttributeTree node, P p); + + /** + * Visits an AuthorTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitAuthor(AuthorTree node, P p); + + /** + * Visits a CommentTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitComment(CommentTree node, P p); + + /** + * Visits a DeprecatedTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitDeprecated(DeprecatedTree node, P p); + + /** + * Visits a DocCommentTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitDocComment(DocCommentTree node, P p); + + /** + * Visits a DocRootTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitDocRoot(DocRootTree node, P p); + + /** + * Visits an EndElementTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitEndElement(EndElementTree node, P p); + + /** + * Visits an EntityTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitEntity(EntityTree node, P p); + + /** + * Visits an ErroneousTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitErroneous(ErroneousTree node, P p); + + /** + * Visits an IdentifierTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitIdentifier(IdentifierTree node, P p); + + /** + * Visits an InheritDocTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitInheritDoc(InheritDocTree node, P p); + + /** + * Visits a LinkTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitLink(LinkTree node, P p); + + /** + * Visits an LiteralTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitLiteral(LiteralTree node, P p); + + /** + * Visits a ParamTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitParam(ParamTree node, P p); + + /** + * Visits a ReferenceTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitReference(ReferenceTree node, P p); + + /** + * Visits a ReturnTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitReturn(ReturnTree node, P p); + + /** + * Visits a SeeTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitSee(SeeTree node, P p); + + /** + * Visits a SerialTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitSerial(SerialTree node, P p); + + /** + * Visits a SerialDataTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitSerialData(SerialDataTree node, P p); + + /** + * Visits a SerialFieldTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitSerialField(SerialFieldTree node, P p); + + /** + * Visits a SinceTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitSince(SinceTree node, P p); + + /** + * Visits a StartElementTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitStartElement(StartElementTree node, P p); + + /** + * Visits a TextTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitText(TextTree node, P p); + + /** + * Visits a ThrowsTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitThrows(ThrowsTree node, P p); + + /** + * Visits an UnknownBlockTagTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitUnknownBlockTag(UnknownBlockTagTree node, P p); + + /** + * Visits an UnknownInlineTagTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitUnknownInlineTag(UnknownInlineTagTree node, P p); + + /** + * Visits a ValueTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitValue(ValueTree node, P p); + + /** + * Visits a VersionTreeTree node. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitVersion(VersionTree node, P p); + + /** + * Visits an unknown type of DocTree node. + * This can occur if the set of tags evolves and new kinds + * of nodes are added to the {@code DocTree} hierarchy. + * @param node the node being visited + * @param p a parameter value + * @return a result value + */ R visitOther(DocTree node, P p); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/EndElementTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/EndElementTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/EndElementTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,9 @@ */ @jdk.Exported public interface EndElementTree extends DocTree { + /** + * Returns the name of this element. + * @return the name + */ Name getName(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/EntityTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/EntityTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/EntityTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,11 +32,17 @@ * A tree node for an HTML entity. * *

- * & name ; + * & name ;
+ * & # digits ;
+ * & #X hex-digits ; * * @since 1.8 */ @jdk.Exported public interface EntityTree extends DocTree { + /** + * Returns the name or value of the entity. + * @return the name or value of the entity + */ Name getName(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/ErroneousTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/ErroneousTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/ErroneousTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ @jdk.Exported public interface ErroneousTree extends TextTree { /** - * Gets a diagnostic object giving details about + * Returns a diagnostic object giving details about * the reason the body text is in error. * * @return a diagnostic diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/IdentifierTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/IdentifierTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/IdentifierTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,9 @@ */ @jdk.Exported public interface IdentifierTree extends DocTree { + /** + * Returns the name of the identifier. + * @return the name + */ Name getName(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/InlineTagTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/InlineTagTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/InlineTagTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,5 +33,9 @@ */ @jdk.Exported public interface InlineTagTree extends DocTree { + /** + * Returns the name of the tag. + * @return the name of the tag + */ String getTagName(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/LinkTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/LinkTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/LinkTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,15 @@ */ @jdk.Exported public interface LinkTree extends InlineTagTree { + /** + * Returns the reference of a link. + * @return the reference + */ ReferenceTree getReference(); + + /** + * Returns the label, if any, of the link. + * @return the label + */ List getLabel(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/LiteralTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/LiteralTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/LiteralTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,5 +36,9 @@ */ @jdk.Exported public interface LiteralTree extends InlineTagTree { + /** + * Returns the body of the {@code @code} or {@code @literal} tag. + * @return the body of the tag + */ TextTree getBody(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/ParamTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/ParamTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/ParamTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,21 @@ */ @jdk.Exported public interface ParamTree extends BlockTagTree { + /** + * Returns true if this is documenting a type parameter. + * @return true if this is documenting a type parameter + */ boolean isTypeParameter(); + + /** + * Returns the name of the parameter. + * @return the name of the parameter + */ IdentifierTree getName(); + + /** + * Returns the description of the parameter. + * @return the description + */ List getDescription(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/ReferenceTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/ReferenceTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/ReferenceTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,20 @@ package com.sun.source.doctree; /** - * A tree node to a reference to a Java language element. + * A tree node for a reference to a Java language element. * *

* package.class#field + * package.class#method(arg-types) * * @since 1.8 */ @jdk.Exported public interface ReferenceTree extends DocTree { + /** + * Returns the signature of the Java language element being referenced, + * as found in {@code @see} and similar nodes. + * @return the signature. + */ String getSignature(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/ReturnTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/ReturnTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/ReturnTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,9 @@ */ @jdk.Exported public interface ReturnTree extends BlockTagTree { + /** + * Returns the description of the return value of a method. + * @return the description + */ List getDescription(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/SeeTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/SeeTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/SeeTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,5 +40,9 @@ */ @jdk.Exported public interface SeeTree extends BlockTagTree { + /** + * Returns the reference. + * @return the reference + */ List getReference(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/SerialDataTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/SerialDataTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/SerialDataTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,9 @@ */ @jdk.Exported public interface SerialDataTree extends BlockTagTree { + /** + * Returns the description of the serial data. + * @return the description + */ List getDescription(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/SerialFieldTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/SerialFieldTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/SerialFieldTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,21 @@ */ @jdk.Exported public interface SerialFieldTree extends BlockTagTree { + /** + * Returns the name of the serial field. + * @return the name of the serial field + */ IdentifierTree getName(); + + /** + * Returns the type of the serial field. + * @return the type of the serial field + */ ReferenceTree getType(); + + /** + * Returns the description of the serial field. + * @return the description of the serial field + */ List getDescription(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/SerialTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/SerialTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/SerialTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,10 @@ */ @jdk.Exported public interface SerialTree extends BlockTagTree { + /** + * Returns the description of the field, or the word + * "include" or "exclude". + * @return the description of the field + */ List getDescription(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/SinceTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/SinceTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/SinceTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,9 @@ */ @jdk.Exported public interface SinceTree extends BlockTagTree { + /** + * Returns the text explaining the availability of the item being documented. + * @return the text + */ List getBody(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/StartElementTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/StartElementTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/StartElementTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,22 @@ */ @jdk.Exported public interface StartElementTree extends DocTree { + /** + * Returns the name of the element. + * @return the name + */ Name getName(); + + /** + * Returns any attributes defined by this element. + * @return the attributes + */ List getAttributes(); + + /** + * Returns true if this is a self-closing element, + * as indicated by a "/" before the closing ">". + * @return true if this is a self-closing element + */ boolean isSelfClosing(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/TextTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/TextTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/TextTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,5 +32,9 @@ */ @jdk.Exported public interface TextTree extends DocTree { + /** + * Returns the text. + * @return the text + */ String getBody(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/ThrowsTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/ThrowsTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/ThrowsTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,16 @@ */ @jdk.Exported public interface ThrowsTree extends BlockTagTree { + /** + * Returns a name of the exception being documented. + * @return the name of the exception + */ ReferenceTree getExceptionName(); + + /** + * Returns the description of the reasons why the + * exception may be thrown. + * @return the description + */ List getDescription(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/UnknownBlockTagTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/UnknownBlockTagTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/UnknownBlockTagTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,9 @@ */ @jdk.Exported public interface UnknownBlockTagTree extends BlockTagTree { + /** + * Returns the content of an unrecognized block tag. + * @return the content + */ List getContent(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/UnknownInlineTagTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/UnknownInlineTagTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/UnknownInlineTagTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,5 +37,9 @@ */ @jdk.Exported public interface UnknownInlineTagTree extends InlineTagTree { + /** + * Returns the content of an unrecognized inline tag. + * @return the content + */ List getContent(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/ValueTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/ValueTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/ValueTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,5 +35,9 @@ */ @jdk.Exported public interface ValueTree extends InlineTagTree { + /** + * Returns the reference to the value. + * @return the reference + */ ReferenceTree getReference(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/doctree/VersionTree.java --- a/langtools/src/share/classes/com/sun/source/doctree/VersionTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/doctree/VersionTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,5 +38,9 @@ */ @jdk.Exported public interface VersionTree extends BlockTagTree { + /** + * Returns the body of the tag. + * @return the body + */ List getBody(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/AnnotatedTypeTree.java --- a/langtools/src/share/classes/com/sun/source/tree/AnnotatedTypeTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/AnnotatedTypeTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ import java.util.List; /** - * A tree node for an annotated type + * A tree node for an annotated type. * * For example: *

@@ -43,6 +43,15 @@
  */
 @jdk.Exported
 public interface AnnotatedTypeTree extends ExpressionTree {
+    /**
+     * Returns the annotations associated with this type expression.
+     * @return the annotations
+     */
     List getAnnotations();
+
+    /**
+     * Returns the underlying type with which the annotations are associated.
+     * @return the underlying type
+     */
     ExpressionTree getUnderlyingType();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/AnnotationTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/AnnotationTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/AnnotationTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,15 @@
  */
 @jdk.Exported
 public interface AnnotationTree extends ExpressionTree {
+    /**
+     * Returns the annotation type.
+     * @return the annotation type
+     */
     Tree getAnnotationType();
+
+    /**
+     * Returns the arguments, if any, for the annotation.
+     * @return the arguments for the annotation type
+     */
     List getArguments();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ArrayAccessTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ArrayAccessTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ArrayAccessTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,15 @@
  */
 @jdk.Exported
 public interface ArrayAccessTree extends ExpressionTree {
+    /**
+     * Returns the expression for the array being accessed.
+     * @return the array
+     */
     ExpressionTree getExpression();
+
+    /**
+     * Returns the expression for the index.
+     * @return the index
+     */
     ExpressionTree getIndex();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ArrayTypeTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ArrayTypeTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ArrayTypeTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,5 +41,9 @@
  */
 @jdk.Exported
 public interface ArrayTypeTree extends Tree {
+    /**
+     * Returns the element type of this array type.
+     * @return the element type
+     */
     Tree getType();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/AssertTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/AssertTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/AssertTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.source.tree;
 
 /**
- * A tree node for an 'assert' statement.
+ * A tree node for an {@code assert} statement.
  *
  * For example:
  * 
@@ -43,6 +43,15 @@
  */
 @jdk.Exported
 public interface AssertTree extends StatementTree {
+    /**
+     * Returns the condition being asserted.
+     * @return the condition
+     */
     ExpressionTree getCondition();
+
+    /**
+     * Returns the detail expression.
+     * @return the detail expression
+     */
     ExpressionTree getDetail();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/AssignmentTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/AssignmentTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/AssignmentTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,15 @@
  */
 @jdk.Exported
 public interface AssignmentTree extends ExpressionTree {
+    /**
+     * Returns the variable being assigned to.
+     * @return the variable
+     */
     ExpressionTree getVariable();
+
+    /**
+     * Returns the expression being assigned to the variable.
+     * @return the expression
+     */
     ExpressionTree getExpression();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/BinaryTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/BinaryTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/BinaryTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,15 @@
  */
 @jdk.Exported
 public interface BinaryTree extends ExpressionTree {
+    /**
+     * Returns the left (first) operand of the expression.
+     * @return the left operand
+     */
     ExpressionTree getLeftOperand();
+
+    /**
+     * Returns the right (second) operand of the expression.
+     * @return the right operand
+     */
     ExpressionTree getRightOperand();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/BlockTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/BlockTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/BlockTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,15 @@
  */
 @jdk.Exported
 public interface BlockTree extends StatementTree {
+    /**
+     * Returns true if and only if this is a static initializer block.
+     * @return true if this is a static initializer block
+     */
     boolean isStatic();
+
+    /**
+     * Returns the statements comprising this block.
+     * @return the statements
+     */
     List getStatements();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/BreakTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/BreakTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/BreakTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import javax.lang.model.element.Name;
 
 /**
- * A tree node for a 'break' statement.
+ * A tree node for a {@code break} statement.
  *
  * For example:
  * 
@@ -45,5 +45,9 @@
  */
 @jdk.Exported
 public interface BreakTree extends StatementTree {
+    /**
+     * Returns the label for this {@code break} statement.
+     * @return the label
+     */
     Name getLabel();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/CaseTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/CaseTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/CaseTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import java.util.List;
 
 /**
- * A tree node for a 'case' in a 'switch' statement.
+ * A tree node for a {@code case} in a {@code switch} statement.
  *
  * For example:
  * 
@@ -48,8 +48,15 @@
 @jdk.Exported
 public interface CaseTree extends Tree {
     /**
-     * @return null if and only if this Case is {@code default:}
+     * Returns the expression for the case, or
+     * {@code null} if this is the default case.
+     * @return the expression for the case, or null
      */
     ExpressionTree getExpression();
+
+    /**
+     * Returns the statements labeled by the case.
+     * @return the statements labeled by the case
+     */
     List getStatements();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/CatchTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/CatchTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/CatchTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.source.tree;
 
 /**
- * A tree node for a 'catch' block in a 'try' statement.
+ * A tree node for a {@code catch} block in a {@code try} statement.
  *
  * For example:
  * 
@@ -42,6 +42,18 @@
  */
 @jdk.Exported
 public interface CatchTree extends Tree {
+    /**
+     * Returns the catch variable.
+     * A multi-catch variable will have a
+     * {@link UnionTypeTree UnionTypeTree}
+     * as the type of the variable.
+     * @return the catch variable
+     */
     VariableTree getParameter();
+
+    /**
+     * Returns the catch block.
+     * @return the catch block
+     */
     BlockTree getBlock();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ClassTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ClassTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ClassTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,10 +50,41 @@
  */
 @jdk.Exported
 public interface ClassTree extends StatementTree {
+    /**
+     * Returns the modifiers, including any annotations,
+     * for this type declaration.
+     * @return the modifiers
+     */
     ModifiersTree getModifiers();
+
+    /**
+     * Returns the simple name of this type declaration.
+     * @return the simple name
+     */
     Name getSimpleName();
+
+    /**
+     * Returns any type parameters of this type declaration.
+     * @return the type parameters
+     */
     List getTypeParameters();
+
+    /**
+     * Returns the supertype of this type declaration,
+     * or {@code null} if none is provided.
+     * @return the supertype
+     */
     Tree getExtendsClause();
+
+    /**
+     * Returns the interfaces implemented by this type declaration.
+     * @return the interfaces
+     */
     List getImplementsClause();
+
+    /**
+     * Returns the members declared in this type declaration.
+     * @return the members
+     */
     List getMembers();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/CompilationUnitTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/CompilationUnitTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/CompilationUnitTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,21 +39,53 @@
  */
 @jdk.Exported
 public interface CompilationUnitTree extends Tree {
+    /**
+     * Returns the annotations listed on any package declaration
+     * at the head of this compilation unit, or {@code null} if there
+     * is no package declaration.
+     * @return the package annotations
+     */
     List getPackageAnnotations();
+
+    /**
+     * Returns the name contained in any package declaration
+     * at the head of this compilation unit, or {@code null} if there
+     * is no package declaration.
+     * @return the package name
+     */
     ExpressionTree getPackageName();
 
     /**
-     * Return the PackageTree associated with this compilation unit.
+     * Returns the package tree associated with this compilation unit,
+     * or {@code null} if there is no package declaration.
+     * @return the package tree
      * @since 1.9
      */
     PackageTree getPackage();
+
+    /**
+     * Returns the import declarations appearing in this compilation unit.
+     * @return the import declarations
+     */
     List getImports();
+
+    /**
+     * Returns the type declarations appearing in this compilation unit.
+     * The list may also include empty statements resulting from
+     * extraneous semicolons.
+     * @return the type declarations
+     */
     List getTypeDecls();
+
+    /**
+     * Returns the file object containing the source for this compilation unit.
+     * @return the file object
+     */
     JavaFileObject getSourceFile();
 
     /**
-     * Gets the line map for this compilation unit, if available.
-     * Returns null if the line map is not available.
+     * Returns the line map for this compilation unit, if available.
+     * Returns {@code null} if the line map is not available.
      * @return the line map for this compilation unit
      */
     LineMap getLineMap();
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/CompoundAssignmentTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/CompoundAssignmentTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/CompoundAssignmentTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,15 @@
  */
 @jdk.Exported
 public interface CompoundAssignmentTree extends ExpressionTree {
+    /**
+     * Returns the variable on the left hand side of the compound assignment.
+     * @return the variable
+     */
     ExpressionTree getVariable();
+
+    /**
+     * Returns the expression on the right hand side of the compound assignment.
+     * @return the expression
+     */
     ExpressionTree getExpression();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ConditionalExpressionTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ConditionalExpressionTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ConditionalExpressionTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,21 @@
  */
 @jdk.Exported
 public interface ConditionalExpressionTree extends ExpressionTree {
+    /**
+     * Returns the condition.
+     * @return the condition
+     */
     ExpressionTree getCondition();
+
+    /**
+     * Returns the expression to be evaluated if the condition is true.
+     * @return the expression to be evaluated if the condition is true
+     */
     ExpressionTree getTrueExpression();
+
+    /**
+     * Returns the expression to be evaluated if the condition is false.
+     * @return the expression to be evaluated if the condition is false
+     */
     ExpressionTree getFalseExpression();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ContinueTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ContinueTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ContinueTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import javax.lang.model.element.Name;
 
 /**
- * A tree node for a 'continue' statement.
+ * A tree node for a {@code continue} statement.
  *
  * For example:
  * 
@@ -44,5 +44,9 @@
  */
 @jdk.Exported
 public interface ContinueTree extends StatementTree {
+    /**
+     * Returns the label for this {@code continue} statement.
+     * @return the label
+     */
     Name getLabel();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/DoWhileLoopTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/DoWhileLoopTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/DoWhileLoopTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.source.tree;
 
 /**
- * A tree node for a 'do' statement.
+ * A tree node for a {@code do} statement.
  *
  * For example:
  * 
@@ -43,6 +43,15 @@
  */
 @jdk.Exported
 public interface DoWhileLoopTree extends StatementTree {
+    /**
+     * Returns the condition of the loop.
+     * @return the condition
+     */
     ExpressionTree getCondition();
+
+    /**
+     * Returns the body of the loop.
+     * @return the body of the loop
+     */
     StatementTree getStatement();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/EnhancedForLoopTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/EnhancedForLoopTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/EnhancedForLoopTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.source.tree;
 
 /**
- * A tree node for an "enhanced" 'for' loop statement.
+ * A tree node for an "enhanced" {@code for} loop statement.
  *
  * For example:
  * 
@@ -42,7 +42,21 @@
  */
 @jdk.Exported
 public interface EnhancedForLoopTree extends StatementTree {
+    /**
+     * Returns the control variable for the loop.
+     * @return the control variable
+     */
     VariableTree getVariable();
+
+    /**
+     * Returns the expression yielding the values for the control variable.
+     * @return the expression
+     */
     ExpressionTree getExpression();
+
+    /**
+     * Returns the body of the loop.
+     * @return the body of the loop
+     */
     StatementTree getStatement();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ErroneousTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ErroneousTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ErroneousTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,5 +36,9 @@
  */
 @jdk.Exported
 public interface ErroneousTree extends ExpressionTree {
+    /**
+     * Returns any trees that were saved in this node.
+     * @return the trees
+     */
     List getErrorTrees();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ExpressionStatementTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ExpressionStatementTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ExpressionStatementTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,5 +41,9 @@
  */
 @jdk.Exported
 public interface ExpressionStatementTree extends StatementTree {
+    /**
+     * Returns the expression constituting this statement.
+     * @return the expression
+     */
     ExpressionTree getExpression();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ForLoopTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ForLoopTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ForLoopTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import java.util.List;
 
 /**
- * A tree node for a basic 'for' loop statement.
+ * A tree node for a basic {@code for} loop statement.
  *
  * For example:
  * 
@@ -44,8 +44,30 @@
  */
 @jdk.Exported
 public interface ForLoopTree extends StatementTree {
+    /**
+     * Returns any initializers of the {@code for} statement.
+     * The result will be an empty list if there are
+     * no initializers
+     * @return the initializers
+     */
     List getInitializer();
+
+    /**
+     * Returns the condition of the {@code for} statement.
+     * May be {@code null} if there is no condition.
+     * @return the condition
+     */
     ExpressionTree getCondition();
+
+    /**
+     * Returns any update expressions of the {@code for} statement.
+     * @return the update expressions
+     */
     List getUpdate();
+
+    /**
+     * Returns the body of the {@code for} statement.
+     * @return the body
+     */
     StatementTree getStatement();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/IdentifierTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/IdentifierTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/IdentifierTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,5 +43,9 @@
  */
 @jdk.Exported
 public interface IdentifierTree extends ExpressionTree {
+    /**
+     * Returns the name of the identifier.
+     * @return the name
+     */
     Name getName();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/IfTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/IfTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/IfTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.source.tree;
 
 /**
- * A tree node for an 'if' statement.
+ * A tree node for an {@code if} statement.
  *
  * For example:
  * 
@@ -47,10 +47,22 @@
  */
 @jdk.Exported
 public interface IfTree extends StatementTree {
+    /**
+     * Returns the condition of the if-statement.
+     * @return the condition
+     */
     ExpressionTree getCondition();
+
+    /**
+     * Returns the statement to be executed if the condition is true
+     * @return the statement to be executed if the condition is true
+     */
     StatementTree getThenStatement();
+
     /**
-     * @return null if this if statement has no else branch.
+     * Returns the statement to be executed if the condition is false,
+     * or {@code null} if there is no such statement.
+     * @return the statement to be executed if the condition is false
      */
     StatementTree getElseStatement();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ImportTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ImportTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ImportTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,10 +43,19 @@
  */
 @jdk.Exported
 public interface ImportTree extends Tree {
+    /**
+     * Returns true if this is a static import declaration.
+     * @return true if this is a static import
+     */
     boolean isStatic();
+
     /**
-     * @return a qualified identifier ending in "*" if and only if
-     * this is an import-on-demand.
+     * Returns the qualified identifier for the declaration(s)
+     * being imported.
+     * If this is an import-on-demand declaration, the
+     * qualified identifier will end in "*".
+     * @return a qualified identifier, ending in "*" if and only if
+     * this is an import-on-demand
      */
     Tree getQualifiedIdentifier();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/InstanceOfTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/InstanceOfTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/InstanceOfTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.source.tree;
 
 /**
- * A tree node for an 'instanceof' expression.
+ * A tree node for an {@code instanceof} expression.
  *
  * For example:
  * 
@@ -41,6 +41,15 @@
  */
 @jdk.Exported
 public interface InstanceOfTree extends ExpressionTree {
+    /**
+     * Returns the expression to be tested.
+     * @return the expression
+     */
     ExpressionTree getExpression();
+
+    /**
+     * Returns the type for which to check.
+     * @return the type
+     */
     Tree getType();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/IntersectionTypeTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/IntersectionTypeTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/IntersectionTypeTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,5 +36,9 @@
  */
 @jdk.Exported
 public interface IntersectionTypeTree extends Tree {
+    /**
+     * Returns the bounds of the type.
+     * @return the bounds
+     */
     List getBounds();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/LabeledStatementTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/LabeledStatementTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/LabeledStatementTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,15 @@
  */
 @jdk.Exported
 public interface LabeledStatementTree extends StatementTree {
+    /**
+     * Returns the label.
+     * @return the label
+     */
     Name getLabel();
+
+    /**
+     * Returns the statement that is labeled.
+     * @return the statement
+     */
     StatementTree getStatement();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/LambdaExpressionTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,8 +41,11 @@
 public interface LambdaExpressionTree extends ExpressionTree {
 
     /**
-     * Lambda expressions come in two forms: (i) expression lambdas, whose body
-     * is an expression, and (ii) statement lambdas, whose body is a block
+     * Lambda expressions come in two forms:
+     * 
    + *
  • expression lambdas, whose body is an expression, and + *
  • statement lambdas, whose body is a block + *
*/ @jdk.Exported public enum BodyKind { @@ -52,7 +55,21 @@ STATEMENT } + /** + * Returns the parameters of this lambda expression. + * @return the parameters + */ List getParameters(); + + /** + * Returns the body of the lambda expression. + * @return the body + */ Tree getBody(); + + /** + * Returns the kind of the body of the lambda expression. + * @return the kind of the body + */ BodyKind getBodyKind(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/LineMap.java --- a/langtools/src/share/classes/com/sun/source/tree/LineMap.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/LineMap.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ @jdk.Exported public interface LineMap { /** - * Find the start position of a line. + * Finds the start position of a line. * * @param line line number (beginning at 1) * @return position of first character in line @@ -45,7 +45,7 @@ long getStartPosition(long line); /** - * Find the position corresponding to a (line,column). + * Finds the position corresponding to a (line,column). * * @param line line number (beginning at 1) * @param column tab-expanded column number (beginning 1) @@ -58,7 +58,7 @@ long getPosition(long line, long column); /** - * Find the line containing a position; a line termination + * Finds the line containing a position; a line termination * character is on the line it terminates. * * @param pos character offset of the position @@ -67,7 +67,7 @@ long getLineNumber(long pos); /** - * Find the column for a character position. + * Finds the column for a character position. * Tab characters preceding the position on the same line * will be expanded when calculating the column number. * diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/LiteralTree.java --- a/langtools/src/share/classes/com/sun/source/tree/LiteralTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/LiteralTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,5 +42,10 @@ */ @jdk.Exported public interface LiteralTree extends ExpressionTree { + /** + * Returns the value of the literal expression. + * The value will be a boxed primitive value, a String, or {@code null}. + * @return the value + */ Object getValue(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/MemberReferenceTree.java --- a/langtools/src/share/classes/com/sun/source/tree/MemberReferenceTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/MemberReferenceTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,13 +48,33 @@ */ @jdk.Exported public enum ReferenceMode { - /** enum constant for method references */ + /** enum constant for method references. */ INVOKE, - /** enum constant for constructor references */ + /** enum constant for constructor references. */ NEW } + + /** + * Returns the mode of the reference. + * @return the mode + */ ReferenceMode getMode(); + + /** + * Returns the qualifier expression for the reference. + * @return the qualifier expression + */ ExpressionTree getQualifierExpression(); + + /** + * Returns the name of the reference. + * @return the name + */ Name getName(); + + /** + * Returns the type arguments for the reference. + * @return the type arguments + */ List getTypeArguments(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/MemberSelectTree.java --- a/langtools/src/share/classes/com/sun/source/tree/MemberSelectTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/MemberSelectTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,15 @@ */ @jdk.Exported public interface MemberSelectTree extends ExpressionTree { + /** + * Returns the expression for which a member is to be selected. + * @return the expression. + */ ExpressionTree getExpression(); + + /** + * Returns the name of the member to be selected. + * @return the member + */ Name getIdentifier(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/MethodInvocationTree.java --- a/langtools/src/share/classes/com/sun/source/tree/MethodInvocationTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/MethodInvocationTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,21 @@ */ @jdk.Exported public interface MethodInvocationTree extends ExpressionTree { + /** + * Returns the type arguments for this method invocation. + * @return the type arguments + */ List getTypeArguments(); + + /** + * Returns the expression identifying the method to be invoked. + * @return the method selection expression + */ ExpressionTree getMethodSelect(); + + /** + * Returns the arguments for the method invocation. + * @return the arguments + */ List getArguments(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/MethodTree.java --- a/langtools/src/share/classes/com/sun/source/tree/MethodTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/MethodTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,21 +48,63 @@ */ @jdk.Exported public interface MethodTree extends Tree { + /** + * Returns the modifiers, including any annotations for the method being declared. + * @return the modifiers + */ ModifiersTree getModifiers(); + + /** + * Returns the name of the method being declared. + * @return the name + */ Name getName(); + + /** + * Returns the return type of the method being declared. + * Returns {@code null} for a constructor. + * @return the return type + */ Tree getReturnType(); + + /** + * Returns the type parameters of the method being declared. + * @return the type parameters + */ List getTypeParameters(); + + /** + * Returns the parameters of the method being declared. + * @return the parameters + */ List getParameters(); /** - * Return an explicit receiver parameter ("this" parameter). + * Return an explicit receiver parameter ("this" parameter), + * or {@code null} if none. * * @return an explicit receiver parameter ("this" parameter) * @since 1.8 */ VariableTree getReceiverParameter(); + /** + * Returns the exceptions listed as being thrown by this method. + * @return the exceptions + */ List getThrows(); + + /** + * Returns the method body, or {@code null} if this is an abstract or native method. + * @return the method body + */ BlockTree getBody(); + + /** + * Returns the default value, if this is an element within + * an annotation type declaration. + * Returns {@code null} otherwise. + * @return the default value + */ Tree getDefaultValue(); // for annotation types } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ModifiersTree.java --- a/langtools/src/share/classes/com/sun/source/tree/ModifiersTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/ModifiersTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,15 @@ */ @jdk.Exported public interface ModifiersTree extends Tree { + /** + * Returns the flags in this modifiers tree. + * @return the flags + */ Set getFlags(); + + /** + * Returns the annotations in this modifiers tree. + * @return the annotations + */ List getAnnotations(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java --- a/langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,9 +45,37 @@ */ @jdk.Exported public interface NewArrayTree extends ExpressionTree { + /** + * Returns the base type of the expression. + * May be {@code null} for an array initializer expression. + * @return the base type + */ Tree getType(); + + /** + * Returns the dimension expressions for the type. + * + * @return the dimension expressions + */ List getDimensions(); + + /** + * Returns the initializer expressions. + * + * @return the initializer expressions + */ List getInitializers(); + + /** + * Returns the annotations on the base type. + * @return the annotations + */ List getAnnotations(); + + /** + * Returns the annotations on each of the dimension + * expressions. + * @return the annotations on the dimensions expressions + */ List> getDimAnnotations(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/NewClassTree.java --- a/langtools/src/share/classes/com/sun/source/tree/NewClassTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/NewClassTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,9 +50,34 @@ */ @jdk.Exported public interface NewClassTree extends ExpressionTree { + /** + * Returns the enclosing expression, or {@code null} if none. + * @return the enclosing expression + */ ExpressionTree getEnclosingExpression(); + + /** + * Returns the type arguments for the object being created. + * @return the type arguments + */ List getTypeArguments(); + + /** + * Returns the name of the class being instantiated. + * @return the name + */ ExpressionTree getIdentifier(); + + /** + * Returns the arguments for the constructor to be invoked. + * @return the arguments + */ List getArguments(); + + /** + * Returns the class body if an anonymous class is being + * instantiated, and {@code null} otherwise. + * @return the class body + */ ClassTree getClassBody(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/PackageTree.java --- a/langtools/src/share/classes/com/sun/source/tree/PackageTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/PackageTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -37,6 +37,15 @@ */ @jdk.Exported public interface PackageTree extends Tree { + /** + * Returns the annotations associated with this package declaration. + * @return the annotations + */ List getAnnotations(); + + /** + * Returns the name of the package being declared. + * @return the name + */ ExpressionTree getPackageName(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ParameterizedTypeTree.java --- a/langtools/src/share/classes/com/sun/source/tree/ParameterizedTypeTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/ParameterizedTypeTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,15 @@ */ @jdk.Exported public interface ParameterizedTypeTree extends Tree { + /** + * Returns the base type. + * @return the base type + */ Tree getType(); + + /** + * Returns the type arguments. + * @return the type arguments + */ List getTypeArguments(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ParenthesizedTree.java --- a/langtools/src/share/classes/com/sun/source/tree/ParenthesizedTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/ParenthesizedTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,5 +42,9 @@ */ @jdk.Exported public interface ParenthesizedTree extends ExpressionTree { + /** + * Returns the expression within the parentheses. + * @return the expression + */ ExpressionTree getExpression(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/PrimitiveTypeTree.java --- a/langtools/src/share/classes/com/sun/source/tree/PrimitiveTypeTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/PrimitiveTypeTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,5 +43,9 @@ */ @jdk.Exported public interface PrimitiveTypeTree extends Tree { + /** + * Returns the kind of this primitive type. + * @return the kind of the type + */ TypeKind getPrimitiveTypeKind(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ReturnTree.java --- a/langtools/src/share/classes/com/sun/source/tree/ReturnTree.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/tree/ReturnTree.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ package com.sun.source.tree; /** - * A tree node for a 'return' statement. + * A tree node for a {@code return} statement. * * For example: *
@@ -42,5 +42,9 @@
  */
 @jdk.Exported
 public interface ReturnTree extends StatementTree {
+    /**
+     * Returns the expression to be returned.
+     * @return the expression
+     */
     ExpressionTree getExpression();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/Scope.java
--- a/langtools/src/share/classes/com/sun/source/tree/Scope.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/Scope.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,21 +52,25 @@
 public interface Scope {
     /**
      * Returns the enclosing scope.
+     * @return the enclosing scope
      */
     public Scope getEnclosingScope();
 
     /**
-     * Returns the innermost type element containing the position of this scope
+     * Returns the innermost type element containing the position of this scope.
+     * @return the innermost enclosing type element
      */
     public TypeElement getEnclosingClass();
 
     /**
      * Returns the innermost executable element containing the position of this scope.
+     * @return the innermost enclosing method declaration
      */
     public ExecutableElement getEnclosingMethod();
 
     /**
      * Returns the elements directly contained in this scope.
+     * @return the elements contained in this scope
      */
     public Iterable getLocalElements();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/SwitchTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/SwitchTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/SwitchTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import java.util.List;
 
 /**
- * A tree node for a 'switch' statement.
+ * A tree node for a {@code switch} statement.
  *
  * For example:
  * 
@@ -45,6 +45,15 @@
  */
 @jdk.Exported
 public interface SwitchTree extends StatementTree {
+    /**
+     * Returns the expression for the {@code switch} statement.
+     * @return the expression
+     */
     ExpressionTree getExpression();
+
+    /**
+     * Returns the cases for the {@code switch} statement.
+     * @return the cases
+     */
     List getCases();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/SynchronizedTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/SynchronizedTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/SynchronizedTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.source.tree;
 
 /**
- * A tree node for a 'synchronized' statement.
+ * A tree node for a {@code synchronized} statement.
  *
  * For example:
  * 
@@ -42,6 +42,15 @@
  */
 @jdk.Exported
 public interface SynchronizedTree extends StatementTree {
+    /**
+     * Returns the expression on which to synchronize.
+     * @return the expression
+     */
     ExpressionTree getExpression();
+
+    /**
+     * Returns the block of the {@code synchronized} statement.
+     * @return the block
+     */
     BlockTree getBlock();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/ThrowTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/ThrowTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/ThrowTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.source.tree;
 
 /**
- * A tree node for a 'throw' statement.
+ * A tree node for a {@code throw} statement.
  *
  * For example:
  * 
@@ -41,5 +41,9 @@
  */
 @jdk.Exported
 public interface ThrowTree extends StatementTree {
+    /**
+     * Returns the expression to be thrown.
+     * @return the expression
+     */
     ExpressionTree getExpression();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/Tree.java
--- a/langtools/src/share/classes/com/sun/source/tree/Tree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/Tree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,10 @@
      */
     @jdk.Exported
     public enum Kind {
-
+        /**
+         * Used for instances of {@link AnnotatedTypeTree}
+         * representing annotated types.
+         */
         ANNOTATED_TYPE(AnnotatedTypeTree.class),
 
         /**
@@ -613,6 +616,10 @@
             associatedInterface = intf;
         }
 
+        /**
+         * Returns the associated interface type that uses this kind.
+         * @return the associated interface
+         */
         public Class asInterface() {
             return associatedInterface;
         }
@@ -621,7 +628,7 @@
     }
 
     /**
-     * Gets the kind of this tree.
+     * Returns the kind of this tree.
      *
      * @return the kind of this tree.
      */
@@ -633,6 +640,9 @@
      *
      * @param  result type of this operation.
      * @param  type of additional data.
+     * @param visitor the visitor to be called
+     * @param data a value to be passed to the visitor
+     * @return the result returned from calling the visitor
      */
      R accept(TreeVisitor visitor, D data);
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java
--- a/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,58 +58,437 @@
  */
 @jdk.Exported
 public interface TreeVisitor {
+    /**
+     * Visits an AnnotatedTypeTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitAnnotatedType(AnnotatedTypeTree node, P p);
+
+    /**
+     * Visits an AnnotatedTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitAnnotation(AnnotationTree node, P p);
+
+    /**
+     * Visits a MethodInvocationTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitMethodInvocation(MethodInvocationTree node, P p);
+
+    /**
+     * Visits an AssertTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitAssert(AssertTree node, P p);
+
+    /**
+     * Visits an AssignmentTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitAssignment(AssignmentTree node, P p);
+
+    /**
+     * Visits a CompoundAssignmentTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitCompoundAssignment(CompoundAssignmentTree node, P p);
+
+    /**
+     * Visits a BinaryTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitBinary(BinaryTree node, P p);
+
+    /**
+     * Visits a BlockTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitBlock(BlockTree node, P p);
+
+    /**
+     * Visits a BreakTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitBreak(BreakTree node, P p);
+
+    /**
+     * Visits a CaseTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitCase(CaseTree node, P p);
+
+    /**
+     * Visits a CatchTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitCatch(CatchTree node, P p);
+
+    /**
+     * Visits a ClassTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitClass(ClassTree node, P p);
+
+    /**
+     * Visits a ConditionalExpressionTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitConditionalExpression(ConditionalExpressionTree node, P p);
+
+    /**
+     * Visits a ContinueTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitContinue(ContinueTree node, P p);
+
+    /**
+     * Visits a DoWhileTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitDoWhileLoop(DoWhileLoopTree node, P p);
+
+    /**
+     * Visits an ErroneousTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitErroneous(ErroneousTree node, P p);
+
+    /**
+     * Visits an ExpressionStatementTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitExpressionStatement(ExpressionStatementTree node, P p);
+
+    /**
+     * Visits an EnhancedForLoopTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitEnhancedForLoop(EnhancedForLoopTree node, P p);
+
+    /**
+     * Visits a ForLoopTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitForLoop(ForLoopTree node, P p);
+
+    /**
+     * Visits an IdentifierTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitIdentifier(IdentifierTree node, P p);
+
+    /**
+     * Visits an IfTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitIf(IfTree node, P p);
+
+    /**
+     * Visits an ImportTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitImport(ImportTree node, P p);
+
+    /**
+     * Visits an ArrayAccessTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitArrayAccess(ArrayAccessTree node, P p);
+
+    /**
+     * Visits a LabeledStatementTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitLabeledStatement(LabeledStatementTree node, P p);
+
+    /**
+     * Visits a LiteralTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitLiteral(LiteralTree node, P p);
+
+    /**
+     * Visits a MethodTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitMethod(MethodTree node, P p);
+
+    /**
+     * Visits a ModifiersTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitModifiers(ModifiersTree node, P p);
+
+    /**
+     * Visits a NewArrayTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitNewArray(NewArrayTree node, P p);
+
+    /**
+     * Visits a NewClassTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitNewClass(NewClassTree node, P p);
+
+    /**
+     * Visits a LambdaExpressionTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitLambdaExpression(LambdaExpressionTree node, P p);
+
+    /**
+     * Visits a PackageTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitPackage(PackageTree node, P p);
+
+    /**
+     * Visits a ParenthesizedTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitParenthesized(ParenthesizedTree node, P p);
+
+    /**
+     * Visits a ReturnTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitReturn(ReturnTree node, P p);
+
+    /**
+     * Visits a MemberSelectTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitMemberSelect(MemberSelectTree node, P p);
+
+    /**
+     * Visits a MemberReferenceTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitMemberReference(MemberReferenceTree node, P p);
+
+    /**
+     * Visits an EmptyStatementTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitEmptyStatement(EmptyStatementTree node, P p);
+
+    /**
+     * Visits a SwitchTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitSwitch(SwitchTree node, P p);
+
+    /**
+     * Visits a SynchronizedTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitSynchronized(SynchronizedTree node, P p);
+
+    /**
+     * Visits a ThrowTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitThrow(ThrowTree node, P p);
+
+    /**
+     * Visits a CompilationUnitTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitCompilationUnit(CompilationUnitTree node, P p);
+
+    /**
+     * Visits a TryTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitTry(TryTree node, P p);
+
+    /**
+     * Visits a ParameterizedTypeTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitParameterizedType(ParameterizedTypeTree node, P p);
+
+    /**
+     * Visits a UnionTypeTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitUnionType(UnionTypeTree node, P p);
+
+    /**
+     * Visits an IntersectionTypeTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitIntersectionType(IntersectionTypeTree node, P p);
+
+    /**
+     * Visits an ArrayTypeTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitArrayType(ArrayTypeTree node, P p);
+
+    /**
+     * Visits a TypeCastTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitTypeCast(TypeCastTree node, P p);
+
+    /**
+     * Visits a PrimitiveTypeTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitPrimitiveType(PrimitiveTypeTree node, P p);
+
+    /**
+     * Visits a TypeParameterTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitTypeParameter(TypeParameterTree node, P p);
+
+    /**
+     * Visits an InstanceOfTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitInstanceOf(InstanceOfTree node, P p);
+
+    /**
+     * Visits a UnaryTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitUnary(UnaryTree node, P p);
+
+    /**
+     * Visits a VariableTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitVariable(VariableTree node, P p);
+
+    /**
+     * Visits a WhileLoopTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitWhileLoop(WhileLoopTree node, P p);
+
+    /**
+     * Visits a WildcardTypeTree node.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitWildcard(WildcardTree node, P p);
+
+    /**
+     * Visits an unknown type of Tree node.
+     * This can occur if the language evolves and new kinds
+     * of nodes are added to the {@code Tree} hierarchy.
+     * @param node the node being visited
+     * @param p a parameter value
+     * @return a result value
+     */
     R visitOther(Tree node, P p);
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/TryTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/TryTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/TryTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 import java.util.List;
 
 /**
- * A tree node for a 'try' statement.
+ * A tree node for a {@code try} statement.
  *
  * For example:
  * 
@@ -47,8 +47,33 @@
  */
 @jdk.Exported
 public interface TryTree extends StatementTree {
+    /**
+     * Returns the block of the {@code try} statement.
+     * @return the block
+     */
     BlockTree getBlock();
+
+    /**
+     * Returns any catch blocks provided in the {@code try} statement.
+     * The result will be an empty list if there are no
+     * catch blocks.
+     * @return the catch blocks
+     */
     List getCatches();
+
+    /**
+     * Returns the finally block provided in the {@code try} statement,
+     * or {@code null} if there is none.
+     * @return the finally block
+     */
     BlockTree getFinallyBlock();
+
+
+    /**
+     * Returns any resource declarations provided in the {@code try} statement.
+     * The result will be an empty list if there are no
+     * resource declarations.
+     * @return the resource declarations
+     */
     List getResources();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/TypeCastTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/TypeCastTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/TypeCastTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,15 @@
  */
 @jdk.Exported
 public interface TypeCastTree extends ExpressionTree {
+    /**
+     * Returns the target type of the cast.
+     * @return the cast
+     */
     Tree getType();
+
+    /**
+     * Returns the expression being cast.
+     * @return the expression
+     */
     ExpressionTree getExpression();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/TypeParameterTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,11 +48,20 @@
  */
 @jdk.Exported
 public interface TypeParameterTree extends Tree {
+    /**
+     * Returns the name of the type parameter.
+     * @return the name
+     */
     Name getName();
+
+    /**
+     * Returns the bounds of the type parameter.
+     * @return the bounds
+     */
     List getBounds();
 
     /**
-     * Return annotations on the type parameter declaration.
+     * Returns annotations on the type parameter declaration.
      *
      * Annotations need Target meta-annotations of
      * {@link java.lang.annotation.ElementType#TYPE_PARAMETER} or
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/UnaryTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/UnaryTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/UnaryTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,5 +44,9 @@
  */
 @jdk.Exported
 public interface UnaryTree extends ExpressionTree {
+    /**
+     * Returns the expression that is the operand of the unary operator.
+     * @return the expression
+     */
     ExpressionTree getExpression();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/UnionTypeTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/UnionTypeTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/UnionTypeTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,8 @@
 import java.util.List;
 
 /**
- * A tree node for a union type expression in a multicatch var declaration.
+ * A tree node for a union type expression in a multicatch
+ * variable declaration.
  *
  * @author Maurizio Cimadamore
  *
@@ -36,5 +37,9 @@
  */
 @jdk.Exported
 public interface UnionTypeTree extends Tree {
+    /**
+     * Returns the alternative type expressions.
+     * @return the alternative type expressions
+     */
     List getTypeAlternatives();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/VariableTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/VariableTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/VariableTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,9 +44,35 @@
  */
 @jdk.Exported
 public interface VariableTree extends StatementTree {
+    /**
+     * Returns the modifiers, including any annotations, on the declaration.
+     * @return the modifiers
+     */
     ModifiersTree getModifiers();
+
+    /**
+     * Returns the name of the variable being declared.
+     * @return the name
+     */
     Name getName();
+
+    /**
+     * Returns the qualified identifier for the name being "declared".
+     * This is only used in certain cases for the receiver of a
+     * method declaration. Returns {@code null} in all other cases.
+     * @return the qualified identifier of a receiver declaration
+     */
     ExpressionTree getNameExpression();
+
+    /**
+     * Returns the type of the variable being declared.
+     * @return the type
+     */
     Tree getType();
+
+    /**
+     * Returns the initializer for the variable, or {@code null} if none.
+     * @return the initializer
+     */
     ExpressionTree getInitializer();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/WhileLoopTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/WhileLoopTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/WhileLoopTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.source.tree;
 
 /**
- * A tree node for a 'while' loop statement.
+ * A tree node for a {@code while} loop statement.
  *
  * For example:
  * 
@@ -43,6 +43,15 @@
  */
 @jdk.Exported
 public interface WhileLoopTree extends StatementTree {
+    /**
+     * Returns the condition of the loop.
+     * @return the condition
+     */
     ExpressionTree getCondition();
+
+    /**
+     * Returns the body of the loop.
+     * @return the body of the loop
+     */
     StatementTree getStatement();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/tree/WildcardTree.java
--- a/langtools/src/share/classes/com/sun/source/tree/WildcardTree.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/tree/WildcardTree.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,5 +46,9 @@
  */
 @jdk.Exported
 public interface WildcardTree extends Tree {
+    /**
+     * Returns the bound of the wildcard.
+     * @return the bound
+     */
     Tree getBound();
 }
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/DocSourcePositions.java
--- a/langtools/src/share/classes/com/sun/source/util/DocSourcePositions.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/util/DocSourcePositions.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
 public interface DocSourcePositions extends SourcePositions {
 
     /**
-     * Gets the starting position of the tree within the comment within the file.  If tree is not found within
+     * Returns the starting position of the tree within the comment within the file.  If tree is not found within
      * file, or if the starting position is not available,
      * return {@link javax.tools.Diagnostic#NOPOS}.
      * The given tree should be under the given comment tree, and the given documentation
@@ -64,7 +64,7 @@
     long getStartPosition(CompilationUnitTree file, DocCommentTree comment, DocTree tree);
 
     /**
-     * Gets the ending position of the tree within the comment within the file.  If tree is not found within
+     * Returns the ending position of the tree within the comment within the file.  If tree is not found within
      * file, or if the ending position is not available,
      * return {@link javax.tools.Diagnostic#NOPOS}.
      * The given tree should be under the given comment tree, and the given documentation
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/DocTreePath.java
--- a/langtools/src/share/classes/com/sun/source/util/DocTreePath.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/util/DocTreePath.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,16 +38,23 @@
 @jdk.Exported
 public class DocTreePath implements Iterable {
     /**
-     * Gets a documentation tree path for a tree node within a compilation unit.
-     * @return null if the node is not found
+     * Returns a documentation tree path for a tree node within a compilation unit,
+     * or {@code null} if the node is not found.
+     * @param treePath the path for the node with which the doc comment is associated
+     * @param doc the doc comment associated with the node
+     * @param target a node within the doc comment
+     * @return a path identifying the target within the tree
      */
     public static DocTreePath getPath(TreePath treePath, DocCommentTree doc, DocTree target) {
         return getPath(new DocTreePath(treePath, doc), target);
     }
 
     /**
-     * Gets a documentation tree path for a tree node within a subtree identified by a DocTreePath object.
-     * @return null if the node is not found
+     * Returns a documentation tree path for a tree node within a subtree
+     * identified by a DocTreePath object, or {@code null} if the node is not found.
+     * @param path a path identifying a node within a doc comment tree
+     * @param target a node to be located within the given node
+     * @return a path identifying the target node
      */
     public static DocTreePath getPath(DocTreePath path, DocTree target) {
         path.getClass();
@@ -100,6 +107,8 @@
 
     /**
      * Creates a DocTreePath for a child node.
+     * @param p the parent node
+     * @param t the child node
      */
     public DocTreePath(DocTreePath p, DocTree t) {
         if (t.getKind() == DocTree.Kind.DOC_COMMENT) {
@@ -113,31 +122,31 @@
     }
 
     /**
-     * Get the TreePath associated with this path.
-     * @return TreePath for this DocTreePath
+     * Returns the TreePath associated with this path.
+     * @return the TreePath for this DocTreePath
      */
     public TreePath getTreePath() {
         return treePath;
     }
 
     /**
-     * Get the DocCommentTree associated with this path.
-     * @return DocCommentTree for this DocTreePath
+     * Returns the DocCommentTree associated with this path.
+     * @return the DocCommentTree for this DocTreePath
      */
     public DocCommentTree getDocComment() {
         return docComment;
     }
 
     /**
-     * Get the leaf node for this path.
-     * @return DocTree for this DocTreePath
+     * Returns the leaf node for this path.
+     * @return the DocTree for this DocTreePath
      */
     public DocTree getLeaf() {
         return leaf;
     }
 
     /**
-     * Get the path for the enclosing node, or null if there is no enclosing node.
+     * Returns the path for the enclosing node, or {@code null} if there is no enclosing node.
      * @return DocTreePath of parent
      */
     public DocTreePath getParentPath() {
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/DocTreePathScanner.java
--- a/langtools/src/share/classes/com/sun/source/util/DocTreePathScanner.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/util/DocTreePathScanner.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,10 @@
 @jdk.Exported
 public class DocTreePathScanner extends DocTreeScanner {
     /**
-     * Scan a tree from a position identified by a TreePath.
+     * Scans a tree from a position identified by a tree path.
+     * @param path the path
+     * @param p a value to be passed to visitor methods
+     * @return the result returned from the main visitor method
      */
     public R scan(DocTreePath path, P p) {
         this.path = path;
@@ -51,8 +54,11 @@
     }
 
     /**
-     * Scan a single node.
+     * Scans a single node.
      * The current path is updated for the duration of the scan.
+     * @param tree the tree to be scanned
+     * @param p a value to be passed to visitor methods
+     * @return the result returned from the main visitor method
      */
     @Override
     public R scan(DocTree tree, P p) {
@@ -69,8 +75,9 @@
     }
 
     /**
-     * Get the current path for the node, as built up by the currently
+     * Returns the current path for the node, as built up by the currently
      * active set of scan calls.
+     * @return the current path
      */
     public DocTreePath getCurrentPath() {
         return path;
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/DocTreeScanner.java
--- a/langtools/src/share/classes/com/sun/source/util/DocTreeScanner.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/com/sun/source/util/DocTreeScanner.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
  * 

The default implementation of the visitXYZ methods will determine * a result as follows: *

    - *
  • If the node being visited has no children, the result will be null. + *
  • If the node being visited has no children, the result will be {@code null}. *
  • If the node being visited has one child, the result will be the * result of calling {@code scan} on that child. The child may be a simple node * or itself a list of nodes. @@ -71,7 +71,10 @@ public class DocTreeScanner implements DocTreeVisitor { /** - * Scan a single node. + * Scans a single node. + * @param node the node to be scanned + * @param p a parameter value passed to the visit method + * @return the result value from the visit method */ public R scan(DocTree node, P p) { return (node == null) ? null : node.accept(this, p); @@ -82,7 +85,11 @@ } /** - * Scan a list of nodes. + * Scans a sequence of nodes. + * @param nodes the nodes to be scanned + * @param p a parameter value to be passed to the visit method for each node + * @return the combined return value from the visit methods. + * The values are combined using the {@link #reduce reduce} method. */ public R scan(Iterable nodes, P p) { R r = null; @@ -104,6 +111,9 @@ * Reduces two results into a combined result. * The default implementation is to return the first parameter. * The general contract of the method is that it may take any action whatsoever. + * @param r1 the first of the values to be combined + * @param r2 the second of the values to be combined + * @return the result of combining the two parameters */ public R reduce(R r1, R r2) { return r1; @@ -114,26 +124,61 @@ * Visitor methods ****************************************************************************/ + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitAttribute(AttributeTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitAuthor(AuthorTree node, P p) { return scan(node.getName(), p); } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitComment(CommentTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitDeprecated(DeprecatedTree node, P p) { return scan(node.getBody(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitDocComment(DocCommentTree node, P p) { R r = scan(node.getFirstSentence(), p); @@ -142,36 +187,85 @@ return r; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitDocRoot(DocRootTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitEndElement(EndElementTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitEntity(EntityTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitErroneous(ErroneousTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitIdentifier(IdentifierTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitInheritDoc(InheritDocTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitLink(LinkTree node, P p) { R r = scan(node.getReference(), p); @@ -179,11 +273,25 @@ return r; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitLiteral(LiteralTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitParam(ParamTree node, P p) { R r = scan(node.getName(), p); @@ -191,31 +299,73 @@ return r; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitReference(ReferenceTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitReturn(ReturnTree node, P p) { return scan(node.getDescription(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitSee(SeeTree node, P p) { return scan(node.getReference(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitSerial(SerialTree node, P p) { return scan(node.getDescription(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitSerialData(SerialDataTree node, P p) { return scan(node.getDescription(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitSerialField(SerialFieldTree node, P p) { R r = scan(node.getName(), p); @@ -224,21 +374,49 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitSince(SinceTree node, P p) { return scan(node.getBody(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitStartElement(StartElementTree node, P p) { return scan(node.getAttributes(), p); } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitText(TextTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitThrows(ThrowsTree node, P p) { R r = scan(node.getExceptionName(), p); @@ -246,26 +424,61 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) { return scan(node.getContent(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) { return scan(node.getContent(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitValue(ValueTree node, P p) { return scan(node.getReference(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitVersion(VersionTree node, P p) { return scan(node.getBody(), p); } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ @Override public R visitOther(DocTree node, P p) { return null; diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/DocTrees.java --- a/langtools/src/share/classes/com/sun/source/util/DocTrees.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/DocTrees.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,8 +40,9 @@ @jdk.Exported public abstract class DocTrees extends Trees { /** - * Gets a DocTrees object for a given CompilationTask. + * Returns a DocTrees object for a given CompilationTask. * @param task the compilation task for which to get the Trees object + * @return the DocTrees object * @throws IllegalArgumentException if the task does not support the Trees API. */ public static DocTrees instance(CompilationTask task) { @@ -49,8 +50,9 @@ } /** - * Gets a DocTrees object for a given ProcessingEnvironment. + * Returns a DocTrees object for a given ProcessingEnvironment. * @param env the processing environment for which to get the Trees object + * @return the DocTrees object * @throws IllegalArgumentException if the env does not support the Trees API. */ public static DocTrees instance(ProcessingEnvironment env) { @@ -60,17 +62,26 @@ } /** - * Gets the doc comment tree, if any, for the Tree node identified by a given TreePath. - * Returns null if no doc comment was found. + * Returns the doc comment tree, if any, for the Tree node identified by a given TreePath. + * Returns {@code null} if no doc comment was found. + * @param path the path for the tree node + * @return the doc comment tree */ public abstract DocCommentTree getDocCommentTree(TreePath path); /** - * Gets the language model element referred to by the leaf node of the given - * {@link DocTreePath}, or null if unknown. + * Returns the language model element referred to by the leaf node of the given + * {@link DocTreePath}, or {@code null} if unknown. + * @param path the path for the tree node + * @return the element */ public abstract Element getElement(DocTreePath path); + /** + * Returns a utility object for accessing the source positions + * of documentation tree nodes. + * @return the utility object + */ public abstract DocSourcePositions getSourcePositions(); /** @@ -80,6 +91,7 @@ * @param kind the kind of message * @param msg the message, or an empty string if none * @param t the tree to use as a position hint + * @param c the doc comment tree to use as a position hint * @param root the compilation unit that contains tree */ public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg, diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/JavacTask.java --- a/langtools/src/share/classes/com/sun/source/util/JavacTask.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/JavacTask.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ public abstract class JavacTask implements CompilationTask { /** - * Get the {@code JavacTask} for a {@code ProcessingEnvironment}. + * Returns the {@code JavacTask} for a {@code ProcessingEnvironment}. * If the compiler is being invoked using a * {@link javax.tools.JavaCompiler.CompilationTask CompilationTask}, * then that task will be returned. @@ -70,7 +70,7 @@ } /** - * Parse the specified files returning a list of abstract syntax trees. + * Parses the specified files returning a list of abstract syntax trees. * * @return a list of abstract syntax trees * @throws IOException if an unhandled I/O error occurred in the compiler. @@ -80,7 +80,7 @@ throws IOException; /** - * Complete all analysis. + * Completes all analysis. * * @return a list of elements that were analyzed * @throws IOException if an unhandled I/O error occurred in the compiler. @@ -89,7 +89,7 @@ public abstract Iterable analyze() throws IOException; /** - * Generate code. + * Generates code. * * @return a list of files that were generated * @throws IOException if an unhandled I/O error occurred in the compiler. @@ -98,7 +98,7 @@ public abstract Iterable generate() throws IOException; /** - * The specified listener will receive notification of events + * Sets a specified listener to receive notification of events * describing the progress of this compilation task. * * If another listener is receiving notifications as a result of a prior @@ -108,46 +108,54 @@ * any listener that has been previously set, followed by {@code addTaskListener} * for the new listener. * + * @param taskListener the task listener * @throws IllegalStateException if the specified listener has already been added. */ public abstract void setTaskListener(TaskListener taskListener); /** - * The specified listener will receive notification of events + * Adds a specified listener so that it receives notification of events * describing the progress of this compilation task. * * This method may be called at any time before or during the compilation. * + * @param taskListener the task listener * @throws IllegalStateException if the specified listener has already been added. * @since 1.8 */ public abstract void addTaskListener(TaskListener taskListener); /** - * The specified listener will no longer receive notification of events - * describing the progress of this compilation task. + * Removes the specified listener so that it no longer receives + * notification of events describing the progress of this + * compilation task. * * This method may be called at any time before or during the compilation. * + * @param taskListener the task listener * @since 1.8 */ public abstract void removeTaskListener(TaskListener taskListener); /** - * Get a type mirror of the tree node determined by the specified path. + * Returns a type mirror of the tree node determined by the specified path. * This method has been superceded by methods on * {@link com.sun.source.util.Trees Trees}. + * @param path the path + * @return the type mirror * @see com.sun.source.util.Trees#getTypeMirror */ public abstract TypeMirror getTypeMirror(Iterable path); /** - * Get a utility object for dealing with program elements. + * Returns a utility object for dealing with program elements. + * @return the utility object for dealing with program elements */ public abstract Elements getElements(); /** - * Get a utility object for dealing with type mirrors. + * Returns a utility object for dealing with type mirrors. + * @return the utility object for dealing with type mirrors */ public abstract Types getTypes(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/Plugin.java --- a/langtools/src/share/classes/com/sun/source/util/Plugin.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/Plugin.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,13 +51,13 @@ @jdk.Exported public interface Plugin { /** - * Get the user-friendly name of this plug-in. + * Returns the user-friendly name of this plug-in. * @return the user-friendly name of the plug-in */ String getName(); /** - * Initialize the plug-in for a given compilation task. + * Initializes the plug-in for a given compilation task. * @param task The compilation task that has just been started * @param args Arguments, if any, for the plug-in */ diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java --- a/langtools/src/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,28 +30,63 @@ /** * A simple visitor for tree nodes. * + * @param the return type of this visitor's methods. Use {@link + * Void} for visitors that do not need to return results. + * @param

    the type of the additional parameter to this visitor's + * methods. Use {@code Void} for visitors that do not need an + * additional parameter. + * * @since 1.8 */ @jdk.Exported public class SimpleDocTreeVisitor implements DocTreeVisitor { + /** + * The default value, returned by the {@link #defaultAction default action}. + */ protected final R DEFAULT_VALUE; + /** + * Creates a visitor, with a DEFAULT_VALUE of {@code null}. + */ protected SimpleDocTreeVisitor() { DEFAULT_VALUE = null; } + /** + * Creates a visitor, with a specified DEFAULT_VALUE. + * @param defaultValue the default value to be returned by the default action. + */ protected SimpleDocTreeVisitor(R defaultValue) { DEFAULT_VALUE = defaultValue; } + /** + * The default action, used by all visit methods that are not overridden. + * @param node the node being visited + * @param p the parameter value passed to the visit method + * @return the result value to be returned from the visit method + */ protected R defaultAction(DocTree node, P p) { return DEFAULT_VALUE; } + /** + * Invokes the appropriate visit method specific to the type of the node. + * @param node the node on which to dispatch + * @param p a parameter to be passed to the appropriate visit method + * @return the value returns from the appropriate visit method + */ public final R visit(DocTree node, P p) { return (node == null) ? null : node.accept(this, p); } + /** + * Invokes the appropriate visit method on each of a sequence of nodes. + * @param nodes the nodes on which to dispatch + * @param p a parameter value to be passed to each appropriate visit method + * @return the value return from the last of the visit methods, or null + * if none were called. + */ public final R visit(Iterable nodes, P p) { R r = null; if (nodes != null) { @@ -61,118 +96,350 @@ return r; } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitAttribute(AttributeTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitAuthor(AuthorTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitComment(CommentTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitDeprecated(DeprecatedTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitDocComment(DocCommentTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitDocRoot(DocRootTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitEndElement(EndElementTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitEntity(EntityTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitErroneous(ErroneousTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitIdentifier(IdentifierTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitInheritDoc(InheritDocTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitLink(LinkTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitLiteral(LiteralTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitParam(ParamTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitReference(ReferenceTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitReturn(ReturnTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitSee(SeeTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitSerial(SerialTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitSerialData(SerialDataTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitSerialField(SerialFieldTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitSince(SinceTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitStartElement(StartElementTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitText(TextTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitThrows(ThrowsTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitValue(ValueTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitVersion(VersionTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitOther(DocTree node, P p) { return defaultAction(node, p); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java --- a/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/SimpleTreeVisitor.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,29 +30,64 @@ /** * A simple visitor for tree nodes. * + * @param the return type of this visitor's methods. Use {@link + * Void} for visitors that do not need to return results. + * @param

    the type of the additional parameter to this visitor's + * methods. Use {@code Void} for visitors that do not need an + * additional parameter. + * * @author Peter von der Ahé * @since 1.6 */ @jdk.Exported public class SimpleTreeVisitor implements TreeVisitor { + /** + * The default value, returned by the {@link #defaultAction default action}. + */ protected final R DEFAULT_VALUE; + /** + * Creates a visitor, with a DEFAULT_VALUE of {@code null}. + */ protected SimpleTreeVisitor() { DEFAULT_VALUE = null; } + /** + * Creates a visitor, with a specified DEFAULT_VALUE. + * @param defaultValue the default value to be returned by the default action. + */ protected SimpleTreeVisitor(R defaultValue) { DEFAULT_VALUE = defaultValue; } + /** + * The default action, used by all visit methods that are not overridden. + * @param node the node being visited + * @param p the parameter value passed to the visit method + * @return the result value to be returned from the visit method + */ protected R defaultAction(Tree node, P p) { return DEFAULT_VALUE; } + /** + * Invokes the appropriate visit method specific to the type of the node. + * @param node the node on which to dispatch + * @param p a parameter to be passed to the appropriate visit method + * @return the value returns from the appropriate visit method + */ public final R visit(Tree node, P p) { return (node == null) ? null : node.accept(this, p); } + /** + * Invokes the appropriate visit method on each of a sequence of nodes. + * @param nodes the nodes on which to dispatch + * @param p a parameter value to be passed to each appropriate visit method + * @return the value return from the last of the visit methods, or null + * if none were called. + */ public final R visit(Iterable nodes, P p) { R r = null; if (nodes != null) @@ -61,218 +96,650 @@ return r; } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitCompilationUnit(CompilationUnitTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitPackage(PackageTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitImport(ImportTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitClass(ClassTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitMethod(MethodTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitVariable(VariableTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitEmptyStatement(EmptyStatementTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitBlock(BlockTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitDoWhileLoop(DoWhileLoopTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitWhileLoop(WhileLoopTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitForLoop(ForLoopTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitEnhancedForLoop(EnhancedForLoopTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitLabeledStatement(LabeledStatementTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitSwitch(SwitchTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitCase(CaseTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitSynchronized(SynchronizedTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitTry(TryTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitCatch(CatchTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitConditionalExpression(ConditionalExpressionTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitIf(IfTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitExpressionStatement(ExpressionStatementTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitBreak(BreakTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitContinue(ContinueTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitReturn(ReturnTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitThrow(ThrowTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitAssert(AssertTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitMethodInvocation(MethodInvocationTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitNewClass(NewClassTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitNewArray(NewArrayTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitLambdaExpression(LambdaExpressionTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitParenthesized(ParenthesizedTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitAssignment(AssignmentTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitCompoundAssignment(CompoundAssignmentTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitUnary(UnaryTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitBinary(BinaryTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitTypeCast(TypeCastTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitInstanceOf(InstanceOfTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitArrayAccess(ArrayAccessTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitMemberSelect(MemberSelectTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitMemberReference(MemberReferenceTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitIdentifier(IdentifierTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitLiteral(LiteralTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitPrimitiveType(PrimitiveTypeTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitArrayType(ArrayTypeTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitParameterizedType(ParameterizedTypeTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitUnionType(UnionTypeTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitIntersectionType(IntersectionTypeTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitTypeParameter(TypeParameterTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitWildcard(WildcardTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitModifiers(ModifiersTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitAnnotation(AnnotationTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitAnnotatedType(AnnotatedTypeTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitErroneous(ErroneousTree node, P p) { return defaultAction(node, p); } + /** + * {@inheritDoc} This implementation calls {@code defaultAction}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of {@code defaultAction} + */ + @Override public R visitOther(Tree node, P p) { return defaultAction(node, p); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/SourcePositions.java --- a/langtools/src/share/classes/com/sun/source/util/SourcePositions.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/SourcePositions.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ public interface SourcePositions { /** - * Gets the starting position of tree within file. If tree is not found within + * Returns the starting position of tree within file. If tree is not found within * file, or if the starting position is not available, * return {@link javax.tools.Diagnostic#NOPOS}. * The returned position must be at the start of the yield of this tree, that @@ -58,7 +58,7 @@ long getStartPosition(CompilationUnitTree file, Tree tree); /** - * Gets the ending position of tree within file. If tree is not found within + * Returns the ending position of tree within file. If tree is not found within * file, or if the ending position is not available, * return {@link javax.tools.Diagnostic#NOPOS}. * The returned position must be at the end of the yield of this tree, diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/TaskEvent.java --- a/langtools/src/share/classes/com/sun/source/util/TaskEvent.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/TaskEvent.java Wed Jul 09 10:42:13 2014 -0700 @@ -79,18 +79,45 @@ COMPILATION, } + /** + * Creates a task event for a given kind. + * The source file, compilation unit and type element + * are all set to {@code null}. + * @param kind the kind of the event + */ public TaskEvent(Kind kind) { this(kind, null, null, null); } + /** + * Creates a task event for a given kind and source file. + * The compilation unit and type element are both set to {@code null}. + * @param kind the kind of the event + * @param sourceFile the source file + */ public TaskEvent(Kind kind, JavaFileObject sourceFile) { this(kind, sourceFile, null, null); } + /** + * Creates a task event for a given kind and compilation unit. + * The source file is set from the compilation unit, + * and the type element is set to {@code null}. + * @param kind the kind of the event + * @param unit the compilation unit + */ public TaskEvent(Kind kind, CompilationUnitTree unit) { this(kind, unit.getSourceFile(), unit, null); } + /** + * Creates a task event for a given kind, compilation unit + * and type element. + * The source file is set from the compilation unit. + * @param kind the kind of the event + * @param unit the compilation unit + * @param clazz the type element + */ public TaskEvent(Kind kind, CompilationUnitTree unit, TypeElement clazz) { this(kind, unit.getSourceFile(), unit, clazz); } @@ -102,22 +129,42 @@ this.clazz = clazz; } + /** + * Returns the kind for this event. + * @return the kind + */ public Kind getKind() { return kind; } + /** + * Returns the source file for this event. + * May be {@code null}. + * @return the source file + */ public JavaFileObject getSourceFile() { return file; } + /** + * Returns the compilation unit for this event. + * May be {@code null}. + * @return the compilation unit + */ public CompilationUnitTree getCompilationUnit() { return unit; } + /** + * Returns the type element for this event. + * May be {@code null}. + * @return the type element + */ public TypeElement getTypeElement() { return clazz; } + @Override public String toString() { return "TaskEvent[" + kind + "," diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/TaskListener.java --- a/langtools/src/share/classes/com/sun/source/util/TaskListener.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/TaskListener.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,15 @@ @jdk.Exported public interface TaskListener { + /** + * Invoked when an event has begun. + * @param e the event + */ public void started(TaskEvent e); + /** + * Invoked when an event has been completed. + * @param e the event + */ public void finished(TaskEvent e); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/TreePath.java --- a/langtools/src/share/classes/com/sun/source/util/TreePath.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/TreePath.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,16 +39,22 @@ @jdk.Exported public class TreePath implements Iterable { /** - * Gets a tree path for a tree node within a compilation unit. - * @return null if the node is not found + * Returns a tree path for a tree node within a compilation unit, + * or {@code null} if the node is not found. + * @param unit the compilation unit to search + * @param target the node to locate + * @return the tree path */ public static TreePath getPath(CompilationUnitTree unit, Tree target) { return getPath(new TreePath(unit), target); } /** - * Gets a tree path for a tree node within a subtree identified by a TreePath object. - * @return null if the node is not found + * Returns a tree path for a tree node within a subtree identified by a TreePath object. + * Returns {@code null} if the node is not found. + * @param path the path in which to search + * @param target the node to locate + * @return the tree path of the target node */ public static TreePath getPath(TreePath path, Tree target) { path.getClass(); @@ -85,41 +91,47 @@ /** * Creates a TreePath for a root node. + * @param node the root node */ - public TreePath(CompilationUnitTree t) { - this(null, t); + public TreePath(CompilationUnitTree node) { + this(null, node); } /** * Creates a TreePath for a child node. + * @param path the parent path + * @param tree the child node */ - public TreePath(TreePath p, Tree t) { - if (t.getKind() == Tree.Kind.COMPILATION_UNIT) { - compilationUnit = (CompilationUnitTree) t; + public TreePath(TreePath path, Tree tree) { + if (tree.getKind() == Tree.Kind.COMPILATION_UNIT) { + compilationUnit = (CompilationUnitTree) tree; parent = null; } else { - compilationUnit = p.compilationUnit; - parent = p; + compilationUnit = path.compilationUnit; + parent = path; } - leaf = t; + leaf = tree; } /** - * Get the compilation unit associated with this path. + * Returns the compilation unit associated with this path. + * @return the compilation unit */ public CompilationUnitTree getCompilationUnit() { return compilationUnit; } /** - * Get the leaf node for this path. + * Returns the leaf node for this path. + * @return the leaf node */ public Tree getLeaf() { return leaf; } /** - * Get the path for the enclosing node, or null if there is no enclosing node. + * Returns the path for the enclosing node, or {@code null} if there is no enclosing node. + * @return the path for the enclosing node */ public TreePath getParentPath() { return parent; diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/TreePathScanner.java --- a/langtools/src/share/classes/com/sun/source/util/TreePathScanner.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/TreePathScanner.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,10 @@ public class TreePathScanner extends TreeScanner { /** - * Scan a tree from a position identified by a TreePath. + * Scans a tree from a position identified by a TreePath. + * @param path the path identifying the node to be scanned + * @param p a parameter value passed to visit methods + * @return the result value from the visit method */ public R scan(TreePath path, P p) { this.path = path; @@ -54,8 +57,9 @@ } /** - * Scan a single node. + * Scans a single node. * The current path is updated for the duration of the scan. + * @return the result value from the visit method */ @Override public R scan(Tree tree, P p) { @@ -72,8 +76,9 @@ } /** - * Get the current path for the node, as built up by the currently + * Returns the current path for the node, as built up by the currently * active set of scan calls. + * @return the current path */ public TreePath getCurrentPath() { return path; diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/TreeScanner.java --- a/langtools/src/share/classes/com/sun/source/util/TreeScanner.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/TreeScanner.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ *

    The default implementation of the visitXYZ methods will determine * a result as follows: *

      - *
    • If the node being visited has no children, the result will be null. + *
    • If the node being visited has no children, the result will be {@code null}. *
    • If the node being visited has one child, the result will be the * result of calling {@code scan} on that child. The child may be a simple node * or itself a list of nodes. @@ -64,6 +64,12 @@ * } *
* + * @param the return type of this visitor's methods. Use {@link + * Void} for visitors that do not need to return results. + * @param

the type of the additional parameter to this visitor's + * methods. Use {@code Void} for visitors that do not need an + * additional parameter. + * * @author Peter von der Ahé * @author Jonathan Gibbons * @since 1.6 @@ -71,17 +77,26 @@ @jdk.Exported public class TreeScanner implements TreeVisitor { - /** Scan a single node. + /** + * Scans a single node. + * @param tree the node to be scanned + * @param p a parameter value passed to the visit method + * @return the result value from the visit method */ - public R scan(Tree node, P p) { - return (node == null) ? null : node.accept(this, p); + public R scan(Tree tree, P p) { + return (tree == null) ? null : tree.accept(this, p); } private R scanAndReduce(Tree node, P p, R r) { return reduce(scan(node, p), r); } - /** Scan a list of nodes. + /** + * Scans a sequence of nodes. + * @param nodes the nodes to be scanned + * @param p a parameter value to be passed to the visit method for each node + * @return the combined return value from the visit methods. + * The values are combined using the {@link #reduce reduce} method. */ public R scan(Iterable nodes, P p) { R r = null; @@ -103,6 +118,9 @@ * Reduces two results into a combined result. * The default implementation is to return the first parameter. * The general contract of the method is that it may take any action whatsoever. + * @param r1 the first of the values to be combined + * @param r2 the second of the values to be combined + * @return the result of combining the two parameters */ public R reduce(R r1, R r2) { return r1; @@ -113,6 +131,14 @@ * Visitor methods ****************************************************************************/ + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitCompilationUnit(CompilationUnitTree node, P p) { R r = scan(node.getPackage(), p); r = scanAndReduce(node.getImports(), p, r); @@ -120,16 +146,40 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitPackage(PackageTree node, P p) { R r = scan(node.getAnnotations(), p); r = scanAndReduce(node.getPackageName(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitImport(ImportTree node, P p) { return scan(node.getQualifiedIdentifier(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitClass(ClassTree node, P p) { R r = scan(node.getModifiers(), p); r = scanAndReduce(node.getTypeParameters(), p, r); @@ -139,6 +189,14 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitMethod(MethodTree node, P p) { R r = scan(node.getModifiers(), p); r = scanAndReduce(node.getReturnType(), p, r); @@ -151,6 +209,14 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitVariable(VariableTree node, P p) { R r = scan(node.getModifiers(), p); r = scanAndReduce(node.getType(), p, r); @@ -159,26 +225,66 @@ return r; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitEmptyStatement(EmptyStatementTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitBlock(BlockTree node, P p) { return scan(node.getStatements(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitDoWhileLoop(DoWhileLoopTree node, P p) { R r = scan(node.getStatement(), p); r = scanAndReduce(node.getCondition(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitWhileLoop(WhileLoopTree node, P p) { R r = scan(node.getCondition(), p); r = scanAndReduce(node.getStatement(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitForLoop(ForLoopTree node, P p) { R r = scan(node.getInitializer(), p); r = scanAndReduce(node.getCondition(), p, r); @@ -187,6 +293,14 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitEnhancedForLoop(EnhancedForLoopTree node, P p) { R r = scan(node.getVariable(), p); r = scanAndReduce(node.getExpression(), p, r); @@ -194,28 +308,68 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitLabeledStatement(LabeledStatementTree node, P p) { return scan(node.getStatement(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitSwitch(SwitchTree node, P p) { R r = scan(node.getExpression(), p); r = scanAndReduce(node.getCases(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitCase(CaseTree node, P p) { R r = scan(node.getExpression(), p); r = scanAndReduce(node.getStatements(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitSynchronized(SynchronizedTree node, P p) { R r = scan(node.getExpression(), p); r = scanAndReduce(node.getBlock(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitTry(TryTree node, P p) { R r = scan(node.getResources(), p); r = scanAndReduce(node.getBlock(), p, r); @@ -224,12 +378,28 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitCatch(CatchTree node, P p) { R r = scan(node.getParameter(), p); r = scanAndReduce(node.getBlock(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitConditionalExpression(ConditionalExpressionTree node, P p) { R r = scan(node.getCondition(), p); r = scanAndReduce(node.getTrueExpression(), p, r); @@ -237,6 +407,14 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitIf(IfTree node, P p) { R r = scan(node.getCondition(), p); r = scanAndReduce(node.getThenStatement(), p, r); @@ -244,32 +422,88 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitExpressionStatement(ExpressionStatementTree node, P p) { return scan(node.getExpression(), p); } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitBreak(BreakTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitContinue(ContinueTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitReturn(ReturnTree node, P p) { return scan(node.getExpression(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitThrow(ThrowTree node, P p) { return scan(node.getExpression(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitAssert(AssertTree node, P p) { R r = scan(node.getCondition(), p); r = scanAndReduce(node.getDetail(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitMethodInvocation(MethodInvocationTree node, P p) { R r = scan(node.getTypeArguments(), p); r = scanAndReduce(node.getMethodSelect(), p, r); @@ -277,6 +511,14 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitNewClass(NewClassTree node, P p) { R r = scan(node.getEnclosingExpression(), p); r = scanAndReduce(node.getIdentifier(), p, r); @@ -286,6 +528,14 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitNewArray(NewArrayTree node, P p) { R r = scan(node.getType(), p); r = scanAndReduce(node.getDimensions(), p, r); @@ -297,126 +547,326 @@ return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitLambdaExpression(LambdaExpressionTree node, P p) { R r = scan(node.getParameters(), p); r = scanAndReduce(node.getBody(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitParenthesized(ParenthesizedTree node, P p) { return scan(node.getExpression(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitAssignment(AssignmentTree node, P p) { R r = scan(node.getVariable(), p); r = scanAndReduce(node.getExpression(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitCompoundAssignment(CompoundAssignmentTree node, P p) { R r = scan(node.getVariable(), p); r = scanAndReduce(node.getExpression(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitUnary(UnaryTree node, P p) { return scan(node.getExpression(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitBinary(BinaryTree node, P p) { R r = scan(node.getLeftOperand(), p); r = scanAndReduce(node.getRightOperand(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitTypeCast(TypeCastTree node, P p) { R r = scan(node.getType(), p); r = scanAndReduce(node.getExpression(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitInstanceOf(InstanceOfTree node, P p) { R r = scan(node.getExpression(), p); r = scanAndReduce(node.getType(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitArrayAccess(ArrayAccessTree node, P p) { R r = scan(node.getExpression(), p); r = scanAndReduce(node.getIndex(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitMemberSelect(MemberSelectTree node, P p) { return scan(node.getExpression(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitMemberReference(MemberReferenceTree node, P p) { R r = scan(node.getQualifierExpression(), p); r = scanAndReduce(node.getTypeArguments(), p, r); return r; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitIdentifier(IdentifierTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitLiteral(LiteralTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitPrimitiveType(PrimitiveTypeTree node, P p) { return null; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitArrayType(ArrayTypeTree node, P p) { return scan(node.getType(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitParameterizedType(ParameterizedTypeTree node, P p) { R r = scan(node.getType(), p); r = scanAndReduce(node.getTypeArguments(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitUnionType(UnionTypeTree node, P p) { return scan(node.getTypeAlternatives(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitIntersectionType(IntersectionTypeTree node, P p) { return scan(node.getBounds(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitTypeParameter(TypeParameterTree node, P p) { R r = scan(node.getAnnotations(), p); r = scanAndReduce(node.getBounds(), p, r); return r; } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitWildcard(WildcardTree node, P p) { return scan(node.getBound(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitModifiers(ModifiersTree node, P p) { return scan(node.getAnnotations(), p); } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitAnnotation(AnnotationTree node, P p) { R r = scan(node.getAnnotationType(), p); r = scanAndReduce(node.getArguments(), p, r); return r; } - public R visitAnnotatedType(AnnotatedTypeTree node, P p) { - R r = scan(node.getAnnotations(), p); - r = scanAndReduce(node.getUnderlyingType(), p, r); - return r; - } + /** + * {@inheritDoc} This implementation scans the children in left to right order. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override + public R visitAnnotatedType(AnnotatedTypeTree node, P p) { + R r = scan(node.getAnnotations(), p); + r = scanAndReduce(node.getUnderlyingType(), p, r); + return r; + } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitOther(Tree node, P p) { return null; } + /** + * {@inheritDoc} This implementation returns {@code null}. + * + * @param node {@inheritDoc} + * @param p {@inheritDoc} + * @return the result of scanning + */ + @Override public R visitErroneous(ErroneousTree node, P p) { return null; } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/source/util/Trees.java --- a/langtools/src/share/classes/com/sun/source/util/Trees.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/Trees.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,9 +54,10 @@ @jdk.Exported public abstract class Trees { /** - * Gets a Trees object for a given CompilationTask. + * Returns a Trees object for a given CompilationTask. * @param task the compilation task for which to get the Trees object * @throws IllegalArgumentException if the task does not support the Trees API. + * @return the Trees object */ public static Trees instance(CompilationTask task) { String taskClassName = task.getClass().getName(); @@ -67,9 +68,10 @@ } /** - * Gets a Trees object for a given ProcessingEnvironment. + * Returns a Trees object for a given ProcessingEnvironment. * @param env the processing environment for which to get the Trees object * @throws IllegalArgumentException if the env does not support the Trees API. + * @return the Trees object */ public static Trees instance(ProcessingEnvironment env) { if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment")) @@ -84,95 +86,129 @@ argType = Class.forName(argType.getName(), false, cl); Method m = c.getMethod("instance", argType); return (Trees) m.invoke(null, arg); - } catch (Throwable e) { + } catch (ReflectiveOperationException e) { throw new AssertionError(e); } } /** - * Gets a utility object for obtaining source positions. + * Returns a utility object for obtaining source positions. + * @return the utility object for obtaining source positions */ public abstract SourcePositions getSourcePositions(); /** - * Gets the Tree node for a given Element. - * Returns null if the node can not be found. + * Returns the Tree node for a given Element. + * Returns {@code null} if the node can not be found. + * @param element the element + * @return the tree node */ public abstract Tree getTree(Element element); /** - * Gets the ClassTree node for a given TypeElement. - * Returns null if the node can not be found. + * Returns the ClassTree node for a given TypeElement. + * Returns {@code null} if the node can not be found. + * @param element the element + * @return the class tree node */ public abstract ClassTree getTree(TypeElement element); /** - * Gets the MethodTree node for a given ExecutableElement. - * Returns null if the node can not be found. + * Returns the MethodTree node for a given ExecutableElement. + * Returns {@code null} if the node can not be found. + * @param method the executable element + * @return the method tree node */ public abstract MethodTree getTree(ExecutableElement method); /** - * Gets the Tree node for an AnnotationMirror on a given Element. - * Returns null if the node can not be found. + * Returns the Tree node for an AnnotationMirror on a given Element. + * Returns {@code null} if the node can not be found. + * @param e the element + * @param a the annotation mirror + * @return the tree node */ public abstract Tree getTree(Element e, AnnotationMirror a); /** - * Gets the Tree node for an AnnotationValue for an AnnotationMirror on a given Element. - * Returns null if the node can not be found. + * Returns the Tree node for an AnnotationValue for an AnnotationMirror on a given Element. + * Returns {@code null} if the node can not be found. + * @param e the element + * @param a the annotation mirror + * @param v the annotation value + * @return the tree node */ public abstract Tree getTree(Element e, AnnotationMirror a, AnnotationValue v); /** - * Gets the path to tree node within the specified compilation unit. + * Returns the path to tree node within the specified compilation unit. + * @param unit the compilation unit + * @param node the tree node + * @return the tree path */ public abstract TreePath getPath(CompilationUnitTree unit, Tree node); /** - * Gets the TreePath node for a given Element. - * Returns null if the node can not be found. + * Returns the TreePath node for a given Element. + * Returns {@code null} if the node can not be found. + * @param e the element + * @return the tree path */ public abstract TreePath getPath(Element e); /** - * Gets the TreePath node for an AnnotationMirror on a given Element. - * Returns null if the node can not be found. + * Returns the TreePath node for an AnnotationMirror on a given Element. + * Returns {@code null} if the node can not be found. + * @param e the element + * @param a the annotation mirror + * @return the tree path */ public abstract TreePath getPath(Element e, AnnotationMirror a); /** - * Gets the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element. - * Returns null if the node can not be found. + * Returns the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element. + * Returns {@code null} if the node can not be found. + * @param e the element + * @param a the annotation mirror + * @param v the annotation value + * @return the tree path */ public abstract TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v); /** - * Gets the Element for the Tree node identified by a given TreePath. - * Returns null if the element is not available. + * Returns the Element for the Tree node identified by a given TreePath. + * Returns {@code null} if the element is not available. + * @param path the tree path + * @return the element * @throws IllegalArgumentException is the TreePath does not identify * a Tree node that might have an associated Element. */ public abstract Element getElement(TreePath path); /** - * Gets the TypeMirror for the Tree node identified by a given TreePath. - * Returns null if the TypeMirror is not available. + * Returns the TypeMirror for the Tree node identified by a given TreePath. + * Returns {@code null} if the TypeMirror is not available. + * @param path the tree path + * @return the type mirror * @throws IllegalArgumentException is the TreePath does not identify * a Tree node that might have an associated TypeMirror. */ public abstract TypeMirror getTypeMirror(TreePath path); /** - * Gets the Scope for the Tree node identified by a given TreePath. - * Returns null if the Scope is not available. + * Returns the Scope for the Tree node identified by a given TreePath. + * Returns {@code null} if the Scope is not available. + * @param path the tree path + * @return the scope */ public abstract Scope getScope(TreePath path); /** - * Gets the doc comment, if any, for the Tree node identified by a given TreePath. - * Returns null if no doc comment was found. + * Returns the doc comment, if any, for the Tree node identified by a given TreePath. + * Returns {@code null} if no doc comment was found. * @see DocTrees#getDocCommentTree(TreePath) + * @param path the tree path + * @return the doc comment */ public abstract String getDocComment(TreePath path); @@ -195,7 +231,7 @@ public abstract boolean isAccessible(Scope scope, Element member, DeclaredType type); /** - * Gets the original type from the ErrorType object. + * Returns the original type from the ErrorType object. * @param errorType The errorType for which we want to get the original type. * @return javax.lang.model.type.TypeMirror corresponding to the original type, replaced by the ErrorType. */ @@ -215,7 +251,7 @@ com.sun.source.tree.CompilationUnitTree root); /** - * Gets the lub of an exception parameter declared in a catch clause. + * Returns the lub of an exception parameter declared in a catch clause. * @param tree the tree for the catch clause * @return The lub of the exception parameter */ diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java Wed Jul 09 10:42:13 2014 -0700 @@ -99,7 +99,7 @@ } /** - * Gets each package name as a separate link. + * Returns each package name as a separate link. * * @param pd PackageDoc * @return content for the package link diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,7 +101,7 @@ } /** - * Gets each profile name as a separate link. + * Returns each profile name as a separate link. * * @param profileName the profile being documented * @return content for the profile link diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java Wed Jul 09 10:42:13 2014 -0700 @@ -104,7 +104,7 @@ } /** - * Gets each package name as a separate link. + * Returns each package name as a separate link. * * @param pd PackageDoc * @param profileName the name of the profile being documented diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Wed Jul 09 10:42:13 2014 -0700 @@ -812,21 +812,24 @@ collator.setStrength(caseSensitive ? Collator.TERTIARY : Collator.SECONDARY); return collator.compare(s1, s2); } + /** - * A comparator for index file uses, + * A comparator for index file presentations, * 1. this sorts first on simple names - * 2. if equal, case insensitive comparison of Parameter types - * 3. if equal, case sensitive comparison of Parameter types - * 4. if equal, compare the FQNs of the entities - * 5. if equal, then compare the DocKinds ex: Package, Interface etc. + * 2. if equal, then compare the DocKind ex: Package, Interface etc. + * 3a. if equal and if the type is of ExecutableMemberDoc(Constructor, Fields), + * a case insensitive comparison of parameter types + * 3b. if equal, a case sensitive comparison of parameter types + * 4. finally, if equal, compare the FQNs of the entities * @return a comparator for index file use */ public static Comparator makeComparatorForIndexUse() { return new Util.DocComparator() { /** - * compare two given Doc entities, first sort on name, if - * applicable on the method's parameter types, and finally on the - * fully qualified name of the entity. + * Compare two given Doc entities, first sort on name, then on the kinds, + * then on the parameters only if the type is an instance of ExecutableMemberDocs, + * the parameters are compared ignoring the case first, then a case sensitive comparison, + * and finally the fully qualified names. * * @param d1 - a Doc element. * @param d2 - a Doc element. @@ -838,7 +841,11 @@ if (result != 0) { return result; } - if (d1 instanceof ExecutableMemberDoc && d2 instanceof ExecutableMemberDoc) { + result = compareDocKinds(d1, d2); + if (result != 0) { + return result; + } + if (hasParameters(d1)) { Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters(); Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters(); result = compareParameters(false, param1, param2); @@ -846,31 +853,28 @@ return result; } result = compareParameters(true, param1, param2); - } - if (result != 0) { - return result; + if (result != 0) { + return result; + } } - result = compareFullyQualifiedNames(d1, d2); - if (result != 0) { - return result; - } - return compareDocKinds(d1, d2); + return compareFullyQualifiedNames(d1, d2); } }; } - /** - * Comparator for ClassUse representations, this sorts on member names, - * fully qualified member names and then the parameter types if applicable, - * and finally the Doc kinds ie. package, class, interface etc. + * Comparator for ClassUse presentations, and sorts as follows: + * 1. member names + * 2. then fully qualified member names + * 3. then parameter types if applicable + * 4. finally the Doc kinds ie. package, class, interface etc. * @return a comparator to sort classes and members for class use */ public static Comparator makeComparatorForClassUse() { return new Util.DocComparator() { /** - * compare two given Doc entities, first sort on name, and if - * applicable on the fully qualified name, and finally if applicable - * on the parameter types. + * Compare two given Doc entities, first sort on name, and if + * applicable on the fully qualified name, and if applicable + * on the parameter types, and finally the DocKind. * @param d1 - a Doc element. * @param d2 - a Doc element. * @return a negative integer, zero, or a positive integer as the first @@ -885,7 +889,7 @@ if (result != 0) { return result; } - if (d1 instanceof ExecutableMemberDoc && d2 instanceof ExecutableMemberDoc) { + if (hasParameters(d1) && hasParameters(d2)) { Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters(); Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters(); result = compareParameters(false, param1, param2); @@ -898,53 +902,54 @@ } }; } - - /** * A general purpose comparator to sort Doc entities, basically provides the building blocks * for creating specific comparators for an use-case. * @param a Doc entity */ static abstract class DocComparator implements Comparator { - static enum DocKinds { + static enum DocKind { PACKAGE, - FIELD, + CLASS, ENUM, + INTERFACE, ANNOTATION, - INTERFACE, - CLASS, + FIELD, CONSTRUCTOR, METHOD }; - private DocKinds getValue(Doc d) { + boolean hasParameters(Doc d) { + return d instanceof ExecutableMemberDoc; + } + DocKind getDocKind(Doc d) { if (d.isAnnotationType() || d.isAnnotationTypeElement()) { - return DocKinds.ANNOTATION; + return DocKind.ANNOTATION; } else if (d.isEnum() || d.isEnumConstant()) { - return DocKinds.ENUM; + return DocKind.ENUM; } else if (d.isField()) { - return DocKinds.FIELD; + return DocKind.FIELD; } else if (d.isInterface()) { - return DocKinds.INTERFACE; + return DocKind.INTERFACE; } else if (d.isClass()) { - return DocKinds.CLASS; + return DocKind.CLASS; } else if (d.isConstructor()) { - return DocKinds.CONSTRUCTOR; + return DocKind.CONSTRUCTOR; } else if (d.isMethod()) { - return DocKinds.METHOD; + return DocKind.METHOD; } else { - return DocKinds.PACKAGE; + return DocKind.PACKAGE; } } /** * Compares two Doc entities' kinds, and these are ordered as defined in - * the DocKinds enumeration. + * the DocKind enumeration. * @param d1 the first Doc object * @param d2 the second Doc object * @return a negative integer, zero, or a positive integer as the first * argument is less than, equal to, or greater than the second. */ protected int compareDocKinds(Doc d1, Doc d2) { - return getValue(d1).compareTo(getValue(d2)); + return getDocKind(d1).compareTo(getDocKind(d2)); } /** * Compares two parameter arrays by comparing each Type of the parameter in the array, diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java Wed Jul 09 10:42:13 2014 -0700 @@ -126,6 +126,9 @@ initContext(); notYetEntered = new HashMap<>(); compilerMain.setAPIMode(true); + compiler = JavaCompiler.instance(context); + compiler.keepComments = true; + compiler.genEndPos = true; result = compilerMain.compile(args, classNames, context, fileObjects, processors); cleanup(); return result; diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Wed Jul 09 10:42:13 2014 -0700 @@ -854,7 +854,7 @@ } /** - * Gets the original type from the ErrorType object. + * Returns the original type from the ErrorType object. * @param errorType The errorType for which we want to get the original type. * @returns TypeMirror corresponding to the original type, replaced by the ErrorType. * noType (type.tag == NONE) is returned if there is no original type. diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/code/Source.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Wed Jul 09 10:42:13 2014 -0700 @@ -240,6 +240,9 @@ public boolean allowPostApplicabilityVarargsAccessCheck() { return compareTo(JDK1_8) >= 0; } + public boolean allowPrivateSafeVarargs() { + return compareTo(JDK1_9) >= 0; + } public static SourceVersion toSourceVersion(Source source) { switch(source) { case JDK1_2: diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/code/Types.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Wed Jul 09 10:42:13 2014 -0700 @@ -626,7 +626,7 @@ * (ii) perform functional interface bridge calculation. */ public ClassSymbol makeFunctionalInterfaceClass(Env env, Name name, List targets, long cflags) { - if (targets.isEmpty() || !isFunctionalInterface(targets.head)) { + if (targets.isEmpty()) { return null; } Symbol descSym = findDescriptorSymbol(targets.head.tsym); @@ -2315,7 +2315,7 @@ public Type visitType(Type t, Void ignored) { // A note on wildcards: there is no good way to // determine a supertype for a super bounded wildcard. - return null; + return Type.noType; } @Override @@ -2482,7 +2482,7 @@ return false; return t.isRaw() || - supertype(t) != null && isDerivedRaw(supertype(t)) || + supertype(t) != Type.noType && isDerivedRaw(supertype(t)) || isDerivedRaw(interfaces(t)); } @@ -2968,6 +2968,12 @@ } @Override + public Type visitUndetVar(UndetVar t, Void ignored) { + //do nothing - we should not replace inside undet variables + return t; + } + + @Override public Type visitClassType(ClassType t, Void ignored) { if (!t.isCompound()) { List typarams = t.getTypeArguments(); diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Jul 09 10:42:13 2014 -0700 @@ -249,36 +249,30 @@ */ Type check(final JCTree tree, final Type found, final int ownkind, final ResultInfo resultInfo) { InferenceContext inferenceContext = resultInfo.checkContext.inferenceContext(); - Type owntype = found; - if (!owntype.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) { - if (allowPoly && inferenceContext.free(found)) { - if ((ownkind & ~resultInfo.pkind) == 0) { - owntype = resultInfo.check(tree, inferenceContext.asUndetVar(owntype)); - } else { - log.error(tree.pos(), "unexpected.type", - kindNames(resultInfo.pkind), - kindName(ownkind)); - owntype = types.createErrorType(owntype); - } + Type owntype; + if (!found.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) { + if ((ownkind & ~resultInfo.pkind) != 0) { + log.error(tree.pos(), "unexpected.type", + kindNames(resultInfo.pkind), + kindName(ownkind)); + owntype = types.createErrorType(found); + } else if (allowPoly && inferenceContext.free(found)) { + //delay the check if there are inference variables in the found type + //this means we are dealing with a partially inferred poly expression + owntype = resultInfo.pt; inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), new FreeTypeListener() { @Override public void typesInferred(InferenceContext inferenceContext) { ResultInfo pendingResult = - resultInfo.dup(inferenceContext.asInstType(resultInfo.pt)); + resultInfo.dup(inferenceContext.asInstType(resultInfo.pt)); check(tree, inferenceContext.asInstType(found), ownkind, pendingResult); } }); - return tree.type = resultInfo.pt; } else { - if ((ownkind & ~resultInfo.pkind) == 0) { - owntype = resultInfo.check(tree, owntype); - } else { - log.error(tree.pos(), "unexpected.type", - kindNames(resultInfo.pkind), - kindName(ownkind)); - owntype = types.createErrorType(owntype); - } + owntype = resultInfo.check(tree, found); } + } else { + owntype = found; } tree.type = owntype; return owntype; @@ -2472,6 +2466,7 @@ currentTarget = infer.instantiateFunctionalInterface(that, currentTarget, explicitParamTypes, resultInfo.checkContext); } + currentTarget = types.removeWildcards(currentTarget); lambdaType = types.findDescriptorType(currentTarget); } else { currentTarget = Type.recoveryType; @@ -2894,7 +2889,7 @@ resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK && isSerializable(currentTarget); if (currentTarget != Type.recoveryType) { - currentTarget = targetChecker.visit(currentTarget, that); + currentTarget = types.removeWildcards(targetChecker.visit(currentTarget, that)); desc = types.findDescriptorType(currentTarget); } else { currentTarget = Type.recoveryType; @@ -3135,10 +3130,19 @@ if (checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK && pt != Type.recoveryType) { //check that functional interface class is well-formed - ClassSymbol csym = types.makeFunctionalInterfaceClass(env, - names.empty, List.of(fExpr.targets.head), ABSTRACT); - if (csym != null) { - chk.checkImplementations(env.tree, csym, csym); + try { + /* Types.makeFunctionalInterfaceClass() may throw an exception + * when it's executed post-inference. See the listener code + * above. + */ + ClassSymbol csym = types.makeFunctionalInterfaceClass(env, + names.empty, List.of(fExpr.targets.head), ABSTRACT); + if (csym != null) { + chk.checkImplementations(env.tree, csym, csym); + } + } catch (Types.FunctionDescriptorLookupError ex) { + JCDiagnostic cause = ex.getDiagnostic(); + resultInfo.checkContext.report(env.tree, cause); } } } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/comp/Check.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jul 09 10:42:13 2014 -0700 @@ -127,6 +127,7 @@ allowSimplifiedVarargs = source.allowSimplifiedVarargs(); allowDefaultMethods = source.allowDefaultMethods(); allowStrictMethodClashCheck = source.allowStrictMethodClashCheck(); + allowPrivateSafeVarargs = source.allowPrivateSafeVarargs(); complexInference = options.isSet("complexinference"); warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts"); suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile"); @@ -181,6 +182,10 @@ */ boolean allowStrictMethodClashCheck; + /** Switch: can the @SafeVarargs annotation be applied to private methods? + */ + boolean allowPrivateSafeVarargs; + /** Switch: -complexinference option set? */ boolean complexInference; @@ -266,6 +271,14 @@ log.warning(LintCategory.STATIC, pos, msg, args); } + /** Warn about division by integer constant zero. + * @param pos Position to be used for error reporting. + */ + void warnDivZero(DiagnosticPosition pos) { + if (lint.isEnabled(LintCategory.DIVZERO)) + log.warning(LintCategory.DIVZERO, pos, "div.zero"); + } + /** * Report any deferred diagnostics. */ @@ -534,8 +547,8 @@ Type checkType(final DiagnosticPosition pos, final Type found, final Type req, final CheckContext checkContext) { final Infer.InferenceContext inferenceContext = checkContext.inferenceContext(); - if (inferenceContext.free(req)) { - inferenceContext.addFreeTypeListener(List.of(req), new FreeTypeListener() { + if (inferenceContext.free(req) || inferenceContext.free(found)) { + inferenceContext.addFreeTypeListener(List.of(req, found), new FreeTypeListener() { @Override public void typesInferred(InferenceContext inferenceContext) { checkType(pos, inferenceContext.asInstType(found), inferenceContext.asInstType(req), checkContext); @@ -816,8 +829,10 @@ if (varargElemType != null) { log.error(tree, "varargs.invalid.trustme.anno", - syms.trustMeType.tsym, - diags.fragment("varargs.trustme.on.virtual.varargs", m)); + syms.trustMeType.tsym, + allowPrivateSafeVarargs ? + diags.fragment("varargs.trustme.on.virtual.varargs", m) : + diags.fragment("varargs.trustme.on.virtual.varargs.final.only", m)); } else { log.error(tree, "varargs.invalid.trustme.anno", @@ -840,7 +855,8 @@ private boolean isTrustMeAllowedOnMethod(Symbol s) { return (s.flags() & VARARGS) != 0 && (s.isConstructor() || - (s.flags() & (STATIC | FINAL)) != 0); + (s.flags() & (STATIC | FINAL | + (allowPrivateSafeVarargs ? PRIVATE : 0) )) != 0); } Type checkMethod(final Type mtype, @@ -2684,7 +2700,7 @@ checkClassBounds(pos, seensofar, it); } Type st = types.supertype(type); - if (st != null) checkClassBounds(pos, seensofar, st); + if (st != Type.noType) checkClassBounds(pos, seensofar, st); } /** Enter interface into into set. @@ -3385,15 +3401,19 @@ * @param operator The operator for the expression * @param operand The right hand operand for the expression */ - void checkDivZero(DiagnosticPosition pos, Symbol operator, Type operand) { + void checkDivZero(final DiagnosticPosition pos, Symbol operator, Type operand) { if (operand.constValue() != null - && lint.isEnabled(LintCategory.DIVZERO) && operand.getTag().isSubRangeOf(LONG) && ((Number) (operand.constValue())).longValue() == 0) { int opc = ((OperatorSymbol)operator).opcode; if (opc == ByteCodes.idiv || opc == ByteCodes.imod || opc == ByteCodes.ldiv || opc == ByteCodes.lmod) { - log.warning(LintCategory.DIVZERO, pos, "div.zero"); + deferredLintHandler.report(new DeferredLintHandler.LintLogger() { + @Override + public void report() { + warnDivZero(pos); + } + }); } } } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Wed Jul 09 10:42:13 2014 -0700 @@ -953,7 +953,7 @@ LambdaReturnScanner() { super(EnumSet.of(BLOCK, CASE, CATCH, DOLOOP, FOREACHLOOP, - FORLOOP, RETURN, SYNCHRONIZED, SWITCH, TRY, WHILELOOP)); + FORLOOP, IF, RETURN, SYNCHRONIZED, SWITCH, TRY, WHILELOOP)); } } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Wed Jul 09 10:42:13 2014 -0700 @@ -354,6 +354,7 @@ Type to, Attr.ResultInfo resultInfo, InferenceContext inferenceContext) { inferenceContext.solve(List.of(from.qtype), new Warner()); + inferenceContext.notifyChange(); Type capturedType = resultInfo.checkContext.inferenceContext() .cachedCapture(tree, from.inst, false); if (types.isConvertible(capturedType, @@ -450,7 +451,7 @@ class ImplicitArgType extends DeferredAttr.DeferredTypeMap { public ImplicitArgType(Symbol msym, Resolve.MethodResolutionPhase phase) { - rs.deferredAttr.super(AttrMode.SPECULATIVE, msym, phase); + (rs.deferredAttr).super(AttrMode.SPECULATIVE, msym, phase); } public Type apply(Type t) { @@ -518,6 +519,8 @@ //or if it's not a subtype of the original target, issue an error checkContext.report(pos, diags.fragment("no.suitable.functional.intf.inst", funcInterface)); } + //propagate constraints as per JLS 18.2.1 + checkContext.compatible(owntype, funcInterface, types.noWarnings); return owntype; } } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Wed Jul 09 10:42:13 2014 -0700 @@ -320,7 +320,9 @@ ListBuffer syntheticInits = new ListBuffer<>(); - if (!sym.isStatic()) { + if (localContext.methodReferenceReceiver != null) { + syntheticInits.append(localContext.methodReferenceReceiver); + } else if (!sym.isStatic()) { syntheticInits.append(makeThis( sym.owner.enclClass().asType(), localContext.owner.enclClass())); @@ -363,17 +365,10 @@ //first determine the method symbol to be used to generate the sam instance //this is either the method reference symbol, or the bridged reference symbol - Symbol refSym = localContext.needsBridge() - ? localContext.bridgeSym - : localContext.isSignaturePolymorphic() + Symbol refSym = localContext.isSignaturePolymorphic() ? localContext.sigPolySym : tree.sym; - //build the bridge method, if needed - if (localContext.needsBridge()) { - bridgeMemberReference(tree, localContext); - } - //the qualifying expression is treated as a special captured arg JCExpression init; switch(tree.kind) { @@ -743,54 +738,51 @@ // /** - * Generate an adapter method "bridge" for a method reference which cannot - * be used directly. + * Converts a method reference which cannot be used directly into a lambda */ - private class MemberReferenceBridger { + private class MemberReferenceToLambda { private final JCMemberReference tree; private final ReferenceTranslationContext localContext; + private final Symbol owner; private final ListBuffer args = new ListBuffer<>(); private final ListBuffer params = new ListBuffer<>(); - MemberReferenceBridger(JCMemberReference tree, ReferenceTranslationContext localContext) { + private JCExpression receiverExpression = null; + + MemberReferenceToLambda(JCMemberReference tree, ReferenceTranslationContext localContext, Symbol owner) { this.tree = tree; this.localContext = localContext; + this.owner = owner; } - /** - * Generate the bridge - */ - JCMethodDecl bridge() { + JCLambda lambda() { int prevPos = make.pos; try { make.at(tree); Type samDesc = localContext.bridgedRefSig(); List samPTypes = samDesc.getParameterTypes(); - //an extra argument is prepended to the signature of the bridge in case - //the member reference is an instance method reference (in which case - //the receiver expression is passed to the bridge itself). - Type recType = null; + // an extra argument is prepended in the case where the member + // reference is an unbound instance method reference (in which + // case the receiver expression in passed. + VarSymbol rcvr; switch (tree.kind) { - case IMPLICIT_INNER: - recType = tree.sym.owner.type.getEnclosingType(); - break; case BOUND: - recType = tree.getQualifierExpression().type; + rcvr = addParameter("rec$", tree.getQualifierExpression().type, false); + receiverExpression = attr.makeNullCheck(tree.getQualifierExpression()); break; case UNBOUND: - recType = samPTypes.head; + rcvr = addParameter("rec$", samPTypes.head, false); samPTypes = samPTypes.tail; break; + default: + rcvr = null; + break; } - //generate the parameter list for the bridged member reference - the - //bridge signature will match the signature of the target sam descriptor - - VarSymbol rcvr = (recType == null) - ? null - : addParameter("rec$", recType, false); + // generate the parameter list for the coverted member reference. + // the signature will match the signature of the target sam descriptor List refPTypes = tree.sym.type.getParameterTypes(); int refSize = refPTypes.size(); @@ -809,60 +801,46 @@ addParameter("xva$" + i, tree.varargsElement, true); } - //generate the bridge method declaration - JCMethodDecl bridgeDecl = make.MethodDef(make.Modifiers(localContext.bridgeSym.flags()), - localContext.bridgeSym.name, - make.QualIdent(samDesc.getReturnType().tsym), - List.nil(), - params.toList(), - tree.sym.type.getThrownTypes() == null - ? List.nil() - : make.Types(tree.sym.type.getThrownTypes()), - null, - null); - bridgeDecl.sym = (MethodSymbol) localContext.bridgeSym; - bridgeDecl.type = localContext.bridgeSym.type = - types.createMethodTypeWithParameters(samDesc, TreeInfo.types(params.toList())); + //body generation - this can be either a method call or a + //new instance creation expression, depending on the member reference kind + JCExpression expr = (tree.getMode() == ReferenceMode.INVOKE) + ? expressionInvoke(rcvr) + : expressionNew(); - //bridge method body generation - this can be either a method call or a - //new instance creation expression, depending on the member reference kind - JCExpression bridgeExpr = (tree.getMode() == ReferenceMode.INVOKE) - ? bridgeExpressionInvoke(makeReceiver(rcvr)) - : bridgeExpressionNew(); - - //the body is either a return expression containing a method call, - //or the method call itself, depending on whether the return type of - //the bridge is non-void/void. - bridgeDecl.body = makeLambdaExpressionBody(bridgeExpr, bridgeDecl); - - return bridgeDecl; + JCLambda slam = make.Lambda(params.toList(), expr); + slam.targets = tree.targets; + slam.type = tree.type; + slam.pos = tree.pos; + return slam; } finally { make.at(prevPos); } } - //where - private JCExpression makeReceiver(VarSymbol rcvr) { - if (rcvr == null) return null; - JCExpression rcvrExpr = make.Ident(rcvr); - Type rcvrType = tree.sym.enclClass().type; - if (!rcvr.type.tsym.isSubClass(rcvrType.tsym, types)) { - rcvrExpr = make.TypeCast(make.Type(rcvrType), rcvrExpr).setType(rcvrType); - } - return rcvrExpr; + + JCExpression getReceiverExpression() { + return receiverExpression; + } + + private JCExpression makeReceiver(VarSymbol rcvr) { + if (rcvr == null) return null; + JCExpression rcvrExpr = make.Ident(rcvr); + Type rcvrType = tree.sym.enclClass().type; + if (!rcvr.type.tsym.isSubClass(rcvrType.tsym, types)) { + rcvrExpr = make.TypeCast(make.Type(rcvrType), rcvrExpr).setType(rcvrType); } + return rcvrExpr; + } /** - * determine the receiver of the bridged method call - the receiver can - * be either the synthetic receiver parameter or a type qualifier; the - * original qualifier expression is never used here, as it might refer - * to symbols not available in the static context of the bridge + * determine the receiver of the method call - the receiver can + * be a type qualifier, the synthetic receiver parameter or 'super'. */ - private JCExpression bridgeExpressionInvoke(JCExpression rcvr) { + private JCExpression expressionInvoke(VarSymbol rcvr) { JCExpression qualifier = tree.sym.isStatic() ? make.Type(tree.sym.owner.type) : (rcvr != null) ? - rcvr : + makeReceiver(rcvr) : tree.getQualifierExpression(); //create the qualifier expression @@ -881,10 +859,9 @@ } /** - * the enclosing expression is either 'null' (no enclosing type) or set - * to the first bridge synthetic parameter + * Lambda body to use for a 'new'. */ - private JCExpression bridgeExpressionNew() { + private JCExpression expressionNew() { if (tree.kind == ReferenceKind.ARRAY_CTOR) { //create the array creation expression JCNewArray newArr = make.NewArray( @@ -894,15 +871,10 @@ newArr.type = tree.getQualifierExpression().type; return newArr; } else { - JCExpression encl = null; - switch (tree.kind) { - case UNBOUND: - case IMPLICIT_INNER: - encl = make.Ident(params.first()); - } - //create the instance creation expression - JCNewClass newClass = make.NewClass(encl, + //note that method reference syntax does not allow an explicit + //enclosing class (so the enclosing class is null) + JCNewClass newClass = make.NewClass(null, List.nil(), make.Type(tree.getQualifierExpression().type), convertArgs(tree.sym, args.toList(), tree.varargsElement), @@ -916,7 +888,8 @@ } private VarSymbol addParameter(String name, Type p, boolean genArg) { - VarSymbol vsym = new VarSymbol(0, names.fromString(name), p, localContext.bridgeSym); + VarSymbol vsym = new VarSymbol(PARAMETER | SYNTHETIC, names.fromString(name), p, owner); + vsym.pos = tree.pos; params.append(make.VarDef(vsym, null)); if (genArg) { args.append(make.Ident(vsym)); @@ -925,15 +898,6 @@ } } - /** - * Bridges a member reference - this is needed when: - * * Var args in the referenced method need to be flattened away - * * super is used - */ - private void bridgeMemberReference(JCMemberReference tree, ReferenceTranslationContext localContext) { - kInfo.addMethod(new MemberReferenceBridger(tree, localContext).bridge()); - } - private MethodType typeToMethodType(Type mt) { Type type = types.erasure(mt); return new MethodType(type.getParameterTypes(), @@ -1252,9 +1216,25 @@ @Override public void visitLambda(JCLambda tree) { + analyzeLambda(tree, "lambda.stat"); + } + + private void analyzeLambda(JCLambda tree, JCExpression methodReferenceReceiver) { + // Translation of the receiver expression must occur first + JCExpression rcvr = translate(methodReferenceReceiver); + LambdaTranslationContext context = analyzeLambda(tree, "mref.stat.1"); + if (rcvr != null) { + context.methodReferenceReceiver = rcvr; + } + } + + private LambdaTranslationContext analyzeLambda(JCLambda tree, String statKey) { List prevStack = frameStack; try { - LambdaTranslationContext context = (LambdaTranslationContext)makeLambdaContext(tree); + LambdaTranslationContext context = new LambdaTranslationContext(tree); + if (dumpLambdaToMethodStats) { + log.note(tree, statKey, context.needsAltMetafactory(), context.translatedSym); + } frameStack = frameStack.prepend(new Frame(tree)); for (JCVariableDecl param : tree.params) { context.addSymbol(param.sym, PARAM); @@ -1263,6 +1243,7 @@ contextMap.put(tree, context); super.visitLambda(tree); context.complete(); + return context; } finally { frameStack = prevStack; @@ -1351,47 +1332,24 @@ * information added in the LambdaToMethod pass will have the wrong * signature. Hooks between Lower and LambdaToMethod have been added to * handle normal "new" in this case. This visitor converts potentially - * effected method references into a lambda containing a normal "new" of - * the class. + * affected method references into a lambda containing a normal + * expression. * * @param tree */ @Override public void visitReference(JCMemberReference tree) { - if (tree.getMode() == ReferenceMode.NEW - && tree.kind != ReferenceKind.ARRAY_CTOR - && tree.sym.owner.isLocal()) { - MethodSymbol consSym = (MethodSymbol) tree.sym; - List ptypes = ((MethodType) consSym.type).getParameterTypes(); - Type classType = consSym.owner.type; - - // Build lambda parameters - // partially cloned from TreeMaker.Params until 8014021 is fixed - Symbol owner = owner(); - ListBuffer paramBuff = new ListBuffer<>(); - int i = 0; - for (List l = ptypes; l.nonEmpty(); l = l.tail) { - JCVariableDecl param = make.Param(make.paramName(i++), l.head, owner); - param.sym.pos = tree.pos; - paramBuff.append(param); - } - List params = paramBuff.toList(); - - // Make new-class call - JCNewClass nc = makeNewClass(classType, make.Idents(params)); - nc.pos = tree.pos; - - // Make lambda holding the new-class call - JCLambda slam = make.Lambda(params, nc); - slam.targets = tree.targets; - slam.type = tree.type; - slam.pos = tree.pos; - - // Now it is a lambda, process as such - visitLambda(slam); + ReferenceTranslationContext rcontext = new ReferenceTranslationContext(tree); + contextMap.put(tree, rcontext); + if (rcontext.needsConversionToLambda()) { + // Convert to a lambda, and process as such + MemberReferenceToLambda conv = new MemberReferenceToLambda(tree, rcontext, owner()); + analyzeLambda(conv.lambda(), conv.getReceiverExpression()); } else { super.visitReference(tree); - contextMap.put(tree, makeReferenceContext(tree)); + if (dumpLambdaToMethodStats) { + log.note(tree, "mref.stat", rcontext.needsAltMetafactory(), null); + } } } @@ -1646,14 +1604,6 @@ } } - private TranslationContext makeLambdaContext(JCLambda tree) { - return new LambdaTranslationContext(tree); - } - - private TranslationContext makeReferenceContext(JCMemberReference tree) { - return new ReferenceTranslationContext(tree); - } - private class Frame { final JCTree tree; List locals; @@ -1773,6 +1723,13 @@ */ final Set freeVarProcessedLocalClasses; + /** + * For method references converted to lambdas. The method + * reference receiver expression. Must be treated like a captured + * variable. + */ + JCExpression methodReferenceReceiver; + LambdaTranslationContext(JCLambda tree) { super(tree); Frame frame = frameStack.head; @@ -1792,9 +1749,6 @@ // This symbol will be filled-in in complete this.translatedSym = makePrivateSyntheticMethod(0, null, null, owner.enclClass()); - if (dumpLambdaToMethodStats) { - log.note(tree, "lambda.stat", needsAltMetafactory(), translatedSym); - } translatedSymbols = new EnumMap<>(LambdaSymbolKind.class); translatedSymbols.put(PARAM, new LinkedHashMap()); @@ -1992,7 +1946,11 @@ // If instance access isn't needed, make it static. // Interface instance methods must be default methods. // Lambda methods are private synthetic. + // Inherit ACC_STRICT from the enclosing method, or, for clinit, + // from the class. translatedSym.flags_field = SYNTHETIC | LAMBDA_METHOD | + owner.flags_field & STRICTFP | + owner.owner.flags_field & STRICTFP | PRIVATE | (thisReferenced? (inInterface? DEFAULT : 0) : STATIC); @@ -2007,6 +1965,13 @@ for (Symbol thisSym : getSymbolMap(CAPTURED_VAR).values()) { params.append(make.VarDef((VarSymbol) thisSym, null)); } + if (methodReferenceReceiver != null) { + params.append(make.VarDef( + make.Modifiers(PARAMETER|FINAL), + names.fromString("$rcvr$"), + make.Type(methodReferenceReceiver.type), + null)); + } for (Symbol thisSym : getSymbolMap(PARAM).values()) { params.append(make.VarDef((VarSymbol) thisSym, null)); } @@ -2034,40 +1999,27 @@ * and the used by the main translation routines in order to adjust method * references (i.e. in case a bridge is needed) */ - private class ReferenceTranslationContext extends TranslationContext { + private final class ReferenceTranslationContext extends TranslationContext { final boolean isSuper; - final Symbol bridgeSym; final Symbol sigPolySym; ReferenceTranslationContext(JCMemberReference tree) { super(tree); this.isSuper = tree.hasKind(ReferenceKind.SUPER); - this.bridgeSym = needsBridge() - ? makePrivateSyntheticMethod(isSuper ? 0 : STATIC, - referenceBridgeName(), null, - owner.enclClass()) - : null; this.sigPolySym = isSignaturePolymorphic() ? makePrivateSyntheticMethod(tree.sym.flags(), tree.sym.name, bridgedRefSig(), tree.sym.enclClass()) : null; - if (dumpLambdaToMethodStats) { - String key = bridgeSym == null ? - "mref.stat" : "mref.stat.1"; - log.note(tree, key, needsAltMetafactory(), bridgeSym); - } } /** * Get the opcode associated with this method reference */ int referenceKind() { - return LambdaToMethod.this.referenceKind(needsBridge() - ? bridgeSym - : tree.sym); + return LambdaToMethod.this.referenceKind(tree.sym); } boolean needsVarArgsConversion() { @@ -2075,62 +2027,6 @@ } /** - * Generate a disambiguating string to increase stability (important - * if serialized) - * - * @return String to differentiate synthetic lambda method names - */ - private String referenceBridgeDisambiguation() { - StringBuilder buf = new StringBuilder(); - // Append the enclosing method signature to differentiate - // overloaded enclosing methods. - if (owner.type != null) { - buf.append(typeSig(owner.type)); - buf.append(":"); - } - - // Append qualifier type - buf.append(classSig(tree.sym.owner.type)); - - // Note static/instance - buf.append(tree.sym.isStatic()? " S " : " I "); - - // Append referenced signature - buf.append(typeSig(tree.sym.erasure(types))); - - return buf.toString(); - } - - /** - * Construct a unique stable name for the method reference bridge - * - * @return Name to use for the synthetic method name - */ - private Name referenceBridgeName() { - StringBuilder buf = new StringBuilder(); - // Append lambda ID, this is semantically significant - buf.append(names.lambda); - // Note that it is a method reference bridge - buf.append("MR$"); - // Append the enclosing method name - buf.append(enclosingMethodName()); - buf.append('$'); - // Append the referenced method name - buf.append(syntheticMethodNameComponent(tree.sym.name)); - buf.append('$'); - // Append a hash of the disambiguating string : enclosing method - // signature, etc. - String disam = referenceBridgeDisambiguation(); - buf.append(Integer.toHexString(disam.hashCode())); - buf.append('$'); - // The above appended name components may not be unique, append - // a count based on the above name components. - buf.append(syntheticMethodNameCounts.getIndex(buf)); - String result = buf.toString(); - return names.fromString(result); - } - - /** * @return Is this an array operation like clone() */ boolean isArrayOp() { @@ -2165,13 +2061,16 @@ } /** - * Does this reference needs a bridge (i.e. var args need to be - * expanded or "super" is used) + * Does this reference need to be converted to a lambda + * (i.e. var args need to be expanded or "super" is used) */ - final boolean needsBridge() { + final boolean needsConversionToLambda() { return isSuper || needsVarArgsConversion() || isArrayOp() || isPrivateInOtherClass() || - !receiverAccessible(); + !receiverAccessible() || + (tree.getMode() == ReferenceMode.NEW && + tree.kind != ReferenceKind.ARRAY_CTOR && + (tree.sym.owner.isLocal() || tree.sym.owner.isInner())); } Type generatedRefSig() { diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Jul 09 10:42:13 2014 -0700 @@ -958,9 +958,10 @@ } public boolean compatible(Type found, Type req, Warner warn) { + InferenceContext inferenceContext = deferredAttrContext.inferenceContext; return strict ? - types.isSubtypeUnchecked(found, deferredAttrContext.inferenceContext.asUndetVar(req), warn) : - types.isConvertible(found, deferredAttrContext.inferenceContext.asUndetVar(req), warn); + types.isSubtypeUnchecked(inferenceContext.asUndetVar(found), inferenceContext.asUndetVar(req), warn) : + types.isConvertible(inferenceContext.asUndetVar(found), inferenceContext.asUndetVar(req), warn); } public void report(DiagnosticPosition pos, JCDiagnostic details) { diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Wed Jul 09 10:42:13 2014 -0700 @@ -866,90 +866,6 @@ return types.erasure(t); } - private boolean boundsRestricted(ClassSymbol c) { - Type st = types.supertype(c.type); - if (st.isParameterized()) { - List actuals = st.allparams(); - List formals = st.tsym.type.allparams(); - while (!actuals.isEmpty() && !formals.isEmpty()) { - Type actual = actuals.head; - Type formal = formals.head; - - if (!types.isSameType(types.erasure(actual), - types.erasure(formal))) - return true; - - actuals = actuals.tail; - formals = formals.tail; - } - } - return false; - } - - private List addOverrideBridgesIfNeeded(DiagnosticPosition pos, - final ClassSymbol c) { - ListBuffer buf = new ListBuffer<>(); - if (c.isInterface() || !boundsRestricted(c)) - return buf.toList(); - Type t = types.supertype(c.type); - Scope s = t.tsym.members(); - if (s.elems != null) { - for (Symbol sym : s.getElements(new NeedsOverridBridgeFilter(c))) { - - MethodSymbol m = (MethodSymbol)sym; - MethodSymbol member = (MethodSymbol)m.asMemberOf(c.type, types); - MethodSymbol impl = m.implementation(c, types, false); - - if ((impl == null || impl.owner != c) && - !types.isSameType(member.erasure(types), m.erasure(types))) { - addOverrideBridges(pos, m, member, c, buf); - } - } - } - return buf.toList(); - } - // where - class NeedsOverridBridgeFilter implements Filter { - - ClassSymbol c; - - NeedsOverridBridgeFilter(ClassSymbol c) { - this.c = c; - } - public boolean accepts(Symbol s) { - return s.kind == MTH && - !s.isConstructor() && - s.isInheritedIn(c, types) && - (s.flags() & FINAL) == 0 && - (s.flags() & (SYNTHETIC | OVERRIDE_BRIDGE)) != SYNTHETIC; - } - } - - private void addOverrideBridges(DiagnosticPosition pos, - MethodSymbol impl, - MethodSymbol member, - ClassSymbol c, - ListBuffer bridges) { - Type implErasure = impl.erasure(types); - long flags = (impl.flags() & AccessFlags) | SYNTHETIC | BRIDGE | OVERRIDE_BRIDGE; - member = new MethodSymbol(flags, member.name, member.type, c); - JCMethodDecl md = make.MethodDef(member, null); - JCExpression receiver = make.Super(types.supertype(c.type).tsym.erasure(types), c); - Type calltype = erasure(impl.type.getReturnType()); - JCExpression call = - make.Apply(null, - make.Select(receiver, impl).setType(calltype), - translateArgs(make.Idents(md.params), - implErasure.getParameterTypes(), null)) - .setType(calltype); - JCStatement stat = (member.getReturnType().hasTag(VOID)) - ? make.Exec(call) - : make.Return(coerce(call, member.erasure(types).getReturnType())); - md.body = make.Block(0, List.of(stat)); - c.members().enter(member); - bridges.append(md); - } - /************************************************************************** * main method *************************************************************************/ @@ -1007,8 +923,6 @@ make.at(tree.pos); if (addBridges) { ListBuffer bridges = new ListBuffer<>(); - if (false) //see CR: 6996415 - bridges.appendList(addOverrideBridgesIfNeeded(tree, c)); if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) { addBridges(tree.pos(), c, bridges); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Wed Jul 09 10:42:13 2014 -0700 @@ -1953,12 +1953,12 @@ } } - public void closeRange(char end) { - if (isLastRangeInitialized()) { + public void closeRange(char length) { + if (isLastRangeInitialized() && length > 0) { Range range = lastRange(); if (range != null) { if (range.length == Character.MAX_VALUE) { - range.length = end; + range.length = length; } } } else { @@ -2022,7 +2022,7 @@ } if (localVar.sym == aliveLocal && localVar.lastRange() != null) { char length = (char)(closingCP - localVar.lastRange().start_pc); - if (length > 0 && length < Character.MAX_VALUE) { + if (length < Character.MAX_VALUE) { localVar.closeRange(length); } } @@ -2093,7 +2093,7 @@ lvar[adr].isLastRangeInitialized()) { LocalVar v = lvar[adr]; char length = (char)(curCP() - v.lastRange().start_pc); - if (length > 0 && length < Character.MAX_VALUE) { + if (length < Character.MAX_VALUE) { lvar[adr] = v.dup(); v.closeRange(length); putVar(v); diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Wed Jul 09 10:42:13 2014 -0700 @@ -2766,7 +2766,7 @@ boolean trackVar(VarSymbol var) { return (var.owner.kind == MTH && - (var.flags() & (PARAMETER | HASINIT)) == 0 && + (var.flags() & PARAMETER) == 0 && analyzer.trackable(var)); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/DocCommentParser.java Wed Jul 09 10:42:13 2014 -0700 @@ -693,7 +693,6 @@ int p = bp; nextChar(); Name name = null; - boolean checkSemi = false; if (ch == '#') { int namep = bp; nextChar(); diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Jul 09 10:42:13 2014 -0700 @@ -412,9 +412,16 @@ case ELSE: case FINALLY: case CATCH: + case THIS: + case SUPER: + case NEW: if (stopAtStatement) return; break; + case ASSERT: + if (stopAtStatement && allowAsserts) + return ; + break; } nextToken(); } @@ -2374,8 +2381,8 @@ ListBuffer stats = variableDeclarators(mods, t, new ListBuffer()); // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon - storeEnd(stats.last(), token.endPos); accept(SEMI); + storeEnd(stats.last(), S.prevToken().endPos); return stats.toList(); } } @@ -2412,13 +2419,14 @@ ListBuffer stats = variableDeclarators(mods, t, new ListBuffer()); // A "LocalVariableDeclarationStatement" subsumes the terminating semicolon - storeEnd(stats.last(), token.endPos); accept(SEMI); + storeEnd(stats.last(), S.prevToken().endPos); return stats.toList(); } else { // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon - JCExpressionStatement expr = to(F.at(pos).Exec(checkExprStat(t))); + t = checkExprStat(t); accept(SEMI); + JCExpressionStatement expr = toP(F.at(pos).Exec(t)); return List.of(expr); } } @@ -2497,8 +2505,8 @@ JCStatement body = parseStatementAsBlock(); accept(WHILE); JCExpression cond = parExpression(); - JCDoWhileLoop t = to(F.at(pos).DoLoop(body, cond)); accept(SEMI); + JCDoWhileLoop t = toP(F.at(pos).DoLoop(body, cond)); return t; } case TRY: { @@ -2546,29 +2554,29 @@ case RETURN: { nextToken(); JCExpression result = token.kind == SEMI ? null : parseExpression(); - JCReturn t = to(F.at(pos).Return(result)); accept(SEMI); + JCReturn t = toP(F.at(pos).Return(result)); return t; } case THROW: { nextToken(); JCExpression exc = parseExpression(); - JCThrow t = to(F.at(pos).Throw(exc)); accept(SEMI); + JCThrow t = toP(F.at(pos).Throw(exc)); return t; } case BREAK: { nextToken(); Name label = LAX_IDENTIFIER.accepts(token.kind) ? ident() : null; - JCBreak t = to(F.at(pos).Break(label)); accept(SEMI); + JCBreak t = toP(F.at(pos).Break(label)); return t; } case CONTINUE: { nextToken(); Name label = LAX_IDENTIFIER.accepts(token.kind) ? ident() : null; - JCContinue t = to(F.at(pos).Continue(label)); accept(SEMI); + JCContinue t = toP(F.at(pos).Continue(label)); return t; } case SEMI: @@ -2593,8 +2601,8 @@ nextToken(); message = parseExpression(); } - JCAssert t = to(F.at(pos).Assert(assertion, message)); accept(SEMI); + JCAssert t = toP(F.at(pos).Assert(assertion, message)); return t; } /* else fall through to default case */ @@ -2609,8 +2617,9 @@ return F.at(pos).Labelled(prevToken.name(), stat); } else { // This Exec is an "ExpressionStatement"; it subsumes the terminating semicolon - JCExpressionStatement stat = to(F.at(pos).Exec(checkExprStat(expr))); + expr = checkExprStat(expr); accept(SEMI); + JCExpressionStatement stat = toP(F.at(pos).Exec(expr)); return stat; } } @@ -3513,8 +3522,8 @@ List defs = variableDeclaratorsRest(pos, mods, type, name, isInterface, dc, new ListBuffer()).toList(); - storeEnd(defs.last(), token.endPos); accept(SEMI); + storeEnd(defs.last(), S.prevToken().endPos); return defs; } else { pos = token.pos; diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Wed Jul 09 10:42:13 2014 -0700 @@ -1101,6 +1101,10 @@ # 0: symbol compiler.misc.varargs.trustme.on.virtual.varargs=\ + Instance method {0} is neither final nor private. + +# 0: symbol +compiler.misc.varargs.trustme.on.virtual.varargs.final.only=\ Instance method {0} is not final. # 0: type, 1: symbol kind, 2: symbol diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/resources/legacy.properties --- a/langtools/src/share/classes/com/sun/tools/javac/resources/legacy.properties Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/legacy.properties Wed Jul 09 10:42:13 2014 -0700 @@ -102,8 +102,6 @@ com.sun.imageio.plugins.png = tiger legacy com.sun.imageio.plugins.wbmp = tiger legacy com.sun.imageio.spi = tiger legacy -com.sun.java.browser.dom = tiger legacy -com.sun.java.browser.net = tiger legacy com.sun.java.swing = tiger legacy com.sun.java.swing.plaf.gtk = tiger legacy com.sun.java.swing.plaf.gtk.icons = tiger legacy diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java --- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java Wed Jul 09 10:42:13 2014 -0700 @@ -490,7 +490,6 @@ "org.xml.sax", "org.xml.sax.ext", "org.xml.sax.helpers", - "com.sun.java.browser.dom", "org.w3c.dom", "org.w3c.dom.bootstrap", "org.w3c.dom.ls", diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Jul 09 10:42:13 2014 -0700 @@ -656,6 +656,10 @@ if (that.packge == sym) result = that; else super.visitTopLevel(that); } + public void visitPackageDef(JCPackageDecl that) { + if (that.packge == sym) result = that; + else super.visitPackageDef(that); + } public void visitClassDef(JCClassDecl that) { if (that.sym == sym) result = that; else super.visitClassDef(that); diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -153,7 +153,7 @@ /** - * Gets a localized string from the compiler's default bundle. + * Returns a localized string from the compiler's default bundle. */ // used to support legacy Log.getLocalizedString static String getDefaultLocalizedString(String key, Object... args) { diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ * about conditions that would otherwise merit a warning. Such processing * is done when the condition is detected, and in those cases, no call is * made on any API to generate a warning at all. In consequence, this handler only - * gets to handle those warnings that JLS says must be generated. + * Returns to handle those warnings that JLS says must be generated. * *

This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -142,7 +142,7 @@ } /** - * Gets the type/symbol printer used by this formatter. + * Returns the type/symbol printer used by this formatter. * @return type/symbol rich printer */ protected RichPrinter getRichPrinter() { diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javah/NativeHeaderTool.java --- a/langtools/src/share/classes/com/sun/tools/javah/NativeHeaderTool.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javah/NativeHeaderTool.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,7 +86,7 @@ Iterable classes); /** - * Gets a new instance of the standard file manager implementation + * Returns a new instance of the standard file manager implementation * for this tool. The file manager will use the given diagnostic * listener for producing any non-fatal diagnostics. Fatal errors * will be signalled with the appropriate exceptions. diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/javap/DisassemblerTool.java --- a/langtools/src/share/classes/com/sun/tools/javap/DisassemblerTool.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javap/DisassemblerTool.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,7 +87,7 @@ Iterable classes); /** - * Gets a new instance of the standard file manager implementation + * Returns a new instance of the standard file manager implementation * for this tool. The file manager will use the given diagnostic * listener for producing any non-fatal diagnostics. Fatal errors * will be signalled with the appropriate exceptions. diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/CleanProperties.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/CleanProperties.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/CleanProperties.java Wed Jul 09 10:42:13 2014 -0700 @@ -36,6 +36,7 @@ import java.util.Properties; import com.sun.tools.sjavac.options.Options; +import com.sun.tools.sjavac.server.JavacService; /** * The clean properties transform should not be necessary. @@ -56,7 +57,8 @@ // Any extra information is ignored for clean properties. } - public boolean transform(Map> pkgSrcs, + public boolean transform(JavacService javacService, + Map> pkgSrcs, Set visibleSrcs, Map> visibleClasses, Map> oldPackageDependencies, diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java Wed Jul 09 10:42:13 2014 -0700 @@ -25,15 +25,18 @@ package com.sun.tools.sjavac; +import java.io.File; import java.io.PrintStream; import java.net.URI; import java.util.Arrays; +import java.util.Collections; import java.util.Random; import java.util.Set; import java.util.Map; import com.sun.tools.sjavac.options.Options; -import com.sun.tools.sjavac.server.JavacServer; +import com.sun.tools.sjavac.server.CompilationResult; +import com.sun.tools.sjavac.server.JavacService; import com.sun.tools.sjavac.server.SysInfo; /** @@ -64,9 +67,10 @@ args = a; } - public boolean transform(Map> pkgSrcs, - Set visibleSources, - Map> visibleClasses, + public boolean transform(final JavacService javacService, + Map> pkgSrcs, + final Set visibleSources, + final Map> visibleClasses, Map> oldPackageDependents, URI destRoot, final Map> packageArtifacts, @@ -75,24 +79,25 @@ int debugLevel, boolean incremental, int numCores, - PrintStream out, - PrintStream err) + final PrintStream out, + final PrintStream err) { boolean rc = true; boolean concurrentCompiles = true; // Fetch the id. - String id = Util.extractStringOption("id", args.getServerConf()); - if (id == null || id.equals("")) { + String idOpt = Util.extractStringOption("id", args.getServerConf()); + if (idOpt == null || idOpt.equals("")) { // No explicit id set. Create a random id so that the requests can be // grouped properly in the server. - id = "id"+(((new Random()).nextLong())&Long.MAX_VALUE); + idOpt = "id"+(((new Random()).nextLong())&Long.MAX_VALUE); } + final String id = idOpt; // Only keep portfile and sjavac settings.. String psServerSettings = Util.cleanSubOptions(Util.set("portfile","sjavac","background","keepalive"), args.getServerConf()); // Get maximum heap size from the server! - SysInfo sysinfo = JavacServer.connectGetSysInfo(psServerSettings, out, err); + SysInfo sysinfo = javacService.getSysInfo(); if (sysinfo.numCores == -1) { Log.error("Could not query server for sysinfo!"); return false; @@ -201,13 +206,10 @@ } // The return values for each chunked compile. - final int[] rn = new int[numCompiles]; + final CompilationResult[] rn = new CompilationResult[numCompiles]; // The requets, might or might not run as a background thread. final Thread[] requests = new Thread[numCompiles]; - final Set fvisible_sources = visibleSources; - final Map> fvisible_classes = visibleClasses; - long start = System.currentTimeMillis(); for (int i=0; iemptyList(), + cc.srcs, + visibleSources); + packageArtifacts.putAll(rn[ii].packageArtifacts); + packageDependencies.putAll(rn[ii].packageDependencies); + packagePubapis.putAll(rn[ii].packagePubapis); } }; @@ -253,7 +252,7 @@ else { requests[ii].run(); // If there was an error, then stop early when running single threaded. - if (rn[i] != 0) { + if (rn[i].returnCode != 0) { return false; } } @@ -269,7 +268,7 @@ // Check the return values. for (int i=0; i 0) { - if (rn[i] != 0) { + if (rn[i].returnCode != 0) { rc = false; } } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/CompileProperties.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/CompileProperties.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/CompileProperties.java Wed Jul 09 10:42:13 2014 -0700 @@ -38,6 +38,7 @@ import java.util.Map; import com.sun.tools.sjavac.options.Options; +import com.sun.tools.sjavac.server.JavacService; /** * Compile properties transform a properties file into a Java source file. @@ -63,7 +64,8 @@ public void setExtra(Options a) { } - public boolean transform(Map> pkgSrcs, + public boolean transform(JavacService javacService, + Map> pkgSrcs, Set visibleSrcs, Map> visibleClasses, Map> oldPackageDependents, diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/CopyFile.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/CopyFile.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/CopyFile.java Wed Jul 09 10:42:13 2014 -0700 @@ -32,6 +32,7 @@ import java.util.Map; import com.sun.tools.sjavac.options.Options; +import com.sun.tools.sjavac.server.JavacService; /** * The copy file transform simply copies a matching file from -src to -d . @@ -50,7 +51,8 @@ public void setExtra(Options a) { } - public boolean transform(Map> pkgSrcs, + public boolean transform(JavacService javacService, + Map> pkgSrcs, Set visibleSrcs, Map> visibleClasses, Map> oldPackageDependents, diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/JavacState.java Wed Jul 09 10:42:13 2014 -0700 @@ -40,6 +40,7 @@ import com.sun.tools.sjavac.options.Options; import com.sun.tools.sjavac.options.SourceLocation; +import com.sun.tools.sjavac.server.JavacService; /** * The javac state class maintains the previous (prev) and the current (now) @@ -625,7 +626,7 @@ sr.put(e.getKey(), e.getValue()); } } - perform(binDir, sr); + perform(null, binDir, sr); } /** @@ -641,20 +642,21 @@ sr.put(e.getKey(), e.getValue()); } - perform(gensrcDir, sr); + perform(null, gensrcDir, sr); } /** * Compile all the java sources. Return true, if it needs to be called again! */ - public boolean performJavaCompilations(Options args, + public boolean performJavaCompilations(JavacService javacService, + Options args, Set recentlyCompiled, boolean[] rcValue) { Map suffixRules = new HashMap<>(); suffixRules.put(".java", compileJavaPackages); compileJavaPackages.setExtra(args); - rcValue[0] = perform(binDir, suffixRules); + rcValue[0] = perform(javacService, binDir, suffixRules); recentlyCompiled.addAll(taintedPackages()); clearTaintedPackages(); boolean again = !packagesWithChangedPublicApis.isEmpty(); @@ -684,7 +686,9 @@ * For all packages, find all sources belonging to the package, group the sources * based on their transformers and apply the transformers on each source code group. */ - private boolean perform(File outputDir, Map suffixRules) + private boolean perform(JavacService javacService, + File outputDir, + Map suffixRules) { boolean rc = true; // Group sources based on transforms. A source file can only belong to a single transform. @@ -709,7 +713,8 @@ Map packagePublicApis = Collections.synchronizedMap(new HashMap()); - boolean r = t.transform(srcs, + boolean r = t.transform(javacService, + srcs, visibleSrcs, visibleClasses, prev.dependents(), diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/Main.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/Main.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/Main.java Wed Jul 09 10:42:13 2014 -0700 @@ -33,7 +33,9 @@ import com.sun.tools.sjavac.options.Options; import com.sun.tools.sjavac.options.SourceLocation; +import com.sun.tools.sjavac.server.JavacService; import com.sun.tools.sjavac.server.JavacServer; +import com.sun.tools.sjavac.server.JavacServiceClient; /** * The main class of the smart javac wrapper tool. @@ -339,7 +341,12 @@ do { // Clean out artifacts in tainted packages. javac_state.deleteClassArtifactsInTaintedPackages(); - again = javac_state.performJavaCompilations(options, recently_compiled, rc); + // Create a JavacService to delegate the actual compilation to. + // Currently sjavac always connects to a server through a socket + // regardless if sjavac runs as a background service or not. + // This will most likely change in the future. + JavacService javacService = new JavacServiceClient(options.getServerConf()); + again = javac_state.performJavaCompilations(javacService, options, recently_compiled, rc); if (!rc[0]) break; } while (again); // Only update the state if the compile went well. diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/Transformer.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/Transformer.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/Transformer.java Wed Jul 09 10:42:13 2014 -0700 @@ -31,6 +31,7 @@ import java.util.Map; import com.sun.tools.sjavac.options.Options; +import com.sun.tools.sjavac.server.JavacService; /** * The transform interface is used to transform content inside a package, from one form to another. @@ -82,7 +83,8 @@ * If num_cores is set to a non-zero value. The transform should attempt to use no more than these * number of threads for heavy work. */ - boolean transform(Map> pkgSrcs, + boolean transform(JavacService javacService, + Map> pkgSrcs, Set visibleSources, Map> visibleClasses, Map> oldPackageDependencies, diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/Util.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/Util.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/Util.java Wed Jul 09 10:42:13 2014 -0700 @@ -26,6 +26,8 @@ package com.sun.tools.sjavac; import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import java.nio.file.Path; import java.util.Arrays; import java.util.HashSet; @@ -67,17 +69,32 @@ } public static String extractStringOption(String opName, String s) { + return extractStringOption(opName, s, null); + } + + public static String extractStringOption(String opName, String s, String deflt) { int p = s.indexOf(opName+"="); - if (p == -1) return null; + if (p == -1) return deflt; p+=opName.length()+1; int pe = s.indexOf(',', p); if (pe == -1) pe = s.length(); return s.substring(p, pe); } + public static boolean extractBooleanOption(String opName, String s, boolean deflt) { + String str = extractStringOption(opName, s); + return "true".equals(str) ? true + : "false".equals(str) ? false + : deflt; + } + public static int extractIntOption(String opName, String s) { + return extractIntOption(opName, s, 0); + } + + public static int extractIntOption(String opName, String s, int deflt) { int p = s.indexOf(opName+"="); - if (p == -1) return 0; + if (p == -1) return deflt; p+=opName.length()+1; int pe = s.indexOf(',', p); if (pe == -1) pe = s.length(); diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/comp/JavaCompilerWithDeps.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/comp/JavaCompilerWithDeps.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/comp/JavaCompilerWithDeps.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,6 @@ import com.sun.tools.javac.main.JavaCompiler; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.code.Symbol.ClassSymbol; -import com.sun.tools.sjavac.server.CompilerThread; -import java.io.File; /** Subclass to Resolve that overrides collect. * @@ -44,16 +42,16 @@ /** The dependency database */ protected Dependencies deps; - protected CompilerThread compilerThread; + protected JavacServiceImpl javacService; - public JavaCompilerWithDeps(Context context, CompilerThread t) { + public JavaCompilerWithDeps(Context context, JavacServiceImpl jsi) { super(context); deps = Dependencies.instance(context); - compilerThread = t; + javacService = jsi; needRootClasses = true; } - public static void preRegister(Context context, final CompilerThread t) { + public static void preRegister(Context context, final JavacServiceImpl t) { context.put(compilerKey, new Context.Factory() { public JavaCompiler make(Context c) { JavaCompiler instance = new JavaCompilerWithDeps(c, t); @@ -99,7 +97,7 @@ // Now check if the truncated uri ends with the path. (It does not == failure!) if (path.length() > 0 && !path.equals("/unnamed package/") && !pp.endsWith(path)) { - compilerThread.logError("Error: The source file "+sym.sourcefile.getName()+ + javacService.logError("Error: The source file "+sym.sourcefile.getName()+ " is located in the wrong package directory, because it contains the class "+ sym.getQualifiedName()); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/comp/JavacServiceImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/comp/JavacServiceImpl.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,121 @@ +package com.sun.tools.sjavac.comp; + +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.URI; +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +import javax.tools.JavaCompiler.CompilationTask; +import javax.tools.JavaFileObject; +import javax.tools.StandardJavaFileManager; + +import com.sun.tools.javac.api.JavacTaskImpl; +import com.sun.tools.javac.api.JavacTool; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.ListBuffer; +import com.sun.tools.sjavac.Util; +import com.sun.tools.sjavac.server.CompilationResult; +import com.sun.tools.sjavac.server.JavacServer; +import com.sun.tools.sjavac.server.JavacService; +import com.sun.tools.sjavac.server.SysInfo; + +public class JavacServiceImpl implements JavacService { + + JavacServer javacServer; + private ThreadLocal forcedExit; + + public JavacServiceImpl(JavacServer javacServer) { + this.javacServer = javacServer; + + } + + public void logError(String msg) { +// stderr.println(msg); + forcedExit.set(true); + } + + @Override + public SysInfo getSysInfo() { + return new SysInfo(Runtime.getRuntime().availableProcessors(), + Runtime.getRuntime().maxMemory()); + } + + @Override + public CompilationResult compile(String protocolId, + String invocationId, + String[] args, + List explicitSources, + Set sourcesToCompile, + Set visibleSources) { + + JavacTool compiler = JavacTool.create(); + StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); + SmartFileManager smartFileManager = new SmartFileManager(fileManager); + Context context = new Context(); + ResolveWithDeps.preRegister(context); + AttrWithDeps.preRegister(context); + JavaCompilerWithDeps.preRegister(context, this); + + // Now setup the actual compilation.... + CompilationResult compilationResult = new CompilationResult(0); + + // First deal with explicit source files on cmdline and in at file. + ListBuffer compilationUnits = new ListBuffer<>(); + for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(explicitSources)) { + compilationUnits.append(i); + } + // Now deal with sources supplied as source_to_compile. + ListBuffer sourcesToCompileFiles = new ListBuffer<>(); + for (URI u : sourcesToCompile) { + sourcesToCompileFiles.append(new File(u)); + } + for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(sourcesToCompileFiles)) { + compilationUnits.append(i); + } + // Log the options to be used. + StringBuilder options = new StringBuilder(); + for (String s : args) { + options.append(">").append(s).append("< "); + } + javacServer.log(protocolId+" <"+invocationId+"> options "+options.toString()); + + forcedExit.set(false); + // Create a new logger. + StringWriter stdoutLog = new StringWriter(); + StringWriter stderrLog = new StringWriter(); + PrintWriter stdout = new PrintWriter(stdoutLog); + PrintWriter stderr = new PrintWriter(stderrLog); + com.sun.tools.javac.main.Main.Result rc = com.sun.tools.javac.main.Main.Result.OK; + try { + if (compilationUnits.size() > 0) { + smartFileManager.setVisibleSources(visibleSources); + smartFileManager.cleanArtifacts(); + smartFileManager.setLog(stdout); + + + // Do the compilation! + CompilationTask task = compiler.getTask(stderr, smartFileManager, null, Arrays.asList(args), null, compilationUnits, context); + rc = ((JavacTaskImpl) task).doCall(); + smartFileManager.flush(); + } + } catch (Exception e) { + stderr.println(e.getMessage()); + forcedExit.set(true); + } + + compilationResult.packageArtifacts = smartFileManager.getPackageArtifacts(); + + Dependencies deps = Dependencies.instance(context); + compilationResult.packageDependencies = deps.getDependencies(); + compilationResult.packagePubapis = deps.getPubapis(); + + compilationResult.stdout = stdoutLog.toString(); + compilationResult.stderr = stderrLog.toString(); + compilationResult.returnCode = rc.exitCode == 0 && forcedExit.get() ? -1 : rc.exitCode; + + return compilationResult; + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,17 +25,21 @@ package com.sun.tools.sjavac.comp; -import com.sun.tools.javac.util.ListBuffer; import java.io.IOException; import java.io.PrintWriter; import java.net.URI; -import java.util.Set; +import java.util.HashMap; import java.util.HashSet; import java.util.Map; -import java.util.HashMap; +import java.util.Set; + import javax.tools.*; import javax.tools.JavaFileObject.Kind; +import com.sun.tools.javac.file.JavacFileManager; +import com.sun.tools.javac.util.BaseFileManager; +import com.sun.tools.javac.util.ListBuffer; + /** * Intercepts reads and writes to the file system to gather * information about what artifacts are generated. @@ -76,6 +80,15 @@ stdout = pw; } + /** + * Set whether or not to use ct.sym as an alternate to rt.jar. + */ + public void setSymbolFileEnabled(boolean b) { + if (!(fileManager instanceof JavacFileManager)) + throw new IllegalStateException(); + ((JavacFileManager) fileManager).setSymbolFileEnabled(b); + } + public Map> getPackageArtifacts() { return packageArtifacts; } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/server/CompilationResult.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilationResult.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,30 @@ +package com.sun.tools.sjavac.server; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class CompilationResult { + + // Return code constants + public final static int ERROR_BUT_TRY_AGAIN = -4712; + public final static int ERROR_FATAL = -1; + + public int returnCode; + public Map> packageArtifacts = new HashMap<>(); + public Map> packageDependencies = new HashMap<>(); + public Map packagePubapis = new HashMap<>(); + public SysInfo sysinfo; + public String stdout; + public String stderr; + + public CompilationResult(int returnCode) { + this.returnCode = returnCode; + this.sysinfo = new SysInfo(-1, -1); + } + + public void setReturnCode(int returnCode) { + this.returnCode = returnCode; + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerPool.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerPool.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerPool.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ import java.util.Stack; import java.util.concurrent.Future; +import com.sun.tools.sjavac.comp.JavacServiceImpl; + /** The compiler pool maintains compiler threads. * *

This is NOT part of any supported API. @@ -147,7 +149,7 @@ public CompilerThread grabCompilerThread() throws InterruptedException { available.acquire(); if (compilers.empty()) { - return new CompilerThread(this); + return new CompilerThread(this, new JavacServiceImpl(javacServer)); } return compilers.pop(); } diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/CompilerThread.java Wed Jul 09 10:42:13 2014 -0700 @@ -44,19 +44,18 @@ import java.util.concurrent.Future; import javax.tools.JavaCompiler.CompilationTask; -import javax.tools.JavaFileManager; import javax.tools.JavaFileObject; import javax.tools.StandardJavaFileManager; import com.sun.tools.javac.api.JavacTaskImpl; -import com.sun.tools.javac.util.BaseFileManager; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.ListBuffer; -import com.sun.tools.javac.util.Log; +import com.sun.tools.javac.util.Options; import com.sun.tools.javac.util.StringUtils; import com.sun.tools.sjavac.comp.AttrWithDeps; import com.sun.tools.sjavac.comp.Dependencies; import com.sun.tools.sjavac.comp.JavaCompilerWithDeps; +import com.sun.tools.sjavac.comp.JavacServiceImpl; import com.sun.tools.sjavac.comp.ResolveWithDeps; import com.sun.tools.sjavac.comp.SmartFileManager; @@ -73,6 +72,7 @@ public class CompilerThread implements Runnable { private JavacServer javacServer; private CompilerPool compilerPool; + private JavacServiceImpl javacServiceImpl; private List> subTasks; // Communicating over this socket. @@ -87,9 +87,10 @@ // If true, then this thread is serving a request. private boolean inUse = false; - CompilerThread(CompilerPool cp) { + CompilerThread(CompilerPool cp, JavacServiceImpl javacServiceImpl) { compilerPool = cp; javacServer = cp.getJavacServer(); + this.javacServiceImpl = javacServiceImpl; } /** @@ -133,7 +134,7 @@ context = new Context(); ResolveWithDeps.preRegister(context); AttrWithDeps.preRegister(context); - JavaCompilerWithDeps.preRegister(context, this); + JavaCompilerWithDeps.preRegister(context, javacServiceImpl); subTasks = new ArrayList<>(); } @@ -320,6 +321,7 @@ // Do the compilation! CompilationTask task = compiler.getTask(stderr, smartFileManager, null, the_options, null, compilationUnits, context); + smartFileManager.setSymbolFileEnabled(!Options.instance(context).isSet("ignore.symbol.file")); rc = ((JavacTaskImpl) task).doCall(); while (numActiveSubTasks()>0) { diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java Wed Jul 09 10:42:13 2014 -0700 @@ -24,30 +24,22 @@ */ package com.sun.tools.sjavac.server; -import java.io.BufferedReader; import java.io.File; import java.io.IOException; -import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.FileNotFoundException; -import java.net.URI; -import java.util.HashSet; -import java.util.Set; import java.util.HashMap; import java.util.Map; import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; -import java.net.SocketAddress; import java.util.ArrayList; import java.util.Random; import com.sun.tools.sjavac.Util; import com.sun.tools.sjavac.ProblemException; import java.io.*; -import java.util.*; /** * The JavacServer class contains methods both to setup a server that responds to requests and methods to connect to this server. @@ -73,8 +65,6 @@ // Though usually only one javac server is started by a client. private static Map allPortFiles; private static Map maxServerMemory; - final static int ERROR_FATAL = -1; - final static int ERROR_BUT_TRY_AGAIN = -4712; final static String PROTOCOL_COOKIE_VERSION = "----THE-COOKIE-V2----"; final static String PROTOCOL_CWD = "----THE-CWD----"; final static String PROTOCOL_ID = "----THE-ID----"; @@ -99,7 +89,7 @@ /** * Acquire the port file. Synchronized since several threads inside an smart javac wrapper client acquires the same port file at the same time. */ - private static synchronized PortFile getPortFile(String filename) throws FileNotFoundException { + public static synchronized PortFile getPortFile(String filename) throws FileNotFoundException { if (allPortFiles == null) { allPortFiles = new HashMap<>(); } @@ -179,17 +169,12 @@ // and stderr are redirected already. // The pool size is a limit the number of concurrent compiler threads used. // The server might use less than these to avoid memory problems. - int poolsize = Util.extractIntOption("poolsize", settings); - if (poolsize <= 0) { - // If not set, default to the number of cores. - poolsize = Runtime.getRuntime().availableProcessors(); - } + int defaultPoolSize = Runtime.getRuntime().availableProcessors(); + int poolsize = Util.extractIntOption("poolsize", settings, defaultPoolSize); // How many seconds of inactivity will the server accept before quitting? - int keepalive = Util.extractIntOption("keepalive", settings); - if (keepalive <= 0) { - keepalive = 120; - } + int keepalive = Util.extractIntOption("keepalive", settings, 120); + // The port file is locked and the server port and cookie is written into it. PortFile portFile = getPortFile(portfile); JavacServer s; @@ -220,134 +205,6 @@ } /** - * Dispatch a compilation request to a javac server. - * - * @param args are the command line args to javac and is allowed to contain source files, @file and other command line options to javac. - * - * The generated classes, h files and other artifacts from the javac invocation are stored by the javac server to disk. - * - * @param sources_to_compile The sources to compile. - * - * @param visibleSources If visible sources has a non zero size, then visible_sources are the only files in the file system that the javac server can see! - * (Sources to compile are always visible.) The visible sources are those supplied by the (filtered) -sourcepath - * - * @param visibleClasses If visible classes for a specific root/jar has a non zero size, then visible_classes are the only class files that the javac server - * can see, in that root/jar. It maps from a classpath root or a jar file to the set of visible classes for that root/jar. - * - * The server return meta data about the build in the following parameters. - * @param package_artifacts, map from package name to set of created artifacts for that package. - * @param package_dependencies, map from package name to set of packages that it depends upon. - * @param package_pubapis, map from package name to unique string identifying its pub api. - */ - public static int useServer(String settings, String[] args, - Set sourcesToCompile, - Set visibleSources, - Map> visibleClasses, - Map> packageArtifacts, - Map> packageDependencies, - Map packagePubapis, - SysInfo sysinfo, - PrintStream out, - PrintStream err) { - try { - // The id can perhaps be used in the future by the javac server to reuse the - // JavaCompiler instance for several compiles using the same id. - String id = Util.extractStringOption("id", settings); - String portfile = Util.extractStringOption("portfile", settings); - String logfile = Util.extractStringOption("logfile", settings); - String stdouterrfile = Util.extractStringOption("stdouterrfile", settings); - String background = Util.extractStringOption("background", settings); - if (background == null || !background.equals("false")) { - background = "true"; - } - // The sjavac option specifies how the server part of sjavac is spawned. - // If you have the experimental sjavac in your path, you are done. If not, you have - // to point to a com.sun.tools.sjavac.Main that supports --startserver - // for example by setting: sjavac=java%20-jar%20...javac.jar%com.sun.tools.sjavac.Main - String sjavac = Util.extractStringOption("sjavac", settings); - int poolsize = Util.extractIntOption("poolsize", settings); - int keepalive = Util.extractIntOption("keepalive", settings); - - if (keepalive <= 0) { - // Default keepalive for server is 120 seconds. - // I.e. it will accept 120 seconds of inactivity before quitting. - keepalive = 120; - } - if (portfile == null) { - err.println("No portfile was specified!"); - return -1; - } - if (logfile == null) { - logfile = portfile + ".javaclog"; - } - if (stdouterrfile == null) { - stdouterrfile = portfile + ".stdouterr"; - } - // Default to sjavac and hope it is in the path. - if (sjavac == null) { - sjavac = "sjavac"; - } - - int attempts = 0; - int rc = -1; - do { - PortFile port_file = getPortFile(portfile); - synchronized (port_file) { - port_file.lock(); - port_file.getValues(); - port_file.unlock(); - } - if (!port_file.containsPortInfo()) { - String cmd = fork(sjavac, port_file.getFilename(), logfile, poolsize, keepalive, err, stdouterrfile, background); - - if (background.equals("true") && !port_file.waitForValidValues()) { - // Ouch the server did not start! Lets print its stdouterrfile and the command used. - printFailedAttempt(cmd, stdouterrfile, err); - // And give up. - return -1; - } - } - rc = connectAndCompile(port_file, id, args, sourcesToCompile, visibleSources, - packageArtifacts, packageDependencies, packagePubapis, sysinfo, - out, err); - // Try again until we manage to connect. Any error after that - // will cause the compilation to fail. - if (rc == ERROR_BUT_TRY_AGAIN) { - // We could not connect to the server. Try again. - attempts++; - try { - Thread.sleep(WAIT_BETWEEN_CONNECT_ATTEMPTS * 1000); - } catch (InterruptedException e) { - } - } - } while (rc == ERROR_BUT_TRY_AGAIN && attempts < MAX_NUM_CONNECT_ATTEMPTS); - return rc; - } catch (Exception e) { - e.printStackTrace(err); - return -1; - } - } - - private static void printFailedAttempt(String cmd, String f, PrintStream err) { - err.println("---- Failed to start javac server with this command -----"); - err.println(cmd); - try { - BufferedReader in = new BufferedReader(new FileReader(f)); - err.println("---- stdout/stderr output from attempt to start javac server -----"); - for (;;) { - String l = in.readLine(); - if (l == null) { - break; - } - err.println(l); - } - err.println("------------------------------------------------------------------"); - } catch (Exception e) { - err.println("The stdout/stderr output in file " + f + " does not exist and the server did not start."); - } - } - - /** * Spawn the server instance. */ @@ -367,15 +224,15 @@ /** * Fork a background process. Returns the command line used that can be printed if something failed. */ - private static String fork(String sjavac, String portfile, String logfile, int poolsize, int keepalive, - final PrintStream err, String stdouterrfile, String background) + public static String fork(String sjavac, String portfile, String logfile, int poolsize, int keepalive, + final PrintStream err, String stdouterrfile, boolean background) throws IOException, ProblemException { if (stdouterrfile != null && stdouterrfile.trim().equals("")) { stdouterrfile = null; } final String startserver = "--startserver:portfile=" + portfile + ",logfile=" + logfile + ",stdouterrfile=" + stdouterrfile + ",poolsize=" + poolsize + ",keepalive="+ keepalive; - if (background.equals("true")) { + if (background) { sjavac += "%20" + startserver; sjavac = sjavac.replaceAll("%20", " "); sjavac = sjavac.replaceAll("%2C", ","); @@ -421,243 +278,6 @@ } /** - * Expect this key on the next line read from the reader. - */ - private static boolean expect(BufferedReader in, String key) throws IOException { - String s = in.readLine(); - if (s != null && s.equals(key)) { - return true; - } - return false; - } - - /** - * Make a request to the server only to get the maximum possible heap size to use for compilations. - * - * @param port_file The port file used to synchronize creation of this server. - * @param id The identify of the compilation. - * @param out Standard out information. - * @param err Standard err information. - * @return The maximum heap size in bytes. - */ - public static SysInfo connectGetSysInfo(String serverSettings, PrintStream out, PrintStream err) { - SysInfo sysinfo = new SysInfo(-1, -1); - String id = Util.extractStringOption("id", serverSettings); - String portfile = Util.extractStringOption("portfile", serverSettings); - try { - PortFile pf = getPortFile(portfile); - useServer(serverSettings, new String[0], - new HashSet(), - new HashSet(), - new HashMap>(), - new HashMap>(), - new HashMap>(), - new HashMap(), - sysinfo, out, err); - } catch (Exception e) { - e.printStackTrace(err); - } - return sysinfo; - } - - /** - * Connect and compile using the javac server settings and the args. When using more advanced features, the sources_to_compile and visible_sources are - * supplied to the server and meta data is returned in package_artifacts, package_dependencies and package_pubapis. - */ - private static int connectAndCompile(PortFile portFile, String id, String[] args, - Set sourcesToCompile, - Set visibleSources, - Map> packageArtifacts, - Map> packageDependencies, - Map packagePublicApis, - SysInfo sysinfo, - PrintStream out, - PrintStream err) { - int rc = -3; - try { - int port = portFile.containsPortInfo() ? portFile.getPort() : 0; - if (port == 0) { - return ERROR_BUT_TRY_AGAIN; - } - long cookie = portFile.getCookie(); - - // Acquire the localhost/127.0.0.1 address. - InetAddress addr = InetAddress.getByName(null); - SocketAddress sockaddr = new InetSocketAddress(addr, port); - Socket sock = new Socket(); - int timeoutMs = CONNECTION_TIMEOUT * 1000; - try { - sock.connect(sockaddr, timeoutMs); - } catch (java.net.ConnectException e) { - err.println("Could not connect to javac server found in portfile: " + portFile.getFilename() + " " + e); - return ERROR_BUT_TRY_AGAIN; - } - if (!sock.isConnected()) { - err.println("Could not connect to javac server found in portfile: " + portFile.getFilename()); - return ERROR_BUT_TRY_AGAIN; - } - BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream())); - PrintWriter sockout = new PrintWriter(sock.getOutputStream()); - - sockout.println(PROTOCOL_COOKIE_VERSION); - sockout.println("" + cookie); - sockout.println(PROTOCOL_CWD); - sockout.println(System.getProperty("user.dir")); - sockout.println(PROTOCOL_ID); - sockout.println(id); - sockout.println(PROTOCOL_ARGS); - for (String s : args) { - StringBuffer buf = new StringBuffer(); - String[] paths = s.split(File.pathSeparator); - int c = 0; - for (String path : paths) { - File f = new File(path); - if (f.isFile() || f.isDirectory()) { - buf.append(f.getAbsolutePath()); - c++; - if (c < paths.length) { - buf.append(File.pathSeparator); - } - } else { - buf = new StringBuffer(s); - break; - } - } - sockout.println(buf.toString()); - } - sockout.println(PROTOCOL_SOURCES_TO_COMPILE); - for (URI uri : sourcesToCompile) { - sockout.println(uri.toString()); - } - sockout.println(PROTOCOL_VISIBLE_SOURCES); - for (URI uri : visibleSources) { - sockout.println(uri.toString()); - } - sockout.println(PROTOCOL_END); - sockout.flush(); - - StringBuffer stdout = new StringBuffer(); - StringBuffer stderr = new StringBuffer(); - - if (!expect(in, PROTOCOL_STDOUT)) { - return ERROR_FATAL; - } - // Load stdout - for (;;) { - String l = in.readLine(); - if (l == null) { - return ERROR_FATAL; - } - if (l.equals(PROTOCOL_STDERR)) { - break; - } - stdout.append(l); - stdout.append('\n'); - } - // Load stderr - for (;;) { - String l = in.readLine(); - if (l == null) { - return ERROR_FATAL; - } - if (l.equals(PROTOCOL_PACKAGE_ARTIFACTS)) { - break; - } - stderr.append(l); - stderr.append('\n'); - } - // Load the package artifacts - Set lastUriSet = null; - for (;;) { - String l = in.readLine(); - if (l == null) { - return ERROR_FATAL; - } - if (l.equals(PROTOCOL_PACKAGE_DEPENDENCIES)) { - break; - } - if (l.length() > 1 && l.charAt(0) == '+') { - String pkg = l.substring(1); - lastUriSet = new HashSet<>(); - packageArtifacts.put(pkg, lastUriSet); - } else if (l.length() > 1 && lastUriSet != null) { - lastUriSet.add(new URI(l.substring(1))); - } - } - // Load package dependencies - Set lastPackageSet = null; - for (;;) { - String l = in.readLine(); - if (l == null) { - return ERROR_FATAL; - } - if (l.equals(PROTOCOL_PACKAGE_PUBLIC_APIS)) { - break; - } - if (l.length() > 1 && l.charAt(0) == '+') { - String pkg = l.substring(1); - lastPackageSet = new HashSet<>(); - packageDependencies.put(pkg, lastPackageSet); - } else if (l.length() > 1 && lastPackageSet != null) { - lastPackageSet.add(l.substring(1)); - } - } - // Load package pubapis - Map tmp = new HashMap<>(); - StringBuffer lastPublicApi = null; - for (;;) { - String l = in.readLine(); - if (l == null) { - return ERROR_FATAL; - } - if (l.equals(PROTOCOL_SYSINFO)) { - break; - } - if (l.length() > 1 && l.charAt(0) == '+') { - String pkg = l.substring(1); - lastPublicApi = new StringBuffer(); - tmp.put(pkg, lastPublicApi); - } else if (l.length() > 1 && lastPublicApi != null) { - lastPublicApi.append(l.substring(1)); - lastPublicApi.append("\n"); - } - } - for (String p : tmp.keySet()) { - assert (packagePublicApis.get(p) == null); - String api = tmp.get(p).toString(); - packagePublicApis.put(p, api); - } - // Now reading the max memory possible. - for (;;) { - String l = in.readLine(); - if (l == null) { - return ERROR_FATAL; - } - if (l.equals(PROTOCOL_RETURN_CODE)) { - break; - } - if (l.startsWith("num_cores=") && sysinfo != null) { - sysinfo.numCores = Integer.parseInt(l.substring(10)); - } - if (l.startsWith("max_memory=") && sysinfo != null) { - sysinfo.maxMemory = Long.parseLong(l.substring(11)); - } - } - String l = in.readLine(); - if (l == null) { - err.println("No return value from the server!"); - return ERROR_FATAL; - } - rc = Integer.parseInt(l); - out.print(stdout); - err.print(stderr); - } catch (Exception e) { - e.printStackTrace(err); - } - return rc; - } - - /** * Run the server thread until it exits. Either because of inactivity or because the port file has been deleted by someone else, or overtaken by some other * javac server. */ diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/server/JavacService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacService.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,18 @@ +package com.sun.tools.sjavac.server; + +import java.io.File; +import java.net.URI; +import java.util.List; +import java.util.Set; + +public interface JavacService { + + SysInfo getSysInfo(); + + CompilationResult compile(String protocolId, + String invocationId, + String[] args, + List explicitSources, + Set sourcesToCompile, + Set visibleSources); +} diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServiceClient.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServiceClient.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,408 @@ +package com.sun.tools.sjavac.server; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.URI; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.sun.tools.sjavac.Util; + +import static com.sun.tools.sjavac.server.CompilationResult.ERROR_BUT_TRY_AGAIN; +import static com.sun.tools.sjavac.server.CompilationResult.ERROR_FATAL; + +public class JavacServiceClient implements JavacService { + + + // The id can perhaps be used in the future by the javac server to reuse the + // JavaCompiler instance for several compiles using the same id. + private final String id; + private final String portfile; + private final String logfile; + private final String stdouterrfile; + private final boolean background; + + // Default keepalive for server is 120 seconds. + // I.e. it will accept 120 seconds of inactivity before quitting. + private final int keepalive; + private final int poolsize; + + // The sjavac option specifies how the server part of sjavac is spawned. + // If you have the experimental sjavac in your path, you are done. If not, you have + // to point to a com.sun.tools.sjavac.Main that supports --startserver + // for example by setting: sjavac=java%20-jar%20...javac.jar%com.sun.tools.sjavac.Main + private final String sjavac; + + public JavacServiceClient(String settings) { + id = Util.extractStringOption("id", settings); + portfile = Util.extractStringOption("portfile", settings); + logfile = Util.extractStringOption("logfile", settings, portfile + ".javaclog"); + stdouterrfile = Util.extractStringOption("stdouterrfile", settings, portfile + ".stdouterr"); + background = Util.extractBooleanOption("background", settings, true); + sjavac = Util.extractStringOption("sjavac", settings, "sjavac"); + int poolsize = Util.extractIntOption("poolsize", settings); + keepalive = Util.extractIntOption("keepalive", settings, 120); + + this.poolsize = poolsize > 0 ? poolsize : Runtime.getRuntime().availableProcessors(); + } + + + /** + * Make a request to the server only to get the maximum possible heap size to use for compilations. + * + * @param port_file The port file used to synchronize creation of this server. + * @param id The identify of the compilation. + * @param out Standard out information. + * @param err Standard err information. + * @return The maximum heap size in bytes. + */ + @Override + public SysInfo getSysInfo() { + try { + CompilationResult cr = useServer(new String[0], + Collections.emptySet(), + Collections.emptySet(), + Collections.>emptyMap()); + return cr.sysinfo; + } catch (Exception e) { + return new SysInfo(-1, -1); + } + } + + @Override + public CompilationResult compile(String protocolId, + String invocationId, + String[] args, + List explicitSources, + Set sourcesToCompile, + Set visibleSources) { + // Delegate to useServer, which delegates to compileHelper + return useServer(args, sourcesToCompile, visibleSources, null); + } + + /** + * Connect and compile using the javac server settings and the args. When using more advanced features, the sources_to_compile and visible_sources are + * supplied to the server and meta data is returned in package_artifacts, package_dependencies and package_pubapis. + */ + public CompilationResult compileHelper(String id, + String[] args, + Set sourcesToCompile, + Set visibleSources) { + + CompilationResult rc = new CompilationResult(-3); + + try { + PortFile portFile = JavacServer.getPortFile(this.portfile); + + int port = portFile.containsPortInfo() ? portFile.getPort() : 0; + if (port == 0) { + return new CompilationResult(ERROR_BUT_TRY_AGAIN); + } + long cookie = portFile.getCookie(); + // Acquire the localhost/127.0.0.1 address. + InetAddress addr = InetAddress.getByName(null); + SocketAddress sockaddr = new InetSocketAddress(addr, port); + Socket sock = new Socket(); + int timeoutMs = JavacServer.CONNECTION_TIMEOUT * 1000; + try { + sock.connect(sockaddr, timeoutMs); + } catch (java.net.ConnectException e) { + rc.setReturnCode(ERROR_BUT_TRY_AGAIN); + rc.stderr = "Could not connect to javac server found in portfile: " + portFile.getFilename() + " " + e; + return rc; + } + if (!sock.isConnected()) { + rc.setReturnCode(ERROR_BUT_TRY_AGAIN); + rc.stderr = "Could not connect to javac server found in portfile: " + portFile.getFilename(); + return rc; + } + + // + // Send arguments + // + BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream())); + PrintWriter sockout = new PrintWriter(sock.getOutputStream()); + + sockout.println(JavacServer.PROTOCOL_COOKIE_VERSION); + sockout.println("" + cookie); + sockout.println(JavacServer.PROTOCOL_CWD); + sockout.println(System.getProperty("user.dir")); + sockout.println(JavacServer.PROTOCOL_ID); + sockout.println(id); + sockout.println(JavacServer.PROTOCOL_ARGS); + for (String s : args) { + StringBuffer buf = new StringBuffer(); + String[] paths = s.split(File.pathSeparator); + int c = 0; + for (String path : paths) { + File f = new File(path); + if (f.isFile() || f.isDirectory()) { + buf.append(f.getAbsolutePath()); + c++; + if (c < paths.length) { + buf.append(File.pathSeparator); + } + } else { + buf = new StringBuffer(s); + break; + } + } + sockout.println(buf.toString()); + } + sockout.println(JavacServer.PROTOCOL_SOURCES_TO_COMPILE); + for (URI uri : sourcesToCompile) { + sockout.println(uri.toString()); + } + sockout.println(JavacServer.PROTOCOL_VISIBLE_SOURCES); + for (URI uri : visibleSources) { + sockout.println(uri.toString()); + } + sockout.println(JavacServer.PROTOCOL_END); + sockout.flush(); + + // + // Receive result + // + StringBuffer stdout = new StringBuffer(); + StringBuffer stderr = new StringBuffer(); + + if (!JavacServiceClient.expect(in, JavacServer.PROTOCOL_STDOUT)) { + return new CompilationResult(ERROR_FATAL); + } + // Load stdout + for (;;) { + String l = in.readLine(); + if (l == null) { + return new CompilationResult(ERROR_FATAL); + } + if (l.equals(JavacServer.PROTOCOL_STDERR)) { + break; + } + stdout.append(l); + stdout.append('\n'); + } + // Load stderr + for (;;) { + String l = in.readLine(); + if (l == null) { + return new CompilationResult(ERROR_FATAL); + } + if (l.equals(JavacServer.PROTOCOL_PACKAGE_ARTIFACTS)) { + break; + } + stderr.append(l); + stderr.append('\n'); + } + // Load the package artifacts + Set lastUriSet = null; + for (;;) { + String l = in.readLine(); + if (l == null) { + return new CompilationResult(ERROR_FATAL); + } + if (l.equals(JavacServer.PROTOCOL_PACKAGE_DEPENDENCIES)) { + break; + } + if (l.length() > 1 && l.charAt(0) == '+') { + String pkg = l.substring(1); + lastUriSet = new HashSet<>(); + rc.packageArtifacts.put(pkg, lastUriSet); + } else if (l.length() > 1 && lastUriSet != null) { + lastUriSet.add(new URI(l.substring(1))); + } + } + // Load package dependencies + Set lastPackageSet = null; + for (;;) { + String l = in.readLine(); + if (l == null) { + return new CompilationResult(ERROR_FATAL); + } + if (l.equals(JavacServer.PROTOCOL_PACKAGE_PUBLIC_APIS)) { + break; + } + if (l.length() > 1 && l.charAt(0) == '+') { + String pkg = l.substring(1); + lastPackageSet = new HashSet<>(); + rc.packageDependencies.put(pkg, lastPackageSet); + } else if (l.length() > 1 && lastPackageSet != null) { + lastPackageSet.add(l.substring(1)); + } + } + // Load package pubapis + Map tmp = new HashMap<>(); + StringBuffer lastPublicApi = null; + for (;;) { + String l = in.readLine(); + if (l == null) { + return new CompilationResult(ERROR_FATAL); + } + if (l.equals(JavacServer.PROTOCOL_SYSINFO)) { + break; + } + if (l.length() > 1 && l.charAt(0) == '+') { + String pkg = l.substring(1); + lastPublicApi = new StringBuffer(); + tmp.put(pkg, lastPublicApi); + } else if (l.length() > 1 && lastPublicApi != null) { + lastPublicApi.append(l.substring(1)); + lastPublicApi.append("\n"); + } + } + for (String p : tmp.keySet()) { + //assert (packagePublicApis.get(p) == null); + String api = tmp.get(p).toString(); + rc.packagePubapis.put(p, api); + } + // Now reading the max memory possible. + for (;;) { + String l = in.readLine(); + if (l == null) { + return new CompilationResult(ERROR_FATAL); + } + if (l.equals(JavacServer.PROTOCOL_RETURN_CODE)) { + break; + } + if (l.startsWith("num_cores=")) { + rc.sysinfo.numCores = Integer.parseInt(l.substring(10)); + } + if (l.startsWith("max_memory=")) { + rc.sysinfo.maxMemory = Long.parseLong(l.substring(11)); + } + } + String l = in.readLine(); + if (l == null) { + rc.setReturnCode(ERROR_FATAL); + rc.stderr = "No return value from the server!"; + return rc; + } + rc.setReturnCode(Integer.parseInt(l)); + rc.stdout = stdout.toString(); + rc.stderr = stderr.toString(); + } catch (Exception e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + rc.stderr = sw.toString(); + } + return rc; + } + + /** + * Dispatch a compilation request to a javac server. + * + * @param args are the command line args to javac and is allowed to contain source files, @file and other command line options to javac. + * + * The generated classes, h files and other artifacts from the javac invocation are stored by the javac server to disk. + * + * @param sources_to_compile The sources to compile. + * + * @param visibleSources If visible sources has a non zero size, then visible_sources are the only files in the file system that the javac server can see! + * (Sources to compile are always visible.) The visible sources are those supplied by the (filtered) -sourcepath + * + * @param visibleClasses If visible classes for a specific root/jar has a non zero size, then visible_classes are the only class files that the javac server + * can see, in that root/jar. It maps from a classpath root or a jar file to the set of visible classes for that root/jar. + * + * The server return meta data about the build in the following parameters. + * @param package_artifacts, map from package name to set of created artifacts for that package. + * @param package_dependencies, map from package name to set of packages that it depends upon. + * @param package_pubapis, map from package name to unique string identifying its pub api. + */ + public CompilationResult useServer(String[] args, + Set sourcesToCompile, + Set visibleSources, + Map> visibleClasses) { + try { + if (portfile == null) { + CompilationResult cr = new CompilationResult(CompilationResult.ERROR_FATAL); + cr.stderr = "No portfile was specified!"; + return cr; + } + + int attempts = 0; + CompilationResult rc; + do { + PortFile port_file = JavacServer.getPortFile(portfile); + synchronized (port_file) { + port_file.lock(); + port_file.getValues(); + port_file.unlock(); + } + if (!port_file.containsPortInfo()) { + String cmd = JavacServer.fork(sjavac, port_file.getFilename(), logfile, poolsize, keepalive, System.err, stdouterrfile, background); + + if (background && !port_file.waitForValidValues()) { + // Ouch the server did not start! Lets print its stdouterrfile and the command used. + StringWriter sw = new StringWriter(); + JavacServiceClient.printFailedAttempt(cmd, stdouterrfile, new PrintWriter(sw)); + // And give up. + CompilationResult cr = new CompilationResult(ERROR_FATAL); + cr.stderr = sw.toString(); + return cr; + } + } + rc = compileHelper(id, args, sourcesToCompile, visibleSources); + // Try again until we manage to connect. Any error after that + // will cause the compilation to fail. + if (rc.returnCode == CompilationResult.ERROR_BUT_TRY_AGAIN) { + // We could not connect to the server. Try again. + attempts++; + try { + Thread.sleep(JavacServer.WAIT_BETWEEN_CONNECT_ATTEMPTS * 1000); + } catch (InterruptedException e) { + } + } + } while (rc.returnCode == ERROR_BUT_TRY_AGAIN && attempts < JavacServer.MAX_NUM_CONNECT_ATTEMPTS); + return rc; + } catch (Exception e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + CompilationResult cr = new CompilationResult(ERROR_FATAL); + cr.stderr = sw.toString(); + return cr; + } + } + + public static void printFailedAttempt(String cmd, String f, PrintWriter err) { + err.println("---- Failed to start javac server with this command -----"); + err.println(cmd); + try { + BufferedReader in = new BufferedReader(new FileReader(f)); + err.println("---- stdout/stderr output from attempt to start javac server -----"); + for (;;) { + String l = in.readLine(); + if (l == null) { + break; + } + err.println(l); + } + err.println("------------------------------------------------------------------"); + } catch (Exception e) { + err.println("The stdout/stderr output in file " + f + " does not exist and the server did not start."); + } + } + + /** + * Expect this key on the next line read from the reader. + */ + public static boolean expect(BufferedReader in, String key) throws IOException { + String s = in.readLine(); + if (s != null && s.equals(key)) { + return true; + } + return false; + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/Diagnostic.java --- a/langtools/src/share/classes/javax/tools/Diagnostic.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/javax/tools/Diagnostic.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,14 +92,14 @@ public final static long NOPOS = -1; /** - * Gets the kind of this diagnostic, for example, error or + * Returns the kind of this diagnostic, for example, error or * warning. * @return the kind of this diagnostic */ Kind getKind(); /** - * Gets the source object associated with this diagnostic. + * Returns the source object associated with this diagnostic. * * @return the source object associated with this diagnostic. * {@code null} if no source object is associated with the @@ -108,7 +108,7 @@ S getSource(); /** - * Gets a character offset from the beginning of the source object + * Returns a character offset from the beginning of the source object * associated with this diagnostic that indicates the location of * the problem. In addition, the following must be true: * @@ -122,7 +122,7 @@ long getPosition(); /** - * Gets the character offset from the beginning of the file + * Returns the character offset from the beginning of the file * associated with this diagnostic that indicates the start of the * problem. * @@ -132,7 +132,7 @@ long getStartPosition(); /** - * Gets the character offset from the beginning of the file + * Returns the character offset from the beginning of the file * associated with this diagnostic that indicates the end of the * problem. * @@ -142,7 +142,7 @@ long getEndPosition(); /** - * Gets the line number of the character offset returned by + * Returns the line number of the character offset returned by * {@linkplain #getPosition()}. * * @return a line number or {@link #NOPOS} if and only if {@link @@ -151,7 +151,7 @@ long getLineNumber(); /** - * Gets the column number of the character offset returned by + * Returns the column number of the character offset returned by * {@linkplain #getPosition()}. * * @return a column number or {@link #NOPOS} if and only if {@link @@ -160,7 +160,7 @@ long getColumnNumber(); /** - * Gets a diagnostic code indicating the type of diagnostic. The + * Returns a diagnostic code indicating the type of diagnostic. The * code is implementation-dependent and might be {@code null}. * * @return a diagnostic code @@ -168,7 +168,7 @@ String getCode(); /** - * Gets a localized message for the given locale. The actual + * Returns a localized message for the given locale. The actual * message is implementation-dependent. If the locale is {@code * null} use the default locale. * diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/DiagnosticCollector.java --- a/langtools/src/share/classes/javax/tools/DiagnosticCollector.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/javax/tools/DiagnosticCollector.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ } /** - * Gets a list view of diagnostics collected by this object. + * Returns a list view of diagnostics collected by this object. * * @return a list view of diagnostics */ diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/DocumentationTool.java --- a/langtools/src/share/classes/javax/tools/DocumentationTool.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/javax/tools/DocumentationTool.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,7 +83,7 @@ Iterable compilationUnits); /** - * Gets a new instance of the standard file manager implementation + * Returns a new instance of the standard file manager implementation * for this tool. The file manager will use the given diagnostic * listener for producing any non-fatal diagnostics. Fatal errors * will be signaled with the appropriate exceptions. diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/FileObject.java --- a/langtools/src/share/classes/javax/tools/FileObject.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/javax/tools/FileObject.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,7 +57,7 @@ URI toUri(); /** - * Gets a user-friendly name for this file object. The exact + * Returns a user-friendly name for this file object. The exact * value returned is not specified but implementations should take * care to preserve names as given by the user. For example, if * the user writes the filename {@code "BobsApp\Test.java"} on @@ -71,7 +71,7 @@ String getName(); /** - * Gets an InputStream for this file object. + * Returns an InputStream for this file object. * * @return an InputStream * @throws IllegalStateException if this file object was @@ -83,7 +83,7 @@ InputStream openInputStream() throws IOException; /** - * Gets an OutputStream for this file object. + * Returns an OutputStream for this file object. * * @return an OutputStream * @throws IllegalStateException if this file object was @@ -95,7 +95,7 @@ OutputStream openOutputStream() throws IOException; /** - * Gets a reader for this object. The returned reader will + * Returns a reader for this object. The returned reader will * replace bytes that cannot be decoded with the default * translation character. In addition, the reader may report a * diagnostic unless {@code ignoreEncodingErrors} is true. @@ -111,7 +111,7 @@ Reader openReader(boolean ignoreEncodingErrors) throws IOException; /** - * Gets the character content of this file object, if available. + * Returns the character content of this file object, if available. * Any byte that cannot be decoded will be replaced by the default * translation character. In addition, a diagnostic may be * reported unless {@code ignoreEncodingErrors} is true. @@ -127,7 +127,7 @@ CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException; /** - * Gets a Writer for this file object. + * Returns a Writer for this file object. * * @return a Writer * @throws IllegalStateException if this file object was @@ -139,7 +139,7 @@ Writer openWriter() throws IOException; /** - * Gets the time this file object was last modified. The time is + * Returns the time this file object was last modified. The time is * measured in milliseconds since the epoch (00:00:00 GMT, January * 1, 1970). * diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/JavaCompiler.java --- a/langtools/src/share/classes/javax/tools/JavaCompiler.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/javax/tools/JavaCompiler.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -263,7 +263,7 @@ Iterable compilationUnits); /** - * Gets a new instance of the standard file manager implementation + * Returns a new instance of the standard file manager implementation * for this tool. The file manager will use the given diagnostic * listener for producing any non-fatal diagnostics. Fatal errors * will be signaled with the appropriate exceptions. diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/JavaFileManager.java --- a/langtools/src/share/classes/javax/tools/JavaFileManager.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/javax/tools/JavaFileManager.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -110,7 +110,7 @@ */ interface Location { /** - * Gets the name of this location. + * Returns the name of this location. * * @return a name */ @@ -127,7 +127,7 @@ } /** - * Gets a class loader for loading plug-ins from the given + * Returns a class loader for loading plug-ins from the given * location. For example, to load annotation processors, a * compiler will request a class loader for the {@link * StandardLocation#ANNOTATION_PROCESSOR_PATH @@ -224,7 +224,7 @@ boolean hasLocation(Location location); /** - * Gets a {@linkplain JavaFileObject file object} for input + * Returns a {@linkplain JavaFileObject file object} for input * representing the specified class of the specified kind in the * given location. * @@ -250,7 +250,7 @@ throws IOException; /** - * Gets a {@linkplain JavaFileObject file object} for output + * Returns a {@linkplain JavaFileObject file object} for output * representing the specified class of the specified kind in the * given location. * @@ -288,7 +288,7 @@ throws IOException; /** - * Gets a {@linkplain FileObject file object} for input + * Returns a {@linkplain FileObject file object} for input * representing the specified relative * name in the specified package in the given location. * @@ -332,7 +332,7 @@ throws IOException; /** - * Gets a {@linkplain FileObject file object} for output + * Returns a {@linkplain FileObject file object} for output * representing the specified relative * name in the specified package in the given location. * diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/JavaFileObject.java --- a/langtools/src/share/classes/javax/tools/JavaFileObject.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/javax/tools/JavaFileObject.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,7 +84,7 @@ } /** - * Gets the kind of this file object. + * Returns the kind of this file object. * * @return the kind */ diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/StandardJavaFileManager.java --- a/langtools/src/share/classes/javax/tools/StandardJavaFileManager.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/src/share/classes/javax/tools/StandardJavaFileManager.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -155,7 +155,7 @@ boolean isSameFile(FileObject a, FileObject b); /** - * Gets file objects representing the given files. + * Returns file objects representing the given files. * * @param files a list of files * @return a list of file objects @@ -166,7 +166,7 @@ Iterable files); /** - * Gets file objects representing the given files. + * Returns file objects representing the given files. * Convenience method equivalent to: * *

@@ -183,7 +183,7 @@
     Iterable getJavaFileObjects(File... files);
 
     /**
-     * Gets file objects representing the given file names.
+     * Returns file objects representing the given file names.
      *
      * @param names a list of file names
      * @return a list of file objects
@@ -194,7 +194,7 @@
         Iterable names);
 
     /**
-     * Gets file objects representing the given file names.
+     * Returns file objects representing the given file names.
      * Convenience method equivalent to:
      *
      * 
@@ -227,7 +227,7 @@
         throws IOException;
 
     /**
-     * Gets the path associated with the given location.
+     * Returns the path associated with the given location.
      *
      * @param location a location
      * @return a list of files or {@code null} if this location has no
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/StandardLocation.java
--- a/langtools/src/share/classes/javax/tools/StandardLocation.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/javax/tools/StandardLocation.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
     NATIVE_HEADER_OUTPUT;
 
     /**
-     * Gets a location object with the given name.  The following
+     * Returns a location object with the given name.  The following
      * property must hold: {@code locationFor(x) ==
      * locationFor(y)} if and only if {@code x.equals(y)}.
      * The returned location will be an output location if and only if
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/Tool.java
--- a/langtools/src/share/classes/javax/tools/Tool.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/javax/tools/Tool.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,7 @@
     int run(InputStream in, OutputStream out, OutputStream err, String... arguments);
 
     /**
-     * Gets the source versions of the Java™ programming language
+     * Returns the source versions of the Java™ programming language
      * supported by this tool.
      * @return a set of supported source versions
      */
diff -r b67086d205bb -r cf09dddb6caf langtools/src/share/classes/javax/tools/ToolProvider.java
--- a/langtools/src/share/classes/javax/tools/ToolProvider.java	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/src/share/classes/javax/tools/ToolProvider.java	Wed Jul 09 10:42:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,7 +93,7 @@
         = "com.sun.tools.javac.api.JavacTool";
 
     /**
-     * Gets the Java™ programming language compiler provided
+     * Returns the Java™ programming language compiler provided
      * with this platform.
      * @return the compiler provided with this platform or
      * {@code null} if no compiler is provided
@@ -106,7 +106,7 @@
         = "com.sun.tools.javadoc.api.JavadocTool";
 
     /**
-     * Gets the Java™ programming language documentation tool provided
+     * Returns the Java™ programming language documentation tool provided
      * with this platform.
      * @return the documentation tool provided with this platform or
      * {@code null} if no documentation tool is provided
diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/DocRootSlash/overview.html
--- a/langtools/test/com/sun/javadoc/DocRootSlash/overview.html	Thu Jul 03 11:37:54 2014 -0700
+++ b/langtools/test/com/sun/javadoc/DocRootSlash/overview.html	Wed Jul 09 10:42:13 2014 -0700
@@ -38,7 +38,7 @@
 Sub-test 29 Expect: ./../docs1/p2/package-summary.html#package_description
 

- + Allow docRoot to work without a trailing slash for those who had to change their comments to work with the 1.4.0 bug: @@ -60,13 +60,5 @@ Sub-test 33 Expect: ./../docs1/p2/package-summary.html#package_description

- -Bonus links, not part of automated test (bug 4662945):
-Actual: package description {@docRoot}p1/packagesummary#package_description
- -Actual: package description {@docRoot}/p1/package-summary.html#package_description
- -Expect: ./p1/package-summary.html#package description - diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/DocRootSlash/p1/C1.java --- a/langtools/test/com/sun/javadoc/DocRootSlash/p1/C1.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/DocRootSlash/p1/C1.java Wed Jul 09 10:42:13 2014 -0700 @@ -59,7 +59,7 @@ * Sub-test 7 Expect: ../../docs1/p2/package-summary.html#package_description *

* - * + * * * Allow docRoot to work without a trailing slash for those who had to change their comments * to work with the 1.4.0 bug: diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/DocRootSlash/p1/package.html --- a/langtools/test/com/sun/javadoc/DocRootSlash/p1/package.html Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/DocRootSlash/p1/package.html Wed Jul 09 10:42:13 2014 -0700 @@ -39,7 +39,7 @@ Sub-test 18 Expect: ../../docs1/p2/package-summary.html#package_description

- + Allow docRoot to work without a trailing slash for those who had to change their comments to work with the 1.4.0 bug: @@ -61,13 +61,5 @@ Sub-test 22 Expect: ../../docs1/p2/package-summary.html#package_description

-Bonus links, not part of automated test (bug 4662945):
-Actual: package description {@docRoot}p1/packagesummary#package_description
- -Actual: package description {@docRoot}/p1/package-summary.html#package_description
- -Expect: ../p1/package-summary.html#package description -

- diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/JavascriptWinTitle/overview.html --- a/langtools/test/com/sun/javadoc/JavascriptWinTitle/overview.html Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/JavascriptWinTitle/overview.html Wed Jul 09 10:42:13 2014 -0700 @@ -9,7 +9,6 @@ subclasses, subinterfaces, nested classes, nested interfaces, inheriting from other packages, constructors, fields, methods, and so forth. -

diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/ValidHtml/overview.html --- a/langtools/test/com/sun/javadoc/ValidHtml/overview.html Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/ValidHtml/overview.html Wed Jul 09 10:42:13 2014 -0700 @@ -9,7 +9,6 @@ subclasses, subinterfaces, nested classes, nested interfaces, inheriting from other packages, constructors, fields, methods, and so forth. -

diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testHref/pkg/C3.java --- a/langtools/test/com/sun/javadoc/testHref/pkg/C3.java Thu Jul 03 11:37:54 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package pkg; - -/** - * - */ -public class C3 {} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java --- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Wed Jul 09 10:42:13 2014 -0700 @@ -250,8 +250,6 @@ + "

\n" + "
Throws:" + "
\n" - + "
" - + "IOException
\n" + "
java.io.IOException
\n" + "
", "Deprecated." @@ -358,8 +356,6 @@ + "
\n" + "
Throws:" + "
\n" - + "
" - + "IOException
\n" + "
java.io.IOException
\n" + "
", "Deprecated." diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C2.java --- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/C2.java Wed Jul 09 10:42:13 2014 -0700 @@ -76,7 +76,7 @@ * Reads the object stream. * * @param s ObjectInputStream - * @throws IOException + * @throws IOException * @deprecated As of JDK version 1.5, replaced by * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}. */ diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java --- a/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java Wed Jul 09 10:42:13 2014 -0700 @@ -47,7 +47,7 @@ checkExit(Exit.OK); checkOutput("pkg1/TestTable.html", true, - "", + "
", "
", diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testHtmlTableStyles/pkg1/TestTable.java --- a/langtools/test/com/sun/javadoc/testHtmlTableStyles/pkg1/TestTable.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testHtmlTableStyles/pkg1/TestTable.java Wed Jul 09 10:42:13 2014 -0700 @@ -28,7 +28,7 @@ * should be displayed as a regular table and not have any styles that the javadoc * generated tables have. * - *
+ *
* * * diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java --- a/langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java Wed Jul 09 10:42:13 2014 -0700 @@ -36,21 +36,20 @@ import java.util.Locale; public class TestHtmlTag extends JavadocTester { - + private static final String defaultLanguage = Locale.getDefault().getLanguage(); public static void main(String... args) throws Exception { TestHtmlTag tester = new TestHtmlTag(); tester.runTests(); } - @Test void test_default() { - javadoc("-d", "out-default", + javadoc("-locale", defaultLanguage, + "-d", "out-default", "-sourcepath", testSrc, "pkg1"); + checkExit(Exit.OK); - String defaultLanguage = Locale.getDefault().getLanguage(); - checkOutput("pkg1/C1.html", true, ""); diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testLegacyTaglet/TestLegacyTaglet.java --- a/langtools/test/com/sun/javadoc/testLegacyTaglet/TestLegacyTaglet.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testLegacyTaglet/TestLegacyTaglet.java Wed Jul 09 10:42:13 2014 -0700 @@ -51,9 +51,9 @@ checkExit(Exit.OK); checkOutput("C.html", true, "This is an underline", - "
To Do:
Summary of test table
" + + "
To Do:
" + "
Finish this class.
", - "
To Do:
" + + "
To Do:
" + "
Tag in Method.
"); checkOutput(Output.STDERR, false, "NullPointerException"); diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testLegacyTaglet/ToDoTaglet.java --- a/langtools/test/com/sun/javadoc/testLegacyTaglet/ToDoTaglet.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testLegacyTaglet/ToDoTaglet.java Wed Jul 09 10:42:13 2014 -0700 @@ -33,7 +33,7 @@ *
*
* To Do: - *
Fix this! + *
Fix this! *
* * @@ -150,7 +150,7 @@ */ public String toString(Tag tag) { return "
" + HEADER + "
" - + "
" + + "
" + tag.text() + "
\n"; } @@ -165,7 +165,7 @@ return null; } String result = "\n
" + HEADER + "
"; - result += "
"; + result += "
"; for (int i = 0; i < tags.length; i++) { if (i > 0) { result += ", "; diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testOrdering/TestOrdering.java --- a/langtools/test/com/sun/javadoc/testOrdering/TestOrdering.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testOrdering/TestOrdering.java Wed Jul 09 10:42:13 2014 -0700 @@ -117,6 +117,31 @@ checkExit(Exit.OK); checkOrder("index-all.html", composeTestVectors()); } + + @Test + void testIndexTypeClustering() { + javadoc("-d", "out-3", + "-sourcepath", testSrc("src-2"), + "-use", + "a", + "b", + "e", + "something"); + checkOrder("index-all.html", typeTestVectors); + checkExit(Exit.OK); + } + String[] typeTestVectors = { + "something - package something", + "something - Class in", + "something - Enum in", + "something - Interface in", + "something - Annotation Type in", + "something - Variable in class", + "something() - Constructor", + "something() - Method in class a. - Method in class a. - Method in class something. testList = new ArrayList<>(); diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testOrdering/src-2/a/A.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testOrdering/src-2/a/A.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package a; +/** + * A class + */ +public class A { + /** + * a method + */ + public void something() {} +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testOrdering/src-2/a/something.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testOrdering/src-2/a/something.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package a; +/** + * A class + */ +public class something { + /** + * A constructor + */ + public something() {} + /** + * a method + */ + public void something() {} +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testOrdering/src-2/b/B.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testOrdering/src-2/b/B.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package b; +/** + * Another class + */ +public class B { + /** + * a field + */ + public Object something; +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testOrdering/src-2/b/something.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testOrdering/src-2/b/something.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package b; +/** + * an annotation + */ +public @interface something{} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testOrdering/src-2/e/something.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testOrdering/src-2/e/something.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package e; +/** + * An enum + */ +public enum something {} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testOrdering/src-2/something/J.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testOrdering/src-2/something/J.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package something; +public class J { + /** + * a method + */ + public void something(){} +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testOrdering/src-2/something/package-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testOrdering/src-2/something/package-info.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/** + * A package + */ +package something; diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testOrdering/src-2/something/something.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testOrdering/src-2/something/something.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package something; +/** + * An interface + */ +public interface something {} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java --- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Wed Jul 09 10:42:13 2014 -0700 @@ -122,8 +122,6 @@ + "
Reads the object stream.
\n" + "
\n" + "
Throws:
\n" - + "
" - + "IOException
\n" + "
java.io.IOException
\n" + "
", "Deprecated." diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java --- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/pkg1/C2.java Wed Jul 09 10:42:13 2014 -0700 @@ -76,7 +76,7 @@ * Reads the object stream. * * @param s ObjectInputStream - * @throws IOException + * @throws IOException * @deprecated As of JDK version 1.5, replaced by * {@link C1#setUndecorated(boolean) setUndecorated(boolean)}. */ diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java --- a/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java Wed Jul 09 10:42:13 2014 -0700 @@ -79,6 +79,23 @@ "
" + "Frames" ); + checkOutput("pkg1/class-use/UsedClass.html", true, + "that return types with arguments of type" + ); + checkOutput("pkg1/class-use/UsedClass.html", true, + "methodInC1ReturningType" + ); + checkOutput("pkg1/class-use/UsedInterface.html", true, + "Classes in pkg1 that implement " + + "UsedInterface" + ); + checkOutput("pkg1/class-use/UsedInterfaceA.html", true, + "Classes in pkg1 that implement " + + "UsedInterfaceA" + ); + checkOutput("pkg1/class-use/UsedClass.html", false, + "methodInC1Protected" + ); } @Test diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testUseOption/pkg1/C1.java --- a/langtools/test/com/sun/javadoc/testUseOption/pkg1/C1.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/com/sun/javadoc/testUseOption/pkg1/C1.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,8 @@ package pkg1; +import java.util.List; + /** * Test 3 passes. */ @@ -40,4 +42,15 @@ public UsedClass methodInC1(UsedClass p) { return p; } + + public List methodInC1ReturningType() { + return null; + } + + /* + * this must not appear anywhere. + */ + UsedClass methodInC1Protected(List p){ + return p; + } } diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testUseOption/pkg1/C10.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testUseOption/pkg1/C10.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg1; + +/** + * An implementor + * + */ +public class C10 extends UsedClass implements UsedInterface, UsedInterfaceA { + + /** + * Nothing + */ + public void doNothing() {} + + /** + * Me too + */ + public void doNothingA() {} +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testUseOption/pkg1/C9.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testUseOption/pkg1/C9.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg1; + +/** + * An implementor + * + */ +public class C9 implements UsedInterface, UsedInterfaceA { + public void doNothing(){} +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testUseOption/pkg1/UsedInterface.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testUseOption/pkg1/UsedInterface.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * An interface + * + */ + +package pkg1; + +public interface UsedInterface { + + /** + * Does nothing + */ + void doNothing(); +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/com/sun/javadoc/testUseOption/pkg1/UsedInterfaceA.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/com/sun/javadoc/testUseOption/pkg1/UsedInterfaceA.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * An interface + * + */ + +package pkg1; + +public interface UsedInterfaceA { + + /** + * Does nothing + */ + void doNothingA(); +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DASwitch.java --- a/langtools/test/tools/javac/DefiniteAssignment/DASwitch.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/DASwitch.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4695463 * @summary DA versus switch: javac allows reference to uninitialized variable * @author Neal Gafter (gafter) * - * @compile/fail DASwitch.java + * @compile/fail/ref=DASwitch.out -XDrawDiagnostics DASwitch.java */ public class DASwitch { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DASwitch.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/DASwitch.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DASwitch.java:22:32: compiler.err.var.might.not.have.been.initialized: b +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DUParam1.java --- a/langtools/test/tools/javac/DefiniteAssignment/DUParam1.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/DUParam1.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4533915 * @summary javac should not analyze final parameters for definite assignment status * @author Neal Gafter (gafter) * - * @compile/fail DUParam1.java + * @compile/fail/ref=DUParam1.out -XDrawDiagnostics DUParam1.java */ public class DUParam1 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DUParam1.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/DUParam1.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DUParam1.java:13:20: compiler.err.final.parameter.may.not.be.assigned: args +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DUParam2.java --- a/langtools/test/tools/javac/DefiniteAssignment/DUParam2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/DUParam2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4533915 * @summary javac should not analyze final parameters for definite assignment status * @author Neal Gafter (gafter) * - * @compile/fail DUParam2.java + * @compile/fail/ref=DUParam2.out -XDrawDiagnostics DUParam2.java */ public class DUParam2 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DUParam2.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/DUParam2.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DUParam2.java:15:24: compiler.err.final.parameter.may.not.be.assigned: e +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterThis_1.java --- a/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterThis_1.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterThis_1.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4087865 4277291 * @summary Verify definite assignment of blank finals after 'this(...)' * @author William Maddox (maddox) * - * @compile/fail DefAssignAfterThis_1.java + * @compile/fail/ref=DefAssignAfterThis_1.out -XDrawDiagnostics DefAssignAfterThis_1.java */ public class DefAssignAfterThis_1 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterThis_1.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterThis_1.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DefAssignAfterThis_1.java:16:9: compiler.err.var.might.already.be.assigned: x +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterThis_2.java --- a/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterThis_2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterThis_2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,28 +1,5 @@ /* - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4087865 * @summary Verify definite assignment of blank finals after 'this(...)' * @author William Maddox (maddox) diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry1.java --- a/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry1.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry1.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test + * @test /nodynamiccopyright/ * @bug 4240487 * @summary Verify that we keep track of init/uninits in Try statement * without finalizer. * - * @compile/fail DefAssignAfterTry1.java + * @compile/fail/ref=DefAssignAfterTry1.out -XDrawDiagnostics DefAssignAfterTry1.java */ class E1 extends Exception {} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry1.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry1.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DefAssignAfterTry1.java:28:28: compiler.err.var.might.not.have.been.initialized: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry2.java --- a/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test + * @test /nodynamiccopyright/ * @bug 4240487 * @summary Verify that we keep track of init/uninits in Try statement * without finalizer. * - * @compile/fail DefAssignAfterTry2.java + * @compile/fail/ref=DefAssignAfterTry2.out -XDrawDiagnostics DefAssignAfterTry2.java */ class E1 extends Exception {} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry2.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry2.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DefAssignAfterTry2.java:32:28: compiler.err.var.might.not.have.been.initialized: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry3.java --- a/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry3.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry3.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test + * @test /nodynamiccopyright/ * @bug 4240487 * @summary Verify that we keep track of init/uninits in Try statement * without finalizer. * - * @compile/fail DefAssignAfterTry3.java + * @compile/fail/ref=DefAssignAfterTry3.out -XDrawDiagnostics DefAssignAfterTry3.java */ class E1 extends Exception {} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry3.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry3.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DefAssignAfterTry3.java:32:28: compiler.err.var.might.not.have.been.initialized: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4704365.java --- a/langtools/test/tools/javac/DefiniteAssignment/T4704365.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4704365.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4704365 * @summary definite assignment status within the case expression * @author Neal Gafter (gafter) * - * @compile/fail T4704365.java + * @compile/fail/ref=T4704365.out -XDrawDiagnostics T4704365.java */ class T4704365 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4704365.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4704365.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4704365.java:16:14: compiler.err.var.might.not.have.been.initialized: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4717164.java --- a/langtools/test/tools/javac/DefiniteAssignment/T4717164.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4717164.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4717164 * @summary missing catch not reachable error when nested try-finally returns in finally * @author Neal Gafter (gafter) * - * @compile/fail T4717164.java + * @compile/fail/ref=T4717164.out -XDrawDiagnostics T4717164.java */ class T4717164 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4717164.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4717164.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4717164.java:20:11: compiler.err.except.never.thrown.in.try: java.lang.ClassNotFoundException +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4717165.java --- a/langtools/test/tools/javac/DefiniteAssignment/T4717165.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4717165.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4717165 * @summary when can a statement complete normally? (break&continue versus finally) * @author Neal Gafter (gafter) * - * @compile/fail T4717165.java + * @compile/fail/ref=T4717165.out -XDrawDiagnostics T4717165.java */ class T4717165 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4717165.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4717165.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4717165.java:18:9: compiler.err.unreachable.stmt +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4718142.java --- a/langtools/test/tools/javac/DefiniteAssignment/T4718142.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4718142.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4718142 * @summary DU analysis not conservative for try-finally * @author Neal Gafter (gafter) * - * @compile/fail T4718142.java + * @compile/fail/ref=T4718142.out -XDrawDiagnostics T4718142.java */ class T4718142 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4718142.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4718142.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4718142.java:20:17: compiler.err.var.might.be.assigned.in.loop: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4718142a.java --- a/langtools/test/tools/javac/DefiniteAssignment/T4718142a.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4718142a.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4718142 * @summary DU analysis not conservative for try-finally * @author Neal Gafter (gafter) * - * @compile/fail T4718142a.java + * @compile/fail/ref=T4718142a.out -XDrawDiagnostics T4718142a.java */ class T4718142a { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4718142a.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4718142a.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4718142a.java:18:21: compiler.err.var.might.be.assigned.in.loop: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4718708.java --- a/langtools/test/tools/javac/DefiniteAssignment/T4718708.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4718708.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4718708 * @summary bug in DU analysis of while loop * @author Neal Gafter (gafter) * - * @compile/fail T4718708.java + * @compile/fail/ref=T4718708.out -XDrawDiagnostics T4718708.java */ class T4718708 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4718708.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4718708.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4718708.java:14:13: compiler.err.var.might.be.assigned.in.loop: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4721062a.java --- a/langtools/test/tools/javac/DefiniteAssignment/T4721062a.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4721062a.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4721062 * @summary DA treatment of return statements in constructors * @author Neal Gafter (gafter) * - * @compile/fail T4721062a.java + * @compile/fail/ref=T4721062a.out -XDrawDiagnostics T4721062a.java */ class T4721062a { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4721062a.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4721062a.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4721062a.java:14:13: compiler.err.var.might.not.have.been.initialized: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4721062b.java --- a/langtools/test/tools/javac/DefiniteAssignment/T4721062b.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4721062b.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4721062 * @summary DA treatment of return statements in constructors * @author Neal Gafter (gafter) * - * @compile/fail T4721062b.java + * @compile/fail/ref=T4721062b.out -XDrawDiagnostics T4721062b.java */ class T4721062b { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4721062b.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4721062b.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4721062b.java:14:13: compiler.err.var.might.not.have.been.initialized: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4725725.java --- a/langtools/test/tools/javac/DefiniteAssignment/T4725725.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4725725.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4725725 * @summary missing DA error in anonymous ctor * @author Neal Gafter (gafter) * - * @compile/fail T4725725.java + * @compile/fail/ref=T4725725.out -XDrawDiagnostics T4725725.java */ class T4725725 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/T4725725.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/T4725725.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4725725.java:13:21: compiler.err.var.might.not.have.been.initialized: x +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/UncaughtException.java --- a/langtools/test/tools/javac/DefiniteAssignment/UncaughtException.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/DefiniteAssignment/UncaughtException.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4053998 * @summary Compiler used to not notice the uncaught checked exception. * @author turnidge * - * @compile/fail UncaughtException.java + * @compile/fail/ref=UncaughtException.out -XDrawDiagnostics UncaughtException.java */ interface I { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/DefiniteAssignment/UncaughtException.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/DefiniteAssignment/UncaughtException.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +UncaughtException.java:20:1: compiler.err.override.meth.doesnt.throw: (compiler.misc.cant.implement: throwCheckedException(), A, throwCheckedException(), I), java.lang.Throwable +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java --- a/langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/T8019486/WrongLNTForLambdaTest.java Wed Jul 09 10:42:13 2014 -0700 @@ -138,7 +138,7 @@ checkClassFile(new File(Paths.get(System.getProperty("user.dir"), "Foo.class").toUri()), "$deserializeLambda$", deserializeExpectedLNT); checkClassFile(new File(Paths.get(System.getProperty("user.dir"), - "Foo.class").toUri()), "lambda$MR$variablesInLambdas$notify$8bc4f5bd$1", lambdaBridgeExpectedLNT); + "Foo.class").toUri()), "lambda$variablesInLambdas$3", lambdaBridgeExpectedLNT); checkClassFile(new File(Paths.get(System.getProperty("user.dir"), "Foo.class").toUri()), "assignLambda", assignmentExpectedLNT); checkClassFile(new File(Paths.get(System.getProperty("user.dir"), diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/assert/DU1.java --- a/langtools/test/tools/javac/assert/DU1.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/assert/DU1.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,9 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4468510 * @summary Check correct DU computation for assertions. * @author gafter - * - * @compile/fail DU1.java + * @compile/fail/ref=DU1.out -XDrawDiagnostics DU1.java */ class DU1 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/assert/DU1.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/assert/DU1.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DU1.java:16:9: compiler.err.var.might.already.be.assigned: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/assert/DU2.java --- a/langtools/test/tools/javac/assert/DU2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/assert/DU2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,9 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4468510 * @summary Check correct DU computation for assertions. * @author gafter - * - * @compile/fail DU2.java + * @compile/fail/ref=DU2.out -XDrawDiagnostics DU2.java */ class DU2 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/assert/DU2.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/assert/DU2.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DU2.java:14:9: compiler.err.var.might.already.be.assigned: i +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/boxing/Boxing2.java --- a/langtools/test/tools/javac/boxing/Boxing2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/boxing/Boxing2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,9 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4974939 * @summary Boxing/unboxing negative unit and regression tests * @author gafter - * - * @compile/fail Boxing2.java + * @compile/fail/ref=Boxing2.out -XDrawDiagnostics Boxing2.java */ public class Boxing2 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/boxing/Boxing2.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/boxing/Boxing2.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +Boxing2.java:12:18: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: int, java.lang.Long) +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/boxing/T5082929.java --- a/langtools/test/tools/javac/boxing/T5082929.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/boxing/T5082929.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,32 +1,9 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5082929 * @summary Comparing Float and Integer * @author Peter von der Ah\u00e9 - * @compile/fail T5082929.java + * @compile/fail/ref=T5082929.out -XDrawDiagnostics T5082929.java */ public class T5082929 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/boxing/T5082929.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/boxing/T5082929.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T5082929.java:11:23: compiler.err.incomparable.types: java.lang.Float, java.lang.Integer +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java --- a/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java Wed Jul 09 10:42:13 2014 -0700 @@ -153,7 +153,6 @@ @ExpectedLocals(name = "inTry", type = "D") @ExpectedLocals(name = "inSync", type = "F") @ExpectedLocals(name = "inDo", type = "B") - @ExpectedLocals(name = "inSwitch", type = "S") @ExpectedLocals(name = "inFor", type = "J") @ExpectedLocals(name = "s", type = "Ljava/util/stream/Stream;") public void deepScope() { @@ -179,17 +178,6 @@ } } - @ExpectedLocals(name = "i", type = "I", scope = 0) - @ExpectedLocals(name = "i", type = "J", scope = 1) - public void reuseByLong() { - { - int i = 0; - } - { - long i = 1; - } - } - class LocalVariableTable implements VariableTable { final LocalVariableTable_attribute att; diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java --- a/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java Wed Jul 09 10:42:13 2014 -0700 @@ -104,7 +104,6 @@ @ExpectedLocals(name = "inTry", type = "TTHIS;") @ExpectedLocals(name = "inSync", type = "TTHIS;") @ExpectedLocals(name = "inDo", type = "TTHIS;") - @ExpectedLocals(name = "inSwitch", type = "TTHIS;") @ExpectedLocals(name = "inFor", type = "LLocalVariableTypeTableTest<-TTHIS;>;") @ExpectedLocals(name = "s", type = "Ljava/util/stream/Stream<+Ljava/lang/Integer;>;") public void deepScope() { @@ -130,17 +129,6 @@ } } - @ExpectedLocals(name = "i", type = "TTHIS;", scope = 0) - @ExpectedLocals(name = "i", type = "Ljava/util/List;", scope = 1) - public void reuseByLong() { - { - THIS i = null; - } - { - List i = null; - } - } - class LocalVariableTypeTable implements VariableTable { final LocalVariableTypeTable_attribute att; diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/completion/C.java --- a/langtools/test/tools/javac/completion/C.java Thu Jul 03 11:37:54 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4433676 - * @summary javac dies with NullPointerException in com.sun.tools.javac.v8.comp.Resolve.find - * @author gafter - * - * @compile/fail C.java - */ -public class C { - - class CInner extends example.B { - - public CInner(Object o) { - } - - } - -} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/completion/C.out --- a/langtools/test/tools/javac/completion/C.out Thu Jul 03 11:37:54 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -C.java:11: cannot access example.a.A -file example/a/A.class not found - class CInner extends example.B { - ^ -1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/completion/example/B.class Binary file langtools/test/tools/javac/completion/example/B.class has changed diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/defaultMethods/static/StaticInvoke.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/defaultMethods/static/StaticInvoke.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,15 @@ +/* @test /nodynamiccopyright/ + * @bug 8037385 + * @summary Must not allow static interface method invocation in legacy code + * @compile -source 8 -Xlint:-options StaticInvoke.java + * @compile/fail/ref=StaticInvoke7.out -source 7 -Xlint:-options -XDrawDiagnostics StaticInvoke.java + * @compile/fail/ref=StaticInvoke6.out -source 6 -Xlint:-options -XDrawDiagnostics StaticInvoke.java + */ +import java.util.stream.Stream; + +class StaticInvoke { + void test() { + Stream.empty(); + java.util.stream.Stream.empty(); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/defaultMethods/static/StaticInvoke6.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/defaultMethods/static/StaticInvoke6.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,3 @@ +StaticInvoke.java:12:15: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.6 +StaticInvoke.java:13:32: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.6 +2 errors diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/defaultMethods/static/StaticInvoke7.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/defaultMethods/static/StaticInvoke7.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,3 @@ +StaticInvoke.java:12:15: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.7 +StaticInvoke.java:13:32: compiler.err.static.intf.method.invoke.not.supported.in.source: 1.7 +2 errors diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/diags/examples/VarargsFinalOnly.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/diags/examples/VarargsFinalOnly.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.varargs.invalid.trustme.anno +// key: compiler.misc.varargs.trustme.on.virtual.varargs.final.only +// options: -source 1.8 -Xlint:varargs,-options,-unchecked + +import java.util.List; + +class VarargsFinalOnly { + @SafeVarargs void m(List... args) { } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/DA1.java --- a/langtools/test/tools/javac/enum/DA1.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/DA1.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,37 +1,11 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5023177 * @summary One can refer static, const static variables from instance initializers of enum * @author gafter - * - * @compile/fail DA1.java + * @compile/fail/ref=DA1.out -XDrawDiagnostics DA1.java */ -package da1; - enum T1 { ; static int N = 12; diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/DA1.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/DA1.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DA1.java:12:13: compiler.err.illegal.enum.static.ref +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/DA2.java --- a/langtools/test/tools/javac/enum/DA2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/DA2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,37 +1,11 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5023177 * @summary One can refer static, const static variables from instance initializers of enum * @author gafter - * - * @compile/fail DA2.java + * @compile/fail/ref=DA2.out -XDrawDiagnostics DA2.java */ -package da2; - enum T2 { ; static int N = 12; diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/DA2.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/DA2.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DA2.java:13:17: compiler.err.illegal.enum.static.ref +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/DA3.java --- a/langtools/test/tools/javac/enum/DA3.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/DA3.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,37 +1,11 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5023177 * @summary One can refer static, const static variables from instance initializers of enum * @author gafter - * - * @compile/fail DA3.java + * @compile/fail/ref=DA3.out -XDrawDiagnostics DA3.java */ -package da3; - enum T3 { ; static int N = 12; diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/DA3.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/DA3.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +DA3.java:13:17: compiler.err.illegal.enum.static.ref +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/EnumProtectedConstructor.java --- a/langtools/test/tools/javac/enum/EnumProtectedConstructor.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/EnumProtectedConstructor.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum constructors cannot be declared public or protected * @author Joseph D. Darcy * - * @compile/fail EnumProtectedConstructor.java + * @compile/fail/ref=EnumProtectedConstructor.out -XDrawDiagnostics EnumProtectedConstructor.java */ enum EnumProtectedConstructor { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/EnumProtectedConstructor.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/EnumProtectedConstructor.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +EnumProtectedConstructor.java:16:15: compiler.err.mod.not.allowed.here: protected +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/EnumPublicConstructor.java --- a/langtools/test/tools/javac/enum/EnumPublicConstructor.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/EnumPublicConstructor.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum constructors cannot be declared public or protected * @author Joseph D. Darcy * - * @compile/fail EnumPublicConstructor.java + * @compile/fail/ref=EnumPublicConstructor.out -XDrawDiagnostics EnumPublicConstructor.java */ enum EnumPublicConstructor { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/EnumPublicConstructor.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/EnumPublicConstructor.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +EnumPublicConstructor.java:16:12: compiler.err.mod.not.allowed.here: public +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/EnumSwitch2.java --- a/langtools/test/tools/javac/enum/EnumSwitch2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/EnumSwitch2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,37 +1,11 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4936393 * @summary enum switch case labels required to be unqualified. * @author gafter - * - * @compile/fail EnumSwitch2.java + * @compile/fail/ref=EnumSwitch2.out -XDrawDiagnostics EnumSwitch2.java */ -package enumswitch2; - enum E1 { a, b, c, d, e } class EnumSwitch2 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/EnumSwitch2.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/EnumSwitch2.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,4 @@ +EnumSwitch2.java:14:16: compiler.err.enum.label.must.be.unqualified.enum +EnumSwitch2.java:15:16: compiler.err.enum.label.must.be.unqualified.enum +EnumSwitch2.java:15:9: compiler.err.duplicate.case.label +3 errors diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/ExplicitlyAbstractEnum1.java --- a/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum1.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum1.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,9 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared abstract * @author Joseph D. Darcy - * - * @compile/fail ExplicitlyAbstractEnum1.java + * @compile/fail/ref=ExplicitlyAbstractEnum1.out -XDrawDiagnostics ExplicitlyAbstractEnum1.java */ abstract enum ExplicitlyAbstractEnum1 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/ExplicitlyAbstractEnum1.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum1.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +ExplicitlyAbstractEnum1.java:9:10: compiler.err.mod.not.allowed.here: abstract +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/ExplicitlyAbstractEnum2.java --- a/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,9 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared abstract even if they are abstract * @author Joseph D. Darcy - * - * @compile/fail ExplicitlyAbstractEnum2.java + * @compile/fail/ref=ExplicitlyAbstractEnum2.out -XDrawDiagnostics ExplicitlyAbstractEnum2.java */ abstract enum ExplicitlyAbstractEnum2 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/ExplicitlyAbstractEnum2.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/ExplicitlyAbstractEnum2.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +ExplicitlyAbstractEnum2.java:9:10: compiler.err.mod.not.allowed.here: abstract +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/ExplicitlyFinalEnum1.java --- a/langtools/test/tools/javac/enum/ExplicitlyFinalEnum1.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/ExplicitlyFinalEnum1.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,9 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared final even if they are * @author Joseph D. Darcy - * - * @compile/fail ExplicitlyFinalEnum1.java + * @compile/fail/ref=ExplicitlyFinalEnum1.out -XDrawDiagnostics ExplicitlyFinalEnum1.java */ final enum ExplicitlyFinalEnum1 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/ExplicitlyFinalEnum1.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/ExplicitlyFinalEnum1.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +ExplicitlyFinalEnum1.java:9:7: compiler.err.mod.not.allowed.here: final +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/ExplicitlyFinalEnum2.java --- a/langtools/test/tools/javac/enum/ExplicitlyFinalEnum2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/enum/ExplicitlyFinalEnum2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,9 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared final * @author Joseph D. Darcy - * - * @compile/fail ExplicitlyFinalEnum2.java + * @compile/fail/ref=ExplicitlyFinalEnum2.out -XDrawDiagnostics ExplicitlyFinalEnum2.java */ final enum ExplicitlyFinalEnum2 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/enum/ExplicitlyFinalEnum2.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/enum/ExplicitlyFinalEnum2.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +ExplicitlyFinalEnum2.java:9:7: compiler.err.mod.not.allowed.here: final +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/expression/NullAppend.java --- a/langtools/test/tools/javac/expression/NullAppend.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/expression/NullAppend.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,10 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4620794 * @summary compiler allows null + null * @author gafter * - * @compile/fail NullAppend.java + * @compile/fail/ref=NullAppend.out -XDrawDiagnostics NullAppend.java */ class NullAppend {{ diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/expression/NullAppend.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/expression/NullAppend.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +NullAppend.java:11:16: compiler.err.operator.cant.be.applied.1: +, compiler.misc.type.null, compiler.misc.type.null +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/expression/NullAppend2.java --- a/langtools/test/tools/javac/expression/NullAppend2.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/expression/NullAppend2.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,9 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4717193 * @summary javac improperly allows null + 1 * @author gafter - * - * @compile/fail NullAppend2.java + * @compile/fail/ref=NullAppend2.out -XDrawDiagnostics NullAppend2.java */ class NullAppend2 {{ diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/expression/NullAppend2.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/expression/NullAppend2.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +NullAppend2.java:10:16: compiler.err.operator.cant.be.applied.1: +, compiler.misc.type.null, int +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/flow/LVTHarness.java --- a/langtools/test/tools/javac/flow/LVTHarness.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/flow/LVTHarness.java Wed Jul 09 10:42:13 2014 -0700 @@ -23,7 +23,7 @@ /* * @test - * @bug 7047734 8027660 8037937 + * @bug 7047734 8027660 8037937 8047719 * @summary The LVT is not generated correctly during some try/catch scenarios * javac crash while creating LVT entry for a local variable defined in * an inner block diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/flow/tests/TestCaseSwitch.java --- a/langtools/test/tools/javac/flow/tests/TestCaseSwitch.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/flow/tests/TestCaseSwitch.java Wed Jul 09 10:42:13 2014 -0700 @@ -5,7 +5,7 @@ @AliveRange(varName="o", bytecodeStart=31, bytecodeLength=16) @AliveRange(varName="o", bytecodeStart=50, bytecodeLength=15) @AliveRange(varName="o", bytecodeStart=68, bytecodeLength=1) - @AliveRange(varName="oo", bytecodeStart=39, bytecodeLength=26) + @AliveRange(varName="oo", bytecodeStart=39, bytecodeLength=8) @AliveRange(varName="uu", bytecodeStart=59, bytecodeLength=6) void m1(String[] args) { Object o; @@ -29,7 +29,7 @@ @AliveRange(varName="o", bytecodeStart=95, bytecodeLength=18) @AliveRange(varName="o", bytecodeStart=116, bytecodeLength=15) @AliveRange(varName="o", bytecodeStart=134, bytecodeLength=1) - @AliveRange(varName="oo", bytecodeStart=104, bytecodeLength=27) + @AliveRange(varName="oo", bytecodeStart=104, bytecodeLength=9) @AliveRange(varName="uu", bytecodeStart=125, bytecodeLength=6) void m2(String[] args) { Object o; @@ -50,12 +50,14 @@ o = "return"; } - @AliveRange(varName="o", bytecodeStart=31, bytecodeLength=8) - @AliveRange(varName="o", bytecodeStart=42, bytecodeLength=8) - @AliveRange(varName="o", bytecodeStart=53, bytecodeLength=9) - void m3(String[] args) { + @AliveRange(varName="o", bytecodeStart=35, bytecodeLength=8) + @AliveRange(varName="o", bytecodeStart=46, bytecodeLength=8) + @AliveRange(varName="o", bytecodeStart=78, bytecodeLength=5) + @AliveRange(varName="o", bytecodeStart=86, bytecodeLength=1) + @AliveRange(varName="oo", bytecodeStart=56, bytecodeLength=16) + void m3(int i) { Object o; - switch (args.length) { + switch (i) { case 0: o = "0"; o.hashCode(); @@ -64,10 +66,19 @@ o = "1"; o.hashCode(); break; + case 2: + int oo = i; + if (oo > 1) { + System.out.println("greater"); + } + break; + case 3: + int uu = i; default: o = "default"; o.hashCode(); } o = "finish"; } + } diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/generics/inference/T8044546/CrashImplicitLambdaTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/inference/T8044546/CrashImplicitLambdaTest.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8044546 + * @summary Crash on faulty reduce/lambda + * @compile CrashImplicitLambdaTest.java + */ + +abstract class CrashImplicitLambdaTest { + boolean foo() { + return bar(true, a -> {}); + } + + abstract T1 bar(T1 t1, S s); + + interface S { + void baz(S1 s1); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/generics/inference/T8044546/NestedInvocationsTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/inference/T8044546/NestedInvocationsTest.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8044546 + * @summary Crash on faulty reduce/lambda + * @compile NestedInvocationsTest.java + */ + +class NestedInvocationsTest { + boolean foo(I i) { + return baz(zas(i)); + } + + J zas(I i) { + return null; + } + + R baz(J j) { + return null; + } + + interface I {} + + interface J {} +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/generics/wildcards/T8034147.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/generics/wildcards/T8034147.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8034147 + * @summary javac crashes with a NullPointerException during bounds checking + * @compile T8034147.java + */ + +class T8034147 { + static class One> {} + static class Two> implements Three {} + interface Three {} +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/LambdaTestStrictFP.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/LambdaTestStrictFP.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8046060 + * @summary Different results of floating point multiplication for lambda code block + */ + +strictfp +public class LambdaTestStrictFP { + + static double fld = eval(() -> { + double x = Double.longBitsToDouble(0x1e7ee00000000000L); + double y = Double.longBitsToDouble(0x2180101010101010L); + + return x * y; + }); + + public static void main(String args[]) { + double result = eval(() -> { + double x = Double.longBitsToDouble(0x1e7ee00000000000L); + double y = Double.longBitsToDouble(0x2180101010101010L); + + return x * y; + }); + { + double x = Double.longBitsToDouble(0x1e7ee00000000000L); + double y = Double.longBitsToDouble(0x2180101010101010L); + + double z = x * y; + check(z, result, "method"); + check(z, fld, "field"); + } + } + + private static void check(double expected, double got, String where) { + if (got != expected) { + throw new AssertionError(where + ": Non-strictfp " + got + " != " + expected); + } + } + + private static double eval(Face arg) { + return arg.m(); + } + + private interface Face { + double m(); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/LambdaTestStrictFPFlag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/LambdaTestStrictFPFlag.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8046060 + * @summary Different results of floating point multiplication for lambda code block + */ + +import java.io.*; +import java.net.URL; +import com.sun.tools.classfile.*; +import static com.sun.tools.classfile.AccessFlags.ACC_STRICT; + +public class LambdaTestStrictFPFlag { + public static void main(String[] args) throws Exception { + new LambdaTestStrictFPFlag().run(); + } + + void run() throws Exception { + ClassFile cf = getClassFile("LambdaTestStrictFPFlag$Test.class"); + ConstantPool cp = cf.constant_pool; + boolean found = false; + for (Method meth: cf.methods) { + if (meth.getName(cp).startsWith("lambda$")) { + if ((meth.access_flags.flags & ACC_STRICT) == 0) { + throw new Exception("strict flag missing from lambda"); + } + found = true; + } + } + if (!found) { + throw new Exception("did not find lambda method"); + } + } + + ClassFile getClassFile(String name) throws IOException, ConstantPoolException { + URL url = getClass().getResource(name); + InputStream in = url.openStream(); + try { + return ClassFile.read(in); + } finally { + in.close(); + } + } + + class Test { + strictfp void test() { + Face itf = () -> { }; + } + } + + interface Face { + void m(); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/LambdaTestStrictFPMethod.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/LambdaTestStrictFPMethod.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8046060 + * @summary Different results of floating point multiplication for lambda code block + */ + +public class LambdaTestStrictFPMethod { + + public static void main(String args[]) { + new LambdaTestStrictFPMethod().test(); + } + + strictfp void test() { + double result = eval(() -> { + double x = Double.longBitsToDouble(0x1e7ee00000000000L); + double y = Double.longBitsToDouble(0x2180101010101010L); + + return x * y; + }); + { + double x = Double.longBitsToDouble(0x1e7ee00000000000L); + double y = Double.longBitsToDouble(0x2180101010101010L); + + double z = x * y; + check(z, result, "method"); + } + } + + strictfp void check(double expected, double got, String where) { + if (got != expected) { + throw new AssertionError(where + ": Non-strictfp " + got + " != " + expected); + } + } + + static double eval(Face arg) { + return arg.m(); + } + + interface Face { + double m(); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,24 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8038182 + * @summary javac crash with FunctionDescriptorLookupError for invalid functional interface + * @compile/fail/ref=CrashFunctionDescriptorExceptionTest.out -XDrawDiagnostics CrashFunctionDescriptorExceptionTest.java + */ + +class CrashFunctionDescriptorExceptionTest { + + @SuppressWarnings("unchecked") + void m () { + bar((B b) -> {}); + } + + > void bar(I i) {} + + class A {} + + class B extends A {} + + interface I> { + void foo(E e); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/T8038182/CrashFunctionDescriptorExceptionTest.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +CrashFunctionDescriptorExceptionTest.java:12:13: compiler.err.prob.found.req: (compiler.misc.no.suitable.functional.intf.inst: CrashFunctionDescriptorExceptionTest.I) +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,33 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8042759 + * @summary Lambda returning implicitly-typed lambdas considered pertinent to applicability + * @compile/fail/ref=ImplicitLambdaConsideredForApplicabilityTest.out -XDrawDiagnostics ImplicitLambdaConsideredForApplicabilityTest.java + */ + +abstract class ImplicitLambdaConsideredForApplicabilityTest { + interface A { + B m(int a, int b); + } + + interface C { + String m(int a, int b); + } + + interface B { + int m(int c); + } + + abstract void foo(A a); + + abstract void foo(C c); + + void bar() { + foo((int a, int b) -> { + if(a < b) + return c -> 0; + else + return c -> 0; + }); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/T8042759/ImplicitLambdaConsideredForApplicabilityTest.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +ImplicitLambdaConsideredForApplicabilityTest.java:26:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(ImplicitLambdaConsideredForApplicabilityTest.A), ImplicitLambdaConsideredForApplicabilityTest, kindname.method, foo(ImplicitLambdaConsideredForApplicabilityTest.C), ImplicitLambdaConsideredForApplicabilityTest +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerBootstrap.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerBootstrap.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8044748 + * @summary JVM cannot access constructor though ::new reference although can call it directly + */ + +public class MethodRefNewInnerBootstrap { + + interface Constructor { + public MyTest execute(int i); + } + + public class MyTest { + public MyTest(int i) { System.out.println("Constructor executed " + i); } + } + + public Constructor getConstructor() { + return MyTest::new; + } + + public static void main(String argv[]) { + new MethodRefNewInnerBootstrap().call(); + } + + public void call() { + MyTest mt = new MyTest(0); + + Constructor c1 = MyTest::new; + c1.execute(1); + + Constructor c2 = getConstructor(); + c2.execute(2); + + Constructor c3 = new Constructor() { + public MyTest execute(int i) { + return new MyTest(3); + } + }; + c3.execute(3); + + Constructor c4 = new Constructor() { + public MyTest execute(int i) { + Constructor c = MyTest::new; + return c.execute(i); + } + }; + c4.execute(4); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaNPE1.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaNPE1.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8037404 + * @summary javac NPE or VerifyError for code with constructor reference of inner class + */ + +import java.util.function.Supplier; +import java.util.stream.Stream; + +public class MethodRefNewInnerInLambdaNPE1 { + public static void main(String[] args) { + if (new MethodRefNewInnerInLambdaNPE1().getList().get().getClass() != TT.class) + throw new AssertionError("sanity failed"); + } + + Supplier getList() { + return () -> Stream.of(1).map(TT::new).findFirst().get(); + } + + class TT { + public TT(int i) { + + } + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaNPE2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaNPE2.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8044737 + * @summary Lambda: NPE while obtaining method reference through lambda expression + * @compile MethodRefNewInnerInLambdaNPE2.java + */ + +public class MethodRefNewInnerInLambdaNPE2 { + + interface Constructor { + MyTest execute(); + } + + class MyTest { + MyTest() { System.out.println("Constructor executed"); } + } + + public Constructor getConstructor() { + return getConstructor(() -> { return MyTest::new; }); + } + + public static void main(String argv[]) { + MethodRefNewInnerInLambdaNPE2 t = new MethodRefNewInnerInLambdaNPE2(); + MyTest mytest = t.getConstructor().execute(); + } + + Constructor getConstructor(Wrapper arg) { + return arg.unwrap(); + } + + interface Wrapper { + Constructor unwrap(); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaVerify1.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaVerify1.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8037404 + * @summary javac NPE or VerifyError for code with constructor reference of inner class + */ + +import java.util.function.Function; +import java.util.stream.Stream; + +public class MethodRefNewInnerInLambdaVerify1 { + public static void main(String[] args) { + if (new MethodRefNewInnerInLambdaVerify1().map().apply(1).getClass() != TT.class) + throw new AssertionError("sanity failed"); + } + + Function map() { + return (i) -> Stream.of(i).map(TT::new).findFirst().get(); + } + + class TT { + public TT(int i) { + + } + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaVerify2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaVerify2.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8038776 + * @summary VerifyError when running successfully compiled java class + */ + +import java.util.function.Function; + +/** + * Derived from code by: + * @author Yawkat + */ +public class MethodRefNewInnerInLambdaVerify2 { + public static void main(String[] args) { new MethodRefNewInnerInLambdaVerify2().runTest(); } + + private void runTest() { + Worker worker = new Worker(); + run(() -> worker.check(field -> new SomeClass(field))); + run(() -> worker.check(SomeClass::new)); + } + + private void run(Runnable runnable) { + runnable.run(); + } + + private class SomeClass { + final Object field; + + SomeClass(Object field) { + this.field = field; + } + } + + private static class Worker { + void check(Function i) { + if (!i.apply("frank").field.equals("frank")) throw new AssertionError("sanity failed"); + } + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaVerify2simple.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodRefNewInnerInLambdaVerify2simple.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8038776 + * @summary VerifyError when running successfully compiled java class + */ + +import java.util.function.Function; + +/** + * Derived from code by: + * @author Yawkat + */ +public class MethodRefNewInnerInLambdaVerify2simple { + public static void main(String[] args) { new MethodRefNewInnerInLambdaVerify2simple().runTest(); } + + private void runTest() { + Runnable r = (() -> { Sup w = SomeClass::new; } ); + } + + private class SomeClass { + SomeClass() { } + } +} + +interface Sup { + Object get(); +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodRefQualifier1.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodRefQualifier1.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8048121 + * @summary javac complex method references: revamp and simplify + */ + +public class MethodRefQualifier1 { + + interface SAM { + void m(); + } + + static int count = 0; + + static void assertTrue(boolean cond, String msg) { + if (!cond) + throw new AssertionError(msg); + } + + MethodRefQualifier1 check() { + count++; + return this; + } + + void ido(Object... args) { } + + public static void main(String[] args) { + new MethodRefQualifier1().test(); + } + + void test() { + count = 0; + SAM s = check()::ido; + assertTrue(count == 1, "creation: unexpected: " + count); + count = 0; + s.m(); + assertTrue(count == 0, "evaluation: unexpected: " + count); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodRefSingleRefEvalBridge.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodRefSingleRefEvalBridge.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8048121 + * @summary javac complex method references: revamp and simplify + * + * Make sure that the method reference receiver is evaluated exactly once + * even in this bridging case. + */ + + public class MethodRefSingleRefEvalBridge { + + interface SAM { + int m(); + } + + class ZZ { + // private to force bridging + private int four() { return 4; } + } + + static int count = 0; + ZZ azz = new ZZ(); + + static void assertEqual(int expected, int got) { + if (got != expected) + throw new AssertionError("Expected " + expected + " got " + got); + } + + public static void main(String[] args) { + new MethodRefSingleRefEvalBridge().test(); + } + + ZZ check() { + count++; + return azz; + } + + void test() { + count = 0; + SAM s = check()::four; + assertEqual(1, count); + + count = 0; + assertEqual(4, s.m()); + assertEqual(0, count); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodRefToInner.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodRefToInner.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8047341 + * @summary lambda reference to inner class in base class causes LambdaConversionException + */ + +import java.util.List; +import java.util.ArrayList; + +class MethodRefToInnerBase { + class TestString { + String str; + TestString(String strin) { + str = strin; + } + } +} +public class MethodRefToInner extends MethodRefToInnerBase { + public static void main(String[] args) { + new MethodRefToInner().run(); + } + MethodRefToInner() { + super(); + } + void run() { + List list = new ArrayList<>(); + list.stream().forEach(TestString::new); + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lambda/methodReference/MethodReferenceComplexNullCheckTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/lambda/methodReference/MethodReferenceComplexNullCheckTest.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8048121 + * @summary javac complex method references: revamp and simplify + * + * Make sure NPE check is done even in the convert to Lambda case + */ + +public class MethodReferenceComplexNullCheckTest { + public static void main(String[] args) { + F fr = null; + boolean npeFired = false; + try { + IForm frf = fr::doit; + } catch (NullPointerException npe) { + npeFired = true; + } finally { + if (!npeFired) throw new AssertionError( "NPE should have been thrown"); + } + } + + interface IForm { + void xyz(Object... args); + } + + class F { + private void doit(Object... args) { } + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/lib/DPrinter.java --- a/langtools/test/tools/javac/lib/DPrinter.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/lib/DPrinter.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ /* @test - * @bug 8043484 + * @bug 8043484 8007307 * @summary Make sure DPrinter.java compiles * @compile DPrinter.java */ @@ -50,6 +50,7 @@ import javax.tools.StandardLocation; import javax.tools.ToolProvider; +import com.sun.source.doctree.*; import com.sun.source.util.JavacTask; import com.sun.source.util.TaskEvent; import com.sun.source.util.TaskListener; @@ -74,6 +75,7 @@ import com.sun.tools.javac.tree.TreeScanner; import com.sun.tools.javac.util.Assert; import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.Convert; import com.sun.tools.javac.util.Log; @@ -248,6 +250,20 @@ } } + public void printDocTree(String label, DocTree tree) { + if (tree == null) { + printNull(label); + } else { + indent(); + out.print(label); + out.println(": " + tree.getClass().getSimpleName() + "," + tree.getKind()); + + indent(+1); + tree.accept(docTreeVisitor, null); + indent(-1); + } + } + public void printFileObject(String label, FileObject fo) { if (fo == null) { printNull(label); @@ -265,6 +281,17 @@ printString(label, String.valueOf(i)); } + public void printLimitedEscapedString(String label, String text) { + String s = Convert.quote(text); + if (s.length() > maxSrcLength) { + String trim = "[...]"; + int head = (maxSrcLength - trim.length()) * 2 / 3; + int tail = maxSrcLength - trim.length() - head; + s = s.substring(0, head) + trim + s.substring(s.length() - tail); + } + printString(label, s); + } + public void printList(String label, List list) { if (list == null) { printNull(label); @@ -304,6 +331,8 @@ printType(label, (Type) item, details); } else if (item instanceof JCTree) { printTree(label, (JCTree) item); + } else if (item instanceof DocTree) { + printDocTree(label, (DocTree) item); } else if (item instanceof List) { printList(label, (List) item); } else if (item instanceof Name) { @@ -877,6 +906,191 @@ // + // + + protected DocTreeVisitor docTreeVisitor = new DefaultDocTreeVisitor(); + + /** + * Default visitor class for DocTree objects. + * Note: each visitXYZ method ends by calling the corresponding + * visit method for its superclass. + */ + class DefaultDocTreeVisitor implements DocTreeVisitor { + + public Void visitAttribute(AttributeTree node, Void p) { + printName("name", node.getName()); + printString("vkind", node.getValueKind().name()); + printList("value", node.getValue()); + return visitTree(node, null); + } + + public Void visitAuthor(AuthorTree node, Void p) { + printList("name", node.getName()); + return visitBlockTag(node, null); + } + + public Void visitComment(CommentTree node, Void p) { + printLimitedEscapedString("body", node.getBody()); + return visitTree(node, null); + } + + public Void visitDeprecated(DeprecatedTree node, Void p) { + printList("body", node.getBody()); + return visitBlockTag(node, null); + } + + public Void visitDocComment(DocCommentTree node, Void p) { + printList("firstSentence", node.getFirstSentence()); + printList("body", node.getBody()); + printList("tags", node.getBlockTags()); + return visitTree(node, null); + } + + public Void visitDocRoot(DocRootTree node, Void p) { + return visitInlineTag(node, null); + } + + public Void visitEndElement(EndElementTree node, Void p) { + printName("name", node.getName()); + return visitTree(node, null); + } + + public Void visitEntity(EntityTree node, Void p) { + printName("name", node.getName()); + return visitTree(node, null); + } + + public Void visitErroneous(ErroneousTree node, Void p) { + printLimitedEscapedString("body", node.getBody()); + printString("diag", node.getDiagnostic().getMessage(Locale.getDefault())); + return visitTree(node, null); + } + + public Void visitIdentifier(IdentifierTree node, Void p) { + printName("name", node.getName()); + return visitTree(node, null); + } + + public Void visitInheritDoc(InheritDocTree node, Void p) { + return visitInlineTag(node, null); + } + + public Void visitLink(LinkTree node, Void p) { + printString("kind", node.getKind().name()); + printDocTree("ref", node.getReference()); + printList("list", node.getLabel()); + return visitInlineTag(node, null); + } + + public Void visitLiteral(LiteralTree node, Void p) { + printString("kind", node.getKind().name()); + printDocTree("body", node.getBody()); + return visitInlineTag(node, null); + } + + public Void visitParam(ParamTree node, Void p) { + printString("isTypeParameter", String.valueOf(node.isTypeParameter())); + printString("kind", node.getKind().name()); + printList("desc", node.getDescription()); + return visitBlockTag(node, null); + } + + public Void visitReference(ReferenceTree node, Void p) { + printString("signature", node.getSignature()); + return visitTree(node, null); + } + + public Void visitReturn(ReturnTree node, Void p) { + printList("desc", node.getDescription()); + return visitBlockTag(node, null); + } + + public Void visitSee(SeeTree node, Void p) { + printList("ref", node.getReference()); + return visitBlockTag(node, null); + } + + public Void visitSerial(SerialTree node, Void p) { + printList("desc", node.getDescription()); + return visitBlockTag(node, null); + } + + public Void visitSerialData(SerialDataTree node, Void p) { + printList("desc", node.getDescription()); + return visitBlockTag(node, null); + } + + public Void visitSerialField(SerialFieldTree node, Void p) { + printDocTree("name", node.getName()); + printDocTree("type", node.getType()); + printList("desc", node.getDescription()); + return visitBlockTag(node, null); + } + + public Void visitSince(SinceTree node, Void p) { + printList("body", node.getBody()); + return visitBlockTag(node, null); + } + + public Void visitStartElement(StartElementTree node, Void p) { + printName("name", node.getName()); + printList("attrs", node.getAttributes()); + printString("selfClosing", String.valueOf(node.isSelfClosing())); + return visitBlockTag(node, null); + } + + public Void visitText(TextTree node, Void p) { + printLimitedEscapedString("body", node.getBody()); + return visitTree(node, null); + } + + public Void visitThrows(ThrowsTree node, Void p) { + printDocTree("name", node.getExceptionName()); + printList("desc", node.getDescription()); + return visitBlockTag(node, null); + } + + public Void visitUnknownBlockTag(UnknownBlockTagTree node, Void p) { + printString("name", node.getTagName()); + printList("content", node.getContent()); + return visitBlockTag(node, null); + } + + public Void visitUnknownInlineTag(UnknownInlineTagTree node, Void p) { + printString("name", node.getTagName()); + printList("content", node.getContent()); + return visitInlineTag(node, null); + } + + public Void visitValue(ValueTree node, Void p) { + printDocTree("value", node.getReference()); + return visitInlineTag(node, null); + } + + public Void visitVersion(VersionTree node, Void p) { + printList("body", node.getBody()); + return visitBlockTag(node, null); + } + + public Void visitOther(DocTree node, Void p) { + return visitTree(node, null); + } + + public Void visitBlockTag(DocTree node, Void p) { + return visitTree(node, null); + } + + public Void visitInlineTag(DocTree node, Void p) { + return visitTree(node, null); + } + + public Void visitTree(DocTree node, Void p) { + return null; + } + } + + // + // protected Symbol.Visitor symVisitor = new SymbolVisitor(); @@ -1228,18 +1442,19 @@ } private void handle(TaskEvent e) { + JCCompilationUnit unit = (JCCompilationUnit) e.getCompilationUnit(); switch (e.getKind()) { case PARSE: case ENTER: h.handle(e.getSourceFile().getName(), - (JCTree) e.getCompilationUnit(), + unit, unit, dprinter); break; default: TypeElement elem = e.getTypeElement(); h.handle(elem.toString(), - (JCTree) trees.getTree(elem), + unit, (JCTree) trees.getTree(elem), dprinter); break; } @@ -1258,7 +1473,9 @@ Handler(String name) { this.name = name; } - abstract void handle(String label, JCTree tree, DPrinter dprinter); + abstract void handle(String label, + JCCompilationUnit unit, JCTree tree, + DPrinter dprinter); } Map getHandlers() { @@ -1272,36 +1489,36 @@ protected final Handler[] defaultHandlers = { new Handler("trees") { @Override - void handle(String name, JCTree tree, DPrinter dprinter) { + void handle(String name, JCCompilationUnit unit, JCTree tree, DPrinter dprinter) { dprinter.printTree(name, tree); dprinter.out.println(); } }, + new Handler("doctrees") { + @Override + void handle(final String name, final JCCompilationUnit unit, JCTree tree, final DPrinter dprinter) { + TreeScanner ds = new DeclScanner() { + public void visitDecl(JCTree tree, Symbol sym) { + DocTree dt = unit.docComments.getCommentTree(tree); + if (dt != null) { + String label = (sym == null) ? Pretty.toSimpleString(tree) : sym.name.toString(); + dprinter.printDocTree(label, dt); + dprinter.out.println(); + } + } + }; + ds.scan(tree); + } + }, + new Handler("symbols") { @Override - void handle(String name, JCTree tree, final DPrinter dprinter) { - TreeScanner ds = new TreeScanner() { - @Override - public void visitClassDef(JCClassDecl tree) { - visitDecl(tree, tree.sym); - super.visitClassDef(tree); - } - - @Override - public void visitMethodDef(JCMethodDecl tree) { - visitDecl(tree, tree.sym); - super.visitMethodDef(tree); - } - - @Override - public void visitVarDef(JCVariableDecl tree) { - visitDecl(tree, tree.sym); - super.visitVarDef(tree); - } - - void visitDecl(JCTree tree, Symbol sym) { - dprinter.printSymbol(sym.name.toString(), sym); + void handle(String name, JCCompilationUnit unit, JCTree tree, final DPrinter dprinter) { + TreeScanner ds = new DeclScanner() { + public void visitDecl(JCTree tree, Symbol sym) { + String label = (sym == null) ? Pretty.toSimpleString(tree) : sym.name.toString(); + dprinter.printSymbol(label, sym); dprinter.out.println(); } }; @@ -1311,7 +1528,7 @@ new Handler("types") { @Override - void handle(String name, JCTree tree, final DPrinter dprinter) { + void handle(String name, JCCompilationUnit unit, JCTree tree, final DPrinter dprinter) { TreeScanner ts = new TreeScanner() { @Override public void scan(JCTree tree) { @@ -1332,6 +1549,28 @@ }; } + protected static abstract class DeclScanner extends TreeScanner { + @Override + public void visitClassDef(JCClassDecl tree) { + visitDecl(tree, tree.sym); + super.visitClassDef(tree); + } + + @Override + public void visitMethodDef(JCMethodDecl tree) { + visitDecl(tree, tree.sym); + super.visitMethodDef(tree); + } + + @Override + public void visitVarDef(JCVariableDecl tree) { + visitDecl(tree, tree.sym); + super.visitVarDef(tree); + } + + protected abstract void visitDecl(JCTree tree, Symbol sym); + } + // } diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/nested/5009484/X.java --- a/langtools/test/tools/javac/nested/5009484/X.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/nested/5009484/X.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,32 +1,9 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test + * @test /nodynamiccopyright/ * @bug 5009484 * @summary Compiler fails to resolve appropriate type for outer member * @author Philippe P Mulet - * @compile/fail X.java + * @compile/fail/ref=X.out -XDrawDiagnostics X.java */ public class X { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/nested/5009484/X.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/nested/5009484/X.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +X.java:22:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T, X) +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/nested/5009484/Y.java --- a/langtools/test/tools/javac/nested/5009484/Y.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/nested/5009484/Y.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,32 +1,9 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test + * @test /nodynamiccopyright/ * @bug 5009484 * @summary Compiler fails to resolve appropriate type for outer member * @author Peter von der Ah\u00e9 - * @compile/fail Y.java + * @compile/fail/ref=Y.out -XDrawDiagnostics Y.java */ public class Y { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/nested/5009484/Y.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/nested/5009484/Y.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +Y.java:12:18: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: T, Y) +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/overload/T4743490.java --- a/langtools/test/tools/javac/overload/T4743490.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/overload/T4743490.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,33 +1,9 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 4743490 * @summary overloading versus super.f(args) versus interfaces * @author gafter - * - * @compile/fail T4743490.java + * @compile/fail/ref=T4743490.out -XDrawDiagnostics T4743490.java */ class T4743490 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/overload/T4743490.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/overload/T4743490.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T4743490.java:21:18: compiler.err.ref.ambiguous: m, kindname.method, m(java.lang.String,java.lang.Object), T4743490.B, kindname.method, m(java.lang.Object,java.lang.String), T4743490.A +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/overload/T5090220.java --- a/langtools/test/tools/javac/overload/T5090220.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/overload/T5090220.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,31 +1,8 @@ /* - * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test + * @test /nodynamiccopyright/ * @bug 5090220 * @summary Autoboxing applied when calculating most-specific method - * @compile/fail T5090220.java + * @compile/fail/ref=T5090220.out -XDrawDiagnostics T5090220.java */ class T5090220 { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/overload/T5090220.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/overload/T5090220.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,2 @@ +T5090220.java:16:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(int,java.lang.Integer), T5090220, kindname.method, foo(java.lang.Integer,double), T5090220 +1 error diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/processing/model/util/elements/doccomments/TestPackageInfoComments.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/processing/model/util/elements/doccomments/TestPackageInfoComments.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8042345 + * @summary getDocComment() fails for doc comments on PackageElement found in package-info.java + */ + +import com.sun.source.util.JavacTask; + +import java.io.*; +import java.util.*; +import javax.annotation.processing.*; +import javax.lang.model.*; +import javax.lang.model.element.*; +import javax.lang.model.util.*; +import javax.tools.*; + +@SupportedAnnotationTypes("*") +public class TestPackageInfoComments extends AbstractProcessor { + + public static void main(String... args) throws Exception { + String[] opts = { + "-implicit:none", + "-processor", TestPackageInfoComments.class.getName(), + "-processorpath", System.getProperty("test.classes") + }; + File[] files = { + new File(System.getProperty("test.src"), "p/package-info.java") + }; + run_test(opts, files); + } + + static void run_test(String[] opts, File[] files) throws IOException { + DiagnosticListener dl = new DiagnosticListener() { + public void report(Diagnostic diagnostic) { + throw new Error(diagnostic.toString()); + } + }; + JavaCompiler c = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager fm = c.getStandardFileManager(null, null, null); + Iterable units = fm.getJavaFileObjects(files); + JavacTask t = (JavacTask) c.getTask(null, fm, dl, Arrays.asList(opts), null, units); + t.parse(); + t.analyze(); + } + + // -- Annotation processor: Check all PackageDecl's have a doc comment + + Messager messager; + Elements elements; + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + + @Override + public void init(ProcessingEnvironment pEnv) { + super.init(pEnv); + messager = pEnv.getMessager(); + elements = pEnv.getElementUtils(); + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + for (Element e: roundEnv.getRootElements()) + new TestElementScanner().scan(e); + return true; + } + + class TestElementScanner extends ElementScanner7 { + @Override + public Void visitPackage(PackageElement e, Void v) { + if (elements.getDocComment(e) == null) + messager.printMessage(Diagnostic.Kind.ERROR, "doc comment is null", e); + return v; + } + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/processing/model/util/elements/doccomments/p/package-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/processing/model/util/elements/doccomments/p/package-info.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** A non-empty comment. */ +package foo; diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/tree/MissingSemicolonTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/tree/MissingSemicolonTest.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8041648 + * @summary Verify that end positions are sane if semicolons are missing. + * @run main MissingSemicolonTest MissingSemicolonTest.java + */ + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.util.*; + +import javax.tools.*; + +import com.sun.source.tree.*; +import com.sun.source.tree.Tree.Kind; +import com.sun.source.util.*; +import com.sun.tools.javac.api.JavacTool; +import com.sun.tools.javac.parser.Scanner; +import com.sun.tools.javac.parser.ScannerFactory; +import com.sun.tools.javac.tree.JCTree; +import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; +import com.sun.tools.javac.util.Context; + +public class MissingSemicolonTest { + public static void main(String... args) { + String testSrc = System.getProperty("test.src"); + File baseDir = new File(testSrc); + boolean ok = new MissingSemicolonTest().run(baseDir, args); + if (!ok) { + throw new Error("failed"); + } + } + + boolean run(File baseDir, String... args) { + if (args.length == 0) { + throw new IllegalStateException("Needs input files."); + } + + for (String arg : args) { + File file = new File(baseDir, arg); + if (file.exists()) + test(file); + else + error("File not found: " + file); + } + + System.err.println(fileCount + " files read"); + if (errors > 0) + System.err.println(errors + " errors"); + + return errors == 0; + } + + void test(File file) { + if (file.isFile() && file.getName().endsWith(".java")) { + try { + fileCount++; + String content = new String(Files.readAllBytes(file.toPath())); + List spans = gatherTreeSpans(file, content); + int nextSemicolon = -1; + + //remove semicolons, one at a time, and verify the positions are still meaningful: + while ((nextSemicolon = content.indexOf(';', nextSemicolon + 1)) != (-1)) { + String updatedContent = + content.substring(0, nextSemicolon) + + " " + + content.substring(nextSemicolon + 1); + verifyTreeSpans(file, spans, updatedContent, nextSemicolon); + } + } catch (IOException e) { + error("Error reading " + file + ": " + e); + } + } + } + + public List gatherTreeSpans(File file, String content) throws IOException { + JCCompilationUnit unit = read(file.toURI(), content); + List spans = new ArrayList<>(); + new TreePathScanner() { + @Override + public Void scan(Tree tree, Void p) { + if (tree != null) { + int start = ((JCTree) tree).getStartPosition(); + int end = ((JCTree) tree).getEndPosition(unit.endPositions); + + spans.add(new int[] {start, end}); + } + return super.scan(tree, p); + } + }.scan(unit, null); + return spans; + } + + public void verifyTreeSpans(File file, List spans, + String updatedContent, int semicolon) throws IOException { + JCCompilationUnit updated = read(file.toURI(), updatedContent); + Iterator nextSpan = spans.iterator(); + new TreePathScanner() { + @Override + public Void scan(Tree tree, Void p) { + if (tree != null) { + int start = ((JCTree) tree).getStartPosition(); + int end = ((JCTree) tree).getEndPosition(updated.endPositions); + + if (tree.getKind() != Kind.ERRONEOUS) { + int[] expected = nextSpan.next(); + int expectedEnd = expected[1]; + + if (expectedEnd == semicolon + 1) { + Scanner scanner = scannerFactory.newScanner(updatedContent, true); + scanner.nextToken(); + while (scanner.token().pos < expectedEnd) + scanner.nextToken(); + expectedEnd = scanner.token().pos; + } + + if (expected[0] != start || expectedEnd != end) { + error(updatedContent + "; semicolon: " + semicolon + "; expected: " + + expected[0] + "-" + expectedEnd + "; found=" + start + "-" + end + + ";" + tree); + } + } + } + return super.scan(tree, p); + } + }.scan(updated, null); + } + + DiagnosticListener devNull = (d) -> {}; + JavacTool tool = JavacTool.create(); + StandardJavaFileManager fm = tool.getStandardFileManager(devNull, null, null); + ScannerFactory scannerFactory = ScannerFactory.instance(new Context()); + + /** + * Read a file. + * @param file the file to be read + * @return the tree for the content of the file + * @throws IOException if any IO errors occur + * @throws MissingSemicolonTest.ParseException if any errors occur while parsing the file + */ + JCCompilationUnit read(URI uri, String content) throws IOException { + JavacTool tool = JavacTool.create(); + JavacTask task = tool.getTask(null, fm, devNull, Collections.emptyList(), null, + Arrays.asList(new JavaSource(uri, content))); + Iterable trees = task.parse(); + Iterator iter = trees.iterator(); + if (!iter.hasNext()) + throw new Error("no trees found"); + JCCompilationUnit t = (JCCompilationUnit) iter.next(); + if (iter.hasNext()) + throw new Error("too many trees found"); + return t; + } + + class JavaSource extends SimpleJavaFileObject { + + private final String content; + public JavaSource(URI uri, String content) { + super(uri, JavaFileObject.Kind.SOURCE); + this.content = content; + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return content; + } + } + + /** + * Report an error. When the program is complete, the program will either + * exit or throw an Error if any errors have been reported. + * @param msg the error message + */ + void error(String msg) { + System.err.println(msg); + errors++; + } + + /** Number of files that have been analyzed. */ + int fileCount; + /** Number of errors reported. */ + int errors; + +} + +class TestCase { + String str1; + String str2; + public TestCase() { + super(); + super.hashCode(); + } + public TestCase(String str1, String str2) { + super(); + this.str1 = str1; + this.str2 = str2; + assert true; + } + + void newClass() { + new String(); + new String(); + } + + void localVars() { + String str1 = ""; + String str2; + String str3; + final String str4; + } + + void throwsException() { + throw new IllegalStateException(); + } + + int returnWithExpression() { + return 1; + } + + void returnWithoutExpression() { + return ; + } + + void doWhileBreakContinue() { + do { + if (true) + break; + if (false) + continue; + } while(true); + } + + void labelled() { + LABEL: doWhileBreakContinue(); + } + +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/varargs/warning/Warn4.java --- a/langtools/test/tools/javac/varargs/warning/Warn4.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/varargs/warning/Warn4.java Wed Jul 09 10:42:13 2014 -0700 @@ -73,13 +73,15 @@ ModifierKind modKind) { switch(this) { case VARARGS: - return source == SourceLevel.JDK_6 || + return source.compareTo(SourceLevel.JDK_7) < 0 || suppressLevelDecl == SuppressLevel.UNCHECKED || trustMe == TrustMe.TRUST; case UNCHECKED: return suppressLevelClient == SuppressLevel.UNCHECKED || - (trustMe == TrustMe.TRUST && modKind != - ModifierKind.NONE && source == SourceLevel.JDK_7); + (trustMe == TrustMe.TRUST && + (((modKind == ModifierKind.FINAL || modKind == ModifierKind.STATIC) && + source.compareTo( SourceLevel.JDK_7) >= 0 ) || + (modKind == ModifierKind.PRIVATE && source.compareTo( SourceLevel.JDK_9) >= 0 ))); } SuppressLevel supLev = this == VARARGS ? @@ -92,7 +94,8 @@ enum SourceLevel { JDK_6("6"), - JDK_7("7"); + JDK_7("7"), + JDK_9("9"); String sourceKey; @@ -115,7 +118,8 @@ enum ModifierKind { NONE(" "), FINAL("final "), - STATIC("static "); + STATIC("static "), + PRIVATE("private "); String mod; diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/varargs/warning/Warn5.java --- a/langtools/test/tools/javac/varargs/warning/Warn5.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/varargs/warning/Warn5.java Wed Jul 09 10:42:13 2014 -0700 @@ -89,7 +89,8 @@ enum ModifierKind { NONE(""), FINAL("final"), - STATIC("static"); + STATIC("static"), + PRIVATE("private"); String mod; @@ -111,7 +112,8 @@ enum SourceLevel { JDK_6("6"), - JDK_7("7"); + JDK_7("7"), + JDK_9("9"); String sourceKey; @@ -238,7 +240,7 @@ EnumSet expectedWarnings = EnumSet.noneOf(WarningKind.class); - if (sourceLevel == SourceLevel.JDK_7 && + if (sourceLevel.compareTo(SourceLevel.JDK_7) >= 0 && trustMe == TrustMe.TRUST && suppressLevel != SuppressLevel.VARARGS && xlint != XlintOption.NONE && @@ -247,11 +249,12 @@ body.hasAliasing && (methKind == MethodKind.CONSTRUCTOR || (methKind == MethodKind.METHOD && - modKind != ModifierKind.NONE))) { + modKind == ModifierKind.FINAL || modKind == ModifierKind.STATIC || + (modKind == ModifierKind.PRIVATE && sourceLevel.compareTo(SourceLevel.JDK_9) >= 0)))) { expectedWarnings.add(WarningKind.UNSAFE_BODY); } - if (sourceLevel == SourceLevel.JDK_7 && + if (sourceLevel.compareTo(SourceLevel.JDK_7) >= 0 && trustMe == TrustMe.DONT_TRUST && sig.isVarargs && !sig.isReifiableArg && @@ -259,20 +262,22 @@ expectedWarnings.add(WarningKind.UNSAFE_DECL); } - if (sourceLevel == SourceLevel.JDK_7 && + if (sourceLevel.compareTo(SourceLevel.JDK_7) >= 0 && trustMe == TrustMe.TRUST && (!sig.isVarargs || - (modKind == ModifierKind.NONE && - methKind == MethodKind.METHOD))) { + ((modKind == ModifierKind.NONE || + modKind == ModifierKind.PRIVATE && sourceLevel.compareTo(SourceLevel.JDK_9) < 0 ) && + methKind == MethodKind.METHOD))) { expectedWarnings.add(WarningKind.MALFORMED_SAFEVARARGS); } - if (sourceLevel == SourceLevel.JDK_7 && + if (sourceLevel.compareTo(SourceLevel.JDK_7) >= 0 && trustMe == TrustMe.TRUST && xlint != XlintOption.NONE && suppressLevel != SuppressLevel.VARARGS && - (modKind != ModifierKind.NONE || - methKind == MethodKind.CONSTRUCTOR) && + (modKind == ModifierKind.FINAL || modKind == ModifierKind.STATIC || + (modKind == ModifierKind.PRIVATE && sourceLevel.compareTo(SourceLevel.JDK_9) >= 0) || + methKind == MethodKind.CONSTRUCTOR) && sig.isVarargs && sig.isReifiableArg) { expectedWarnings.add(WarningKind.REDUNDANT_SAFEVARARGS); @@ -283,6 +288,7 @@ throw new Error("invalid diagnostics for source:\n" + source.getCharContent(true) + "\nOptions: " + xlint.getXlintOption() + + "\nSource Level: " + sourceLevel + "\nExpected warnings: " + expectedWarnings + "\nFound warnings: " + dc.warnings); } diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/warnings/suppress/T6707032.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/warnings/suppress/T6707032.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,18 @@ +/** + * @test /nodynamiccopyright/ + * @bug 6707032 + * @summary Verify that \\@SuppressWarnings("divzero") works for constant initializers + * @build VerifySuppressWarnings + * @compile/ref=T6707032.out -XDrawDiagnostics -Xlint:divzero T6707032.java + * @run main VerifySuppressWarnings T6707032.java + */ + +public class T6707032 { + public static final int D1 = T6707032b.D0; + public static final int D2 = 1/0; +} + +class T6707032b { + public static final int D0 = 1/0; + public static final int D3 = T6707032.D2; +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/warnings/suppress/T6707032.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/javac/warnings/suppress/T6707032.out Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,3 @@ +T6707032.java:12:36: compiler.warn.div.zero +T6707032.java:16:36: compiler.warn.div.zero +2 warnings diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javac/warnings/suppress/VerifySuppressWarnings.java --- a/langtools/test/tools/javac/warnings/suppress/VerifySuppressWarnings.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javac/warnings/suppress/VerifySuppressWarnings.java Wed Jul 09 10:42:13 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,11 +55,12 @@ * the @SuppressWarnings annotation on the declaration and verifies than no * warnings are produced inside the declaration, but all are produced outside it. * - * Currently only works with unchecked,deprecation,cast warnings. + * Currently only works with unchecked,deprecation,cast,divzero warnings. */ public class VerifySuppressWarnings { - private static final List STANDARD_PARAMS = Arrays.asList("-Xlint:unchecked,deprecation,cast", "-Xjcov"); + private static final List STANDARD_PARAMS = + Arrays.asList("-Xlint:unchecked,deprecation,cast,divzero"); public static void main(String... args) throws IOException, URISyntaxException { if (args.length != 1) throw new IllegalStateException("Must provide class name!"); @@ -133,7 +134,8 @@ }.scan(cut, null); for (final int[] declarationSpan : declarationSpans) { - final String suppressWarnings = "@SuppressWarnings({\"deprecation\", \"unchecked\", \"serial\"})"; + final String suppressWarnings = + "@SuppressWarnings({\"deprecation\", \"unchecked\", \"serial\", \"divzero\"})"; final String updatedContent = testContent.substring(0, declarationSpan[0]) + suppressWarnings + testContent.substring(declarationSpan[0]); final List> foundErrors = new ArrayList<>(diagnostics); DiagnosticListener verifyDiagnostics = new DiagnosticListener() { diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/javadoc/6227454/Test.java --- a/langtools/test/tools/javadoc/6227454/Test.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/javadoc/6227454/Test.java Wed Jul 09 10:42:13 2014 -0700 @@ -38,15 +38,18 @@ } void run() throws Exception { - test("ABC XYZ"); - test("ABC XYZ"); - test("ABC XYZ"); - test("ABC XYZ"); - test("ABC XYZ"); - test(" ABC XYZ", "Body tag missing from HTML"); - test("ABC XYZ ", "Close body tag missing from HTML"); - test(" ABC XYZ ", "Body tag missing from HTML"); - test("ABC" + bigText(8192, 40) + "XYZ"); + String docType = ""; + String headTag = "Title "; + test(docType+"ABC XYZ"); + test(docType+"ABC XYZ"); + test(docType+"ABC XYZ"); + test(docType+"ABC XYZ"); + test(docType+"ABC XYZ"); + test(docType+""+headTag+" ABC XYZ", "Body tag missing from HTML"); + test(docType+"ABC XYZ ", "Close body tag missing from HTML"); + test(docType+""+headTag+" ABC XYZ ", "Body tag missing from HTML"); + test(docType+"ABC" + bigText(8192, 40) + "XYZ"); if (errors > 0) throw new Exception(errors + " errors occurred"); diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/sjavac/IgnoreSymbolFile.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/langtools/test/tools/sjavac/IgnoreSymbolFile.java Wed Jul 09 10:42:13 2014 -0700 @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8047183 + * @summary JDK build fails with sjavac enabled + */ + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintStream; +import java.lang.reflect.Method; +import java.util.Arrays; + +public class IgnoreSymbolFile { + public static void main(String... args) throws Exception { + if (sjavacAvailable()) { + IgnoreSymbolFile test = new IgnoreSymbolFile(); + test.run(); + } else { + System.err.println("sjavac not available; test skipped"); + } + } + + void run() throws Exception { + String body = + "package p;\n" + + "import sun.reflect.annotation.*;\n" + + "class X {\n" + + " ExceptionProxy proxy;" + + "}"; + writeFile("src/p/X.java", body); + + new File("classes").mkdirs(); + + String server = "--server:portfile=testserver,background=false"; + int rc1 = compile(server, "-d", "classes", "-Werror", "src"); + if (rc1 == 0) + error("compilation succeeded unexpectedly"); + + int rc2 = compile(server, "-d", "classes", "-Werror", "-XDignore.symbol.file=true", "src"); + if (rc2 != 0) + error("compilation failed unexpectedly: rc=" + rc2); + + if (errors > 0) + throw new Exception(errors + " errors occurred"); + } + + int compile(String... args) throws ReflectiveOperationException { + // Use reflection to avoid a compile-time dependency on sjavac Main + System.err.println("compile: " + Arrays.toString(args)); + Class c = Class.forName("com.sun.tools.sjavac.Main"); + Method m = c.getDeclaredMethod("go", String[].class, PrintStream.class, PrintStream.class); + Object sjavac = c.newInstance(); + int rc = (Integer) m.invoke(sjavac, args, System.err, System.err); + System.err.println("rc=" + rc); + return rc; + } + + void writeFile(String path, String body) throws IOException { + File f = new File(path); + if (f.getParentFile() != null) + f.getParentFile().mkdirs(); + try (FileWriter w = new FileWriter(f)) { + w.write(body); + } + } + + void error(String msg) { + System.err.println("Error: " + msg); + errors++; + } + + int errors; + + static boolean sjavacAvailable() { + try { + Class.forName("com.sun.tools.sjavac.Main"); + return true; + } catch (ClassNotFoundException e) { + return false; + } + } +} diff -r b67086d205bb -r cf09dddb6caf langtools/test/tools/sjavac/SJavac.java --- a/langtools/test/tools/sjavac/SJavac.java Thu Jul 03 11:37:54 2014 -0700 +++ b/langtools/test/tools/sjavac/SJavac.java Wed Jul 09 10:42:13 2014 -0700 @@ -23,7 +23,6 @@ import java.util.*; import java.io.*; -import java.net.*; import java.nio.file.*; import java.nio.file.attribute.*; import java.nio.charset.*; @@ -43,6 +42,9 @@ } FileSystem defaultfs = FileSystems.getDefault(); + String serverArg = "--server:" + + "portfile=testportfile," + + "background=false"; // Where to put generated sources that will // test aspects of sjavac, ie JTWork/scratch/gensrc @@ -136,7 +138,7 @@ "private int b() { return A.DEFINITION; } native void foo(); }"); compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false", "--log=debug"); + serverArg, "--log=debug"); previous_bin_state = collectState(bin); previous_headers_state = collectState(headers); } @@ -145,7 +147,7 @@ System.out.println("\nTesting that no change in sources implies no change in binaries."); System.out.println("------------------------------------------------------------------"); compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false", "--log=debug"); + serverArg, "--log=debug"); Map new_bin_state = collectState(bin); verifyEqual(new_bin_state, previous_bin_state); Map new_headers_state = collectState(headers); @@ -158,7 +160,7 @@ System.out.println("-----------------------------------------"); removeFrom(gensrc, "alfa/omega/AA.java"); compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false", "--log=debug"); + serverArg, "--log=debug"); Map new_bin_state = collectState(bin); verifyThatFilesHaveBeenRemoved(previous_bin_state, new_bin_state, "bin/alfa/omega/AA$1.class", @@ -185,7 +187,7 @@ "public final static int DEFINITION = 18; public void aint() { } private void foo() { } }"); compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false", "--log=debug"); + serverArg, "--log=debug"); Map new_bin_state = collectState(bin); verifyNewerFiles(previous_bin_state, new_bin_state, @@ -211,7 +213,7 @@ "private int b() { return A.DEFINITION; } }"); compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false", "--log=debug"); + serverArg, "--log=debug"); Map new_bin_state = collectState(bin); verifyNewerFiles(previous_bin_state, new_bin_state, "bin/beta/B.class", @@ -236,7 +238,7 @@ "@java.lang.annotation.Native final static int alfa = 42; }"); compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false", "--log=debug"); + serverArg, "--log=debug"); Map new_bin_state = collectState(bin); verifyNewerFiles(previous_bin_state, new_bin_state, "bin/beta/B.class", @@ -262,7 +264,7 @@ "@java.lang.annotation.Native final static int alfa = 43; }"); compile("gensrc", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false", "--log=debug"); + serverArg, "--log=debug"); Map new_bin_state = collectState(bin); verifyNewerFiles(previous_bin_state, new_bin_state, "bin/beta/B.class", @@ -299,7 +301,7 @@ "package beta; public class B { }"); compile("-x", "beta", "gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false"); + serverArg); Map new_bin_state = collectState(bin); verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, "bin/alfa/omega/A.class", @@ -310,7 +312,7 @@ System.out.println("----- Compile with exluded beta went well!"); delete(bin); compileExpectFailure("gensrc", "gensrc2", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false"); + serverArg); System.out.println("----- Compile without exluded beta failed, as expected! Good!"); delete(bin); @@ -341,7 +343,7 @@ compile("gensrc", "-x", "beta", "-sourcepath", "gensrc2", "-sourcepath", "gensrc3", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false"); + serverArg); System.out.println("The first compile went well!"); Map new_bin_state = collectState(bin); @@ -353,7 +355,7 @@ delete(bin); compileExpectFailure("gensrc", "-sourcepath", "gensrc2", "-sourcepath", "gensrc3", "-d", "bin", "-h", "headers", "-j", "1", - "--server:portfile=testserver,background=false"); + serverArg); System.out.println("----- Compile without exluded beta failed, as expected! Good!"); delete(bin); @@ -378,7 +380,7 @@ "package gamma; public class C { alfa.omega.A a; }"); compile("gensrc", "-d", "bin", "-h", "headers", "-j", "3", - "--server:portfile=testserver,background=false","--log=debug"); + serverArg,"--log=debug"); Map new_bin_state = collectState(bin); verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, "bin/alfa/omega/A.class", @@ -407,7 +409,7 @@ "package beta; public class B { }"); compile("-x", "beta", "-src", "gensrc", "-x", "alfa/omega", "-sourcepath", "gensrc", - "-d", "bin", "--server:portfile=testserver,background=false"); + "-d", "bin", serverArg); Map new_bin_state = collectState(bin); verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, @@ -431,7 +433,7 @@ "}"); compile("gensrc", "-d", "bin", "-j", "1", - "--server:portfile=testserver,background=false", "--log=debug"); + serverArg, "--log=debug"); Map previous_bin_state = collectState(bin); // Change pubapi of A, this should trigger a recompile of B. @@ -443,7 +445,7 @@ "}"); compile("gensrc", "-d", "bin", "-j", "1", - "--server:portfile=testserver,background=false", "--log=debug"); + serverArg, "--log=debug"); Map new_bin_state = collectState(bin); verifyNewerFiles(previous_bin_state, new_bin_state,