mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
Revert "[java-highlighting] IDEA-352727 Incomplete model with lombok"
This reverts commit ea0f6f9c GitOrigin-RevId: c9f49f0bcf193ce593a6b9fbea9600d0f507fa9d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
08dd233a7c
commit
f1642ef3bb
@@ -8,7 +8,6 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.augment.PsiAugmentProvider;
|
||||
import com.intellij.psi.augment.PsiExtensionMethod;
|
||||
import com.intellij.psi.impl.source.PsiExtensibleClass;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.siyeh.ig.psiutils.InitializationUtils;
|
||||
import de.plushnikov.intellij.plugin.LombokClassNames;
|
||||
import de.plushnikov.intellij.plugin.processor.LombokProcessorManager;
|
||||
@@ -202,43 +201,4 @@ public final class LombokAugmentProvider extends PsiAugmentProvider implements P
|
||||
}
|
||||
return ExtensionMethodsHelper.getExtensionMethods(aClass, nameHint, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean mightBeAugmentedForIncompleteMode(@NotNull PsiClass psiClass) {
|
||||
if(!(psiClass instanceof PsiExtensibleClass extensibleClass)) {
|
||||
return false;
|
||||
}
|
||||
if(!(extensibleClass.getContainingFile() instanceof PsiJavaFile file)) {
|
||||
return false;
|
||||
}
|
||||
return hasAnyLombokAnnotation(extensibleClass.getAnnotations()) ||
|
||||
ContainerUtil.exists(extensibleClass.getOwnFields(), field -> hasAnyLombokAnnotation(field.getAnnotations())) ||
|
||||
(file.getImportList() != null &&
|
||||
ContainerUtil.exists(file.getImportList().getAllImportStatements(), statement -> {
|
||||
PsiJavaCodeReferenceElement reference = statement.getImportReference();
|
||||
return reference != null && reference.getText().startsWith("lombok");
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the given PsiModifierListOwner has any Lombok annotation.
|
||||
* It is used only for incomplete mode.
|
||||
*
|
||||
* @param annotations The annotations to check for Lombok annotations.
|
||||
* @return true if the modifierListOwner has any Lombok annotation, otherwise false.
|
||||
*/
|
||||
|
||||
private static boolean hasAnyLombokAnnotation(PsiAnnotation @NotNull [] annotations) {
|
||||
return ContainerUtil.exists(annotations, annotation -> {
|
||||
if (annotation == null) {
|
||||
return false;
|
||||
}
|
||||
String qualifiedName = annotation.getQualifiedName();
|
||||
if (qualifiedName == null) {
|
||||
return false;
|
||||
}
|
||||
return qualifiedName.startsWith("lombok.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.intellij.java.lomboktest;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.project.IncompleteDependenciesService;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.intellij.openapi.project.IncompleteDependenciesServiceKt.asAutoCloseable;
|
||||
|
||||
public class LombokIncompleteModeHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
|
||||
public void testLombokBasics() { doTest(); }
|
||||
|
||||
public void testLombokBasicsWithExplicitImport() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
doTest(getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
private void doTest(String fileName) {
|
||||
IncompleteDependenciesService service = getProject().getService(IncompleteDependenciesService.class);
|
||||
try (var ignored = asAutoCloseable(WriteAction.compute(() -> service.enterIncompleteState()))) {
|
||||
doTest("/plugins/lombok/testData/highlightingIncompleteMode/" + fileName, true, true);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NonNls @NotNull String getTestDataPath() {
|
||||
return PlatformTestUtil.getCommunityPath();
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import <info descr="Not resolved until the project is fully loaded">lombok</info>.*<EOLError descr="';' expected"></EOLError>
|
||||
|
||||
public final class LombokBasics {
|
||||
public static void main(String[] args) {
|
||||
UserDao userDao = UserDao.<info descr="Not resolved until the project is fully loaded">builder</info>()
|
||||
.<info descr="Not resolved until the project is fully loaded">info</info>("1")
|
||||
.<info descr="Not resolved until the project is fully loaded">build</info>();
|
||||
String name = userDao.<info descr="Not resolved until the project is fully loaded">name</info>();
|
||||
UserChain userChain = new UserChain();
|
||||
String name1 = userChain.<info descr="Not resolved until the project is fully loaded">getName</info>();
|
||||
}
|
||||
}
|
||||
|
||||
@<info descr="Not resolved until the project is fully loaded">Getter</info>
|
||||
@<info descr="Not resolved until the project is fully loaded">SuperBuilder</info>
|
||||
class UserDao extends UserId {
|
||||
<info descr="Not resolved until the project is fully loaded">private final String name;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String surname;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String email;</info>
|
||||
}
|
||||
|
||||
@<info descr="Not resolved until the project is fully loaded">SuperBuilder</info>
|
||||
abstract class UserId {
|
||||
<info descr="Not resolved until the project is fully loaded">private final long id;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String info;</info>
|
||||
}
|
||||
|
||||
class UserChain {
|
||||
@<info descr="Not resolved until the project is fully loaded">Getter</info>
|
||||
@<info descr="Not resolved until the project is fully loaded">Setter</info>
|
||||
private String name;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import <info descr="Not resolved until the project is fully loaded">lombok</info>.<info descr="Not resolved until the project is fully loaded">Getter</info>;
|
||||
import <info descr="Not resolved until the project is fully loaded">lombok</info>.<info descr="Not resolved until the project is fully loaded">Setter</info>;
|
||||
import <info descr="Not resolved until the project is fully loaded">lombok</info>.<info descr="Not resolved until the project is fully loaded">SuperBuilder</info>;
|
||||
|
||||
public final class LombokBasicsWithExplicitImport {
|
||||
public static void main(String[] args) {
|
||||
UserDao userDao = UserDao.<info descr="Not resolved until the project is fully loaded">builder</info>()
|
||||
.<info descr="Not resolved until the project is fully loaded">info</info>("1")
|
||||
.<info descr="Not resolved until the project is fully loaded">build</info>();
|
||||
String name = userDao.<info descr="Not resolved until the project is fully loaded">name</info>();
|
||||
UserChain userChain = new UserChain();
|
||||
String name1 = userChain.<info descr="Not resolved until the project is fully loaded">getName</info>();
|
||||
}
|
||||
}
|
||||
|
||||
@<info descr="Not resolved until the project is fully loaded">Getter</info>
|
||||
@<info descr="Not resolved until the project is fully loaded">SuperBuilder</info>
|
||||
class UserDao extends UserId {
|
||||
<info descr="Not resolved until the project is fully loaded">private final String name;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String surname;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String email;</info>
|
||||
}
|
||||
|
||||
@<info descr="Not resolved until the project is fully loaded">SuperBuilder</info>
|
||||
abstract class UserId {
|
||||
<info descr="Not resolved until the project is fully loaded">private final long id;</info>
|
||||
<info descr="Not resolved until the project is fully loaded">private final String info;</info>
|
||||
}
|
||||
|
||||
class UserChain {
|
||||
@<info descr="Not resolved until the project is fully loaded">Getter</info>
|
||||
@<info descr="Not resolved until the project is fully loaded">Setter</info>
|
||||
private String name;
|
||||
}
|
||||
Reference in New Issue
Block a user