Preferences prefs = Preferences.userNodeForPackage(this);One typically wants to obtain a preferences node in a static context, as part of the initialization of the class that requires access to preferences. With the API in the Public Review draft, this left the programmer with little choice but to use the "root factory" and specify the node name explicitly using a string:
Preferences prefs = Preferences.userRootForPackage().node( "/com/acme/widget");If the string is wrong, compilation proceeds normally and you use the wrong preferences at runtime.
A second problem is that subclasses of base types using preferences would not have easy access to the parent's preferences if the parent and child were in different packages. If the child used the suggested usage (above) it would get a node corresponding to its package rather than its parent's.
To solve both of these problems, we are changing the argument type of the two static factories from Object to Class. The suggested usage becomes:
Preferences prefs = Preferences.userNodeForPackage(Widget.class);
The usage notes have been amended to reflect this clarification.