mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java inspection: In batch mode avoid indicating the problem twice with "Split Try Statement with Multiple Resources" inspection, test added (IDEA-157727)
This commit is contained in:
+1
-1
@@ -112,7 +112,7 @@ public class SplitTryWithMultipleResourcesInspection extends BaseInspection {
|
||||
@Override
|
||||
public void visitKeyword(PsiKeyword keyword) {
|
||||
super.visitKeyword(keyword);
|
||||
if (isOnTheFly() && isAcceptable(keyword)) {
|
||||
if (isOnTheFly() && keyword.getTokenType() == JavaTokenType.TRY_KEYWORD && isAcceptable(keyword)) {
|
||||
registerError(keyword);
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import java.io.*;
|
||||
class AtFinalKeyword {
|
||||
void foo(File file1, File file2) throws IOException {
|
||||
try (final FileInputStream in = new FileInputStream(file1)) {
|
||||
try (FileOutputStream out = new FileOutputStream(file2)) {
|
||||
System.out.println(in + ", " + out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import java.io.*;
|
||||
class AtFinalKeyword {
|
||||
void foo(File file1, File file2) throws IOException {
|
||||
try (f<caret>inal FileInputStream in = new FileInputStream(file1); FileOutputStream out = new FileOutputStream(file2)) {
|
||||
System.out.println(in + ", " + out);
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
@@ -47,6 +47,10 @@ public class SplitTryWithMultipleResourcesFixTest extends IGQuickFixesTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAtFinalKeyword() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testAtCodeBlock() {
|
||||
assertQuickfixNotAvailable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user