Class OutputResourceLeakCodemod

java.lang.Object
io.codemodder.javaparser.JavaParserChanger
io.codemodder.SarifPluginJavaParserChanger<com.github.javaparser.ast.expr.Expression>
io.codemodder.codemods.OutputResourceLeakCodemod
All Implemented Interfaces:
io.codemodder.CodeChanger

@Codemod(id="codeql:java/output-resource-leak", reviewGuidance=MERGE_WITHOUT_REVIEW, executionPriority=HIGH) public final class OutputResourceLeakCodemod extends io.codemodder.SarifPluginJavaParserChanger<com.github.javaparser.ast.expr.Expression>
A codemod for automatically fixing output:w resource leaks detected by CodeQL's rule "java/output-resource-leak" whenever possible.
  • Field Summary

    Fields inherited from class io.codemodder.SarifPluginJavaParserChanger

    sarif

    Fields inherited from class io.codemodder.javaparser.JavaParserChanger

    reporter
  • Constructor Summary

    Constructors
    Constructor
    Description
    OutputResourceLeakCodemod(io.codemodder.RuleSarif sarif)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    onResultFound(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, com.github.javaparser.ast.expr.Expression expr, com.contrastsecurity.sarif.Result result)
     

    Methods inherited from class io.codemodder.SarifPluginJavaParserChanger

    shouldRun, visit

    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

    • OutputResourceLeakCodemod

      @Inject public OutputResourceLeakCodemod(@ProvidedCodeQLScan(ruleId="java/output-resource-leak") io.codemodder.RuleSarif sarif)
  • Method Details

    • onResultFound

      public boolean onResultFound(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, com.github.javaparser.ast.expr.Expression expr, com.contrastsecurity.sarif.Result result)
      Specified by:
      onResultFound in class io.codemodder.SarifPluginJavaParserChanger<com.github.javaparser.ast.expr.Expression>