MCPcopy Create free account
hub / github.com/cinit/TMoe / findMethodByTypes_1

Method findMethodByTypes_1

app/src/main/java/cc/ioctl/tmoe/util/Reflex.java:1031–1068  ·  view source on GitHub ↗
(Class<?> clazz, Class returnType, Class... argt)

Source from the content-addressed store, hash-verified

1029 }
1030
1031 public static Method findMethodByTypes_1(Class<?> clazz, Class returnType, Class... argt)
1032 throws NoSuchMethodException {
1033 Method method = null;
1034 Method[] m;
1035 Class[] _argt;
1036 loop_main:
1037 do {
1038 m = clazz.getDeclaredMethods();
1039 loop:
1040 for (Method value : m) {
1041 _argt = value.getParameterTypes();
1042 if (_argt.length == argt.length) {
1043 for (int ii = 0; ii < argt.length; ii++) {
1044 if (!argt[ii].equals(_argt[ii])) {
1045 continue loop;
1046 }
1047 }
1048 if (returnType != null && !returnType.equals(value.getReturnType())) {
1049 continue;
1050 }
1051 if (method == null) {
1052 method = value;
1053 //here we go through this class
1054 } else {
1055 throw new NoSuchMethodException(
1056 "Multiple methods found for __attribute__((any))" + paramsTypesToString(
1057 argt) + " in " + clazz.getName());
1058 }
1059 }
1060 }
1061 } while (method == null && !Object.class.equals(clazz = clazz.getSuperclass()));
1062 if (method == null) {
1063 throw new NoSuchMethodException(
1064 "__attribute__((a))" + paramsTypesToString(argt) + " in " + clazz.getName());
1065 }
1066 method.setAccessible(true);
1067 return method;
1068 }
1069
1070 public static Field hasField(Object obj, String name) throws ReflectiveOperationException {
1071 return hasField(obj, name, null);

Callers

nothing calls this directly

Calls 4

paramsTypesToStringMethod · 0.95
getParameterTypesMethod · 0.80
getReturnTypeMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected