The actual class used for making new instances of Directory is FSDirectory.IMPL, set via the system property "org.apache.lucene.FSDirectory.class".
It seems like we should make it possible to create multiple FSDirectory implementations of different types in the same JVM.
The simplest workaround would be to create a
protected static FSDirectory getDirectory(File file, LockFactory lockFactory, Class impl)
Subclasses could implement their own getDirectory calls that pass down the appropriate class.
Not the most elegant solution if one were starting from scratch, but it seems like it would be completely backward compatible, while allowing NIOFSDirectory.getDirectory() to do what it looks like it should do.