This is the mail archive of the kawa@sources.redhat.com 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]

Re: Exception when calling fn. using for-each in Java


Jocelyn Paine wrote:

> ... Tentative hypothesis: when Kawa compiles a 'for-each', it generates some
> kind of initialisation code which needs to be executed when the function
> is called for the first time. This is automatic when calling from Kawa,
> but not from Java. Any suggestions?

I think you're right when you say that there is an automatic initialisation
when called from Kawa. When you load or require the class test, Kawa
execute the method test.run. I think you should try to add in your code
something like that (correct me if I'm wrong):
...
  public class test1
  {
    static {        // add that
       test.run(); //
    }                //

    public static final void main( String[] argv )
    {
      System.out.println( test.pairToVector(null) );
    }
  }

The lines "static {...}" are executed when java classload load the class test1.

Manu

PS : I am eager to know if it really works



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