Skip to content

[core] Use empty name for languages with a single language version #4048

@oowekyala

Description

@oowekyala

Is your feature request related to a problem? Please describe.
Most language modules support only one language version. Among those, some declare a version with an empty name:

Others declare a version with a name

addVersion(String.valueOf((int) Version.CURRENT.getExternal()), new ApexHandler(), true);

I don't think it's useful to name the version when there is a single one. OTOH having an empty name prevents depending on it by accident. The names are unstable, for instance for Apex, the name comes from Jorje. Also, it's not a breaking change to introduce named versions later, when they're needed.

With #3919, all CPD languages need to be fitted to the PMD language interface. CPD has no concept of language version, so all these languages would have a single version. I think recognizing the "unnamed" language version as an idiom for languages which have only one language version would be useful in this case.

Describe the solution you'd like

  • Rename the versions used by all language modules that have a single version to the empty string
  • Adopt the convention that languages with a single version use an empty string as the name. Maybe add some convenience API in BaseLanguageModule. Add some checks there at least.

Describe alternatives you've considered
Require that all versions have actual names? There is no use for it and the names may change with a library update...

Additional context
Add any other context about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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