8274893: Update java.desktop classes to use try-with-resources
Backport of JDK-8274893 for parity with Oracle's JDK 8u461.
The first commit is a cherry-pick of the backport to JDK 11 with conflicts unresolved, the second resolves the conflicts, the rest resolve issues uncaught by git.
Resolved:
-
jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java- Missing JDK-8271456:
"ISO-8859-1"string is used instead ofISO_8859_1enum constant - Missing JDK-8041679:
StringBufferis used instead ofStringBuilder
- Missing JDK-8271456:
-
jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java- Missing JDK-8271456:
"ISO-8859-1"string is used instead ofISO_8859_1enum constant
- Missing JDK-8271456:
-
jdk/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java- Missing JDK-8143909: no
Objects.requireNonNull(...)in this version
- Missing JDK-8143909: no
-
jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java- Missing JDK-8054834: imports from
sun.fontpackage are still needed in this file
- Missing JDK-8054834: imports from
-
jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java- Missing JDK-8080835: use
IOUtils.readAllBytes(InputStream is)instead of the missingInputStream.readAllBytes()
- Missing JDK-8080835: use
- Missing JDK-7196163: try-with-resources cannot be used with pre-existing variables — fell back to try-finally in such cases
Testing: GitHub CI, jdk_imageio test group locally (headless linux/arm64)
Progress
- [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [ ] JDK-8274893 needs maintainer approval
- [x] Commit message must refer to an issue
Issue
- JDK-8274893: Update java.desktop classes to use try-with-resources (Enhancement - P5)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk8u-dev.git pull/686/head:pull/686
$ git checkout pull/686
Update a local copy of the PR:
$ git checkout pull/686
$ git pull https://git.openjdk.org/jdk8u-dev.git pull/686/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 686
View PR using the GUI difftool:
$ git pr show -t 686
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk8u-dev/pull/686.diff
Using Webrev
:wave: Welcome back tpushkin! 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.
❗ This change is not yet ready to be integrated. See the Progress checklist in the description for automated requirements.
This backport pull request has now been updated with issue from the original commit.
I believe test failures are not related
@TimPushkin This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
/touch
@TimPushkin The pull request is being re-evaluated and the inactivity timeout has been reset.
@TimPushkin This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
/touch
@TimPushkin The pull request is being re-evaluated and the inactivity timeout has been reset.
@TimPushkin This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!
/touch
@TimPushkin The pull request is being re-evaluated and the inactivity timeout has been reset.