Skip to content
Open
21 changes: 18 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,20 @@ declare module "frida-java-bridge" {
*/
$init: MethodDispatcher<T>;

/**
* The class initializer, i.e. `<clinit>`, which the runtime invokes once to
* initialize the class' static state.
*
* Replace the `implementation` property to hook it. As the class is only ever
* initialized once, this must happen before anything touches it -- accessing a
* static member, or calling a static method, is enough to trigger it. Note that
* `Java.use()` itself deliberately does not. Throws if the class has no class
* initializer.
*
* Not supported on Dalvik, i.e. Android < 5.0.
*/
$clinit: Method<T, [], void>;

/**
* Eagerly deletes the underlying JNI global reference without having to
* wait for the object to become unreachable and the JavaScript
Expand Down Expand Up @@ -534,9 +548,10 @@ declare module "frida-java-bridge" {

// eslint-disable-next-line @definitelytyped/no-const-enum
const enum MethodType {
Constructor = 1,
Static = 2,
Instance = 3,
ClassInitializer = 1,
Constructor = 2,
Static = 3,
Instance = 4,
}

// eslint-disable-next-line @definitelytyped/no-const-enum
Expand Down
Loading