Class DescriptionBasedDiff

java.lang.Object
com.google.errorprone.apply.DescriptionBasedDiff
All Implemented Interfaces:
Diff, DescriptionListener

public final class DescriptionBasedDiff extends Object implements DescriptionListener, Diff
Implementation of a Diff that performs the modifications that are passed to its onDescribed(com.google.errorprone.matchers.Description) method, with no formatting.

If imports are changed, they are resorted as per Google Java style.

Author:
lowasser@google.com (Louis Wasserman)
  • Method Details

    • create

      public static DescriptionBasedDiff create(com.sun.tools.javac.tree.JCTree.JCCompilationUnit compilationUnit, ImportOrganizer importOrganizer)
    • createIgnoringOverlaps

      public static DescriptionBasedDiff createIgnoringOverlaps(com.sun.tools.javac.tree.JCTree.JCCompilationUnit compilationUnit, ImportOrganizer importOrganizer)
    • getRelevantFileName

      public String getRelevantFileName()
      Description copied from interface: Diff
      Gets the name of the file this difference applies to
      Specified by:
      getRelevantFileName in interface Diff
    • isEmpty

      public boolean isEmpty()
    • onDescribed

      public void onDescribed(Description description)
      Description copied from interface: DescriptionListener
      Reports a suggested modification to the code.
      Specified by:
      onDescribed in interface DescriptionListener
    • handleFix

      public void handleFix(Fix fix)
    • applyDifferences

      public void applyDifferences(SourceFile sourceFile)
      Description copied from interface: Diff
      Applies this difference to the supplied sourceFile.
      Specified by:
      applyDifferences in interface Diff