The purpose of super() in a NetRexx constructor

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The purpose of super() in a NetRexx constructor

Thomas.Schneider.Wien
Hello there,
   I do have a specific NetRexx question where I cannot find a solution
by myself.


I do have the follwoing call structure
   class Lang
      class Tokens extends Lang
          class InLine extends Tokens
              class Scan extends InLine
                 class InItem extends Scan
                     class InExpr (including InTerm) extends InItem
   class InDecl extends Scan uses InExpr InItem
   class InClause (including Parser) extends  Scan uses InDecl

   class ProcessOneFile (executes InClause.Parser)

Up to Scan everything works correct.
Now, when calling the Parser, the main Program aborts in
   
    at org.netrexx.rey.in.InItem.<init>(InItem.nrx) with a null pointer
exception,where
it should NOT (no Null item involved).

I'm now investigating to use super() in the InItem sonstructor, but
cannot find the doc
what this would imply.

What I actually want is that InItem and InExpr construct a Scan Object,
and *NOT* an own Object...

As I do have a similar problem with other classes as well, I would like
to have this clarified
before I do further look into this -maybe very specific- problem!

Any advise whar the functionality of super() actually is, and what it is
used for, wand when it should be used?

Thanks in advance :-)
Thomas Schneider.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)
Reply | Threaded
Open this post in threaded view
|

Re: The purpose of super() in a NetRexx constructor

rvjansen
To quote nrl:

All constructors follow the same rules as other methods, and in addition:
1.Constructor calls always include parentheses in the syntax, even if
no arguments are supplied. This distinguishes them from a reference to
the type of the same name.
2.Constructors must call a constructor of their superclass (the class
they extend) before they carry out any initialization of their own.
This is so any initialization carried out by the superclass takes
place, and at the appropriate moment. Only after this call is complete
can they make any reference to the special words this or super (see
page 129).
Therefore, the first instruction in a constructor must be either a
call to the superclass, using the special constructor super() (with
optional arguments), or a call to to another constructor in the same
class, using the special constructor this() (with optional arguments).
In the latter case, eventually a constructor that explicitly calls
super() will be invoked and the chain of local constructor calls ends.
As a convenience, NetRexx will add a default call to super(), with no
arguments, if the first instruction in a constructor is not a call to
this() or super().
3.The properties of a constructed value are initialized, in the order
given in the program, after the call to super() (whether implicit or
explicit).

I'd suggest just to trace where the null pointer exception stems from.

best regards,

René

On Wed, Apr 28, 2010 at 7:09 AM, Thomas Schneider <[hidden email]> wrote:

> Hello there,
>  I do have a specific NetRexx question where I cannot find a solution by
> myself.
>
>
> I do have the follwoing call structure
>  class Lang
>     class Tokens extends Lang
>         class InLine extends Tokens
>             class Scan extends InLine
>                class InItem extends Scan
>                    class InExpr (including InTerm) extends InItem
>  class InDecl extends Scan uses InExpr InItem
>  class InClause (including Parser) extends  Scan uses InDecl
>
>  class ProcessOneFile (executes InClause.Parser)
>
> Up to Scan everything works correct.
> Now, when calling the Parser, the main Program aborts in
>      at org.netrexx.rey.in.InItem.<init>(InItem.nrx) with a null pointer
> exception,where
> it should NOT (no Null item involved).
>
> I'm now investigating to use super() in the InItem sonstructor, but cannot
> find the doc
> what this would imply.
>
> What I actually want is that InItem and InExpr construct a Scan Object, and
> *NOT* an own Object...
>
> As I do have a similar problem with other classes as well, I would like to
> have this clarified
> before I do further look into this -maybe very specific- problem!
>
> Any advise whar the functionality of super() actually is, and what it is
> used for, wand when it should be used?
>
> Thanks in advance :-)
> Thomas Schneider.
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: The purpose of super() in a NetRexx constructor

Thomas.Schneider.Wien
Hi Rene, & all:

Whilst I didn't resolve my *current* problem (as yet), I'm very
*thankful* for your quotes of the NetRexx
Language Definition.

Whilst I've read it now 3 times, I will need some more time to really
*understand* the implications,
and look in my own code to see where the (*my*) current  problem does
come from...... :-(

Thanks anyway for your clarifications.....

... and greetings to Venetia (strictly private).

See you sometime and/or somewhere :-)

Thomas Schneider.
====================================================================
René Jansen schrieb:

> To quote nrl:
>
> All constructors follow the same rules as other methods, and in addition:
> 1.Constructor calls always include parentheses in the syntax, even if
> no arguments are supplied. This distinguishes them from a reference to
> the type of the same name.
> 2.Constructors must call a constructor of their superclass (the class
> they extend) before they carry out any initialization of their own.
> This is so any initialization carried out by the superclass takes
> place, and at the appropriate moment. Only after this call is complete
> can they make any reference to the special words this or super (see
> page 129).
> Therefore, the first instruction in a constructor must be either a
> call to the superclass, using the special constructor super() (with
> optional arguments), or a call to to another constructor in the same
> class, using the special constructor this() (with optional arguments).
> In the latter case, eventually a constructor that explicitly calls
> super() will be invoked and the chain of local constructor calls ends.
> As a convenience, NetRexx will add a default call to super(), with no
> arguments, if the first instruction in a constructor is not a call to
> this() or super().
> 3.The properties of a constructed value are initialized, in the order
> given in the program, after the call to super() (whether implicit or
> explicit).
>
> I'd suggest just to trace where the null pointer exception stems from.
>
> best regards,
>
> René
>
> On Wed, Apr 28, 2010 at 7:09 AM, Thomas Schneider <[hidden email]> wrote:
>  
>> Hello there,
>>  I do have a specific NetRexx question where I cannot find a solution by
>> myself.
>>
>>
>> I do have the follwoing call structure
>>  class Lang
>>     class Tokens extends Lang
>>         class InLine extends Tokens
>>             class Scan extends InLine
>>                class InItem extends Scan
>>                    class InExpr (including InTerm) extends InItem
>>  class InDecl extends Scan uses InExpr InItem
>>  class InClause (including Parser) extends  Scan uses InDecl
>>
>>  class ProcessOneFile (executes InClause.Parser)
>>
>> Up to Scan everything works correct.
>> Now, when calling the Parser, the main Program aborts in
>>      at org.netrexx.rey.in.InItem.<init>(InItem.nrx) with a null pointer
>> exception,where
>> it should NOT (no Null item involved).
>>
>> I'm now investigating to use super() in the InItem sonstructor, but cannot
>> find the doc
>> what this would imply.
>>
>> What I actually want is that InItem and InExpr construct a Scan Object, and
>> *NOT* an own Object...
>>
>> As I do have a similar problem with other classes as well, I would like to
>> have this clarified
>> before I do further look into this -maybe very specific- problem!
>>
>> Any advise whar the functionality of super() actually is, and what it is
>> used for, wand when it should be used?
>>
>> Thanks in advance :-)
>> Thomas Schneider.
>>
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>>
>>    
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>  

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)