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


Java Convert.packagePart方法代码示例

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


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

示例1: enterClassFiles

import com.sun.tools.javac.util.Convert; //导入方法依赖的package包/类
/** Enter a set of generated class files. */
private List<ClassSymbol> enterClassFiles(Map<String, JavaFileObject> classFiles) {
    ClassReader reader = ClassReader.instance(context);
    Names names = Names.instance(context);
    List<ClassSymbol> list = List.nil();

    for (Map.Entry<String,JavaFileObject> entry : classFiles.entrySet()) {
        Name name = names.fromString(entry.getKey());
        JavaFileObject file = entry.getValue();
        if (file.getKind() != JavaFileObject.Kind.CLASS)
            throw new AssertionError(file);
        ClassSymbol cs;
        if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
            Name packageName = Convert.packagePart(name);
            PackageSymbol p = reader.enterPackage(packageName);
            if (p.package_info == null)
                p.package_info = reader.enterClass(Convert.shortName(name), p);
            cs = p.package_info;
            if (cs.classfile == null)
                cs.classfile = file;
        } else
            cs = reader.enterClass(name, file);
        list = list.prepend(cs);
    }
    return list.reverse();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:27,代码来源:JavacProcessingEnvironment.java

示例2: enterClassFiles

import com.sun.tools.javac.util.Convert; //导入方法依赖的package包/类
/** Enter a set of generated class files. */
private List<ClassSymbol> enterClassFiles(Map<ModuleSymbol, Map<String, JavaFileObject>> modulesAndClassFiles) {
    List<ClassSymbol> list = List.nil();

    for (Entry<ModuleSymbol, Map<String, JavaFileObject>> moduleAndClassFiles : modulesAndClassFiles.entrySet()) {
        for (Map.Entry<String,JavaFileObject> entry : moduleAndClassFiles.getValue().entrySet()) {
            Name name = names.fromString(entry.getKey());
            JavaFileObject file = entry.getValue();
            if (file.getKind() != JavaFileObject.Kind.CLASS)
                throw new AssertionError(file);
            ClassSymbol cs;
            if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
                Name packageName = Convert.packagePart(name);
                PackageSymbol p = symtab.enterPackage(moduleAndClassFiles.getKey(), packageName);
                if (p.package_info == null)
                    p.package_info = symtab.enterClass(moduleAndClassFiles.getKey(), Convert.shortName(name), p);
                cs = p.package_info;
                cs.reset();
                if (cs.classfile == null)
                    cs.classfile = file;
                cs.completer = initialCompleter;
            } else {
                cs = symtab.enterClass(moduleAndClassFiles.getKey(), name);
                cs.reset();
                cs.classfile = file;
                cs.completer = initialCompleter;
                cs.owner.members().enter(cs); //XXX - OverwriteBetweenCompilations; syms.getClass is not sufficient anymore
            }
            list = list.prepend(cs);
        }
    }
    return list.reverse();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:JavacProcessingEnvironment.java

示例3: enterClassFiles

import com.sun.tools.javac.util.Convert; //导入方法依赖的package包/类
/** Enter a set of generated class files. */
private List<ClassSymbol> enterClassFiles(Map<String, JavaFileObject> classFiles) {
    List<ClassSymbol> list = List.nil();

    for (Map.Entry<String,JavaFileObject> entry : classFiles.entrySet()) {
        Name name = names.fromString(entry.getKey());
        JavaFileObject file = entry.getValue();
        if (file.getKind() != JavaFileObject.Kind.CLASS)
            throw new AssertionError(file);
        ClassSymbol cs;
        // TODO: for now, we assume that generated code is in a default module;
        // in time, we need a way to be able to specify the module for generated code
        if (isPkgInfo(file, JavaFileObject.Kind.CLASS)) {
            Name packageName = Convert.packagePart(name);
            PackageSymbol p = symtab.enterPackage(defaultModule, packageName);
            if (p.package_info == null)
                p.package_info = symtab.enterClass(defaultModule, Convert.shortName(name), p);
            cs = p.package_info;
            cs.reset();
            if (cs.classfile == null)
                cs.classfile = file;
            cs.completer = initialCompleter;
        } else {
            cs = symtab.enterClass(defaultModule, name);
            cs.reset();
            cs.classfile = file;
            cs.completer = initialCompleter;
            cs.owner.members().enter(cs); //XXX - OverwriteBetweenCompilations; syms.getClass is not sufficient anymore
        }
        list = list.prepend(cs);
    }
    return list.reverse();
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:34,代码来源:JavacProcessingEnvironment.java


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