37 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
37 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
38 import com.sun.tools.javac.util.List; |
38 import com.sun.tools.javac.util.List; |
39 import com.sun.tools.javac.code.*; |
39 import com.sun.tools.javac.code.*; |
40 import com.sun.tools.javac.code.Scope.*; |
40 import com.sun.tools.javac.code.Scope.*; |
41 import com.sun.tools.javac.code.Symbol.*; |
41 import com.sun.tools.javac.code.Symbol.*; |
|
42 import com.sun.tools.javac.parser.EndPosTable; |
42 import com.sun.source.tree.*; |
43 import com.sun.source.tree.*; |
43 |
44 |
44 import static com.sun.tools.javac.code.BoundKind.*; |
45 import static com.sun.tools.javac.code.BoundKind.*; |
45 import static com.sun.tools.javac.tree.JCTree.Tag.*; |
46 import static com.sun.tools.javac.tree.JCTree.Tag.*; |
46 |
47 |
448 public int getPreferredPosition() { |
449 public int getPreferredPosition() { |
449 return pos; |
450 return pos; |
450 } |
451 } |
451 |
452 |
452 // for default DiagnosticPosition |
453 // for default DiagnosticPosition |
453 public int getEndPosition(Map<JCTree, Integer> endPosTable) { |
454 public int getEndPosition(EndPosTable endPosTable) { |
454 return TreeInfo.getEndPos(this, endPosTable); |
455 return TreeInfo.getEndPos(this, endPosTable); |
455 } |
456 } |
456 |
457 |
457 /** |
458 /** |
458 * Everything in one source file is kept in a TopLevel structure. |
459 * Everything in one source file is kept in a TopLevel structure. |
465 * @param lineMap Line starting positions, defined only |
466 * @param lineMap Line starting positions, defined only |
466 * if option -g is set. |
467 * if option -g is set. |
467 * @param docComments A hashtable that stores all documentation comments |
468 * @param docComments A hashtable that stores all documentation comments |
468 * indexed by the tree nodes they refer to. |
469 * indexed by the tree nodes they refer to. |
469 * defined only if option -s is set. |
470 * defined only if option -s is set. |
470 * @param endPositions A hashtable that stores ending positions of source |
471 * @param endPositions An object encapsulating ending positions of source |
471 * ranges indexed by the tree nodes they belong to. |
472 * ranges indexed by the tree nodes they belong to. |
472 * Defined only if option -Xjcov is set. |
473 * Defined only if option -Xjcov is set. |
473 */ |
474 */ |
474 public static class JCCompilationUnit extends JCTree implements CompilationUnitTree { |
475 public static class JCCompilationUnit extends JCTree implements CompilationUnitTree { |
475 public List<JCAnnotation> packageAnnotations; |
476 public List<JCAnnotation> packageAnnotations; |
479 public PackageSymbol packge; |
480 public PackageSymbol packge; |
480 public ImportScope namedImportScope; |
481 public ImportScope namedImportScope; |
481 public StarImportScope starImportScope; |
482 public StarImportScope starImportScope; |
482 public Position.LineMap lineMap = null; |
483 public Position.LineMap lineMap = null; |
483 public Map<JCTree, String> docComments = null; |
484 public Map<JCTree, String> docComments = null; |
484 public Map<JCTree, Integer> endPositions = null; |
485 public EndPosTable endPositions = null; |
485 protected JCCompilationUnit(List<JCAnnotation> packageAnnotations, |
486 protected JCCompilationUnit(List<JCAnnotation> packageAnnotations, |
486 JCExpression pid, |
487 JCExpression pid, |
487 List<JCTree> defs, |
488 List<JCTree> defs, |
488 JavaFileObject sourcefile, |
489 JavaFileObject sourcefile, |
489 PackageSymbol packge, |
490 PackageSymbol packge, |