private ClassIndex indexForPath(Path path) {
        if (isJRTMarkerFile(path)) {
            FileSystem jrtfs = FileSystems.getFileSystem(URI.create("jrt:/"));
            Path modules = jrtfs.getPath("modules");
            return PATH_TO_INDEX.compute(path, (p, index) -> {
                try {
                    long lastModified = Files.getLastModifiedTime(modules).toMillis();
                    if (index == null || index.timestamp != lastModified) {
                        try (DirectoryStream<Path> stream = Files.newDirectoryStream(modules)) {
                            index = doIndex(lastModified, path, stream);
                        }
                    }
                    return index;
                } catch (IOException ex) {
                    proc.debug(ex, "SourceCodeAnalysisImpl.indexesForPath(" + path.toString() + ")");
                    return new ClassIndex(-1, path, Collections.emptySet(), Collections.emptyMap());
                }
            });
        } else if (!Files.isDirectory(path)) {
            if (Files.exists(path)) {
                return PATH_TO_INDEX.compute(path, (p, index) -> {
                    try {
                        long lastModified = Files.getLastModifiedTime(p).toMillis();
                        if (index == null || index.timestamp != lastModified) {
                            ClassLoader cl = SourceCodeAnalysisImpl.class.getClassLoader();

                            try (FileSystem zip = FileSystems.newFileSystem(path, cl)) {
                                index = doIndex(lastModified, path, zip.getRootDirectories());
                            }
                        }
                        return index;
                    } catch (IOException ex) {
                        proc.debug(ex, "SourceCodeAnalysisImpl.indexesForPath(" + path.toString() + ")");
                        return new ClassIndex(-1, path, Collections.emptySet(), Collections.emptyMap());
                    }
                });
            } else {
                return new ClassIndex(-1, path, Collections.emptySet(), Collections.emptyMap());
            }
        } else {
            return PATH_TO_INDEX.compute(path, (p, index) -> {
                //no persistence for directories, as we cannot check timestamps:
                if (index == null) {
                    index = doIndex(-1, path, Arrays.asList(p));
                }
                return index;
            });
        }
    }
private ClassIndex indexForPath ( Path path ) { if ( isJRTMarkerFile ( path ) ) { FileSystem jrtfs = FileSystems . getFileSystem ( URI . create ( "jrt:/" ) ) ; Path modules = jrtfs . getPath ( "modules" ) ; return PATH_TO_INDEX . compute ( path , ( p , index ) -> { try { long lastModified = Files . getLastModifiedTime ( modules ) . toMillis ( ) ; if ( index == null || index . timestamp != lastModified ) { try ( DirectoryStream < Path > stream = Files . newDirectoryStream ( modules ) ) { index = doIndex ( lastModified , path , stream ) ; } } return index ; } catch ( IOException ex ) { proc . debug ( ex , "SourceCodeAnalysisImpl.indexesForPath(" + path . toString ( ) + ")" ) ; return new ClassIndex ( - 1 , path , Collections . emptySet ( ) , Collections . emptyMap ( ) ) ; } } ) ; } else if ( ! Files . isDirectory ( path ) ) { if ( Files . exists ( path ) ) { return PATH_TO_INDEX . compute ( path , ( p , index ) -> { try { long lastModified = Files . getLastModifiedTime ( p ) . toMillis ( ) ; if ( index == null || index . timestamp != lastModified ) { ClassLoader cl = SourceCodeAnalysisImpl . class . getClassLoader ( ) ; try ( FileSystem zip = FileSystems . newFileSystem ( path , cl ) ) { index = doIndex ( lastModified , path , zip . getRootDirectories ( ) ) ; } } return index ; } catch ( IOException ex ) { proc . debug ( ex , "SourceCodeAnalysisImpl.indexesForPath(" + path . toString ( ) + ")" ) ; return new ClassIndex ( - 1 , path , Collections . emptySet ( ) , Collections . emptyMap ( ) ) ; } } ) ; } else { return new ClassIndex ( - 1 , path , Collections . emptySet ( ) , Collections . emptyMap ( ) ) ; } } else { return PATH_TO_INDEX . compute ( path , ( p , index ) -> { if ( index == null ) { index = doIndex ( - 1 , path , Arrays . asList ( p ) ) ; } return index ; } ) ; } }
if an index exists for the given entry, the existing index is kept unless the timestamp is modified