Package com.google.errorprone
Interface CodeTransformer
- All Known Implementing Classes:
CompositeCodeTransformer
,ErrorProneScannerTransformer
,RefasterRule
public interface CodeTransformer
Interface for a transformation over Java source.
- Author:
- lowasser@google.com (Louis Wasserman)
-
Method Summary
Modifier and Type Method Description com.google.common.collect.ImmutableClassToInstanceMap<Annotation>
annotations()
Returns a map of annotation data logically applied to this code transformer.void
apply(com.sun.source.util.TreePath path, com.sun.tools.javac.util.Context context, DescriptionListener listener)
Apply recursively from the leaf node in the givenTreePath
.
-
Method Details
-
apply
void apply(com.sun.source.util.TreePath path, com.sun.tools.javac.util.Context context, DescriptionListener listener)Apply recursively from the leaf node in the givenTreePath
. -
annotations
com.google.common.collect.ImmutableClassToInstanceMap<Annotation> annotations()Returns a map of annotation data logically applied to this code transformer.As an example, if a
CodeTransformer
expressed as a Refaster rule had an annotation applied to it:
You could retrieve the value of{@literal @}MyCustomAnnotation("value") public class AnnotatedRefasterRule { {@literal @}BeforeTemplate void before(String x) {...} {@literal @}AfterTemplate void after(String x) {...} }
@MyCustomAnnotation
from this map.
-