Fix the parameters order problems when invoke in MCP Inspector v0.12.0#2
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
|
@steveGuRen |
It's a good news. |
codeboyzhou
left a comment
There was a problem hiding this comment.
Finished my review. By the way, could you please amend the commit message to avoid the typo? I have edited the title of this PR but can not amend your commit, thanks.
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
| import java.util.*; |
There was a problem hiding this comment.
Wildcard imports are not recommended because they might introduce potential issues such as naming conflicts or reduced code clarity.
| Method[] methods = clazz.getMethods(); | ||
| return Set.of(methods).stream().filter(m -> m.isAnnotationPresent(annotation)).collect(toSet()); | ||
| List<Method> methodList = Arrays.asList(methods); | ||
| return methodList.stream().filter(p -> p.isAnnotationPresent(annotation)).toList(); |
There was a problem hiding this comment.
How about changing them to this? It looks more concise.
return Stream.of(methods).filter(m -> m.isAnnotationPresent(annotation)).toList();
| Parameter[] parameters = method.getParameters(); | ||
| return Set.of(parameters).stream().filter(p -> p.isAnnotationPresent(annotation)).collect(toSet()); | ||
| List<Parameter> parameterList = Arrays.asList(parameters); | ||
| return parameterList.stream().filter(p -> p.isAnnotationPresent(annotation)).toList(); |
There was a problem hiding this comment.
Same as above, more concise.
return Stream.of(parameters).filter(p -> p.isAnnotationPresent(annotation)).toList();
05038e3 to
3acfc9d
Compare
|
@codeboyzhou all problems fixed.You can review again. |
|
@steveGuRen LGTM, merged, thanks for your contribution, this fix will be included in v0.4.0 release. |
There are problems when invoke in MCP Inspector page, the parameters order show in page is error. And it cause the annotation not work correct when call method.invoke()
