Permalink
Browse files

Revert "Revert "Work around scalac issue causing boxing." (ClassNotFo…

…undException)" (reverted wrong commit)

This reverts commit b60f6eb.
  • Loading branch information...
1 parent b60f6eb commit 130563ccbf777569ab26b3b465a5df93d989d237 @harrah committed Apr 18, 2012
Showing with 12 additions and 10 deletions.
  1. +12 −10 util/classfile/Parser.scala
@@ -5,6 +5,7 @@ package sbt
package classfile
import java.io.{DataInputStream, File, InputStream}
+import scala.annotation.switch
// Translation of jdepend.framework.ClassFileParser by Mike Clark, Clarkware Consulting, Inc.
// BSD Licensed
@@ -132,17 +133,18 @@ private[sbt] object Parser
pool
}
- private def getConstant(in: DataInputStream) =
- {
+ private def getConstant(in: DataInputStream): Constant =
+ {
val tag = in.readByte()
- tag match
- {
- case ConstantClass | ConstantString => new Constant(tag, in.readUnsignedShort())
- case ConstantField | ConstantMethod | ConstantInterfaceMethod | ConstantNameAndType =>
- new Constant(tag, in.readUnsignedShort(), in.readUnsignedShort())
- case ConstantInteger => new Constant(tag, new java.lang.Integer(in.readInt()))
- case ConstantFloat => new Constant(tag, new java.lang.Float(in.readFloat()))
- case ConstantLong => new Constant(tag, new java.lang.Long(in.readLong()))
+
+ // No switch for byte scrutinees! Stupid compiler.
+ ((tag: Int): @switch) match {
+ case ConstantClass | ConstantString => new Constant(tag, in.readUnsignedShort())
+ case ConstantField | ConstantMethod | ConstantInterfaceMethod | ConstantNameAndType =>
+ new Constant(tag, in.readUnsignedShort(), in.readUnsignedShort())
+ case ConstantInteger => new Constant(tag, new java.lang.Integer(in.readInt()))
+ case ConstantFloat => new Constant(tag, new java.lang.Float(in.readFloat()))
+ case ConstantLong => new Constant(tag, new java.lang.Long(in.readLong()))
case ConstantDouble => new Constant(tag, new java.lang.Double(in.readDouble()))
case ConstantUTF8 => new Constant(tag, in.readUTF())
case _ => error("Unknown constant: " + tag)

0 comments on commit 130563c

Please sign in to comment.