Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@
if (afterFirstToken) {
builder.forcedBreak();
}
builder.open(row.iterator().next().getKind() == NEW_ARRAY || cols == 1 ? ZERO : plusFour);

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 530 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / Publish snapshot

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs
boolean firstInRow = true;
for (ExpressionTree item : row) {
if (!firstInRow) {
Expand Down Expand Up @@ -767,7 +767,7 @@
CollapseEmptyOrNot.YES,
AllowLeadingBlankLine.YES,
AllowTrailingBlankLine.YES);
if (node.getStatement().getKind() == BLOCK) {

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 770 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / Publish snapshot

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs
builder.space();
} else {
builder.breakOp(" ");
Expand Down Expand Up @@ -1083,11 +1083,11 @@
builder.open(plusFour);
builder.open(
node.getInitializer().size() > 1
&& node.getInitializer().get(0).getKind() == Tree.Kind.EXPRESSION_STATEMENT

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1086 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / Publish snapshot

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs
? plusFour
: ZERO);
if (!node.getInitializer().isEmpty()) {
if (node.getInitializer().get(0).getKind() == VARIABLE) {

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1090 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / Publish snapshot

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs
PeekingIterator<StatementTree> it =
Iterators.peekingIterator(node.getInitializer().iterator());
visitVariables(
Expand Down Expand Up @@ -1151,7 +1151,7 @@
while (true) {
expressions.add(node.getCondition());
statements.add(node.getThenStatement());
if (node.getElseStatement() != null && node.getElseStatement().getKind() == IF) {

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs

Check warning on line 1154 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / Publish snapshot

[PreferInstanceofOverGetKind] Prefer instanceof over getKind() checks where possible, as these work well with pattern matching instanceofs
node = (IfTree) node.getElseStatement();
} else {
break;
Expand Down Expand Up @@ -2643,8 +2643,7 @@
"default",
"sealed",
"non",
"-",
"value" ->
"-" ->
true;
default -> false;
};
Expand Down Expand Up @@ -2991,7 +2990,7 @@
builder.close();
}

/** Collapse chains of {@code .} operators, across multiple {@link ASTNode} types. */

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on ubuntu-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 25 on macos-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / JDK 21 on ubuntu-latest

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

Check warning on line 2993 in core/src/main/java/com/google/googlejavaformat/java/JavaInputAstVisitor.java

View workflow job for this annotation

GitHub Actions / Publish snapshot

[NotJavadoc] This element has multiple Javadoc comments; only the last one will be used.

/**
* Output a "." node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Iterables.getLast;

import com.google.common.base.Enums;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Ordering;
import com.google.common.collect.Range;
Expand Down Expand Up @@ -185,7 +184,7 @@ private static void addTrivia(StringBuilder replacement, ImmutableList<? extends
if (modifier == null) {
return null;
}
return Enums.getIfPresent(Modifier.class, "NON_" + modifier.name()).orNull();
return Modifier.valueOf("NON_" + modifier.name());
}

/**
Expand Down Expand Up @@ -214,7 +213,6 @@ private static void addTrivia(StringBuilder replacement, ImmutableList<? extends
default ->
switch (token.getTok().getText()) {
case "sealed" -> Modifier.SEALED;
case "value" -> Enums.getIfPresent(Modifier.class, "VALUE").orNull();
default -> null;
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.common.truth.TruthJUnit.assume;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertThrows;

import com.google.common.base.Enums;
import com.google.common.io.CharStreams;
import com.google.googlejavaformat.java.JavaFormatterOptions.Style;
import java.io.ByteArrayInputStream;
Expand All @@ -31,7 +29,6 @@
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import javax.lang.model.element.Modifier;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand Down Expand Up @@ -872,38 +869,4 @@ public void maxLineLengthOutOfRange() {

assertThat(Style.builder().maxLineLength(999).build().maxLineLength()).isEqualTo(999);
}

@Test
public void valueClassAndRecord() throws Exception {
assume().that(Enums.getIfPresent(Modifier.class, "VALUE").isPresent()).isTrue();
String input =
"""
value final public class PointValueClass {
final int x;
final int y;

PointValueClass(int x, int y) {
this.x = x;
this.y = y;
}
}

value public record PointValueRecord(int x, int y) {}
""";
String expected =
"""
public final value class PointValueClass {
final int x;
final int y;

PointValueClass(int x, int y) {
this.x = x;
this.y = y;
}
}

public value record PointValueRecord(int x, int y) {}
""";
assertThat(new Formatter().formatSource(input)).isEqualTo(expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
package com.google.googlejavaformat.java;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.TruthJUnit.assume;

import com.google.common.base.Enums;
import com.google.common.collect.Range;
import java.util.Arrays;
import javax.lang.model.element.Modifier;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand Down Expand Up @@ -111,11 +108,4 @@ public void sealedClass() throws FormatterException {
assertThat(ModifierOrderer.reorderModifiers("non-sealed sealed public").getText())
.isEqualTo("public sealed non-sealed");
}

@Test
public void valueClass() throws FormatterException {
assume().that(Enums.getIfPresent(Modifier.class, "VALUE").isPresent()).isTrue();
assertThat(ModifierOrderer.reorderModifiers("value final public").getText())
.isEqualTo("public final value");
}
}
Loading