congo-cc / congo-parser-generator

The CongoCC Parser Generator, the Next Generation of JavaCC 21, which in turn was the next generation of JavaCC
https://discuss.congocc.org/
Other
36 stars 11 forks source link

potential NPE on `token.getLocation()` #27

Closed stbischof closed 1 year ago

stbischof commented 1 year ago

https://github.com/congo-cc/congo-parser-generator/blob/08708399b324504961bb1a55fcee58f31e5a1d2c/src/templates/java/ParseException.java.ftl#L69

revusky commented 1 year ago

Okay, that one is correct. I suppose it was never hitting the NPE because in the code, if token was null, expectedTypes always was null, so it would exist on line 72. But this is a potential problem lurking, now fixed. Actually, that ParseException template is due for some significant rewriting/refactoring at some point soon, I think.

stbischof commented 1 year ago

thx for fixing so fast.

this all arent really bugs in production. but i thing is is a good idea to let external cleanCode tools validate the generated parsers