mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
Revert "IJ-CR-134196 [java-highlighting]IDEA-352727 Incomplete model with lombok"
This reverts commit 537fa533381ca5db2cba1e19cae3ca402c31f8e6. GitOrigin-RevId: 1b2fbc0e6d184e7317cbac02f67458c2f663ccd8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
41c184cc13
commit
3183b72cb2
@@ -199,12 +199,7 @@ final class IncompleteModelUtil {
|
||||
PsiImportList list = file.getImportList();
|
||||
List<PsiImportStatementBase> imports = new ArrayList<>();
|
||||
if (list != null) {
|
||||
boolean incompleteModel = isIncompleteModel(file);
|
||||
for (PsiImportStatementBase statement : list.getAllImportStatements()) {
|
||||
if (incompleteModel && canBeUsedImportImplicitly(statement)) {
|
||||
imports.add(statement);
|
||||
continue;
|
||||
}
|
||||
if (statement instanceof PsiImportStaticStatement staticImport && staticImport.resolveTargetClass() != null) continue;
|
||||
if (!statement.isOnDemand()) {
|
||||
PsiJavaCodeReferenceElement reference = statement.getImportReference();
|
||||
@@ -285,9 +280,4 @@ final class IncompleteModelUtil {
|
||||
return CachedValuesManager.getProjectPsiDependentCache(targetClass,
|
||||
psiClass -> PsiAugmentProvider.canBeAugmentedForIncompleteMode(psiClass));
|
||||
}
|
||||
|
||||
static boolean canBeUsedImportImplicitly(@Nullable PsiImportStatementBase importStatementBase) {
|
||||
if (importStatementBase == null) return false;
|
||||
return PsiAugmentProvider.canBeUsedImportForIncompleteMode(importStatementBase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,18 +279,6 @@ public abstract class PsiAugmentProvider implements PossiblyDumbAware {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the given PsiImportStatementBase might be used.
|
||||
* This method is usually called in incomplete mode.
|
||||
*
|
||||
* @param psiImport the PsiImportStatementBase to be checked
|
||||
* @return true if the import might be used, false otherwise
|
||||
*/
|
||||
protected boolean mightBeUsedImportForIncompleteMode(@NotNull PsiImportStatementBase psiImport) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given PsiClass might be augmented.
|
||||
* This method is usually called in incomplete mode.
|
||||
@@ -308,14 +296,4 @@ public abstract class PsiAugmentProvider implements PossiblyDumbAware {
|
||||
});
|
||||
return result.get();
|
||||
}
|
||||
|
||||
public static boolean canBeUsedImportForIncompleteMode(@NotNull PsiImportStatementBase psiImport) {
|
||||
Ref<Boolean> result = Ref.create();
|
||||
forEach(psiImport.getProject(), provider -> {
|
||||
boolean augmentedForIncompleteMode = provider.mightBeUsedImportForIncompleteMode(psiImport);
|
||||
result.set(augmentedForIncompleteMode);
|
||||
return !augmentedForIncompleteMode;
|
||||
});
|
||||
return result.get();
|
||||
}
|
||||
}
|
||||
@@ -215,16 +215,11 @@ public final class LombokAugmentProvider extends PsiAugmentProvider implements P
|
||||
ContainerUtil.exists(extensibleClass.getOwnFields(), field -> hasAnyLombokAnnotation(field.getAnnotations())) ||
|
||||
(file.getImportList() != null &&
|
||||
ContainerUtil.exists(file.getImportList().getAllImportStatements(), statement -> {
|
||||
return mightBeUsedImportForIncompleteMode(statement);
|
||||
PsiJavaCodeReferenceElement reference = statement.getImportReference();
|
||||
return reference != null && reference.getText().startsWith("lombok");
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean mightBeUsedImportForIncompleteMode(@NotNull PsiImportStatementBase psiImport) {
|
||||
if (psiImport instanceof PsiImportStaticStatement) return false;
|
||||
PsiJavaCodeReferenceElement reference = psiImport.getImportReference();
|
||||
return reference != null && reference.getText().startsWith("lombok");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given PsiModifierListOwner has any Lombok annotation.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.intellij.java.lomboktest;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.codeInspection.unusedImport.UnusedImportInspection;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.project.IncompleteDependenciesService;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
@@ -23,7 +22,6 @@ public class LombokIncompleteModeHighlightingTest extends LightDaemonAnalyzerTes
|
||||
}
|
||||
|
||||
private void doTest(String fileName) {
|
||||
enableInspectionTools(new UnusedImportInspection());
|
||||
IncompleteDependenciesService service = getProject().getService(IncompleteDependenciesService.class);
|
||||
try (var ignored = asAutoCloseable(WriteAction.compute(() -> service.enterIncompleteState()))) {
|
||||
doTest("/plugins/lombok/testData/highlightingIncompleteMode/" + fileName, true, true);
|
||||
|
||||
Reference in New Issue
Block a user