Skip to content
Closed
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 @@ -461,7 +461,7 @@ class BeamModulePlugin implements Plugin<Project> {
def aws_java_sdk2_version = "2.17.127"
def cassandra_driver_version = "3.10.2"
def cdap_version = "6.5.1"
def checkerframework_version = "3.12.0"
def checkerframework_version = "3.16.0"
def classgraph_version = "4.8.104"
def dbcp2_version = "2.8.0"
def errorprone_version = "2.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public static void main(String[] args) {
* @param options The execution options.
* @return The pipeline result.
*/
@SuppressWarnings({"dereference.of.nullable", "argument.type.incompatible"})
@SuppressWarnings({"dereference.of.nullable", "argument"})
public static PipelineResult run(DataTokenizationOptions options) {
SchemasUtils schema = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void close() {
}

@ProcessElement
@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
public void process(@Element KV<Integer, Iterable<Row>> element, ProcessContext context) {
Iterable<Row> rows = element.getValue();

Expand Down Expand Up @@ -246,7 +246,7 @@ private String formatJsonsToRpcBatch(Iterable<String> jsons) {
return stringBuilder.toString();
}

@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
private ArrayList<Row> getTokenizedRow(Iterable<Row> inputRows) throws IOException {
ArrayList<Row> outputRows = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public JsonToBeamRow(String failedToParseDeadLetterPath, SchemasUtils schema) {
}

@Override
@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
public PCollection<Row> expand(PCollection<String> jsons) {
ParseResult rows =
jsons.apply(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
import org.slf4j.LoggerFactory;

/** Common transforms for Csv files. */
@SuppressWarnings({"argument.type.incompatible"})
@SuppressWarnings({"argument"})
public class CsvConverters {

/* Logger for class. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static Builder newBuilder() {

public abstract @Nullable Duration windowDuration();

@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
@Override
public PDone expand(PCollection<FailsafeElement<String, String>> pCollection) {

Expand Down Expand Up @@ -266,7 +266,7 @@ public static <T, V> WriteErrorsToTextIO.Builder<T, V> newBuilder() {
public abstract @Nullable Duration windowDuration();

@Override
@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
public PDone expand(PCollection<FailsafeElement<T, V>> pCollection) {

PCollection<String> formattedErrorRows =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
*/
@SuppressWarnings({
"initialization.fields.uninitialized",
"method.invocation.invalid",
"method.invocation",
"dereference.of.nullable",
"argument.type.incompatible",
"return.type.incompatible"
"argument",
"return"
})
public class SchemasUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
*/
package org.apache.beam.sdk.io;

import static org.apache.beam.sdk.util.Preconditions.checkArgumentNotNull;
import static org.apache.beam.sdk.util.Preconditions.checkStateNotNull;
import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument;
import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkNotNull;
import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkState;

import java.io.File;
Expand All @@ -40,7 +41,7 @@ class LocalResourceId implements ResourceId {
private transient volatile @Nullable Path cachedPath;

static LocalResourceId fromPath(Path path, boolean isDirectory) {
checkNotNull(path, "path");
checkArgumentNotNull(path, "path");
return new LocalResourceId(path, isDirectory);
}

Expand Down Expand Up @@ -78,7 +79,7 @@ public LocalResourceId getCurrentDirectory() {
if (parent == null && path.getNameCount() == 1) {
parent = Paths.get(".");
}
checkState(parent != null, "Failed to get the current directory for path: [%s].", pathString);
checkStateNotNull(parent, "Failed to get the current directory for path: [%s].", pathString);
return fromPath(parent, true /* isDirectory */);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class MetricsEnvironment {
private static final AtomicBoolean METRICS_SUPPORTED = new AtomicBoolean(false);
private static final AtomicBoolean REPORTED_MISSING_CONTAINER = new AtomicBoolean(false);

@SuppressWarnings("type.argument.type.incompatible") // object guaranteed to be non-null
@SuppressWarnings("type.argument") // object guaranteed to be non-null
private static final ThreadLocal<@NonNull MetricsContainerHolder> CONTAINER_FOR_THREAD =
ThreadLocal.withInitial(MetricsContainerHolder::new);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ final class ScheduledFutureTask<@Nullable @KeyForBottom V> extends FutureTask<V>
}

/** Creates a periodic action with given nanoTime-based initial trigger time and period. */
@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
ScheduledFutureTask(Runnable r, @Nullable V result, long triggerTime, long period) {
super(r, result);
this.time = triggerTime;
Expand Down Expand Up @@ -247,7 +247,7 @@ public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedE

@Override
/* UnboundedScheduledExecutorService is the only caller after it has been initialized.*/
@SuppressWarnings("method.invocation.invalid")
@SuppressWarnings("method.invocation")
public void execute(Runnable command) {
// These are already guaranteed to be a ScheduledFutureTask so there is no need to wrap
// it in another ScheduledFutureTask.
Expand Down Expand Up @@ -366,7 +366,7 @@ public void execute(Runnable command) {

@Override
/* Ignore improper flag since FB detects that ScheduledExecutorService can't have nullable V. */
@SuppressWarnings("override.return.invalid")
@SuppressWarnings("override.return")
public <@Nullable @KeyForBottom T> Future<T> submit(Runnable command, T result) {
if (command == null) {
throw new NullPointerException();
Expand All @@ -378,7 +378,7 @@ public void execute(Runnable command) {

@Override
/* Ignore improper flag since FB detects that ScheduledExecutorService can't have nullable V. */
@SuppressWarnings({"override.param.invalid", "override.return.invalid"})
@SuppressWarnings({"override.param", "override.return"})
public <@Nullable @KeyForBottom T> Future<T> submit(Callable<T> command) {
if (command == null) {
throw new NullPointerException();
Expand Down Expand Up @@ -418,7 +418,7 @@ public void execute(Runnable command) {
}

@Override
public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
public ScheduledFuture<@Nullable ?> schedule(Runnable command, long delay, TimeUnit unit) {
if (command == null || unit == null) {
throw new NullPointerException();
}
Expand All @@ -430,7 +430,7 @@ public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)

@Override
/* Ignore improper flag since FB detects that ScheduledExecutorService can't have nullable V. */
@SuppressWarnings({"override.param.invalid", "override.return.invalid"})
@SuppressWarnings({"override.param", "override.return"})
public <@Nullable @KeyForBottom V> ScheduledFuture<V> schedule(
Callable<V> callable, long delay, TimeUnit unit) {
if (callable == null || unit == null) {
Expand All @@ -442,7 +442,7 @@ public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
}

@Override
public ScheduledFuture<?> scheduleAtFixedRate(
public ScheduledFuture<@Nullable ?> scheduleAtFixedRate(
Runnable command, long initialDelay, long period, TimeUnit unit) {
if (command == null || unit == null) {
throw new NullPointerException();
Expand All @@ -458,7 +458,7 @@ public ScheduledFuture<?> scheduleAtFixedRate(
}

@Override
public ScheduledFuture<?> scheduleWithFixedDelay(
public ScheduledFuture<@Nullable ?> scheduleWithFixedDelay(
Runnable command, long initialDelay, long delay, TimeUnit unit) {
if (command == null || unit == null) {
throw new NullPointerException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
* @param <InputT> input {@link PInput} type of the transform
* @param <OutputT> output {@link POutput} type of the transform
*/
@SuppressWarnings({"argument.type.incompatible", "assignment.type.incompatible"})
@SuppressFBWarnings("UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD")
class JavaClassLookupTransformProvider<InputT extends PInput, OutputT extends POutput>
implements TransformProvider<PInput, POutput> {
Expand All @@ -89,6 +88,7 @@ public JavaClassLookupTransformProvider(AllowList allowList) {
this.allowList = allowList;
}

@SuppressWarnings("argument")
@Override
public PTransform<PInput, POutput> getTransform(FunctionSpec spec) {
JavaClassLookupPayload payload;
Expand Down Expand Up @@ -137,6 +137,7 @@ public PTransform<PInput, POutput> getTransform(FunctionSpec spec) {
}
}

@SuppressWarnings("assignment")
private PTransform<PInput, POutput> applyBuilderMethods(
PTransform<PInput, POutput> transform,
JavaClassLookupPayload payload,
Expand Down Expand Up @@ -328,6 +329,7 @@ private boolean parametersCompatible(
return true;
}

@SuppressWarnings("argument")
private @Nullable Object getDecodedValueFromRow(
Class<?> type, Object valueFromRow, @Nullable Type genericType) {
if (isPrimitiveOrWrapperOrString(type)) {
Expand Down Expand Up @@ -366,6 +368,7 @@ private boolean parametersCompatible(
throw new RuntimeException("Could not decode the value from Row " + valueFromRow);
}

@SuppressWarnings("argument")
private Object[] getParameterValues(
java.lang.reflect.Parameter[] parameters, Row constrtuctorRow, Type[] genericTypes) {
ArrayList<Object> parameterValues = new ArrayList<>();
Expand All @@ -380,6 +383,7 @@ private Object[] getParameterValues(
return parameterValues.toArray();
}

@SuppressWarnings("argument")
private Object[] getDecodedArrayValueFromRow(Class<?> arrayComponentType, Object valueFromRow) {
List<Object> originalValues = (List<Object>) valueFromRow;
List<Object> decodedValues = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public PythonService withExtraPackages(List<String> extraPackages) {
ImmutableList.<String>builder().addAll(this.extraPackages).addAll(extraPackages).build());
}

@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
public AutoCloseable start() throws IOException, InterruptedException {
File bootstrapScript = File.createTempFile("bootstrap_beam_venv", ".py");
bootstrapScript.deleteOnExit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static String[] checkConnectionArgs(String[] args) {
}

/** Nullable InputStream is being handled inside sqlLine.begin. */
@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
static Status runSqlLine(
String[] args,
@Nullable InputStream inputStream,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private String taxiRideJSON(
}

/** Suppressing this due to https://github.com/typetools/checker-framework/issues/979. */
@SuppressWarnings("return.type.incompatible")
@SuppressWarnings("return")
private Future<List<List<String>>> runQueryInBackground(String[] args) {
return pool.submit(
(Callable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ private static class HighestUsageFinder extends RexVisitorImpl<Void> {
continue;
}
currentLevel = exprLevels[i];
@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
final Void unused = exprs[i].accept(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public PCollection<ProducerRecord<byte[], byte[]>> expand(PCollection<Row> input
}

// Suppress nullability warnings: ProducerRecord is supposed to accept null arguments.
@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
@VisibleForTesting
ProducerRecord<byte[], byte[]> transformOutput(Row row) {
row = castRow(row, row.getSchema(), schema);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void validTopicTables() {
}

@Test
@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
public void topicTableCannotRead() {
BeamSqlTable basic =
makeTable(FULL_WRITE_SCHEMA, example(TopicPath.class).toString(), ImmutableMap.of());
Expand Down Expand Up @@ -230,7 +230,7 @@ public void validSubscriptionTables() {
}

@Test
@SuppressWarnings("argument.type.incompatible")
@SuppressWarnings("argument")
public void subscriptionTableCannotWrite() {
BeamSqlTable basic =
makeTable(FULL_READ_SCHEMA, example(SubscriptionPath.class).toString(), ImmutableMap.of());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public PCollection<Long> expand(PCollection<T> input) {
return input.apply(builder.globally()).apply(HllCount.Extract.globally());
}

// Boiler plate to avoid [argument.type.incompatible] NonNull vs Nullable
// Boiler plate to avoid [argument] NonNull vs Nullable
Contextful<Fn<T, Long>> mapping = getMapping();

if (mapping != null) {
Expand Down Expand Up @@ -221,7 +221,7 @@ public PCollection<KV<K, Long>> expand(PCollection<KV<K, V>> input) {
return input.apply(builder.perKey()).apply(HllCount.Extract.perKey());
}

// Boiler plate to avoid [argument.type.incompatible] NonNull vs Nullable
// Boiler plate to avoid [argument] NonNull vs Nullable
Contextful<Fn<KV<K, V>, KV<K, Long>>> mapping = getMapping();

if (mapping != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public OnErrorException(@NonNull Throwable throwable) {
}

@Override
@SuppressWarnings("return.type.incompatible")
@SuppressWarnings("return")
public synchronized @NonNull Throwable getCause() {
return super.getCause();
}
Expand All @@ -61,7 +61,7 @@ public OnErrorException(@NonNull Throwable throwable) {
private final Future<?> queueDrainer;
private final int bufferSize;

@SuppressWarnings("methodref.receiver.bound.invalid")
@SuppressWarnings("methodref.receiver.bound")
public BufferingStreamObserver(
Phaser phaser,
CallStreamObserver<T> outboundObserver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static <T> PrefetchableIterable<T> concat(Iterable<T>... iterables) {
return maybePrefetchable(iterables[0]);
}
return new Default<T>() {
@SuppressWarnings("methodref.receiver.invalid")
@SuppressWarnings("methodref.receiver")
@Override
public PrefetchableIterator<T> createIterator() {
return PrefetchableIterators.concatIterators(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ public class ExecutionStateSampler {

private final Future<Void> stateSamplingThread;

@SuppressWarnings(
"methodref.receiver.bound.invalid" /* Synchronization ensures proper initialization */)
@SuppressWarnings("methodref.receiver.bound" /* Synchronization ensures proper initialization */)
public ExecutionStateSampler(PipelineOptions options, MillisProvider clock) {
String samplingPeriodMills =
ExperimentalOptions.getExperimentValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface AwsClientsProvider extends Serializable {

/** @deprecated DynamoDBIO doesn't require a CloudWatch client */
@Deprecated
@SuppressWarnings("return.type.incompatible")
@SuppressWarnings("return")
default AmazonCloudWatch getCloudWatchClient() {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface AwsClientsProvider extends Serializable {

/** @deprecated SnsIO doesn't require a CloudWatch client */
@Deprecated
@SuppressWarnings("return.type.incompatible")
@SuppressWarnings("return")
default AmazonCloudWatch getCloudWatchClient() {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public final void processElement(ProcessContext c) throws Exception {
// trying to expand all pages to a single collection. We are emitting a single page at a time
// while tracking read progress so we can resume if an error has occurred and we still have
// attempt budget available.
"type.argument.type.incompatible"
"type.argument"
})
private abstract static class PaginatedFirestoreV1ReadFn<
RequestT extends Message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NestedRowToMessage extends SimpleFunction<Row, PubsubMessage> {
private final SerializableFunction<Row, Map<String, String>> attributesExtractor;
private final SerializableFunction<Row, byte[]> payloadExtractor;

@SuppressWarnings("methodref.receiver.bound.invalid")
@SuppressWarnings("methodref.receiver.bound")
NestedRowToMessage(PayloadSerializer serializer, Schema schema) {
this.serializer = serializer;
if (schema.getField(ATTRIBUTES_FIELD).getType().equals(ATTRIBUTE_MAP_FIELD_TYPE)) {
Expand Down
Loading