Code inspection strange behavior with string literals

I implemented a code inspection in my plugin, but I faced with some strange behavior when it's processing string literals.

When I'm modifying some identifiers in the code my inspection shows problem descriptor successfully but if I'm trying to modify string literal then the problem descriptor isn't be shown although             holder.registerProblem(descriptor) method is invoked without any exceptions (I see it in debugger).
Another strange fact: if I modify my string so that the inspection should be shown (but really it's not) and then remove and restore double quotes at the beginning of this string literal so inspection is shown successfully.
It looks like inspection caused by modifying of string literal treats all problem descriptors as "low priority" and doesn't show them.

Inspection code:

public class InconsistentFixtureInspection extends LocalInspectionTool {
//...

  public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
    final PsiElementVisitor visitor = new JavaElementVisitor() {
      @Override
      public void visitClass(PsiClass clazz) {
       //...some logic
          ProblemDescriptor descriptor = holder.getManager().createProblemDescriptor(clazz.getNameIdentifier(),
                    description, false, fixes.toArray(new LocalQuickFix[fixes.size()]), ProblemHighlightType.GENERIC_ERROR);
            holder.registerProblem(descriptor);
          }
        }
      }
    };
    return visitor;
  }
}


Test code:

public class DrawBestChartsFixture extends OneLineFixture {
    private int field;

    public boolean drawBestChartsForYou(int arg) {
        return true;
    }

    public static String[] getTestTableTemplates() {
        return new String[] {"|draw best charts|123|for you|"};
    }
}


The inspection should show name mismatch between class name, method name and template in the last method. If I change class name to DrwBestChartsFixture then inspections is shown, but if I change template to "|drw best charts|123|for you|" it isn't be shown.

Please sign in to leave a comment.