On 9/29/17 2:38 PM, Peter Levart wrote:
I think the hotspot has an optimization and detects that finalize() has no bytecodes and treats the object as not needing finalization.
http://hg.openjdk.java.net/jdk10/master/file/7d67bb6b0599/src/hotspot/share/classfile/classFileParser.cpp#l4250

  // Check if this klass has an empty finalize method (i.e. one with return bytecode only),
  // in which case we don't have to register objects as finalizable
  if (!_has_empty_finalizer) {
    if (_has_finalizer ||
        (super != NULL && super->has_finalizer())) {
      ik->set_has_finalizer();
    }
  }

Mandy

Reply via email to