Skip to content

Commit 37f716a

Browse files
java-team-github-botgoogle-java-format Team
authored and
google-java-format Team
committed
Automated rollback of commit 1a87579.
*** Reason for rollback *** TAP shows this is broke Voice Access (and perhaps other projects) [] *** Original change description *** Format type annotation as part of the type, not part of the modifiers list Given e.g. `@Deprecated @nullable Object foo() {}`, prefer this: ``` @deprecated @nullable Object foo() {} ``` instead of: ``` @deprecated @nullable Object foo() {} ``` The implementation is complicated by the fact that the AST doesn't store source position information for modifiers, and there's no requirement that declaration annotations, modifiers, and type annotations appear in any particular order in source. To... *** PiperOrigin-RevId: 392785771
1 parent 1a87579 commit 37f716a

File tree

7 files changed

+68
-398
lines changed

7 files changed

+68
-398
lines changed

core/pom.xml

+1-5
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@
5151
<artifactId>error_prone_annotations</artifactId>
5252
<optional>true</optional>
5353
</dependency>
54-
<dependency>
55-
<groupId>com.google.auto.value</groupId>
56-
<artifactId>auto-value-annotations</artifactId>
57-
<optional>true</optional>
58-
</dependency>
54+
5955

6056
<!-- Test dependencies -->
6157
<dependency>

core/src/main/java/com/google/googlejavaformat/OpsBuilder.java

-24
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import static java.lang.Math.min;
1919

2020
import com.google.common.base.MoreObjects;
21-
import com.google.common.base.Preconditions;
22-
import com.google.common.base.Predicate;
2321
import com.google.common.collect.ArrayListMultimap;
2422
import com.google.common.collect.ImmutableList;
2523
import com.google.common.collect.Iterables;
@@ -283,28 +281,6 @@ public final Optional<String> peekToken(int skip) {
283281
: Optional.empty();
284282
}
285283

286-
/**
287-
* Returns the {@link Input.Tok}s starting at the current source position, which are satisfied by
288-
* the given predicate.
289-
*/
290-
public ImmutableList<Tok> peekTokens(int startPosition, Predicate<Input.Tok> predicate) {
291-
ImmutableList<? extends Input.Token> tokens = input.getTokens();
292-
Preconditions.checkState(
293-
tokens.get(tokenI).getTok().getPosition() == startPosition,
294-
"Expected the current token to be at position %s, found: %s",
295-
startPosition,
296-
tokens.get(tokenI));
297-
ImmutableList.Builder<Tok> result = ImmutableList.builder();
298-
for (int idx = tokenI; idx < tokens.size(); idx++) {
299-
Tok tok = tokens.get(idx).getTok();
300-
if (!predicate.apply(tok)) {
301-
break;
302-
}
303-
result.add(tok);
304-
}
305-
return result.build();
306-
}
307-
308284
/**
309285
* Emit an optional token iff it exists on the input. This is used to emit tokens whose existence
310286
* has been lost in the AST.

0 commit comments

Comments
 (0)