scijava/scijava-common — pull request #91 by ctrueden (2014-07-01 20:44:41+00:00)
Title: Better lazy resolution

This improves the `ObjectIndex` lazy object resolution feature to only resolve objects as needed based on the type. Previously, as soon as `get(Class)` or `getAll()` was called, _all_ pending objects would be resolved. Now we inspect the generic return type of the `LazyObjects#get()` method to see if the type of the `Collection` is even worth bothering about.

This logic can fail in convoluted cases, such as a `LazyObjects` concrete subtype overriding the `get()` return type to something like `Foo` where `Foo extends Collection` or something similarly unintuitive—the logic will detect the `` part and assume that `String` is the relevant type, when really `Integer` would be. But I think this is an acceptable tradeoff for the performance and usability gains, and we can always fix such shortcomings later if needed.

To test:
* Verify that all tests of `ObjectIndexTest` pass.
* Revert commit f871b37 and verify that the `testAddLater` test fails.

See also issue #90.