replace & forbid "new FileInputStream" and "new FileOutputStream" with Files.newInputStream & Files.newOutputStream [LUCENE-7789]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
I haven't looked into the details of this much, but saw these links today and thought it would be worth opening a jira for discussion...
- https://dzone.com/articles/fileinputstream-fileoutputstream-considered-harmful
- https://issues.jenkins-ci.org/browse/JENKINS-42934
- https://bugs.openjdk.java.net/browse/JDK-8080225
The crux of the issue being that the "FileInputStream" and "FileOutputStream" classes have finalizer methods with GC overhead that can be avoided using Files.newInputStream and Files.newOutputStream in their place.
This seems like it would make these methods good candidates for forbidding in lucene/solr (if possible).
---
Migrated from [LUCENE-7789](https://issues.apache.org/jira/browse/LUCENE-7789) by Chris M. Hostetter (@hossman), updated Apr 21 2017
Contributor guide
Research direction
Review Lucene and Solr usages of new FileInputStream and new FileOutputStream, then compare them with Files.newInputStream and Files.newOutputStream. Determine how these constructors could be forbidden across the project; done means the usages are replaced and the forbidden forms are enforced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, search
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100