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-10556] Move rawtype error suppression to class level #13261

Merged
merged 2 commits into from
Nov 5, 2020
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
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ class BeamModulePlugin implements Plugin<Project> {
/** Controls whether the checker framework plugin is enabled and configured. */
boolean enableChecker = true

/** Controls whether legacy rawtype usage is allowed. */
boolean ignoreRawtypeErrors = false

/** Controls whether the dependency analysis plugin is enabled. */
boolean enableStrictDependencies = false

Expand Down Expand Up @@ -719,10 +716,6 @@ class BeamModulePlugin implements Plugin<Project> {
'varargs',
]

if (configuration.ignoreRawtypeErrors) {
defaultLintSuppressions.add("rawtypes")
}

project.tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
// As we want to add '-Xlint:-deprecation' we intentionally remove '-Xlint:deprecation' from compilerArgs here,
Expand Down
1 change: 0 additions & 1 deletion examples/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ plugins { id 'org.apache.beam.module' }
applyJavaNature(
exportJavadoc: false,
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.examples')
provideIntegrationTestingDependencies()
enableJavaPerformanceTesting()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
*
* <p>It is used to run Beam examples.
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
@SuppressWarnings({
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
})
public class ExampleUtils {

private static final int SC_NOT_FOUND = 404;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@
* <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)
@SuppressWarnings({
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
})
public class AutoComplete {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
* <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)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@
* <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)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
* <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)
@SuppressWarnings({
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
})
public class StatefulTeamScore extends LeaderBoard {

/** Options supported by {@link StatefulTeamScore}. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
* 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)
@SuppressWarnings({
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
})
public class UserScore {

/** Class to hold info about a game event. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
* Injector <project-name> none <filename>
* }</pre>
*/
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
* 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)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
* 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)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@
* <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)
@SuppressWarnings({
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a number of changes like this that I did just to make it more sane to automatically add the rawtype warnings. I can revert if you like or separate into another commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SG. It's a mechanical change so no problem leaving it in this commit.

})
public class TriggerExample {
// Numeric value of fixed window duration, in minutes
public static final int WINDOW_DURATION = 30;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@
import org.slf4j.LoggerFactory;

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

@DefaultCoder(AvroCoder.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
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)
@SuppressWarnings({
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
})
class BigQueryMyData {

@SuppressFBWarnings("URF_UNREAD_FIELD")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
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)
@SuppressWarnings({
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
})
public class SubProcessCommandLineArgs {

// Parameters to pass to the sub-process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
/**
* 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)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@

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

String fileName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
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)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@

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

@Rule public TestName testName = new TestName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@

/** End-to-end tests of TrafficMaxLaneFlowIT. */
@RunWith(JUnit4.class)
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@

/** End-to-end tests of TrafficRoutes. */
@RunWith(JUnit4.class)
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
* ideas: https://beam.apache.org/documentation/pipelines/test-your-pipeline/
*/
@RunWith(JUnit4.class)
@SuppressWarnings({
"rawtypes" // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public class HourlyTeamScoreTest implements Serializable {

static final String[] GAME_EVENTS_ARRAY =
Expand Down
1 change: 0 additions & 1 deletion runners/core-construction-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
plugins { id 'org.apache.beam.module' }
applyJavaNature(
enableChecker: false,
ignoreRawtypeErrors: true,
automaticModuleName: 'org.apache.beam.runners.core.construction')

description = "Apache Beam :: Runners :: Core Construction Java"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

/** Coder registrar for AvroGenericCoder. */
@AutoService(CoderTranslatorRegistrar.class)
@SuppressWarnings({
"rawtypes" // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public class AvroGenericCoderRegistrar implements CoderTranslatorRegistrar {
public static final String AVRO_CODER_URN = "beam:coder:avro:generic:v1";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
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)
@SuppressWarnings({
"rawtypes", // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
})
public class CoderTranslation {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import org.apache.beam.sdk.coders.Coder;

/** A registrar of {@link Coder} URNs to the associated {@link CoderTranslator}. */
@SuppressWarnings({
"rawtypes" // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public interface CoderTranslatorRegistrar {
/**
* Returns a mapping of coder classes to the URN representing that coder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
* Methods for translating between {@link Combine} {@link PTransform PTransforms} and {@link
* RunnerApi.CombinePayload} protos.
*/
@SuppressWarnings({
"rawtypes" // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public class CombineTranslation {

static final String JAVA_SERIALIZED_COMBINE_FN_URN = "beam:combinefn:javasdk:v1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
* dedicated runners-core-construction auxiliary class
*/
@Deprecated
@SuppressWarnings({
"rawtypes" // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public class CreatePCollectionViewTranslation {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
* 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)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
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)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
import org.slf4j.LoggerFactory;

/** Utilities for interacting with portability {@link Environment environments}. */
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
@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
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@
* high-level wrapper classes rather than this one.
*/
@Experimental(Kind.PORTABILITY)
@SuppressWarnings("nullness") // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
@SuppressWarnings({
"rawtypes", // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
"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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
import org.checkerframework.checker.nullness.qual.Nullable;

/** Translating External transforms to proto. */
@SuppressWarnings({
"rawtypes" // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public class ExternalTranslation {
public static final String EXTERNAL_TRANSFORM_URN = "beam:transform:external:v1";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
/**
* Utility methods for translating a {@link Assign} to and from {@link RunnerApi} representations.
*/
@SuppressWarnings({
"rawtypes" // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public class FlattenTranslator implements TransformPayloadTranslator<Flatten.PCollections<?>> {

public static TransformPayloadTranslator create() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
* 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)
@SuppressWarnings({
"rawtypes", // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
"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
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
* Utility methods for translating a {@link GroupByKey} to and from {@link RunnerApi}
* representations.
*/
@SuppressWarnings({
"rawtypes" // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public class GroupByKeyTranslation {

static class GroupByKeyTranslator implements TransformPayloadTranslator<GroupByKey<?, ?>> {
Expand Down