The thing is, lookupAny(id, int) is safe, because if the object didn't exist in the walk before this point, it will be added, but we will discover the UNINTERESTING flag is missing and immediately abort with the exception.  So yea, the walk is polluted for a short period with an assumption of an object of a certain type... but it won't have the flag.

I'd rather not change the API of RevWalk right now just to implement this feature.  I'm too afraid we might be forced to live with that new method forever, and its semantics.  So just use lookupAny(id, Constants.OBJ_BLOB) here and accept that the walk gets partially polluted right before the crash.