java compiler error with minor class and super()

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

java compiler error with minor class and super()

Woolaway, Dave
Could anyone explain why the following code example gives the
indicated error from javac? I'm using 1.148 and 1.149; same error for
both.

=======testa.nrx==========
class testa public

method testa(name)
  say name
return

class testa.testb extends testa

method testb(name)
  super(name || '.c')            -- this line in error
return
=======================
C:\nrx\testa.java:10: Can't reference $01 before the superclass
constructor has been called.
super(name.OpCc(null,$01));
                     ^

2 things I noted:
1. It doesn't happen when testb is not a minor class (ie when
   in own .nrx file).
2. If I cast '.c' to String, the error doesn't occur:
   super(name || (String '.c'))


Cheers
Dave Woolaway
British Airways, London UK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: java compiler error with minor class and super()

Mike Cowlishaw-2


Bit of a tricky one, that.   NetRexx is generating a constant Rexx string
for the '.c' string.   Unfortunately, Java does not allow statics in minor
classes (in Java 1.1) so I have to make it non-static -- which means in
this one special case (inside the super() call) it cannot be accessed.
I'll see if I can think of a neat way to avoid the problem.    In the
meantime, use the cast-to-String workaround, or perhaps make the method,
class, or whole program binary.

Sorry for the problem.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mike Cowlishaw, IBM Fellow
mailto:[hidden email]  --  http://www2.hursley.ibm.com



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: java compiler error with minor class and super()

Woolaway, Dave
In reply to this post by Woolaway, Dave
Thanks for the explanation, Mike. I'll work around it.

One thing I haven't understood yet about NetRexx is: when I
get an error from javac, does this indicate an error in NetRexxC,
or do some of my NetRexx coding errors get propagated thru to
the java compiler for it to catch (so that I should sometimes expect
to see them).

Cheers,
Dave Woolaway
British Airways, London UK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: java compiler error with minor class and super()

Mike Cowlishaw-2
In reply to this post by Woolaway, Dave


NetRexxC should catch all coding errors; the general principle is that it
should generate perfect Java (or none at all).   In general you should
never see errors from javac.    There are a few grey areas (the one you
found is one -- statics disallowed  in 1.1 was a bad mistake and in Java
1.2 this has been fixed and they are allowed -- once 1.2 is pervasive I'd
want NetRexxC to generate static constants in minor classes); similarly,
there are some bugs in Java definition and in javac, and sometimes these
will show up as messages from javac.

So, if you do see javac errors, and they're not covered in my documentation
('restrictions', at the end of the user/install document), then please let
me know.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mike Cowlishaw, IBM Fellow
mailto:[hidden email]  --  http://www2.hursley.ibm.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>