diff options
4 files changed, 7 insertions, 17 deletions
diff --git a/src/reflect/scala/reflect/api/Position.scala b/src/reflect/scala/reflect/api/Position.scala index 2bbc9172da..9c63e4becf 100644 --- a/src/reflect/scala/reflect/api/Position.scala +++ b/src/reflect/scala/reflect/api/Position.scala @@ -50,12 +50,12 @@ trait Position extends Attachments { type Pos >: Null <: Position /** Java file corresponding to the source file of this position. + * + * The return type is [[scala.reflect.io.AbstractFile]], which belongs to an experimental part of Scala reflection. + * It should not be used unless you know what you are doing. In subsequent releases, this API will be refined + * and exposed as a part of scala.reflect.api. */ - def fileInfo: java.io.File - - /** Content of the source file that contains this position. - */ - def fileContent: Array[Char] + def source: scala.reflect.internal.util.SourceFile /** Is this position neither a NoPosition nor a FakePosition? * If isDefined is true, offset and source are both defined. diff --git a/src/reflect/scala/reflect/internal/util/Position.scala b/src/reflect/scala/reflect/internal/util/Position.scala index 0e5bbfa940..151a64daff 100644 --- a/src/reflect/scala/reflect/internal/util/Position.scala +++ b/src/reflect/scala/reflect/internal/util/Position.scala @@ -43,16 +43,6 @@ abstract class Position extends scala.reflect.api.Position { self => def withPos(newPos: Position): Attachments { type Pos = self.Pos } = newPos - /** Java file corresponding to the source file of this position. - */ - // necessary for conformance with scala.reflect.api.Position - def fileInfo: java.io.File = source.file.file - - /** Contents of the source file that contains this position. - */ - // necessary for conformance with scala.reflect.api.Position - def fileContent: Array[Char] = source.content - /** An optional value containing the source file referred to by this position, or * None if not defined. */ diff --git a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala index 0793696fd4..5f3f61ca3f 100644 --- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala @@ -8,7 +8,7 @@ object Macros { val outer = c.Expr[SourceLocation](if (!inscope.isEmpty) inscope else Literal(Constant(null))) val Apply(fun, args) = c.enclosingImplicits(0)._2 - val fileName = fun.pos.fileInfo.getName + val fileName = fun.pos.source.file.file.getName val line = fun.pos.line val charOffset = fun.pos.point c.universe.reify { SourceLocation1(outer.splice, c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) } diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala index f89e51f560..535ec2ccf0 100644 --- a/test/files/run/macro-sip19/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19/Impls_Macros_1.scala @@ -4,7 +4,7 @@ object Macros { def impl(c: Context) = { import c.universe._ val Apply(fun, args) = c.enclosingImplicits(0)._2 - val fileName = fun.pos.fileInfo.getName + val fileName = fun.pos.source.file.file.getName val line = fun.pos.line val charOffset = fun.pos.point c.universe.reify { SourceLocation(c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) } |