As usual it took a mighty long time, but I finally managed to check in my changes
and create a new snapshot.
Here is what's new:
-
Support for @deprecated attribute in ikvmc. Compiled as System.ObsoleteAttribute
(IsError = false).
-
Support for declared exceptions. Reflection (Method.getExceptionTypes) will now return
all declared exceptions that the method throws. C# (or VB.NET or whatever) code can
use the OpenSystem.Java.ThrowsAttribute attribute to declare exceptions.
-
Changed value type handling to treat null reference as default instance when unboxing
(instead of throwing an unexpected NullPointerException). Added (experimental) support
for customized boxing in map.xml.
-
Remapped types can now have constant (non-blank static final) fields.
-
java.lang.String and java.lang.Throwable now have the correct serialVersionUID.
-
Fixed a bug (introduced with the ghost interfaces change) that caused virtual call
to Object.clone() to fail with a CloneNotSupportedException.
-
Changed static initializer support to use a special field (__<clinit>) in the
base class to trigger the base class static initializer to run (instead of using RuntimeHelpers.RunClassConstructor).
This should make static initialization a little faster.
-
Changed "managed JNI" method lookup to support overloading.
-
Made all introduced methods in ghost wrappers HideFromReflection.
-
Re-enabled the warning for missing native methods on static compilation.
-
Fixed reflection on .NET types to hide static methods on interfaces (Java doesn't
allow them).
-
Added dummy "native" methods for unused methods in java.lang.reflect.Proxy (to avoid
warnings from ikvmc when compiling classpath.dll).
-
Fixed InetAddress.getLocalHostname() method name typo.
-
Added skeleton implementation of "native" methods for java.nio.channels.FileChannelImpl.
-
Changed DupHelper in compiler to support "unitialized this" references.
-
Changed compiler to emit ldc_i4_0 / conv_i8 instead of ldc_8 0 and various similar
(small) optimizations.
-
Added support for declaring exceptions on methods of remapped types and
added appropriate declaration to map.xml.
-
Added experimental remapping of gnu.classpath.RawData to System.IntPtr and custom
boxing operator for gnu.classpath.RawData to box IntPtr.Zero to a null reference.
-
Added support for ldnull and box opcodes to remapping instruction
set.
-
Added optional constant attribute to field element of remapping
xml.
-
Added ikvm\classpath\java\lang\ref\Reference.java (copied from GNU Classpath and modified
to implement (most of) the required functionality).
-
Added exclusion list to compilation of classpath.dll to remove unused classes (VMObject,
VMString and VMThrowable).
-
Fixed netexp to create classes for non-public base classes.
-
Fixed netexp to export the interfaces a class implements.
-
Fixed netexp to export declared exceptions.
-
Some refactoring and a few small other changes.
I used Stuart's excellent japitools to test the
remapping, reflection and round-tripping and found a lot of bugs this way. I ran japize on
a classpath.jar generated by netexp from classpath.dll. This way, the
whole tool chain is tested (ikvmc -> reflection -> netexp).
Note that @deprecated doesn't round-trip, because Java reflection doesn't expose the
fact that something is deprecated.
The full patch is here (excluding
the new files, Reference.java and exclude.lst).
Updated binary and source snapshots
are available.