本文整理匯總了Java中com.sun.tools.javac.code.Flags.ACYCLIC屬性的典型用法代碼示例。如果您正苦於以下問題:Java Flags.ACYCLIC屬性的具體用法?Java Flags.ACYCLIC怎麽用?Java Flags.ACYCLIC使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.sun.tools.javac.code.Flags
的用法示例。
在下文中一共展示了Flags.ACYCLIC屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupAutomaticModule
private void setupAutomaticModule(ModuleSymbol msym) throws CompletionFailure {
try {
ListBuffer<Directive> directives = new ListBuffer<>();
ListBuffer<ExportsDirective> exports = new ListBuffer<>();
Set<String> seenPackages = new HashSet<>();
for (JavaFileObject clazz : fileManager.list(msym.classLocation, "", EnumSet.of(Kind.CLASS), true)) {
String binName = fileManager.inferBinaryName(msym.classLocation, clazz);
String pack = binName.lastIndexOf('.') != (-1) ? binName.substring(0, binName.lastIndexOf('.')) : ""; //unnamed package????
if (seenPackages.add(pack)) {
ExportsDirective d = new ExportsDirective(syms.enterPackage(msym, names.fromString(pack)), null);
//TODO: opens?
directives.add(d);
exports.add(d);
}
}
msym.exports = exports.toList();
msym.provides = List.nil();
msym.requires = List.nil();
msym.uses = List.nil();
msym.directives = directives.toList();
msym.flags_field |= Flags.ACYCLIC;
} catch (IOException ex) {
throw new IllegalStateException(ex);
}
}
示例2: checkCyclicDependencies
private void checkCyclicDependencies(JCModuleDecl mod) {
for (JCDirective d : mod.directives) {
JCRequires rd;
if (!d.hasTag(Tag.REQUIRES) || (rd = (JCRequires) d).directive == null)
continue;
Set<ModuleSymbol> nonSyntheticDeps = new HashSet<>();
List<ModuleSymbol> queue = List.of(rd.directive.module);
while (queue.nonEmpty()) {
ModuleSymbol current = queue.head;
queue = queue.tail;
if (!nonSyntheticDeps.add(current))
continue;
current.complete();
if ((current.flags() & Flags.ACYCLIC) != 0)
continue;
Assert.checkNonNull(current.requires, current::toString);
for (RequiresDirective dep : current.requires) {
if (!dep.flags.contains(RequiresFlag.EXTRA))
queue = queue.prepend(dep.module);
}
}
if (nonSyntheticDeps.contains(mod.sym)) {
log.error(rd.moduleName.pos(), Errors.CyclicRequires(rd.directive.module));
}
mod.sym.flags_field |= Flags.ACYCLIC;
}
}