Sun's JDK raises VerifyError when an interface contains <clinit> without a code attribute. JVMS, 2nd Edition, Chapter 4.6 Methods states: ... Class and interface initialization methods (3.9) are called implicitly by the Java virtual machine; the value of their access_flags item is ignored except for the settings of the ACC_STRICT flag. ... Thus, ClassFormatError should be thrown in such case, because: - the value of ACC_ABSTRACT is among the ignored flag (as others but except ACC_STRICT) - ACC_ABSTRACT cannot be used to suggest that VM should not check for a Code attribute - the unstated implicit assumption is that if <clinit> exists, it must have a Code Attribute - the check for the existence of a Code Attribute should result to ClassFormatError, not a VerifyError. It is fine for other methods that ACC_ABSTRACT implies no code attribute, but <clinit> is specifically excepted by the above paragraph. Note that Sun's JDK raises VerifyError in such cases at least since JDK 1.2. Please see comments for 6300312 for more details.
|