Java annotation processing: how do I know that a round is the last?
•
Java
When abstractprocessor is extended, it is possible to override init (...), but there is no "opposite" method, which will be called after all rounds are processed
This is a problem: when you have to append the information collected in each round to the same file, you cannot close the file because your last round is not known Therefore, the file is never closed and remains empty
Using Shutdown hook also doesn't work. Hooks are never called
Any ideas?
Solution
Processor. The process method includes a parameter of type roundenvironment Maybe roundenvironment The processingover method can help
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码