Berin,
>
> From: Berin Loritsch <[EMAIL PROTECTED]>
[snip]
> Statics do not inherit. What the compiler does is make it *look* like
> it inherits (i.e. it allows you to call a subinterface.ROLE when the
> subinterface does not mark it).
>
> Any time you have a new contract, i.e. a new interface that extends
> existing contracts, it is in itself a new ROLE. You should define
> the .ROLE constant for that interface.
Yeah I see that. I actually wrote some code that
shows the lack of inheritance as a test. It was so
hard for me to accept the fact that I've goofed this
fact for years. I feel like a dumb ass.
BTW this code only prints out "BAR" and "FOO" is not seen:
public interface Foo { String FOO = "foo" ; }
public interface Bar extends Foo { String BAR = "bar" ; }
Class l_clazz = Class.forName( "interfacetests.Bar" ) ;
Field [] l_fields = l_clazz.getDeclaredFields() ;
for ( int ii = 0; ii < l_fields.length; ii++ )
{
System.out.println( l_fields[ii].getName() ) ;
}
System.out.print( Bar.FOO ) ;
prints ...
BAR
foo
But if you have a class Abc that inherits from Bar then
if you cast Abc to Foo and access the FOO contant you'll
see it. Accessing it via a Bar cast is also possible so
there is some trickery going on here. True inheritance
is not actually at play but there is the appearance of it.
This may still lead to ROLE confusion though or what
appears to be ROLE confusion via this simulated inheritance.
So yes your right but does this mean there is no confusion
with which ROLE is which?
> lookup(Interface.ROLE);
> lookup("interface");
>
> Which will let the compiler tell you that you made a typo before
> you try to run it?
Very good point!
> Rely would be too strong. More like it takes advantage of it if you desire.
So then I'll presume the operation of components without the ROLE const
is possible in pico.
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]