Skip to content

Commit 77f82a3

Browse files
committed
Update Java SE 25
1 parent fb0bdb7 commit 77f82a3

17 files changed

+653
-173
lines changed

chapter-1.txt

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Table of Contents
77
1.3. Notation
88
1.4. Relationship to Predefined Classes and Interfaces
99
1.5. Preview Features
10+
1.5.1. Restrictions on the Use of Preview Features
11+
1.5.2. Current Preview Language Features
1012
1.6. Feedback
1113
1.7. References
1214

@@ -16,7 +18,7 @@ The Java programming language is strongly and statically typed. This specificati
1618

1719
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.
1820

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.
21+
The Java programming language is normally compiled to the bytecode instruction set and binary format defined in The Java Virtual Machine Specification, Java SE 25 Edition.
2022

2123
1.1. Organization of the Specification
2224

@@ -111,7 +113,7 @@ Hello, world.
111113

112114
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.
113115

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).
116+
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 25 Edition via cross-references of the form (JVMS §x.y).
115117

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

@@ -133,21 +135,25 @@ A preview feature is:
133135

134136
a new feature of the Java programming language ("preview language feature"), or
135137

138+
a new feature of the Java Virtual Machine ("preview VM feature"), or
139+
136140
a new module, package, class, interface, field, method, constructor, or enum constant in the java.* or javax.* namespace ("preview API")
137141

138142
that is fully specified, fully implemented, and yet impermanent. It is available in implementations of a given release of the Java SE Platform to provoke developer feedback based on real world use; this may lead to it becoming permanent in a future release of the Java SE Platform.
139143

140-
Implementations must disable, at both compile time and run time, the preview features defined by a given release of the Java SE Platform, unless the user indicates via the host system, at both compile time and run time, that preview features are to be enabled.
141-
142144
The preview features defined by a given release of the Java SE Platform are enumerated in the Java SE Platform Specification for that release. The preview features are specified as follows:
143145

144146
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.
145147

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.
148+
Preview VM features are specified in standalone documents that indicate changes ("diffs") to The Java® Virtual Machine Specification for that release. The specifications of preview VM features are incorporated into The Java® Virtual Machine Specification by reference, and made a part thereof, if and only if preview features are enabled at run time.
147149

148150
Preview APIs are specified within the Java SE API Specification for that release.
149151

150-
The rules for use of preview language features are as follows:
152+
1.5.1. Restrictions on the Use of Preview Features
153+
154+
Implementations of the Java SE Platform disable, at both compile time and run time, the preview features defined by a given release, unless the user indicates via the host system, at both compile time and run time, that preview features are enabled. Implementations do not provide a way to enable only some of the given release's preview features.
155+
156+
At compile time, the rules for use of preview language features are as follows:
151157

152158
If preview features are disabled, then any source code reference to a preview language feature, or to a class or interface declared using a preview language feature, causes a compile-time error.
153159

@@ -159,7 +165,7 @@ The reference appears in an import declaration (§7.5).
159165

160166
When preview features are enabled, Java compilers are strongly encouraged to give a non-suppressible warning for every source code reference to a preview language feature. Details of this warning are beyond the scope of this specification, but the intent should be to alert programmers to the possibility of code being affected by future changes to preview language features.
161167

162-
Some preview APIs are described as reflective by the Java SE Platform Specification, principally in the java.lang.reflect, java.lang.invoke, and javax.lang.model packages. The rule for use of reflective preview APIs is as follows:
168+
Some preview APIs are described as reflective by the Java SE Platform Specification, principally in the java.lang.reflect, java.lang.invoke, and javax.lang.model packages. At compile time, the rule for use of reflective preview APIs is as follows:
163169

164170
Whether preview features are enabled or disabled, any source code reference to a reflective preview API element causes a preview warning, unless one of the following is true:
165171

@@ -169,7 +175,7 @@ The reference appears in a declaration that is annotated to suppress preview war
169175

170176
The reference appears in an import declaration.
171177

172-
All preview APIs not described as reflective in the Java SE Platform Specification are normal. The rules for use of normal preview APIs are as follows:
178+
All preview APIs not described as reflective in the Java SE Platform Specification are normal. At compile time, the rules for use of normal preview APIs are as follows:
173179

174180
If preview features are disabled, then any source code reference to a normal preview API element causes a compile-time error, unless:
175181

@@ -183,6 +189,14 @@ The reference appears in a declaration that is annotated to suppress preview war
183189

184190
The reference appears in an import declaration.
185191

192+
1.5.2. Current Preview Language Features
193+
194+
Java SE 25 defines one preview language feature:
195+
196+
Primitive Types in Patterns, instanceof, and switch
197+
198+
The standalone documents which specify this preview feature are available at the web site which hosts this edition of The Java® Language Specification.
199+
186200
1.6. Feedback
187201

188202
Readers are invited to report technical errors and ambiguities in The Java® Language Specification to jls-jvms-spec-comments@openjdk.org.

chapter-11.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Table of Contents
88
11.1.3. Asynchronous Exceptions
99
11.2. Compile-Time Checking of Exceptions
1010
11.2.1. Exception Analysis of Expressions
11-
11.2.2. Exception Analysis of Statements
11+
11.2.2. Exception Analysis of Statements and Constructor Invocations
1212
11.2.3. Exception Checking
1313
11.3. Run-Time Handling of an Exception
1414

@@ -147,7 +147,7 @@ For every other kind of expression, the expression can throw an exception class
147147

148148
Note that a method reference expression (§15.13) of the form Primary :: [TypeArguments] Identifier can throw an exception class if the Primary subexpression can throw an exception class. In contrast, a lambda expression can throw nothing, and has no immediate subexpressions on which to perform exception analysis. It is the body of a lambda expression, containing expressions and statements, that can throw exception classes.
149149

150-
11.2.2. Exception Analysis of Statements
150+
11.2.2. Exception Analysis of Statements and Constructor Invocations
151151

152152
A throw statement (§14.18) whose thrown expression has static type E and is not a final or effectively final exception parameter can throw E or any exception class that the thrown expression can throw.
153153

@@ -169,12 +169,6 @@ Some catch block of the try statement can throw E and either no finally block is
169169

170170
A finally block is present and can throw E.
171171

172-
An explicit constructor invocation statement (§8.8.7.1) can throw an exception class E iff either:
173-
174-
Some expression of the constructor invocation's parameter list can throw E; or
175-
176-
E is determined to be an exception class of the throws clause of the constructor that is invoked (§15.12.2.6).
177-
178172
A switch statement (§14.11) can throw an exception class E iff either:
179173

180174
The selector expression can throw E; or
@@ -183,6 +177,12 @@ Some switch rule expression, switch rule block, switch rule throw statement, or
183177

184178
Any other statement S can throw an exception class E iff an expression or statement immediately contained in S can throw E.
185179

180+
A constructor invocation (§8.8.7.1) can throw an exception class E iff either:
181+
182+
Some expression of the constructor invocation's parameter list can throw E; or
183+
184+
E is determined to be an exception class of the throws clause of the constructor that is invoked (§15.12.2.6).
185+
186186
11.2.3. Exception Checking
187187

188188
It is a compile-time error if a method or constructor body can throw some exception class E when E is a checked exception class and E is not a subclass of some class declared in the throws clause of the method or constructor.

0 commit comments

Comments
 (0)