diff --git a/javaguide.html b/javaguide.html index 3ce36e5..5ef0dc8 100644 --- a/javaguide.html +++ b/javaguide.html @@ -186,37 +186,21 @@ statements.

3.3.3 Ordering and spacing

- - -

Import statements are divided into the following groups, in this order, with each group -separated by a single blank line:

+

Imports are ordered as follows:

    -
  1. All static imports in a single group - -
  2. - -
  3. com.google imports - (only if this source file is in the com.google package - space)
  4. - -
  5. Third-party imports, one group per top-level package, in ASCII sort order - -
  6. - -
  7. java imports
  8. - -
  9. javax imports
  10. +
  11. All static imports in a single block.
  12. +
  13. All non-static imports in a single block.
-

Within a group there are no blank lines, and the imported names appear in ASCII sort -order. (Note: this is not the same as the import statements being in -ASCII sort order; the presence of semicolons warps the result.)

+

If there are both static and non-static imports, a single blank line separates the two +blocks. There are no other blank lines between import statements.

+ +

Within each block the imported names appear in ASCII sort order. (Note: +this is not the same as the import statements being in ASCII sort order, since '.' +sorts before ';'.)

+ +

3.4 Class declaration

@@ -284,9 +268,15 @@ for nonempty blocks and block-like constructs:

else or a comma. -

Example:

+

Examples:

-
return new MyClass() {
+
return () -> {
+  while (condition()) {
+    method();
+  }
+};
+
+return new MyClass() {
   @Override public void method() {
     if (condition()) {
       try {
@@ -381,7 +371,8 @@ without the need to line-wrap.

such as C++ and JavaScript.) + but not + +
    +
  • the two colons (::) of a method reference, which + is written like Object::toString
  • +
  • the dot separator (.), which is written like + object.toString()
@@ -690,7 +693,8 @@ for example:

@Partial @Mock DataLoader loader;
 
-

There are no specific rules for formatting parameter and local variable annotations.

+

There are no specific rules for formatting annotations on parameters, local variables, or types. +

4.8.6 Comments

@@ -729,7 +733,7 @@ re-wrap the lines when necessary (paragraph-style). Most formatters don't re-wra recommended by the Java Language Specification:

-
public protected private abstract static final transient volatile synchronized native strictfp
+
public protected private abstract default static final transient volatile synchronized native strictfp
 

4.8.8 Numeric Literals