Refactor java class, package and type system.