Skip to content
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

8258444: Clean up specifications of java.io.Reader.read(char[],int,int) in subclass overrides #2680

Closed
wants to merge 3 commits into from

Conversation

bplb
Copy link
Member

@bplb bplb commented Feb 22, 2021


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8258444: Clean up specifications of java.io.Reader.read(char[],int,int) in subclass overrides

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2680/head:pull/2680
$ git checkout pull/2680

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 22, 2021

👋 Welcome back bpb! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@bplb
Copy link
Member Author

bplb commented Feb 22, 2021

This change proposes to use {@inheritdoc} to improve consistency of the specification of Reader.read(char[],in,in) in Reader and its subclasses. In the course of this, some bounds checks are replaced with Objects.checkFromIndexSize().

@openjdk
Copy link

openjdk bot commented Feb 22, 2021

@bplb The following label will be automatically applied to this pull request:

  • core-libs

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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Feb 22, 2021
@bplb
Copy link
Member Author

bplb commented Feb 22, 2021

/csr

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Feb 22, 2021
@openjdk
Copy link

openjdk bot commented Feb 22, 2021

@bplb has indicated that a compatibility and specification (CSR) request is needed for this pull request.
@bplb please create a CSR request and add link to it in JDK-8258444. This pull request cannot be integrated until the CSR request is approved.

@openjdk openjdk bot added rfr Pull request is ready for review and removed rfr Pull request is ready for review labels Feb 22, 2021
@mlbridge
Copy link

mlbridge bot commented Feb 22, 2021

Webrevs

*/
public int read(char cbuf[], int offset, int length) throws IOException {
return sd.read(cbuf, offset, length);
public int read(char[] cbuf, int off, int len) throws IOException {
Copy link
Contributor

@AlanBateman AlanBateman Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IOOBE is unchecked, are you sure it gets inherited into the sub-class here?

Copy link
Contributor

@AlanBateman AlanBateman Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The long standard behavior is that javadoc doesn't copy the throws of unchecked exceptions, instead we've had to declare the throws and use inheritDoc. I assume you'll need to do that here.

Copy link
Member Author

@bplb bplb Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not and there is a javadoc issue already on file about this.

@bplb
Copy link
Member Author

bplb commented Feb 23, 2021

Copy link
Contributor

@RogerRiggs RogerRiggs left a comment

Nice cleanup.

*
* @param cbuf Destination buffer
* @param off Offset at which to start writing characters
* @param len Maximum number of characters to read
*
* @return The number of characters read, or -1 if the end of the
* stream has been reached
*
* @throws IOException If an I/O error occurs
* @throws IndexOutOfBoundsException {@inheritDoc}
* {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
public int read(char[] cbuf, int off, int len) throws IOException {
Copy link
Member

@dfuch dfuch Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you add

 * @throws IndexOutOfBoundException {@inheritDoc}
 * @throws IOException {@inheritDoc}

here as well? IIRC the global {@inheritdoc} will not add them.

Copy link
Member Author

@bplb bplb Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. In this case the specification no longer appears in the main method summary but rather under Methods declared in class java.io.FilterReader which has a full spec.

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Feb 25, 2021
@openjdk
Copy link

openjdk bot commented Feb 25, 2021

@bplb This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8258444: Clean up specifications of java.io.Reader.read(char[],int,int) in subclass overrides

Reviewed-by: alanb, rriggs

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 59 new commits pushed to the master branch:

  • a50725d: 8254001: [Metrics] Enhance parsing of cgroup interface files for version detection
  • 6549212: 8262315: missing ';' in generated entities
  • d70fd7b: 8258855: Two tests sun/security/krb5/auto/ReplayCacheTestProc.java and ReplayCacheTestProcWithMD5.java failed on OL8.3
  • 9d9ad96: 8261919: java/util/Locale/LocaleProvidersRun.java failed with "RuntimeException: Expected log was not emitted. LogRecord: null"
  • 2c99bad: 8261920: [AIX] jshell command throws java.io.IOError on non English locales
  • 8c07063: 8262259: Remove unused variable in MethodLiveness::BasicBlock::compute_gen_kill_single
  • 0d2dbd2: 8262027: Improve how HttpConnection detects a closed channel when taking/returning a connection to the pool
  • 382e38d: 8256438: AArch64: Implement match rules with ROR shift register value
  • fac37bf: 8262269: javadoc test TestGeneratedClasses.java fails on Windows
  • 3e13b66: 8262157: LingeredApp.startAppExactJvmOpts does not print app output when launching fails
  • ... and 49 more: https://git.openjdk.java.net/jdk/compare/7ffa1481c2a9d41bd06db484bd01b3e48d55810f...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 25, 2021
@bplb
Copy link
Member Author

bplb commented Feb 25, 2021

@AlanBateman, @dfuch, @RogerRiggs thanks for the reviews here and @jddarcy for approving the CSR!

/integrate

@openjdk openjdk bot closed this Feb 25, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 25, 2021
@openjdk
Copy link

openjdk bot commented Feb 25, 2021

@bplb Since your change was applied there have been 70 commits pushed to the master branch:

  • 7d4f60b: 8260403: javap should be more robust in the face of invalid class files
  • 674be87: 8261203: Incorrectly escaped javadoc html with type annotations
  • 2eca17d: 8261457: test/langtools/tools/javac/T8187978 can fail if ArrayList class is modified
  • c54724d: 8257234: Add gz option to SA jmap to write a gzipped heap dump
  • aa35b42: 8261131: jcmd jmap dump should not accept gz option with no value
  • ebdc80e: 8252883: AccessDeniedException caused by delayed file deletion on Windows
  • f79c626: 8262296: Fix remaining doclint warnings in jdk.httpserver
  • ea48a0b: 8262163: Extend settings printout in jcmd VM.metaspace
  • a83e802: 8262299: C2 compilation fails with "modified node was not processed by IGVN.transform_old()"
  • 0f8be6e: 8261868: Reduce inclusion of metaspace.hpp
  • ... and 60 more: https://git.openjdk.java.net/jdk/compare/7ffa1481c2a9d41bd06db484bd01b3e48d55810f...master

Your commit was automatically rebased without conflicts.

Pushed as commit 5a9b701.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@bplb bplb deleted the 8258444-Reader-read branch Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
4 participants