public int endPos(JCTree tree) {
            if (tree == null) return Position.NOPOS;
            if (tree.getTag() == JCTree.BLOCK)
                return ((JCBlock) tree).endpos;
            Integer endpos = endPositions.get(tree);
            if (endpos != null)
                return endpos.intValue();
            return Position.NOPOS;
        }