Daniel Pejcinovski
02/18/2025, 3:00 PMcontainingFile
for every KSClassDeclaration
I find that matches my criterion, and setting the aggregating
flag to true.
I also wrap each KSClassDeclaration
in a KSTopDownVisitor
to write my data.
As far as I understand KSP, this should be everything necessary to not reprocess the classes in future runs, but I can see that it runs multiple times and as soon as it does it causes a fileAlreadExistsException
.
Any ideas?David Rawson
02/18/2025, 6:05 PMFileAlreadyExistsException
is attempting to write the file even when there are no relevant symbols found.
The pseudocode for a simple processor doing what you described should be something like:
1. Get all classes implementing a specific interface
2. Process these classes somehow into a single collection of data for output
3. Only in the case where is data from step 2, write the file once based on the collection
There are solutions for more advanced use cases if you search the chat for FileAlreadyExistsException
including writing in finish()
and generating dummy outputs.jamireh
02/18/2025, 7:40 PMDaniel Pejcinovski
03/04/2025, 10:24 AM