本文整理汇总了Java中com.sun.tools.javac.file.Locations类的典型用法代码示例。如果您正苦于以下问题:Java Locations类的具体用法?Java Locations怎么用?Java Locations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Locations类属于com.sun.tools.javac.file包,在下文中一共展示了Locations类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DocletInvoker
import com.sun.tools.javac.file.Locations; //导入依赖的package包/类
public DocletInvoker(Messager messager, JavaFileManager fileManager,
String docletClassName, String docletPath,
ClassLoader docletParentClassLoader,
boolean apiMode) {
this.messager = messager;
this.docletClassName = docletClassName;
this.apiMode = apiMode;
if (fileManager != null && fileManager.hasLocation(DocumentationTool.Location.DOCLET_PATH)) {
appClassLoader = fileManager.getClassLoader(DocumentationTool.Location.DOCLET_PATH);
} else {
// construct class loader
String cpString = null; // make sure env.class.path defaults to dot
// do prepends to get correct ordering
cpString = appendPath(System.getProperty("env.class.path"), cpString);
cpString = appendPath(System.getProperty("java.class.path"), cpString);
cpString = appendPath(docletPath, cpString);
URL[] urls = Locations.pathToURLs(cpString);
if (docletParentClassLoader == null)
appClassLoader = new URLClassLoader(urls, getDelegationClassLoader(docletClassName));
else
appClassLoader = new URLClassLoader(urls, docletParentClassLoader);
}
// attempt to find doclet
Class<?> dc = null;
try {
dc = appClassLoader.loadClass(docletClassName);
} catch (ClassNotFoundException exc) {
messager.error(Messager.NOPOS, "main.doclet_class_not_found", docletClassName);
messager.exit();
}
docletClass = dc;
}
示例2: createLocations
import com.sun.tools.javac.file.Locations; //导入依赖的package包/类
protected Locations createLocations() {
return new Locations();
}