src/share/classes/com/sun/tools/apt/mirror/util/SourcePositionImpl.java

Print this page




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package com.sun.tools.apt.mirror.util;
  27 
  28 
  29 import java.io.File;
  30 import javax.tools.JavaFileObject;
  31 
  32 import com.sun.mirror.util.SourcePosition;
  33 import com.sun.tools.javac.util.Position;
  34 
  35 
  36 /**
  37  * Implementation of SourcePosition
  38  */
  39 
  40 public class SourcePositionImpl implements SourcePosition {
  41 
  42     private JavaFileObject sourcefile;
  43     private int pos;            // file position, in javac's internal format
  44     private Position.LineMap linemap;
  45 
  46 
  47     public SourcePositionImpl(JavaFileObject sourcefile, int pos, Position.LineMap linemap) {
  48         this.sourcefile = sourcefile;
  49         this.pos = pos;
  50         this.linemap = linemap;
  51         assert sourcefile != null;
  52         assert linemap != null;
  53     }
  54 
  55     public int getJavacPosition() {
  56         return pos;
  57     }
  58 
  59     public JavaFileObject getSource() {




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package com.sun.tools.apt.mirror.util;
  27 
  28 
  29 import java.io.File;
  30 import javax.tools.JavaFileObject;
  31 
  32 import com.sun.mirror.util.SourcePosition;
  33 import com.sun.tools.javac.util.Position;
  34 
  35 
  36 /**
  37  * Implementation of SourcePosition
  38  */
  39 @SuppressWarnings("deprecation")
  40 public class SourcePositionImpl implements SourcePosition {
  41 
  42     private JavaFileObject sourcefile;
  43     private int pos;            // file position, in javac's internal format
  44     private Position.LineMap linemap;
  45 
  46 
  47     public SourcePositionImpl(JavaFileObject sourcefile, int pos, Position.LineMap linemap) {
  48         this.sourcefile = sourcefile;
  49         this.pos = pos;
  50         this.linemap = linemap;
  51         assert sourcefile != null;
  52         assert linemap != null;
  53     }
  54 
  55     public int getJavacPosition() {
  56         return pos;
  57     }
  58 
  59     public JavaFileObject getSource() {