ij-legacy: Add a few @SuppressWarnings("unused")

The parameters are actually required, but Eclipse would not know.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: offer a more meaningful explanation instead of a LinkageError

When the ImageJ 1.x classes were already defined, we cannot patch
them anymore. Explain the situation better.

This is as much to help future users of ij-legacy as this developer, who
has now spent three times more than an hour to figure out what was going
on, with exactly the same resolution: ij.IJ was already defined.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: when javassist-patching failed, say which classloader

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy tests: make sure that a main class is found

On Windows, currently the AppUtils get a chance to determine the main
class only after we ran the LegacyHeadlessTest. This test changes the
current thread's name, on which AppUtils unfortunately relies. So simply
change it back.

The shortcomings of scijava-common to handle that situation gracefully
rather than throwing a NullPointerException when getBaseDirectory() was
called will be fixed there.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy tests (Windows): make sure that ij.IJ is *not* loaded early

We really need to make sure that ij.IJ is not yet loaded before trying
to patch in the headless hacks. Unfortunately, it seems that Windows is
not only challenged when you ask it to perform things that are
outright easy on POSIX platforms, it also seems that it insists to load
the complete shebang when you simply ask for ij.IJ.class.

To work around this Windows-only problem, use the class ij.CommandListener
(which has no reference to any ImageJ 1.x class that might need patching
in the legacy headless mode) instead, because, really, all we need at that
point is the location of the .jar file containing the ImageJ 1.x classes.

Noticed by judicial Jonny Jenkins.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge branch 'legacy-tests'

This works around a couple of problems Windows has with code that runs
just fine everywhere else. In other words, another Microsoft time tax.

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