This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Hash-table unavailable in compiled classes?


Hi,

I've run into a problem accessing hash-tables from within compiled
classes.  I have the following scheme module:

  (module-static #t)
  (require 'hash-table)

  (define-simple-class <SchemeTest> (<java.lang.Object>)

    ((test (number :: <java.lang.String>))
     :: <java.lang.String>
     (let ((hash (make-hash-table)))
        (hash-table-set! hash 1234 (<java.lang.String>:new "1234"))
        (hash-table-ref hash 1234))))

I compile this and attempt call the method 'test' from the following
Java main class:

  import java.lang.*;

  public class JavaTest {
     public static void main(String []args)  {
         SchemeTest scm = new SchemeTest();
         System.out.println("Test run: " + scm.test("1223") + "\n");
     }
  }

I get the following:

  Exception in thread "main" java.lang.ExceptionInInitializerError
        at SchemeTest.test(test-inline.scm:6)
        at JavaTest.main(JavaTest.java:7)
  Caused by: java.lang.NullPointerException
        at gnu.mapping.InheritingEnvironment.lookupInherited(InheritingEnvironment.java:72)
        at gnu.mapping.InheritingEnvironment.getLocation(InheritingEnvironment.java:100)
        at gnu.mapping.Environment.getLocation(Environment.java:117)
        at gnu.mapping.ThreadLocation.getLocation(ThreadLocation.java:99)
        at gnu.mapping.ThreadLocation.set(ThreadLocation.java:137)
        at gnu.kawa.slib.srfi69.run(srfi69.scm:30)
        at gnu.expr.ModuleBody.run(ModuleBody.java:44)
        at gnu.expr.ModuleBody.run(ModuleBody.java:32)
        at gnu.kawa.slib.srfi69.<clinit>(srfi69.scm:60)
        ... 2 more

Is this a bug or am I doing something wrong (again)?

Cheers,
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]