# Friday, 27 September 2002
No Title

More small changes:

  • Many more class file validation checks added
  • Cleaned up the starter executable ikvm and added support to run jars.
  • Fixed some bugs in NetExp
  • Fixed some bugs in stack trace handling
  • Added support for classes that implement interfaces without actually implementing the interface methods

Updated the binaries and source snaphots.

Friday, 27 September 2002 17:57:38 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Monday, 23 September 2002
No Title

Many small changes, mostly to deal with incorrect class files and a few bug fixes:

  • Java threads now inherit their name from the .NET thread (for threads that aren't created in Java) and threads that are created in Java, set the name of the .NET thread to their Java name
  • JNI methods that do not exist now throw UnsatifiedLinkError
  • Added more checks to class file reader
  • Added the JavaException helper class to centralize all the dynamic exception creation (for things like NoClassDefFoundError, VerifyError, IncompatibleClassChangeError, etc.)
  • Improved stack trace handling for inner exceptions
  • Enforced access checks for base classes and interfaces
  • Added checks to enforce that base class is not an interface and checks to ensure implemented interfaces are in fact interfaces
  • Added check to prevent subclassing final classes
  • Fixed doubleToLongBits to return normalized NaN and implemented doubleToRawLongBits
  • Added support for calling interface methods on object references (required because it sometimes isn't possible to merge interface types, so the merged type will be Object), also added support for calling Object methods through invokeinterface.
  • Ported Java DoubleToString class (written by Jack Shirazi) that (hopefully) correctly converts a double to its string representation
  • Added support for abstract methods in non-abstract classes (which the JVM apparently allows)

Updated the binaries and source snaphots.

Monday, 23 September 2002 12:38:26 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Thursday, 12 September 2002
No Title

Fun with method overriding

Given the following three classes:

package p1;

public class c1
{
  
public static void main(String[] args)
   {
      c1 o =
new c2();
      o.m1();
      o.m2();

      o = new c3();
      o.m1();
      o.m2();
   }

   public void m1()
   {
     
System.out.println("c1.m1");
   }

   void m2()
   {
     
System.out.println("c1.m2");
   }
}

public class c3 extends c2
{
  
public void m1()
  
{
     
System.out.println("c3.m1");
  
}

   void m2()
  
{
     
System.out.println("c3.m2");
  
}
}


package p2;

public class c2 extends c1
{
  
void m1()
  
{
     
System.out.println("c2.m1");
   }

   private void m2()
  
{
     
System.out.println("c2.m2");
  
}
}

What will be the output when running p1.c1? (note that javac will not compile this code as is, but it is possible to create the resulting class files with javac by temporarily changing the sources and then recompiling the individual classes, but for convenience I've provided the equivalent code in Jasmin source).

The output is (using Sun's JDK 1.4.0 with the -Xfuture switch to enforce accessibility checking):
c2.m1
c1.m2
c2.m1
c3.m2

What does this mean?

  • It's possible to override a public method with a package private method (c1.m1 is overridden by c2.m1)
  • A private method never overrides another method (making c1.m2 public doesn't make any difference)
  • Private methods don't get in the way when finding methods to override (c3.m2 overrides c1.m2, even though c2.m2 is "in the way")

Some other things I found:

  • When invokespecial p1/c1/m2()V is added to c3.m2, it calls the private method c2.m2
  • It isn't possible to override c3.m1 in another package, even though the original method (c1.m1) is public

I implemented support for these behaviours (except the ability to call private methods from outside of the class). It's also interesting to note that none of this is described in the JVM spec.

Fixed various bugs introduced by the classloader support.

Updated the binaries and source snaphots.

Thursday, 12 September 2002 12:05:55 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Monday, 09 September 2002
No Title

Major changes. Big step towards multiple classloader support. The starter app now depends on classpath.dll and creates it's own (trivial) custom classloader (derived from URLClassLoader), so it now supports loading classes from zips and jars (courtesy of Classpath's URLClassLoader).

Note that this means that Java code that uses a custom classloader to dynamically generate classes (using ClassLoader.defineClass) should work now.

There is still some work to be done, because all the classloaders still shares a single namespace. Also, exception (and general error) handling isn't quite ready yet, either.

Updated the binaries and source snaphots.

Monday, 09 September 2002 17:02:51 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
# Thursday, 05 September 2002
No Title

Generics

Yesterday, Microsoft Research released a beta version of Gyro, which is their implementation of generics for Rotor.

I downloaded it this morning and played with it, and I must say, it's great! This is going to be the killer feature for .NET (once the commercial platform gets it). Unlike the platform that starts with a J, this is actually done right. The Java generics proposal that was floated for 1.4 and then withdrawn was an ugly (nay, disgusting) hack. Gyro is beautiful, I have no other word for it.

I can't wait for this to appear in the commercial platform!

Thursday, 05 September 2002 18:43:29 (W. Europe Daylight Time, UTC+02:00)  #    Comments [3]
# Tuesday, 03 September 2002
No Title

I did some work to get my database server app working. I implemented rudimentary socket support and some very lame AWT stuff. My database server now runs (including its lame GUI). Also fixed a few bugs (among others, support for long & double volatiles, thanks to Richard Birkby for pointing this out to me).

Since I built the AWT in C#, linking it against classpath.dll, building is becoming a little more tricky. Hopefully I'll be able to make the build process more straight forward in the future, but for the time being you'll have to suffer ;-)

Updated the binaries and source snaphots.

Tuesday, 03 September 2002 19:19:30 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]