本文整理汇总了Java中com.sun.tools.javac.util.JCDiagnostic.DiagnosticType类的典型用法代码示例。如果您正苦于以下问题:Java DiagnosticType类的具体用法?Java DiagnosticType怎么用?Java DiagnosticType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DiagnosticType类属于com.sun.tools.javac.util.JCDiagnostic包,在下文中一共展示了DiagnosticType类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWriterForDiagnosticType
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
@Deprecated
protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) {
switch (dt) {
case FRAGMENT:
throw new IllegalArgumentException();
case NOTE:
return noticeWriter;
case WARNING:
return warnWriter;
case ERROR:
return errWriter;
default:
throw new Error();
}
}
示例2: getDiagnostic
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
@Override
JCDiagnostic getDiagnostic(DiagnosticType dkind,
DiagnosticPosition pos,
Symbol location,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes) {
if (candidates.nonEmpty()) {
JCDiagnostic err = diags.create(dkind,
log.currentSource(),
pos,
"cant.apply.symbols",
name == names.init ? KindName.CONSTRUCTOR : absentKind(kind),
getName(),
argtypes);
return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(site));
} else {
return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
location, site, name, argtypes, typeargtypes);
}
}
示例3: report
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
private void report(DiagnosticType type, SourcePosition pos, String msg) {
switch (type) {
case ERROR:
case WARNING:
Object prefix = (pos == null) ? programName : pos;
report(javadocDiags.create(type, null, null, "msg", prefix, msg));
break;
case NOTE:
String key = (pos == null) ? "msg" : "pos.msg";
report(javadocDiags.create(type, null, null, key, pos, msg));
break;
default:
throw new IllegalArgumentException(type.toString());
}
}
示例4: getWriterForDiagnosticType
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
@Deprecated
protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) {
switch (dt) {
case FRAGMENT:
throw new IllegalArgumentException();
case NOTE:
return noticeWriter;
case WARNING:
return warnWriter;
case ERROR:
return errWriter;
default:
throw new Error();
}
}
示例5: getDiagnostic
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
@Override
JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
DiagnosticPosition pos,
Symbol location,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes) {
List<Symbol> diagSyms = ambiguousSyms.reverse();
Symbol s1 = diagSyms.head;
Symbol s2 = diagSyms.tail.head;
Name sname = s1.name;
if (sname == names.init) sname = s1.owner.name;
return diags.create(dkind, log.currentSource(),
pos, "ref.ambiguous", sname,
kindName(s1),
s1,
s1.location(site, types),
kindName(s2),
s2,
s2.location(site, types));
}
示例6: getWriterForDiagnosticType
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
@Deprecated
protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt) {
switch (dt) {
case FRAGMENT:
throw new IllegalArgumentException();
case NOTE:
return writers.get(WriterKind.NOTICE);
case WARNING:
return writers.get(WriterKind.WARNING);
case ERROR:
return writers.get(WriterKind.ERROR);
default:
throw new Error();
}
}
示例7: getDiagnostic
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
@Override
JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos,
Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
JCDiagnostic details = getDetails();
if (details != null && compactMethodDiags) {
JCDiagnostic simpleDiag =
MethodResolutionDiagHelper.rewrite(diags, pos, log.currentSource(), dkind, details);
if (simpleDiag != null) {
return simpleDiag;
}
}
String key = details == null ?
"cant.apply.diamond" :
"cant.apply.diamond.1";
return diags.create(dkind, log.currentSource(), pos, key,
Fragments.Diamond(site.tsym), details);
}
示例8: report
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
private void report(DiagnosticType type, String pos, String msg) {
switch (type) {
case ERROR:
case WARNING:
Object prefix = (pos == null) ? programName : pos;
report(javadocDiags.create(type, null, null, "msg", prefix, msg));
break;
case NOTE:
String key = (pos == null) ? "msg" : "pos.msg";
report(javadocDiags.create(type, null, null, key, pos, msg));
break;
default:
throw new IllegalArgumentException(type.toString());
}
}
示例9: printError
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
/**
* Print error message, increment error count.
* Part of DocErrorReporter.
*
* @param pos the position where the error occurs
* @param msg message to print
*/
public void printError(SourcePosition pos, String msg) {
if (diagListener != null) {
report(DiagnosticType.ERROR, pos, msg);
return;
}
if (nerrors < MaxErrors) {
String prefix = (pos == null) ? programName : pos.toString();
PrintWriter errWriter = getWriter(WriterKind.ERROR);
errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
errWriter.flush();
prompt();
nerrors++;
}
}
示例10: printNotice
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
/**
* Print a message.
* Part of DocErrorReporter.
*
* @param pos the position where the error occurs
* @param msg message to print
*/
public void printNotice(SourcePosition pos, String msg) {
if (diagListener != null) {
report(DiagnosticType.NOTE, pos, msg);
return;
}
PrintWriter noticeWriter = getWriter(WriterKind.NOTICE);
if (pos == null)
noticeWriter.println(msg);
else
noticeWriter.println(pos + ": " + msg);
noticeWriter.flush();
}
示例11: getDiagnostic
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
@Override
JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos,
Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
JCDiagnostic details = getDetails();
if (details != null && compactMethodDiags) {
JCDiagnostic simpleDiag =
MethodResolutionDiagHelper.rewrite(diags, pos, log.currentSource(), dkind, details);
if (simpleDiag != null) {
return simpleDiag;
}
}
String key = details == null ?
"cant.apply.diamond" :
"cant.apply.diamond.1";
return diags.create(dkind, log.currentSource(), pos, key,
diags.fragment("diamond", site.tsym), details);
}
示例12: getDiagnostic
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
@Override
JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
DiagnosticPosition pos,
Symbol location,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes) {
if (candidates.nonEmpty()) {
JCDiagnostic err = diags.create(dkind,
log.currentSource(),
pos,
"cant.apply.symbols",
name == names.init ? KindName.CONSTRUCTOR : absentKind(kind),
getName(),
argtypes);
return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(site));
} else {
return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
location, site, name, argtypes, typeargtypes);
}
}
示例13: getDiagnostic
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; //导入依赖的package包/类
@Override
JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
DiagnosticPosition pos,
Symbol location,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes) {
if (!candidates.isEmpty()) {
JCDiagnostic err = diags.create(dkind,
log.currentSource(),
pos,
"cant.apply.symbols",
name == names.init ? KindName.CONSTRUCTOR : absentKind(kind),
getName(),
argtypes);
return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(site));
} else {
return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
location, site, name, argtypes, typeargtypes);
}
}