diff --git a/compiler/tests/org/jetbrains/jet/storage/StorageManagerTest.java b/compiler/tests/org/jetbrains/jet/storage/StorageManagerTest.java index 5419f0ba79f..bfa7469a00e 100644 --- a/compiler/tests/org/jetbrains/jet/storage/StorageManagerTest.java +++ b/compiler/tests/org/jetbrains/jet/storage/StorageManagerTest.java @@ -149,7 +149,7 @@ public class StorageManagerTest extends TestCase { fail(); } catch (AssertionError e) { - assertEquals("Recursion detected on input: !!!", e.getMessage()); + assertTrue(e.getMessage().startsWith("Recursion detected on input: !!!")); } } diff --git a/core/util.runtime/src/org/jetbrains/jet/storage/LockBasedStorageManager.java b/core/util.runtime/src/org/jetbrains/jet/storage/LockBasedStorageManager.java index f132863e759..9b03ca18e5d 100644 --- a/core/util.runtime/src/org/jetbrains/jet/storage/LockBasedStorageManager.java +++ b/core/util.runtime/src/org/jetbrains/jet/storage/LockBasedStorageManager.java @@ -94,7 +94,7 @@ public class LockBasedStorageManager implements StorageManager { @Override public String toString() { - return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()) + " (" + debugText + ')'; + return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()) + " (" + debugText + ")"; } @NotNull @@ -213,7 +213,7 @@ public class LockBasedStorageManager implements StorageManager { @NotNull protected RecursionDetectedResult recursionDetectedDefault() { - throw new IllegalStateException("Recursive call in a lazy value"); + throw new IllegalStateException("Recursive call in a lazy value under " + this); } private static class RecursionDetectedResult { @@ -237,7 +237,7 @@ public class LockBasedStorageManager implements StorageManager { } public T getValue() { - assert !fallThrough : "A value requested from FALL_THROUGH "; + assert !fallThrough : "A value requested from FALL_THROUGH in " + this; return value; } @@ -365,7 +365,7 @@ public class LockBasedStorageManager implements StorageManager { lock.lock(); try { value = cache.get(input); - assert value != NotValue.COMPUTING : "Recursion detected on input: " + input; + assert value != NotValue.COMPUTING : "Recursion detected on input: " + input + " under " + LockBasedStorageManager.this; if (value != null) return WrappedValues.unescapeExceptionOrNull(value); AssertionError error = null; @@ -379,7 +379,8 @@ public class LockBasedStorageManager implements StorageManager { // A seemingly obvious way to come about this case would be to declare a special exception class, but the problem is that // one memoized function is likely to (indirectly) call another, and if this second one throws this exception, we are screwed if (oldValue != NotValue.COMPUTING) { - error = new AssertionError("Race condition detected on input " + input + ". Old value is " + oldValue); + error = new AssertionError("Race condition detected on input " + input + ". Old value is " + oldValue + + " under " + LockBasedStorageManager.this); throw error; } @@ -389,7 +390,8 @@ public class LockBasedStorageManager implements StorageManager { if (throwable == error) throw exceptionHandlingStrategy.handleException(throwable); Object oldValue = cache.put(input, WrappedValues.escapeThrowable(throwable)); - assert oldValue == NotValue.COMPUTING : "Race condition detected on input " + input + ". Old value is " + oldValue; + assert oldValue == NotValue.COMPUTING : "Race condition detected on input " + input + ". Old value is " + oldValue + + " under " + LockBasedStorageManager.this; throw exceptionHandlingStrategy.handleException(throwable); } @@ -413,7 +415,7 @@ public class LockBasedStorageManager implements StorageManager { @Override public V invoke(K input) { V result = super.invoke(input); - assert result != null : "compute() returned null"; + assert result != null : "compute() returned null under " + LockBasedStorageManager.this; return result; } }