# Monday, July 18, 2005
IKVM 0.18 rc1

The previous release candidate 0.16 rc1 never actually made it to release because of a GNU Classpath showstopper bug. Thanks to Mark Wielaard for working hard to quickly do a follow up GNU Classpath release that fixes the problem and includes a number of other improvements. I haven't made many changes to IKVM in the mean time, the only major one being that I focussed some effort on reducing the size of the metadata of IKVM.GNU.Classpath (and as a side effect for most other ikvmc generated assemblies as well). I also switched to the Eclipse Java Compiler  because Jikes generates code that is incompatible with the new -strictfinalfieldsemantics ikvmc option.

Update japi results are available here.


  • Integrated GNU Classpath 0.17.
  • Switched to the Eclipse Java Compiler for compiling GNU Classpath (not just the generics branch).
  • Added optimization to only store source file name is the name differs from the class name + ".java"
  • Simplified and optimized inner class attribute metadata.
  • Added -strictfinalfieldsemantics option to ikvmc to generate more efficient (and 1.5 spec compliant) code. Note that this is not enabled by default for maximum compatibility with the Sun JVM (which isn't compliant with the 1.5 spec).
  • Rely less on HideFromJavaAttribute and more on naming conventions to use less metadata.
  • Changed ikvm.exe to ignore common -X options that java.exe supports.
  • Changed java.version system property to 1.4.1 to support Eclipse 3.1.
  • Added GNU Classpath version to ikvm.exe -version output.

Files are available here: ikvm- (sources + binaries), ikvmbin- (binaries)

Monday, July 18, 2005 10:09:06 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Friday, July 1, 2005
IKVM 0.16 rc1

GNU Classpath 0.16 was released yesterday, so I've made a new IKVM release based on it. An interesting new feature in this release is that you can now debug dynamically loaded Java classes in the June CTP of Visual Studio 2005. Note that this only works if you start your application in the Visual Studio debugger (at startup the IKVM runtime checks System.Diagnostics.Debugger.IsAttached to determine if it should emit debugging information or not).

Update japi results are available here.


  • Integrated GNU Classpath 0.16.
  • Fixed GC race condition for remapped exceptions (introduced in previous snapshot).
  • Added support for naming method/constructor parameters in map.xml.
  • Added support for attaching attributes to parameters in map.xml.
  • Named all method/constructor parameters in map.xml.
  • Changed ExceptionHelper.readObject to not convert ClassNotFoundException into IOException.
  • Named parameters for Cast, CastArray, IsInstance and IsInstanceArray methods in ghost structures.
  • Removed support for "deprecated" attribute in map.xml. Marking methods deprecated in map.xml can now be done by applying the System.ObsoleteAttribute attribute.
  • Removed support for "hidefromjava" attribute in map.xml. Marking methods HideFromJava in map.xml can now be done by applying the IKVM.Attributes.HideFromJavaAttribute attribute.
  • Instancehelper methods on java.lang.String are no longer EditorBrowable(Never).
  • Only emit method parameter names for public/protected methods in public types.
  • Interface methods and methods that don't have debug info now get synthesized parameter names.
  • A couple of "random" awt fixes.
  • Added support for P/Invoke (DllImportAttribute).
  • Moved ikvmc specific compiler support to AotTypeWrapper class.
  • Fixed member access checks (for real this time).
  • Moved native methods of FileChannelImpl and MappedByteBufferImpl from IKVM.Runtime to IKVM.GNU.Classpath (using P/Invoke from Java).
  • Added -fileversion option to ikvmc to set the unmanaged file version.
  • Added call to AssemblyBuilder.DefineVersionInfoResource() to ikvmc, so that a version info resource is now automatically created (the contents are based on the various assembly attributes and the -version and -fileversion options).
  • Fixed possible (but unlikely) NullReferenceException in ClassLoaderWrapper.FinishAll() when it encounters a type that cannot be finished for some reason.
  • Made the line number table encoding a little more efficient.
  • Changed build process to support building the GNU Classpath generics branch (in addition to the main branch).
  • Added a hack to ikvmstub to export generic type instantiations. This enables a usable mscorlib.jar to be generated from the 2.0 version of mscorlib.dll.
  • Implement reversible name mangling for .NET type names (to handle generic type instantiations).
  • Fixed name mangling for delegate inner classes.
  • Set DebuggableAttribute to assembly before creating the module, to make sure Visual Studio (Whidbey) picks up the attribute when debugging dynamically generated code.
    Fixed possible System.ArgumentException in Class.forName() (when trying to load a class with a name that is invalid in .NET)
  • Fixed JNI_GetCreatedJavaVMs to accept null pointer for nVMs.
  • Fixed class name in error message for VerifyError that occurs when overriding a final method.
  • Added workaround to make dynamic debugging work in Whidbey June CTP.

Files are available here: ikvm- (sources + binaries), ikvmbin- (binaries)

Friday, July 1, 2005 12:47:52 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Wednesday, June 29, 2005
The Eclipse Java Compiler

For the past three years I've been using the Jikes compiler to build GNU Classpath, but unfortunately Jikes development isn't very active anymore. I wanted to start playing with the GNU Classpath generics branch (the branch that contains the classes that require 1.5 specific language features), so I needed a compiler that could compile the generics branch and was freely available. The Eclipse Java Compiler was the obvious choice and while I ran into two bugs when I tried to compile the generics branch, the bugs were fixed within hours after I filed them, that kind of responsiveness is confidence inspiring.

The next IKVM release (hopefully due next week) will still be built with Jikes, but future releases will most likely be built with the Eclipse Java Compiler. To make this easier I've used ikvmc to compile it to ecj.exe and created a Windows installer that installs ecj.exe and adds IKVM.GNU.Classpath.dll and IKVM.Runtime.dll to the Global Assembly Cache. If you're not on Windows, you can download ecj.exe in this zipfile. Note that ecj.exe requires Mono or later.

Wednesday, June 29, 2005 2:51:00 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Thursday, June 23, 2005
PDC '05

From September 13 thru 16 I'll be in Los Angeles for the Microsoft Professional Developer Conference.

If anyone wants to meet up and hang out or chat, drop me a note.

Thursday, June 23, 2005 3:56:19 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Monday, May 23, 2005
New Snapshot

Partial Trust

I did some research into supporting partial trust and it looks like it might be feasible. This snapshot already contains some changes to better support running in partial trust (particularly for IKVM.GNU.Classpath, IKVM.Runtime contains unsafe code so it currently needs to be trusted). On .NET 1.1 non of the built in partial trust permission sets are suitable, because I require ReflectionPermission(ReflectionPermissionFlag.TypeInformation). In Whidbey this permission flag is deprecated, so the story looks more promissing there.

One of the consequences of adding partial trust support is that IKVM.Runtime.dll will need to be split into several parts. At the very least the JNI implementation will need to be in a separate assembly, so that the common non-JNI scenarios won't require SkipVerification permission.

Exception Handling

I made some major changes to exception handling in this version. However, for Java code nothing should change (except that it hopefully runs a little bit faster), but for .NET/Java interop there are some important changes:

  • Exceptions generated by the CLR or .NET code (e.g. System.NullReferenceException) will no longer be changed into their Java equivalents for non-Java code. This means that when you catch an exception in IKVM Java code, you'll still see the corresponding Java exception (e.g. java.lang.NullPointerException), but when you rethrow the exception, the original exception gets thrown.
  • When Java code explicitly throws a .NET exception (e.g. System.NullReferenceException) it is no longer remapped to the Java equivalent.
  • Catching exceptions now faithfully corresponds to the IKVM type system. This means that you can now use catch(cli.System.Exception) to catch the unremapped .NET exceptions.

This is a major step towards my ultimate vision for exception handling, but I'm not nearly there yet. Other changes I want to make include adding more exception state to java.lang.Throwable instead of the WeakHashMap construct that is currently used (the WeakHashMap will still be required to associate the .NET exceptions with their remapped Java exceptions). I also want to use exception filters to check for remapped exceptions, to make the debugging experience better and the bytecode compiler needs to be improved to recognize try {} finally {} constructs so that they can be compiled as .NET try {} finally {} blocks, instead of the currently used and vastly less efficient try {} catch() { throw; }.

Other News

Mark Proctor reports that Drools runs on IKVM.


  • Sync'ed with GNU Classpath cvs.
  • Removed VMClass.forName() implementation (rely on standard implementation instead).
  • Fixed ikvmc to ignore directories in jars.
  • Added "isStatic" parameter to JNI methods ToReflectedMethod and ToReflectedField (this parameter is missing in the JNI specification, but exists in the Sun implementation).
  • Removed workaround for previously unimplemented MethodBase.GetMethodFromHandle in Mono from JNI code.
  • Removed workaround for previously broken GCHandle.IsAllocated in Mono.
  • Removed workaround for previously broken Assembly.GetTypes() in Mono.
  • Disabled finalizer in MemberWrapper (since code unloading isn't supported, members will never be finalized anyway).
  • Added MirandaMethod to MemberFlags.
  • Fixed cosmetic bug in verifier that caused unloadable array types to be named incorrectly.
  • Implemented 1.5 java.lang.String methods (except String.format()).
  • Added ldsfld instruction support to remapper.
  • Implemented ikvmc -compressresources option, to use a simple compression algorithm for resources.
  • Classpath locale information is now in *.properties files instead of classes with resource compression this shaves a couple of hundred KB of the size of IKVM.GNU.Classpath.
  • Many changes to exception handling to improve performance, compatibility and consistency.
  • Added EditorBrowsable(Never) attribute to helper methods in java.lang.Throwable.
  • Fixed method "cloaking" (i.e. hiding .NET methods on Java types in IntelliSense) to hide inherited static methods as well.
  • Various fixes to work towards supporting running in partial trust.
  • Fixed ikvmc bug that caused it to run Java code when tracing was enabled.
  • Added support for applying CodeAccessSecurityAttribute derived attributes (although not at the assembly level yet).
  • Fixed a Miranda bug that caused incorrect classes to be generated for abstract classes implementing java.lang.Comparable but not implementing compareTo.
  • Implemented support for applying attributes to methods/fields defined in map.xml.
  • Changed reflection to disallow reflecting on IKVM.Runtime types (to avoid potential security holes, where Java code can access internal members of IKVM.Runtime).
  • Enabled generation of debug info when a debugger is attached (at the time the runtime is initializing), to allow debugging of dynamically generated code (a Whidbey feature, although in beta 2 it doesn't work yet).
  • Added check to ikvmc to make sure that referenced ikvmc-generated assemblies were compiled with the same version of the ikvm runtime.

New snapshots: just the binaries and source plus binaries.

Monday, May 23, 2005 11:31:14 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Wednesday, May 18, 2005
Cross Language Debugging in MonoDevelop

Lluis Sánchez posted some cool screencasts that demo cross language debugging in MonoDevelop [via Miguel de Icaza].

Wednesday, May 18, 2005 2:16:45 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [1]
# Wednesday, May 11, 2005
IKVM 0.14 Released

I released 0.14 and put the files up on SourceForge. The bits are identical to Monday's rc2.

Wednesday, May 11, 2005 2:43:20 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [1]
# Monday, May 9, 2005

There's been a lot of confusion about Harmony in the last couple of days. I don't pretend to speak on behalf of the project, but I wanted to give my take on it.

The primary goal of Harmony is to create a J2SE 5 implementation under the Apache License. Many people have interpreted this as meaning that the ASF would start building a JVM and class library from scratch, but that's not the intention at all (although it is a possible worst case scenario). Talks are ongoing between the FSF and ASF to try and work together to change the GNU Classpath license to be compatible with the Apache License. In this light it is important to note that GNU Classpath is already licensed under a modified version the GPL that is more liberal to attract more developers and users. Another thing to note is that the FSF owns all copyright on GNU Classpath (each individual contributor signs over their copyright to the FSF), so the FSF can relatively easily change the license of GNU Classpath (or, for example, dual license it).

In his "Fork in the Open Source Java world" blog entry (a title I obviously disagree with) Miguel argues that the GPL may be a liability instead of an asset for some open source projects. I tend to agree with his view, the GPL and the FSF activism scare many people away, and even with a more liberal license there exist strong motivational factors for companies to work with the community instead of forking a large project and improving only their private version.

As for the pretentious name, all I can say is that I had nothing to do with that :-)

Update: Mark Wielaard corrects me:

And just to correct a little information in Jeroen's latest blog. The FSF/ASF talks are about the general (L)GPL/ASL 2.0 incompatabilities. We do hope to finally solve those since most of them are just legal technicalities and misunderstandings/misinterpretations. (This is something I think is of even more value then this new harmony project).

The current exception statement to the GPL used by GNU Classpath is compatible with and acceptable to the Apache community. But the FSF did say that IF the exception statement was in any way unclear THEN they would certainly be willing to clarify it so that there was no obstacle for adoption of GNU Classpath. There currently doesn't seem any need to do this though.

Monday, May 9, 2005 10:05:34 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
Release Candidate 2

Thanks to M. David Peterson for reporting a regression in rc1. I fixed that and created rc2.


ikvm-0.14-rc2.zip  (source + binaries)
ikvmbin-0.14-rc2.zip   (binaries)


  • Fixed regression in member access check that caused public members inherited from a non-public base class in a different package not to be accessible.
  • Merged ikvm-native FreeBSD compilation fixes from Mono's svn back in.
  • Updated all assembly versions to (including JVM.DLL that I forgot in rc1).
Monday, May 9, 2005 9:24:36 AM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Monday, May 2, 2005
IKVM 0.14 rc1
GNU Classpath 0.15 was released yesterday, so based on that I'm releasing a new version of IKVM. Besides the many improvements to GNU Classpath, there have been a bunch of IKVM fixes and two major new features: support for defining .NET properties and for applying .NET attributes. Both these features are controlled via the xml remap file. Here's an example Java class with corresponding xml file:
public class IntList
  private int[] list;
  public IntList(int size)
    list = new int[size];
  public void setItem(int index, int value)
    list[index] = value;
  public int getItem(int index)
    return list[index];
<?xml version="1.0" encoding="utf-8" ?>
     <class name="IntList">
       <attribute type="System.Reflection.DefaultMemberAttribute, mscorlib" sig="(Ljava.lang.String;)V">
       <property name="Item" sig="(I)I">
         <getter name="getItem" sig="(I)I" />
         <setter name="setItem" sig="(II)V" />

When IntList.java is compiled to IntList.class and then ikvmc'ed using:

   ikvmc IntList.class -remap:IntList.xml

The resulting IntList.dll will be usable from C# like this:

   IntList l = new IntList(10);
   l[4] = 42;

Valdemar Mejstad created a tool to automatically generate the xml to define properties based on Java's java.beans.BeanInfo. The source is available here: MapFileGenerator.java.


ikvm-0.14-rc1.zip  (source + binaries)
ikvmbin-0.14-rc1.zip   (binaries)


  • Integrated GNU Classpath 0.15 release
  • Dropped support for Mono 1.0.x, because Mono 1.1.x is now the recommended (by the Mono team) version to use.
  • Made some optimizations to System.arraycopy().
  • Removed the previously deprecated ikvm.lang.ByteArrayHack class.
  • Merged fixes to gnu.java.nio.channels.FileChannelImpl from Classpath.
  • Added CLR "bitness" (32 or 64) to ikvm -version output.
  • Fixed ByteCodeHelper.DynamicCast() and ByteCodeHelper.DynamicInstance() to handle null references properly (always succeed/fail the cast/instanceof, without trying to load the type).
  • Changed os.arch for "AMD64" to "amd64" to match JDK.
  • Added sun.arch.data.model system property.
  • Fixed VMThread.suspend()/resume() to not throw exceptions if invalid calls are done.
  • Fixed VMThread.stop() to better handle suspended threads.
  • Fixed a bug in invocation of JNI_OnLoad (if the method exited with a pending exception, the exception wasn't dispatched).
  • Added GC.KeepAlive() to FileChannelImpl.flush() to make sure the file channel isn't GCed (and thus closed) while the native method is running.
  • Fixed verifier to correctly identify stack overflows when double/long values are involved.
  • Fixed verifier to reject empty try blocks.
  • Fixed bug in VMTimeZone.inDaylightTime() [Fix by Alexander Zuev].
  • Fixed a whole bunch of bugs in java.lang.reflect.Field [Reported by Alexander Zuev].
  • Created two subclasses of CompiledTypeWrapper to handle the special cases for remapped and ghost type to make the normal types more efficient.
  • Added a micro optimization to FieldWrapper to avoid having to call FieldInfo.IsLiteral on each reflective field access, because FieldInfo.IsLiteral turns out to be quite expensive on the Microsoft CLR.
  • Removed -monoBugWorkaround switch from IKVM.GNU.Classpath.dll build script, since Mono 1.1.4 and later no longer require it.
  • Fixed bug in protected member access check (it was too strict, requiring the referenced class to be visible).
  • Improved error message when core library doesn't match runtime version.
  • Implemented memory mapped I/O.
  • Added support for defining properties through map.xml file.
  • Added check to ikvmc to prevent signing assemblies that reference unsigned assemblies.
  • Added support for adding custom attributes to assembly, classes, fields, methods and constructors in the map.xml file.
  • Removed -enabletls option from ikvmc (fields can now be marked as thread local by adding a custom attribute).
  • Added AssemblyCopyrightAttribute to IKVM.GNU.Classpath.dll.
  • Fixed a bug in .NET type reflection handling of explicit method implementations.
  • Fixed bug in JNI return value marshaling for methods with boolean return type.
  • Fixed NullReferenceException bug when compiling class with native finalize method.
  • Fixed JNI to continue to work during "finalization for exit".
  • Implemented System.runFinalizersOnExit(boolean). By default, Java finalizers no longer run at application exit.
Monday, May 2, 2005 2:39:33 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]