Skip to content

Hidden annotation does not hide methods from help text #18873

@kennknowles

Description

@kennknowles

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]

public static void printHelp(PrintStream out, Class<? extends PipelineOptions> iface) {

[2]

Imported from Jira BEAM-4227. Original Jira may contain additional context.
Reported by: pgerv12.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions