contrib/jwrapper grammar: fix `implements` and `extends` behavior