AutoService: should override the service config file instead of appending new contents
- Dominant language
- Java
- Stars
- 10.6k
- Forks
- 1.2k
- Avg merge
- 6h 32m
- Merged PRs (30d)
- 13
Description
When generating a service config file (e.g `META-INF/services/serviceloader.Dictionary`), the processor reads the old content from the existing config file, adding new services and then writes to the config file.
The problem I observed is that if I delete a service class (e.g ExtendedDictionary) after the first build and then build and run at the second time, I wll get `java.util.ServiceConfigurationError: serviceloader.Dictionary: Provider serviceloader.ExtendedDictionary not found` error since the old entry `serviceloader.ExtendedDictionary` is still in the newly generated file.
I can use `mvn clean package` to avoid this problem. But if I use some IDE like Intellij, it's not a good practice to have to delete the file manually every time. I don't see why we should append the file instead of overriding.
Contributor guide
Assessment
This issue has not been assessed yet.