Various improvements, mainly to Java codec generator