JDK 10 RFR of 8180767: A return value of zero from java.io.File#lastModified() is ambiguous
brian.burkhalter at oracle.com
Mon May 22 20:22:29 UTC 2017
java.io.File#lastModified() returns zero if the file in question does not exist. If however the file does exist and by some fantastic improbability has a last-modified time equal to the epoch, then a caller literally following the specification verbiage would interpret the returned value of zero as signifying that the file does not exist. It would probably be ideal to throw a FileNotFoundException when the file does not exist, but instead here we propose to return unity (1) instead of zero when the last-modified time of the file equals the epoch.
Note that this webrev is with respect to the one for  which is currently pending CCC approval, and is shown in the webrev in the JDK 9 tree. As it contains code changes, it would however be pushed to JDK 10 after the patch for  has been pushed and eventually migrated into the JDK 10 repository.
More information about the core-libs-dev