feat: support probe shell generation

This commit is contained in:
ReaJason
2025-08-13 23:53:40 +08:00
parent 6a4c5a1e96
commit 13be57e66d
304 changed files with 59084 additions and 1454 deletions
@@ -1,13 +1,9 @@
package com.reajason.javaweb.buddy;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.asm.AsmVisitorWrapper;
import net.bytebuddy.dynamic.DynamicType;
import org.junit.jupiter.api.Test;
import java.util.Collections;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
@@ -43,15 +39,8 @@ class MethodCallReplaceVisitorWrapperTest {
DynamicType.Unloaded<TargetClass> dynamicType = new ByteBuddy()
.redefine(TargetClass.class)
.name(newClassName)
.visit(new AsmVisitorWrapper
.ForDeclaredMethods()
.method(named("targetMethod"),
new MethodCallReplaceVisitorWrapper(
newClassName,
Collections.singleton(ExternalClass.class.getName())
)
)
)
.visit(MethodCallReplaceVisitorWrapper.newInstance(
"targetMethod", newClassName, ExternalClass.class.getName()))
.make();
Class<?> redefinedClass = dynamicType.load(MethodCallReplaceVisitorWrapperTest.class.getClassLoader())
.getLoaded();