本文整理汇总了Java中com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper类的典型用法代码示例。如果您正苦于以下问题:Java DiagnosticSourceUnwrapper类的具体用法?Java DiagnosticSourceUnwrapper怎么用?Java DiagnosticSourceUnwrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DiagnosticSourceUnwrapper类属于com.sun.tools.javac.api.ClientCodeWrapper包,在下文中一共展示了DiagnosticSourceUnwrapper类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: asJCDiagnostic
import com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper; //导入依赖的package包/类
JCDiagnostic asJCDiagnostic(Diagnostic<? extends JavaFileObject> diagnostic) {
if (diagnostic instanceof JCDiagnostic) {
return (JCDiagnostic)diagnostic;
} else if (diagnostic instanceof DiagnosticSourceUnwrapper) {
return ((DiagnosticSourceUnwrapper)diagnostic).d;
} else {
throw new AssertionError("Cannot convert diagnostic to JCDiagnostic: " + diagnostic.getClass().getName());
}
}
示例2: report
import com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper; //导入依赖的package包/类
public void report(Diagnostic message) {
if (!(message instanceof DiagnosticSourceUnwrapper)) {
throw new AssertionError("Wrapped diagnostic expected!");
}
String actual = message.toString();
JCDiagnostic jd = (JCDiagnostic)((DiagnosticSourceUnwrapper)message).d;
String expected = jd.toString();
if (!actual.equals(expected)) {
throw new AssertionError("expected = " + expected + "\nfound = " + actual);
}
}