Skip to content

Commit fb0bdb7

Browse files
committed
Update Java SE 24
1 parent dfa11c5 commit fb0bdb7

16 files changed

+221
-211
lines changed

chapter-1.txt

Lines changed: 4 additions & 4 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 23 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 24 Edition.
2020

2121
1.1. Organization of the Specification
2222

@@ -111,7 +111,7 @@ Hello, world.
111111

112112
Throughout this specification, we refer to classes and interfaces drawn from the Java SE Platform API. Whenever we refer to a class or interface (other than those declared in an example) using a single identifier N, the intended reference is to the class or interface named N in the package java.lang. We use the canonical name (§6.7) for classes or interfaces from packages other than java.lang.
113113

114-
A cross-reference within this specification is shown as (§x.y). Occasionally, we refer to concepts in the The Java Virtual Machine Specification, Java SE 23 Edition via cross-references of the form (JVMS §x.y).
114+
A cross-reference within this specification is shown as (§x.y). Occasionally, we refer to concepts in the The Java Virtual Machine Specification, Java SE 24 Edition via cross-references of the form (JVMS §x.y).
115115

116116
Non-normative text, designed to clarify the normative text of this specification, is given in smaller, indented text.
117117

@@ -143,7 +143,7 @@ The preview features defined by a given release of the Java SE Platform are enum
143143

144144
Preview language features are specified in standalone documents that indicate changes ("diffs") to The Java® Language Specification for that release. The specifications of preview language 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.
145145

146-
Java SE 23 defines four preview language features: Flexible Constructor Bodies; Implicitly Declared Classes and Instance main Methods; Module Import Declarations; and Primitive Types in Patterns, instanceof, and switch. 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/.
146+
Java SE 24 defines four preview language features: Flexible Constructor Bodies; Simple Source Files and Instance main Methods; Module Import Declarations; and Primitive Types in Patterns, instanceof, and switch. The standalone documents which specify these preview features are available at the web site which hosts this edition of The Java® Language Specification.
147147

148148
Preview APIs are specified within the Java SE API Specification for that release.
149149

@@ -214,4 +214,4 @@ Mitchell, James G., William Maybury, and Richard Sweet. The Mesa Programming Lan
214214

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

217-
Unicode Consortium, The. The Unicode Standard, Version 15.1.0. South San Francisco, CA: The Unicode Consortium, 2023. ISBN 978-1-936213-33-7.
217+
Unicode Consortium, The. The Unicode Standard, Version 16.0.0. South San Francisco: The Unicode Consortium, 2024. ISBN 978-1-936213-34-4.

chapter-11.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class StaticallyThrownExceptionsIncludeSubtypes {
211211
try {
212212
throw new FileNotFoundException();
213213
} catch (IOException ioe) {
214-
// "catch IOException" catches IOException
214+
// "catch IOException" catches IOException
215215
// and any subtype.
216216
}
217217

@@ -225,7 +225,7 @@ class StaticallyThrownExceptionsIncludeSubtypes {
225225
} catch (IOException ioe) {
226226
// Legal, but compilers are encouraged to give
227227
// warnings as of Java SE 7, because all subtypes of
228-
// IOException that the try block "can throw" have
228+
// IOException that the try block "can throw" have
229229
// already been caught by the prior catch clause.
230230
}
231231

@@ -236,7 +236,7 @@ class StaticallyThrownExceptionsIncludeSubtypes {
236236
// that m "can throw" a subtype or supertype of
237237
// IOException (e.g. Exception).
238238
} catch (FileNotFoundException fnfe) {
239-
// Legal, because the dynamic type of the exception
239+
// Legal, because the dynamic type of the exception
240240
// might be FileNotFoundException.
241241
} catch (IOException ioe) {
242242
// Legal, because the dynamic type of the exception

chapter-12.txt

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

3535
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.
3636

37-
The precise semantics of Java Virtual Machine startup are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 23 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
37+
The precise semantics of Java Virtual Machine startup are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 24 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
3838

3939
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.
4040

@@ -99,9 +99,9 @@ public static void main(String... args)
9999

100100
Loading refers to the process of finding the binary form of a class or interface 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 (§1.4).
101101

102-
The precise semantics of loading are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 23 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
102+
The precise semantics of loading are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 24 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
103103

104-
The binary representation of a class or interface is normally the class file format described in Chapter 4 of The Java Virtual Machine Specification, Java SE 23 Edition, but other representations are possible, provided they meet the requirements specified in §13.1.
104+
The binary representation of a class or interface is normally the class file format described in Chapter 4 of The Java Virtual Machine Specification, Java SE 24 Edition, but other representations are possible, provided they meet the requirements specified in §13.1.
105105

106106
12.2.1. The Loading Process
107107

@@ -129,13 +129,13 @@ If a class loader L1 delegates loading of a class or interface C to another load
129129

130130
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.
131131

132-
For further discussion of these issues, see The Java Virtual Machine Specification, Java SE 23 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.
132+
For further discussion of these issues, see The Java Virtual Machine Specification, Java SE 24 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 sensitive system classes such as ClassLoader.
133133

134134
12.3. Linking of Classes and Interfaces
135135

136136
Linking is the process of taking a binary form of a class or interface and combining it into the run-time state of the Java Virtual Machine, so that it can be executed. A class or interface is always loaded before it is linked.
137137

138-
The precise semantics of linking are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 23 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
138+
The precise semantics of linking are given in Chapter 5 of The Java Virtual Machine Specification, Java SE 24 Edition. Here we present an overview of the process from the viewpoint of the Java programming language.
139139

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

@@ -469,7 +469,7 @@ This shows that the invocation of printThree in the constructor for class Super
469469

470470
12.6. Finalization of Class Instances
471471

472-
As of Java SE 23, the Java SE Platform Specification allows finalization of class instances to be disabled in an implementation of the Java SE Platform, in anticipation of the removal of finalization from a future release of the Java SE Platform.
472+
As of Java SE 24, the Java SE Platform Specification allows finalization of class instances to be disabled in an implementation of the Java SE Platform, in anticipation of the removal of finalization from a future release of the Java SE Platform.
473473

474474
The class Object has a protected method called finalize; this method can be overridden by other classes. The particular definition of finalize that can be invoked for an object is called the finalizer of that object. Before the storage for an object is reclaimed by the garbage collector, the Java Virtual Machine will invoke the finalizer of that object.
475475

@@ -543,7 +543,7 @@ class Foo {
543543
/* finalize outer Foo object */
544544
}
545545
}
546-
}
546+
}
547547

548548

549549

chapter-13.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This chapter first specifies some properties that any binary format for the Java
7878

7979
13.1. The Form of a Binary
8080

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

8383
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:
8484

@@ -337,7 +337,7 @@ Example 13.4.4-1. Changing A Superclass
337337

338338
Suppose that the following test program:
339339

340-
class Hyper { char h = 'h'; }
340+
class Hyper { char h = 'h'; }
341341
class Super extends Hyper { char s = 's'; }
342342
class Test extends Super {
343343
public static void printH(Hyper h) {
@@ -508,8 +508,8 @@ class Test extends points.Point {
508508
Test t = new Test();
509509
t.print();
510510
}
511-
protected void print() {
512-
System.out.println("Test");
511+
protected void print() {
512+
System.out.println("Test");
513513
}
514514
}
515515

chapter-14.txt

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ The following code illustrates the typing of variables declared with var:
309309

310310
var a = 1; // a has type 'int'
311311
var b = java.util.List.of(1, 2); // b has type 'List<Integer>'
312-
var c = "x".getClass(); // c has type 'Class<? extends String>'
312+
var c = "x".getClass(); // c has type 'Class<? extends String>'
313313
// (see JLS 15.12.2.6)
314314
var d = new Object() {}; // d has the type of the anonymous class
315315
var e = (CharSequence & Comparable<String>) "x";
@@ -457,7 +457,7 @@ class Test {
457457
while (n-- != 0) {
458458
if (v1[j++] != v2[k++])
459459
continue i;
460-
}
460+
}
461461
return i - offset;
462462
}
463463
return -1;
@@ -566,22 +566,22 @@ This rule is motivated by a case that demands special treatment. Recall that the
566566

567567
public class Foo {
568568
public static void main(String[] args) {
569-
Baz.testAsserts();
569+
Baz.testAsserts();
570570
// Will execute after Baz is initialized.
571571
}
572572
}
573573
class Bar {
574574
static {
575-
Baz.testAsserts();
575+
Baz.testAsserts();
576576
// Will execute before Baz is initialized!
577577
}
578578
}
579579
class Baz extends Bar {
580580
static void testAsserts() {
581581
boolean enabled = false;
582582
assert enabled = true;
583-
System.out.println("Asserts " +
584-
(enabled ? "enabled" : "disabled"));
583+
System.out.println("Asserts " +
584+
(enabled ? "enabled" : "disabled"));
585585
}
586586
}
587587

@@ -686,35 +686,35 @@ If a case label with more than one case pattern could declare pattern variables,
686686

687687

688688
Object obj = ...;
689-
switch (obj) {
690-
case Integer i, Boolean b -> {
689+
switch (obj) {
690+
case Integer i, Boolean b -> {
691691
... // Error! Is i or b initialized?
692-
}
693-
...
692+
}
693+
...
694694
}
695695

696696

697697
Even if only one of the case patterns declares a pattern variable, it would still not be clear whether the variable was initialized or not; for example:
698698

699699

700700
Object obj = ...;
701-
switch (obj) {
702-
case Integer i, Boolean _ -> {
701+
switch (obj) {
702+
case Integer i, Boolean _ -> {
703703
... // Error! Is i initialized?
704-
}
705-
...
704+
}
705+
...
706706
}
707707

708708

709709
The following does not result in a compile-time error:
710710

711711

712712
Object obj = ...;
713-
switch (obj) {
714-
case Integer _, Boolean _ -> {
713+
switch (obj) {
714+
case Integer _, Boolean _ -> {
715715
... // Matches both an Integer and a Boolean
716-
}
717-
...
716+
}
717+
...
718718
}
719719

720720

@@ -815,7 +815,7 @@ A case label with more than one case pattern is dominated if any one of these pa
815815
case Integer _, String _ -> // Error - dominated!
816816
System.out.println("An Integer or a String");
817817
...
818-
}
818+
}
819819

820820

821821
A case label with a case constant c is dominated if one of the following holds:
@@ -976,7 +976,7 @@ static int testEnumExhaustive(E e) {
976976
case H -> 2; // No default required!
977977
};
978978
}
979-
979+
980980

981981

982982
The type T names an abstract sealed class or sealed interface C and for every permitted direct subclass or subinterface D of C, one of the following two conditions holds:
@@ -987,7 +987,6 @@ There is a type U that both names D and is a subtype of T, and P covers U.
987987

988988
A default label is permitted, but not required, in the case where the switch block exhausts all the permitted direct subclasses and subinterfaces of an abstract sealed class or sealed interface. For example:
989989

990-
991990

992991
sealed interface I permits A, B, C {}
993992
final class A implements I {}
@@ -1297,7 +1296,7 @@ class TwoMany {
12971296
howMany(3);
12981297
howManyAgain(1);
12991298
howManyAgain(2);
1300-
howManyAgain(3);
1299+
howManyAgain(3);
13011300
}
13021301
}
13031302

0 commit comments

Comments
 (0)