本文整理汇总了Java中com.sun.tools.javac.util.JCDiagnostic.MultilineDiagnostic方法的典型用法代码示例。如果您正苦于以下问题:Java JCDiagnostic.MultilineDiagnostic方法的具体用法?Java JCDiagnostic.MultilineDiagnostic怎么用?Java JCDiagnostic.MultilineDiagnostic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.util.JCDiagnostic
的用法示例。
在下文中一共展示了JCDiagnostic.MultilineDiagnostic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: report
import com.sun.tools.javac.util.JCDiagnostic; //导入方法依赖的package包/类
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
try {
if (diagnostic.getKind() == Diagnostic.Kind.ERROR &&
diagnostic.getCode().equals("compiler.err.ref.ambiguous")) {
ambiguityFound = true;
} else if (diagnostic.getKind() == Diagnostic.Kind.NOTE &&
diagnostic.getCode()
.equals("compiler.note.verbose.resolve.multi")) {
ClientCodeWrapper.DiagnosticSourceUnwrapper dsu =
(ClientCodeWrapper.DiagnosticSourceUnwrapper)diagnostic;
JCDiagnostic.MultilineDiagnostic mdiag =
(JCDiagnostic.MultilineDiagnostic)dsu.d;
int mostSpecificIndex = (Integer)mdiag.getArgs()[2];
mostSpecificSig =
((JCDiagnostic)mdiag.getSubdiagnostics()
.get(mostSpecificIndex)).getArgs()[1].toString();
}
} catch (RuntimeException t) {
t.printStackTrace();
throw t;
}
}
示例2: mostSpecificSignature
import com.sun.tools.javac.util.JCDiagnostic; //导入方法依赖的package包/类
String mostSpecificSignature(Result<Iterable<? extends Element>> result) {
List<Diagnostic<? extends JavaFileObject>> rsDiag =
result.diagnosticsForKey("compiler.note.verbose.resolve.multi");
if (rsDiag.nonEmpty()) {
ClientCodeWrapper.DiagnosticSourceUnwrapper dsu =
(ClientCodeWrapper.DiagnosticSourceUnwrapper)rsDiag.head;
JCDiagnostic.MultilineDiagnostic mdiag =
(JCDiagnostic.MultilineDiagnostic)dsu.d;
int mostSpecificIndex = (Integer)mdiag.getArgs()[2];
return mdiag.getSubdiagnostics().get(mostSpecificIndex).getArgs()[1].toString();
} else {
return null;
}
}
示例3: subDiagnostics
import com.sun.tools.javac.util.JCDiagnostic; //导入方法依赖的package包/类
List<JCDiagnostic> subDiagnostics(Diagnostic<? extends JavaFileObject> diagnostic) {
JCDiagnostic diag = asJCDiagnostic(diagnostic);
if (diag instanceof JCDiagnostic.MultilineDiagnostic) {
return ((JCDiagnostic.MultilineDiagnostic)diag).getSubdiagnostics();
} else {
throw new AssertionError("Cannot extract subdiagnostics: " + diag.getClass().getName());
}
}