src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java

changeset 303
8ec37cf2b37e
parent 100
37551dc0f591
child 415
49359d0e6a9c
     1.1 --- a/src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java	Wed Jun 24 10:50:27 2009 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/util/DiagnosticSource.java	Wed Jun 24 10:50:54 2009 +0100
     1.3 @@ -46,11 +46,22 @@
     1.4   *  deletion without notice.</b>
     1.5   */
     1.6  public class DiagnosticSource {
     1.7 +
     1.8 +    /* constant DiagnosticSource to be used when sourcefile is missing */
     1.9 +    public static final DiagnosticSource NO_SOURCE = new DiagnosticSource() {
    1.10 +        @Override
    1.11 +        protected boolean findLine(int pos) {
    1.12 +            return false;
    1.13 +        }
    1.14 +    };
    1.15 +
    1.16      public DiagnosticSource(JavaFileObject fo, AbstractLog log) {
    1.17          this.fileObject = fo;
    1.18          this.log = log;
    1.19      }
    1.20  
    1.21 +    private DiagnosticSource() {}
    1.22 +
    1.23      /** Return the underlying file object handled by this
    1.24       *  DiagnosticSource object.
    1.25       */
    1.26 @@ -134,7 +145,7 @@
    1.27      /** Find the line in the buffer that contains the current position
    1.28       * @param pos      Character offset into the buffer
    1.29       */
    1.30 -    private boolean findLine(int pos) {
    1.31 +    protected boolean findLine(int pos) {
    1.32          if (pos == Position.NOPOS)
    1.33              return false;
    1.34  

mercurial