本文整理汇总了Java中com.sun.tools.javac.code.Symbol.ClassSymbol.flags方法的典型用法代码示例。如果您正苦于以下问题:Java ClassSymbol.flags方法的具体用法?Java ClassSymbol.flags怎么用?Java ClassSymbol.flags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.code.Symbol.ClassSymbol
的用法示例。
在下文中一共展示了ClassSymbol.flags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: needsHeader
import com.sun.tools.javac.code.Symbol.ClassSymbol; //导入方法依赖的package包/类
private boolean needsHeader(ClassSymbol c, boolean checkNestedClasses) {
if (c.isLocal() || (c.flags() & Flags.SYNTHETIC) != 0)
return false;
for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
if (i.sym.kind == Kinds.MTH && (i.sym.flags() & Flags.NATIVE) != 0)
return true;
for (Attribute.Compound a: i.sym.getDeclarationAttributes()) {
if (a.type.tsym == syms.nativeHeaderType.tsym)
return true;
}
}
if (checkNestedClasses) {
for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
if ((i.sym.kind == Kinds.TYP) && needsHeader(((ClassSymbol) i.sym), true))
return true;
}
}
return false;
}
示例2: visitProvides
import com.sun.tools.javac.code.Symbol.ClassSymbol; //导入方法依赖的package包/类
@Override
public void visitProvides(JCProvides tree) {
Type st = attr.attribType(tree.serviceName, env, syms.objectType);
ClassSymbol service = (ClassSymbol) st.tsym;
if (allProvides.containsKey(service)) {
log.error(tree.serviceName.pos(), Errors.RepeatedProvidesForService(service));
}
ListBuffer<ClassSymbol> impls = new ListBuffer<>();
for (JCExpression implName : tree.implNames) {
Type it;
boolean prevVisitingServiceImplementation = env.info.visitingServiceImplementation;
try {
env.info.visitingServiceImplementation = true;
it = attr.attribType(implName, env, syms.objectType);
} finally {
env.info.visitingServiceImplementation = prevVisitingServiceImplementation;
}
ClassSymbol impl = (ClassSymbol) it.tsym;
if ((impl.flags_field & PUBLIC) == 0) {
log.error(implName.pos(), Errors.NotDefPublic(impl, impl.location()));
}
//find provider factory:
MethodSymbol factory = factoryMethod(impl);
if (factory != null) {
Type returnType = factory.type.getReturnType();
if (!types.isSubtype(returnType, st)) {
log.error(implName.pos(), Errors.ServiceImplementationProviderReturnMustBeSubtypeOfServiceInterface);
}
} else {
if (!types.isSubtype(it, st)) {
log.error(implName.pos(), Errors.ServiceImplementationMustBeSubtypeOfServiceInterface);
} else if ((impl.flags() & ABSTRACT) != 0) {
log.error(implName.pos(), Errors.ServiceImplementationIsAbstract(impl));
} else if (impl.isInner()) {
log.error(implName.pos(), Errors.ServiceImplementationIsInner(impl));
} else {
MethodSymbol constr = noArgsConstructor(impl);
if (constr == null) {
log.error(implName.pos(), Errors.ServiceImplementationDoesntHaveANoArgsConstructor(impl));
} else if ((constr.flags() & PUBLIC) == 0) {
log.error(implName.pos(), Errors.ServiceImplementationNoArgsConstructorNotPublic(impl));
}
}
}
if (it.hasTag(CLASS)) {
if (allProvides.computeIfAbsent(service, s -> new HashSet<>()).add(impl)) {
impls.append(impl);
} else {
log.error(implName.pos(), Errors.DuplicateProvides(service, impl));
}
}
}
if (st.hasTag(CLASS) && !impls.isEmpty()) {
Directive.ProvidesDirective d = new Directive.ProvidesDirective(service, impls.toList());
msym.provides = msym.provides.prepend(d);
msym.directives = msym.directives.prepend(d);
directiveToTreeMap.put(d, tree);
}
}