-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Labels
Description
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.
grammars-v4/java/java/JavaParser.g4
Lines 106 to 112 in a0e876b
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.