LazyValue renamed to avoid confusion

This commit is contained in:
Andrey Breslav
2013-01-23 14:21:05 +04:00
parent 17b4a5a15c
commit e7ea3d9667
10 changed files with 26 additions and 26 deletions
@@ -26,7 +26,7 @@ import org.jetbrains.jet.lang.types.*;
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.renderer.DescriptorRenderer;
import org.jetbrains.jet.util.lazy.LazyValue;
import org.jetbrains.jet.util.lazy.RecursionIntolerantLazyValue;
import java.util.Collections;
import java.util.List;
@@ -218,7 +218,7 @@ public class TypeParameterDescriptorImpl extends DeclarationDescriptorNonRootImp
getTypeConstructor(),
TypeUtils.hasNullableLowerBound(this),
Collections.<TypeProjection>emptyList(),
new LazyScopeAdapter(new LazyValue<JetScope>() {
new LazyScopeAdapter(new RecursionIntolerantLazyValue<JetScope>() {
@Override
protected JetScope compute() {
return getUpperBoundsAsType().getMemberScope();
@@ -39,8 +39,8 @@ import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
import org.jetbrains.jet.lang.types.expressions.ExpressionTypingServices;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.lexer.JetTokens;
import org.jetbrains.jet.util.lazy.LazyValue;
import org.jetbrains.jet.util.lazy.LazyValueWithDefault;
import org.jetbrains.jet.util.lazy.RecursionIntolerantLazyValue;
import org.jetbrains.jet.util.lazy.RecursionIntolerantLazyValueWithDefault;
import javax.inject.Inject;
import java.util.*;
@@ -289,7 +289,7 @@ public class DescriptorResolver {
final JetExpression bodyExpression = function.getBodyExpression();
if (bodyExpression != null) {
returnType =
DeferredType.create(trace, new LazyValueWithDefault<JetType>(ErrorUtils.createErrorType("Recursive dependency")) {
DeferredType.create(trace, new RecursionIntolerantLazyValueWithDefault<JetType>(ErrorUtils.createErrorType("Recursive dependency")) {
@Override
protected JetType compute() {
//JetFlowInformationProvider flowInformationProvider = computeFlowData(function, bodyExpression);
@@ -990,7 +990,7 @@ public class DescriptorResolver {
return ErrorUtils.createErrorType("No type, no body");
}
else {
LazyValue<JetType> lazyValue = new LazyValueWithDefault<JetType>(ErrorUtils.createErrorType("Recursive dependency")) {
RecursionIntolerantLazyValue<JetType> lazyValue = new RecursionIntolerantLazyValueWithDefault<JetType>(ErrorUtils.createErrorType("Recursive dependency")) {
@Override
protected JetType compute() {
return expressionTypingServices.safeGetType(scope, initializer, TypeUtils.NO_EXPECTED_TYPE, dataFlowInfo, trace);
@@ -1271,7 +1271,7 @@ public class DescriptorResolver {
new SimpleFunctionDescriptorImpl(classObjectDescriptor, annotations,
VALUES_METHOD_NAME,
CallableMemberDescriptor.Kind.DECLARATION);
JetType type = DeferredType.create(trace, new LazyValue<JetType>() {
JetType type = DeferredType.create(trace, new RecursionIntolerantLazyValue<JetType>() {
@Override
protected JetType compute() {
return KotlinBuiltIns.getInstance().getArrayType(enumClassDescriptor.getDefaultType());
@@ -1295,7 +1295,7 @@ public class DescriptorResolver {
new SimpleFunctionDescriptorImpl(classObjectDescriptor, annotations,
VALUE_OF_METHOD_NAME,
CallableMemberDescriptor.Kind.DECLARATION);
JetType type = DeferredType.create(trace, new LazyValue<JetType>() {
JetType type = DeferredType.create(trace, new RecursionIntolerantLazyValue<JetType>() {
@Override
protected JetType compute() {
return enumClassDescriptor.getDefaultType();
@@ -30,7 +30,7 @@ import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.resolve.scopes.LazyScopeAdapter;
import org.jetbrains.jet.lang.types.*;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.util.lazy.LazyValue;
import org.jetbrains.jet.util.lazy.RecursionIntolerantLazyValue;
import javax.inject.Inject;
import java.util.ArrayList;
@@ -267,7 +267,7 @@ public class TypeResolver {
return typeParameterDescriptor.getUpperBoundsAsType().getMemberScope();
}
else {
return new LazyScopeAdapter(new LazyValue<JetScope>() {
return new LazyScopeAdapter(new RecursionIntolerantLazyValue<JetScope>() {
@Override
protected JetScope compute() {
return typeParameterDescriptor.getUpperBoundsAsType().getMemberScope();
@@ -31,7 +31,7 @@ import org.jetbrains.jet.lang.types.DeferredType;
import org.jetbrains.jet.lang.types.ErrorUtils;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.util.lazy.LazyValue;
import org.jetbrains.jet.util.lazy.RecursionIntolerantLazyValue;
import java.util.*;
@@ -358,7 +358,7 @@ public class LazyClassMemberScope extends AbstractLazyMemberScope<LazyClassDescr
}
private void setDeferredReturnType(@NotNull ConstructorDescriptorImpl descriptor) {
descriptor.setReturnType(DeferredType.create(resolveSession.getTrace(), new LazyValue<JetType>() {
descriptor.setReturnType(DeferredType.create(resolveSession.getTrace(), new RecursionIntolerantLazyValue<JetType>() {
@Override
protected JetType compute() {
return thisDescriptor.getDefaultType();
@@ -33,7 +33,7 @@ import org.jetbrains.jet.lang.types.*;
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.lexer.JetTokens;
import org.jetbrains.jet.util.lazy.LazyValue;
import org.jetbrains.jet.util.lazy.RecursionIntolerantLazyValue;
import java.util.Collection;
import java.util.Collections;
@@ -215,7 +215,7 @@ public class LazyTypeParameterDescriptor implements TypeParameterDescriptor, Laz
@Override
public JetType getDefaultType() {
if (defaultType == null) {
defaultType = new JetTypeImpl(getTypeConstructor(), new LazyScopeAdapter(new LazyValue<JetScope>() {
defaultType = new JetTypeImpl(getTypeConstructor(), new LazyScopeAdapter(new RecursionIntolerantLazyValue<JetScope>() {
@Override
protected JetScope compute() {
return getUpperBoundsAsType().getMemberScope();
@@ -18,13 +18,13 @@ package org.jetbrains.jet.lang.resolve.scopes;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.resolve.AbstractScopeAdapter;
import org.jetbrains.jet.util.lazy.LazyValue;
import org.jetbrains.jet.util.lazy.RecursionIntolerantLazyValue;
public class LazyScopeAdapter extends AbstractScopeAdapter {
private final LazyValue<JetScope> scope;
private final RecursionIntolerantLazyValue<JetScope> scope;
public LazyScopeAdapter(LazyValue<JetScope> scope) {
public LazyScopeAdapter(RecursionIntolerantLazyValue<JetScope> scope) {
this.scope = scope;
}
@@ -21,7 +21,7 @@ import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.util.Box;
import org.jetbrains.jet.util.lazy.LazyValue;
import org.jetbrains.jet.util.lazy.RecursionIntolerantLazyValue;
import org.jetbrains.jet.util.lazy.ReenteringLazyValueComputationException;
import java.util.List;
@@ -30,15 +30,15 @@ import static org.jetbrains.jet.lang.resolve.BindingContext.DEFERRED_TYPE;
public class DeferredType implements JetType {
public static DeferredType create(BindingTrace trace, LazyValue<JetType> lazyValue) {
public static DeferredType create(BindingTrace trace, RecursionIntolerantLazyValue<JetType> lazyValue) {
DeferredType deferredType = new DeferredType(lazyValue);
trace.record(DEFERRED_TYPE, new Box<DeferredType>(deferredType));
return deferredType;
}
private final LazyValue<JetType> lazyValue;
private final RecursionIntolerantLazyValue<JetType> lazyValue;
private DeferredType(LazyValue<JetType> lazyValue) {
private DeferredType(RecursionIntolerantLazyValue<JetType> lazyValue) {
this.lazyValue = lazyValue;
}
@@ -30,7 +30,7 @@ import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.*;
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
import org.jetbrains.jet.util.lazy.LazyValueWithDefault;
import org.jetbrains.jet.util.lazy.RecursionIntolerantLazyValueWithDefault;
import org.jetbrains.jet.util.slicedmap.WritableSlice;
import java.util.Collections;
@@ -60,7 +60,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
@Override
public void handleRecord(WritableSlice<PsiElement, ClassDescriptor> slice, PsiElement declaration, final ClassDescriptor descriptor) {
if (slice == CLASS && declaration == expression.getObjectDeclaration()) {
JetType defaultType = DeferredType.create(context.trace, new LazyValueWithDefault<JetType>(ErrorUtils.createErrorType("Recursive dependency")) {
JetType defaultType = DeferredType.create(context.trace, new RecursionIntolerantLazyValueWithDefault<JetType>(ErrorUtils.createErrorType("Recursive dependency")) {
@Override
protected JetType compute() {
return descriptor.getDefaultType();
@@ -16,7 +16,7 @@
package org.jetbrains.jet.util.lazy;
public abstract class LazyValue<T> {
public abstract class RecursionIntolerantLazyValue<T> {
private enum State {
NOT_COMPUTED,
@@ -16,10 +16,10 @@
package org.jetbrains.jet.util.lazy;
public abstract class LazyValueWithDefault<T> extends LazyValue<T> {
public abstract class RecursionIntolerantLazyValueWithDefault<T> extends RecursionIntolerantLazyValue<T> {
private final T defaultValue;
protected LazyValueWithDefault(T defaultValue) {
protected RecursionIntolerantLazyValueWithDefault(T defaultValue) {
this.defaultValue = defaultValue;
}