3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-01-16 15:46:20 +00:00

Java bindings with no finalizers

Replacing finalizers with PhantomReferences, required quite a lot of
changes to the codebase.
This commit is contained in:
George Karpenkov 2016-06-12 14:18:13 +02:00
parent dfc80d3b69
commit 495ef0f055
48 changed files with 368 additions and 939 deletions

View file

@ -20,32 +20,21 @@ package com.microsoft.z3;
/**
* Lists of constructors
**/
public class ConstructorList extends Z3Object
{
/**
* Destructor.
* @throws Throwable
* @throws Z3Exception on error
**/
protected void finalize() throws Throwable
{
try {
Native.delConstructorList(getContext().nCtx(), getNativeObject());
} finally {
super.finalize();
}
}
public class ConstructorList extends Z3Object {
ConstructorList(Context ctx, long obj)
{
super(ctx, obj);
}
@Override
void incRef(long o) {
getContext().getConstructorListDRQ().storeReference(getContext(), this);
}
ConstructorList(Context ctx, Constructor[] constructors)
{
super(ctx);
setNativeObject(Native.mkConstructorList(getContext().nCtx(),
super(ctx, Native.mkConstructorList(ctx.nCtx(),
constructors.length,
Constructor.arrayToNative(constructors)));
}