How to suppress built-in inspection (Java: SuspiciousMethodCalls) in only a very specific case with a plugin

已回答

I have a library that has some collection classes. These collection classes all have the parametric type Handle and extend Set<Handle> and Map<Handle,T> respectively. Some of the methods these classes override (get, contains, containsKey etc.) allow for String parameters in addition to the Handle type, which is made possible because the methods in the base Java interfaces take in objects of any type. This in turn causes the SuspiciousMethodCalls inspection to be triggered when these methods are used with Strings. While I could write a separate method that takes in a String for some of these methods, this is not possible for the methods that take in a Collection<?> and those still trigger the inspection.

I want to write a plugin that suppresses this warning, but only in the very specific case of a String given to these methods in my collection classes. All the information I can seem to find online about inspections and plugins is about adding new inspections, which is not really that helpful to me. Any pointers on where to look would be greatly appreciated.

0

请先登录再写评论。