JVM Specification 8-10 inaccuracy in Chapter 6.5 -- invokespecial instruction
Alex Buckley
alex.buckley at oracle.com
Wed Oct 31 21:59:35 UTC 2018
Thank you for reporting the inaccurate phrasing. I have recorded it in
https://bugs.openjdk.java.net/browse/JDK-8210840 and actioned an update
to the text in JVMS12.
Alex
On 9/14/2018 1:11 AM, Nikita Lipsky wrote:
> Hello,
>
>
>
> It seems I've found inaccuracy in the JVM specifications 8-10, Chapter
> 6.5 -- invokespecial instruction
> (https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5
> .invokespecial).
>
>
>
> The phrase "If the symbolic reference names a class (not an interface),
> then that class is a superclass of the current class." looks like
> implication.
>
>
>
> So if the symbolic reference names an interface this would result for
> the condition to be true. However then the point 3 bellow:
>
>
>
> " Otherwise, if C is an interface and the class Object contains a
> declaration of a public instance method with the same name and
> descriptor as the resolved method, then it is the method to be invoked."
>
>
>
> will never be satisfied for classes that references methods in
> interfaces as C will be a super class of the current class (in case if
> the current class has "ACC_SUPER" and non-constructor should be called).
>
>
>
> Then if we call a default method of a superinterface of the current
> class it can be not found.
>
>
>
> So I strongly believe that the phrase should be read as "The symbolic
> reference names a class (not an interface) and that class is a
> superclass of the current class."
>
>
>
> HotSpot implementation follows exactly this interpretation (however it
> also checks some conditions that are not stated by the spec: if looks
> for default methods only in direct superinterfaces which is strange -- I
> cannot find any place in the specification where it is stated).
>
>
>
> Best Regards,
>
> Nikita Lipsky
More information about the jls-jvms-spec-comments
mailing list