Uncertainty about fix for JDK-5059679
Dan Smith
daniel.smith at oracle.com
Tue Feb 14 01:06:00 UTC 2023
On Feb 13, 2023, at 10:28 AM, Archie Cobbs <archie.cobbs at gmail.com> wrote:
* The signature of m1 is not a subsignature (§8.4.2) of the signature of m2 as a member of the supertype of C that names A.
* The declared signature of m1 or some method m1 overrides (directly or indirectly) has the same erasure as the declared signature of m2 or some method m2 overrides (directly or indirectly).
Note the distinction in these rules between
"signature of m2 as a member of the supertype of C that names A" (third rule)
and
"declared signature of m2" (fourth rule)
I would interpret the first to mean the signature '(Class<R>)->void', and the second to mean the signature '(T)->void'. Since the erasure of 'T' is 'Object', the fourth rule doesn't apply, and there's no error.
JLS isn't always clear about which of these two signatures it's talking about, but in this case, given the use of different phrases in the third and fourth rules, and the fact of javac's longstanding behavior, I think that's the intent.
(It makes sense, too, because the underlying problem is that you don't want the descriptors to clash in the class file. And they don't, because one has descriptor '(Object)V' and the other is '(Class)V'. Eventually, somebody might try to override something and need a bridge method that *would* clash, but in that case there would be another method for which this error check should apply.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20230214/6e6b1ce4/attachment-0001.htm>
More information about the compiler-dev
mailing list