Fix tests: No dangling annotations in stubs

This commit is contained in:
Andrey Breslav
2014-12-26 00:58:26 +03:00
parent 6c6ced2442
commit 06c5be6489
5 changed files with 38 additions and 2 deletions
@@ -92,7 +92,7 @@ public class JetClassBody extends JetElementImplStub<KotlinPlaceHolderStub<JetCl
@NotNull
public List<JetAnnotationEntry> getDanglingAnnotations() {
return KotlinPackage.flatMap(
findChildrenByClass(JetModifierList.class),
getStubOrPsiChildrenAsList(MODIFIER_LIST),
new Function1<JetModifierList, Iterable<JetAnnotationEntry>>() {
@Override
public Iterable<JetAnnotationEntry> invoke(JetModifierList modifierList) {
@@ -245,8 +245,15 @@ public class JetFile extends PsiFileBase implements JetDeclarationContainer, Jet
*/
@NotNull
public List<JetAnnotationEntry> getDanglingAnnotations() {
KotlinFileStub stub = getStub();
JetModifierList[] danglingModifierLists = stub == null
? findChildrenByClass(JetModifierList.class)
: stub.getChildrenByType(
JetStubElementTypes.MODIFIER_LIST,
JetStubElementTypes.MODIFIER_LIST.getArrayFactory()
);
return KotlinPackage.flatMap(
findChildrenByClass(JetModifierList.class),
danglingModifierLists,
new Function1<JetModifierList, Iterable<JetAnnotationEntry>>() {
@Override
public Iterable<JetAnnotationEntry> invoke(JetModifierList modifierList) {