correctly check if we need to process deferred types in body resolver
This commit is contained in:
@@ -511,7 +511,8 @@ public class BodyResolver {
|
||||
AnnotationResolver.resolveAnnotationsArguments(klass.getPrimaryConstructorModifierList(), trace);
|
||||
|
||||
if (unsubstitutedPrimaryConstructor != null) {
|
||||
WritableScope parameterScope = getPrimaryConstructorParametersScope(classDescriptor.getScopeForClassHeaderResolution(), unsubstitutedPrimaryConstructor);
|
||||
WritableScope parameterScope = getPrimaryConstructorParametersScope(classDescriptor.getScopeForClassHeaderResolution(),
|
||||
unsubstitutedPrimaryConstructor);
|
||||
valueParameterResolver.resolveValueParameters(klass.getPrimaryConstructorParameters(), unsubstitutedPrimaryConstructor.getValueParameters(),
|
||||
parameterScope, c.getOuterDataFlowInfo(), trace);
|
||||
}
|
||||
@@ -799,30 +800,30 @@ public class BodyResolver {
|
||||
|
||||
private void computeDeferredTypes() {
|
||||
Collection<Box<DeferredType>> deferredTypes = trace.getKeys(DEFERRED_TYPE);
|
||||
if (deferredTypes != null) {
|
||||
// +1 is a work around agains new Queue(0).addLast(...) bug // stepan.koltsov@ 2011-11-21
|
||||
final Queue<DeferredType> queue = new Queue<DeferredType>(deferredTypes.size() + 1);
|
||||
trace.addHandler(DEFERRED_TYPE, new ObservableBindingTrace.RecordHandler<Box<DeferredType>, Boolean>() {
|
||||
@Override
|
||||
public void handleRecord(WritableSlice<Box<DeferredType>, Boolean> deferredTypeKeyDeferredTypeWritableSlice, Box<DeferredType> key, Boolean value) {
|
||||
queue.addLast(key.getData());
|
||||
}
|
||||
});
|
||||
for (Box<DeferredType> deferredType : deferredTypes) {
|
||||
queue.addLast(deferredType.getData());
|
||||
if (deferredTypes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// +1 is a work around against new Queue(0).addLast(...) bug // stepan.koltsov@ 2011-11-21
|
||||
final Queue<DeferredType> queue = new Queue<DeferredType>(deferredTypes.size() + 1);
|
||||
trace.addHandler(DEFERRED_TYPE, new ObservableBindingTrace.RecordHandler<Box<DeferredType>, Boolean>() {
|
||||
@Override
|
||||
public void handleRecord(WritableSlice<Box<DeferredType>, Boolean> deferredTypeKeyDeferredTypeWritableSlice, Box<DeferredType> key, Boolean value) {
|
||||
queue.addLast(key.getData());
|
||||
}
|
||||
while (!queue.isEmpty()) {
|
||||
DeferredType deferredType = queue.pullFirst();
|
||||
if (!deferredType.isComputed()) {
|
||||
try {
|
||||
deferredType.getDelegate(); // to compute
|
||||
}
|
||||
catch (ReenteringLazyValueComputationException e) {
|
||||
// A problem should be reported while computing the type
|
||||
}
|
||||
});
|
||||
for (Box<DeferredType> deferredType : deferredTypes) {
|
||||
queue.addLast(deferredType.getData());
|
||||
}
|
||||
while (!queue.isEmpty()) {
|
||||
DeferredType deferredType = queue.pullFirst();
|
||||
if (!deferredType.isComputed()) {
|
||||
try {
|
||||
deferredType.getDelegate(); // to compute
|
||||
}
|
||||
catch (ReenteringLazyValueComputationException e) {
|
||||
// A problem should be reported while computing the type
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user