lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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