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]

Re: "unbound location string->number"


Hi, 

I've done some more investigation on this and there's definitely
something funny going on.  To test I've created the following Scheme
and Java classes:

;; test-inline.scm

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

     ((decode (number :: <java.lang.String>))
      :: <java.lang.Integer>
      (let ((num (string->number "1234")))
        (<java.lang.Integer>:new num))))



// JavaTest.java

  import java.lang.*;
  import au.com.isay.test.SchemeTest;
  
  public class JavaTest {
    public static void main(String []args)  {
      SchemeTest scm = new SchemeTest();
      System.out.println("Test run: " + scm.decode("1234") + "\n");
    }
  }


# Compile                     
  
  /opt/kawa-snapshot/bin/kawa -P au.com.isay.test. -C test-inline.scm
  javac -classpath . JavaTest.java
                        

This results in a compilation error:

  JavaTest.java:7: cannot find symbol
  symbol  : constructor SchemeTest()
  location: class au.com.isay.test.SchemeTest
         SchemeTest scm = new SchemeTest();

Looking at the javap output we get this:

  Compiled from "test-inline.scm"
  public class au.com.isay.test.SchemeTest extends java.lang.Object{
      au.com.isay.test.test$Mninline this$0;
      public java.lang.Integer decode(java.lang.String);
      public au.com.isay.test.SchemeTest(au.com.isay.test.test$Mninline);
  }


However if I remove the (string->number) call the default constructor
is created.

This is using the SVN version; using the released version it builds
with warnings but fails at runtime with:

  Exception in thread "main" 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:85)
        at gnu.mapping.ThreadLocation.get(ThreadLocation.java:118)
        at gnu.mapping.Location.get(Location.java:65)
        at au.com.isay.test.SchemeTest.decode(test-inline.scm:6)
        at JavaTest.main(JavaTest.java:8)

Does anyone have any suggestions?

Cheers,
Steve


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