public boolean isDependencyChanged(File grammarFile) throws IOException {
        String grammarPath = getRelativePath(grammarFile);

        for (Map.Entry<File, Map.Entry<byte[], Collection<String>>> e : grammars.entrySet()) {
            File depGrammarFile = e.getKey();
            byte[] checksum = e.getValue().getKey();
            Collection<String> usages = e.getValue().getValue();

            if (usages.contains(grammarPath)) {
                if (!depGrammarFile.exists() || !Arrays.equals(MojoUtils.checksum(depGrammarFile), checksum)) {
                    log.debug("  " + grammarPath + ": dependency " +
                        depGrammarFile.getName() + " changed");

                    return true;
                }
            }
        }

        return false;
    }
Determines whether a grammar used by the given grammar was modified since the last
build.

@param   grammarFile  the grammar.

@return  {@code true} if a grammar used by the given grammar has been modified.
antlr4-maven-plugin/src/main/java/org/antlr/mojo/antlr4/GrammarDependencies.java