1. File.mkdir method spec is not self-contained.
---------------------------------
Creates the directory named by this abstract pathname
Returns:
true if and only if the directory was created; false otherwise
----------------------------------
So what should happed if mkdir() is invoked for instance representing "/foo/bar" if "/foo" does not exist ?
Looking at the method specification it looks like such directory should be created and true returned.
At least I see nothing in the File.mkdir specification which would prevent such interpretation.
Meanwhile the real behavior is different. No directory is created and false is returned.
Well, if I see both File.mkdir and File.mkdirs specs I may make guess like "File.mkdirs is explicitly specified to create intermediate subdirs. So it looks like mkdir must not create them. Otherwise what is reason to introduce two such methods ?".
I think File.mkdir specification should be clarified to be self-contained.
---------------------------------
Creates the directory named by this abstract pathname
Returns:
true if and only if the directory was created; false otherwise
----------------------------------
So what should happed if mkdir() is invoked for instance representing "/foo/bar" if "/foo" does not exist ?
Looking at the method specification it looks like such directory should be created and true returned.
At least I see nothing in the File.mkdir specification which would prevent such interpretation.
Meanwhile the real behavior is different. No directory is created and false is returned.
Well, if I see both File.mkdir and File.mkdirs specs I may make guess like "File.mkdirs is explicitly specified to create intermediate subdirs. So it looks like mkdir must not create them. Otherwise what is reason to introduce two such methods ?".
I think File.mkdir specification should be clarified to be self-contained.