@CheckReturnValue public BugCheckerRefactoringTestHelper setFixChooser(FixChooser chooser) { this.fixChooser = chooser; return this; }
/** If set, fixes that produce output that doesn't compile are allowed. Off by default. */ @CheckReturnValue public BugCheckerRefactoringTestHelper allowBreakingChanges() { allowBreakingChanges = true; return this; }
/** * Tells the compilation helper to expect that no diagnostics will be generated, even if the * source file contains bug markers. Useful for testing that a check is actually disabled when the * proper command-line argument is passed. */ @CheckReturnValue public CompilationTestHelper expectNoDiagnostics() { this.expectNoDiagnostics = true; return this; }
@CheckReturnValue public BugCheckerRefactoringTestHelper setImportOrder(String importOrder) { this.importOrder = importOrder; return this; }
/** * By default, the compilation helper will not run Error Prone on compilations that fail with * javac errors. This behaviour can be disabled to test the interaction between Error Prone checks * and javac diagnostics. */ @CheckReturnValue public CompilationTestHelper ignoreJavacErrors() { this.checkWellFormed = false; return this; }
@CheckReturnValue public BugCheckerRefactoringTestHelper expectUnchanged() { return addInputAndOutput(input, input); } }
/** * By default, the compilation helper will only inspect diagnostics generated by the check being * tested. This behaviour can be disabled to test the interaction between Error Prone checks and * javac diagnostics. */ @CheckReturnValue public CompilationTestHelper matchAllDiagnostics() { this.lookForCheckNameInDiagnostic = LookForCheckNameInDiagnostic.NO; return this; }
/** * Sets the classpath for the test compilation, overriding the default of using the runtime * classpath of the test execution. This is useful to verify correct behavior when the classpath * is incomplete. * * @param classes the class(es) to use as the classpath */ @CheckReturnValue public CompilationTestHelper withClasspath(Class<?>... classes) { this.overrideClasspath = ImmutableList.copyOf(classes); return this; }
/** * Sets custom command-line arguments for the compilation. These will be appended to the default * compilation arguments. */ @CheckReturnValue public CompilationTestHelper setArgs(List<String> args) { this.extraArgs = ImmutableList.copyOf(args); return this; }
/** * Tells the compilation helper to expect a specific result from the compilation, e.g. success or * failure. */ @CheckReturnValue public CompilationTestHelper expectResult(Result result) { expectedResult = Optional.of(result); return this; }
/** * Returns a new thread factory using the options supplied during the building process. After * building, it is still possible to change the options used to build the ThreadFactory and/or * build again. State is not shared amongst built instances. * * @return the fully constructed {@link ThreadFactory} */ @CheckReturnValue public ThreadFactory build() { return doBuild(this); }
@CheckReturnValue public BugCheckerRefactoringTestHelper setArgs(String... args) { this.options = ImmutableList.copyOf(args); return this; }
/** * Returns a new immutable array. The builder can continue to be used after this call, to append * more values and build again. * * <p><b>Performance note:</b> the returned array is backed by the same array as the builder, so * no data is copied as part of this step, but this may occupy more memory than strictly * necessary. To copy the data to a right-sized backing array, use {@code .build().trimmed()}. */ @CheckReturnValue public ImmutableDoubleArray build() { return count == 0 ? EMPTY : new ImmutableDoubleArray(array, 0, count); } }
/** * Returns a new immutable array. The builder can continue to be used after this call, to append * more values and build again. * * <p><b>Performance note:</b> the returned array is backed by the same array as the builder, so * no data is copied as part of this step, but this may occupy more memory than strictly * necessary. To copy the data to a right-sized backing array, use {@code .build().trimmed()}. */ @CheckReturnValue public ImmutableIntArray build() { return count == 0 ? EMPTY : new ImmutableIntArray(array, 0, count); } }
/** * Returns a new immutable array. The builder can continue to be used after this call, to append * more values and build again. * * <p><b>Performance note:</b> the returned array is backed by the same array as the builder, so * no data is copied as part of this step, but this may occupy more memory than strictly * necessary. To copy the data to a right-sized backing array, use {@code .build().trimmed()}. */ @CheckReturnValue public ImmutableLongArray build() { return count == 0 ? EMPTY : new ImmutableLongArray(array, 0, count); } }
@CheckReturnValue public <K1 extends K, V1 extends V> CacheBuilder<K1, V1> removalListener( RemovalListener<? super K1, ? super V1> listener) {
/** * Returns a new thread factory using the options supplied during the building process. After * building, it is still possible to change the options used to build the ThreadFactory and/or * build again. State is not shared amongst built instances. * * @return the fully constructed {@link ThreadFactory} */ @CheckReturnValue public ThreadFactory build() { return doBuild(this); }
/** * Returns a new immutable array. The builder can continue to be used after this call, to append * more values and build again. * * <p><b>Performance note:</b> the returned array is backed by the same array as the builder, so * no data is copied as part of this step, but this may occupy more memory than strictly * necessary. To copy the data to a right-sized backing array, use {@code .build().trimmed()}. */ @CheckReturnValue public ImmutableLongArray build() { return count == 0 ? EMPTY : new ImmutableLongArray(array, 0, count); } }
/** * Returns a new immutable array. The builder can continue to be used after this call, to append * more values and build again. * * <p><b>Performance note:</b> the returned array is backed by the same array as the builder, so * no data is copied as part of this step, but this may occupy more memory than strictly * necessary. To copy the data to a right-sized backing array, use {@code .build().trimmed()}. */ @CheckReturnValue public ImmutableIntArray build() { return count == 0 ? EMPTY : new ImmutableIntArray(array, 0, count); } }
/** * Returns a new immutable array. The builder can continue to be used after this call, to append * more values and build again. * * <p><b>Performance note:</b> the returned array is backed by the same array as the builder, so * no data is copied as part of this step, but this may occupy more memory than strictly * necessary. To copy the data to a right-sized backing array, use {@code .build().trimmed()}. */ @CheckReturnValue public ImmutableDoubleArray build() { return count == 0 ? EMPTY : new ImmutableDoubleArray(array, 0, count); } }