JET-54 SOE on trying to call Collections.sort()
This commit is contained in:
@@ -2,6 +2,8 @@ package org.jetbrains.jet.lang.descriptors;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.resolve.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.LazyScopeAdapter;
|
||||
import org.jetbrains.jet.lang.types.*;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -115,7 +117,12 @@ public class TypeParameterDescriptor extends DeclarationDescriptorImpl implement
|
||||
getTypeConstructor(),
|
||||
TypeUtils.hasNullableBound(this),
|
||||
Collections.<TypeProjection>emptyList(),
|
||||
getBoundsAsType().getMemberScope());
|
||||
new LazyScopeAdapter(new LazyValue<JetScope>() {
|
||||
@Override
|
||||
protected JetScope compute() {
|
||||
return getBoundsAsType().getMemberScope();
|
||||
}
|
||||
}));
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public abstract class AbstractScopeAdapter implements JetScope {
|
||||
@NotNull
|
||||
protected abstract JetScope getWorkerScope();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JetType getThisType() {
|
||||
return getWorkerScope().getThisType();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionGroup getFunctionGroup(@NotNull String name) {
|
||||
return getWorkerScope().getFunctionGroup(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespaceDescriptor getNamespace(@NotNull String name) {
|
||||
return getWorkerScope().getNamespace(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassifierDescriptor getClassifier(@NotNull String name) {
|
||||
return getWorkerScope().getClassifier(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableDescriptor getVariable(@NotNull String name) {
|
||||
return getWorkerScope().getVariable(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DeclarationDescriptor getContainingDeclaration() {
|
||||
return getWorkerScope().getContainingDeclaration();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(String labelName) {
|
||||
return getWorkerScope().getDeclarationsByLabel(labelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor getPropertyByFieldReference(@NotNull String fieldName) {
|
||||
return getWorkerScope().getPropertyByFieldReference(fieldName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.types.*;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class JetScopeAdapter implements JetScope {
|
||||
public class JetScopeAdapter extends AbstractScopeAdapter {
|
||||
@NotNull
|
||||
private final JetScope scope;
|
||||
|
||||
@@ -18,51 +14,8 @@ public class JetScopeAdapter implements JetScope {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected final JetScope getWorkerScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JetType getThisType() {
|
||||
return scope.getThisType();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionGroup getFunctionGroup(@NotNull String name) {
|
||||
return scope.getFunctionGroup(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespaceDescriptor getNamespace(@NotNull String name) {
|
||||
return scope.getNamespace(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassifierDescriptor getClassifier(@NotNull String name) {
|
||||
return scope.getClassifier(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableDescriptor getVariable(@NotNull String name) {
|
||||
return scope.getVariable(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DeclarationDescriptor getContainingDeclaration() {
|
||||
return scope.getContainingDeclaration();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(String labelName) {
|
||||
return scope.getDeclarationsByLabel(labelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor getPropertyByFieldReference(@NotNull String fieldName) {
|
||||
return scope.getPropertyByFieldReference(fieldName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.types.LazyValue;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class LazyScopeAdapter extends AbstractScopeAdapter {
|
||||
|
||||
private final LazyValue<JetScope> scope;
|
||||
|
||||
public LazyScopeAdapter(LazyValue<JetScope> scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected JetScope getWorkerScope() {
|
||||
return scope.get();
|
||||
}
|
||||
}
|
||||
@@ -141,6 +141,7 @@ public class JavaDescriptorResolver {
|
||||
typeParameter.getName(),
|
||||
typeParameter.getIndex()
|
||||
);
|
||||
typeParameterDescriptorCache.put(typeParameter, typeParameterDescriptor);
|
||||
PsiClassType[] referencedTypes = typeParameter.getExtendsList().getReferencedTypes();
|
||||
if (referencedTypes.length == 0){
|
||||
typeParameterDescriptor.addUpperBound(JetStandardClasses.getNullableAnyType());
|
||||
@@ -161,7 +162,7 @@ public class JavaDescriptorResolver {
|
||||
TypeParameterDescriptor typeParameterDescriptor = typeParameterDescriptorCache.get(psiTypeParameter);
|
||||
if (typeParameterDescriptor == null) {
|
||||
typeParameterDescriptor = createJavaTypeParameterDescriptor(JAVA_ROOT, psiTypeParameter);
|
||||
typeParameterDescriptorCache.put(psiTypeParameter, typeParameterDescriptor);
|
||||
// Tis is done inside the method: typeParameterDescriptorCache.put(psiTypeParameter, typeParameterDescriptor);
|
||||
}
|
||||
return typeParameterDescriptor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user