Incorrect "AutoCloseable used without 'try'-with-resources" warning for append call?

Answered

Incorrect "AutoCloseable used without 'try'-with-resources" warning for append call for following code? (IU-143.2287, Intellij IDEA Ultimate 15.0.4 (lame you can't copy this from the About screen too), JDK 8 on OS X Mavericks 10.9.5).

static void foo() throws IOException {
try(BufferedWriter wr = new BufferedWriter(new FileWriter("foo.txt"))) {
wr.append("bar"); // <- produces warning
}
}
9 comments

Just noticed if i check "Ignore AutoCloseable instances returned from method calls" it goes away, but it still seems spurious to me when that's unchecked.

0

> lame you can't copy this from the About screen too

Actually, you can: https://youtrack.jetbrains.com/issue/IDEA-70737.

0

I'll be damned - thank you; it's not at all clear UI-wise.

0

Would be cool if you could just select the text; that applies elsewhere too like in the preferences menu when i want to copy the preference name for a bug report.

0

Selecting text in About dialog is not an easy task to implement, see https://youtrack.jetbrains.com/issue/IDEA-152558 why. IDEA 16 already displays a hint that you can copy the info from About dialog.

0

I sympathize with reporter's (https://youtrack.jetbrains.com/issue/IDEA-152558 ) desire to copy as much text as possible but am by no means a UI expert or product manager and appreciate the complexity - value tradeoffs - thanks for the feedback!

Any ideas on my real question would be cool :)

0

> Any ideas on my real question would be cool :)

I've asked the responsible developer to have a look.

0

Please sign in to leave a comment.