public boolean test()

in src/main/java/org/apache/maven/plugin/compiler/PathFilter.java [203:233]


    public boolean test(Path path) {
        @SuppressWarnings("LocalVariableHidesMemberVariable")
        final SourceDirectory sourceRoot = this.sourceRoot; // Protect from changes.
        FileSystem pfs = path.getFileSystem();
        if (pfs != fs) {
            if (useDefaultInclude) {
                includes[0] = "glob:**" + sourceRoot.fileKind.extension;
            }
            includeMatchers = createMatchers(sourceRoot.includes, includes, useDefaultInclude, pfs);
            excludeMatchers = createMatchers(sourceRoot.excludes, excludes, false, pfs);
            incrementalExcludeMatchers = createMatchers(List.of(), incrementalExcludes, false, pfs);
            needRelativize = !(sourceRoot.includes.isEmpty() && sourceRoot.excludes.isEmpty())
                    || needRelativize(includes)
                    || needRelativize(excludes);
            fs = pfs;
        }
        if (needRelativize) {
            path = sourceRoot.root.relativize(path);
        }
        for (PathMatcher include : includeMatchers) {
            if (include.matches(path)) {
                for (PathMatcher exclude : excludeMatchers) {
                    if (exclude.matches(path)) {
                        return false;
                    }
                }
                return true;
            }
        }
        return false;
    }