mirror of
https://github.com/Z3Prover/z3
synced 2026-06-23 17:10:33 +00:00
* Reworked phantom reference handling. - Replaced IDecRefQueue with a new Z3ReferenceQueue class - Z3ReferenceQueue manages custom subclasses of phantom references in a doubly-linked list - Replaced all subclasses of IDecRefQueue with subclasses of Z3ReferenceQueue.Reference. These custom reference classes are embedded in the class they reference count. - Context now owns a single Z3ReferenceQueue for all types of references. * Made Statistics.Entry a static subclass * Made Context.close idempotent (as recommended) * Update CMakeLists.txt for building the Java API. * Updated CMakeLists.txt again. * Use correct SuppressWarning annotation to silence the compiler * Formatting
60 lines
1.2 KiB
Java
60 lines
1.2 KiB
Java
/**
|
|
Copyright (c) 2012-2014 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
ConstructorList.java
|
|
|
|
Abstract:
|
|
|
|
Author:
|
|
|
|
@author Christoph Wintersteiger (cwinter) 2012-03-15
|
|
|
|
Notes:
|
|
|
|
**/
|
|
|
|
package com.microsoft.z3;
|
|
|
|
import java.lang.ref.ReferenceQueue;
|
|
|
|
/**
|
|
* Lists of constructors
|
|
**/
|
|
public class ConstructorList<R> extends Z3Object {
|
|
|
|
ConstructorList(Context ctx, long obj)
|
|
{
|
|
super(ctx, obj);
|
|
}
|
|
|
|
@Override
|
|
void incRef() {
|
|
// Constructor lists are not reference counted.
|
|
}
|
|
|
|
@Override
|
|
void addToReferenceQueue() {
|
|
getContext().getReferenceQueue().storeReference(this, ConstructorListRef::new);
|
|
}
|
|
|
|
ConstructorList(Context ctx, Constructor<R>[] constructors)
|
|
{
|
|
super(ctx, Native.mkConstructorList(ctx.nCtx(),
|
|
constructors.length,
|
|
Constructor.arrayToNative(constructors)));
|
|
}
|
|
|
|
private static class ConstructorListRef extends Z3ReferenceQueue.Reference<ConstructorList<?>> {
|
|
|
|
private ConstructorListRef(ConstructorList<?> referent, ReferenceQueue<Z3Object> q) {
|
|
super(referent, q);
|
|
}
|
|
|
|
@Override
|
|
void decRef(Context ctx, long z3Obj) {
|
|
Native.delConstructorList(ctx.nCtx(), z3Obj);
|
|
}
|
|
}
|
|
}
|