4294 4295 void ClassFileParser::set_precomputed_flags(instanceKlassHandle k) { 4296 Klass* super = k->super(); 4297 4298 // Check if this klass has an empty finalize method (i.e. one with return bytecode only), 4299 // in which case we don't have to register objects as finalizable 4300 if (!_has_empty_finalizer) { 4301 if (_has_finalizer || 4302 (super != NULL && super->has_finalizer())) { 4303 k->set_has_finalizer(); 4304 } 4305 } 4306 4307 #ifdef ASSERT 4308 bool f = false; 4309 Method* m = k->lookup_method(vmSymbols::finalize_method_name(), 4310 vmSymbols::void_method_signature()); 4311 if (m != NULL && !m->is_empty_method()) { 4312 f = true; 4313 } 4314 assert(f == k->has_finalizer(), "inconsistent has_finalizer"); 4315 #endif 4316 4317 // Check if this klass supports the java.lang.Cloneable interface 4318 if (SystemDictionary::Cloneable_klass_loaded()) { 4319 if (k->is_subtype_of(SystemDictionary::Cloneable_klass())) { 4320 k->set_is_cloneable(); 4321 } 4322 } 4323 4324 // Check if this klass has a vanilla default constructor 4325 if (super == NULL) { 4326 // java.lang.Object has empty default constructor 4327 k->set_has_vanilla_constructor(); 4328 } else { 4329 if (super->has_vanilla_constructor() && 4330 _has_vanilla_constructor) { 4331 k->set_has_vanilla_constructor(); 4332 } 4333 #ifdef ASSERT 4334 bool v = false; | 4294 4295 void ClassFileParser::set_precomputed_flags(instanceKlassHandle k) { 4296 Klass* super = k->super(); 4297 4298 // Check if this klass has an empty finalize method (i.e. one with return bytecode only), 4299 // in which case we don't have to register objects as finalizable 4300 if (!_has_empty_finalizer) { 4301 if (_has_finalizer || 4302 (super != NULL && super->has_finalizer())) { 4303 k->set_has_finalizer(); 4304 } 4305 } 4306 4307 #ifdef ASSERT 4308 bool f = false; 4309 Method* m = k->lookup_method(vmSymbols::finalize_method_name(), 4310 vmSymbols::void_method_signature()); 4311 if (m != NULL && !m->is_empty_method()) { 4312 f = true; 4313 } 4314 4315 // Spec doesn't prevent agent from redefinition of empty finalizer. 4316 // Despite the fact that it's generally bad idea and redefined finalizer 4317 // will not work as expected we shouldn't abort vm in this case 4318 if (!k->has_been_redefined()) { 4319 assert(f == k->has_finalizer(), "inconsistent has_finalizer"); 4320 } 4321 #endif 4322 4323 // Check if this klass supports the java.lang.Cloneable interface 4324 if (SystemDictionary::Cloneable_klass_loaded()) { 4325 if (k->is_subtype_of(SystemDictionary::Cloneable_klass())) { 4326 k->set_is_cloneable(); 4327 } 4328 } 4329 4330 // Check if this klass has a vanilla default constructor 4331 if (super == NULL) { 4332 // java.lang.Object has empty default constructor 4333 k->set_has_vanilla_constructor(); 4334 } else { 4335 if (super->has_vanilla_constructor() && 4336 _has_vanilla_constructor) { 4337 k->set_has_vanilla_constructor(); 4338 } 4339 #ifdef ASSERT 4340 bool v = false; |