Add extra diagnostic information when no common supertypes are found
We're suspecting that the culprit of such errors is race condition on 'supertypes' in AbstractTypeConstructor, when it is created using 'LockBasedStorageManager.NO_LOCKS'
This commit is contained in:
@@ -146,6 +146,11 @@ public class LockBasedStorageManager implements StorageManager {
|
||||
protected RecursionDetectedResult<T> recursionDetected(boolean firstTime) {
|
||||
return RecursionDetectedResult.value(onRecursiveCall);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String presentableName() {
|
||||
return "RecursionTolerantLazyValue";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -170,6 +175,11 @@ public class LockBasedStorageManager implements StorageManager {
|
||||
protected void postCompute(@NotNull T value) {
|
||||
postCompute.invoke(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String presentableName() {
|
||||
return "LazyValueWithPostCompute";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -188,6 +198,11 @@ public class LockBasedStorageManager implements StorageManager {
|
||||
protected RecursionDetectedResult<T> recursionDetected(boolean firstTime) {
|
||||
return RecursionDetectedResult.value(onRecursiveCall);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String presentableName() {
|
||||
return "RecursionTolerantNullableLazyValue";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -201,6 +216,11 @@ public class LockBasedStorageManager implements StorageManager {
|
||||
protected void postCompute(@Nullable T value) {
|
||||
postCompute.invoke(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String presentableName() {
|
||||
return "NullableLazyValueWithPostCompute";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -356,6 +376,15 @@ public class LockBasedStorageManager implements StorageManager {
|
||||
protected void postCompute(T value) {
|
||||
// Doing something in post-compute helps prevent infinite recursion
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String renderDebugInformation() {
|
||||
return presentableName() + ", storageManager=" + storageManager;
|
||||
}
|
||||
|
||||
protected String presentableName() {
|
||||
return this.getClass().getName();
|
||||
}
|
||||
}
|
||||
|
||||
private static class LockBasedNotNullLazyValue<T> extends LockBasedLazyValue<T> implements NotNullLazyValue<T> {
|
||||
|
||||
@@ -29,6 +29,9 @@ interface MemoizedFunctionToNullable<in P, out R : Any> : Function1<P, R?> {
|
||||
interface NotNullLazyValue<out T : Any> : Function0<T> {
|
||||
fun isComputed(): Boolean
|
||||
fun isComputing(): Boolean
|
||||
|
||||
// Only for debugging
|
||||
fun renderDebugInformation(): String = ""
|
||||
}
|
||||
|
||||
interface NullableLazyValue<out T : Any> : Function0<T?> {
|
||||
|
||||
Reference in New Issue
Block a user