Class SonarPluginJavaParserChanger<T extends com.github.javaparser.ast.Node,S extends io.codemodder.sonar.model.SonarFinding>

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

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

    Fields
    Modifier and Type
    Field
    Description
    protected final RuleFinding<S>
     

    Fields inherited from class io.codemodder.javaparser.JavaParserChanger

    reporter
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    protected abstract io.codemodder.javaparser.ChangesResult
    onFindingFound(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, T node, S sonarFinding)
    Creates a visitor for the given context and locations.
    boolean
    supports(Path file)
     
     
    io.codemodder.CodemodFileScanningResult
    visit(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu)
     

    Methods inherited from class io.codemodder.javaparser.JavaParserChanger

    getDescription, getIncludesExcludesPattern, getIndividualChangeDescription, getReferences, getSummary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.codemodder.CodeChanger

    shouldRun

    Methods inherited from interface io.codemodder.FixOnlyCodeChanger

    detectorRule
  • Field Details

    • ruleFinding

      protected final RuleFinding<S extends io.codemodder.sonar.model.SonarFinding> ruleFinding
  • Constructor Details

    • SonarPluginJavaParserChanger

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

      protected SonarPluginJavaParserChanger(RuleFinding<S> ruleFinding, Class<? extends com.github.javaparser.ast.Node> nodeType)
    • SonarPluginJavaParserChanger

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

    • supports

      public boolean supports(Path file)
      Specified by:
      supports in interface io.codemodder.CodeChanger
      Overrides:
      supports in class io.codemodder.javaparser.JavaParserChanger
    • visit

      public io.codemodder.CodemodFileScanningResult visit(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu)
      Specified by:
      visit in class io.codemodder.javaparser.JavaParserChanger
    • onFindingFound

      protected abstract io.codemodder.javaparser.ChangesResult onFindingFound(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, T node, S sonarFinding)
      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
      sonarFinding - the given Sonar finding to act on
      Returns:
      ChangesResult, that contains result changes
    • vendorName

      public String vendorName()
      Specified by:
      vendorName in interface io.codemodder.FixOnlyCodeChanger