Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.IOException;
import javax.annotation.processing.Filer;
import javax.annotation.processing.Messager;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.tools.FileObject;
import javax.tools.JavaFileManager;
Expand All @@ -38,8 +39,25 @@ public final class FormattingFiler implements Filer {
private final Messager messager;

/**
* Create a new {@link FormattingFiler}.
*
* @param processingEnv the processing environment
*/
public static Filer create(ProcessingEnvironment processingEnv) {
Filer delegate = processingEnv.getFiler();
if (processingEnv.getOptions().containsKey("experimental_turbine_hjar")) {
return delegate;
}
return new FormattingFiler(delegate, processingEnv.getMessager());
}

/**
* Create a new {@link FormattingFiler}.
*
* @param delegate filer to decorate
* @deprecated prefer {@link #create(ProcessingEnvironment)}
*/
@Deprecated
public FormattingFiler(Filer delegate) {
this(delegate, null);
}
Expand All @@ -50,7 +68,9 @@ public FormattingFiler(Filer delegate) {
*
* @param delegate filer to decorate
* @param messager to log warnings to
* @deprecated prefer {@link #create(ProcessingEnvironment)}
*/
@Deprecated
public FormattingFiler(Filer delegate, @Nullable Messager messager) {
this.delegate = checkNotNull(delegate);
this.messager = messager;
Expand Down
Loading