Bug#263161: [kaffe] kaffe: different compilers giving different results for the same source file

Dalibor Topic robilad at kaffe.org
Thu Aug 5 02:26:56 PDT 2004


Rogério Brito wrote:
> Hi, everybody.

>>The language specification says:
>>
>>  Suppose that a field access expression super.name appears within class C,
>>  and the immediate superclass of C is class S. Then super.name is treated
>>  exactly as if it had been the expression ((S)this).name; thus, it refers
>>  to the field named name of the current object, but with the current object
>>  viewed as an instance of the superclass.
>>
>>So the expression "super" alone may mean ((S)this) although not allowed
>>by the language specification.
>>
>>I think this is KJC's bug.  But can't we lazily accept this as a language
>>extension by KJC?
> 
> 
> I have no problems with that, if it doesn't matter for other people.
> 
> But then, I think that a warning regarding this should be generated, so
> that people can know if their code is using something illegal in "pure"
> Java.

Try compiling it with kjc -w10, which will give you tons of warnings 
from kjc, usually.

> BTW, just for curiosity's sake, has this use of "super" alone been
> deprecated from the language? I'm asking this because it was used in the
> (very old) James Gosling's book on Java that I have here.

The Java language changes more or less subtly with each JDK release. Sun 
hasn't bothered to keep the specifications in sync, but I've heard that 
someone is working on a third, updated edition of the language and vm 
specifications. Usage of 'super' alone is not in Java as specified by 
JLS2, I'd say.

cheers,
dalibor topic




More information about the kaffe mailing list