All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.picnic.errorprone.refaster.plugin.RefasterRuleCompiler Maven / Gradle / Ivy

Go to download

A Java compiler plugin that identifies and compiles Refaster rules, storing them as resource files on the classpath.

There is a newer version: 0.18.0
Show newest version
package tech.picnic.errorprone.refaster.plugin;

import com.google.auto.service.AutoService;
import com.sun.source.util.JavacTask;
import com.sun.source.util.Plugin;
import com.sun.tools.javac.api.BasicJavacTask;

/**
 * A variant of {@code com.google.errorprone.refaster.RefasterRuleCompiler} that outputs a {@code
 * fully/qualified/Class.refaster} file for each compiled {@code fully.qualified.Class} that
 * contains a Refaster rule.
 */
@AutoService(Plugin.class)
public final class RefasterRuleCompiler implements Plugin {
  /** Instantiates a new {@link RefasterRuleCompiler} instance. */
  public RefasterRuleCompiler() {}

  @Override
  public String getName() {
    return getClass().getSimpleName();
  }

  @Override
  public void init(JavacTask javacTask, String... args) {
    javacTask.addTaskListener(
        new RefasterRuleCompilerTaskListener(((BasicJavacTask) javacTask).getContext()));
  }

  @Override
  public boolean autoStart() {
    return true;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy