Skip to content

[java] Incorrectly refactored typeParameter #4599

@kaby76

Description

@kaby76

The JLS defines typeParameter as the following.

TypeParameter:
    { TypeParameterModifier } TypeIdentifier [ TypeBound ]

TypeParameterModifier:
    Annotation

TypeBound:
    'extends' TypeVariable
    'extends' ClassOrInterfaceType { AdditionalBound }

AdditionalBound:
    '&' InterfaceType

On the contrary, the Antlr grammar defines typeParameter as the following.

typeParameter
: annotation* identifier (EXTENDS annotation* typeBound)?
;
typeBound
: typeType ('&' typeType)*
;

Although they work, these rules are refactored incorrectly. For example, we see identifier used instead of typeIdentifier. People have been doing these refactorings off the top of their heads, but this is not how things should be done because it is not rigorous, and in most cases, wrong. We need to see the actual steps performed in the refactoring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions