Ejemplo n.º 1
0
 /** {@inheritDoc} */
 public String getDocComment() {
   // Our doc comment is contained in a map in our toplevel,
   // indexed by our tree.  Find our enter environment, which gives
   // us our toplevel.  It also gives us a tree that contains our
   // tree:  walk it to find our tree.  This is painful.
   Env<AttrContext> enterEnv = getEnterEnv();
   if (enterEnv == null) return null;
   JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
   return enterEnv.toplevel.docComments.get(tree);
 }
Ejemplo n.º 2
0
  /** {@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);
  }