Clarifications and Amendments to the Java Virtual Machine Specification

Synthetic Attribute

The specification of the synthetic attribute in JVMS 4.7.6, states:

A class member that does not appear in the source code must be marked using a Synthetic attribute.
This is inaccurate with respect to both JLS 2nd edition and the reference implementation. The text should be revised to state
A class member that does not appear in the source code must be marked using a Synthetic attribute, except for the default constructor and the class initialization method.

Lookup Algorithm for Invokevirtual Instruction


The lookup algorithm used by the invokevirtual  instruction (pages 291-292 of the JVMS, 2nd edition) should be revised as follows:

Let C be the class of the target of the method invocation. The actual method to be invoked is selected by the following lookup procedure:

If C contains a declaration for an instance method M with the same name and descriptor as the resolved method, and M overrides the resolved method , then M is the method to be invoked, and the lookup procedure terminates.

Otherwise, if C has a superclass, this same lookup procedure is performed recursively using the direct superclass of C ; the method to be invoked is the result of the recursive invocation of this lookup procedure.

Otherwise, an AbstractMethodError is raised.

The text highlighted in red is the only change. It replaces the text

and the resolved method is accessible from C

in the current specification. See the revision of the definition of method override in the JLS 3rd Edition page for more details.
 

Changes for JDK 1.5

The following changes to the Java Virtual Machine Specification Second Edition are planned were made in JDK 1.5. These changes are part of JSR45 and  JSR 924


Copyright © 1995-2005 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy
[ This page was updated: Thursday, 12-June-2005 14:21:42 PDT ]