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: A Boolean inside a subclass of a subclass of Thread is null when accessed from run().


Kjetil S. Matheussen wrote:
Thanks! Changing to boolean fixed it. I didn't know about boolean. But I wonder something fishy may be going on anyway?

Yes. Your Java program is undefined. You're calling start from a Thread's constructor. Don't do that. In this case, you're creating a new thread in the super-class constructor, when then calls getData. At the "same time" the original thread returns from the superclass constructor, and continues the derived constructor, which means initializing the isplaying field. So it is undefined whether the isplaying field is set before or after it is accessed.

1) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2]

didn't compile and gave error about the Boolean/boolean mixup.

Yes, because the auto-conversion ("boxing") from boolean to Boolean is a Java 5 feature. -- --Per Bothner per@bothner.com http://per.bothner.com/


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