You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by sc...@apache.org on 2018/10/30 14:36:41 UTC
[beam] branch master updated: [BEAM-308] Print warning about using
non-public PipelineOptions interface. (#6871)
This is an automated email from the ASF dual-hosted git repository.
scott pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new f381f3b [BEAM-308] Print warning about using non-public PipelineOptions interface. (#6871)
f381f3b is described below
commit f381f3bb3c6d9fad8ad916d8a11d936388798baf
Author: Lukasz Cwik <lc...@google.com>
AuthorDate: Tue Oct 30 07:36:35 2018 -0700
[BEAM-308] Print warning about using non-public PipelineOptions interface. (#6871)
---
.../examples/complete/StreamingWordExtract.java | 2 +-
.../examples/complete/game/StatefulTeamScore.java | 2 +-
.../examples/cookbook/CombinePerKeyExamples.java | 2 +-
.../beam/examples/cookbook/DistinctExample.java | 2 +-
.../beam/examples/cookbook/FilterExamples.java | 2 +-
.../beam/examples/cookbook/JoinExamples.java | 2 +-
.../beam/examples/cookbook/MaxPerKeyExamples.java | 2 +-
.../apache/beam/sdk/options/PipelineOptions.java | 2 +-
.../beam/sdk/options/PipelineOptionsFactory.java | 13 ++++
.../sdk/options/PipelineOptionsFactoryTest.java | 72 ++++++++++++++--------
.../sdk/options/PipelineOptionsReflectorTest.java | 30 ++++++---
.../beam/sdk/options/PipelineOptionsTest.java | 11 ++--
.../sdk/options/PipelineOptionsValidatorTest.java | 15 +++--
.../sdk/options/ProxyInvocationHandlerTest.java | 43 ++++++++-----
.../beam/sdk/util/common/ReflectHelpersTest.java | 3 +-
.../sdk/io/hadoop/inputformat/HIFITestOptions.java | 2 +-
.../apache/beam/sdk/io/hcatalog/HCatalogIOIT.java | 3 +-
17 files changed, 137 insertions(+), 71 deletions(-)
diff --git a/examples/java/src/main/java/org/apache/beam/examples/complete/StreamingWordExtract.java b/examples/java/src/main/java/org/apache/beam/examples/complete/StreamingWordExtract.java
index 978836d..4cfbcd5 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/complete/StreamingWordExtract.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/complete/StreamingWordExtract.java
@@ -95,7 +95,7 @@ public class StreamingWordExtract {
*
* <p>Inherits standard configuration options.
*/
- private interface StreamingWordExtractOptions
+ public interface StreamingWordExtractOptions
extends ExampleOptions, ExampleBigQueryTableOptions, StreamingOptions {
@Description("Path of the file to read from")
@Default.String("gs://apache-beam-samples/shakespeare/kinglear.txt")
diff --git a/examples/java/src/main/java/org/apache/beam/examples/complete/game/StatefulTeamScore.java b/examples/java/src/main/java/org/apache/beam/examples/complete/game/StatefulTeamScore.java
index ccfe9f8..15a63f7 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/complete/game/StatefulTeamScore.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/complete/game/StatefulTeamScore.java
@@ -79,7 +79,7 @@ import org.joda.time.Instant;
public class StatefulTeamScore extends LeaderBoard {
/** Options supported by {@link StatefulTeamScore}. */
- interface Options extends LeaderBoard.Options {
+ public interface Options extends LeaderBoard.Options {
@Description("Numeric value, multiple of which is used as threshold for outputting team score.")
@Default.Integer(5000)
diff --git a/examples/java/src/main/java/org/apache/beam/examples/cookbook/CombinePerKeyExamples.java b/examples/java/src/main/java/org/apache/beam/examples/cookbook/CombinePerKeyExamples.java
index da5e90d..d06912f 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/cookbook/CombinePerKeyExamples.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/cookbook/CombinePerKeyExamples.java
@@ -159,7 +159,7 @@ public class CombinePerKeyExamples {
*
* <p>Inherits standard configuration options.
*/
- private interface Options extends PipelineOptions {
+ public interface Options extends PipelineOptions {
@Description("Table to read from, specified as " + "<project_id>:<dataset_id>.<table_id>")
@Default.String(SHAKESPEARE_TABLE)
String getInput();
diff --git a/examples/java/src/main/java/org/apache/beam/examples/cookbook/DistinctExample.java b/examples/java/src/main/java/org/apache/beam/examples/cookbook/DistinctExample.java
index 9efa2d1..0f6a52f 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/cookbook/DistinctExample.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/cookbook/DistinctExample.java
@@ -56,7 +56,7 @@ public class DistinctExample {
*
* <p>Inherits standard configuration options.
*/
- private interface Options extends PipelineOptions {
+ public interface Options extends PipelineOptions {
@Description("Path to the directory or GCS prefix containing files to read from")
@Default.String("gs://apache-beam-samples/shakespeare/*")
String getInput();
diff --git a/examples/java/src/main/java/org/apache/beam/examples/cookbook/FilterExamples.java b/examples/java/src/main/java/org/apache/beam/examples/cookbook/FilterExamples.java
index 17a34b0..4d2480f 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/cookbook/FilterExamples.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/cookbook/FilterExamples.java
@@ -198,7 +198,7 @@ public class FilterExamples {
*
* <p>Inherits standard configuration options.
*/
- private interface Options extends PipelineOptions {
+ public interface Options extends PipelineOptions {
@Description("Table to read from, specified as " + "<project_id>:<dataset_id>.<table_id>")
@Default.String(WEATHER_SAMPLES_TABLE)
String getInput();
diff --git a/examples/java/src/main/java/org/apache/beam/examples/cookbook/JoinExamples.java b/examples/java/src/main/java/org/apache/beam/examples/cookbook/JoinExamples.java
index 3b5fd60..bdbe25f 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/cookbook/JoinExamples.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/cookbook/JoinExamples.java
@@ -157,7 +157,7 @@ public class JoinExamples {
*
* <p>Inherits standard configuration options.
*/
- private interface Options extends PipelineOptions {
+ public interface Options extends PipelineOptions {
@Description("Path of the file to write to")
@Validation.Required
String getOutput();
diff --git a/examples/java/src/main/java/org/apache/beam/examples/cookbook/MaxPerKeyExamples.java b/examples/java/src/main/java/org/apache/beam/examples/cookbook/MaxPerKeyExamples.java
index 369f796..63d2cde 100644
--- a/examples/java/src/main/java/org/apache/beam/examples/cookbook/MaxPerKeyExamples.java
+++ b/examples/java/src/main/java/org/apache/beam/examples/cookbook/MaxPerKeyExamples.java
@@ -119,7 +119,7 @@ public class MaxPerKeyExamples {
*
* <p>Inherits standard configuration options.
*/
- private interface Options extends PipelineOptions {
+ public interface Options extends PipelineOptions {
@Description("Table to read from, specified as " + "<project_id>:<dataset_id>.<table_id>")
@Default.String(WEATHER_SAMPLES_TABLE)
String getInput();
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptions.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptions.java
index 33157eb..86e6aa1 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptions.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptions.java
@@ -101,7 +101,7 @@ import org.joda.time.format.DateTimeFormatter;
* PipelineOptionsFactory as your command-line interpreter, you will provide a standardized way for
* users to interact with your application via the command-line.
*
- * <p>To define your own {@link PipelineOptions}, you create an interface which extends {@link
+ * <p>To define your own {@link PipelineOptions}, you create a public interface which extends {@link
* PipelineOptions} and define getter/setter pairs. These getter/setter pairs define a collection of
* <a href="https://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html">JavaBean
* properties</a>.
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java
index 9d0bd43..3546fcd 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java
@@ -865,6 +865,19 @@ public class PipelineOptionsFactory {
Set<Class<? extends PipelineOptions>> validatedPipelineOptionsInterfaces,
Class<? extends PipelineOptions> klass)
throws IntrospectionException {
+
+ // TODO(BEAM-308): Make this an error in users pipelines for the next major version
+ // of Apache Beam.
+ if (!Modifier.isPublic(iface.getModifiers())) {
+ LOG.warn(
+ "Using non-public interface {} may fail during runtime. The JVM requires that "
+ + "all non-public interfaces to be in the same package; otherwise, it would not be "
+ + "possible for the PipelineOptions proxy class to implement all of the interfaces, "
+ + "regardless of what package it is defined in. This will become an error in"
+ + "a future version of Apache Beam.",
+ iface.getName());
+ }
+
// Verify that there are no methods with the same name with two different return types.
validateReturnType(iface);
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsFactoryTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsFactoryTest.java
index 7cca11b..aa81d61 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsFactoryTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsFactoryTest.java
@@ -450,7 +450,8 @@ public class PipelineOptionsFactoryTest {
options.as(CombinedObject.class);
}
- private interface MultiGetters extends PipelineOptions {
+ /** Test interface. */
+ public interface MultiGetters extends PipelineOptions {
Object getObject();
void setObject(Object value);
@@ -465,7 +466,8 @@ public class PipelineOptionsFactoryTest {
void setConsistent(Void consistent);
}
- private interface MultipleGettersWithInconsistentJsonIgnore extends PipelineOptions {
+ /** Test interface. */
+ public interface MultipleGettersWithInconsistentJsonIgnore extends PipelineOptions {
@JsonIgnore
Object getObject();
@@ -559,7 +561,7 @@ public class PipelineOptionsFactoryTest {
* This class is has a conflicting field with {@link CombinedObject} that doesn't have {@link
* Default @Default}.
*/
- private interface GetterWithDefault extends PipelineOptions {
+ public interface GetterWithDefault extends PipelineOptions {
@Default.Integer(1)
Object getObject();
@@ -570,7 +572,7 @@ public class PipelineOptionsFactoryTest {
* This class is consistent with {@link GetterWithDefault} that has the same {@link
* Default @Default}.
*/
- private interface GetterWithConsistentDefault extends PipelineOptions {
+ public interface GetterWithConsistentDefault extends PipelineOptions {
@Default.Integer(1)
Object getObject();
@@ -581,7 +583,7 @@ public class PipelineOptionsFactoryTest {
* This class is inconsistent with {@link GetterWithDefault} that has a different {@link
* Default @Default}.
*/
- private interface GetterWithInconsistentDefaultType extends PipelineOptions {
+ public interface GetterWithInconsistentDefaultType extends PipelineOptions {
@Default.String("abc")
Object getObject();
@@ -592,7 +594,7 @@ public class PipelineOptionsFactoryTest {
* This class is inconsistent with {@link GetterWithDefault} that has a different {@link
* Default @Default} value.
*/
- private interface GetterWithInconsistentDefaultValue extends PipelineOptions {
+ public interface GetterWithInconsistentDefaultValue extends PipelineOptions {
@Default.Integer(0)
Object getObject();
@@ -675,7 +677,8 @@ public class PipelineOptionsFactoryTest {
options.as(GetterWithInconsistentJsonIgnoreValue.class);
}
- private interface GettersWithMultipleDefault extends PipelineOptions {
+ /** Test interface. */
+ public interface GettersWithMultipleDefault extends PipelineOptions {
@Default.String("abc")
@Default.Integer(0)
Object getObject();
@@ -697,7 +700,8 @@ public class PipelineOptionsFactoryTest {
PipelineOptionsFactory.as(GettersWithMultipleDefault.class);
}
- private interface MultiGettersWithDefault extends PipelineOptions {
+ /** Test interface. */
+ public interface MultiGettersWithDefault extends PipelineOptions {
Object getObject();
void setObject(Object value);
@@ -712,7 +716,8 @@ public class PipelineOptionsFactoryTest {
void setConsistent(Void consistent);
}
- private interface MultipleGettersWithInconsistentDefault extends PipelineOptions {
+ /** Test interface. */
+ public interface MultipleGettersWithInconsistentDefault extends PipelineOptions {
@Default.Boolean(true)
Object getObject();
@@ -1006,7 +1011,7 @@ public class PipelineOptionsFactoryTest {
}
/** A test interface for verifying JSON -> complex type conversion. */
- interface ComplexTypes extends PipelineOptions {
+ public interface ComplexTypes extends PipelineOptions {
Map<String, String> getMap();
void setMap(Map<String, String> value);
@@ -1421,6 +1426,16 @@ public class PipelineOptionsFactoryTest {
expectedLogs.verifyWarn("Strict parsing is disabled, ignoring option");
}
+ private interface NonPublicPipelineOptions extends PipelineOptions {}
+
+ @Test
+ public void testNonPublicInterfaceLogsWarning() throws Exception {
+ PipelineOptionsFactory.as(NonPublicPipelineOptions.class);
+ // Make sure we print the name of the class.
+ expectedLogs.verifyWarn(NonPublicPipelineOptions.class.getName());
+ expectedLogs.verifyWarn("all non-public interfaces to be in the same package");
+ }
+
/** A test interface containing all supported List return types. */
public interface Maps extends PipelineOptions {
Map<Integer, Integer> getMap();
@@ -1533,7 +1548,8 @@ public class PipelineOptionsFactoryTest {
PipelineOptionsFactory.fromArgs(args).create();
}
- interface SuggestedOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface SuggestedOptions extends PipelineOptions {
String getAbc();
void setAbc(String value);
@@ -1685,15 +1701,15 @@ public class PipelineOptionsFactoryTest {
}
/** Used for a name collision test with the other NameConflict interfaces. */
- private static class NameConflictClassA {
+ public static class NameConflictClassA {
/** Used for a name collision test with the other NameConflict interfaces. */
- private interface NameConflict extends PipelineOptions {}
+ public interface NameConflict extends PipelineOptions {}
}
/** Used for a name collision test with the other NameConflict interfaces. */
- private static class NameConflictClassB {
+ public static class NameConflictClassB {
/** Used for a name collision test with the other NameConflict interfaces. */
- private interface NameConflict extends PipelineOptions {}
+ public interface NameConflict extends PipelineOptions {}
}
@Test
@@ -1785,20 +1801,23 @@ public class PipelineOptionsFactoryTest {
output, containsString("The pipeline runner that will be used to execute the pipeline."));
}
- interface PipelineOptionsInheritedInvalid
+ /** Test interface. */
+ public interface PipelineOptionsInheritedInvalid
extends Invalid1, InvalidPipelineOptions2, PipelineOptions {
String getFoo();
void setFoo(String value);
}
- interface InvalidPipelineOptions1 {
+ /** Test interface. */
+ public interface InvalidPipelineOptions1 {
String getBar();
void setBar(String value);
}
- interface Invalid1 extends InvalidPipelineOptions1 {
+ /** Test interface. */
+ public interface Invalid1 extends InvalidPipelineOptions1 {
@Override
String getBar();
@@ -1806,7 +1825,8 @@ public class PipelineOptionsFactoryTest {
void setBar(String value);
}
- interface InvalidPipelineOptions2 {
+ /** Test interface. */
+ public interface InvalidPipelineOptions2 {
String getBar();
void setBar(String value);
@@ -1864,7 +1884,8 @@ public class PipelineOptionsFactoryTest {
}
}
- private interface RegisteredTestOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface RegisteredTestOptions extends PipelineOptions {
Object getRegisteredExampleFooBar();
void setRegisteredExampleFooBar(Object registeredExampleFooBar);
@@ -1890,7 +1911,7 @@ public class PipelineOptionsFactoryTest {
}
/** PipelineOptions used to test auto registration of Jackson modules. */
- interface JacksonIncompatibleOptions extends PipelineOptions {
+ public interface JacksonIncompatibleOptions extends PipelineOptions {
JacksonIncompatible getJacksonIncompatible();
void setJacksonIncompatible(JacksonIncompatible value);
@@ -1988,7 +2009,8 @@ public class PipelineOptionsFactoryTest {
assertThat(optsWithDefault.getValue(), equalTo(12.25));
}
- private interface ExtendedOptionsWithDefault extends OptionsWithDefaultMethod {}
+ /** Test interface. */
+ public interface ExtendedOptionsWithDefault extends OptionsWithDefaultMethod {}
@Test
public void testDefaultMethodInExtendedClassIgnoresDefaultImplementation() {
@@ -2000,7 +2022,8 @@ public class PipelineOptionsFactoryTest {
assertThat(extendedOptsWithDefault.getValue(), equalTo(Double.NEGATIVE_INFINITY));
}
- private interface OptionsWithDefaultMethod extends PipelineOptions {
+ /** Test interface. */
+ public interface OptionsWithDefaultMethod extends PipelineOptions {
default Number getValue() {
return 1024;
}
@@ -2016,7 +2039,8 @@ public class PipelineOptionsFactoryTest {
PipelineOptionsFactory.fromArgs("--myMethod=value").as(OptionsWithStaticMethod.class)));
}
- private interface OptionsWithStaticMethod extends PipelineOptions {
+ /** Test interface. */
+ public interface OptionsWithStaticMethod extends PipelineOptions {
String getMyMethod();
void setMyMethod(String value);
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsReflectorTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsReflectorTest.java
index e13260b..cdbff02 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsReflectorTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsReflectorTest.java
@@ -50,7 +50,8 @@ public class PipelineOptionsReflectorTest {
SimpleOptions.class, "foo", SimpleOptions.class.getDeclaredMethod("getFoo"))));
}
- interface SimpleOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface SimpleOptions extends PipelineOptions {
String getFoo();
void setFoo(String value);
@@ -64,7 +65,8 @@ public class PipelineOptionsReflectorTest {
assertThat(properties, not(hasItem(hasName(isOneOf("misspelled", "hasParameter", "prefix")))));
}
- interface OnlyTwoValidGetters extends PipelineOptions {
+ /** Test interface. */
+ public interface OnlyTwoValidGetters extends PipelineOptions {
String getFoo();
void setFoo(String value);
@@ -96,7 +98,8 @@ public class PipelineOptionsReflectorTest {
assertThat(props, hasItem(allOf(hasName("bar"), hasClass(ExtendsSimpleOptions.class))));
}
- interface ExtendsSimpleOptions extends SimpleOptions {
+ /** Test interface. */
+ public interface ExtendsSimpleOptions extends SimpleOptions {
@Override
String getFoo();
@@ -116,13 +119,15 @@ public class PipelineOptionsReflectorTest {
assertThat(properties, not(hasItem(hasName("foo"))));
}
- interface NoExtendsClause {
+ /** Test interface. */
+ public interface NoExtendsClause {
String getFoo();
void setFoo(String value);
}
- interface ExtendsNonPipelineOptions extends NoExtendsClause, PipelineOptions {}
+ /** Test interface. */
+ public interface ExtendsNonPipelineOptions extends NoExtendsClause, PipelineOptions {}
@Test
public void testExcludesHiddenInterfaces() {
@@ -132,8 +137,9 @@ public class PipelineOptionsReflectorTest {
assertThat(properties, not(hasItem(hasName("foo"))));
}
+ /** Test interface. */
@Hidden
- interface HiddenOptions extends PipelineOptions {
+ public interface HiddenOptions extends PipelineOptions {
String getFoo();
void setFoo(String value);
@@ -148,7 +154,8 @@ public class PipelineOptionsReflectorTest {
assertThat(properties, hasItem(allOf(hasName("ignored"), not(shouldSerialize()))));
}
- interface JsonIgnoreOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface JsonIgnoreOptions extends PipelineOptions {
String getNotIgnored();
void setNotIgnored(String value);
@@ -171,19 +178,22 @@ public class PipelineOptionsReflectorTest {
assertThat(props, hasItem(allOf(hasName("extendOption2"), hasClass(ExtendOptions2.class))));
}
- interface BaseOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface BaseOptions extends PipelineOptions {
String getBaseOption();
void setBaseOption(String value);
}
- interface ExtendOptions1 extends BaseOptions {
+ /** Test interface. */
+ public interface ExtendOptions1 extends BaseOptions {
String getExtendOption1();
void setExtendOption1(String value);
}
- interface ExtendOptions2 extends BaseOptions {
+ /** Test interface. */
+ public interface ExtendOptions2 extends BaseOptions {
String getExtendOption2();
void setExtendOption2(String value);
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsTest.java
index 167f689..d386dc2 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsTest.java
@@ -42,7 +42,7 @@ public class PipelineOptionsTest {
@Rule public ExpectedException expectedException = ExpectedException.none();
/** Interfaces used for testing that {@link PipelineOptions#as(Class)} functions. */
- private interface DerivedTestOptions extends BaseTestOptions {
+ public interface DerivedTestOptions extends BaseTestOptions {
int getDerivedValue();
void setDerivedValue(int derivedValue);
@@ -55,7 +55,8 @@ public class PipelineOptionsTest {
void setIgnoredValue(Set<String> ignoredValue);
}
- private interface ConflictedTestOptions extends BaseTestOptions {
+ /** Test interface. */
+ public interface ConflictedTestOptions extends BaseTestOptions {
String getDerivedValue();
void setDerivedValue(String derivedValue);
@@ -68,7 +69,8 @@ public class PipelineOptionsTest {
void setIgnoredValue(Set<String> ignoredValue);
}
- private interface BaseTestOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface BaseTestOptions extends PipelineOptions {
List<Boolean> getBaseValue();
void setBaseValue(List<Boolean> baseValue);
@@ -85,7 +87,8 @@ public class PipelineOptionsTest {
assertNotNull(options);
}
- private interface ValueProviderOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface ValueProviderOptions extends PipelineOptions {
ValueProvider<Boolean> getBool();
void setBool(ValueProvider<Boolean> value);
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsValidatorTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsValidatorTest.java
index 6c2b335..a98d027 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsValidatorTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsValidatorTest.java
@@ -218,7 +218,8 @@ public class PipelineOptionsValidatorTest {
PipelineOptionsValidator.validate(MultiGroupRequired.class, multiGroupRequired);
}
- private interface LeftOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface LeftOptions extends PipelineOptions {
@Validation.Required(groups = {"left"})
String getFoo();
@@ -235,7 +236,8 @@ public class PipelineOptionsValidatorTest {
void setBoth(String both);
}
- private interface RightOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface RightOptions extends PipelineOptions {
@Validation.Required(groups = {"right"})
String getFoo();
@@ -252,7 +254,8 @@ public class PipelineOptionsValidatorTest {
void setBoth(String both);
}
- private interface JoinedOptions extends LeftOptions, RightOptions {}
+ /** Test interface. */
+ public interface JoinedOptions extends LeftOptions, RightOptions {}
@Test
public void testWhenOptionIsDefinedInMultipleSuperInterfacesAndIsNotPresentFailsRequirement() {
@@ -312,7 +315,8 @@ public class PipelineOptionsValidatorTest {
PipelineOptionsValidator.validate(JoinedOptions.class, options);
}
- private interface SuperOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface SuperOptions extends PipelineOptions {
@Validation.Required(groups = {"super"})
String getFoo();
@@ -329,7 +333,8 @@ public class PipelineOptionsValidatorTest {
void setSuperclassObj(String sup);
}
- private interface SubOptions extends SuperOptions {
+ /** Test interface. */
+ public interface SubOptions extends SuperOptions {
@Override
@Validation.Required(groups = {"sub"})
String getFoo();
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/ProxyInvocationHandlerTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/ProxyInvocationHandlerTest.java
index 1fbb786..049852d 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/options/ProxyInvocationHandlerTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/options/ProxyInvocationHandlerTest.java
@@ -542,7 +542,7 @@ public class ProxyInvocationHandlerTest {
}
/** Test interface for JSON conversion of simple types. */
- private interface SimpleTypes extends PipelineOptions {
+ public interface SimpleTypes extends PipelineOptions {
int getInteger();
void setInteger(int value);
@@ -603,7 +603,7 @@ public class ProxyInvocationHandlerTest {
}
/** Test interface for JSON conversion of container types. */
- private interface ContainerTypes extends PipelineOptions {
+ public interface ContainerTypes extends PipelineOptions {
List<String> getList();
void setList(List<String> values);
@@ -633,7 +633,7 @@ public class ProxyInvocationHandlerTest {
}
/** Test interface for conversion of inner types. */
- private static class InnerType {
+ public static class InnerType {
public double doubleField;
static InnerType of(double value) {
@@ -656,7 +656,7 @@ public class ProxyInvocationHandlerTest {
}
/** Test interface for conversion of generics and inner types. */
- private static class ComplexType {
+ public static class ComplexType {
public String stringField;
public Integer intField;
public List<InnerType> genericType;
@@ -678,7 +678,8 @@ public class ProxyInvocationHandlerTest {
}
}
- private interface ComplexTypes extends PipelineOptions {
+ /** Test interface. */
+ public interface ComplexTypes extends PipelineOptions {
ComplexType getComplexType();
void setComplexType(ComplexType value);
@@ -699,7 +700,7 @@ public class ProxyInvocationHandlerTest {
}
/** Test interface for testing ignored properties during serialization. */
- private interface IgnoredProperty extends PipelineOptions {
+ public interface IgnoredProperty extends PipelineOptions {
@JsonIgnore
String getValue();
@@ -729,7 +730,7 @@ public class ProxyInvocationHandlerTest {
}
/** Test interface containing a class that is not serializable by Jackson. */
- private interface NotSerializableProperty extends PipelineOptions {
+ public interface NotSerializableProperty extends PipelineOptions {
NotSerializable getValue();
void setValue(NotSerializable value);
@@ -749,7 +750,7 @@ public class ProxyInvocationHandlerTest {
* Test interface that has {@link JsonIgnore @JsonIgnore} on a property that Jackson can't
* serialize.
*/
- private interface IgnoredNotSerializableProperty extends PipelineOptions {
+ public interface IgnoredNotSerializableProperty extends PipelineOptions {
@JsonIgnore
NotSerializable getValue();
@@ -785,7 +786,7 @@ public class ProxyInvocationHandlerTest {
* Test interface containing a property that is serializable by Jackson only with the additional
* metadata.
*/
- private interface SerializableWithMetadataProperty extends PipelineOptions {
+ public interface SerializableWithMetadataProperty extends PipelineOptions {
SerializableWithMetadata getValue();
void setValue(SerializableWithMetadata value);
@@ -842,7 +843,8 @@ public class ProxyInvocationHandlerTest {
assertThat(displayData, hasDisplayItem("object", "foobar"));
}
- interface TypedOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface TypedOptions extends PipelineOptions {
int getInteger();
void setInteger(int value);
@@ -906,13 +908,15 @@ public class ProxyInvocationHandlerTest {
allOf(hasKey("foo"), hasValue("bar"), hasNamespace(ExtendsBaseOptions.class))));
}
- interface BaseOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface BaseOptions extends PipelineOptions {
String getFoo();
void setFoo(String value);
}
- interface ExtendsBaseOptions extends BaseOptions {
+ /** Test interface. */
+ public interface ExtendsBaseOptions extends BaseOptions {
@Override
String getFoo();
@@ -942,13 +946,15 @@ public class ProxyInvocationHandlerTest {
assertThat(data, hasDisplayItem(allOf(hasKey("bar"), hasNamespace(BarOptions.class))));
}
- interface FooOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface FooOptions extends PipelineOptions {
String getFoo();
void setFoo(String value);
}
- interface BarOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface BarOptions extends PipelineOptions {
String getBar();
void setBar(String value);
@@ -962,7 +968,8 @@ public class ProxyInvocationHandlerTest {
assertThat(data, not(hasDisplayItem("foo")));
}
- interface HasDefaults extends PipelineOptions {
+ /** Test interface. */
+ public interface HasDefaults extends PipelineOptions {
@Default.String("bar")
String getFoo();
@@ -1016,7 +1023,8 @@ public class ProxyInvocationHandlerTest {
assertThat(deserializedData, hasDisplayItem("deepPrimitiveArray", "[[1, 2], [3]]"));
}
- private interface ArrayOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface ArrayOptions extends PipelineOptions {
String[][] getDeepArray();
void setDeepArray(String[][] value);
@@ -1084,7 +1092,8 @@ public class ProxyInvocationHandlerTest {
assertThat(displayData, hasDisplayItem("classOption", expectedJsonValue));
}
- interface HasClassOptions extends PipelineOptions {
+ /** Test interface. */
+ public interface HasClassOptions extends PipelineOptions {
Class<?> getClassOption();
void setClassOption(Class<?> value);
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/util/common/ReflectHelpersTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/util/common/ReflectHelpersTest.java
index f7fab5f..32568d7 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/util/common/ReflectHelpersTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/util/common/ReflectHelpersTest.java
@@ -127,7 +127,8 @@ public class ReflectHelpersTest {
new TypeDescriptor<Map<? super InputT, ? extends OutputT>>() {}.getType()));
}
- private interface Options extends PipelineOptions {
+ /** Test interface. */
+ public interface Options extends PipelineOptions {
@Default.String("package.OuterClass$InnerClass#method()")
String getString();
diff --git a/sdks/java/io/hadoop-input-format/src/test/java/org/apache/beam/sdk/io/hadoop/inputformat/HIFITestOptions.java b/sdks/java/io/hadoop-input-format/src/test/java/org/apache/beam/sdk/io/hadoop/inputformat/HIFITestOptions.java
index 34c62f0..7c571b1 100644
--- a/sdks/java/io/hadoop-input-format/src/test/java/org/apache/beam/sdk/io/hadoop/inputformat/HIFITestOptions.java
+++ b/sdks/java/io/hadoop-input-format/src/test/java/org/apache/beam/sdk/io/hadoop/inputformat/HIFITestOptions.java
@@ -22,7 +22,7 @@ import org.apache.beam.sdk.options.Description;
import org.apache.beam.sdk.testing.TestPipelineOptions;
/** Properties needed when using HadoopInputFormatIO with the Beam SDK. */
-interface HIFITestOptions extends TestPipelineOptions {
+public interface HIFITestOptions extends TestPipelineOptions {
//Cassandra test options
@Description("Cassandra Server IP")
diff --git a/sdks/java/io/hcatalog/src/test/java/org/apache/beam/sdk/io/hcatalog/HCatalogIOIT.java b/sdks/java/io/hcatalog/src/test/java/org/apache/beam/sdk/io/hcatalog/HCatalogIOIT.java
index cbca60f..00eb41a 100644
--- a/sdks/java/io/hcatalog/src/test/java/org/apache/beam/sdk/io/hcatalog/HCatalogIOIT.java
+++ b/sdks/java/io/hcatalog/src/test/java/org/apache/beam/sdk/io/hcatalog/HCatalogIOIT.java
@@ -67,7 +67,8 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class HCatalogIOIT {
- private interface HCatalogPipelineOptions extends IOTestPipelineOptions {
+ /** PipelineOptions for testing {@link org.apache.beam.sdk.io.hcatalog.HCatalogIO}. */
+ public interface HCatalogPipelineOptions extends IOTestPipelineOptions {
@Description("HCatalog metastore host (hostname/ip address)")
@Default.String("hcatalog-metastore")
String getHCatalogMetastoreHostName();