From 5c1946d6732da62a8cc50c6e076ab6a27d86bd09 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Mon, 30 Jan 2023 11:54:01 +0800 Subject: [PATCH] Add java docs --- .../libxposed/api/XposedContextWrapper.java | 70 +++++++++++-------- .../github/libxposed/api/XposedInterface.java | 30 ++++++++ 2 files changed, 71 insertions(+), 29 deletions(-) diff --git a/api/src/main/java/io/github/libxposed/api/XposedContextWrapper.java b/api/src/main/java/io/github/libxposed/api/XposedContextWrapper.java index fa34347..2bc4eb4 100644 --- a/api/src/main/java/io/github/libxposed/api/XposedContextWrapper.java +++ b/api/src/main/java/io/github/libxposed/api/XposedContextWrapper.java @@ -35,7 +35,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf * * @return API version */ - final public int getAPIVersion() { + public final int getAPIVersion() { return API; } @@ -44,7 +44,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public XposedContext getBaseContext() { + public final XposedContext getBaseContext() { return (XposedContext) super.getBaseContext(); } @@ -53,7 +53,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public String getFrameworkName() { + public final String getFrameworkName() { return getBaseContext().getFrameworkName(); } @@ -62,7 +62,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public String getFrameworkVersion() { + public final String getFrameworkVersion() { return getBaseContext().getFrameworkVersion(); } @@ -70,7 +70,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf * {@inheritDoc} */ @Override - final public long getFrameworkVersionCode() { + public final long getFrameworkVersionCode() { return getBaseContext().getFrameworkVersionCode(); } @@ -78,7 +78,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf * {@inheritDoc} */ @Override - final public int getFrameworkPrivilege() { + public final int getFrameworkPrivilege() { return getBaseContext().getFrameworkPrivilege(); } @@ -87,7 +87,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @Nullable @Override - final public Object featuredMethod(String name, Object... args) { + public final Object featuredMethod(String name, Object... args) { return getBaseContext().featuredMethod(name, args); } @@ -96,7 +96,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker, Method> hookBefore(@NonNull Method origin, @NonNull BeforeHooker hooker) { + public final MethodUnhooker, Method> hookBefore(@NonNull Method origin, @NonNull BeforeHooker hooker) { return getBaseContext().hookBefore(origin, hooker); } @@ -105,7 +105,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker, Method> hookAfter(@NonNull Method origin, @NonNull AfterHooker hooker) { + public final MethodUnhooker, Method> hookAfter(@NonNull Method origin, @NonNull AfterHooker hooker) { return getBaseContext().hookAfter(origin, hooker); } @@ -114,7 +114,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker, Method> hook(@NonNull Method origin, @NonNull Hooker hooker) { + public final MethodUnhooker, Method> hook(@NonNull Method origin, @NonNull Hooker hooker) { return getBaseContext().hook(origin, hooker); } @@ -123,7 +123,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker, Method> hookBefore(@NonNull Method origin, int priority, @NonNull BeforeHooker hooker) { + public final MethodUnhooker, Method> hookBefore(@NonNull Method origin, int priority, @NonNull BeforeHooker hooker) { return getBaseContext().hookBefore(origin, priority, hooker); } @@ -132,7 +132,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker, Method> hookAfter(@NonNull Method origin, int priority, @NonNull AfterHooker hooker) { + public final MethodUnhooker, Method> hookAfter(@NonNull Method origin, int priority, @NonNull AfterHooker hooker) { return getBaseContext().hookAfter(origin, priority, hooker); } @@ -141,7 +141,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker, Method> hook(@NonNull Method origin, int priority, @NonNull Hooker hooker) { + public final MethodUnhooker, Method> hook(@NonNull Method origin, int priority, @NonNull Hooker hooker) { return getBaseContext().hook(origin, priority, hooker); } @@ -150,7 +150,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker>, Constructor> hookBefore(@NonNull Constructor origin, @NonNull BeforeHooker> hooker) { + public final MethodUnhooker>, Constructor> hookBefore(@NonNull Constructor origin, @NonNull BeforeHooker> hooker) { return getBaseContext().hookBefore(origin, hooker); } @@ -159,7 +159,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker>, Constructor> hookAfter(@NonNull Constructor origin, @NonNull AfterHooker> hooker) { + public final MethodUnhooker>, Constructor> hookAfter(@NonNull Constructor origin, @NonNull AfterHooker> hooker) { return getBaseContext().hookAfter(origin, hooker); } @@ -168,7 +168,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker>, Constructor> hook(@NonNull Constructor origin, @NonNull Hooker> hooker) { + public final MethodUnhooker>, Constructor> hook(@NonNull Constructor origin, @NonNull Hooker> hooker) { return getBaseContext().hook(origin, hooker); } @@ -177,7 +177,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker>, Constructor> hookBefore(@NonNull Constructor origin, int priority, @NonNull BeforeHooker> hooker) { + public final MethodUnhooker>, Constructor> hookBefore(@NonNull Constructor origin, int priority, @NonNull BeforeHooker> hooker) { return getBaseContext().hookBefore(origin, priority, hooker); } @@ -186,7 +186,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker>, Constructor> hookAfter(@NonNull Constructor origin, int priority, @NonNull AfterHooker> hooker) { + public final MethodUnhooker>, Constructor> hookAfter(@NonNull Constructor origin, int priority, @NonNull AfterHooker> hooker) { return getBaseContext().hookAfter(origin, priority, hooker); } @@ -195,7 +195,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @NonNull @Override - final public MethodUnhooker>, Constructor> hook(@NonNull Constructor origin, int priority, @NonNull Hooker> hooker) { + public final MethodUnhooker>, Constructor> hook(@NonNull Constructor origin, int priority, @NonNull Hooker> hooker) { return getBaseContext().hook(origin, priority, hooker); } @@ -203,7 +203,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf * {@inheritDoc} */ @Override - final public boolean deoptimize(@NonNull Method method) { + public final boolean deoptimize(@NonNull Method method) { return getBaseContext().deoptimize(method); } @@ -211,31 +211,43 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf * {@inheritDoc} */ @Override - final public boolean deoptimize(@NonNull Constructor constructor) { + public final boolean deoptimize(@NonNull Constructor constructor) { return getBaseContext().deoptimize(constructor); } + /** + * {@inheritDoc} + */ @Nullable @Override - public Object invokeOrigin(@NonNull Method method, @Nullable Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException { + public final Object invokeOrigin(@NonNull Method method, @Nullable Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException { return getBaseContext().invokeOrigin(method, thisObject, args); } + /** + * {@inheritDoc} + */ @Nullable @Override - public Object invokeSpecial(@NonNull Method method, @NonNull Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException { + public final Object invokeSpecial(@NonNull Method method, @NonNull Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException { return getBaseContext().invokeSpecial(method, thisObject, args); } + /** + * {@inheritDoc} + */ @NonNull @Override - public T newInstanceOrigin(@NonNull Constructor constructor, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException { + public final T newInstanceOrigin(@NonNull Constructor constructor, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException { return getBaseContext().newInstanceOrigin(constructor, args); } + /** + * {@inheritDoc} + */ @NonNull @Override - public U newInstanceSpecial(@NonNull Constructor constructor, @NonNull Class subClass, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException { + public final U newInstanceSpecial(@NonNull Constructor constructor, @NonNull Class subClass, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException { return getBaseContext().newInstanceSpecial(constructor, subClass, args); } @@ -243,7 +255,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf * {@inheritDoc} */ @Override - final public void log(@NonNull String message) { + public final void log(@NonNull String message) { getBaseContext().log(message); } @@ -251,7 +263,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf * {@inheritDoc} */ @Override - final public void log(@NonNull String message, @NonNull Throwable throwable) { + public final void log(@NonNull String message, @NonNull Throwable throwable) { getBaseContext().log(message, throwable); } @@ -260,7 +272,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf */ @Nullable @Override - final public DexParser parseDex(@NonNull ByteBuffer dexData, boolean includeAnnotations) throws IOException { + public final DexParser parseDex(@NonNull ByteBuffer dexData, boolean includeAnnotations) throws IOException { return getBaseContext().parseDex(dexData, includeAnnotations); } @@ -268,7 +280,7 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf * {@inheritDoc} */ @Override - final protected void attachBaseContext(Context base) { + protected final void attachBaseContext(Context base) { if (base instanceof XposedContext || base instanceof XposedContextWrapper) { super.attachBaseContext(base); } else { diff --git a/api/src/main/java/io/github/libxposed/api/XposedInterface.java b/api/src/main/java/io/github/libxposed/api/XposedInterface.java index ea2c3fe..519c2fb 100644 --- a/api/src/main/java/io/github/libxposed/api/XposedInterface.java +++ b/api/src/main/java/io/github/libxposed/api/XposedInterface.java @@ -129,6 +129,7 @@ public interface XposedInterface { * * @return the object * @throws InvocationTargetException the invocation target exception + * @throws IllegalArgumentException the illegal argument exception * @throws IllegalAccessException the illegal access exception */ @Nullable @@ -521,27 +522,56 @@ public interface XposedInterface { * @param args the args * @return the object * @throws InvocationTargetException the invocation target exception + * @throws IllegalArgumentException the illegal argument exception * @throws IllegalAccessException the illegal access exception */ @Nullable Object invokeOrigin(@NonNull Method method, @Nullable Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException; + /** + * Invoke special object. + * + * @param method the method + * @param thisObject the this object + * @param args the args + * @return the object + * @throws InvocationTargetException the invocation target exception + * @throws IllegalArgumentException the illegal argument exception + * @throws IllegalAccessException the illegal access exception + */ @Nullable Object invokeSpecial(@NonNull Method method, @NonNull Object thisObject, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException; /** * new origin object. * + * @param the type parameter * @param constructor the constructor * @param args the args * @return the object * @throws InvocationTargetException the invocation target exception + * @throws IllegalArgumentException the illegal argument exception * @throws IllegalAccessException the illegal access exception + * @throws InstantiationException the instantiation exception */ @NonNull T newInstanceOrigin(@NonNull Constructor constructor, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException; + /** + * New instance special u. + * + * @param the type parameter + * @param the type parameter + * @param constructor the constructor + * @param subClass the sub class + * @param args the args + * @return the u + * @throws InvocationTargetException the invocation target exception + * @throws IllegalArgumentException the illegal argument exception + * @throws IllegalAccessException the illegal access exception + * @throws InstantiationException the instantiation exception + */ @NonNull U newInstanceSpecial(@NonNull Constructor constructor, @NonNull Class subClass, Object... args) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException;