grammars-v4
grammars-v4 copied to clipboard
Potential bug in Java grammar
trafficstars
I'm currently using this Java grammar in a project and found something which I believe is a bug. Look at these interface method rules:
interfaceMethodDeclaration
: interfaceMethodModifier* (typeTypeOrVoid | typeParameters annotation* typeTypeOrVoid)
IDENTIFIER formalParameters ('[' ']')* (THROWS qualifiedNameList)? methodBody
;
genericInterfaceMethodDeclaration
: typeParameters interfaceMethodDeclaration
;
As you can see the generic interface method decl uses the normal one. However, looking closer you can see that interfaceMethodDeclaration actually also parses type parameters (so it's actually generic too).
However genericInterfaceMethodDeclaration also parses type parameters, allowing so 2 sets of parameters, which is wrong IMO. But since I'm not so fluent in Java, it could be I'm wrong here.