Make changes in super call lambda not cause out-of-block modification (KT-13474)

#KT-13474 Fixed
This commit is contained in:
Nikolay Krasko
2016-08-26 21:17:39 +03:00
parent 64d511566e
commit 52dd02fe08
9 changed files with 77 additions and 7 deletions
@@ -34,6 +34,7 @@ fun KtElement.getModificationStamp(): Long {
return when (this) {
is KtFile -> this.modificationStamp
is KtDeclarationStub<*> -> this.modificationStamp
is KtSuperTypeList -> this.modificationStamp
else -> (parent as KtElement).getModificationStamp()
}
}
@@ -29,8 +29,11 @@ import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
public class KtSuperTypeList extends KtElementImplStub<KotlinPlaceHolderStub<KtSuperTypeList>> {
private final AtomicLong modificationStamp = new AtomicLong();
public KtSuperTypeList(@NotNull ASTNode node) {
super(node);
}
@@ -66,4 +69,15 @@ public class KtSuperTypeList extends KtElementImplStub<KotlinPlaceHolderStub<KtS
public List<KtSuperTypeListEntry> getEntries() {
return Arrays.asList(getStubOrPsiChildren(KtStubElementTypes.SUPER_TYPE_LIST_ENTRIES, KtSuperTypeListEntry.ARRAY_FACTORY));
}
@Override
public void subtreeChanged() {
super.subtreeChanged();
modificationStamp.getAndIncrement();
}
public long getModificationStamp() {
return modificationStamp.get();
}
}