Fix memory issue in JavaClass with reading fields.