-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Hidden annotation does not hide methods from help text #18873
Description
The javadoc for @hidden mentions that it hides methods and/or interfaces, but the filtering of @hidden for --help only works for interfaces while methods with the annotation are still visible.
For example, in PipelineOptions the optionsId getter is set with the Hidden annotation, but when –help is executed, it appears in the list:
org.apache.beam.sdk.options.PipelineOptions:
--jobName=<String>
Default: JobNameFactory
Name of the pipeline execution.It must match the regular expression
'[a-z]([-a-z0-9]{0,38}[a-z0-9])?'.It
defaults to
ApplicationName-UserName-Date-RandomInteger
--optionsId=<long>
Default: AtomicLongFactory
...
--userAgent=<String>
Default: UserAgentFactory
...
A proper fix should be skip methods marked with the Hidden class when performing print help [1]. Additionally, a test should be added to PipelineOptionsReflectorTest [2] or factory test.
[1]
beam/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java
Line 581 in 19bdad6
| public static void printHelp(PrintStream out, Class<? extends PipelineOptions> iface) { |
[2]
beam/sdks/java/core/src/test/java/org/apache/beam/sdk/options/PipelineOptionsReflectorTest.java
Line 120 in 48f9cce
| public void testExcludesHiddenInterfaces() { |
Imported from Jira BEAM-4227. Original Jira may contain additional context.
Reported by: pgerv12.