core/src/main/java/org/jruby/RubyBasicObject.java
@Override
    public void addFinalizer(IRubyObject f) {
        Finalizer finalizer = (Finalizer) getInternalVariable("__finalizer__");
        if (finalizer == null) {
            // since this is the first time we're registering a finalizer, we
            // must also register this object in ObjectSpace, so that future
            // calls to undefine_finalizer, which takes an object symbol, can
            // locate the object properly. See JRUBY-4839.
            long id = getObjectId();
            IRubyObject fixnumId = id();

            getRuntime().getObjectSpace().registerObjectId(id, this);

            finalizer = new Finalizer(fixnumId);
            setInternalVariable("__finalizer__", finalizer);
            getRuntime().addFinalizer(finalizer);
        }
        finalizer.addFinalizer(f);
    }
/**
     * Adds the specified object as a finalizer for this object.
     */
Adds the specified object as a finalizer for this object.
Adds the specified object as a finalizer for this object .
@Override
    public void addFinalizer(IRubyObject f) {
        Finalizer finalizer = (Finalizer) getInternalVariable("__finalizer__");
        if (finalizer == null) {
            long id = getObjectId();
            IRubyObject fixnumId = id();
            getRuntime().getObjectSpace().registerObjectId(id, this);
            finalizer = new Finalizer(fixnumId);
            setInternalVariable("__finalizer__", finalizer);
            getRuntime().addFinalizer(finalizer);
        }
        finalizer.addFinalizer(f);
    }
@ Override public void addFinalizer ( IRubyObject f ) { Finalizer finalizer = ( Finalizer ) getInternalVariable ( "__finalizer__" ) ; if ( finalizer == null ) { long id = getObjectId ( ) ; IRubyObject fixnumId = id ( ) ; getRuntime ( ) . getObjectSpace ( ) . registerObjectId ( id , this ) ; finalizer = new Finalizer ( fixnumId ) ; setInternalVariable ( "__finalizer__" , finalizer ) ; getRuntime ( ) . addFinalizer ( finalizer ) ; } finalizer . addFinalizer ( f ) ; }
Adds the specified object as a finalizer for this object.
Adds the specified object as a finalizer for this object .
// since this is the first time we're registering a finalizer, we // must also register this object in ObjectSpace, so that future // calls to undefine_finalizer, which takes an object symbol, can // locate the object properly. See JRUBY-4839.