--- old/src/java.base/linux/classes/sun/nio/fs/LinuxWatchService.java 2016-05-30 16:31:29.000000000 +0100 +++ new/src/java.base/linux/classes/sun/nio/fs/LinuxWatchService.java 2016-05-30 16:31:29.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -232,9 +232,11 @@ for (WatchEvent.Modifier modifier: modifiers) { if (modifier == null) return new NullPointerException(); - if (modifier instanceof com.sun.nio.file.SensitivityWatchEventModifier) - continue; // ignore - return new UnsupportedOperationException("Modifier not supported"); + if (!ExtendedOptions.SENSITIVITY_HIGH.matches(modifier) && + !ExtendedOptions.SENSITIVITY_MEDIUM.matches(modifier) && + !ExtendedOptions.SENSITIVITY_LOW.matches(modifier)) { + return new UnsupportedOperationException("Modifier not supported"); + } } } --- old/src/java.base/share/classes/module-info.java 2016-05-30 16:31:30.000000000 +0100 +++ new/src/java.base/share/classes/module-info.java 2016-05-30 16:31:30.000000000 +0100 @@ -216,6 +216,8 @@ exports sun.nio.cs to java.desktop, jdk.charsets; + exports sun.nio.fs to + jdk.unsupported; exports sun.reflect.annotation to jdk.compiler; exports sun.reflect.generics.reflectiveObjects to --- old/src/java.base/share/classes/sun/nio/fs/PollingWatchService.java 2016-05-30 16:31:30.000000000 +0100 +++ new/src/java.base/share/classes/sun/nio/fs/PollingWatchService.java 2016-05-30 16:31:30.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,16 +25,32 @@ package sun.nio.fs; -import java.nio.file.*; -import java.nio.file.attribute.*; +import java.nio.file.ClosedWatchServiceException; +import java.nio.file.DirectoryIteratorException; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.NotDirectoryException; +import java.nio.file.Path; +import java.nio.file.StandardWatchEventKinds; +import java.nio.file.WatchEvent; +import java.nio.file.WatchKey; +import java.nio.file.attribute.BasicFileAttributes; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; import java.io.IOException; -import java.util.*; -import java.util.concurrent.*; -import com.sun.nio.file.SensitivityWatchEventModifier; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; /** * Simple WatchService implementation that uses periodic tasks to poll @@ -46,8 +62,7 @@ extends AbstractWatchService { // map of registrations - private final Map map = - new HashMap(); + private final Map map = new HashMap<>(); // used to execute the periodic tasks that poll for changes private final ScheduledExecutorService scheduledExecutor; @@ -58,7 +73,7 @@ .newSingleThreadScheduledExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { - Thread t = new Thread(null, r, "FileSystemWatchService", 0, false); + Thread t = new Thread(null, r, "FileSystemWatcher", 0, false); t.setDaemon(true); return t; }}); @@ -74,8 +89,7 @@ throws IOException { // check events - CCE will be thrown if there are invalid elements - final Set> eventSet = - new HashSet>(events.length); + final Set> eventSet = new HashSet<>(events.length); for (WatchEvent.Kind event: events) { // standard events if (event == StandardWatchEventKinds.ENTRY_CREATE || @@ -99,17 +113,22 @@ if (eventSet.isEmpty()) throw new IllegalArgumentException("No events to register"); - // A modifier may be used to specify the sensitivity level - SensitivityWatchEventModifier sensivity = SensitivityWatchEventModifier.MEDIUM; + // Extended modifiers may be used to specify the sensitivity level + int sensitivity = 10; if (modifiers.length > 0) { for (WatchEvent.Modifier modifier: modifiers) { if (modifier == null) throw new NullPointerException(); - if (modifier instanceof SensitivityWatchEventModifier) { - sensivity = (SensitivityWatchEventModifier)modifier; - continue; + + if (ExtendedOptions.SENSITIVITY_HIGH.matches(modifier)) { + sensitivity = ExtendedOptions.SENSITIVITY_HIGH.parameter(); + } else if (ExtendedOptions.SENSITIVITY_MEDIUM.matches(modifier)) { + sensitivity = ExtendedOptions.SENSITIVITY_MEDIUM.parameter(); + } else if (ExtendedOptions.SENSITIVITY_LOW.matches(modifier)) { + sensitivity = ExtendedOptions.SENSITIVITY_LOW.parameter(); + } else { + throw new UnsupportedOperationException("Modifier not supported"); } - throw new UnsupportedOperationException("Modifier not supported"); } } @@ -120,12 +139,12 @@ // registration is done in privileged block as it requires the // attributes of the entries in the directory. try { - final SensitivityWatchEventModifier s = sensivity; + int value = sensitivity; return AccessController.doPrivileged( new PrivilegedExceptionAction() { @Override public PollingWatchKey run() throws IOException { - return doPrivilegedRegister(path, eventSet, s); + return doPrivilegedRegister(path, eventSet, value); } }); } catch (PrivilegedActionException pae) { @@ -140,7 +159,7 @@ // existing key if already registered private PollingWatchKey doPrivilegedRegister(Path path, Set> events, - SensitivityWatchEventModifier sensivity) + int sensitivityInSeconds) throws IOException { // check file is a directory and get its file key if possible @@ -169,7 +188,7 @@ watchKey.disable(); } } - watchKey.enable(events, sensivity.sensitivityValueInSeconds()); + watchKey.enable(events, sensitivityInSeconds); return watchKey; } @@ -178,7 +197,7 @@ @Override void implClose() throws IOException { synchronized (map) { - for (Map.Entry entry: map.entrySet()) { + for (Map.Entry entry: map.entrySet()) { PollingWatchKey watchKey = entry.getValue(); watchKey.disable(); watchKey.invalidate(); --- old/src/java.base/solaris/classes/sun/nio/fs/SolarisWatchService.java 2016-05-30 16:31:31.000000000 +0100 +++ new/src/java.base/solaris/classes/sun/nio/fs/SolarisWatchService.java 2016-05-30 16:31:31.000000000 +0100 @@ -272,9 +272,11 @@ for (WatchEvent.Modifier modifier: modifiers) { if (modifier == null) return new NullPointerException(); - if (modifier instanceof com.sun.nio.file.SensitivityWatchEventModifier) - continue; // ignore - return new UnsupportedOperationException("Modifier not supported"); + if (!ExtendedOptions.SENSITIVITY_HIGH.matches(modifier) && + !ExtendedOptions.SENSITIVITY_MEDIUM.matches(modifier) && + !ExtendedOptions.SENSITIVITY_LOW.matches(modifier)) { + return new UnsupportedOperationException("Modifier not supported"); + } } } --- old/src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java 2016-05-30 16:31:32.000000000 +0100 +++ new/src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java 2016-05-30 16:31:32.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,18 @@ package sun.nio.fs; -import java.nio.file.*; import java.io.IOException; +import java.nio.file.AtomicMoveNotSupportedException; +import java.nio.file.CopyOption; +import java.nio.file.DirectoryNotEmptyException; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.LinkOption; +import java.nio.file.LinkPermission; +import java.nio.file.StandardCopyOption; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import com.sun.nio.file.ExtendedCopyOption; import static sun.nio.fs.UnixNativeDispatcher.*; import static sun.nio.fs.UnixConstants.*; @@ -82,7 +87,7 @@ flags.failIfUnableToCopyBasic = true; continue; } - if (option == ExtendedCopyOption.INTERRUPTIBLE) { + if (ExtendedOptions.INTERRUPTIBLE.matches(option)) { flags.interruptible = true; continue; } --- old/src/java.base/windows/classes/sun/nio/fs/WindowsChannelFactory.java 2016-05-30 16:31:32.000000000 +0100 +++ new/src/java.base/windows/classes/sun/nio/fs/WindowsChannelFactory.java 2016-05-30 16:31:32.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,8 +34,6 @@ import java.nio.file.StandardOpenOption; import java.util.Set; -import com.sun.nio.file.ExtendedOpenOption; - import jdk.internal.misc.JavaIOFileDescriptorAccess; import jdk.internal.misc.SharedSecrets; import sun.nio.ch.FileChannelImpl; @@ -103,15 +101,6 @@ } continue; } - if (option instanceof ExtendedOpenOption) { - switch ((ExtendedOpenOption)option) { - case NOSHARE_READ : flags.shareRead = false; break; - case NOSHARE_WRITE : flags.shareWrite = false; break; - case NOSHARE_DELETE : flags.shareDelete = false; break; - default: throw new UnsupportedOperationException(); - } - continue; - } if (option == LinkOption.NOFOLLOW_LINKS) { flags.noFollowLinks = true; continue; @@ -120,6 +109,18 @@ flags.openReparsePoint = true; continue; } + if (ExtendedOptions.NOSHARE_READ.matches(option)) { + flags.shareRead = false; + continue; + } + if (ExtendedOptions.NOSHARE_WRITE.matches(option)) { + flags.shareWrite = false; + continue; + } + if (ExtendedOptions.NOSHARE_DELETE.matches(option)) { + flags.shareDelete = false; + continue; + } if (option == null) throw new NullPointerException(); throw new UnsupportedOperationException(); --- old/src/java.base/windows/classes/sun/nio/fs/WindowsFileCopy.java 2016-05-30 16:31:33.000000000 +0100 +++ new/src/java.base/windows/classes/sun/nio/fs/WindowsFileCopy.java 2016-05-30 16:31:33.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ import java.nio.file.*; import java.io.IOException; import java.util.concurrent.ExecutionException; -import com.sun.nio.file.ExtendedCopyOption; import static sun.nio.fs.WindowsNativeDispatcher.*; import static sun.nio.fs.WindowsConstants.*; @@ -67,7 +66,7 @@ copyAttributes = true; continue; } - if (option == ExtendedCopyOption.INTERRUPTIBLE) { + if (ExtendedOptions.INTERRUPTIBLE.matches(option)) { interruptible = true; continue; } --- old/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java 2016-05-30 16:31:34.000000000 +0100 +++ new/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java 2016-05-30 16:31:34.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,6 @@ import java.util.*; import java.lang.ref.WeakReference; -import com.sun.nio.file.ExtendedWatchEventModifier; - import static sun.nio.fs.WindowsNativeDispatcher.*; import static sun.nio.fs.WindowsConstants.*; @@ -864,7 +862,7 @@ modifiers = Arrays.copyOf(modifiers, ml); int i=0; while (i < ml) { - if (modifiers[i++] == ExtendedWatchEventModifier.FILE_TREE) { + if (ExtendedOptions.FILE_TREE.matches(modifiers[i++])) { watchSubtree = true; break; } --- old/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java 2016-05-30 16:31:34.000000000 +0100 +++ new/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java 2016-05-30 16:31:34.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,6 @@ import java.util.Map; import java.util.Set; -import com.sun.nio.file.ExtendedWatchEventModifier; import jdk.internal.misc.Unsafe; import static sun.nio.fs.WindowsNativeDispatcher.*; @@ -342,14 +341,16 @@ // FILE_TREE modifier allowed for (WatchEvent.Modifier modifier: modifiers) { - if (modifier == ExtendedWatchEventModifier.FILE_TREE) { + if (ExtendedOptions.FILE_TREE.matches(modifier)) { watchSubtree = true; } else { if (modifier == null) return new NullPointerException(); - if (modifier instanceof com.sun.nio.file.SensitivityWatchEventModifier) - continue; // ignore - return new UnsupportedOperationException("Modifier not supported"); + if (!ExtendedOptions.SENSITIVITY_HIGH.matches(modifier) && + !ExtendedOptions.SENSITIVITY_MEDIUM.matches(modifier) && + !ExtendedOptions.SENSITIVITY_LOW.matches(modifier)) { + return new UnsupportedOperationException("Modifier not supported"); + } } } --- old/src/jdk.unsupported/share/classes/module-info.java 2016-05-30 16:31:35.000000000 +0100 +++ new/src/jdk.unsupported/share/classes/module-info.java 2016-05-30 16:31:35.000000000 +0100 @@ -26,5 +26,6 @@ module jdk.unsupported { exports sun.misc; exports sun.reflect; + exports com.sun.nio.file; } --- old/test/java/nio/file/Files/InterruptCopy.java 2016-05-30 16:31:36.000000000 +0100 +++ new/test/java/nio/file/Files/InterruptCopy.java 2016-05-30 16:31:36.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* @test * @bug 4313887 6993267 * @summary Unit test for Sun-specific ExtendedCopyOption.INTERRUPTIBLE option - * @modules java.base/com.sun.nio.file + * @modules jdk.unsupported * @library .. */ --- old/test/java/nio/file/Files/SBC.java 2016-05-30 16:31:36.000000000 +0100 +++ new/test/java/nio/file/Files/SBC.java 2016-05-30 16:31:36.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @bug 4313887 * @summary Unit test for java.nio.file.Files.newByteChannel * @library .. - * @modules java.base/com.sun.nio.file + * @modules jdk.unsupported */ import java.nio.ByteBuffer; --- old/test/java/nio/file/WatchService/FileTreeModifier.java 2016-05-30 16:31:37.000000000 +0100 +++ new/test/java/nio/file/WatchService/FileTreeModifier.java 2016-05-30 16:31:37.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,9 @@ /* @test * @bug 4313887 6838333 - * @summary Sanity test for Sun-specific FILE_TREE watch event modifier + * @summary Sanity test for JDK-specific FILE_TREE watch event modifier * @library .. - * @modules java.base/com.sun.nio.file + * @modules jdk.unsupported */ import java.nio.file.*; --- old/test/java/nio/file/WatchService/SensitivityModifier.java 2016-05-30 16:31:38.000000000 +0100 +++ new/test/java/nio/file/WatchService/SensitivityModifier.java 2016-05-30 16:31:38.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,8 +23,8 @@ /* @test * @bug 4313887 - * @summary Sanity test for Sun-specific sensitivity level watch event modifier - * @modules java.base/com.sun.nio.file + * @summary Sanity test for JDK-specific sensitivity level watch event modifier + * @modules jdk.unsupported * @library .. * @run main/timeout=240 SensitivityModifier * @key randomness --- old/test/java/nio/file/WatchService/WithSecurityManager.java 2016-05-30 16:31:38.000000000 +0100 +++ new/test/java/nio/file/WatchService/WithSecurityManager.java 2016-05-30 16:31:38.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* @test * @bug 4313887 * @summary Unit test for Watchable#register's permission checks - * @modules java.base/com.sun.nio.file + * @modules jdk.unsupported * @build WithSecurityManager * @run main/othervm WithSecurityManager denyAll.policy - fail * @run main/othervm WithSecurityManager denyAll.policy tree fail --- /dev/null 2016-05-30 16:31:39.000000000 +0100 +++ new/src/java.base/share/classes/sun/nio/fs/ExtendedOptions.java 2016-05-30 16:31:39.000000000 +0100 @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.nio.fs; + +import java.nio.file.CopyOption; +import java.nio.file.OpenOption; +import java.nio.file.WatchEvent; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Provides support for handling JDK-specific OpenOption, CopyOption and + * WatchEvent.Modifier types. + */ + +public final class ExtendedOptions { + + // maps InternalOption to ExternalOption + private static final Map, Wrapper> internalToExternal + = new ConcurrentHashMap<>(); + + /** + * Wraps an option or modifier. + */ + private static final class Wrapper { + private final Object option; + private final T param; + + Wrapper(Object option, T param) { + this.option = option; + this.param = param; + } + + T parameter() { + return param; + } + } + + /** + * The internal version of a JDK-specific OpenOption, CopyOption or + * WatchEvent.Modifier. + */ + public static final class InternalOption { + + InternalOption() { } + + private void registerInternal(Object option, T param) { + Wrapper wrapper = new Wrapper(option, param); + internalToExternal.put(this, wrapper); + } + + /** + * Register this internal option as a OpenOption. + */ + public void register(OpenOption option) { + registerInternal(option, null); + } + + /** + * Register this internal option as a CopyOption. + */ + public void register(CopyOption option) { + registerInternal(option, null); + } + + /** + * Register this internal option as a WatchEvent.Modifier. + */ + public void register(WatchEvent.Modifier option) { + registerInternal(option, null); + } + + /** + * Register this internal option as a WatchEvent.Modifier with the + * given parameter. + */ + public void register(WatchEvent.Modifier option, T param) { + registerInternal(option, param); + } + + /** + * Returns true if the given option (or modifier) maps to this internal + * option. + */ + public boolean matches(Object option) { + Wrapper wrapper = internalToExternal.get(this); + if (wrapper == null) + return false; + else + return option == wrapper.option; + } + + /** + * Returns the parameter object associated with this internal option. + */ + @SuppressWarnings("unchecked") + public T parameter() { + Wrapper wrapper = internalToExternal.get(this); + if (wrapper == null) + return null; + else + return (T) wrapper.parameter(); + } + } + + // Internal equivalents of the options and modifiers defined in + // package com.sun.nio.file + + public static final InternalOption INTERRUPTIBLE = new InternalOption<>(); + + public static final InternalOption NOSHARE_READ = new InternalOption<>(); + public static final InternalOption NOSHARE_WRITE = new InternalOption<>(); + public static final InternalOption NOSHARE_DELETE = new InternalOption<>(); + + public static final InternalOption FILE_TREE = new InternalOption<>(); + + public static final InternalOption SENSITIVITY_HIGH = new InternalOption<>(); + public static final InternalOption SENSITIVITY_MEDIUM = new InternalOption<>(); + public static final InternalOption SENSITIVITY_LOW = new InternalOption<>(); +} --- old/src/java.base/share/classes/com/sun/nio/file/ExtendedCopyOption.java 2016-05-30 16:31:40.000000000 +0100 +++ /dev/null 2016-05-30 16:31:40.000000000 +0100 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.nio.file; - -import java.nio.file.CopyOption; - -/** - * Defines extended copy options supported on some platforms - * by Sun's provider implementation. - * - * @since 1.7 - */ - -public enum ExtendedCopyOption implements CopyOption { - /** - * The copy may be interrupted by the {@link Thread#interrupt interrupt} - * method. - */ - INTERRUPTIBLE, -} --- /dev/null 2016-05-30 16:31:40.000000000 +0100 +++ new/src/jdk.unsupported/share/classes/com/sun/nio/file/ExtendedCopyOption.java 2016-05-30 16:31:39.000000000 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.nio.file; + +import java.nio.file.CopyOption; +import sun.nio.fs.ExtendedOptions; + +/** + * Defines extended copy options supported on some platforms + * by Sun's provider implementation. + * + * @since 1.7 + */ + +public enum ExtendedCopyOption implements CopyOption { + /** + * The copy may be interrupted by the {@link Thread#interrupt interrupt} + * method. + */ + INTERRUPTIBLE(ExtendedOptions.INTERRUPTIBLE); + + ExtendedCopyOption(ExtendedOptions.InternalOption option) { + option.register(this); + } +} --- old/src/java.base/share/classes/com/sun/nio/file/ExtendedOpenOption.java 2016-05-30 16:31:40.000000000 +0100 +++ /dev/null 2016-05-30 16:31:41.000000000 +0100 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.nio.file; - -import java.nio.file.OpenOption; - -/** - * Defines extended open options supported on some platforms - * by Sun's provider implementation. - * - * @since 1.7 - */ - -public enum ExtendedOpenOption implements OpenOption { - /** - * Prevent operations on the file that request read access. - */ - NOSHARE_READ, - /** - * Prevent operations on the file that request write access. - */ - NOSHARE_WRITE, - /** - * Prevent operations on the file that request delete access. - */ - NOSHARE_DELETE; -} --- /dev/null 2016-05-30 16:31:41.000000000 +0100 +++ new/src/jdk.unsupported/share/classes/com/sun/nio/file/ExtendedOpenOption.java 2016-05-30 16:31:40.000000000 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.nio.file; + +import java.nio.file.OpenOption; +import sun.nio.fs.ExtendedOptions; + +/** + * Defines extended open options supported on some platforms + * by Sun's provider implementation. + * + * @since 1.7 + */ + +public enum ExtendedOpenOption implements OpenOption { + /** + * Prevent operations on the file that request read access. + */ + NOSHARE_READ(ExtendedOptions.NOSHARE_READ), + /** + * Prevent operations on the file that request write access. + */ + NOSHARE_WRITE(ExtendedOptions.NOSHARE_WRITE), + /** + * Prevent operations on the file that request delete access. + */ + NOSHARE_DELETE(ExtendedOptions.NOSHARE_DELETE); + + ExtendedOpenOption(ExtendedOptions.InternalOption option) { + option.register(this); + } +} --- old/src/java.base/share/classes/com/sun/nio/file/ExtendedWatchEventModifier.java 2016-05-30 16:31:41.000000000 +0100 +++ /dev/null 2016-05-30 16:31:41.000000000 +0100 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.nio.file; - -import java.nio.file.WatchEvent.Modifier; - -/** - * Defines extended watch event modifiers supported on some platforms - * by Sun's provider implementation. - * - * @since 1.7 - */ - -public enum ExtendedWatchEventModifier implements Modifier { - - /** - * Register a file tree instead of a single directory. - */ - FILE_TREE, -} --- /dev/null 2016-05-30 16:31:41.000000000 +0100 +++ new/src/jdk.unsupported/share/classes/com/sun/nio/file/ExtendedWatchEventModifier.java 2016-05-30 16:31:41.000000000 +0100 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.nio.file; + +import java.nio.file.WatchEvent.Modifier; +import sun.nio.fs.ExtendedOptions; + +/** + * Defines extended watch event modifiers supported on some platforms + * by Sun's provider implementation. + * + * @since 1.7 + */ + +public enum ExtendedWatchEventModifier implements Modifier { + + /** + * Register a file tree instead of a single directory. + */ + FILE_TREE(ExtendedOptions.FILE_TREE); + + ExtendedWatchEventModifier(ExtendedOptions.InternalOption option) { + option.register(this); + } +} --- old/src/java.base/share/classes/com/sun/nio/file/SensitivityWatchEventModifier.java 2016-05-30 16:31:42.000000000 +0100 +++ /dev/null 2016-05-30 16:31:42.000000000 +0100 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.nio.file; - -import java.nio.file.WatchEvent.Modifier; - -/** - * Defines the sensitivity levels when registering objects with a - * watch service implementation that polls the file system. - * - * @since 1.7 - */ - -public enum SensitivityWatchEventModifier implements Modifier { - /** - * High sensitivity. - */ - HIGH(2), - /** - * Medium sensitivity. - */ - MEDIUM(10), - /** - * Low sensitivity. - */ - LOW(30); - - /** - * Returns the sensitivity in seconds. - */ - public int sensitivityValueInSeconds() { - return sensitivity; - } - - private final int sensitivity; - private SensitivityWatchEventModifier(int sensitivity) { - this.sensitivity = sensitivity; - } -} --- /dev/null 2016-05-30 16:31:42.000000000 +0100 +++ new/src/jdk.unsupported/share/classes/com/sun/nio/file/SensitivityWatchEventModifier.java 2016-05-30 16:31:42.000000000 +0100 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.nio.file; + +import java.nio.file.WatchEvent.Modifier; +import sun.nio.fs.ExtendedOptions; + +/** + * Defines the sensitivity levels when registering objects with a + * watch service implementation that polls the file system. + * + * @since 1.7 + */ + +public enum SensitivityWatchEventModifier implements Modifier { + /** + * High sensitivity. + */ + HIGH(ExtendedOptions.SENSITIVITY_HIGH, 2), + /** + * Medium sensitivity. + */ + MEDIUM(ExtendedOptions.SENSITIVITY_MEDIUM, 10), + /** + * Low sensitivity. + */ + LOW(ExtendedOptions.SENSITIVITY_LOW, 30); + + /** + * Returns the sensitivity in seconds. + */ + public int sensitivityValueInSeconds() { + return sensitivity; + } + + private final int sensitivity; + private SensitivityWatchEventModifier(ExtendedOptions.InternalOption option, + int sensitivity) { + this.sensitivity = sensitivity; + option.register(this, sensitivity); + } +}