fix problem with multiple method overrides in generic types.
This commit is contained in:
		| @@ -12,11 +12,12 @@ public record AppliedCheck(InteractionCheck<?> check, Annotation annotation) { | ||||
|     public boolean pre(Object context) { | ||||
|         Method[] methods = Arrays.stream(check.getClass().getMethods()) | ||||
|             .filter(x -> x.getName().equals("preExec")) | ||||
|             .filter(x -> !x.isBridge()) | ||||
|             .toArray(s -> new Method[s]); | ||||
|         Method method = ReflectionUtil.getMostSpecificMethod(methods, context.getClass()); | ||||
|         Method method = ReflectionUtil.getMostSpecificMethod(methods, context.getClass(), annotation.getClass()); | ||||
|         method.setAccessible(true); | ||||
|         try { | ||||
|             return (boolean) method.invoke(check, annotation); | ||||
|             return (boolean) method.invoke(check, context, annotation); | ||||
|         } catch (IllegalAccessException | InvocationTargetException | SecurityException e) { | ||||
|             e.printStackTrace(); | ||||
|             return false; | ||||
| @@ -26,11 +27,12 @@ public record AppliedCheck(InteractionCheck<?> check, Annotation annotation) { | ||||
|     public boolean post(Object context) { | ||||
|         Method[] methods = Arrays.stream(check.getClass().getMethods()) | ||||
|             .filter(x -> x.getName().equals("postExec")) | ||||
|             .filter(x -> !x.isBridge()) | ||||
|             .toArray(s -> new Method[s]); | ||||
|         Method method = ReflectionUtil.getMostSpecificMethod(methods, context.getClass()); | ||||
|         Method method = ReflectionUtil.getMostSpecificMethod(methods, context.getClass(), annotation.getClass()); | ||||
|         method.setAccessible(true); | ||||
|         try { | ||||
|             return (boolean) method.invoke(check, annotation); | ||||
|             return (boolean) method.invoke(check, context, annotation); | ||||
|         } catch (IllegalAccessException | InvocationTargetException | SecurityException e) { | ||||
|             e.printStackTrace(); | ||||
|             return false; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user