Add a simple Java agent to identify when ImageJ 1.x classes are loaded

When ImageJ 1.x' classes are loaded before the ij-legacy patching had
a chance, we have a problem. The biggest problem is that we only have
a chance to detect that situation when the ij-legacy patching takes
place, so there is no way to know which code path loaded the unpatched
ImageJ 1.x classes.

To help with that, this commit adds a Java agent that reports whenever
classes in the "ij" package (or any of its nested packages) is loaded.

We will refine this agent in subsequent commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyJavaAgent: show only the relevant part of the stack trace

We do not need to show any part that is concerned with (possibly
nested) class loading, just the part in the user code that wants
to refer to ImageJ 1.x classes. So we hide anything inside the
bootstrap class loader (actually, the ext class loader, but that is
an implementation detail) and anything inside the LegacyJavaAgent
class itself.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyJavaAgent: Add documentation to the premain() method

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyJavaAgent: Add code to write out a minimal .jar file

When debugging ij-legacy itself, we need a minimal .jar file that
does not hide the classes we try to debug.

The newly introduced main() method does exactly that, copying the
LegacyJavaAgent .class file into a new .jar file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a Premain-Class: entry so that the ij-legacy agent can be started

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyJavaAgent: Offer an API to switch the agent off

When the legacy patching is done, we should not warn any longer.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: shut up the LegacyJavaAgent just before patching

The legacy java agent is supposed to warn when ImageJ 1.x classes
were used before patching, but it should no longer warn when that
patching starts (or afterwards).

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