ObjectIndexTest: add a lazy object resolution test

This tests that the addLater method works in conjunction with calls to
get(Class). The logic is nontrivial because we only want to resolve
pending objects when the types are compatible with the requested one.
LazyObjects: add getType() method

This breaks backwards compatibility.
WIP