Java_gen: a few smaller fixes

Reviewer: @yotamhc

thought this was already in...