Fix KT-25853 IDEA hangs when Kotlin bytecode tool window open...
KotlinTypeMapper.findFirstDelegatingSuperCall can loop forever if the code is invalid. Bail out.
This commit is contained in:
@@ -63,10 +63,7 @@ import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.isStaticMethod;
|
||||
@@ -1681,10 +1678,13 @@ public class KotlinTypeMapper {
|
||||
@Nullable
|
||||
private ResolvedCall<ConstructorDescriptor> findFirstDelegatingSuperCall(@NotNull ConstructorDescriptor descriptor) {
|
||||
ClassifierDescriptorWithTypeParameters constructorOwner = descriptor.getContainingDeclaration();
|
||||
Set<ConstructorDescriptor> visited = new HashSet<>();
|
||||
visited.add(descriptor);
|
||||
while (true) {
|
||||
ResolvedCall<ConstructorDescriptor> next = getDelegationConstructorCall(bindingContext, descriptor);
|
||||
if (next == null) return null;
|
||||
descriptor = next.getResultingDescriptor().getOriginal();
|
||||
if (!visited.add(descriptor)) return null;
|
||||
if (descriptor.getContainingDeclaration() != constructorOwner) return next;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user