cached jar files in STGroup.loadGroupFile (Linux only)
- Dominant language
- Java
- Stars
- 1k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
I am writing a annotation processing tool with the help of stringtemplate4 which generates java source code from stg template files. Whenever I changed the stg template file (which ends up residing in a jar) and tried to re-generated the source code from that file, I ended up with an old version of that file (unless I waited long enough - then suddenly it worked).
Digging into the stringtemplate source code, I found this (in org.stringtemplate.v4.STGroup.loadGroupFile(String, String)):
```
URL f = new URL(fileName);
ANTLRInputStream fs = new ANTLRInputStream(f.openStream(), encoding);
```
From [stackoverflow](http://stackoverflow.com/questions/11569511/java-net-url-cache-when-reading-from-files) I learned that on linux, the jar file being accessed is cached.
Could you please check if an approach like this
```
URL f = new URL(fileName);
URLConnection openConnection = f.openConnection();
openConnection.setUseCaches(false);
... = new ANTLRInputStream(openConnection.getInputStream(), encoding);
```
could be used (maybe in other places as well) to overcome this behaviour?
Thanks a lot for the great library in either case ;)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.