Java Reference
In-Depth Information
This chapter specifies minimum standards for binary compatibility guaranteed by all im-
plementations. The Java programming language guarantees compatibility when binaries of
classes and interfaces are mixed that are not known to be from compatible sources, but
whose sources have been modified in the compatible ways described here. Note that we are
discussing compatibility between releases of an application. A discussion of compatibility
among releases of the Java SE platform is beyond the scope of this chapter.
We encourage development systems to provide facilities that alert developers to the impact
of changes on pre-existing binaries that cannot be recompiled.
This chapter first specifies some properties that any binary format for the Java program-
ming language must have (§ 13.1 ) . It next defines binary compatibility, explaining what it
is and what it is not (§ 13.2 ). It finally enumerates a large set of possible changes to pack-
ages (§ 13.3 ) , classes (§ 13.4 ), and interfaces (§ 13.5 ) , specifying which of these changes are
guaranteed to preserve binary compatibility and which are not.
13.1. The Form of a Binary
Programs must be compiled either into the class file format specified by The Java Virtual
Machine Specification, Java SE 7 Edition , or into a representation that can be mapped into
that format by a class loader written in the Java programming language.
Furthermore, the resulting class file must have certain properties. A number of these prop-
erties are specifically chosen to support source code transformations that preserve binary
compatibility. The required properties are:
1. The class or interface must be named by its binary name , which must meet the fol-
lowing constraints:
• The binary name of a top level type (§ 7.6 ) is its canonical name (§ 6.7 ) .
• The binary name of a member type (§ 8.5 , § 9.5 ) consists of the binary name of
its immediately enclosing type, followed by $, followed by the simple name of
the member.
• The binary name of a local class (§ 14.3 ) consists of the binary name of its im-
mediately enclosing type, followed by $, followed by a non-empty sequence of
digits, followed by the simple name of the local class.
• The binary name of an anonymous class (§ 15.9.5 ) consists of the binary name
of its immediately enclosing type, followed by $, followed by a non-empty se-
quence of digits.
Search WWH ::




Custom Search