Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Marmoset A3 test J1_supermethod_override11

43 views
Skip to first unread message

zma...@gmail.com

unread,
Mar 3, 2014, 9:49:07 PM3/3/14
to
Hey,

Which part of the JLS covers why 'CompB' is a valid class? There is a conflict between CompA and Comparable with respect to the privacy of the compareTo method and I would like to what the JLS says we should do in this case. I have been unsuccessful in finding what the spec says we should do.

Ondřej Lhoták

unread,
Mar 4, 2014, 6:29:25 PM3/4/14
to
On Mon, Mar 03, 2014 at 06:49:07PM -0800, zma...@gmail.com wrote:
> Hey,
>
> Which part of the JLS covers why 'CompB' is a valid class? There is a conflict between CompA and Comparable with respect to the privacy of the compareTo method and I would like to what the JLS says we should do in this case. I have been unsuccessful in finding what the spec says we should do.

JLS 8.4.6.4 deals with this situation: a class (CompB) that inherits two
methods with the same signature. Within this section, the second bullet
point applies because both methods are abstract. This point does not
place any restrictions on access modifiers. Furthermore, this point does
not create any overriding relationship between the two methods, so none
of the restrictions on access modifiers arising from overriding (JLS
8.4.6.3) apply either. This class is valid because there is nothing
about it that the JLS declares to be invalid.

0 new messages