本文整理汇总了Java中com.sun.tools.javadoc.Messager类的典型用法代码示例。如果您正苦于以下问题:Java Messager类的具体用法?Java Messager怎么用?Java Messager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Messager类属于com.sun.tools.javadoc包,在下文中一共展示了Messager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDirectAccess1
import com.sun.tools.javadoc.Messager; //导入依赖的package包/类
@Test
public void testDirectAccess1() throws Exception {
JavaFileObject srcFile = createSimpleJavaFileObject();
Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
Context c = new Context();
Messager.preRegister(c, "javadoc");
StandardJavaFileManager fm = new JavacFileManager(c, true, null);
File outDir = getOutDir();
fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
DocumentationTask t = new JavadocTaskImpl(c, null, null, files);
if (t.call()) {
System.err.println("task succeeded");
} else {
throw new Exception("task failed");
}
}
示例2: testDirectAccess2
import com.sun.tools.javadoc.Messager; //导入依赖的package包/类
@Test
public void testDirectAccess2() throws Exception {
JavaFileObject srcFile = null; // error, provokes NPE
Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
Context c = new Context();
Messager.preRegister(c, "javadoc");
StandardJavaFileManager fm = new JavacFileManager(c, true, null);
File outDir = getOutDir();
fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
try {
DocumentationTask t = new JavadocTaskImpl(c, null, null, files);;
error("getTask succeeded, no exception thrown");
} catch (NullPointerException e) {
System.err.println("exception caught as expected: " + e);
}
}
示例3: Start
import com.sun.tools.javadoc.Messager; //导入依赖的package包/类
Start(String programName,
PrintWriter errWriter,
PrintWriter warnWriter,
PrintWriter noticeWriter,
String defaultDocletClassName) {
context = new Context();
messager = new Messager(context, programName, errWriter, warnWriter, noticeWriter);
this.defaultDocletClassName = defaultDocletClassName;
}