When we pass a String to
Annotator annotator = new Annotator(filepath) it leaves the resource open even if we call
annotator.dispose(); annotator.close();. If you put a breakpoint after you dispose or close it, you’ll see that you cannot delete or rename the file because it is being used by JVM. And this leads to one question. Does annotator.close() call annotator.dispose() or should I use both? I would like to use it with try-with-resources to auto-close it for me.
For now, I fixed this issue by passing an InputStream to the Annotator, but I would like to alert you about this issue.