Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-10402] Suppress nullness errors in classes that need it #13191

Merged
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.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Expand Up @@ -62,6 +62,7 @@
*
* <p>It is used to run Beam examples.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class ExampleUtils {

private static final int SC_NOT_FOUND = 404;
Expand Down
Expand Up @@ -95,6 +95,7 @@
* <p>This will update the Cloud Datastore every 10 seconds based on the last 30 minutes of data
* received.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class AutoComplete {

/**
Expand Down
Expand Up @@ -73,6 +73,7 @@
* <p>The example will try to cancel the pipelines on the signal to terminate the process (CTRL-C)
* and then exits.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class TrafficMaxLaneFlow {

static final int WINDOW_DURATION = 60; // Default sliding window duration in minutes
Expand Down
Expand Up @@ -77,6 +77,7 @@
* <p>The example will try to cancel the pipelines on the signal to terminate the process (CTRL-C)
* and then exits.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class TrafficRoutes {

// Instantiate some small predefined San Diego routes to analyze
Expand Down
Expand Up @@ -76,6 +76,7 @@
* <p>The BigQuery dataset you specify must already exist. The PubSub topic you specify should be
* the same topic to which the Injector is publishing.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class StatefulTeamScore extends LeaderBoard {

/** Options supported by {@link StatefulTeamScore}. */
Expand Down
Expand Up @@ -70,6 +70,7 @@
* value for example batch data file, or use {@code injector.Injector} to generate your own batch
* data.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class UserScore {

/** Class to hold info about a game event. */
Expand Down
Expand Up @@ -75,6 +75,7 @@
* Injector <project-name> none <filename>
* }</pre>
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
class Injector {
private static Pubsub pubsub;
private static Random random = new Random();
Expand Down
Expand Up @@ -39,6 +39,7 @@
* Generate, format, and write BigQuery table row information. Use provided information about the
* field names and types, as well as lambda functions that describe how to generate their values.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class WriteToBigQuery<InputT> extends PTransform<PCollection<InputT>, PDone> {

protected String projectId;
Expand Down
Expand Up @@ -47,6 +47,7 @@
* Generate, format, and write rows. Use provided information about the field names and types, as
* well as lambda functions that describe how to generate their values.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class WriteToText<InputT> extends PTransform<PCollection<InputT>, PDone> {

private static final DateTimeFormatter formatter =
Expand Down
Expand Up @@ -121,6 +121,7 @@
* <p>The example will try to cancel the pipelines on the signal to terminate the process (CTRL-C)
* and then exits.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class TriggerExample {
// Numeric value of fixed window duration, in minutes
public static final int WINDOW_DURATION = 30;
Expand Down
Expand Up @@ -116,6 +116,7 @@
import org.slf4j.LoggerFactory;

/** Code snippets used in webdocs. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class Snippets {

@DefaultCoder(AvroCoder.class)
Expand Down
Expand Up @@ -33,6 +33,7 @@
import org.apache.beam.sdk.coders.AvroCoder;
import org.apache.beam.sdk.coders.DefaultCoder;

@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
class BigQueryMyData {

@SuppressFBWarnings("URF_UNREAD_FIELD")
Expand Down
Expand Up @@ -23,7 +23,7 @@
* Configuration file used to setup the Process kernel for execution of the external library Values
* are copied from the Options to all them to be Serializable.
*/
@SuppressWarnings("serial")
@SuppressWarnings({"serial", "nullness"}) // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class SubProcessConfiguration implements Serializable {

// Source GCS directory where the C++ library is located gs://bucket/tests
Expand Down
Expand Up @@ -21,6 +21,7 @@
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists;

/** Parameters to the sub-process, has tuple of ordinal position and the value. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class SubProcessCommandLineArgs {

// Parameters to pass to the sub-process
Expand Down
Expand Up @@ -33,6 +33,7 @@
/**
* This is the process kernel which deals with exec of the subprocess. It also deals with all I/O.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class SubProcessKernel {

private static final Logger LOG = LoggerFactory.getLogger(SubProcessKernel.class);
Expand Down
Expand Up @@ -25,6 +25,7 @@

/** Contains the configuration for the external library. */
@DefaultCoder(AvroCoder.class)
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class ExecutableFile {

String fileName;
Expand Down
Expand Up @@ -36,6 +36,7 @@
import org.slf4j.LoggerFactory;

/** Utilities for dealing with movement of files from object stores and workers. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class FileUtils {

private static final Logger LOG = LoggerFactory.getLogger(FileUtils.class);
Expand Down
Expand Up @@ -62,6 +62,7 @@

/** End-to-end integration test of {@link WindowedWordCount}. */
@RunWith(JUnit4.class)
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class WindowedWordCountIT {

@Rule public TestName testName = new TestName();
Expand Down
Expand Up @@ -42,6 +42,7 @@

/** End-to-end tests of TrafficMaxLaneFlowIT. */
@RunWith(JUnit4.class)
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class TrafficMaxLaneFlowIT {
private static final Logger LOG = LoggerFactory.getLogger(TrafficMaxLaneFlowIT.class);
private TrafficMaxLaneFlowOptions options;
Expand Down
Expand Up @@ -42,6 +42,7 @@

/** End-to-end tests of TrafficRoutes. */
@RunWith(JUnit4.class)
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class TrafficRoutesIT {
private static final Logger LOG = LoggerFactory.getLogger(TrafficRoutesIT.class);
private TrafficRoutesOptions options;
Expand Down
Expand Up @@ -35,6 +35,7 @@
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;

/** Converts to and from Beam Runner API representations of {@link Coder Coders}. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class CoderTranslation {

/**
Expand Down
Expand Up @@ -34,6 +34,7 @@
* they registered i.e. the function registered later overrides the earlier one if they resolve the
* same artifact.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class DefaultArtifactResolver implements ArtifactResolver {
public static final ArtifactResolver INSTANCE = new DefaultArtifactResolver();

Expand Down
Expand Up @@ -30,6 +30,7 @@
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;

/** Utilities for going to/from DisplayData protos. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class DisplayDataTranslation {
public static final String LABELLED_STRING = "beam:display_data:labelled_string:v1";

Expand Down
Expand Up @@ -60,6 +60,7 @@
import org.slf4j.LoggerFactory;

/** Utilities for interacting with portability {@link Environment environments}. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class Environments {
private static final Logger LOG = LoggerFactory.getLogger(Environments.class);

Expand Down
Expand Up @@ -68,6 +68,7 @@
* high-level wrapper classes rather than this one.
*/
@Experimental(Kind.PORTABILITY)
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class External {
private static final String EXPANDED_TRANSFORM_BASE_NAME = "external";
private static final String IMPULSE_PREFIX = "IMPULSE";
Expand Down
Expand Up @@ -33,6 +33,7 @@
* delegate transform but with overridden methods. Implementors are required to implement {@link
* #delegate()}, which returns the object to forward calls to, and {@link #expand(PInput)}.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public abstract class ForwardingPTransform<InputT extends PInput, OutputT extends POutput>
extends PTransform<InputT, OutputT> {
protected abstract PTransform<InputT, OutputT> delegate();
Expand Down
Expand Up @@ -45,6 +45,7 @@

/** The {@link CoderTranslatorRegistrar} for coders which are shared across languages. */
@AutoService(CoderTranslatorRegistrar.class)
@SuppressWarnings({"nullness", "keyfor"}) // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class ModelCoderRegistrar implements CoderTranslatorRegistrar {

// The URNs for coders which are shared across languages
Expand Down
Expand Up @@ -28,6 +28,7 @@
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Iterables;

/** */
@SuppressWarnings({"nullness", "keyfor"}) // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class PTransformReplacements {
/**
* Gets the singleton input of an {@link AppliedPTransform}, ignoring any additional inputs
Expand Down
Expand Up @@ -59,6 +59,7 @@
* Utilities for converting {@link PTransform PTransforms} to {@link RunnerApi Runner API protocol
* buffers}.
*/
@SuppressWarnings({"nullness", "keyfor"}) // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class PTransformTranslation {
// We specifically copy the values here so that they can be used in switch case statements
// and we validate that the value matches the actual URN in the static block below.
Expand Down
Expand Up @@ -42,6 +42,7 @@
* <p>This ensures maximum memoization of rehydrated components, which is semantically necessary for
* {@link PCollection} and nice-to-have for other objects.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class RehydratedComponents {
private final Components components;

Expand Down
Expand Up @@ -34,6 +34,7 @@
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Iterables;

/** Utility methods for creating {@link ReplacementOutput} for known styles of {@link POutput}. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class ReplacementOutputs {
private ReplacementOutputs() {}

Expand Down
Expand Up @@ -33,6 +33,7 @@
import org.checkerframework.checker.nullness.qual.Nullable;

/** A {@link PCollectionView} created from the components of a {@link SideInput}. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class RunnerPCollectionView<T> extends PValueBase implements PCollectionView<T> {
private final TupleTag<Iterable<WindowedValue<?>>> tag;
private final ViewFn<Iterable<WindowedValue<?>>, T> viewFn;
Expand Down
Expand Up @@ -44,6 +44,7 @@
import org.checkerframework.checker.nullness.qual.Nullable;

/** SDK objects that will be represented at some later point within a {@link Components} object. */
@SuppressWarnings({"nullness", "keyfor"}) // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class SdkComponents {
private final String newIdPrefix;
private final RunnerApi.Components.Builder componentsBuilder = RunnerApi.Components.newBuilder();
Expand Down
Expand Up @@ -61,6 +61,7 @@
* Utility transforms and overrides for running bounded splittable DoFn's naively, by implementing
* {@link ProcessKeyedElements} using a simple {@link Reshuffle} and {@link ParDo}.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class SplittableParDoNaiveBounded {
/** Overrides a {@link ProcessKeyedElements} into {@link SplittableProcessNaive}. */
public static class OverrideFactory<InputT, OutputT, RestrictionT, WatermarkEstimatorStateT>
Expand Down
Expand Up @@ -49,6 +49,7 @@
* org.apache.beam.sdk.state.Timer}.
*/
@AutoValue
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public abstract class Timer<K> {

/**
Expand Down
Expand Up @@ -47,6 +47,7 @@
import org.joda.time.Instant;

/** Utilities for working with {@link TriggerTranslation Triggers}. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class TriggerTranslation implements Serializable {

@VisibleForTesting static final ProtoConverter CONVERTER = new ProtoConverter();
Expand Down
Expand Up @@ -70,6 +70,7 @@
* <p>This transform is intended to be used by a runner during pipeline translation to convert a
* Read.Bounded into a Read.Unbounded.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class UnboundedReadFromBoundedSource<T> extends PTransform<PBegin, PCollection<T>> {

private static final Logger LOG = LoggerFactory.getLogger(UnboundedReadFromBoundedSource.class);
Expand Down
Expand Up @@ -33,6 +33,7 @@
* Utilities for ensuring that all {@link Read} {@link PTransform PTransforms} are consumed by some
* {@link PTransform}.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class UnconsumedReads {
public static void ensureAllReadsConsumed(Pipeline pipeline) {
final Set<PCollection<?>> unconsumed = new HashSet<>();
Expand Down
Expand Up @@ -54,6 +54,7 @@
* Utility methods for translating a {@link WriteFiles} to and from {@link RunnerApi}
* representations.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class WriteFilesTranslation {

/** The URN for an unknown Java {@link FileBasedSink}. */
Expand Down
Expand Up @@ -40,6 +40,7 @@
/**
* A Fuser that constructs a fused pipeline by fusing as many PCollections into a stage as possible.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
class GreedyPCollectionFusers {
private static final Logger LOG = LoggerFactory.getLogger(GreedyPCollectionFusers.class);

Expand Down
Expand Up @@ -55,6 +55,7 @@
/** Fuses a {@link Pipeline} into some set of single-environment executable transforms. */
// The use of NavigableSets everywhere provides consistent ordering but may be overkill for this
// cause.
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class GreedyPipelineFuser {
private static final Logger LOG = LoggerFactory.getLogger(GreedyPipelineFuser.class);

Expand Down
Expand Up @@ -46,6 +46,7 @@
* <p>A {@link PCollectionNode} with consumers that execute in an environment other than a stage is
* materialized, and its consumers execute in independent stages.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class GreedyStageFuser {
// TODO: Provide a way to merge in a compatible subgraph (e.g. one where all of the siblings
// consume a PCollection materialized by this subgraph and can be fused into it).
Expand Down
Expand Up @@ -46,6 +46,7 @@
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.graph.NetworkBuilder;

/** Static utility methods for {@link Network} instances that are directed. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class Networks {
/**
* An abstract class that can be extended to apply a function in a type safe manner.
Expand Down
Expand Up @@ -46,6 +46,7 @@
* Utilities to insert synthetic {@link PCollectionNode PCollections} for {@link PCollection
* PCollections} which are produced by multiple independently executable stages.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
class OutputDeduplicator {

/**
Expand Down
Expand Up @@ -74,6 +74,7 @@
* A {@link Pipeline} which has additional methods to relate nodes in the graph relative to each
* other.
*/
@SuppressWarnings({"nullness", "keyfor"}) // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class QueryablePipeline {
// TODO: Is it better to have the signatures here require nodes in almost all contexts, or should
// they all take strings? Nodes gives some degree of type signalling that names might not, but
Expand Down
Expand Up @@ -42,6 +42,7 @@
* href="https://github.com/apache/beam/blob/cb15994d5228f729dda922419b08520c8be8804e/model/pipeline/src/main/proto/beam_runner_api.proto#L279"
* />
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class SplittableParDoExpander {

/**
Expand Down
Expand Up @@ -27,6 +27,7 @@
* TrivialNativeTransformExpander is used to replace transforms with known URNs with their native
* equivalent.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class TrivialNativeTransformExpander {
private static final Logger LOG = LoggerFactory.getLogger(TrivialNativeTransformExpander.class);

Expand Down
Expand Up @@ -25,6 +25,7 @@
import org.apache.beam.sdk.values.PValue;

/** A DOT renderer for BEAM {@link Pipeline} DAG. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
public class PipelineDotRenderer implements Pipeline.PipelineVisitor {
public static String toDotString(Pipeline pipeline) {
final PipelineDotRenderer visitor = new PipelineDotRenderer();
Expand Down
Expand Up @@ -26,6 +26,7 @@
/**
* A DOT renderer for BEAM portable {@link org.apache.beam.model.pipeline.v1.RunnerApi.Pipeline}.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
class PortablePipelineDotRenderer {
private final StringBuilder dotBuilder = new StringBuilder();
private final Map<String, Integer> valueToProducerNodeId = new HashMap<>();
Expand Down