Skip to content

Instantly share code, notes, and snippets.

@tonymorris

tonymorris/vmspec-4.1.md

Last active Aug 29, 2015
Embed
What would you like to do?

JVM Specification 4

4.1 The Classfile Structure

http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.1

Table 4.1. Class access and property modifiers (abbreviated)
  • ACC_PUBLIC
  • ACC_FINAL
  • ACC_SUPER
  • ACC_INTERFACE
  • ACC_ABSTRACT
  • ACC_SYNTHETIC
  • ACC_ANNOTATION
  • ACC_ENUM

If the ACC_INTERFACE flag of this class file is set, its ACC_ABSTRACT flag must also be set (JLS §9.1.1.1). Such a class file must not have its ACC_FINAL, ACC_SUPER or ACC_ENUM flags set.

An annotation type must have its ACC_ANNOTATION flag set. If the ACC_ANNOTATION flag is set, the ACC_INTERFACE flag must be set as well. If the ACC_INTERFACE flag of this class file is not set, it may have any of the other flags in Table 4.1 set, except the ACC_ANNOTATION flag. However, such a class file cannot have both its ACC_FINAL and ACC_ABSTRACT flags set (JLS §8.1.1.2).


  1. ACC_ANNOTATION -> ACC_INTERFACE

  2. "If the ACC_INTERFACE flag of this class file is not set…" Which class?

    1. The one with ACC_ANNOTATION -> See rule 1.

    2. Some arbitrary class -> "may have any … other flags … set, except the ACC_ANNOTATION … However, … cannot have both its ACC_FINAL and ACC_ABSTRACT flags set"

Contradiction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment