Java improvements from preprocess rewrite