Skip to content

Commit 8d6a7a3

Browse files
committed
Update Java SE 15
1 parent 4d3112e commit 8d6a7a3

File tree

12 files changed

+417
-132
lines changed

12 files changed

+417
-132
lines changed

chapter-1.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The Java programming language is strongly and statically typed. This specificati
1616

1717
The Java programming language is a relatively high-level language, in that details of the machine representation are not available through the language. It includes automatic storage management, typically using a garbage collector, to avoid the safety problems of explicit deallocation (as in C's free or C++'s delete). High-performance garbage-collected implementations can have bounded pauses to support systems programming and real-time applications. The language does not include any unsafe constructs, such as array accesses without index checking, since such unsafe constructs would cause a program to behave in an unspecified way.
1818

19-
The Java programming language is normally compiled to the bytecode instruction set and binary format defined in The Java Virtual Machine Specification, Java SE 14 Edition.
19+
The Java programming language is normally compiled to the bytecode instruction set and binary format defined in The Java Virtual Machine Specification, Java SE 15 Edition.
2020

2121
1.1. Organization of the Specification
2222

@@ -26,7 +26,7 @@ Chapter 3 describes the lexical structure of the Java programming language, whic
2626

2727
Chapter 4 describes types, values, and variables. Types are subdivided into primitive types and reference types.
2828

29-
The primitive types are defined to be the same on all machines and in all implementations, and are various sizes of two's-complement integers, single- and double-precision IEEE 754 standard floating-point numbers, a boolean type, and a Unicode character char type. Values of the primitive types do not share state.
29+
The primitive types are defined to be the same on all machines and in all implementations, and are various sizes of two's-complement integers, IEEE 754 floating-point numbers, a boolean type, and a Unicode character char type. Values of the primitive types do not share state.
3030

3131
Reference types are the class types, the interface types, and the array types. The reference types are implemented by dynamically created objects that are either instances of classes or arrays. Many references to each object can exist. All objects (including arrays) support the methods of the class Object, which is the (single) root of the class hierarchy. A predefined String class supports Unicode character strings. Classes exist for wrapping primitive values inside of objects. In many cases, wrapping and unwrapping is performed automatically by the compiler (in which case, wrapping is called boxing, and unwrapping is called unboxing). Class and interface declarations may be generic, that is, they may be parameterized by other reference types. Such declarations may then be invoked with specific type arguments.
3232

@@ -129,7 +129,7 @@ Implementations must disable, at both compile time and run time, the preview fea
129129

130130
The preview features defined by a given release of the Java SE Platform are specified in standalone documents that indicate changes ("diffs") to The Java® Language Specification for that release. The specifications of preview features are incorporated into The Java® Language Specification by reference, and made a part thereof, if and only if preview features are enabled at compile time.
131131

132-
Java SE 14 defines three preview features in the Java programming language: Pattern Matching for instanceof; Records; and Text Blocks. The standalone documents which specify these preview features are available at the Oracle web site which hosts The Java® Language Specification: https://docs.oracle.com/javase/specs/.
132+
Java SE 15 defines three preview features in the Java programming language: Pattern Matching for instanceof; Records; and Sealed Classes. The standalone documents which specify these preview features are available at the Oracle web site which hosts The Java® Language Specification: https://docs.oracle.com/javase/specs/.
133133

134134
A preview feature may be associated with elements of the Java SE Platform API. Namely, an API element is essential if it exists in the package java.lang or java.lang.annotation, and programs cannot use the preview feature without referring (directly or indirectly) to the API element.
135135

@@ -145,12 +145,10 @@ The declaration where the use appears and the declaration of the essential API e
145145

146146
The use is within an import declaration that imports the essential API element.
147147

148-
Java SE 14 contain the following essential API elements:
148+
Java SE 15 contain the following essential API elements:
149149

150150
For the preview feature Records: The class Record; and in enum java.lang.annotation.ElementType, the enum constant RECORD_COMPONENT.
151151

152-
For the preview feature Text Blocks: In class String, the methods stripIndent and translateEscapes.
153-
154152
1.6. Feedback
155153

156154
Readers are invited to report technical errors and ambiguities in The Java® Language Specification to jls-jvms-spec-comments@openjdk.java.net.
@@ -172,7 +170,7 @@ Harbison, Samuel. Modula-3. Prentice Hall, Englewood Cliffs, New Jersey, 1992, I
172170

173171
Hoare, C. A. R. Hints on Programming Language Design. Stanford University Computer Science Department Technical Report No. CS-73-403, December 1973. Reprinted in SIGACT/SIGPLAN Symposium on Principles of Programming Languages. Association for Computing Machinery, New York, October 1973.
174172

175-
IEEE Standard for Binary Floating-Point Arithmetic. ANSI/IEEE Std. 754-1985. Available from Global Engineering Documents, 15 Inverness Way East, Englewood, Colorado 80112-5704 USA; 800-854-7179.
173+
IEEE. IEEE Standard for Floating-Point Arithmetic. IEEE Std 754-2019 (Revision of IEEE 754-2008). July 2019, ISBN 978-1-5044-5924-2.
176174

177175
Kernighan, Brian W., and Dennis M. Ritchie. The C Programming Language, 2nd ed. Prentice Hall, Englewood Cliffs, New Jersey, 1988, ISBN 0-13-110362-8.
178176

@@ -182,4 +180,4 @@ Mitchell, James G., William Maybury, and Richard Sweet. The Mesa Programming Lan
182180

183181
Stroustrup, Bjarne. The C++ Progamming Language, 2nd ed. Addison-Wesley, Reading, Massachusetts, 1991, reprinted with corrections January 1994, ISBN 0-201-53992-6.
184182

185-
Unicode Consortium, The. The Unicode Standard, Version 12.1.0. Mountain View, California, 2019, ISBN 978-1-936213-25-2.
183+
Unicode Consortium, The. The Unicode Standard, Version 13.0. Mountain View, California, 2020, ISBN 978-1-936213-26-9.

chapter-12.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The chapter continues with a specification of the procedures for creation of new
3333

3434
The Java Virtual Machine starts execution by invoking the method main of some specified class or interface, passing it a single argument which is an array of strings. In the examples in this specification, this first class is typically called Test.
3535

36-
The precise semantics of Java Virtual Machine startup are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 14 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
36+
The precise semantics of Java Virtual Machine startup are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 15 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
3737

3838
The manner in which the initial class or interface is specified to the Java Virtual Machine is beyond the scope of this specification, but it is typical, in host environments that use command lines, for the fully qualified name of the class or interface to be specified as a command line argument and for following command line arguments to be used as strings to be provided as the argument to the method main.
3939

@@ -98,9 +98,9 @@ public static void main(String... args)
9898

9999
Loading refers to the process of finding the binary form of a class or interface type with a particular name, perhaps by computing it on the fly, but more typically by retrieving a binary representation previously computed from source code by a Java compiler, and constructing, from that binary form, a Class object to represent the class or interface.
100100

101-
The precise semantics of loading are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 14 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
101+
The precise semantics of loading are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 15 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
102102

103-
The binary format of a class or interface is normally the class file format described in The Java Virtual Machine Specification, Java SE 14 Edition cited above, but other formats are possible, provided they meet the requirements specified in §13.1. The method defineClass of class ClassLoader may be used to construct Class objects from binary representations in the class file format.
103+
The binary format of a class or interface is normally the class file format described in The Java Virtual Machine Specification, Java SE 15 Edition cited above, but other formats are possible, provided they meet the requirements specified in §13.1. The method defineClass of class ClassLoader may be used to construct Class objects from binary representations in the class file format.
104104

105105
Well-behaved class loaders maintain these properties:
106106

@@ -110,7 +110,7 @@ If a class loader L1 delegates loading of a class C to another loader L2, then f
110110

111111
A malicious class loader could violate these properties. However, it could not undermine the security of the type system, because the Java Virtual Machine guards against this.
112112

113-
For further discussion of these issues, see The Java Virtual Machine Specification, Java SE 14 Edition and the paper Dynamic Class Loading in the Java Virtual Machine, by Sheng Liang and Gilad Bracha, in Proceedings of OOPSLA '98, published as ACM SIGPLAN Notices, Volume 33, Number 10, October 1998, pages 36-44. A basic principle of the design of the Java programming language is that the run-time type system cannot be subverted by code written in the Java programming language, not even by implementations of such otherwise sensitive system classes as ClassLoader and SecurityManager.
113+
For further discussion of these issues, see The Java Virtual Machine Specification, Java SE 15 Edition and the paper Dynamic Class Loading in the Java Virtual Machine, by Sheng Liang and Gilad Bracha, in Proceedings of OOPSLA '98, published as ACM SIGPLAN Notices, Volume 33, Number 10, October 1998, pages 36-44. A basic principle of the design of the Java programming language is that the run-time type system cannot be subverted by code written in the Java programming language, not even by implementations of such otherwise sensitive system classes as ClassLoader and SecurityManager.
114114

115115
12.2.1. The Loading Process
116116

@@ -134,7 +134,7 @@ Linking is the process of taking a binary form of a class or interface type and
134134

135135
Three different activities are involved in linking: verification, preparation, and resolution of symbolic references.
136136

137-
The precise semantics of linking are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 14 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
137+
The precise semantics of linking are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 15 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
138138

139139
This specification allows an implementation flexibility as to when linking activities (and, because of recursion, loading) take place, provided that the semantics of the Java programming language are respected, that a class or interface is completely verified and prepared before it is initialized, and that errors detected during linkage are thrown at a point in the program where some action is taken by the program that might require linkage to the class or interface involved in the error.
140140

@@ -366,7 +366,7 @@ A new class instance is explicitly created when evaluation of a class instance c
366366

367367
A new class instance may be implicitly created in the following situations:
368368

369-
Loading of a class or interface that contains a string literal (§3.10.5) may create a new String object to represent the literal. (This will not occur if a string denoting the same sequence of Unicode code points has previously been interned.)
369+
Loading of a class or interface that contains a string literal (§3.10.5) or a text block (§3.10.6) may create a new String object to denote the string represented by the string literal or text block. (This object creation will not occur if an instance of String denoting the same sequence of Unicode code points as the string represented by the string literal or text block has previously been interned.)
370370

371371
Execution of an operation that causes boxing conversion (§5.1.7). Boxing conversion may create a new object of a wrapper class (Boolean, Byte, Short, Character, Integer, Long, Float, Double) associated with one of the primitive types.
372372

chapter-13.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ We encourage development systems to provide facilities that alert developers to
7171

7272
This chapter first specifies some properties that any binary format for the Java programming 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 packages (§13.3), classes (§13.4), and interfaces (§13.5), specifying which of these changes are guaranteed to preserve binary compatibility and which are not.
7373

74-
Occasionally, references of the form: (JVMS §x.y) are used to indicate concepts from The Java Virtual Machine Specification, Java SE 14 Edition.
74+
Occasionally, references of the form: (JVMS §x.y) are used to indicate concepts from The Java Virtual Machine Specification, Java SE 15 Edition.
7575

7676
13.1. The Form of a Binary
7777

78-
Programs must be compiled either into the class file format specified by The Java Virtual Machine Specification, Java SE 14 Edition, or into a representation that can be mapped into that format by a class loader written in the Java programming language.
78+
Programs must be compiled either into the class file format specified by The Java Virtual Machine Specification, Java SE 15 Edition, or into a representation that can be mapped into that format by a class loader written in the Java programming language.
7979

8080
A class file corresponding to a class or interface declaration must have certain properties. A number of these properties are specifically chosen to support source code transformations that preserve binary compatibility. The required properties are:
8181

chapter-14.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,9 @@ switch (day) {
634634
}
635635

636636

637-
null cannot be used as a case constant because it is not a constant expression. Even if case null was allowed, it would be undesirable because the code in that case can never be executed. Namely, if the selector expression is of a reference type (that is, String or a boxed primitive type or an enum type), then an exception will occur if the selector expression evaluates to null at run time. In the judgment of the designers of the Java programming language, propagating the exception is a better outcome than either having no case label match, or having the default label match.
637+
null cannot be used as a case constant because it is not a constant expression. Even if case null was allowed, it would be undesirable because the code in that case would never be executed. This is due to the fact that, given a selector expression of a reference type (that is, String or a boxed primitive type or an enum type), an exception will occur if the selector expression evaluates to null at run time. In the judgment of the designers of the Java programming language, propagating the exception is a better outcome than either having no case label match, or having the default label match.
638+
639+
A Java compiler is encouraged (but not required) to provide a warning if a switch statement with an enum-typed selector expression lacks a default label and lacks case labels for one or more of the enum's constants. Such a switch statement will silently do nothing if the expression evaluates to one of the missing constants.
638640

639641
In C and C++ the body of a switch statement can be a statement and statements with case labels do not have to be immediately contained by that statement. Consider the simple loop:
640642

@@ -1938,10 +1940,10 @@ The last statement in the switch block can complete normally.
19381940

19391941
There is at least one switch label after the last switch block statement group.
19401942

1941-
The switch block does not contain a default label.
1942-
19431943
There is a reachable break statement that exits the switch statement.
19441944

1945+
The switch block does not contain a default label.
1946+
19451947
A switch statement whose switch block consists of switch rules can complete normally iff at least one of the following is true:
19461948

19471949
One of the switch rules introduces a switch rule expression (which is necessarily a statement expression).
@@ -1950,6 +1952,8 @@ One of the switch rules introduces a switch rule block that can complete normall
19501952

19511953
One of the switch rules introduces a switch rule block that contains a reachable break statement which exits the switch statement.
19521954

1955+
The switch block does not contain a default label.
1956+
19531957
A switch block is reachable iff its switch statement is reachable.
19541958

19551959
A statement in a switch block that consists of switch labeled statement groups is reachable iff the switch block is reachable and at least one of the following is true:

0 commit comments

Comments
 (0)