Feasability? A plugin to configure intentions through custom annotations

I recently wrote this question on Stack Overflow about configuring the "malformed format string" intention: https://stackoverflow.com/q/47007947/924597

Somebody answered the question for me - but configuring the intention via strings like that would be a tedious maintenance nightmare.

One of the comments talks about writing a plugin.

The more I think about it - the more I like it.

Is it feasible for a plugin to hook into intentions like this?

Example logic:

  • look for annotation on method where the annotation itself has some comment like "malformed format string"
  • have idea use the "malformed format string" logic wherever that method is invoked

I wouldn't want the plugin to modify the intention settings (that is, I don't want to dump a bunch of classes and methods into the "malformed format string" settings storage).

Are there any plugins anyone knows of that do a similar thing?  Something I can use as a starting point?





1 comment

I guess you want to hook inside inspection, not intention. And I don't see how you can do it without providing an extension point to the inspection itself, say introducing a special 'format' annotation (given that you don't want to provide exact list of accepted methods by default via the plugin). What are those 'myMethod's you talk about? Are they project specific?


BTW I am not sure if detecting annotations by comment is a good idea, you can provide unexpected results to users. Don't understand the second example, sorry.


Please sign in to leave a comment.