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.73.0
version=1.21.11-2.73.1
relocationPrefix=dev.slne.surf.surfapi.libs
snapshot=false
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,13 @@ static <I> I createInvoker(
final List<Object> classData = List.of(target, payloadClass, method, privateLookupIn, isSuspend);
final MethodHandles.Lookup hiddenClassLookup = lookup.defineHiddenClassWithClassData(templateBytes, classData, true);

return hiddenClassLookup.lookupClass()
.asSubclass(invokerInterface)
.getDeclaredConstructor()
.newInstance();
final MethodHandle constructor = hiddenClassLookup.findConstructor(hiddenClassLookup.lookupClass(), MethodType.methodType(void.class));

try {
return invokerInterface.cast(constructor.invoke());
} catch (Throwable e) {
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

The new catch (Throwable e) wraps all Errors (e.g., OutOfMemoryError, StackOverflowError) into a ReflectiveOperationException, which can mask fatal JVM conditions and change failure semantics. Consider rethrowing Error (or at least VirtualMachineError/ThreadDeath/LinkageError) and only wrapping non-fatal throwables from MethodHandle.invoke() into ReflectiveOperationException.

Suggested change
} catch (Throwable e) {
} catch (Throwable e) {
if (e instanceof Error) {
throw (Error) e;
}

Copilot uses AI. Check for mistakes.
throw new ReflectiveOperationException("Failed to instantiate hidden class", e);
}
}

/**
Expand Down Expand Up @@ -192,7 +195,7 @@ public static InvokerClassData loadClassData(
* the hidden class.
* @param methodType the expected {@link MethodType} for non-suspend handler methods.
* @return an {@link InvokerClassData} instance containing the resolved handler method
* information, along with metadata on whether it's a suspend function.
* information, along with metadata on whether it's a suspend function.
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

JavaDoc formatting regression: the continuation line after @return lost indentation/alignment (* information, ...). This reads like a paragraph break and is inconsistent with the surrounding JavaDoc style; re-indent to keep the wrapped @return description aligned.

Suggested change
* information, along with metadata on whether it's a suspend function.
* information, along with metadata on whether it's a suspend function.

Copilot uses AI. Check for mistakes.
* @throws ReflectiveOperationException if class data extraction or handle resolution fails.
*/
public static InvokerClassData loadClassDataWithAutoSuspend(
Expand Down