Improved java handling for unknown types