mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
IDEA-103114 ("Surround with try-with-resources" fixed to not lose last declaration element)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.FileChannel;
|
||||
|
||||
class C {
|
||||
void m(File file) throws IOException {
|
||||
<caret>FileInputStream stream = new FileInputStream(file);
|
||||
stream.getFD();
|
||||
FileChannel channel1 = stream.getChannel(), channel2 = stream.getChannel();
|
||||
channel1.close();
|
||||
channel2.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.FileChannel;
|
||||
|
||||
class C {
|
||||
void m(File file) throws IOException {
|
||||
FileChannel channel1;
|
||||
FileChannel channel2;
|
||||
try (FileInputStream stream = new FileInputStream(file)) {
|
||||
stream.getFD();
|
||||
channel1 = stream.getChannel();
|
||||
channel2 = stream.getChannel();
|
||||
}
|
||||
channel1.close();
|
||||
channel2.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user