Problem with RS Inspection - Cannot resolve parameter
已回答
There seems to be a deficiency (I'd argument it's a "bug") in one of the REST (RS) inspections.
It seems unable to resolve an @PathParam for a method parameter, if the path param comes from the @Path annotation on the class definition. See this screen snhot:
It I insert a @Path annotation on that method that contains {id}, the inspection goes away.

We're evaluating IntelliJ for our company and this occurs in a lot of our code. Obviously we can turn the inspection off, but I rather like the check.
Is this a bug? can it be fixed?
请先登录再写评论。
Hello,
Unfortunately your screen shots are not displayed due to some error.
Can you please share the code samples where the issue is reproduced.
Please also check the following issues, they may probably be the duplicates to your's:
https://youtrack.jetbrains.com/issue/IDEA-154093
https://youtrack.jetbrains.com/issue/IDEA-164683
Thank you
OK, I will include a code sample here, but I also have whittled down part of what's required to reproduce it and my guess is that this will tell you exactly where the issue lies.
Here's the code. I've had to sanitize it a bit, but you should easily be able to make this compile
What you will find is an RS inspection error on the "id" string in the @PathParam annotation. The text of the inspection is: "Cannot resolve param less... (Ctrl+F1) Inspection info: RS inspections.
And I think a key factor here the fact that the @Path annotation on the class declaration contains an "expression" rather than a constant. Yes, I know I could turn THIS example into a constant, but in our actual code the "Foo" string constant is actually a reference to a string constant in an important class as in
@Path(BASE + "member/{id}/visitReports")
Note that this is legal Java. I do understand that challenge here, and that the inspection here would require classpath resolution. But the bottom line, IMHO, is still that the inspection is wrong. You might want to just "punt" in this case, although I'd like to see it work.
And FWIW, this same issue also prevents the JAX-RS view (in the Enterprise view) from working. We'd LOVE LOVE LOVE to see that work because we really want ONE place to specify the prefix to our REST URIs although perhaps there's a better way to do this with JAX-RS. (Like a servlet prefix for the JAX-RS servlet).
Thank you for providing the detailed sample!
Your issue is the duplicate of https://youtrack.jetbrains.com/issue/IDEA-164683, please follow/comment it for more details.
I have linked your report to the issue, so the bug is updated.