[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJava - LuaWrapperBuilder vs Java2 Verifier
- From: Carlos Cassino <cassino@...>
- Date: Thu, 24 Aug 2000 14:35:21 -0300 (EST)
Hi Aaron.
> [...] The
> exception's msg isn't accurate, but I don't see how lref can become
> null...
The structure:
if( lref == null )
{
super.thisMethod(someArguments);
return;
}
else
{
... // do actual work
}
is actually needed because the first thing Java does to initialize an
object is a call to super(...) and, while executing it, lref does have
the null value. That way, if the constructor of the superclass calls any
(non-private) method, the check must be there. As a matter of fact, it's
not possible to set lref before calling the super's constructor since it
is a field introduced by the subclass.
> I'm sure that there is probably a better fix for this problem...
> anyone?
The missing:
> if (!is_interface && !is_abstract) {
is my mistake and introducing it is the right fix. Regarding the "else"-
part, the same explanation applies but I can't see a better way: since
lref can't be assigned before running super(), there is no (polite) way
to create a Lua extention of a class which calls an abstract method from
it's constructor. Maybe this could be the message...
I'll fix that in the current version, add the property-driven file creation
as you did, and put it on the site.
Thank you!
-- Cassino