Miranda methods and Methods added by Code Generators

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Aug 9 04:59:52 PDT 2010


>
> Now you may be right that this is nothing to do with Miranda methods. 
> I cannot really look into the minds of whoever originally designed the 
> code in order to argue a case. But javac is plainly wrong in stating 
> that Child does not have an implementation for getAdvisor(). This 
> method is defined by Parent and has perfectly valid, executable code. 
> So, Child ought to inherit this implementation.
Javac complains about Child not having an 'explicit' override of 
getAdvisor(), where by 'explicit' I mean a user-defined one (not 
SYNTHETIC). As I said, bridge methods are an important case of synthetic 
methods that should *not* be taken into account when determining as to 
whether a subclass implements all superclass/superinterfaces abstract 
methods.

Now, I admit that the currently implemented check is probably too strict 
for you, but please, keep in mind that the scenario you are describing 
(class with just a synthetic implementation of a superinterface method) 
is something that simply cannot happen when compiling Java sources - 
that's why javac is not prepared to handle this case [in the case of 
bridge methods, there's always at least one user-defined implementation 
in addition to compiler-generated ones, so the check in question is 
never problematic].

Maurizio



More information about the compiler-dev mailing list