FilterFileSystem extends FileSystem { public FilterFileSystem() { } FilterFileSystem();  FilterFileSystem(FileSystem fs); FileSystem getRawFileSystem(); @Override void initialize(URI name, Configuration conf); @Override URI getUri(); @Override Path makeQualified(Path path); @Override BlockLocation[] getFileBlockLocations(FileStatus file, long start,
    long len); @Override Path resolvePath(final Path p); @Override FSDataInputStream open(Path f, int bufferSize); @Override FSDataInputStream open(PathHandle fd, int bufferSize); @Override FSDataOutputStream append(Path f, int bufferSize,
      Progressable progress); @Override void concat(Path f, Path[] psrcs); @Override FSDataOutputStream create(Path f, FsPermission permission,
      boolean overwrite, int bufferSize, short replication, long blockSize,
      Progressable progress); @Override FSDataOutputStream create(Path f,
        FsPermission permission,
        EnumSet<CreateFlag> flags,
        int bufferSize,
        short replication,
        long blockSize,
        Progressable progress,
        ChecksumOpt checksumOpt); @Override FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
      EnumSet<CreateFlag> flags, int bufferSize, short replication, long blockSize,
      Progressable progress); @Override boolean setReplication(Path src, short replication); @Override boolean rename(Path src, Path dst); @Override boolean truncate(Path f, final long newLength); @Override boolean delete(Path f, boolean recursive); @Override FileStatus[] listStatus(Path f); @Override RemoteIterator<Path> listCorruptFileBlocks(Path path); @Override RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f); @Override RemoteIterator<FileStatus> listStatusIterator(Path f); @Override Path getHomeDirectory(); @Override void setWorkingDirectory(Path newDir); @Override Path getWorkingDirectory(); @Override FsStatus getStatus(Path p); @Override boolean mkdirs(Path f, FsPermission permission); @Override boolean mkdirs(Path f); @Override void copyFromLocalFile(boolean delSrc, Path src, Path dst); @Override void copyFromLocalFile(boolean delSrc, boolean overwrite, 
                                Path[] srcs, Path dst); @Override void copyFromLocalFile(boolean delSrc, boolean overwrite, 
                                Path src, Path dst); @Override void copyToLocalFile(boolean delSrc, Path src, Path dst); @Override Path startLocalOutput(Path fsOutputFile, Path tmpLocalFile); @Override void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile); @Override long getUsed(); @Override long getUsed(Path path); @Override long getDefaultBlockSize(); @Override short getDefaultReplication(); @Override FsServerDefaults getServerDefaults(); @Override long getDefaultBlockSize(Path f); @Override short getDefaultReplication(Path f); @Override FsServerDefaults getServerDefaults(Path f); @Override FileStatus getFileStatus(Path f); @Override void access(Path path, FsAction mode); void createSymlink(final Path target, final Path link,
      final boolean createParent); FileStatus getFileLinkStatus(final Path f); boolean supportsSymlinks(); Path getLinkTarget(Path f); @Override FileChecksum getFileChecksum(Path f); @Override FileChecksum getFileChecksum(Path f, long length); @Override void setVerifyChecksum(boolean verifyChecksum); @Override void setWriteChecksum(boolean writeChecksum); @Override Configuration getConf(); @Override void close(); @Override void setOwner(Path p, String username, String groupname
      ); @Override void setTimes(Path p, long mtime, long atime
      ); @Override void setPermission(Path p, FsPermission permission
      ); @Override // FileSystem FileSystem[] getChildFileSystems(); @Override // FileSystem Path createSnapshot(Path path, String snapshotName); @Override // FileSystem void renameSnapshot(Path path, String snapshotOldName,
      String snapshotNewName); @Override // FileSystem void deleteSnapshot(Path path, String snapshotName); @Override void modifyAclEntries(Path path, List<AclEntry> aclSpec); @Override void removeAclEntries(Path path, List<AclEntry> aclSpec); @Override void removeDefaultAcl(Path path); @Override void removeAcl(Path path); @Override void setAcl(Path path, List<AclEntry> aclSpec); @Override AclStatus getAclStatus(Path path); @Override void setXAttr(Path path, String name, byte[] value); @Override void setXAttr(Path path, String name, byte[] value,
      EnumSet<XAttrSetFlag> flag); @Override byte[] getXAttr(Path path, String name); @Override Map<String, byte[]> getXAttrs(Path path); @Override Map<String, byte[]> getXAttrs(Path path, List<String> names); @Override List<String> listXAttrs(Path path); @Override void removeXAttr(Path path, String name); @Override void satisfyStoragePolicy(Path src); @Override void setStoragePolicy(Path src, String policyName); @Override void unsetStoragePolicy(Path src); @Override BlockStoragePolicySpi getStoragePolicy(final Path src); @Override Collection<? extends BlockStoragePolicySpi> getAllStoragePolicies(); @Override Path getTrashRoot(Path path); @Override Collection<FileStatus> getTrashRoots(boolean allUsers); @Override FSDataOutputStreamBuilder createFile(Path path); @Override FSDataOutputStreamBuilder appendFile(Path path); @Override FutureDataInputStreamBuilder openFile(final Path path); @Override FutureDataInputStreamBuilder openFile(final PathHandle pathHandle); @Override boolean hasPathCapability(final Path path, final String capability);  }
@Test public void testFilterFileSystem() throws Exception { int errors = 0; for (Method m : FileSystem.class.getDeclaredMethods()) { if (Modifier.isStatic(m.getModifiers()) || Modifier.isPrivate(m.getModifiers()) || Modifier.isFinal(m.getModifiers())) { continue; } try { MustNotImplement.class.getMethod(m.getName(), m.getParameterTypes()); try { FilterFileSystem.class.getDeclaredMethod(m.getName(), m.getParameterTypes()); LOG.error("FilterFileSystem MUST NOT implement " + m); errors++; } catch (NoSuchMethodException ex) { } } catch (NoSuchMethodException exc) { try{ FilterFileSystem.class.getDeclaredMethod(m.getName(), m.getParameterTypes()); } catch(NoSuchMethodException exc2){ LOG.error("FilterFileSystem MUST implement " + m); errors++; } } } assertTrue((errors + " methods were not overridden correctly - see" + " log"), errors <= 0); }