Search in sources :

Example 1 with SourcePositionImpl

use of com.sun.tools.apt.mirror.util.SourcePositionImpl in project ceylon-compiler by ceylon.

the class MessagerImpl method printError.

/**
     * {@inheritDoc}
     */
public void printError(SourcePosition pos, String msg) {
    if (pos instanceof SourcePositionImpl) {
        SourcePositionImpl posImpl = (SourcePositionImpl) pos;
        JavaFileObject prev = bark.useSource(posImpl.getSource());
        bark.aptError(posImpl.getJavacPosition(), "Messager", msg);
        bark.useSource(prev);
    } else
        printError(msg);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) SourcePositionImpl(com.sun.tools.apt.mirror.util.SourcePositionImpl)

Example 2 with SourcePositionImpl

use of com.sun.tools.apt.mirror.util.SourcePositionImpl in project ceylon-compiler by ceylon.

the class MessagerImpl method printNotice.

/**
     * {@inheritDoc}
     */
public void printNotice(SourcePosition pos, String msg) {
    if (pos instanceof SourcePositionImpl) {
        SourcePositionImpl posImpl = (SourcePositionImpl) pos;
        JavaFileObject prev = bark.useSource(posImpl.getSource());
        bark.aptNote(posImpl.getJavacPosition(), "Messager", msg);
        bark.useSource(prev);
    } else
        printNotice(msg);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) SourcePositionImpl(com.sun.tools.apt.mirror.util.SourcePositionImpl)

Example 3 with SourcePositionImpl

use of com.sun.tools.apt.mirror.util.SourcePositionImpl in project ceylon-compiler by ceylon.

the class DeclarationImpl method getPosition.

/**
     * {@inheritDoc}
     */
public SourcePosition getPosition() {
    // Find the toplevel.  From there use a tree-walking utility
    // that finds the tree for our symbol, and with it the position.
    Env<AttrContext> enterEnv = getEnterEnv();
    if (enterEnv == null)
        return null;
    JCTree.JCCompilationUnit toplevel = enterEnv.toplevel;
    JavaFileObject sourcefile = toplevel.sourcefile;
    if (sourcefile == null)
        return null;
    int pos = TreeInfo.positionFor(sym, toplevel);
    return new SourcePositionImpl(sourcefile, pos, toplevel.lineMap);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) SourcePositionImpl(com.sun.tools.apt.mirror.util.SourcePositionImpl) AttrContext(com.sun.tools.javac.comp.AttrContext)

Example 4 with SourcePositionImpl

use of com.sun.tools.apt.mirror.util.SourcePositionImpl in project ceylon-compiler by ceylon.

the class MessagerImpl method printWarning.

/**
     * {@inheritDoc}
     */
public void printWarning(SourcePosition pos, String msg) {
    if (pos instanceof SourcePositionImpl) {
        SourcePositionImpl posImpl = (SourcePositionImpl) pos;
        JavaFileObject prev = bark.useSource(posImpl.getSource());
        bark.aptWarning(posImpl.getJavacPosition(), "Messager", msg);
        bark.useSource(prev);
    } else
        printWarning(msg);
}
Also used : JavaFileObject(javax.tools.JavaFileObject) SourcePositionImpl(com.sun.tools.apt.mirror.util.SourcePositionImpl)

Aggregations

SourcePositionImpl (com.sun.tools.apt.mirror.util.SourcePositionImpl)4 JavaFileObject (javax.tools.JavaFileObject)4 AttrContext (com.sun.tools.javac.comp.AttrContext)1