Why isn't java.io.File deprecated? -
since java 7 there java.nio.file package. why java.io.filestill not deprecated in java 8?
it not deprecated because not broken.
oracle (and sun before them) reserved deprecation apis deemed harmful use, , impossible fix without breaking binary (or semantic) compatibility.
the java.io.file api merely old-fashioned , clunky1, not harmful. there other standard apis depend on file, not mention many 3rd party apis , (probably) 100's of millions of lines of customer code. there no need signal world of code needs overhauled.
1 - @fge points out file methods don't behave correctly on platforms (particularly windows / ad) in versions of java. however, / implementation bugs, not fundamental api flaws. on unix / linux platforms, methods semantics more or less correct2.
2 - couple of "less correct" aspects file.length() returns 0 files in "/proc" tree, , strange things happen when access fat file system mounted on linux , try access if java.
Comments
Post a Comment