-
Notifications
You must be signed in to change notification settings - Fork 169
8274893: Update java.desktop classes to use try-with-resources #686
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
base: master
Are you sure you want to change the base?
Conversation
Backport-of: 70c6df6be431fe11c5441986ed04040f9ec3b750
👋 Welcome back tpushkin! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
This backport pull request has now been updated with issue from the original commit. |
Webrevs
|
@@ -91,8 +88,7 @@ public Soundbank getSoundbank(URL url) | |||
"META-INF/services/javax.sound.midi.Soundbank"); | |||
if (stream == null) | |||
return null; | |||
try | |||
{ | |||
try { |
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.
There should be try-with-resources
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.
There was in the original change but in this JDK try-with-resources on an existing variable is not possible (no JDK-7196163), so I fell back to try-finally. This is not the only place where I've done this, see 832c3c3.
Alternatives are to either create a copy variable for try-with-resources (which also must be used inside it to prevent a compiler warning) or move all interactions with the variable inside try-with-resources — both diverge code from the original change and the pre-existing code so I decided against them.
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.
Shouldn't we revert formatting changes here, then?
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.
I wasn't sure what would be the best here: keeping the existing formatting to changing it to be closer to the backported change — and went with the latter.
Since I don't really have a strong preference, reverted to the old one now as you suggest.
I believe test failures are not related |
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
"ISO-8859-1"
string is used instead ofISO_8859_1
enum constantStringBuffer
is used instead ofStringBuilder
jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
"ISO-8859-1"
string is used instead ofISO_8859_1
enum constantjdk/src/share/classes/com/sun/media/sound/StandardMidiFileWriter.java
Objects.requireNonNull(...)
in this versionjdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java
sun.font
package are still needed in this filejdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java
IOUtils.readAllBytes(InputStream is)
instead of the missingInputStream.readAllBytes()
Testing: GitHub CI,
jdk_imageio
test group locally (headless linux/arm64)Progress
Issue
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
Link to Webrev Comment