mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[java-inspections] IDEA-356672 Support JEP 477. Incorrect intentions and actions with implicit imports
- improve ImplicitImportChecker to support modules - check conflict for modules - new method `PsiImportModuleStatement.findImportedPackage` is added GitOrigin-RevId: 0d0f61916bdda17b8c9d9146a13aa8d6d0876bb1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b9ddf4e737
commit
8f3e75e7db
@@ -0,0 +1,70 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.fixes.style;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.LightJavaInspectionTestCase;
|
||||
import com.siyeh.ig.style.UnnecessaryFullyQualifiedNameInspection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class UnnecessaryFullyQualifiedNameWithImplicitImportsFixTest extends LightJavaInspectionTestCase {
|
||||
@Override
|
||||
protected @Nullable InspectionProfileEntry getInspection() {
|
||||
return new UnnecessaryFullyQualifiedNameInspection();
|
||||
}
|
||||
|
||||
public void testSimpleImportWIthModule() {
|
||||
doTest();
|
||||
checkQuickFix(InspectionGadgetsBundle.message("unnecessary.fully.qualified.name.remove.quickfix"));
|
||||
}
|
||||
|
||||
public void testSimpleImportWIthModuleImplicitClasses() {
|
||||
doTest();
|
||||
checkQuickFix(InspectionGadgetsBundle.message("unnecessary.fully.qualified.name.remove.quickfix"));
|
||||
}
|
||||
|
||||
public void testSimpleImportJavaLangWithImplicitClass() {
|
||||
doTest();
|
||||
checkQuickFix(InspectionGadgetsBundle.message("unnecessary.fully.qualified.name.remove.quickfix"));
|
||||
}
|
||||
|
||||
public void testSimpleImportJavaLangWithImplicitClassWithConflict() {
|
||||
myFixture.addClass("""
|
||||
package p;
|
||||
public class String {}""");
|
||||
doTest();
|
||||
assertQuickFixNotAvailable(InspectionGadgetsBundle.message("unnecessary.fully.qualified.name.remove.quickfix"));
|
||||
}
|
||||
|
||||
public void testSimpleImportWithModuleWithConflict() {
|
||||
myFixture.addClass("""
|
||||
package p;
|
||||
public class Date {}""");
|
||||
doTest();
|
||||
assertQuickFixNotAvailable(InspectionGadgetsBundle.message("unnecessary.fully.qualified.name.remove.quickfix"));
|
||||
}
|
||||
|
||||
public void testSimpleImportWithModuleWithConflictWIthImplicitClass() {
|
||||
myFixture.addClass("""
|
||||
package p;
|
||||
public class Date {}""");
|
||||
doTest();
|
||||
assertQuickFixNotAvailable(InspectionGadgetsBundle.message("unnecessary.fully.qualified.name.remove.quickfix"));
|
||||
}
|
||||
|
||||
public void testSimpleImportWithoutModuleWithoutConflict() {
|
||||
myFixture.addClass("""
|
||||
package p;
|
||||
public class Date {}""");
|
||||
doTest();
|
||||
checkQuickFix(InspectionGadgetsBundle.message("unnecessary.fully.qualified.name.remove.quickfix"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected @NotNull LightProjectDescriptor getProjectDescriptor() {
|
||||
return JAVA_23;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user