Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate IDisposable and related utilities #7309

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions common/api/core-backend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ import { Id64Arg } from '@itwin/core-bentley';
import { Id64Array } from '@itwin/core-bentley';
import { Id64Set } from '@itwin/core-bentley';
import { Id64String } from '@itwin/core-bentley';
import { IDisposable } from '@itwin/core-bentley';
import { ImageSourceFormat } from '@itwin/core-common';
import { IModel } from '@itwin/core-common';
import { IModelCoordinatesRequestProps } from '@itwin/core-common';
Expand Down Expand Up @@ -635,14 +634,14 @@ export interface ChangedECInstance {
}

// @internal
export class ChangedElementsDb implements IDisposable {
export class ChangedElementsDb implements Disposable {
// (undocumented)
[Symbol.dispose](): void;
constructor();
// (undocumented)
cleanCaches(): void;
closeDb(): void;
static createDb(briefcase: IModelDb, pathName: string): ChangedElementsDb;
// (undocumented)
dispose(): void;
getChangeData(startChangesetId: string, endChangesetId: string): ChangeData | undefined;
getChangedElements(startChangesetId: string, endChangesetId: string): ChangedElements | undefined;
getChangedModels(startChangesetId: string, endChangesetId: string): ChangedModels | undefined;
Expand Down Expand Up @@ -688,7 +687,8 @@ export interface ChangesetArg extends IModelIdArg {
}

// @beta
export class ChangesetECAdaptor implements IDisposable {
export class ChangesetECAdaptor implements Disposable {
[Symbol.dispose](): void;
constructor(reader: SqliteChangesetReader, disableMetaData?: boolean);
acceptClass(classFullName: string): ChangesetECAdaptor;
acceptOp(op: SqliteChangeOp): ChangesetECAdaptor;
Expand All @@ -702,7 +702,6 @@ export class ChangesetECAdaptor implements IDisposable {
deleted?: ChangedECInstance;
// (undocumented)
readonly disableMetaData: boolean;
dispose(): void;
inserted?: ChangedECInstance;
get isDeleted(): boolean;
isECTable(tableName: string): boolean;
Expand Down Expand Up @@ -1740,16 +1739,18 @@ export abstract class DriverBundleElement extends InformationContentElement {
}

// @public
export class ECDb implements IDisposable {
export class ECDb implements Disposable {
// @internal (undocumented)
get [_nativeDb](): IModelJsNative.ECDb;
[Symbol.dispose](): void;
constructor();
abandonChanges(): void;
// @internal
clearStatementCache(): void;
closeDb(): void;
createDb(pathName: string): void;
createQueryReader(ecsql: string, params?: QueryBinder, config?: QueryOptions): ECSqlReader;
// @deprecated (undocumented)
dispose(): void;
// @internal
getCachedStatementCount(): number;
Expand Down Expand Up @@ -1866,7 +1867,8 @@ export interface ECSqlRowArg {
}

// @public
export class ECSqlStatement implements IterableIterator<any>, IDisposable {
export class ECSqlStatement implements IterableIterator<any>, Disposable {
[Symbol.dispose](): void;
[Symbol.iterator](): IterableIterator<any>;
bindArray(parameter: number | string, val: any[]): void;
bindBlob(parameter: number | string, blob: string | Uint8Array | ArrayBuffer | SharedArrayBuffer): void;
Expand All @@ -1888,6 +1890,7 @@ export class ECSqlStatement implements IterableIterator<any>, IDisposable {
bindValue(parameter: number | string, val: any): void;
bindValues(values: any[] | object): void;
clearBindings(): void;
// @deprecated (undocumented)
dispose(): void;
getBinder(parameter: string | number): ECSqlBinder;
getColumnCount(): number;
Expand Down Expand Up @@ -3332,10 +3335,12 @@ export namespace IModelDb {

// @beta
export class IModelElementCloneContext {
[Symbol.dispose](): void;
constructor(sourceDb: IModelDb, targetDb?: IModelDb);
// @internal
cloneElement(sourceElement: Element_2, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps;
static create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext>;
// @deprecated (undocumented)
dispose(): void;
// @internal
dump(outputFileName: string): void;
Expand Down Expand Up @@ -5282,15 +5287,15 @@ export interface SqliteChange {
export type SqliteChangeOp = "Inserted" | "Updated" | "Deleted";

// @beta
export class SqliteChangesetReader implements IDisposable {
export class SqliteChangesetReader implements Disposable {
[Symbol.dispose](): void;
protected constructor(
db: AnyDb);
get changeIndex(): number;
close(): void;
get columnCount(): number;
readonly db: AnyDb;
get disableSchemaCheck(): boolean;
dispose(): void;
getChangeValue(columnIndex: number, stage: SqliteValueStage): SqliteValue_2;
getChangeValueBinary(columnIndex: number, stage: SqliteValueStage): Uint8Array | null | undefined;
getChangeValueDouble(columnIndex: number, stage: SqliteValueStage): number | null | undefined;
Expand Down Expand Up @@ -5438,7 +5443,8 @@ export namespace SQLiteDb {
}

// @public
export class SqliteStatement implements IterableIterator<any>, IDisposable {
export class SqliteStatement implements IterableIterator<any>, Disposable {
[Symbol.dispose](): void;
[Symbol.iterator](): IterableIterator<any>;
constructor(_sql: string);
bindBlob(parameter: BindParameter, blob: Uint8Array): void;
Expand All @@ -5454,6 +5460,7 @@ export class SqliteStatement implements IterableIterator<any>, IDisposable {
bindValue(parameter: BindParameter, value: any): void;
bindValues(values: any[] | object): void;
clearBindings(): void;
// @deprecated (undocumented)
dispose(): void;
getColumnBytes(colIndex: number): number;
getColumnCount(): number;
Expand Down
19 changes: 15 additions & 4 deletions common/api/core-bentley.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,15 @@ export class DisposableList implements IDisposable {
}

// @public
export function dispose(disposable?: Disposable): undefined;

// @public @deprecated (undocumented)
export function dispose(disposable?: IDisposable): undefined;

// @public
export function disposeArray(list?: Disposable[]): undefined;

// @public @deprecated (undocumented)
export function disposeArray(list?: IDisposable[]): undefined;

// @public
Expand Down Expand Up @@ -695,7 +701,7 @@ export type Id64Set = Set<Id64String>;
// @public
export type Id64String = string;

// @public
// @public @deprecated
export interface IDisposable {
dispose(): void;
}
Expand Down Expand Up @@ -1009,6 +1015,9 @@ export class IndexMap<T> {
}

// @public
export function isDisposable(obj: unknown): obj is Disposable;

// @public @deprecated
export function isIDisposable(obj: unknown): obj is IDisposable;

// @public
Expand Down Expand Up @@ -1404,9 +1413,11 @@ export class OrderedSet<T> extends ReadonlyOrderedSet<T> {
export function partitionArray<T>(array: T[], criterion: (element: T) => boolean): number;

// @public
export class PerfLogger implements IDisposable {
constructor(operation: string, metaData?: LoggingMetaData);
export class PerfLogger implements Disposable {
// (undocumented)
[Symbol.dispose](): void;
constructor(operation: string, metaData?: LoggingMetaData);
// @deprecated (undocumented)
dispose(): void;
}

Expand Down Expand Up @@ -1744,7 +1755,7 @@ export class UnexpectedErrors {
static setHandler(handler: OnUnexpectedError): OnUnexpectedError;
}

// @public
// @public @deprecated
export function using<T extends IDisposable, TResult>(resources: T | T[], func: (...r: T[]) => TResult): TResult;

// @public
Expand Down
9 changes: 5 additions & 4 deletions common/api/core-common.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { GuidString } from '@itwin/core-bentley';
import { Id64 } from '@itwin/core-bentley';
import { Id64Array } from '@itwin/core-bentley';
import { Id64String } from '@itwin/core-bentley';
import { IDisposable } from '@itwin/core-bentley';
import { IModelJson } from '@itwin/core-geometry';
import { IModelStatus } from '@itwin/core-bentley';
import { IndexedPolyface } from '@itwin/core-geometry';
Expand Down Expand Up @@ -8140,11 +8139,13 @@ export namespace RenderSchedule {
}

// @public
export abstract class RenderTexture implements IDisposable {
export abstract class RenderTexture implements Disposable {
[Symbol.dispose](): void;
protected constructor(type: RenderTexture.Type);
// (undocumented)
abstract get bytesUsed(): number;
compare(other: RenderTexture): number;
// @deprecated (undocumented)
abstract dispose(): void;
// (undocumented)
get isGlyph(): boolean;
Expand Down Expand Up @@ -8780,6 +8781,8 @@ export class RpcRegistry {

// @internal
export abstract class RpcRequest<TResponse = any> {
// (undocumented)
[Symbol.dispose](): void;
constructor(client: RpcInterface, operation: string, parameters: any[]);
static get activeRequests(): ReadonlyMap<string, RpcRequest>;
static get aggregateLoad(): RpcOperationsProfile;
Expand All @@ -8790,8 +8793,6 @@ export abstract class RpcRequest<TResponse = any> {
protected computeRetryAfter(attempts: number): number;
get connecting(): boolean;
static current(context: RpcInterface): RpcRequest;
// (undocumented)
dispose(): void;
get elapsed(): number;
static readonly events: BeEvent<RpcRequestEventHandler>;
get extendedStatus(): string;
Expand Down
Loading
Loading