JetModifierList#getAnnotations() and getAnnotationEntries() by stub

This commit is contained in:
Pavel V. Talanov
2014-04-04 18:42:51 +04:00
parent 70f85bd2a2
commit 1f3797ffb2
@@ -22,8 +22,8 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.stubs.IStubElementType; import com.intellij.psi.stubs.IStubElementType;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.JetNodeTypes;
import org.jetbrains.jet.lang.psi.stubs.PsiJetModifierListStub; import org.jetbrains.jet.lang.psi.stubs.PsiJetModifierListStub;
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
import org.jetbrains.jet.lexer.JetModifierKeywordToken; import org.jetbrains.jet.lexer.JetModifierKeywordToken;
import org.jetbrains.jet.lexer.JetToken; import org.jetbrains.jet.lexer.JetToken;
@@ -48,12 +48,12 @@ public abstract class JetModifierList extends JetElementImplStub<PsiJetModifierL
@NotNull @NotNull
public List<JetAnnotation> getAnnotations() { public List<JetAnnotation> getAnnotations() {
return findChildrenByType(JetNodeTypes.ANNOTATION); return getStubOrPsiChildrenAsList(JetStubElementTypes.ANNOTATION);
} }
@NotNull @NotNull
public List<JetAnnotationEntry> getAnnotationEntries() { public List<JetAnnotationEntry> getAnnotationEntries() {
List<JetAnnotationEntry> entries = findChildrenByType(JetNodeTypes.ANNOTATION_ENTRY); List<JetAnnotationEntry> entries = getStubOrPsiChildrenAsList(JetStubElementTypes.ANNOTATION_ENTRY);
List<JetAnnotationEntry> answer = entries.isEmpty() ? null : Lists.newArrayList(entries); List<JetAnnotationEntry> answer = entries.isEmpty() ? null : Lists.newArrayList(entries);
for (JetAnnotation annotation : getAnnotations()) { for (JetAnnotation annotation : getAnnotations()) {
if (answer == null) answer = new ArrayList<JetAnnotationEntry>(); if (answer == null) answer = new ArrayList<JetAnnotationEntry>();