From b075cb7cad464b224103fb2ec8fdb8521ec08e7f Mon Sep 17 00:00:00 2001
From: Liam Miller-Cushon 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: 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 ';'.) 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.) Example: Examples: 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.
+3.3.2 No line-wrapping
3.3.3 Ordering and spacing
-
-
-
-
-
-
- com.google
imports
- (only if this source file is in the com.google
package
- space)
-
- android
, com
, org
, sun
java
importsjavax
imports3.4 Class declaration
@@ -284,9 +268,15 @@ 4.1.2 Nonempty blocks: K & R style
else
or a comma.
-return () -> {
+ while (condition()) {
+ method();
+ }
+};
-
return new MyClass() {
+return new MyClass() {
@Override public void method() {
if (condition()) {
try {
@@ -381,7 +371,8 @@
4.5.1 Where to break
such as C++ and JavaScript.)
+ but not
+
+ .
), the ampersand in type bounds
+ (.
), the two colons of a method reference
+ (::
), the ampersand in type bounds
(<T extends Foo & Bar>
), and the pipe in
catch blocks
(catch (FooException | BarException e)
).4.6.1 Vertical Whitespace
4.6.2 Horizontal whitespace
:
) in an enhanced
for
("foreach") statement(String str) -> str.length()
+
@@ -690,7 +693,8 @@ ::
) of a method reference, which
+ is written like Object::toString
.
), which is written like
+ object.toString()
4.8.5 Annotations
@Partial @Mock DataLoader loader;
-4.8.6 Comments
@@ -729,7 +733,7 @@ 4.8.7 Modifiers
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 strictfp4.8.8 Numeric Literals