I am trying to generate a config file for my sourcecode via compiletime annotation processing in Java 8.
As far as I understand for each Annotation listed in the getSupportedAnnotationTypes class, the processor gets called once.
@Override public Set<String> getSupportedAnnotationTypes() { Set<String> set = new LinkedHashSet<>(); set.add(MCPlugin.class.getCanonicalName()); set.add(MCAPIVersion.class.getCanonicalName()); set.add(MCAuthor.class.getCanonicalName()); set.add(MCAPIVersion.class.getCanonicalName()); set.add(MCDepend.class.getCanonicalName()); set.add(MCLoad.class.getCanonicalName()); set.add(MCLoadBefore.class.getCanonicalName()); set.add(MCSoftDepend.class.getCanonicalName()); set.add(MCCommand.class.getCanonicalName()); return set; } Actually I don't want to process all those annotations with one annotation processer (Would this be the right way?) because it causes problems with the MCCommand annotation. So my plan was to create another annotation processer, which only processes the MCCommand annotations.
My problem is, that the output of both processers should go into the same output file. (Is that even possible?)
I have already tried to reopen the resource file like this (this is also how I open it in the first place):
FileObject file = filer.createResource(StandardLocation.SOURCE_OUTPUT, "", "config.yml"); which will only create an error or override the existing file.
TlDr: How can I make my annotation processer edit a file generated by another annotation processor?
Filer#getResourcework?