This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new e122a3835f8 Remove useless codes for AgentReflectionUtils (#30268)
e122a3835f8 is described below
commit e122a3835f8b2b1aa7fa299e480ed8b0ebc05f9e
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Feb 24 14:51:47 2024 +0800
Remove useless codes for AgentReflectionUtils (#30268)
---
.../plugin/core/util/AgentReflectionUtils.java | 24 ----------------------
.../plugin/core/util/AgentReflectionUtilsTest.java | 5 -----
2 files changed, 29 deletions(-)
diff --git
a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java
b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java
index 27e78a72bd3..a00bcc116df 100644
---
a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java
+++
b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java
@@ -22,7 +22,6 @@ import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.util.Optional;
/**
@@ -73,27 +72,4 @@ public final class AgentReflectionUtils {
}
return Optional.empty();
}
-
- /**
- * Invoke method.
- *
- * @param method method
- * @param target target
- * @param args arguments
- * @param <T> type of invoke result
- * @return invoke result
- */
- @SuppressWarnings("unchecked")
- @SneakyThrows(ReflectiveOperationException.class)
- public static <T> T invokeMethod(final Method method, final Object target,
final Object... args) {
- boolean accessible = method.isAccessible();
- if (!accessible) {
- method.setAccessible(true);
- }
- T result = (T) method.invoke(target, args);
- if (!accessible) {
- method.setAccessible(false);
- }
- return result;
- }
}
diff --git
a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilsTest.java
b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilsTest.java
index e6bf3a63525..937b09740d9 100644
---
a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilsTest.java
+++
b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilsTest.java
@@ -30,9 +30,4 @@ class AgentReflectionUtilsTest {
ReflectionFixture reflectionFixture = new ReflectionFixture("foo");
assertThat(AgentReflectionUtils.getFieldValue(reflectionFixture,
"value"), is(reflectionFixture.getValue()));
}
-
- @Test
- void assertInvokeMethod() throws NoSuchMethodException {
-
assertThat(AgentReflectionUtils.invokeMethod(ReflectionFixture.class.getDeclaredMethod("call"),
new ReflectionFixture("foo")), is("foo"));
- }
}