Exceptions problem

Date view Thread view Subject view Author view

From: Archie Cobbs (archie@whistle.com)
Date: Mon Dec 21 1998 - 21:12:12 EST


Kaffe and Jikes just don't work when it comes to exceptions..
Consider this input file:

    public class Foo {
      public static void main(String[] args) {
        Object o = null;
        int x;
        try {
          x = o.hashCode();
        } catch (Exception e) {
        }
      }
    }

Jikes produces this class file (also attached in binary to this email):

    Compiled from Foo.java
    public synchronized class Foo extends java.lang.Object
        /* ACC_SUPER bit set */
    {
        public static void main(java.lang.String[]);
        public Foo();
    }

    Method void main(java.lang.String[])
       0 aconst_null
       1 astore_1
       2 aload_1
       3 invokevirtual #12 <Method int hashCode()>
       6 istore_2
       7 goto 15
      10 nop
      11 astore_3
      12 goto 15
      15 nop
      16 return
    Exception table:
       from to target type
         2 10 11 <Class java.lang.Exception>

    Method Foo()
       0 aload_0
       1 invokespecial #18 <Method java.lang.Object()>
       4 return

But running kaffe produces this output:

    java.lang.NullPointerException
        at Foo.main(6)

What gives?? The class file appears to be correct from what I can tell.

-Archie

___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com



Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:27 EDT