use of com.intellij.psi.impl.java.stubs.PsiModifierListStub in project intellij-community by JetBrains.
the class PsiModifierListImpl method calcExplicitModifiers.
private Set<String> calcExplicitModifiers() {
Set<String> explicitModifiers = ContainerUtil.newHashSet();
PsiModifierListStub stub = getGreenStub();
if (stub != null) {
int mask = stub.getModifiersMask();
for (int i = 0; i < 31; i++) {
int flag = 1 << i;
if (BitUtil.isSet(mask, flag)) {
ContainerUtil.addIfNotNull(explicitModifiers, ModifierFlags.MODIFIER_FLAG_TO_NAME_MAP.get(flag));
}
}
} else {
for (ASTNode child : getNode().getChildren(null)) {
ContainerUtil.addIfNotNull(explicitModifiers, KEYWORD_TYPE_TO_NAME_MAP.get(child.getElementType()));
}
}
return explicitModifiers;
}
use of com.intellij.psi.impl.java.stubs.PsiModifierListStub in project intellij-community by JetBrains.
the class TypeInfo method applyAnnotations.
@NotNull
public TypeInfo applyAnnotations(@NotNull StubBase<?> owner) {
PsiModifierListStub modifierList = (PsiModifierListStub) owner.findChildStubByType(JavaStubElementTypes.MODIFIER_LIST);
if (modifierList == null)
return this;
List<PsiAnnotationStub> annotationStubs = null;
for (StubElement child : modifierList.getChildrenStubs()) {
if (!(child instanceof PsiAnnotationStub))
continue;
PsiAnnotationStub annotationStub = (PsiAnnotationStub) child;
if (PsiImplUtil.isTypeAnnotation(annotationStub.getPsiElement())) {
if (annotationStubs == null)
annotationStubs = new SmartList<>();
annotationStubs.add(annotationStub);
}
}
PsiAnnotationStub[] stubArray = PsiAnnotationStub.EMPTY_ARRAY;
if (annotationStubs != null)
stubArray = annotationStubs.toArray(new PsiAnnotationStub[annotationStubs.size()]);
return new TypeInfo(text, arrayCount, isEllipsis, stubArray);
}
use of com.intellij.psi.impl.java.stubs.PsiModifierListStub in project intellij-community by JetBrains.
the class PsiModifierListImpl method hasExplicitModifier.
@Override
public boolean hasExplicitModifier(@NotNull String name) {
PsiModifierListStub stub = getGreenStub();
if (stub != null) {
return BitUtil.isSet(stub.getModifiersMask(), ModifierFlags.NAME_TO_MODIFIER_FLAG_MAP.get(name));
}
final CompositeElement tree = (CompositeElement) getNode();
final IElementType type = NAME_TO_KEYWORD_TYPE_MAP.get(name);
return tree.findChildByType(type) != null;
}
Aggregations