@@ -183,7 +183,12 @@ <h3 id="s3.1-copyright-statement">3.1 License or copyright information, if prese
183183< a id ="s3.2-package-statement "> </ a >
184184< h3 id ="s3.2-package-declaration "> 3.2 Package declaration</ h3 >
185185
186- < p > The package declaration is < strong > not line-wrapped</ strong > . The column limit (Section 4.4,
186+ < p > Every source file must have a package declaration. < a href ="https://openjdk.org/jeps/512 ">
187+ Compact source files</ a > are not used. (This rule obviously does not apply to
188+ < code > module-info.java</ code > files, which have a different syntax that does not include a
189+ package declaration.)
190+
191+ </ p > < p > The package declaration is < strong > not line-wrapped</ strong > . The column limit (Section 4.4,
187192< a href ="#s4.4-column-limit "> Column limit: 100</ a > ) does not apply to package declarations.</ p >
188193
189194< a id ="imports "> </ a >
@@ -194,6 +199,16 @@ <h4 id="s3.3.1-wildcard-imports">3.3.1 No wildcard imports</h4>
194199< p > < strong > Wildcard ("on-demand") imports</ strong > , static or otherwise, < strong > are not
195200 used</ strong > .</ p >
196201
202+ < h4 id ="s3.3.1.1-module-imports "> 3.3.1.1 No module imports</ h4 >
203+
204+ < p > < a href ="https://docs.oracle.com/en/java/javase/25/language/module-import-declarations.html ">
205+ Module imports</ a > < strong > are not used</ strong > .</ p >
206+
207+ < p > Example:</ p >
208+
209+ < pre class ="prettyprint lang-java "> import module java.base;
210+ </ pre >
211+
197212< h4 id ="s3.3.2-import-line-wrapping "> 3.3.2 No line-wrapping</ h4 >
198213
199214< p > Imports are < strong > not line-wrapped</ strong > . The column limit (Section 4.4,
@@ -855,7 +870,7 @@ <h5 id="s4.8.5.2-class-annotation-style">4.8.5.2 Class, package, and module anno
855870</ pre >
856871< pre class ="prettyprint lang-java "> /** This is a module. */
857872@Deprecated
858- @SuppressWarnings("CheckReturnValue")
873+ @SuppressWarnings("CheckReturnValue") // TODO: b/123 - Fix existing CRV violations.
859874module com.example.frozzler { ... }
860875</ pre >
861876
@@ -869,8 +884,9 @@ <h5 id="s4.8.5.3-method-annotation-style">4.8.5.3 Method and constructor annotat
869884public String getNameIfPresent() { ... }
870885</ pre >
871886
872- < p class ="exception "> < strong > Exception:</ strong > A < em > single</ em > parameterless annotation
873- < em > may</ em > instead appear together with the first line of the signature, for example:</ p >
887+ < p class ="exception "> < strong > Exception:</ strong > If the method or constructor only has a
888+ < em > single</ em > , < em > parameterless</ em > annotation, it < em > may</ em > appear together with the first
889+ line of the signature, for example:</ p >
874890
875891< pre class ="prettyprint lang-java "> @Override public int hashCode() { ... }
876892</ pre >
@@ -1111,6 +1127,14 @@ <h4 id="s5.2.8-type-variable-names">5.2.8 Type variable names</h4>
11111127 < code class ="prettyprint lang-java "> FooBarT</ code > ).</ li >
11121128</ ul >
11131129
1130+ < h4 id ="s5.2.9-unnamed-variables "> 5.2.9 Unnamed variables</ h4 >
1131+
1132+ < p > The < code class ="prettyprint lang-java "> _</ code > syntax for unnamed variables and parameters is
1133+ allowed wherever it is applicable. For example:</ p >
1134+
1135+ < pre class ="prettyprint lang-java "> Predicate<String> alwaysTrue = _ -> true;
1136+ </ pre >
1137+
11141138< a id ="acronyms "> </ a >
11151139< a id ="camelcase "> </ a >
11161140< h3 id ="s5.3-camel-case "> 5.3 Camel case: defined</ h3 >
@@ -1232,7 +1256,7 @@ <h3 id="s6.2-caught-exceptions">6.2 Caught exceptions: not ignored</h3>
12321256< pre class ="prettyprint lang-java "> try {
12331257 int i = Integer.parseInt(response);
12341258 return handleNumericResponse(i);
1235- } catch (NumberFormatException ok ) {
1259+ } catch (NumberFormatException _ ) {
12361260 // it's not numeric; that's fine, just continue
12371261}
12381262return handleTextResponse(response);
0 commit comments