Possible error in oracle java tutorial?

From this Oracle Java Tutorial:

The asFileAttribute method accepts a set of file permissions and creates a file attribute that can be passed to Path.createFile or Path.createDirectory.

Did they mean Files.createFile ?

+4
source share
1 answer

The documentation was correct but not updated.

In JDK7 build b129, the abstract Path.createFile method was present in the abstract Path class. In JDK 7 build b130, the abstract Path class becomes interface and the method has been moved to the "File Class" .

Here is a link to changeet in the OpenJDK 7 Mercury Repository .

 -public abstract class Path - implements FileRef, Comparable<Path>, Iterable<Path>, Watchable +public interface Path + extends Comparable<Path>, Iterable<Path>, Watchable 

and a link to a related bug in the JDK error system.

+4
source

Source: https://habr.com/ru/post/1495900/


All Articles