Remove no longer needed @SupressWarnings

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move installHooks(LegacyHooks) from CodeHacker to LegacyInjector

The installHooks() method is really meant to run long, long, long time
after the code patching happened. Therefore, the CodeHacker class is
actually not the best place to put that method (but we did, in order to
be certain to insert the hooks into the correct class loader).

While at it, get rid of the setLegacyService() method: we do not set
the legacy service at all any longer, just the legacy hooks: it is their
task to connect everything to the correct legacy service.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Patch in the _hooks field in the LegacyInjector class

The CodeHacker is not supposed to know anything about ImageJ 1.x, just
about code patching.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move the preinit() logic from DefaultLegacyService into LegacyInjector

This is another change in the overall project to separate better between
legacy code patching and the legacy service.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Allow LegacyInjector.preinit() to be called multiple times

The subsequent calls will simply verify that all was patched alright and
then return.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Always start with a fresh ClassPool when patching ImageJ 1.x

That way, we will be able to patch multiple ImageJ 1.x 'instances' in
different ClassLoaders with the same LegacyInjector instance.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Deprecate DefaultLegacyService's preinit() in favor of LegacyInjector's

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a class loader specifically for loading a patched ImageJ 1.x

This class loader will only find the ImageJ 1.x classes, plus
LegacyHooks and EssentialLegacyHooks. It will also patch the ImageJ
1.x classes appropriately and install an EssentialLegacyHooks instance.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
WIP: Add a "legacy environment", i.e. encapsulated ImageJ 1.x instances

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
WIP: Add a test for calling a fresh headless ImageJ 1.x

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
TODOs