contrib/jwrapper: refactor `add_identifier`