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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
dependencies {
classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.6.0'
classpath 'com.gradle.publish:plugin-publish-plugin:1.3.1'
classpath 'com.palantir.baseline:gradle-baseline-java:6.42.0'
classpath 'com.palantir.baseline:gradle-baseline-java:6.43.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.36.0'
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.19.0'
classpath 'com.palantir.gradle.failure-reports:gradle-failure-reports:1.14.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public abstract class ExecutableTransform implements TransformAction<TransformPa
@InputArtifact
public abstract Provider<FileSystemLocation> getInputArtifact();

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public void transform(TransformOutputs outputs) {
File inputFile = getInputArtifact().get().getAsFile();
Expand All @@ -58,6 +59,7 @@ public void transform(TransformOutputs outputs) {
}
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
private static void makeFileExecutable(Path pathToExe) {
try {
Set<PosixFilePermission> existingPermissions = Files.getPosixFilePermissions(pathToExe);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public FormatterService serviceLoad() {

@SuppressWarnings("for-rollout:NullAway")
private FormatterService serviceLoadInternal() {
@SuppressWarnings("for-rollout:PreferUncheckedIoException")
URL[] jarUris = configuration.getFiles().stream()
.map(file -> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static final class State implements Serializable {
this.memoizedFormatter = memoizedFormatter;
}

@SuppressWarnings("NullableProblems")
@SuppressWarnings({"NullableProblems", "for-rollout:PreferUncheckedIoException"})
FormatterFunc createFormat() {
return input -> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ private static URL[] toUrlsUnchecked(List<Path> paths) {
.toArray(URL[]::new);
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
private static List<Path> listDirAsUrlsUnchecked(Path dir) {
try (Stream<Path> list = Files.list(dir)) {
return list.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Optional<String> getImplementationVersion() {
return Optional.ofNullable(FormatterProvider.getPluginDescriptor().getVersion());
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
Optional<String> computeFormatterVersion() {
return getImplementationClassPath().map(classpath -> classpath.stream()
.flatMap(uri -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ protected Project getProject() {
@NotNull
protected LightProjectDescriptor getProjectDescriptor() {
return new DefaultLightProjectDescriptor() {
@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public Sdk getSdk() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static class BenchmarkState {

final List<String> filesToFormat = getFilesToFormat();

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
private static List<String> getFilesToFormat() {
Path srcJavaFormatFiles = Paths.get(".")
.toAbsolutePath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public BootstrappingFormatterService(Path jdkPath, Integer jdkMajorVersion, List
this.implementationClassPath = implementationClassPath;
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public ImmutableList<Replacement> getFormatReplacements(String input, Collection<Range<Integer>> ranges) {
try {
Expand All @@ -59,6 +60,7 @@ public ImmutableList<Replacement> getFormatReplacements(String input, Collection
}
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public String formatSourceReflowStringsAndFixImports(String input) {
try {
Expand All @@ -68,6 +70,7 @@ public String formatSourceReflowStringsAndFixImports(String input) {
}
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public String fixImports(String input) throws FormatterException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public NativeImageFormatterService(Path nativeImagePath) {
this.nativeImagePath = nativeImagePath;
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public ImmutableList<Replacement> getFormatReplacements(String input, Collection<Range<Integer>> ranges) {
try {
Expand All @@ -63,6 +64,7 @@ public ImmutableList<Replacement> getFormatReplacements(String input, Collection
}
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public String formatSourceReflowStringsAndFixImports(String input) {
try {
Expand All @@ -72,6 +74,7 @@ public String formatSourceReflowStringsAndFixImports(String input) {
}
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public String fixImports(String input) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public interface Cases<R> {
*/
static class Json extends JsonSerializer<BreakBehaviour> {

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public void serialize(BreakBehaviour value, JsonGenerator gen, SerializerProvider serializers)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static Path getOutputFile() {
return publicDir.resolve("output.js");
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
static void render(
JavaInput javaInput,
OpsOutput opsOutput,
Expand Down Expand Up @@ -84,6 +85,7 @@ private static String outputAsString(JavaOutput javaOutput) {
return output.toString();
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
private static String opsJson(OpsOutput opsOutput) {
ArrayNode arrayNode = OBJECT_MAPPER.createArrayNode();

Expand Down Expand Up @@ -145,6 +147,7 @@ private static String opsJson(OpsOutput opsOutput) {
}
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
private static String jsonEscapedString(String javaInput) {
try {
return OBJECT_MAPPER.writeValueAsString(javaInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public String call() throws FormatterException {
return formatFile(formatter);
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
private String formatReplacements(Formatter formatter) throws FormatterException {
ImmutableList<Replacement> replacements =
formatter.getFormatReplacements(input, characterRanges(input).asRanges());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ static JavaOutput format(
return javaOutput;
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
static JCCompilationUnit parseJcCompilationUnit(Context context, String sourceText) throws FormatterException {
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
context.put(DiagnosticListener.class, diagnostics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import javax.tools.SimpleJavaFileObject;

/** {@code JavaInput} extends {@link Input} to represent a Java input document. */
@SuppressWarnings("for-rollout:ThrowError")
public final class JavaInput extends Input {
/**
* A {@code JavaInput} is a sequence of {@link Tok}s that cover the Java input. A {@link Tok} is either a token (if
Expand Down Expand Up @@ -475,7 +476,7 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept
* @param handler the diagnostic handler
* @return a collection of diagnostics
*/
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "for-rollout:ThrowError"})
private static Collection<JCDiagnostic> getDiagnostics(DeferredDiagnosticHandler handler) {
try {
return (Collection<JCDiagnostic>) GET_DIAGNOSTICS.invoke(handler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3623,6 +3623,7 @@ private void declareMany(List<VariableTree> fragments, Direction annotationDirec
}

/** Add a list of declarations. */
@SuppressWarnings("for-rollout:NullAway")
protected void addBodyDeclarations(
List<? extends Tree> bodyDeclarations, BracesOrNot braces, FirstDeclarationsOrNot first0) {
if (bodyDeclarations.isEmpty()) {
Expand All @@ -3648,7 +3649,6 @@ protected void addBodyDeclarations(
Tree bodyDeclaration = it.next();
dropEmptyDeclarations();
builder.forcedBreak();
@SuppressWarnings("for-rollout:NullAway")
boolean thisOneGetsBlankLineBefore =
!(bodyDeclaration instanceof VariableTree) || hasJavaDoc(bodyDeclaration);
if (first) {
Expand Down Expand Up @@ -3715,7 +3715,6 @@ private void classDeclarationTypeList(String token, List<? extends Tree> types)
*
* <p>e.g. {@code int x, y;} is parsed as {@code int x; int y;}.
*/
@SuppressWarnings("for-rollout:NullAway")
private List<VariableTree> variableFragments(PeekingIterator<? extends Tree> it, Tree first) {
List<VariableTree> fragments = new ArrayList<>();
if (first instanceof VariableTree) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public FinishLevelNode writeLevelNode(int levelNodeId, int parentExplorationId,
return acceptedExplorationId -> json.put("acceptedExplorationId", acceptedExplorationId);
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
@Override
public String getOutput() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ private int formatFiles(CommandLineOptions parameters, JavaFormatterOptions opti
return allOk ? 0 : 1;
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
private int formatStdin(CommandLineOptions parameters, JavaFormatterOptions options) {
String input;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static int getEndPosition(Tree expression, TreePath path) {
}

/** Returns the source text for the node. */
@SuppressWarnings("for-rollout:PreferUncheckedIoException")
static String getSourceForNode(Tree node, TreePath path) {
CharSequence source;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ private Path getOutputTestPath(String testName) {
return fullTestPath.resolve(testName + ".output");
}

@SuppressWarnings("for-rollout:PreferUncheckedIoException")
public void writeFormatterOutput(String testName, String output) {
try (BufferedWriter writer = Files.newBufferedWriter(getOutputTestPath(testName))) {
writer.append(output);
Expand Down