Search code examples
intellij-ideacode-hintinginspections

Writing Intelli-J inspections?


How would I go about writing my own Intelli-J inspection? I'm looking for some general guides or resources.

I want to bring up an inspection hint every time a collection class is instantiated manually, rather than through the Guava (List.newArrayList()/Maps.newHashMap()) etc. as per a team-wide standard.

I'd appreciate any direction.


Solution

  • For such an inspection you don't need to write a plug-in, instead use the Structural Search and Replace (SSR) feature which allows to create custom inspections with quick fixes.

    See also the Creating your own inspections section and documentation for this feature.

    Note that it's available in the Ultimate version only.