Java backend: minor optimization