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]

A Boolean inside a subclass of a subclass of Thread is null when accessed from run().




This error is a bit weird, but hopefully I'm just doing something crazy.


When running the program posted at the end of this mail, I get the following error:

"
kjetil@ttleush ~/hurtigmixer/src/boolbug $ kawa test.scm
isplaying=null
Exception in thread "Thread-1" java.lang.NullPointerException
        at AThread.getData(AThread.java:21)
        at BThread.run(AThread.java:9)
"



The weird thing about this is that the variable "isplaying" is a Boolean
initialized to false in the class AThread:
"private Boolean isplaying=true;"

(Needless to say, I don't get this error if just making an AThread instance from java instead of kawa.)

I can probably work around the error somehow, but any help would be
appreciated. Thanks.



Here is the java file called AThread.java stripped down as much as possible:
"
import java.util.*;
class BThread extends Thread{
public void getData(){
System.out.println("I am not called");
}
public void run(){
getData();
}
public BThread(){
start();
}
}
public class AThread extends BThread{
private Boolean isplaying=true;
public void getData(){
System.out.println("isplaying="+isplaying);
if(isplaying==true){
System.out.println("This is never displayed");
}
}
}
"


And here is my file test.scm:
"
(<AThread>)
"



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