本文整理汇总了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();
}
示例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();
}
示例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();
}