diff --git a/jimfs/pom.xml b/jimfs/pom.xml index 58a24f37..017387be 100644 --- a/jimfs/pom.xml +++ b/jimfs/pom.xml @@ -62,7 +62,7 @@ org.checkerframework - checker-compat-qual + checker-qual true diff --git a/jimfs/src/main/java/com/google/common/jimfs/AbstractWatchService.java b/jimfs/src/main/java/com/google/common/jimfs/AbstractWatchService.java index 0bf2258a..2ccaa1b2 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/AbstractWatchService.java +++ b/jimfs/src/main/java/com/google/common/jimfs/AbstractWatchService.java @@ -42,7 +42,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Abstract implementation of {@link WatchService}. Provides the means for registering and managing @@ -91,16 +91,14 @@ ImmutableList queuedKeys() { return ImmutableList.copyOf(queue); } - @NullableDecl @Override - public WatchKey poll() { + public @Nullable WatchKey poll() { checkOpen(); return check(queue.poll()); } - @NullableDecl @Override - public WatchKey poll(long timeout, TimeUnit unit) throws InterruptedException { + public @Nullable WatchKey poll(long timeout, TimeUnit unit) throws InterruptedException { checkOpen(); return check(queue.poll(timeout, unit)); } @@ -112,8 +110,7 @@ public WatchKey take() throws InterruptedException { } /** Returns the given key, throwing an exception if it's the poison. */ - @NullableDecl - private WatchKey check(@NullableDecl WatchKey key) { + private @Nullable WatchKey check(@Nullable WatchKey key) { if (key == poison) { // ensure other blocking threads get the poison queue.offer(poison); @@ -143,9 +140,9 @@ static final class Event implements WatchEvent { private final Kind kind; private final int count; - @NullableDecl private final T context; + private final @Nullable T context; - public Event(Kind kind, int count, @NullableDecl T context) { + public Event(Kind kind, int count, @Nullable T context) { this.kind = checkNotNull(kind); checkArgument(count >= 0, "count (%s) must be non-negative", count); this.count = count; @@ -162,9 +159,8 @@ public int count() { return count; } - @NullableDecl @Override - public T context() { + public @Nullable T context() { return context; } @@ -215,7 +211,7 @@ private static WatchEvent overflowEvent(int count) { public Key( AbstractWatchService watcher, - @NullableDecl Watchable watchable, + @Nullable Watchable watchable, Iterable> subscribedTypes) { this.watcher = checkNotNull(watcher); this.watchable = watchable; // nullable for Watcher poison diff --git a/jimfs/src/main/java/com/google/common/jimfs/AclAttributeProvider.java b/jimfs/src/main/java/com/google/common/jimfs/AclAttributeProvider.java index 1fa0f155..9b543d31 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/AclAttributeProvider.java +++ b/jimfs/src/main/java/com/google/common/jimfs/AclAttributeProvider.java @@ -29,7 +29,7 @@ import java.nio.file.attribute.UserPrincipal; import java.util.List; import java.util.Map; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Attribute provider that provides the {@link AclFileAttributeView} ("acl"). @@ -71,9 +71,8 @@ public ImmutableSet fixedAttributes() { return ImmutableMap.of("acl:acl", acl); } - @NullableDecl @Override - public Object get(File file, String attribute) { + public @Nullable Object get(File file, String attribute) { if (attribute.equals("acl")) { return file.getAttribute("acl", "acl"); } diff --git a/jimfs/src/main/java/com/google/common/jimfs/AttributeProvider.java b/jimfs/src/main/java/com/google/common/jimfs/AttributeProvider.java index f5cade23..b975c985 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/AttributeProvider.java +++ b/jimfs/src/main/java/com/google/common/jimfs/AttributeProvider.java @@ -24,7 +24,7 @@ import java.nio.file.attribute.FileAttributeView; import java.util.Arrays; import java.util.Map; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Abstract provider for handling a specific file attribute view. @@ -87,8 +87,7 @@ public ImmutableSet attributes(File file) { * Returns the value of the given attribute in the given file or null if the attribute is not * supported by this provider. */ - @NullableDecl - public abstract Object get(File file, String attribute); + public abstract @Nullable Object get(File file, String attribute); /** * Sets the value of the given attribute in the given file object. The {@code create} parameter @@ -108,8 +107,7 @@ public ImmutableSet attributes(File file) { * Returns the type of file attributes object this provider supports, or null if it doesn't * support reading its attributes as an object. */ - @NullableDecl - public Class attributesType() { + public @Nullable Class attributesType() { return null; } diff --git a/jimfs/src/main/java/com/google/common/jimfs/AttributeService.java b/jimfs/src/main/java/com/google/common/jimfs/AttributeService.java index 333a4973..3bae38d7 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/AttributeService.java +++ b/jimfs/src/main/java/com/google/common/jimfs/AttributeService.java @@ -36,7 +36,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Service providing all attribute related operations for a file store. One piece of the file store @@ -204,8 +204,7 @@ public Object getAttribute(File file, String view, String attribute) { return value; } - @NullableDecl - private Object getAttributeInternal(File file, String view, String attribute) { + private @Nullable Object getAttributeInternal(File file, String view, String attribute) { AttributeProvider provider = providersByName.get(view); if (provider == null) { return null; @@ -259,8 +258,8 @@ private void setAttributeInternal( * if the view type is not supported. */ @SuppressWarnings("unchecked") - @NullableDecl - public V getFileAttributeView(FileLookup lookup, Class type) { + public @Nullable V getFileAttributeView( + FileLookup lookup, Class type) { AttributeProvider provider = providersByViewType.get(type); if (provider != null) { diff --git a/jimfs/src/main/java/com/google/common/jimfs/BasicAttributeProvider.java b/jimfs/src/main/java/com/google/common/jimfs/BasicAttributeProvider.java index 247aa163..43272ee3 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/BasicAttributeProvider.java +++ b/jimfs/src/main/java/com/google/common/jimfs/BasicAttributeProvider.java @@ -23,7 +23,7 @@ import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.FileAttributeView; import java.nio.file.attribute.FileTime; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Attribute provider that provides attributes common to all file systems, the {@link @@ -56,9 +56,8 @@ public ImmutableSet fixedAttributes() { return ATTRIBUTES; } - @NullableDecl @Override - public Object get(File file, String attribute) { + public @Nullable Object get(File file, String attribute) { switch (attribute) { case "size": return file.size(); @@ -149,9 +148,9 @@ public BasicFileAttributes readAttributes() throws IOException { @Override public void setTimes( - @NullableDecl FileTime lastModifiedTime, - @NullableDecl FileTime lastAccessTime, - @NullableDecl FileTime createTime) + @Nullable FileTime lastModifiedTime, + @Nullable FileTime lastAccessTime, + @Nullable FileTime createTime) throws IOException { File file = lookupFile(); diff --git a/jimfs/src/main/java/com/google/common/jimfs/Configuration.java b/jimfs/src/main/java/com/google/common/jimfs/Configuration.java index e86e7609..7801ea7e 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/Configuration.java +++ b/jimfs/src/main/java/com/google/common/jimfs/Configuration.java @@ -45,7 +45,7 @@ import java.util.Map; import java.util.Set; import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Immutable configuration for an in-memory file system. A {@code Configuration} is passed to a @@ -442,7 +442,7 @@ private ImmutableSet checkNormalizations( } private static void checkNormalizationNotSet( - PathNormalization n, @NullableDecl PathNormalization set) { + PathNormalization n, @Nullable PathNormalization set) { if (set != null) { throw new IllegalArgumentException( "can't set normalization " + n + ": normalization " + set + " already set"); diff --git a/jimfs/src/main/java/com/google/common/jimfs/Directory.java b/jimfs/src/main/java/com/google/common/jimfs/Directory.java index 54130e91..1d341c86 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/Directory.java +++ b/jimfs/src/main/java/com/google/common/jimfs/Directory.java @@ -22,7 +22,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.nio.file.attribute.FileTime; import java.util.Iterator; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A table of {@linkplain DirectoryEntry directory entries}. @@ -105,8 +105,7 @@ public boolean isEmpty() { } /** Returns the entry for the given name in this table or null if no such entry exists. */ - @NullableDecl - public DirectoryEntry get(Name name) { + public @Nullable DirectoryEntry get(Name name) { int index = bucketIndex(name, table.length); DirectoryEntry entry = table[index]; @@ -337,7 +336,7 @@ DirectoryEntry remove(Name name) { public Iterator iterator() { return new AbstractIterator() { int index; - @NullableDecl DirectoryEntry entry; + @Nullable DirectoryEntry entry; @Override protected DirectoryEntry computeNext() { diff --git a/jimfs/src/main/java/com/google/common/jimfs/DirectoryEntry.java b/jimfs/src/main/java/com/google/common/jimfs/DirectoryEntry.java index f6bf458a..6492a59b 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/DirectoryEntry.java +++ b/jimfs/src/main/java/com/google/common/jimfs/DirectoryEntry.java @@ -27,7 +27,7 @@ import java.nio.file.NotLinkException; import java.nio.file.Path; import java.util.Objects; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Entry in a directory, containing references to the directory itself, the file the entry links to @@ -41,11 +41,11 @@ final class DirectoryEntry { private final Directory directory; private final Name name; - @NullableDecl private final File file; + private final @Nullable File file; - @NullableDecl DirectoryEntry next; // for use in Directory + @Nullable DirectoryEntry next; // for use in Directory - DirectoryEntry(Directory directory, Name name, @NullableDecl File file) { + DirectoryEntry(Directory directory, Name name, @Nullable File file) { this.directory = checkNotNull(directory); this.name = checkNotNull(name); this.file = file; @@ -140,8 +140,7 @@ public File file() { } /** Returns the file this entry links to or {@code null} if the file does not exist */ - @NullableDecl - public File fileOrNull() { + public @Nullable File fileOrNull() { return file; } diff --git a/jimfs/src/main/java/com/google/common/jimfs/DosAttributeProvider.java b/jimfs/src/main/java/com/google/common/jimfs/DosAttributeProvider.java index 51bf96bd..9a8ed189 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/DosAttributeProvider.java +++ b/jimfs/src/main/java/com/google/common/jimfs/DosAttributeProvider.java @@ -27,7 +27,7 @@ import java.nio.file.attribute.FileAttributeView; import java.nio.file.attribute.FileTime; import java.util.Map; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Attribute provider that provides the {@link DosFileAttributeView} ("dos") and allows the reading @@ -75,9 +75,8 @@ private static Boolean getDefaultValue(String attribute, Map userProv return false; } - @NullableDecl @Override - public Object get(File file, String attribute) { + public @Nullable Object get(File file, String attribute) { if (ATTRIBUTES.contains(attribute)) { return file.getAttribute("dos", attribute); } diff --git a/jimfs/src/main/java/com/google/common/jimfs/File.java b/jimfs/src/main/java/com/google/common/jimfs/File.java index f363ac97..71b25016 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/File.java +++ b/jimfs/src/main/java/com/google/common/jimfs/File.java @@ -26,7 +26,7 @@ import java.io.IOException; import java.nio.file.attribute.FileTime; import java.util.concurrent.locks.ReadWriteLock; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A file object, containing both the file's metadata and content. @@ -43,8 +43,8 @@ public abstract class File { private FileTime lastAccessTime; private FileTime lastModifiedTime; - @NullableDecl // null when only the basic view is used (default) - private Table attributes; + // null when only the basic view is used (default) + private @Nullable Table attributes; File(int id, FileTime creationTime) { this.id = id; @@ -102,8 +102,7 @@ void copyContentTo(File file) throws IOException {} * Returns the read-write lock for this file's content, or {@code null} if there is no content * lock. */ - @NullableDecl - ReadWriteLock contentLock() { + @Nullable ReadWriteLock contentLock() { return null; } @@ -210,8 +209,7 @@ final synchronized ImmutableSet getAttributeKeys() { } /** Gets the value of the given attribute in the given view. */ - @NullableDecl - public final synchronized Object getAttribute(String view, String attribute) { + public final synchronized @Nullable Object getAttribute(String view, String attribute) { if (attributes == null) { return null; } @@ -251,7 +249,7 @@ final synchronized void copyAttributes(File target) { target.putAll(attributes); } - private synchronized void putAll(@NullableDecl Table attributes) { + private synchronized void putAll(@Nullable Table attributes) { if (attributes != null && this.attributes != attributes) { if (this.attributes == null) { this.attributes = HashBasedTable.create(); diff --git a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java b/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java index c441edeb..702326ff 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java +++ b/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java @@ -50,7 +50,7 @@ import java.util.Set; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * View of a file system with a specific working directory. As all file system operations need to @@ -313,8 +313,7 @@ public RegularFile getOrCreateRegularFile( * Looks up the regular file at the given path, throwing an exception if the file isn't a regular * file. Returns null if the file did not exist. */ - @NullableDecl - private RegularFile lookUpRegularFile(JimfsPath path, Set options) + private @Nullable RegularFile lookUpRegularFile(JimfsPath path, Set options) throws IOException { store.readLock().lock(); try { @@ -700,14 +699,13 @@ private void unlockSourceAndCopy(File sourceFile, File copyFile) { } /** Returns a file attribute view using the given lookup callback. */ - @NullableDecl - public V getFileAttributeView(FileLookup lookup, Class type) { + public @Nullable V getFileAttributeView( + FileLookup lookup, Class type) { return store.getFileAttributeView(lookup, type); } /** Returns a file attribute view for the given path in this view. */ - @NullableDecl - public V getFileAttributeView( + public @Nullable V getFileAttributeView( final JimfsPath path, Class type, final Set options) { return store.getFileAttributeView( new FileLookup() { diff --git a/jimfs/src/main/java/com/google/common/jimfs/FileTree.java b/jimfs/src/main/java/com/google/common/jimfs/FileTree.java index c4809420..f0dd4260 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/FileTree.java +++ b/jimfs/src/main/java/com/google/common/jimfs/FileTree.java @@ -27,7 +27,7 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * The tree of directories and files for the file system. Contains the file system root directories @@ -63,8 +63,7 @@ public ImmutableSortedSet getRootDirectoryNames() { * Gets the directory entry for the root with the given name or {@code null} if no such root * exists. */ - @NullableDecl - public DirectoryEntry getRoot(Name name) { + public @Nullable DirectoryEntry getRoot(Name name) { Directory dir = roots.get(name); return dir == null ? null : dir.entryInParent(); } @@ -83,8 +82,7 @@ public DirectoryEntry lookUp( return result; } - @NullableDecl - private DirectoryEntry lookUp( + private @Nullable DirectoryEntry lookUp( File dir, JimfsPath path, Set options, int linkDepth) throws IOException { ImmutableList names = path.names(); @@ -114,8 +112,7 @@ private DirectoryEntry lookUp( * Looks up the given names against the given base file. If the file is not a directory, the * lookup fails. */ - @NullableDecl - private DirectoryEntry lookUp( + private @Nullable DirectoryEntry lookUp( File dir, Iterable names, Set options, int linkDepth) throws IOException { Iterator nameIterator = names.iterator(); @@ -151,9 +148,8 @@ private DirectoryEntry lookUp( } /** Looks up the last element of a path. */ - @NullableDecl - private DirectoryEntry lookUpLast( - @NullableDecl File dir, Name name, Set options, int linkDepth) + private @Nullable DirectoryEntry lookUpLast( + @Nullable File dir, Name name, Set options, int linkDepth) throws IOException { Directory directory = toDirectory(dir); if (directory == null) { @@ -177,8 +173,7 @@ private DirectoryEntry lookUpLast( * Returns the directory entry located by the target path of the given symbolic link, resolved * relative to the given directory. */ - @NullableDecl - private DirectoryEntry followSymbolicLink(File dir, SymbolicLink link, int linkDepth) + private @Nullable DirectoryEntry followSymbolicLink(File dir, SymbolicLink link, int linkDepth) throws IOException { if (linkDepth >= MAX_SYMBOLIC_LINK_DEPTH) { throw new IOException("too many levels of symbolic links"); @@ -196,8 +191,7 @@ private DirectoryEntry followSymbolicLink(File dir, SymbolicLink link, int linkD * we find an entry [bar -> "." -> bar], we instead return the entry for bar in its parent, [foo * -> "bar" -> bar]. */ - @NullableDecl - private DirectoryEntry getRealEntry(DirectoryEntry entry) { + private @Nullable DirectoryEntry getRealEntry(DirectoryEntry entry) { Name name = entry.name(); if (name.equals(Name.SELF) || name.equals(Name.PARENT)) { @@ -209,8 +203,7 @@ private DirectoryEntry getRealEntry(DirectoryEntry entry) { } } - @NullableDecl - private Directory toDirectory(@NullableDecl File file) { + private @Nullable Directory toDirectory(@Nullable File file) { return file == null || !file.isDirectory() ? null : (Directory) file; } diff --git a/jimfs/src/main/java/com/google/common/jimfs/Handler.java b/jimfs/src/main/java/com/google/common/jimfs/Handler.java index 9b1dfee2..18c305b6 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/Handler.java +++ b/jimfs/src/main/java/com/google/common/jimfs/Handler.java @@ -23,7 +23,7 @@ import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * {@link URLStreamHandler} implementation for jimfs. Named {@code Handler} so that the class can be @@ -80,10 +80,9 @@ protected URLConnection openConnection(URL url) throws IOException { return new PathURLConnection(url); } - @NullableDecl @Override @SuppressWarnings("UnsynchronizedOverridesSynchronized") // no need to synchronize to return null - protected InetAddress getHostAddress(URL url) { + protected @Nullable InetAddress getHostAddress(URL url) { // jimfs uses the URI host to specify the name of the file system being used. // In the default implementation of getHostAddress(URL), a non-null host would cause an attempt // to look up the IP address, causing a slowdown on calling equals/hashCode methods on the URL diff --git a/jimfs/src/main/java/com/google/common/jimfs/Jimfs.java b/jimfs/src/main/java/com/google/common/jimfs/Jimfs.java index a04ce46d..6719913d 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/Jimfs.java +++ b/jimfs/src/main/java/com/google/common/jimfs/Jimfs.java @@ -33,7 +33,7 @@ import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Static factory methods for creating new Jimfs file systems. File systems may either be created @@ -174,7 +174,7 @@ static FileSystem newFileSystem(URI uri, Configuration config) { * The system-loaded instance of {@code SystemJimfsFileSystemProvider}, or {@code null} if it * could not be found or loaded. */ - @NullableDecl static final FileSystemProvider systemProvider = getSystemJimfsProvider(); + static final @Nullable FileSystemProvider systemProvider = getSystemJimfsProvider(); /** * Returns the system-loaded instance of {@code SystemJimfsFileSystemProvider} or {@code null} if @@ -188,8 +188,7 @@ static FileSystem newFileSystem(URI uri, Configuration config) { * same class loader) as the class whose static cache a {@code JimfsFileSystem} instance will be * placed in when {@code FileSystems.newFileSystem} is called in {@code Jimfs.newFileSystem}. */ - @NullableDecl - private static FileSystemProvider getSystemJimfsProvider() { + private static @Nullable FileSystemProvider getSystemJimfsProvider() { try { for (FileSystemProvider provider : FileSystemProvider.installedProviders()) { if (provider.getScheme().equals(URI_SCHEME)) { diff --git a/jimfs/src/main/java/com/google/common/jimfs/JimfsAsynchronousFileChannel.java b/jimfs/src/main/java/com/google/common/jimfs/JimfsAsynchronousFileChannel.java index 08df76f8..36c0af32 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/JimfsAsynchronousFileChannel.java +++ b/jimfs/src/main/java/com/google/common/jimfs/JimfsAsynchronousFileChannel.java @@ -34,7 +34,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * {@link AsynchronousFileChannel} implementation that delegates to a {@link JimfsFileChannel}. @@ -57,9 +57,7 @@ public long size() throws IOException { } private void addCallback( - ListenableFuture future, - CompletionHandler handler, - @NullableDecl A attachment) { + ListenableFuture future, CompletionHandler handler, @Nullable A attachment) { future.addListener(new CompletionHandlerCallback<>(future, handler, attachment), executor); } @@ -80,7 +78,7 @@ public void lock( long position, long size, boolean shared, - @NullableDecl A attachment, + @Nullable A attachment, CompletionHandler handler) { checkNotNull(handler); addCallback(lock(position, size, shared), handler, attachment); @@ -125,7 +123,7 @@ public FileLock tryLock(long position, long size, boolean shared) throws IOExcep public void read( ByteBuffer dst, long position, - @NullableDecl A attachment, + @Nullable A attachment, CompletionHandler handler) { addCallback(read(dst, position), handler, attachment); } @@ -151,7 +149,7 @@ public Integer call() throws IOException { public void write( ByteBuffer src, long position, - @NullableDecl A attachment, + @Nullable A attachment, CompletionHandler handler) { addCallback(write(src, position), handler, attachment); } @@ -194,12 +192,12 @@ private static final class CompletionHandlerCallback implements Runnable { private final ListenableFuture future; private final CompletionHandler completionHandler; - @NullableDecl private final A attachment; + private final @Nullable A attachment; private CompletionHandlerCallback( ListenableFuture future, CompletionHandler completionHandler, - @NullableDecl A attachment) { + @Nullable A attachment) { this.future = checkNotNull(future); this.completionHandler = checkNotNull(completionHandler); this.attachment = attachment; diff --git a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java b/jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java index 910d231e..08ae3e36 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java +++ b/jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java @@ -34,7 +34,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * {@link FileStore} implementation which provides methods for file creation, lookup and attribute @@ -102,8 +102,7 @@ ImmutableSortedSet getRootDirectoryNames() { } /** Returns the root directory with the given name or {@code null} if no such directory exists. */ - @NullableDecl - Directory getRoot(Name name) { + @Nullable Directory getRoot(Name name) { DirectoryEntry entry = tree.getRoot(name); return entry == null ? null : (Directory) entry.file(); } @@ -170,8 +169,7 @@ void setInitialAttributes(File file, FileAttribute... attrs) { * Returns an attribute view of the given type for the given file lookup callback, or {@code null} * if the view type is not supported. */ - @NullableDecl - V getFileAttributeView(FileLookup lookup, Class type) { + @Nullable V getFileAttributeView(FileLookup lookup, Class type) { state.checkOpen(); return attributes.getFileAttributeView(lookup, type); } diff --git a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystem.java b/jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystem.java index dd72146f..4cc0d20b 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystem.java +++ b/jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystem.java @@ -33,7 +33,7 @@ import java.nio.file.attribute.UserPrincipalLookupService; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * {@link FileSystem} implementation for Jimfs. Most behavior for the file system is implemented by @@ -285,7 +285,7 @@ public WatchService newWatchService() throws IOException { return watchServiceConfig.newWatchService(defaultView, pathService); } - @NullableDecl private ExecutorService defaultThreadPool; + private @Nullable ExecutorService defaultThreadPool; /** * Returns a default thread pool to use for asynchronous file channels when users do not provide diff --git a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystemProvider.java b/jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystemProvider.java index 8d487dd7..915bc344 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystemProvider.java +++ b/jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystemProvider.java @@ -48,7 +48,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutorService; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * {@link FileSystemProvider} implementation for Jimfs. This provider implements the actual file @@ -170,7 +170,7 @@ public SeekableByteChannel newByteChannel( public AsynchronousFileChannel newAsynchronousFileChannel( Path path, Set options, - @NullableDecl ExecutorService executor, + @Nullable ExecutorService executor, FileAttribute... attrs) throws IOException { // call newFileChannel and cast so that FileChannel support is checked there @@ -320,9 +320,8 @@ public void checkAccess(Path path, AccessMode... modes) throws IOException { getDefaultView(checkedPath).checkAccess(checkedPath); } - @NullableDecl @Override - public V getFileAttributeView( + public @Nullable V getFileAttributeView( Path path, Class type, LinkOption... options) { JimfsPath checkedPath = checkPath(path); return getDefaultView(checkedPath) diff --git a/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java b/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java index a9a39fea..4c454b86 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java +++ b/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java @@ -41,7 +41,7 @@ import java.util.Iterator; import java.util.List; import java.util.Objects; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Jimfs implementation of {@link Path}. Creation of new {@code Path} objects is delegated to the @@ -52,19 +52,18 @@ @SuppressWarnings("ShouldNotSubclass") // I know what I'm doing I promise final class JimfsPath implements Path { - @NullableDecl private final Name root; + private final @Nullable Name root; private final ImmutableList names; private final PathService pathService; - public JimfsPath(PathService pathService, @NullableDecl Name root, Iterable names) { + public JimfsPath(PathService pathService, @Nullable Name root, Iterable names) { this.pathService = checkNotNull(pathService); this.root = root; this.names = ImmutableList.copyOf(names); } /** Returns the root name, or null if there is no root. */ - @NullableDecl - public Name root() { + public @Nullable Name root() { return root; } @@ -77,8 +76,7 @@ public ImmutableList names() { * Returns the file name of this path. Unlike {@link #getFileName()}, this may return the name of * the root if this is a root path. */ - @NullableDecl - public Name name() { + public @Nullable Name name() { if (!names.isEmpty()) { return Iterables.getLast(names); } @@ -112,24 +110,21 @@ public boolean isAbsolute() { return root != null; } - @NullableDecl @Override - public JimfsPath getRoot() { + public @Nullable JimfsPath getRoot() { if (root == null) { return null; } return pathService.createRoot(root); } - @NullableDecl @Override - public JimfsPath getFileName() { + public @Nullable JimfsPath getFileName() { return names.isEmpty() ? null : getName(names.size() - 1); } - @NullableDecl @Override - public JimfsPath getParent() { + public @Nullable JimfsPath getParent() { if (names.isEmpty() || (names.size() == 1 && root == null)) { return null; } @@ -421,7 +416,7 @@ public int compareTo(Path other) { } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@Nullable Object obj) { return obj instanceof JimfsPath && compareTo((JimfsPath) obj) == 0; } @@ -435,8 +430,7 @@ public String toString() { return pathService.toString(this); } - @NullableDecl - private JimfsPath checkPath(Path other) { + private @Nullable JimfsPath checkPath(Path other) { if (checkNotNull(other) instanceof JimfsPath && other.getFileSystem().equals(getFileSystem())) { return (JimfsPath) other; } diff --git a/jimfs/src/main/java/com/google/common/jimfs/JimfsSecureDirectoryStream.java b/jimfs/src/main/java/com/google/common/jimfs/JimfsSecureDirectoryStream.java index e3391b67..db72f046 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/JimfsSecureDirectoryStream.java +++ b/jimfs/src/main/java/com/google/common/jimfs/JimfsSecureDirectoryStream.java @@ -35,7 +35,7 @@ import java.nio.file.attribute.FileAttributeView; import java.util.Iterator; import java.util.Set; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Secure directory stream implementation that uses a {@link FileSystemView} with the stream's @@ -87,7 +87,7 @@ protected synchronized void checkOpen() { private final class DirectoryIterator extends AbstractIterator { - @NullableDecl private Iterator fileNames; + private @Nullable Iterator fileNames; @Override protected synchronized Path computeNext() { diff --git a/jimfs/src/main/java/com/google/common/jimfs/Name.java b/jimfs/src/main/java/com/google/common/jimfs/Name.java index 327be751..885c5628 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/Name.java +++ b/jimfs/src/main/java/com/google/common/jimfs/Name.java @@ -21,7 +21,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.collect.Ordering; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Immutable representation of a file name. Used both for the name components of paths and as the @@ -77,7 +77,7 @@ private Name(String display, String canonical) { } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@Nullable Object obj) { if (obj instanceof Name) { Name other = (Name) obj; return canonical.equals(other.canonical); diff --git a/jimfs/src/main/java/com/google/common/jimfs/OwnerAttributeProvider.java b/jimfs/src/main/java/com/google/common/jimfs/OwnerAttributeProvider.java index 34086392..156be1b3 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/OwnerAttributeProvider.java +++ b/jimfs/src/main/java/com/google/common/jimfs/OwnerAttributeProvider.java @@ -26,7 +26,7 @@ import java.nio.file.attribute.FileOwnerAttributeView; import java.nio.file.attribute.UserPrincipal; import java.util.Map; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Attribute provider that provides the {@link FileOwnerAttributeView} ("owner"). @@ -65,9 +65,8 @@ public ImmutableSet fixedAttributes() { return ImmutableMap.of("owner:owner", owner); } - @NullableDecl @Override - public Object get(File file, String attribute) { + public @Nullable Object get(File file, String attribute) { if (attribute.equals("owner")) { return file.getAttribute("owner", "owner"); } diff --git a/jimfs/src/main/java/com/google/common/jimfs/PathService.java b/jimfs/src/main/java/com/google/common/jimfs/PathService.java index 2bd11a72..89e9290e 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/PathService.java +++ b/jimfs/src/main/java/com/google/common/jimfs/PathService.java @@ -38,7 +38,7 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Service for creating {@link JimfsPath} instances and handling other path-related operations. @@ -162,7 +162,7 @@ public JimfsPath createRelativePath(Iterable names) { } /** Returns a path with the given root (or no root, if null) and the given names. */ - public JimfsPath createPath(@NullableDecl Name root, Iterable names) { + public JimfsPath createPath(@Nullable Name root, Iterable names) { ImmutableList nameList = ImmutableList.copyOf(Iterables.filter(names, NOT_EMPTY)); if (root == null && nameList.isEmpty()) { // ensure the canonical empty path (one empty string name) is used rather than a path with @@ -173,7 +173,7 @@ public JimfsPath createPath(@NullableDecl Name root, Iterable names) { } /** Returns a path with the given root (or no root, if null) and the given names. */ - protected final JimfsPath createPathInternal(@NullableDecl Name root, Iterable names) { + protected final JimfsPath createPathInternal(@Nullable Name root, Iterable names) { return new JimfsPath(this, root, names); } diff --git a/jimfs/src/main/java/com/google/common/jimfs/PathType.java b/jimfs/src/main/java/com/google/common/jimfs/PathType.java index 4e4d30e2..1ac75336 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/PathType.java +++ b/jimfs/src/main/java/com/google/common/jimfs/PathType.java @@ -26,7 +26,7 @@ import java.net.URISyntaxException; import java.nio.file.InvalidPathException; import java.util.Arrays; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * An object defining a specific type of path. Knows how to parse strings to a path and how to @@ -164,7 +164,7 @@ public String toString() { } /** Returns the string form of the given path. */ - public abstract String toString(@NullableDecl String root, Iterable names); + public abstract String toString(@Nullable String root, Iterable names); /** * Returns the string form of the given path for use in the path part of a URI. The root element @@ -211,10 +211,10 @@ public final ParseResult fromUri(URI uri) { /** Simple result of parsing a path. */ public static final class ParseResult { - @NullableDecl private final String root; + private final @Nullable String root; private final Iterable names; - public ParseResult(@NullableDecl String root, Iterable names) { + public ParseResult(@Nullable String root, Iterable names) { this.root = root; this.names = checkNotNull(names); } @@ -230,8 +230,7 @@ public boolean isRoot() { } /** Returns the parsed root element, or null if there was no root. */ - @NullableDecl - public String root() { + public @Nullable String root() { return root; } diff --git a/jimfs/src/main/java/com/google/common/jimfs/PathURLConnection.java b/jimfs/src/main/java/com/google/common/jimfs/PathURLConnection.java index 9c983874..6626657b 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/PathURLConnection.java +++ b/jimfs/src/main/java/com/google/common/jimfs/PathURLConnection.java @@ -43,7 +43,7 @@ import java.util.Locale; import java.util.Map; import java.util.TimeZone; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * {@code URLConnection} implementation. @@ -134,9 +134,8 @@ public Map> getHeaderFields() { return (ImmutableMap>) (ImmutableMap) headers.asMap(); } - @NullableDecl @Override - public String getHeaderField(String name) { + public @Nullable String getHeaderField(String name) { try { connect(); } catch (IOException e) { diff --git a/jimfs/src/main/java/com/google/common/jimfs/PosixAttributeProvider.java b/jimfs/src/main/java/com/google/common/jimfs/PosixAttributeProvider.java index 9dcd887e..490ef82b 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/PosixAttributeProvider.java +++ b/jimfs/src/main/java/com/google/common/jimfs/PosixAttributeProvider.java @@ -35,7 +35,7 @@ import java.nio.file.attribute.UserPrincipal; import java.util.Map; import java.util.Set; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Attribute provider that provides the {@link PosixFileAttributeView} ("posix") and allows reading @@ -114,9 +114,8 @@ public ImmutableSet fixedAttributes() { "posix:permissions", permissions); } - @NullableDecl @Override - public Object get(File file, String attribute) { + public @Nullable Object get(File file, String attribute) { switch (attribute) { case "group": return file.getAttribute("posix", "group"); diff --git a/jimfs/src/main/java/com/google/common/jimfs/StandardAttributeProviders.java b/jimfs/src/main/java/com/google/common/jimfs/StandardAttributeProviders.java index 973c6bb4..264a8990 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/StandardAttributeProviders.java +++ b/jimfs/src/main/java/com/google/common/jimfs/StandardAttributeProviders.java @@ -17,7 +17,7 @@ package com.google.common.jimfs; import com.google.common.collect.ImmutableMap; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Static registry of {@link AttributeProvider} implementations for the standard set of file @@ -43,8 +43,7 @@ private StandardAttributeProviders() {} * Returns the attribute provider for the given view, or {@code null} if the given view is not one * of the attribute views this supports. */ - @NullableDecl - public static AttributeProvider get(String view) { + public static @Nullable AttributeProvider get(String view) { AttributeProvider provider = PROVIDERS.get(view); if (provider == null && view.equals("unix")) { diff --git a/jimfs/src/main/java/com/google/common/jimfs/UnixAttributeProvider.java b/jimfs/src/main/java/com/google/common/jimfs/UnixAttributeProvider.java index b1e3b5cf..6f793d7b 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/UnixAttributeProvider.java +++ b/jimfs/src/main/java/com/google/common/jimfs/UnixAttributeProvider.java @@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Attribute provider that provides the "unix" attribute view. @@ -94,10 +94,9 @@ private Integer getUniqueId(Object object) { return id; } - @NullableDecl @SuppressWarnings("unchecked") @Override - public Object get(File file, String attribute) { + public @Nullable Object get(File file, String attribute) { switch (attribute) { case "uid": UserPrincipal user = (UserPrincipal) file.getAttribute("owner", "owner"); diff --git a/jimfs/src/main/java/com/google/common/jimfs/UnixPathType.java b/jimfs/src/main/java/com/google/common/jimfs/UnixPathType.java index 76f13395..35b7bcf7 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/UnixPathType.java +++ b/jimfs/src/main/java/com/google/common/jimfs/UnixPathType.java @@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkArgument; import java.nio.file.InvalidPathException; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Unix-style path type. @@ -55,7 +55,7 @@ private static void checkValid(String path) { } @Override - public String toString(@NullableDecl String root, Iterable names) { + public String toString(@Nullable String root, Iterable names) { StringBuilder builder = new StringBuilder(); if (root != null) { builder.append(root); diff --git a/jimfs/src/main/java/com/google/common/jimfs/UserDefinedAttributeProvider.java b/jimfs/src/main/java/com/google/common/jimfs/UserDefinedAttributeProvider.java index 0c8e8723..1da028a1 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/UserDefinedAttributeProvider.java +++ b/jimfs/src/main/java/com/google/common/jimfs/UserDefinedAttributeProvider.java @@ -25,7 +25,7 @@ import java.nio.file.attribute.FileAttributeView; import java.nio.file.attribute.UserDefinedFileAttributeView; import java.util.List; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Attribute provider that provides the {@link UserDefinedFileAttributeView} ("user"). Unlike most @@ -69,9 +69,8 @@ private static ImmutableSet userDefinedAttributes(File file) { return builder.build(); } - @NullableDecl @Override - public Object get(File file, String attribute) { + public @Nullable Object get(File file, String attribute) { Object value = file.getAttribute("user", attribute); if (value instanceof byte[]) { byte[] bytes = (byte[]) value; diff --git a/jimfs/src/main/java/com/google/common/jimfs/WindowsPathType.java b/jimfs/src/main/java/com/google/common/jimfs/WindowsPathType.java index 7cdf0c40..bfd92eac 100644 --- a/jimfs/src/main/java/com/google/common/jimfs/WindowsPathType.java +++ b/jimfs/src/main/java/com/google/common/jimfs/WindowsPathType.java @@ -20,7 +20,7 @@ import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Windows-style path type. @@ -134,8 +134,7 @@ private String parseUncRoot(String path, String original) { private static final Pattern DRIVE_LETTER_ROOT = Pattern.compile("^[a-zA-Z]:\\\\"); /** Parses a normal drive-letter root, e.g. "C:\". */ - @NullableDecl - private String parseDriveRoot(String path) { + private @Nullable String parseDriveRoot(String path) { Matcher drivePathMatcher = DRIVE_LETTER_ROOT.matcher(path); if (drivePathMatcher.find()) { return path.substring(drivePathMatcher.start(), drivePathMatcher.end()); @@ -160,7 +159,7 @@ private static boolean isReserved(char c) { } @Override - public String toString(@NullableDecl String root, Iterable names) { + public String toString(@Nullable String root, Iterable names) { StringBuilder builder = new StringBuilder(); if (root != null) { builder.append(root); diff --git a/jimfs/src/test/java/com/google/common/jimfs/AbstractPathMatcherTest.java b/jimfs/src/test/java/com/google/common/jimfs/AbstractPathMatcherTest.java index 10ea5c4d..141cc133 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/AbstractPathMatcherTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/AbstractPathMatcherTest.java @@ -34,7 +34,7 @@ import java.nio.file.WatchService; import java.util.Iterator; import java.util.regex.PatternSyntaxException; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Abstract base class for tests of {@link PathMatcher} implementations. @@ -49,8 +49,7 @@ public abstract class AbstractPathMatcherTest { protected abstract PathMatcher matcher(String pattern); /** Override to return a real matcher for the given pattern. */ - @NullableDecl - protected PathMatcher realMatcher(String pattern) { + protected @Nullable PathMatcher realMatcher(String pattern) { return null; } @@ -78,7 +77,7 @@ protected final class PatternAsserter { private final PathMatcher matcher; - @NullableDecl private final PathMatcher realMatcher; + private final @Nullable PathMatcher realMatcher; PatternAsserter(String pattern) { this.matcher = matcher(pattern); diff --git a/jimfs/src/test/java/com/google/common/jimfs/DirectoryTest.java b/jimfs/src/test/java/com/google/common/jimfs/DirectoryTest.java index ebbd9fd4..2090d690 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/DirectoryTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/DirectoryTest.java @@ -28,7 +28,7 @@ import com.google.common.collect.Iterables; import java.util.HashSet; import java.util.Set; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -371,7 +371,7 @@ private DirectoryEntry entry(String name) { return new DirectoryEntry(a, Name.simple(name), a); } - private DirectoryEntry entry(Directory dir, String name, @NullableDecl File file) { + private DirectoryEntry entry(Directory dir, String name, @Nullable File file) { return new DirectoryEntry(dir, Name.simple(name), file); } diff --git a/jimfs/src/test/java/com/google/common/jimfs/FileTreeTest.java b/jimfs/src/test/java/com/google/common/jimfs/FileTreeTest.java index c919bf3c..55032d93 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/FileTreeTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/FileTreeTest.java @@ -32,7 +32,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Random; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -88,7 +88,7 @@ public ParseResult parsePath(String path) { } @Override - public String toString(@NullableDecl String root, Iterable names) { + public String toString(@Nullable String root, Iterable names) { root = Strings.nullToEmpty(root); return root + Joiner.on('/').join(names); } @@ -102,7 +102,8 @@ public String toUriPath(String root, Iterable names, boolean directory) @Override public ParseResult parseUriPath(String uriPath) { checkArgument( - uriPath.matches("^/[/$!].*"), "uriPath (%s) must start with // or /$ or /!", + uriPath.matches("^/[/$!].*"), + "uriPath (%s) must start with // or /$ or /!", uriPath); return parsePath(uriPath.substring(1)); // skip leading / } diff --git a/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java b/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java index 84b7c58f..991b1286 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java +++ b/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java @@ -37,7 +37,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Subject for doing assertions on file system paths. @@ -110,7 +110,7 @@ public PathSubject isRelative() { /** Asserts that the path has the given root component. */ @CanIgnoreReturnValue - public PathSubject hasRootComponent(@NullableDecl String root) { + public PathSubject hasRootComponent(@Nullable String root) { Path rootComponent = actual.getRoot(); if (root == null && rootComponent != null) { failWithActual("expected to have root component", root); diff --git a/jimfs/src/test/java/com/google/common/jimfs/PathTypeTest.java b/jimfs/src/test/java/com/google/common/jimfs/PathTypeTest.java index a80ec0db..53e08fe7 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/PathTypeTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/PathTypeTest.java @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.jimfs.PathType.ParseResult; import java.net.URI; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -94,7 +94,7 @@ public void testUriRoundTrips() { assertUriRoundTripsCorrectly(type, "$foo/bar baz"); } - static void assertParseResult(ParseResult result, @NullableDecl String root, String... names) { + static void assertParseResult(ParseResult result, @Nullable String root, String... names) { assertThat(result.root()).isEqualTo(root); assertThat(result.names()).containsExactly((Object[]) names).inOrder(); } @@ -126,7 +126,7 @@ public ParseResult parsePath(String path) { } @Override - public String toString(@NullableDecl String root, Iterable names) { + public String toString(@Nullable String root, Iterable names) { StringBuilder builder = new StringBuilder(); if (root != null) { builder.append(root); diff --git a/jimfs/src/test/java/com/google/common/jimfs/TestAttributeProvider.java b/jimfs/src/test/java/com/google/common/jimfs/TestAttributeProvider.java index 4518132a..b5360477 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/TestAttributeProvider.java +++ b/jimfs/src/test/java/com/google/common/jimfs/TestAttributeProvider.java @@ -26,7 +26,7 @@ import java.nio.file.attribute.FileTime; import java.util.HashMap; import java.util.Map; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.checkerframework.checker.nullness.qual.Nullable; /** @author Colin Decker */ public final class TestAttributeProvider extends AttributeProvider { @@ -133,9 +133,9 @@ public Attributes readAttributes() throws IOException { @Override public void setTimes( - @NullableDecl FileTime lastModifiedTime, - @NullableDecl FileTime lastAccessTime, - @NullableDecl FileTime createTime) + @Nullable FileTime lastModifiedTime, + @Nullable FileTime lastAccessTime, + @Nullable FileTime createTime) throws IOException { basicView.setTimes(lastModifiedTime, lastAccessTime, createTime); } diff --git a/pom.xml b/pom.xml index 4a74fd2f..c0769467 100644 --- a/pom.xml +++ b/pom.xml @@ -137,8 +137,8 @@ org.checkerframework - checker-compat-qual - 2.5.5 + checker-qual + 3.34.0