Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.

Commit 354c904

Browse files
committed
8273452: DocTrees.getDocCommentTree should be specified as idempotent
Reviewed-by: jjg
1 parent 06b4d49 commit 354c904

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/jdk.compiler/share/classes/com/sun/source/util/DocTrees.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ public static DocTrees instance(ProcessingEnvironment env) {
8787
/**
8888
* Returns the doc comment tree, if any, for the Tree node identified by a given TreePath.
8989
* Returns {@code null} if no doc comment was found.
90+
*
91+
* @implNote The default implementation of this method returns the same
92+
* {@code DocCommentTree} instance for repeated invocations
93+
* with the same argument.
94+
*
9095
* @param path the path for the tree node
9196
* @return the doc comment tree
9297
*/
@@ -95,6 +100,11 @@ public static DocTrees instance(ProcessingEnvironment env) {
95100
/**
96101
* Returns the doc comment tree of the given element.
97102
* Returns {@code null} if no doc comment was found.
103+
*
104+
* @implNote The default implementation of this method returns the same
105+
* {@code DocCommentTree} instance for repeated invocations
106+
* with the same argument.
107+
*
98108
* @param e an element whose documentation is required
99109
* @return the doc comment tree
100110
*
@@ -109,6 +119,9 @@ public static DocTrees instance(ProcessingEnvironment env) {
109119
* Returns {@code null} if no doc comment was found.
110120
* Future releases may support additional file types.
111121
*
122+
* @implNote The default implementation of this method returns a
123+
* new {@code DocCommentTree} instance for each invocation.
124+
*
112125
* @param fileObject the content container
113126
* @return the doc comment tree
114127
* @since 9
@@ -123,6 +136,9 @@ public static DocTrees instance(ProcessingEnvironment env) {
123136
* Returns {@code null} if no doc comment was found.
124137
* Future releases may support additional file types.
125138
*
139+
* @implNote The default implementation of this method returns a
140+
* new {@code DocCommentTree} instance for each invocation.
141+
*
126142
* @param e an element whose path is used as a reference
127143
* @param relativePath the relative path from the Element
128144
* @return the doc comment tree

0 commit comments

Comments
 (0)