Skip to content

Commit de7b370

Browse files
authored
Merge pull request #3256 from dotty-staging/change-unpickle-diag
Improve diagnostics for bad Tasty files
2 parents 60be656 + b0e3b67 commit de7b370

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ClassfileParser(
5454
private def currentIsTopLevel(implicit ctx: Context) = classRoot.owner is Flags.PackageClass
5555

5656
private def mismatchError(className: SimpleName) =
57-
throw new IOException(s"class file '${in.file}' has location not matching its contents: contains class $className")
57+
throw new IOException(s"class file '${in.file.file.getAbsolutePath}' has location not matching its contents: contains class $className")
5858

5959
def run()(implicit ctx: Context): Option[Embedded] = try {
6060
ctx.debuglog("[class] >> " + classRoot.fullName)
@@ -65,7 +65,7 @@ class ClassfileParser(
6565
case e: RuntimeException =>
6666
if (ctx.debug) e.printStackTrace()
6767
throw new IOException(
68-
i"""class file $classfile is broken, reading aborted with ${e.getClass}
68+
i"""class file ${classfile.file.getAbsolutePath} is broken, reading aborted with ${e.getClass}
6969
|${Option(e.getMessage).getOrElse("")}""")
7070
}
7171

compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import NameKinds._
1010
import java.util.UUID
1111

1212
object TastyUnpickler {
13-
class UnpickleException(msg: String) extends Exception(msg)
13+
class UnpickleException(msg: String) extends RuntimeException(msg)
1414

1515
abstract class SectionUnpickler[R](val name: String) {
1616
def unpickle(reader: TastyReader, nameAtRef: NameTable): R

0 commit comments

Comments
 (0)