0

I wrote an annotation processor and i'd like to write some information into a text file. In my class I'm extending the AbstractProcessor and overriding the

public void init(ProcessingEnvironment processingEnv)

and

public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)

methods.

In the init() method I'm creating a new PrintWriter (eg. this way: writer = new PrintWriter("output.csv", "UTF-8");)

with which I print some text into a file in the process() method.

The problem is, that (as I use my processor on multiple sources in different packages) the file (output.csv) always gets recreated when a new source is being processed (because a new Processor object is created each time). This way only the lastly processed source's information gets into the text file, although I want to acquire information from all of the annotated methods (from different sources) into one text file.

Barnie
  • 5
  • 5

1 Answers1

0

This might help you:

new PrintWriter(new FileOutputStream("output.csv", true));