mirror of https://github.com/sbt/sbt.git
Work around scalac issue causing boxing.
Tableswitch slightly cheaper than a couple million trips through the Byte box.
This commit is contained in:
parent
1537a9d6b1
commit
6c090313da
|
|
@ -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,11 +133,12 @@ private[sbt] object Parser
|
|||
pool
|
||||
}
|
||||
|
||||
private def getConstant(in: DataInputStream) =
|
||||
private def getConstant(in: DataInputStream): Constant =
|
||||
{
|
||||
val tag = in.readByte()
|
||||
tag match
|
||||
{
|
||||
|
||||
// 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())
|
||||
|
|
|
|||
Loading…
Reference in New Issue