Java backend: minor: clean up
Java backend: lazy initialization + cache for Term#hashCode()