mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
IDEA-332133 [java] Make OuterModelsModificationTracker to track annotation changes for package statements
GitOrigin-RevId: bce9c1eebcd820acd0a86fbaa82a145ea6a9f75c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ddf67b3885
commit
dff61fdd49
@@ -30,7 +30,7 @@ import org.jetbrains.uast.util.ClassSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.uast.util.ClassSetKt.isInstanceOf;
|
||||
import static org.jetbrains.uast.util.ClassSetKt.*;
|
||||
|
||||
/**
|
||||
* This ModificationTracker is incremented if changes in file (class) of VFS could change the number of stereotype components scanned
|
||||
@@ -336,7 +336,8 @@ public class OuterModelsModificationTracker extends SimpleModificationTracker {
|
||||
return modifierListOwner == null // just added annotation
|
||||
|| isInstanceOf(modifierListOwner, possiblePsiTypes.forClasses)
|
||||
|| (isInstanceOf(modifierListOwner, possiblePsiTypes.forMethods)
|
||||
&& !isInstanceOf(modifierListOwner, possiblePsiTypes.forVariables));
|
||||
&& !isInstanceOf(modifierListOwner, possiblePsiTypes.forVariables))
|
||||
|| isInstanceOf(modifierListOwner, possiblePsiTypes.forPackageStatements);
|
||||
}
|
||||
|
||||
private @Nullable MyPsiPossibleTypes getPossiblePsiTypesFor(@NotNull String languageId) {
|
||||
@@ -360,6 +361,7 @@ public class OuterModelsModificationTracker extends SimpleModificationTracker {
|
||||
public final @NotNull ClassSet<PsiElement> forImports;
|
||||
public final @NotNull ClassSet<PsiElement> forAnnotations;
|
||||
public final @NotNull ClassSet<PsiElement> forAnnotationOwners;
|
||||
public final @NotNull ClassSet<PsiElement> forPackageStatements;
|
||||
|
||||
private MyPsiPossibleTypes(@NotNull UastLanguagePlugin uastPlugin) {
|
||||
this.forClasses = uastPlugin.getPossiblePsiSourceTypes(UClass.class);
|
||||
@@ -367,7 +369,8 @@ public class OuterModelsModificationTracker extends SimpleModificationTracker {
|
||||
this.forVariables = uastPlugin.getPossiblePsiSourceTypes(UVariable.class);
|
||||
this.forImports = uastPlugin.getPossiblePsiSourceTypes(UImportStatement.class);
|
||||
this.forAnnotations = uastPlugin.getPossiblePsiSourceTypes(UAnnotation.class);
|
||||
this.forAnnotationOwners = uastPlugin.getPossiblePsiSourceTypes(UAnnotated.class);
|
||||
this.forPackageStatements = classSetOf(PsiPackageStatement.class);
|
||||
this.forAnnotationOwners = classSetsUnion(uastPlugin.getPossiblePsiSourceTypes(UAnnotated.class), forPackageStatements);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +104,8 @@ fun <T> classSetOf(vararg classes: Class<out T>): ClassSet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> classSetsUnion(vararg classSets: ClassSet<T>): ClassSet<T> = classSetOf(*classSets.flatMap { it.toList() }.toTypedArray())
|
||||
|
||||
private val emptyClassSet: ClassSet<Nothing> = object : ClassSet<Nothing> {
|
||||
override fun isEmpty() = true
|
||||
override fun contains(element: Class<out Nothing>): Boolean = false
|
||||
|
||||
Reference in New Issue
Block a user