Java Reference
In-Depth Information
1.5 Introduced generics, enums, annotations, and extended for
loop. Also uses StringBuilder rather than StringBuffer for string
concatenation.
Similarly, the target versions are
1.1 Compliant with the first edition of the Java Virtual Machine
Specification ( JVMS )
1.2 Compliant with the second edition of the JVMS . The main
change involved the way static member accesses were encoded
in the compiled class and resolved at runtime.
1.3 No known change
1.4 No known change
1.5 Compliant with the third edition of the JVMS . This enables sup-
port for enums, annotations, and some aspects of generics. It
also modifies the way class literals are implemented.
Because some language changes require new library classes, a change
in the source version may imply a minimum target value. For example,
a source of 1.4 requires a target of 1.4 because an earlier version of the
virtual machine won't have the classes or methods that support asser-
tions. Not surprisingly, a source of 1.5 requires a target of 1.5 as well.
Naturally, source and target versions that came into existence after a
given compiler was released are not supported.
Each target version causes a change in the class file version number that
is encoded in the compiled classes. Each virtual machine knows what
class versions it supports and will generally refuse to load any class files
that have a higher version number. This means, for example, that you
can prevent a class from being loaded on an older virtual machine even
if there is no missing functionality in the version.
The default settings for the compiler in the 5.0 release are source 1.5
and target 1.5 to enable all the latest features of the language. If you
compile code to run on previous versions (which doesn't use the new
 
Search WWH ::




Custom Search