Class SonarPluginJavaParserChanger<T extends com.github.javaparser.ast.Node>

java.lang.Object
io.codemodder.javaparser.JavaParserChanger
io.codemodder.providers.sonar.SonarPluginJavaParserChanger<T>
All Implemented Interfaces:
io.codemodder.CodeChanger

public abstract class SonarPluginJavaParserChanger<T extends com.github.javaparser.ast.Node> extends io.codemodder.javaparser.JavaParserChanger
Provides base functionality for making JavaParser-based changes based on Sonar results.
  • Field Summary

    Fields inherited from class io.codemodder.javaparser.JavaParserChanger

    reporter
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    SonarPluginJavaParserChanger(RuleIssues ruleIssues, Class<? extends com.github.javaparser.ast.Node> nodeType)
     
    protected
    SonarPluginJavaParserChanger(RuleIssues ruleIssues, Class<? extends com.github.javaparser.ast.Node> nodeType, io.codemodder.RegionNodeMatcher regionNodeMatcher, io.codemodder.CodemodReporterStrategy codemodReporterStrategy)
     
    protected
    SonarPluginJavaParserChanger(RuleIssues ruleIssues, Class<? extends com.github.javaparser.ast.Node> nodeType, io.codemodder.RegionNodeMatcher regionNodeMatcher, io.codemodder.NodeCollector nodeCollector)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    onIssueFound(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, T node, Issue issue)
    Creates a visitor for the given context and locations.
    boolean
     
    List<io.codemodder.CodemodChange>
    visit(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu)
     

    Methods inherited from class io.codemodder.javaparser.JavaParserChanger

    dependenciesRequired, getDescription, getIndividualChangeDescription, getReferences, getSummary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SonarPluginJavaParserChanger

      protected SonarPluginJavaParserChanger(RuleIssues ruleIssues, Class<? extends com.github.javaparser.ast.Node> nodeType, io.codemodder.RegionNodeMatcher regionNodeMatcher, io.codemodder.NodeCollector nodeCollector)
    • SonarPluginJavaParserChanger

      protected SonarPluginJavaParserChanger(RuleIssues ruleIssues, Class<? extends com.github.javaparser.ast.Node> nodeType)
    • SonarPluginJavaParserChanger

      protected SonarPluginJavaParserChanger(RuleIssues ruleIssues, Class<? extends com.github.javaparser.ast.Node> nodeType, io.codemodder.RegionNodeMatcher regionNodeMatcher, io.codemodder.CodemodReporterStrategy codemodReporterStrategy)
  • Method Details

    • visit

      public List<io.codemodder.CodemodChange> visit(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu)
      Specified by:
      visit in class io.codemodder.javaparser.JavaParserChanger
    • shouldRun

      public boolean shouldRun()
    • onIssueFound

      public abstract boolean onIssueFound(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, T node, Issue issue)
      Creates a visitor for the given context and locations.
      Parameters:
      context - the context of this files transformation
      cu - the parsed model of the file being transformed
      node - the node to act on
      issue - the given Sonar issue to act on
      Returns:
      true, if the change was made, false otherwise