Updated: 3/13/2003; 2:20:44 PM.
IKVM.NET Weblog
The development of a Java VM for .NET
        

Friday, November 22, 2002
This weblog has moved to http://weblog.ikvm.net/

I tried to get Eclipse to run. This led to an interesting series of events:

  • I found that I didn't set the ProtectionDomain of a Class instance. Fixed.
  • I found that FileOutputStream in append mode didn't work. Fixed.
  • I found that Eclipse requires a 1.3.0 VM, but doesn't give any feedback whatsoever if the version isn't good enough. Workaround: ikvm -Djava.version=1.3.0
  • The bytecode compiler didn't implement migrating uninitialized object references into and out of try-blocks. Fixed.
  • The version of java.io.File.listFiles() that I used couldn't deal with the native method returning null. Fixed by getting the latest version from CVS.
  • Classpath's java.net.URL has bug where it doesn't try its own pool of protocol handlers, if a factory is installed, but the factory refuses a particular protocol. In order to fix this, I first had to update my Classpath code, to get the most recent URL code (it changed quite a bit, but the bug is still there).
  • After I got the latest version of Classpath from CVS, jikes would hang when compiling (it later turned out that jikes wasn't hanging, but that it was actually nAnt, but at that moment I suspected jikes).
  • I downloaded a new version of jikes, 1.18 (the version I was using was 1.15), generally tried as sorts of stupid things (including accidentally deleting my whole Classpath tree).
  • Not exactly sure why, but this whole exercize caused a number of bugs to appear when compiling classpath.dll. Here are some examples:
  • When this code is compiled by jikes 1.15:
    class Outer {
        private static class Inner {
            private Inner() {}
        }
        public static void main(String[] args) {
           new Inner() { };
        }
    }
    First of all, I don't why this is legal. IMO since the constructor of Inner is private, you shouldn't be able to instantiate in Outer, but Sun's 1.4 compiler compiles it, and so does jikes. However, jikes 1.15 actually emits code that calls the private constructor from the constructor of the anonymous class. This is clearly incorrect (and it is fixed in 1.18), but it took me a while before I had figured out what was going on. BTW, the "correct" compilation is to inject a synthetic constructor in Inner that accepts a reference to the Outer class (and has package accessibility).
  • jikes doesn't generate Miranda methods. Take the following class, for example:
    abstract class Foo implements Runnable {
        Foo() {
            run();
        }
    }
    This compiles (and is legal). When javac compiles this code, it inserts an public abstract void run() method into Foo, this method is called a Miranda method. Older VMs (probably in the 1.0 time frame) didn't think the class was valid without this method. Jikes doesn't do this and IK.VM.NET couldn't handle that. Fixed.
  • Access check for fields had a bug. java.awt.Component directly accesses the id field of several events, this is legal because in the java.awt.AWTEvent class the id field is declared protected (which also implies package accessibility). However, jikes 1.18 decided that the reference to the field should not be compiled as a reference to java.awt.AWTEvent.id, but to (e.g.) java.awt.event.ComponentEvent.id, perfectly legal, because the field is inherited, but the compiler incorrectly did the package accessibility check on the class name in the reference, instead of on the class name where the field is actually declared. Fixed.

At the moment I'm stuck on an exception that the .NET framework throws (when I'm compiling classpath.dll with ikvmc):

System.TypeLoadException: Method getBounds2D in type java.awt.Rectangle from assembly getBounds2D does not have an implementation.
   at System.Reflection.Emit.TypeBuilder.TermCreateClass(TypeToken handle, Module module)
   at System.Reflection.Emit.TypeBuilder.CreateType()

I have no idea why this happens. Interestingly enough, it doesn't happen when I compile with jikes 1.15.


3:45:26 PM    Comments

© Copyright 2003 Jeroen Frijters.
 
November 2002
Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Oct   Dec