mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-inspections] IDEA-340624 IJ-CR-152872 Optimize imports quick fixes do nothing
- more tests GitOrigin-RevId: 0b9e4bbfad412a65179ec94f936e866fdcb77572
This commit is contained in:
committed by
intellij-monorepo-bot
parent
dec3edb4cd
commit
c37ce75491
+4
@@ -0,0 +1,4 @@
|
||||
<warning descr="Unused import statement">import <error descr="Cannot resolve symbol 'foo'">foo</error>.bar.Baz<caret>;</warning>
|
||||
|
||||
class Foo {
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import <error descr="Cannot resolve symbol 'foo'">foo</error>.bar.Baz;
|
||||
<warning descr="Unused import statement">import java.util.List<caret>;</warning>
|
||||
|
||||
class Foo {
|
||||
void test(<error descr="Cannot resolve symbol 'Baz'">Baz</error> <warning descr="Parameter 'baz' is never used">baz</warning>) {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import foo.bar.Baz;<caret>
|
||||
|
||||
class Foo {
|
||||
void test(Baz baz) {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import <error descr="Cannot resolve symbol 'foo'">foo</error>.bar.Baz<caret>;
|
||||
|
||||
class Foo {
|
||||
void test(<error descr="Cannot resolve symbol 'Baz'">Baz</error> <warning descr="Parameter 'baz' is never used">baz</warning>) {}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import <error descr="Cannot resolve symbol 'foo'">foo</error>.bar.*;
|
||||
<warning descr="Unused import statement">import static java.util.Arrays.asList<caret>;</warning>
|
||||
|
||||
class Foo {
|
||||
void test(<error descr="Cannot resolve symbol 'Baz'">Baz</error> <warning descr="Parameter 'baz' is never used">baz</warning>) {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import <error descr="Cannot resolve symbol 'foo'">foo</error>.bar.*<caret>;
|
||||
|
||||
class Foo {
|
||||
void test(<error descr="Cannot resolve symbol 'Baz'">Baz</error> <warning descr="Parameter 'baz' is never used">baz</warning>) {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import foo.bar.*;<caret>
|
||||
|
||||
class Foo {
|
||||
void test(Baz baz) {}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
class Foo {
|
||||
}
|
||||
@@ -328,7 +328,7 @@ public class OptimizeImportsTest extends OptimizeImportsTestCase {
|
||||
package one;
|
||||
public interface Super {
|
||||
class Result {}
|
||||
|
||||
|
||||
Result x();
|
||||
}
|
||||
""");
|
||||
@@ -412,7 +412,7 @@ public class OptimizeImportsTest extends OptimizeImportsTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testNoStubPsiMismatchOnRecordInsideImportList() throws Exception {
|
||||
public void testNoStubPsiMismatchOnRecordInsideImportList() {
|
||||
myFixture.enableInspections(new UnusedImportInspection());
|
||||
myFixture.configureByText("a.java", """
|
||||
import java.ut<caret>il.List;
|
||||
@@ -446,14 +446,44 @@ public class OptimizeImportsTest extends OptimizeImportsTestCase {
|
||||
}
|
||||
|
||||
public void testOptimizeImportNotOnTheFly() {
|
||||
checkOptimizeImport();
|
||||
}
|
||||
|
||||
public void testOptimizeImportNotOnTheFlyInvalidImport() {
|
||||
checkOptimizeImport();
|
||||
}
|
||||
|
||||
public void testOptimizeImportNotOnTheFlyInvalidImport2() {
|
||||
checkOptimizeImport();
|
||||
}
|
||||
|
||||
public void testOptimizeImportNotOnTheFlyInvalidImportNoIntention() {
|
||||
checkOptimizeImportNoIntention();
|
||||
}
|
||||
|
||||
public void testOptimizeImportNotOnTheFlyInvalidImportOnDemand() {
|
||||
checkOptimizeImport();
|
||||
}
|
||||
|
||||
public void testOptimizeImportNotOnTheFlyInvalidImportOnDemandNoIntention() {
|
||||
checkOptimizeImportNoIntention();
|
||||
}
|
||||
|
||||
private void checkOptimizeImport() {
|
||||
myFixture.enableInspections(new MissortedImportsInspection(), new UnusedImportInspection());
|
||||
myFixture.testHighlighting(getTestName(false) + ".java");
|
||||
IntentionAction intention = myFixture.findSingleIntention(QuickFixBundle.message("optimize.imports.fix"));
|
||||
assertNotNull(intention);
|
||||
myFixture.launchAction(intention);
|
||||
myFixture.checkResultByFile(getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
private void checkOptimizeImportNoIntention() {
|
||||
myFixture.enableInspections(new MissortedImportsInspection(), new UnusedImportInspection());
|
||||
myFixture.testHighlighting(getTestName(false) + ".java");
|
||||
IntentionAction intention = myFixture.getAvailableIntention(QuickFixBundle.message("optimize.imports.fix"));
|
||||
assertNull(intention);
|
||||
}
|
||||
|
||||
public void testRemovingAllUnusedImports() throws Exception {
|
||||
myFixture.enableInspections(new UnusedImportInspection());
|
||||
myFixture.configureByText("a.java", """
|
||||
@@ -669,7 +699,7 @@ public class OptimizeImportsTest extends OptimizeImportsTestCase {
|
||||
package one;
|
||||
public interface Super {
|
||||
class List {}
|
||||
|
||||
|
||||
List x();
|
||||
}
|
||||
""");
|
||||
|
||||
Reference in New Issue
Block a user