mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
[java] exception highlighting in try-with-resources (IDEA-142066)
This commit is contained in:
+27
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -223,6 +223,32 @@ public class HighlightUsagesHandlerTest extends LightCodeInsightFixtureTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public void testExceptionsInTryWithResources() {
|
||||
myFixture.configureByText 'A.java', '''
|
||||
import java.io.*;
|
||||
class A {
|
||||
void test() throws IOException {
|
||||
try (InputStream in = new FileInputStream("file.name")) { }
|
||||
<caret>catch (FileNotFoundException e) { throw new FileNotFoundException("no highlighting here"); }
|
||||
}
|
||||
}'''.stripIndent()
|
||||
ctrlShiftF7()
|
||||
assertRangeText 'FileInputStream', 'catch'
|
||||
}
|
||||
|
||||
public void testExceptionsResourceCloser() {
|
||||
myFixture.configureByText 'A.java', '''
|
||||
import java.io.*;
|
||||
class A {
|
||||
void test() {
|
||||
try (InputStream in = new FileInputStream("file.name")) { }
|
||||
<caret>catch (IOException e) { }
|
||||
}
|
||||
}'''.stripIndent()
|
||||
ctrlShiftF7()
|
||||
assertRangeText 'in', 'FileInputStream', 'FileInputStream', 'catch'
|
||||
}
|
||||
|
||||
private void configureFile() {
|
||||
def testName = getTestName(false)
|
||||
def file = myFixture.copyFileToProject "/codeInsight/highlightUsagesHandler/${testName}.java", "${testName}.java"
|
||||
|
||||
Reference in New Issue
Block a user