[Java] Serializatio revisited

Remove code based on Java library like Serializable.