Make changes in super call lambda not cause out-of-block modification (KT-13474)
#KT-13474 Fixed
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user