Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 636
Stefan Kendall Avatar asked Oct 15 '22 02:10

Stefan Kendall


2 Answers

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.

like image 158
CrazyCoder Avatar answered Oct 18 '22 12:10

CrazyCoder


I'll have to disappoint you but there are no written guidelines nor resources nor documentation for almost everything related to plug-ins and IntelliJ :(. (this is the main reason many IntelliJ fans haven't worked on plug-ins for their favorite tool).

That company makes fantastic products, but when it comes to documentation, books, and guidelines for developers (not users) - well, they're practically non-existing :(.

Your only bet is to take a look the source of actual IntelliJ plug-ins (some of them are here: http://git.jetbrains.org/) and ask very concrete questions on the IntelliJ plug-in list since the development team will gladly answer you usually in a matter of minutes.

like image 37
A. Ionescu Avatar answered Oct 18 '22 13:10

A. Ionescu