Add API to the CodeHacker to guard casts

Casts are inherently unsafe and must be guarded by verifying that the
object to be cast can actually be cast to the target type. This commit
adds a function to assign null instead of throwing ClassCastExceptions
for ungarded casts.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Help ImageJ 1.x avoid an invalid cast

There are so many different code paths to do essentially the same:
create an image and an image window. At least one of those code paths
ends up with a composite image that does not have StackWindow but a
plain ImageWindow.

This happenes e.g. when Fiji's sample image loader uses SCIFIO to load a
16-bit image, as reported by Stefano Ciciliot in
http://fiji.sc/bugzilla/show_bug.cgi?id=813.

ImageJ 1.x is not very careful there and just assumes that every
composite window must have a composite window and casts the window to a
StackWindow to ask whether it has the correct dimensions.

Let's give ImageJ 1.x some help here.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a regression test for the patch avoiding the ClassCastException

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Avoid showing newly-created StackWindows in batch mode

This change mainly helps the just-added regression test to run without
displaying an image.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge branch 'avoid-class-cast-exception'

This topic branch mainly adds code to help ImageJ 1.x avoid a
class cast exception reported by Stefano Ciciliot in
http://fiji.sc/bugzilla/show_bug.cgi?id=813.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge remote-tracking branch 'origin/master'
Bump to newest parent version

... has been a while since we updated...

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