src/share/vm/classfile/classFileParser.cpp

Print this page




4292 }
4293 
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     }




4292 }
4293 
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     // Spec doesn't prevent agent from redefinition of empty finalyzer.
4313     // despite the fact that it's generally bad idea and redefined finalyzer
4314     // will not work as expected we shouldn't abort vm in this case
4315     if (!k->has_been_redefined()) {
4316       f = true;
4317     }
4318   }
4319   assert(f == k->has_finalizer(), "inconsistent has_finalizer");
4320 #endif
4321 
4322   // Check if this klass supports the java.lang.Cloneable interface
4323   if (SystemDictionary::Cloneable_klass_loaded()) {
4324     if (k->is_subtype_of(SystemDictionary::Cloneable_klass())) {
4325       k->set_is_cloneable();
4326     }
4327   }
4328 
4329   // Check if this klass has a vanilla default constructor
4330   if (super == NULL) {
4331     // java.lang.Object has empty default constructor
4332     k->set_has_vanilla_constructor();
4333   } else {
4334     if (super->has_vanilla_constructor() &&
4335         _has_vanilla_constructor) {
4336       k->set_has_vanilla_constructor();
4337     }