mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[jvm-lang] deprecate JvmModifiersOwner#getModifiers
Also remove JvmModifier#EMPTY_ARRAY
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.lang.jvm;
|
||||
|
||||
public enum JvmModifier {
|
||||
@@ -16,7 +16,5 @@ public enum JvmModifier {
|
||||
STRICTFP,
|
||||
TRANSIENT,
|
||||
VOLATILE,
|
||||
TRANSITIVE;
|
||||
|
||||
public static final JvmModifier[] EMPTY_ARRAY = new JvmModifier[0];
|
||||
TRANSITIVE
|
||||
}
|
||||
|
||||
@@ -3,13 +3,21 @@ package com.intellij.lang.jvm;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.intellij.util.containers.ContainerUtil.filter;
|
||||
|
||||
/**
|
||||
* Represents an element which has modifiers and annotations.
|
||||
*/
|
||||
public interface JvmModifiersOwner extends JvmAnnotatedElement {
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in 2018.3
|
||||
*/
|
||||
@Deprecated
|
||||
@NotNull
|
||||
JvmModifier[] getModifiers();
|
||||
default JvmModifier[] getModifiers() {
|
||||
return filter(JvmModifier.values(), this::hasModifier).toArray(new JvmModifier[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the element effectively has the specified modifier.
|
||||
|
||||
@@ -8,7 +8,9 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.intellij.psi.PsiType.getJavaLangObject;
|
||||
import static com.intellij.psi.PsiType.getTypeByName;
|
||||
@@ -53,17 +55,6 @@ class PsiJvmConversionHelper {
|
||||
return list != null && list.hasAnnotation(fqn);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static JvmModifier[] getListModifiers(@NotNull PsiModifierListOwner modifierListOwner) {
|
||||
final Set<JvmModifier> result = EnumSet.noneOf(JvmModifier.class);
|
||||
MODIFIERS.forEach((jvm, psi) -> {
|
||||
if (modifierListOwner.hasModifierProperty(psi)) {
|
||||
result.add(jvm);
|
||||
}
|
||||
});
|
||||
return result.toArray(JvmModifier.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
static boolean hasListModifier(@NotNull PsiModifierListOwner modifierListOwner, @NotNull JvmModifier modifier) {
|
||||
return modifierListOwner.hasModifierProperty(MODIFIERS.get(modifier));
|
||||
}
|
||||
|
||||
@@ -49,12 +49,6 @@ public interface PsiModifierListOwner extends PsiElement, JvmModifiersOwner {
|
||||
return hasListAnnotation(this, fqn);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
default JvmModifier[] getModifiers() {
|
||||
return getListModifiers(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean hasModifier(@NotNull JvmModifier modifier) {
|
||||
return hasListModifier(this, modifier);
|
||||
|
||||
Reference in New Issue
Block a user