- * & 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends DocTree> 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 extends AnnotationTree> 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 extends ExpressionTree> 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 extends StatementTree> 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 extends StatementTree> 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 extends TypeParameterTree> 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 extends Tree> getImplementsClause(); + + /** + * Returns the members declared in this type declaration. + * @return the members + */ List extends Tree> 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 extends AnnotationTree> 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 extends ImportTree> 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 extends Tree> 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 extends Tree> 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 extends StatementTree> 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 extends ExpressionStatementTree> 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 extends Tree> 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: + *
@@ -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 extends Element> 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 extends CaseTree> 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 extends Tree> 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 @@ * * @paramresult 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 extends CatchTree> 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 extends Tree> 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 extends Tree> 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 extends Tree> 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* + * @param{ /** - * 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 extends DocTree> 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 extends Element> 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 extends JavaFileObject> 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 extends Tree> 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 extends DocTree> 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 extends Tree> 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 @@ * } *
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 extends Tree> 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; i emptyList(), + 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 extends JavaFileObject> 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 extends JavaFileObject> 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 extends File> files); /** - * Gets file objects representing the given files. + * Returns file objects representing the given files. * Convenience method equivalent to: * * @@ -183,7 +183,7 @@ Iterable extends JavaFileObject> 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 @@ Iterablenames); /** - * 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 -