Cyclic definition of overriding

Alex Buckley alex.buckley at oracle.com
Tue Jun 9 19:34:28 UTC 2015


I don't know where you're seeing jls-8.4.8.1-200-D -- there is only 
jls-8.4.8.1-200-{A,B,C} in the HTML and the master files.

That said, jls-8.4.8.1-200 says "An instance method mC declared in or 
inherited by class C, 'overrides from C' another method mI declared in 
an interface I, iff all of the following are true:" -- so you have to 
know that foo() is already inherited by class Test (say from Test1) in 
order to check if Test.foo() overrides Test2.foo(). As you say, we're 
still trying to figure if foo() is inherited from Test1. This all seems 
disturbingly tricky for such a simple scenario. Dan, any comments?

Alex

On 6/9/2015 8:00 AM, Konstantin wrote:
>
> Hello,
>
> I consider this simple case:
>
> interface Test1  {
>      int foo(); // m1
> }
>
> interface Test2{
>      int foo(); // m2
> }
> class Test implements Test1, Test2{
> }
>
> I try to understand if m1 is inherited by Test. I follow jls-8.4.8-200.
> All subassertions are true except jls-8.4.8-200-E. To decide if it is
> true or not we need to turn to overriding definition jls-8.4.8.1-200.
> More detailed, I want to be sure that m2 isn't m'. That's why I need to
> know if m2 overrides m1.
> And new subassertion jls-8.4.8.1-200-D says about inheriting.
> "8.4.8.1 C does not inherit mI."
> So we get a circle. In order to understand if m1 is inherited we need to
> know if it is inherited.
> Please correct me if i misunderstand anything.
>
> Thanks,
> Konstantin


More information about the compiler-dev mailing list