Added assertion as suggested in JENKINS-22767.

This commit is contained in:
Jesse Glick committed 2014-12-29 10:01:22 -05:00
1 parent bacca38aac
commit 1078e6b68f
2 files changed
+8 -2

No files matched your search

@@ -468,7 +468,8 @@ public abstract class AbstractLazyLoadRunMap<R> extends AbstractMap<Integer,R> i
Index copy = editInPlace!=null ? editInPlace : new Index(index);
BuildReference<R> ref = createReference(r);
copy.byNumber.put(getNumberOf(r),ref);
BuildReference<R> old = copy.byNumber.put(getNumberOf(r), ref);
assert old == null || old.get() == null : "tried to overwrite " + old + " with " + ref;
if (editInPlace==null) index = copy;
@@ -66,7 +66,7 @@ public final class BuildReference<R> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BuildReference that = (BuildReference) o;
BuildReference<?> that = (BuildReference) o;
return id.equals(that.id);
}
@@ -76,6 +76,11 @@ public final class BuildReference<R> {
return id.hashCode();
}
@Override public String toString() {
R r = get();
return r != null ? r.toString() : id;
}
/**
* An abstraction of {@link Reference}.
* @since 1.548