New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK-8267204: Expose access to underlying streams in Reporter #4077
JDK-8267204: Expose access to underlying streams in Reporter #4077
Conversation
👋 Welcome back jjg! A progress list of the required criteria for merging this PR into |
@jonathan-gibbons The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
I have two high-level questions: (1) Why would Doclet API expose standard streams given that it already has |
|
I can see that Reporter does not mention streams. But should it mention them given that Reporter is a higher-level abstraction? If a particular mapping between diagnostic kinds and standard streams is desired can it be achieved by configuring Reporter out of band? What would be the best code locations to look at to get familiar with how javac works with standard streams, diagnostic output, and the like? Don't get me wrong, by asking these questions I'm trying to better understand the intent and the design. |
Look at Before there was
In javac then, and still in javadoc today, it was hampered by the use of public single-stream constructors in the Part of the realization of the solution came in the JDK 9 timeframe, when someone (I won't name names) came up with the simple rule that "expected" output (like command-line help) should go to Before: So, depending on why you wanted a stream, you could get the right one. At one point, IIRC, javadoc allowed you to specify 3 streams (!!) for error, warning, notes, but generally, we settled on 1 or 2 streams, representing I'm looking to eventually align Note, I use terms like |
* The implementation provided by the `javadoc` tool to | ||
* {@link Doclet#init(Locale, Reporter) initialize doclets} | ||
* always returns a non-{@code null} value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean {@link Doclet#run(DocletEnvironment) run doclets}
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I guess I did. Good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update copyright years.
* The implementation provided by the `javadoc` tool to | ||
* {@link Doclet#init(Locale, Reporter) initialize doclets} | ||
* always returns a non-{@code null} value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as two preceding comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as preceding response!
* | ||
* @implSpec | ||
* This implementation returns {@code null}. | ||
* The implementation provided by the `javadoc` tool to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use {@code javadoc}
or just javadoc instead of `javadoc` (back ticks).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
This PR has been superseded by #4216. |
Please review a relatively simple update to expose the 1 or 2 streams available within javadoc for writing expected or diagnostic output.
The change at this time is just to expose the streams; followup work may change how we use them.
There are two points of note:
JavadocTester
is extended to provided access to the javadoc entry point used by the launcher. This is simpler than exec-ing the tool to invoke the entry point, and allows us to use the existing code to capture and analyze the output.Messager
is deferred, to allowMessager
to use the values ofSystem.out
andSystem.err
at the time that javadoc is started, instead of when the class was loaded. This is part of the problems described separately in JDK-8267203, but which needs to be addressed here as part of this work.Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4077/head:pull/4077
$ git checkout pull/4077
Update a local copy of the PR:
$ git checkout pull/4077
$ git pull https://git.openjdk.java.net/jdk pull/4077/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4077
View PR using the GUI difftool:
$ git pr show -t 4077
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4077.diff