Teach JSONOutputStream about SezPoz-specific classes

There are exactly four SezPoz-specific classes we need to serialize:
SerAnnotatedElement, SerAnnConst, SerEnumConst and SerTypeConst. We
serialize those to JSON as maps, except for SerTypeConst for which
we write out the type name as a plain String.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Initial stab at a JSONInputStream

This is the counterpart for JSONOutputStream.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Teach JSONInputStream to deserialize SerAnnotatedElement instances

Since we write out SerAnnotatedElement instances as if they were maps,
when reading them back, we actually cannot know whether they are plain
maps or not.

Therefore, let's have a method that we call explicitly when we want a
SerAnnotatedElement.

Prepare this method already to handle the case we will introduce later,
for backwards-compatibility, where readObject() already returns an
instance of SerAnnotatedElement.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a unit test for the JSON input/output

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Teach JSONInputStream to fall back on ObjectInputStream

For backwards-compatibility, we need to handle annotations serialized with
previous SezPoz versions. For that reason, let's just look at the first
byte of the input stream and fall back to Java's deserialization if it
looks like a serialized object.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Prepare IndexItem to read JSON instead of serialized objects

When reading from a JSONInputStream, by necessity the fields' types are
not known before-hand, as e.g. a Class is serialized as its name (i.e.
as a String), and only when using the value in the proxy, it is apparent
what type it is actually expected to have.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Use JSONInputStream to deserialize annotations

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Serialize annotations as JSON

This helps SezPoz to be independent of the vagaries of the particular
class path library it is running with: Android's TreeMap, for example,
is incompatible to deserialize TreeMap instances serialized with
Oracle's Java class library.

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