当前位置: 首页>>代码示例>>Java>>正文


Java Symbol.flags方法代码示例

本文整理汇总了Java中com.sun.tools.javac.code.Symbol.flags方法的典型用法代码示例。如果您正苦于以下问题:Java Symbol.flags方法的具体用法?Java Symbol.flags怎么用?Java Symbol.flags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.code.Symbol的用法示例。


在下文中一共展示了Symbol.flags方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findSuperConstructorInType

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
/**
 * based heavily on {@link ASTHelpers#findSuperMethodInType(Symbol.MethodSymbol, Type, Types)},
 * but works for constructors
 */
@Nullable
private static Symbol.MethodSymbol findSuperConstructorInType(
    Symbol.MethodSymbol methodSymbol, Type superType, Types types) {
  Preconditions.checkArgument(methodSymbol.isConstructor(), "only accepts constructor methods");
  Scope scope = superType.tsym.members();
  for (Symbol sym : scope.getSymbolsByName(methodSymbol.name)) {
    if (sym != null
        && sym.isConstructor()
        && ((sym.flags() & Flags.SYNTHETIC) == 0)
        && hasSameArgTypes((Symbol.MethodSymbol) sym, methodSymbol, types)) {
      return (Symbol.MethodSymbol) sym;
    }
  }
  return null;
}
 
开发者ID:uber,项目名称:NullAway,代码行数:20,代码来源:NullAway.java

示例2: referenceKind

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
/**
 * Get the opcode associated with this method reference
 */
private int referenceKind(Symbol refSym) {
    if (refSym.isConstructor()) {
        return ClassFile.REF_newInvokeSpecial;
    } else {
        if (refSym.isStatic()) {
            return ClassFile.REF_invokeStatic;
        } else if ((refSym.flags() & PRIVATE) != 0) {
            return ClassFile.REF_invokeSpecial;
        } else if (refSym.enclClass().isInterface()) {
            return ClassFile.REF_invokeInterface;
        } else {
            return ClassFile.REF_invokeVirtual;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:LambdaToMethod.java

示例3: visitUses

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
@Override
public void visitUses(JCUses tree) {
    Type st = attr.attribType(tree.qualid, env, syms.objectType);
    Symbol sym = TreeInfo.symbol(tree.qualid);
    if ((sym.flags() & ENUM) != 0) {
        log.error(tree.qualid.pos(), Errors.ServiceDefinitionIsEnum(st.tsym));
    } else if (st.hasTag(CLASS)) {
        ClassSymbol service = (ClassSymbol) st.tsym;
        if (allUses.add(service)) {
            Directive.UsesDirective d = new Directive.UsesDirective(service);
            msym.uses = msym.uses.prepend(d);
            msym.directives = msym.directives.prepend(d);
        } else {
            log.error(tree.pos(), Errors.DuplicateUses(service));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Modules.java

示例4: className

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
/**
 * Converts a class name into a (possibly localized) string. Anonymous inner
 * classes get converted into a localized string.
 *
 * @param t the type of the class whose name is to be rendered
 * @param longform if set, the class' fullname is displayed - if unset the
 * short name is chosen (w/o package)
 * @param locale the locale in which the string is to be rendered
 * @return localized string representation
 */
@Override
protected String className(ClassType t, boolean longform, Locale locale) {
    Symbol sym = t.tsym;
    if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
        return OBJECT;
    } else if (sym.name.length() == 0) {
        // Anonymous
        String s;
        ClassType norm = (ClassType) t.tsym.type;
        if (norm == null) {
            s = OBJECT;
        } else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
            s = visit(norm.interfaces_field.head, locale);
        } else {
            s = visit(norm.supertype_field, locale);
        }
        return s;
    } else if (longform) {
        String pkg = "";
        for (Symbol psym = sym; psym != null; psym = psym.owner) {
            if (psym.kind == PCK) {
                pkg = psym.getQualifiedName().toString();
                break;
            }
        }
        return fullClassNameAndPackageToClass.apply(
                sym.getQualifiedName().toString(),
                pkg
        );
    } else {
        return sym.name.toString();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:44,代码来源:TypePrinter.java

示例5: process

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
@Override
void process(Diagnostic<? extends JavaFileObject> diagnostic) {
    Symbol methodSym = (Symbol)methodSym(diagnostic);
    if ((methodSym.flags() & Flags.GENERATEDCONSTR) != 0) {
        //skip resolution of default constructor (put there by javac)
        return;
    }
    Candidate c = getCandidateAtPos(methodSym,
            asJCDiagnostic(diagnostic).getLineNumber(),
            asJCDiagnostic(diagnostic).getColumnNumber());
    if (c == null) {
        return; //nothing to check
    }

    if (c.applicable().length == 0 && c.mostSpecific()) {
        error("Inapplicable method cannot be most specific " + methodSym);
    }

    if (isApplicable(diagnostic) != Arrays.asList(c.applicable()).contains(phase)) {
        error("Invalid candidate's applicability " + methodSym);
    }

    if (success) {
        for (Phase p : c.applicable()) {
            if (phase.ordinal() < p.ordinal()) {
                error("Invalid phase " + p + " on method " + methodSym);
            }
        }
    }

    if (Arrays.asList(c.applicable()).contains(phase)) { //applicable
        if (c.mostSpecific() != mostSpecific) {
            error("Invalid most specific value for method " + methodSym + " " + new ElementKey(methodSym).key);
        }
        MethodType mtype = getSig(diagnostic);
        if (mtype != null) {
            checkSig(c, methodSym, mtype);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:41,代码来源:ResolveHarness.java

示例6: hasFlag

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
static private boolean hasFlag(Symbol m, int flag) {
    return (m.flags() & flag) != 0;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:JNIWriter.java

示例7: isSynthetic

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
boolean isSynthetic(Symbol sym) {
    return (sym.flags() & Flags.SYNTHETIC) != 0;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ToolEnvironment.java

示例8: unwanted

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
/**
 * Tests whether this is a symbol that should never be seen by
 * clients, such as a synthetic class.  Returns true for null.
 */
private static boolean unwanted(Symbol s) {
    return s == null  ||  (s.flags() & SYNTHETIC) != 0;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:8,代码来源:FilteredMemberList.java


注:本文中的com.sun.tools.javac.code.Symbol.flags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。