Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
javaVersion=25
mcVersion=1.21.11
group=dev.slne.surf
version=1.21.11-2.55.1
version=1.21.11-2.55.2
relocationPrefix=dev.slne.surf.surfapi.libs
snapshot=false
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
import dev.slne.surf.surfapi.core.api.util.SurfUtil;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.commons.lang3.reflect.MethodUtils;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
Expand All @@ -19,11 +25,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.commons.lang3.reflect.MethodUtils;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

@NullMarked
public final class SurfInvocationHandlerJava<T> implements InvocationHandler {
Expand Down Expand Up @@ -176,7 +177,10 @@ private static Method findMethod(
final Class<?>[] paramTypes = Arrays.copyOfRange(original.getParameterTypes(), paramOffset,
original.getParameterCount());
final String methodName = getMethodName(original, nameAnnotation, null, staticAnnotation, null);
final Method method = MethodUtils.getMatchingAccessibleMethod(clazz, methodName, paramTypes);
final Method method = MethodUtils.getMatchingMethod(clazz, methodName, paramTypes);
if (method != null) {
method.setAccessible(true);
}
Comment on lines +180 to +183

Copilot AI Feb 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method.setAccessible(true) can throw InaccessibleObjectException (JPMS/module access) or SecurityException. Right now that will escape as a runtime failure (and likely be wrapped by sneaky(...) later), which is harder to diagnose than a deliberate error. Consider using trySetAccessible() and, if it fails, throw an exception with a clear message about the target class/module not being opened (or fall back to a privateLookupIn(...).unreflect(...) approach).

Copilot uses AI. Check for mistakes.
if (method == null) {
throw new NoSuchMethodException(
"Method " + methodName + " with params " + Arrays.toString(paramTypes));
Expand Down
Loading