Rollerball
Rollerball

Reputation: 13108

Possible error in the oracle java tutorial?

From this Oracle Java tutorial:

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

Did they mean Files.createFile?

Upvotes: 4

Views: 163

Answers (1)

Ortomala Lokni
Ortomala Lokni

Reputation: 62555

The documentation was correct but is no more up to date.

In the JDK7 build b129, the abstract method Path.createFile was present in the abstract class Path. In the JDK 7 build b130 the abstract Path class becomes an interface and the method was moved in the Files class.

Here is a link to the changeset in the OpenJDK 7 mercurial 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 the related bug in the JDK bug system.

Upvotes: 4

Related Questions