Package com.google.errorprone.apply
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)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.errorprone.DescriptionListener
DescriptionListener.Factory
-
Method Summary
Modifier and Type Method Description void
applyDifferences(SourceFile sourceFile)
Applies this difference to the suppliedsourceFile
.static DescriptionBasedDiff
create(com.sun.tools.javac.tree.JCTree.JCCompilationUnit compilationUnit, ImportOrganizer importOrganizer)
static DescriptionBasedDiff
createIgnoringOverlaps(com.sun.tools.javac.tree.JCTree.JCCompilationUnit compilationUnit, ImportOrganizer importOrganizer)
String
getRelevantFileName()
Gets the name of the file this difference applies tovoid
handleFix(Fix fix)
boolean
isEmpty()
void
onDescribed(Description description)
Reports a suggested modification to the code.
-
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
Description copied from interface:Diff
Gets the name of the file this difference applies to- Specified by:
getRelevantFileName
in interfaceDiff
-
isEmpty
public boolean isEmpty() -
onDescribed
Description copied from interface:DescriptionListener
Reports a suggested modification to the code.- Specified by:
onDescribed
in interfaceDescriptionListener
-
handleFix
-
applyDifferences
Description copied from interface:Diff
Applies this difference to the suppliedsourceFile
.- Specified by:
applyDifferences
in interfaceDiff
- Throws:
DiffNotApplicableException
- if the diff could not be applied to the source file
-