final boolean hasModuleDeclaration()

in src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java [388:411]


    final boolean hasModuleDeclaration(final List<SourceDirectory> roots) throws IOException {
        for (SourceDirectory root : roots) {
            hasMainModuleInfo |= root.moduleName != null;
            hasTestModuleInfo |= root.getModuleInfo().isPresent();
            if (hasMainModuleInfo & hasTestModuleInfo) {
                break;
            }
        }
        if (hasTestModuleInfo) {
            MessageBuilder message = messageBuilderFactory.builder();
            message.a("Overwriting the ")
                    .warning(MODULE_INFO + JAVA_FILE_SUFFIX)
                    .a(" file in the test directory is deprecated. Use ")
                    .info("--add-reads")
                    .a(", ")
                    .info("--add-modules")
                    .a(" and related options instead.");
            logger.warn(message.toString());
            if (SUPPORT_LEGACY) {
                return useModulePath;
            }
        }
        return useModulePath && hasMainModuleInfo;
    }