diff --git a/javaguide.html b/javaguide.html index d6f54bfb5..a3f23a425 100644 --- a/javaguide.html +++ b/javaguide.html @@ -183,7 +183,12 @@

3.2 Package declaration

-

The package declaration is not line-wrapped. The column limit (Section 4.4, +

Every source file must have a package declaration. +Compact source files are not used. (This rule obviously does not apply to +module-info.java files, which have a different syntax that does not include a +package declaration.) + +

The package declaration is not line-wrapped. The column limit (Section 4.4, Column limit: 100) does not apply to package declarations.

@@ -194,6 +199,16 @@

3.3.1 No wildcard imports

Wildcard ("on-demand") imports, static or otherwise, are not used.

+

3.3.1.1 No module imports

+ +

+Module imports are not used.

+ +

Example:

+ +
import module java.base;
+
+

3.3.2 No line-wrapping

Imports are not line-wrapped. The column limit (Section 4.4, @@ -855,7 +870,7 @@

4.8.5.2 Class, package, and module anno
/** This is a module. */
 @Deprecated
-@SuppressWarnings("CheckReturnValue")
+@SuppressWarnings("CheckReturnValue") // TODO: b/123 - Fix existing CRV violations.
 module com.example.frozzler { ... }
 
@@ -869,8 +884,9 @@
4.8.5.3 Method and constructor annotat public String getNameIfPresent() { ... } -

Exception: A single parameterless annotation -may instead appear together with the first line of the signature, for example:

+

Exception: If the method or constructor only has a +single, parameterless annotation, it may appear together with the first +line of the signature, for example:

@Override public int hashCode() { ... }
 
@@ -1111,6 +1127,14 @@

5.2.8 Type variable names

FooBarT). +

5.2.9 Unnamed variables

+ +

The _ syntax for unnamed variables and parameters is +allowed wherever it is applicable. For example:

+ +
Predicate<String> alwaysTrue = _ -> true;
+
+

5.3 Camel case: defined

@@ -1232,7 +1256,7 @@

6.2 Caught exceptions: not ignored

try {
   int i = Integer.parseInt(response);
   return handleNumericResponse(i);
-} catch (NumberFormatException ok) {
+} catch (NumberFormatException _) {
   // it's not numeric; that's fine, just continue
 }
 return handleTextResponse(response);