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


Java Symbol.getSimpleName方法代码示例

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


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

示例1: attributeParamIdentifier

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
private Symbol attributeParamIdentifier(TreePath path, DCParam ptag) {
    Symbol javadocSymbol = getElement(path);
    if (javadocSymbol == null)
        return null;
    ElementKind kind = javadocSymbol.getKind();
    List<? extends Symbol> params = List.nil();
    if (kind == ElementKind.METHOD || kind == ElementKind.CONSTRUCTOR) {
        MethodSymbol ee = (MethodSymbol) javadocSymbol;
        params = ptag.isTypeParameter()
                ? ee.getTypeParameters()
                : ee.getParameters();
    } else if (kind.isClass() || kind.isInterface()) {
        ClassSymbol te = (ClassSymbol) javadocSymbol;
        params = te.getTypeParameters();
    }

    for (Symbol param : params) {
        if (param.getSimpleName() == ptag.getName().getName()) {
            return param;
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:JavacTrees.java

示例2: addUsage

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
/**
 * Add a name usage to the simplifier's internal cache
 */
protected void addUsage(Symbol sym) {
    Name n = sym.getSimpleName();
    List<Symbol> conflicts = nameClashes.get(n);
    if (conflicts == null) {
        conflicts = List.nil();
    }
    if (!conflicts.contains(sym))
        nameClashes.put(n, conflicts.append(sym));
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:13,代码来源:RichDiagnosticFormatter.java

示例3: writeMethods

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
protected void writeMethods(PrintWriter out, ClassSymbol sym, String cname)
        throws IOException, TypeSignature.SignatureException {
    List<Symbol> classmethods = sym.getEnclosedElements();
    for (Symbol md : classmethods) {
        if (isNative(md)) {
            TypeSignature newtypesig = new TypeSignature(types);
            CharSequence methodName = md.getSimpleName();
            boolean isOverloaded = false;
            for (Symbol md2 : classmethods) {
                if ((md2 != md)
                        && (methodName.equals(md2.getSimpleName()))
                        && isNative(md2)) {
                    isOverloaded = true;
                }
            }
            out.println("/*");
            out.println(" * Class:     " + cname);
            out.println(" * Method:    " + encode(methodName, EncoderType.FIELDSTUB));
            out.println(" * Signature: " + newtypesig.getSignature(md.type));
            out.println(" */");
            out.println("JNIEXPORT " + jniType(types.erasure(md.type.getReturnType()))
                    + " JNICALL " + encodeMethod(md, sym, isOverloaded));
            out.print("  (JNIEnv *, ");
            out.print((md.isStatic())
                    ? "jclass"
                    : "jobject");
            for (Type arg : types.erasure(md.type.getParameterTypes())) {
                out.print(", ");
                out.print(jniType(arg));
            }
            out.println(");");
            out.println();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:JNIWriter.java


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