4406
4407 void ClassFileParser::set_precomputed_flags(instanceKlassHandle k) {
4408 Klass* super = k->super();
4409
4410 // Check if this klass has an empty finalize method (i.e. one with return bytecode only),
4411 // in which case we don't have to register objects as finalizable
4412 if (!_has_empty_finalizer) {
4413 if (_has_finalizer ||
4414 (super != NULL && super->has_finalizer())) {
4415 k->set_has_finalizer();
4416 }
4417 }
4418
4419 #ifdef ASSERT
4420 bool f = false;
4421 Method* m = k->lookup_method(vmSymbols::finalize_method_name(),
4422 vmSymbols::void_method_signature());
4423 if (m != NULL && !m->is_empty_method()) {
4424 f = true;
4425 }
4426 assert(f == k->has_finalizer(), "inconsistent has_finalizer");
4427 #endif
4428
4429 // Check if this klass supports the java.lang.Cloneable interface
4430 if (SystemDictionary::Cloneable_klass_loaded()) {
4431 if (k->is_subtype_of(SystemDictionary::Cloneable_klass())) {
4432 k->set_is_cloneable();
4433 }
4434 }
4435
4436 // Check if this klass has a vanilla default constructor
4437 if (super == NULL) {
4438 // java.lang.Object has empty default constructor
4439 k->set_has_vanilla_constructor();
4440 } else {
4441 if (super->has_vanilla_constructor() &&
4442 _has_vanilla_constructor) {
4443 k->set_has_vanilla_constructor();
4444 }
4445 #ifdef ASSERT
4446 bool v = false;
|
4406
4407 void ClassFileParser::set_precomputed_flags(instanceKlassHandle k) {
4408 Klass* super = k->super();
4409
4410 // Check if this klass has an empty finalize method (i.e. one with return bytecode only),
4411 // in which case we don't have to register objects as finalizable
4412 if (!_has_empty_finalizer) {
4413 if (_has_finalizer ||
4414 (super != NULL && super->has_finalizer())) {
4415 k->set_has_finalizer();
4416 }
4417 }
4418
4419 #ifdef ASSERT
4420 bool f = false;
4421 Method* m = k->lookup_method(vmSymbols::finalize_method_name(),
4422 vmSymbols::void_method_signature());
4423 if (m != NULL && !m->is_empty_method()) {
4424 f = true;
4425 }
4426
4427 // Spec doesn't prevent agent from redefinition of empty finalizer.
4428 // Despite the fact that it's generally bad idea and redefined finalizer
4429 // will not work as expected we shouldn't abort vm in this case
4430 if (!k->has_redefined_this_or_super()) {
4431 assert(f == k->has_finalizer(), "inconsistent has_finalizer");
4432 }
4433 #endif
4434
4435 // Check if this klass supports the java.lang.Cloneable interface
4436 if (SystemDictionary::Cloneable_klass_loaded()) {
4437 if (k->is_subtype_of(SystemDictionary::Cloneable_klass())) {
4438 k->set_is_cloneable();
4439 }
4440 }
4441
4442 // Check if this klass has a vanilla default constructor
4443 if (super == NULL) {
4444 // java.lang.Object has empty default constructor
4445 k->set_has_vanilla_constructor();
4446 } else {
4447 if (super->has_vanilla_constructor() &&
4448 _has_vanilla_constructor) {
4449 k->set_has_vanilla_constructor();
4450 }
4451 #ifdef ASSERT
4452 bool v = false;
|