提交 57078951 编写于 作者: A Andrey Breslav

Even more detailed error messages

上级 37bc1068
......@@ -52,7 +52,7 @@ public abstract class WritableScopeWithImports extends JetScopeAdapter implement
@Override
public WritableScope changeLockLevel(LockLevel lockLevel) {
if (lockLevel.ordinal() < this.lockLevel.ordinal()) {
throw new IllegalStateException("cannot lower lock level from " + this.lockLevel + " to " + lockLevel + " at " + debugName);
throw new IllegalStateException("cannot lower lock level from " + this.lockLevel + " to " + lockLevel + " at " + toString());
}
this.lockLevel = lockLevel;
return this;
......@@ -60,19 +60,19 @@ public abstract class WritableScopeWithImports extends JetScopeAdapter implement
protected void checkMayRead() {
if (lockLevel != LockLevel.READING && lockLevel != LockLevel.BOTH) {
throw new IllegalStateException("cannot read with lock level " + lockLevel + " at " + debugName);
throw new IllegalStateException("cannot read with lock level " + lockLevel + " at " + toString());
}
}
protected void checkMayWrite() {
if (lockLevel != LockLevel.WRITING && lockLevel != LockLevel.BOTH) {
throw new IllegalStateException("cannot write with lock level " + lockLevel + " at " + debugName);
throw new IllegalStateException("cannot write with lock level " + lockLevel + " at " + toString());
}
}
protected void checkMayNotWrite() {
if (lockLevel == LockLevel.WRITING || lockLevel == LockLevel.BOTH) {
throw new IllegalStateException("cannot write with lock level " + lockLevel + " at " + debugName);
throw new IllegalStateException("cannot write with lock level " + lockLevel + " at " + toString());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册