Confused about User Defined Inspections

Answered

I tried writing a custom inspection. I need it to find fields that do not have my @Instructions annotation and are in a class that extends StructuredDataPacket. I'm not super familiar with regex, but I'm fairly certain this would do want I'm describing, but alas, it does not. If I could get any assistance with this, it'd make my day :)

0
1 comment

Hello,

Something like this should work:

class $A$ extends StructuredDataPacket {
	@$Anno$
	$Type$ $name$;
}

Make sure that:

  • Target is set to the field name
  • Count for the annotation is set to 0
<searchConfiguration name="Fields without @Instructions in StructuredDataPacket subclasses" text="class $A$ extends StructuredDataPacket {&#10;&#9;@$Anno$&#10;&#9;$Type$ $name$;&#10;}" recursive="true" type="JAVA" pattern_context="default">
  <constraint name="__context__" within="" contains="" />
  <constraint name="Type" within="" contains="" />
  <constraint name="name" target="true" within="" contains="" />
  <constraint name="A" within="" contains="" />
  <constraint name="Anno" regexp="Instructions" minCount="0" maxCount="0" within="" contains="" />
</searchConfiguration>

 

0

Please sign in to leave a comment.