當前位置: 首頁>>代碼示例>>Java>>正文


Java Flags.AUTOMATIC_MODULE屬性代碼示例

本文整理匯總了Java中com.sun.tools.javac.code.Flags.AUTOMATIC_MODULE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Flags.AUTOMATIC_MODULE屬性的具體用法?Java Flags.AUTOMATIC_MODULE怎麽用?Java Flags.AUTOMATIC_MODULE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.sun.tools.javac.code.Flags的用法示例。


在下文中一共展示了Flags.AUTOMATIC_MODULE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: completeAutomaticModule

private void completeAutomaticModule(ModuleSymbol msym) throws CompletionFailure {
    ListBuffer<Directive> directives = new ListBuffer<>();

    directives.addAll(msym.directives);

    ListBuffer<RequiresDirective> requires = new ListBuffer<>();

    for (ModuleSymbol ms : allModules()) {
        if (ms == syms.unnamedModule || ms == msym)
            continue;
        Set<RequiresFlag> flags = (ms.flags_field & Flags.AUTOMATIC_MODULE) != 0 ?
                EnumSet.of(RequiresFlag.TRANSITIVE) : EnumSet.noneOf(RequiresFlag.class);
        RequiresDirective d = new RequiresDirective(ms, flags);
        directives.add(d);
        requires.add(d);
    }

    RequiresDirective requiresUnnamed = new RequiresDirective(syms.unnamedModule);
    directives.add(requiresUnnamed);
    requires.add(requiresUnnamed);

    msym.requires = requires.toList();
    msym.directives = directives.toList();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:Modules.java

示例2: complete

@Override
public void complete(Symbol sym) throws CompletionFailure {
    ModuleSymbol msym = moduleFinder.findModule((ModuleSymbol) sym);

    if (msym.kind == ERR) {
        //make sure the module is initialized:
        msym.directives = List.nil();
        msym.exports = List.nil();
        msym.provides = List.nil();
        msym.requires = List.nil();
        msym.uses = List.nil();
    } else if ((msym.flags_field & Flags.AUTOMATIC_MODULE) != 0) {
        setupAutomaticModule(msym);
    } else {
        msym.module_info.complete();
    }

    // If module-info comes from a .java file, the underlying
    // call of classFinder.fillIn will have called through the
    // source completer, to Enter, and then to Modules.enter,
    // which will call completeModule.
    // But, if module-info comes from a .class file, the underlying
    // call of classFinder.fillIn will just call ClassReader to read
    // the .class file, and so we call completeModule here.
    if (msym.module_info.classfile == null || msym.module_info.classfile.getKind() == Kind.CLASS) {
        completeModule(msym);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:28,代碼來源:Modules.java

示例3: computeTransitiveClosure

private Set<ModuleSymbol> computeTransitiveClosure(Set<? extends ModuleSymbol> base,
                                                   Set<? extends ModuleSymbol> rootModules,
                                                   Set<ModuleSymbol> observable) {
    List<ModuleSymbol> primaryTodo = List.nil();
    List<ModuleSymbol> secondaryTodo = List.nil();

    for (ModuleSymbol ms : base) {
        if (rootModules.contains(ms)) {
            primaryTodo = primaryTodo.prepend(ms);
        } else {
            secondaryTodo = secondaryTodo.prepend(ms);
        }
    }

    Set<ModuleSymbol> result = new LinkedHashSet<>();
    result.add(syms.java_base);

    while (primaryTodo.nonEmpty() || secondaryTodo.nonEmpty()) {
        try {
            ModuleSymbol current;
            boolean isPrimaryTodo;
            if (primaryTodo.nonEmpty()) {
                current = primaryTodo.head;
                primaryTodo = primaryTodo.tail;
                isPrimaryTodo = true;
            } else {
                current = secondaryTodo.head;
                secondaryTodo = secondaryTodo.tail;
                isPrimaryTodo = false;
            }
            if (observable != null && !observable.contains(current))
                continue;
            if (!result.add(current) || current == syms.unnamedModule || ((current.flags_field & Flags.AUTOMATIC_MODULE) != 0))
                continue;
            current.complete();
            if (current.kind == ERR && (isPrimaryTodo || base.contains(current)) && warnedMissing.add(current)) {
                log.error(Errors.ModuleNotFound(current));
            }
            for (RequiresDirective rd : current.requires) {
                if (rd.module == syms.java_base) continue;
                if ((rd.isTransitive() && isPrimaryTodo) || rootModules.contains(current)) {
                    primaryTodo = primaryTodo.prepend(rd.module);
                } else {
                    secondaryTodo = secondaryTodo.prepend(rd.module);
                }
            }
        } catch (CompletionFailure ex) {
            chk.completionError(null, ex);
        }
    }

    return result;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:53,代碼來源:Modules.java


注:本文中的com.sun.tools.javac.code.Flags.AUTOMATIC_MODULE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。