Project Jigsaw: VM changes for Modules
2009/2/3
Classloading
5.3.5 Deriving a Class from a class File Representation
Only members of a class in a module may use module accessibility
By the definition ofACC_MODULE in chapter 4, a
ClassFormatError must be thrown if a
ClassFile uses the ACC_MODULE flag in
ClassFile.access_flags,
field_info.access_flags,
method_info.access_flags or
InnerClasses.inner_class_access_flags, and the
ClassFile does not have a Module
attribute.
Resolution
5.4.3.4 Interface method resolution
When resolving an interface method reference:- If C is not an interface, interface method resolution throws an IncompatibleClassChangeError.
- Otherwise, if the referenced method does not have the same name and descriptor as a method in C or in one of the superinterfaces of C, or in class Object, interface method resolution throws a NoSuchMethodError.
- Otherwise, if the referenced method is not accessible (§5.4.4) to D, interface method resolution throws an IllegalAccessError.
5.4.4 Access Control
Terminology:- A class's runtime module is the pair of its module name and defining classloader.
A class or interface C is accessible to a class or interface D if and only if any of the following conditions are true:
- C is
public. - C is
moduleand D is a member of the same runtime module as C. - C and D are members of the same runtime package (5.3).
- R is
public. - R is
moduleand is declared in a class C, and D is a member of the same runtime module as C. - R is
protectedand is declared in a class C, and D is either a subclass of C or C itself. Furthermore, if R is notstatic, then the symbolic reference to R must contain a symbolic reference to a class T, such that T is either a subclass of D, a superclass of D or D itself. - R is either
protectedor has default access (that is, neitherpublicnormodulenorprotectednorprivate), and is declared by a class in the same runtime package as D. - R is
privateand is declared in D.
Other JVMS changes
- 4.2.1 Binary class and interface names
- 4.3.2 Field descriptors

