Search in sources :

Example 1 with IManualDestructable

use of php.runtime.lang.support.IManualDestructable in project jphp by jphp-compiler.

the class ObjectMemory method manualUnset.

@Override
public void manualUnset(Environment env) {
    ClassEntity entity = value.getReflection();
    if (entity.methodDestruct != null) {
        if (!value.isFinalized()) {
            value.doFinalize();
            env.pushCall(value, entity.methodDestruct.getName());
            try {
                if (value instanceof IManualDestructable) {
                    ((IManualDestructable) value).onManualDestruct(env);
                }
                entity.methodDestruct.invokeDynamic(value, env);
            } catch (InvocationTargetException e) {
                env.__throwException(e);
            } catch (RuntimeException e) {
                throw e;
            } catch (Throwable throwable) {
                throw new CriticalException(throwable);
            } finally {
                env.popCall();
            }
        }
    }
}
Also used : ClassEntity(php.runtime.reflection.ClassEntity) IManualDestructable(php.runtime.lang.support.IManualDestructable) CriticalException(php.runtime.exceptions.CriticalException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 CriticalException (php.runtime.exceptions.CriticalException)1 IManualDestructable (php.runtime.lang.support.IManualDestructable)1 ClassEntity (php.runtime.reflection.ClassEntity)1