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


Java Identifier.isInner方法代码示例

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


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

示例1: mangleClass

import sun.tools.java.Identifier; //导入方法依赖的package包/类
/**
 * If necessary, convert a class name to its mangled form, i.e. the
 * non-inner class name used in the binary representation of
 * inner classes.  This is necessary to be able to name inner
 * classes in the generated source code in places where the language
 * does not permit it, such as when synthetically defining an inner
 * class outside of its outer class, and for generating file names
 * corresponding to inner classes.
 *
 * Currently this mangling involves modifying the internal names of
 * inner classes by converting occurrences of ". " into "$".
 *
 * This code is taken from the "mangleInnerType" method of
 * the "sun.tools.java.Type" class; this method cannot be accessed
 * itself because it is package protected.
 */
static final public Identifier mangleClass(Identifier className) {
    if (!className.isInner())
        return className;

    /*
     * Get '.' qualified inner class name (with outer class
     * qualification and no package qualification) and replace
     * each '.' with '$'.
     */
    Identifier mangled = Identifier.lookup(
                                           className.getFlatName().toString()
                                           .replace('.', sun.tools.java.Constants.SIGC_INNERCLASS));
    if (mangled.isInner())
        throw new Error("failed to mangle inner class name");

    // prepend package qualifier back for returned identifier
    return Identifier.lookup(className.getQualifier(), mangled);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:Names.java


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