mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 02:38:59 +07:00
RefactoringUtil#ensureCodeBlock enhanced and used in Surround with try-catch
Fixes IDEA-178781 "Surround with try-catch" QuickFix for "Unhandled exception" in a field initializer Enables stream-to-loop in field initializer Fixes stream-to-loop in for initializer Disables stream-to-loop in for update
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// "Surround with try/catch" "true"
|
||||
import java.io.IOException;
|
||||
|
||||
class C {
|
||||
static final String S;
|
||||
|
||||
static {
|
||||
try {
|
||||
S = getString();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static String getString() throws IOException {
|
||||
if(Math.random() > 0.5) throw new IOException();
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user