CodeHacker: allow adding public static fields, too

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CodeHacker: allow initializing newly-added static fields

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Introduce CodeHacker#hasField(String fieldName)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Allow multiple CodeHacker instances to be used

With Fiji, we will set the application name before we let the
LegacyService inject the hooks. Therefore, we will need to be able
to instantiate CodeHacker a couple of times with the same class loader.

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

It has moved to a proper ImageJ tutorial called execute-commands:

https://github.com/imagej/imagej-tutorials/blob/93ce61c2d939b17359de3affeaf5ef0c87bd0429/execute-commands/src/main/java/ExecuteCommands.java
CodeHacker: add a helper to get a reference to a constructor

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CodeHacker: add a helper to replace parameters in calls/instantiations

This will be needed to override the app name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CodeHacker: let replaceParameterInCall operate on super(), too

This is required to override the app name in the constructor of
ij.ImageJ because it sets the frame title via calling
super("ImageJ");

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
LegacyInjector: Allow setting the application name

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Teach CodeHacker to edit/add exception handlers

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move NoSuchMethodError handling from fiji-compat into ij-legacy

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: clarify the double-purpose of LegacyHacker

LegacyHacker serves two purposes:

- making it possible to synchronize legacy and modern ImageJ instances,

- give fiji-compat's backwards-compatibility patches a safe home (Fiji
  made ImageJ 1.x more backwards-compatible than it wanted to be).

The latter purpose also includes hooks introduced by Fiji e.g. for
setting the application name, the window icon, or patching in the Script
Editor in place of the bare-bones text editor of ImageJ 1.x.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move Fiji's JavassistHelper#disassemble() into the CodeHacker

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Move Fiji's JavassistHelper#writeJar() into the CodeHacker

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add documentation for CodeHacker#disassemble

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add documentation for CodeHacker#writeJar

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
CodeHackerTest: clarify an assertion

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Hack bytecode verification into the CodeHacker

This is extremely hacky at the moment: it assumes that you have
a Fiji.app/ in your home directory and loads the ASM embedded in
Fiji's jruby.jar. This is extremely fragile and needs to be cleaned
up. However, in the interest of YAGNI, this commit does not do
that yet.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ij-legacy: add legacy plugins from $HOME/.plugins/

This is the first step to replace Fiji's FijiClassLoader: it looks
also in ~/.plugins/.

However, to test, and to be able to override, we also look at the
property 'ij1.plugin.dirs' which is interpreted as a PATH-style list
of directories. If this property is set, ~/.plugins/ is not looked
at automatically.

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