Skip to content

Commit

Permalink
Clean up bugpattern AutoValueSubclassLeaked (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkdn authored Jan 20, 2025
1 parent 5a0f148 commit 78003ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.common.truth.FailureMetadata;
import com.google.common.truth.Subject;
import com.google.common.truth.Truth;
import java.util.Arrays;
import java.util.Set;

/** Result of program invocation. */
Expand All @@ -37,6 +36,10 @@ public abstract class ProgramResult {
/** Returns {@code true} if program invocation failed. */
public abstract boolean failed();

static ProgramResult create(Set<String> errors, Set<String> warnings, boolean failed) {
return new AutoValue_ProgramResult(errors, warnings, failed);
}

/** Begins a Truth assertion about a program invocation result. */
public static ResultChain assertThat(ProgramResult result) {
return Truth.assertAbout(SUBJECT_FACTORY).that(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public final class ProgramRunner<T extends Program> {
/** Runs program and returns result of invocation. */
public ProgramResult run() throws Exception {
delegate.run();
return new AutoValue_ProgramResult(reporter.getErrors(), reporter.getWarnings(), failed.get());
return ProgramResult.create(reporter.getErrors(), reporter.getWarnings(), failed.get());
}
}

0 comments on commit 78003ba

Please # to comment.