当前位置: 首页>>代码示例>>Java>>正文


Java DiagnosticType类代码示例

本文整理汇总了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();
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:Log.java

示例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);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:23,代码来源:Resolve.java

示例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());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:Messager.java

示例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();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:Log.java

示例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));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:Resolve.java

示例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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:Log.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Resolve.java

示例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());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Messager.java

示例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++;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:Messager.java

示例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();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Messager.java

示例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);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:18,代码来源:Resolve.java

示例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);
    }
}
 
开发者ID:aducode,项目名称:openjdk-source-code-learn,代码行数:23,代码来源:Resolve.java

示例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);
    }
}
 
开发者ID:kohsuke,项目名称:javap,代码行数:23,代码来源:Resolve.java


注:本文中的com.sun.tools.javac.util.JCDiagnostic.DiagnosticType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。