Implement Class#getDeclaredClasses

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Fix NPE in Field#getAnnotation

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Initialize the context class loader to the app class loader

Previously, we initialized it to the boot class loader, but that is
inconsistent with Java; if compiling against OpenJDK's class library,
the context class loader is therefore initialized to the app class
loader, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Set File.pathSeparator and File.separator

Many Java programs expect those fields to be initialized to non-null
values, including SCIFIO (http://scif.io/).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Initialize Logger instances to the 'INFO' level by default

... otherwise, logging would throw an exception when trying to
determine whether the current level allows the message to be logged.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Support Logger#log(Level,String,Object)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Add a dummy implementation of EmptyStackException

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Implement the Math#signum method

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Implement a Java-compatible ObjectOutputStream

The Java Language Specification documents the serialization protocol
implemented by this change set:

http://docs.oracle.com/javase/7/docs/platform/serialization/spec/protocol.html#10258

This change is intended to make it easier to use Avian VM as a drop-in
replacement for the Oracle JVM when serializing objects.

The previous serialization code is still available as
avian.LegacyObjectOutputStream.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Implement the Field#set<PrimitiveType> method family

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Make ObjectOutputStream's constants available to java.io

We will reuse the constants in the upcoming deserialization counterpart.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Implement a rudimentary Java-compatible ObjectInputStream

The Java Language Specification documents the serialization protocol
implemented by this change set:

http://docs.oracle.com/javase/7/docs/platform/serialization/spec/protocol.html#10258

This change is intended to make it easier to use Avian VM as a drop-in
replacement for the Oracle JVM when serializing objects.

The previous serialization code is still available as
avian.LegacyObjectInputStream.

This commit only implements the non-object parts of the deserialization
specification.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ObjectInputStream: add rudimentary support for objects

This is by no means a complete support for the deserialization compliant
to the Java Language Specification, but it is better to add the support
incrementally, for better readability of the commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Test the new, Java-compatible (de)serialization

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ObjectInputStream: handle fields of type String

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Fix java.lang.reflect.Field.getLong()

The bug was that the long was cast to an int, cutting off the most
significant bytes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ObjectOutputStream: optimize String serialization

The serialization protocol specifies a quick method to serialize
a String (because that is so common an operation): TC_STRING +
(short)length + bytes. Let's use that, also to make it easier to test
the upcoming changes to TreeMap harmonizing that Avian's serialization
of said class with OpenJDK's.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ObjectOutputStream: use private writeObject() methods

The specification of the Java serialization demands that a private
writeObject(ObjectOutputStream) method is used -- if it exists. In that
case, ObjectOutputStream must not write the contents of the fields
(called 'classdata[]' in the documentation) but offer that via the
defaultWriteObject() method.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
ObjectInputStream: use private readObject() methods

The specification of the Java deserialization demands that a private
readObject(ObjectOutputStream) method is used -- if it exists. In
that case, ObjectInputStream must not initialize the contents of the
fields (called 'classdata[]' in the documentation) but offer that
functionality via the defaultReadObject() method.

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