summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-04-01 21:25:51 -0700
committerPaul Phillips <paulp@improving.org>2013-04-03 01:29:22 -0700
commit71c14e41adc29a7c7db18c54baedd7319c63e3bc (patch)
tree8558186722698d735d6d7190c592a76462c1d582 /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
parent13bb4e5af4f2cfcbbee0ae590e0a5aed83ff50dc (diff)
downloadscala-71c14e41adc29a7c7db18c54baedd7319c63e3bc.tar.gz
scala-71c14e41adc29a7c7db18c54baedd7319c63e3bc.tar.bz2
scala-71c14e41adc29a7c7db18c54baedd7319c63e3bc.zip
Cleaning up error handling.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index bc7c129c20..1e0e0797da 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -23,6 +23,7 @@ import scala.tools.nsc.io.AbstractFile
abstract class ClassfileParser {
val global: Global
import global._
+ import definitions._
import scala.reflect.internal.ClassfileConstants._
import Flags._
@@ -108,19 +109,11 @@ abstract class ClassfileParser {
private def parseHeader() {
val magic = in.nextInt
if (magic != JAVA_MAGIC)
- throw new IOException("class file '" + in.file + "' "
- + "has wrong magic number 0x" + toHexString(magic)
- + ", should be 0x" + toHexString(JAVA_MAGIC))
- val minorVersion = in.nextChar.toInt
- val majorVersion = in.nextChar.toInt
- if ((majorVersion < JAVA_MAJOR_VERSION) ||
- ((majorVersion == JAVA_MAJOR_VERSION) &&
- (minorVersion < JAVA_MINOR_VERSION)))
- throw new IOException("class file '" + in.file + "' "
- + "has unknown version "
- + majorVersion + "." + minorVersion
- + ", should be at least "
- + JAVA_MAJOR_VERSION + "." + JAVA_MINOR_VERSION)
+ abort(s"class file ${in.file} has wrong magic number 0x${toHexString(magic)}")
+
+ val minor, major = in.nextChar.toInt
+ if (major < JAVA_MAJOR_VERSION || major == JAVA_MAJOR_VERSION && minor < JAVA_MINOR_VERSION)
+ abort(s"class file ${in.file} has unknown version $major.$minor, should be at least $JAVA_MAJOR_VERSION.$JAVA_MINOR_VERSION")
}
class ConstantPool {