[Gambas-user] Overriding native classess

Bruce bbruen at ...2308...
Mon Dec 16 02:01:40 CET 2013


On Mon, 2013-12-16 at 00:49 +0100, Benoît Minisini wrote:
> Le 16/12/2013 00:36, Bruce a écrit :
> > I've got myself in a real mess with this one. :-(
> >
> > I have a class in a local ("third-party") component that inherits the
> > native Application class. It provides some generic setup stuff, database
> > connectivity across networks and some basic security. It works fine and
> > has done so for a few years.
> >
> > Now I have a need to override the Application class itself in a project
> > that uses this component (to provide an additional property which is a
> > collection of gb.logging Logger objects.) The new Application class uses
> > an _init() method to set up these logs.
> >
> > When I run the project through the IDE, it starts and the stack
> > backtrace panel shows "(native code)" and execution just stops. It
> > doesn't hang or anything, it just stops as if it hit a debugging
> > breakpoint. There is no further information. If I then continue
> > execution (via F5 ) the program just ends. No errors, nothing.
> >
> > I realise that the problem is caused by this mixing of overriding and
> > inheriting the native Application class. My problem is that I can't see
> > where to start looking for a solution.
> >
> > So,
> > Is this mixing of inheritance and overrides on native classes "illegal"?
> > (If not) Does anyone know what is going on inside this "native code" at
> > the point of program startup?
> >
> > tia
> > Bruce
> >
> >
> 
> Without the source code, hard to say.

Yes, I expected that :-) I had started to simplify up an example and in
the course of doing that finally got the error balloon that I was,
unfortunately, expecting: "Overriding an already inherited class is
forbidden".
Oh well, that component was overdue for a "major grease and oil change"
anyway to take advantage of stuff that wasn't around when it was
originally written.

> Usually the depicted behaviour is an error returned by the debugger not 
> displayed by the IDE, because it is raised "too early" (when 
> initializing classes).
> 
What was interesting was that the error still occurs when there is no
code that references the component, it's only reference was in the
project properties (i.e. it is still in the .project and .startup
files). Is that expected?

B






More information about the User mailing list