Skip to content

Instantly share code, notes, and snippets.

@abeln
Created November 14, 2019 20:51
Show Gist options
  • Save abeln/8b38d6a9b7ec588c743a2008cd492aac to your computer and use it in GitHub Desktop.
Save abeln/8b38d6a9b7ec588c743a2008cd492aac to your computer and use it in GitHub Desktop.
diff --git a/src/scalap/scala/tools/scalap/Decode.scala b/src/scalap/scala/tools/scalap/Decode.scala
index acef441..4e5197e 100644
--- a/src/scalap/scala/tools/scalap/Decode.scala
+++ b/src/scalap/scala/tools/scalap/Decode.scala
@@ -55,7 +55,7 @@ object Decode {
classFile annotation SCALA_SIG_ANNOTATION map { case Annotation(_, els) =>
val bytesElem = els find (x => constant(x.elementNameIndex) == BYTES_VALUE) orNull
- val _bytes = bytesElem.elementValue match { case ConstValueIndex(x) => constantWrapped(x) }
+ val _bytes = bytesElem.nn.elementValue match { case ConstValueIndex(x) => constantWrapped(x) }
val bytes = _bytes.asInstanceOf[StringBytesPair].bytes
val length = ByteCodecs.decode(bytes)
@@ -103,4 +103,3 @@ object Decode {
}
}
}
-
diff --git a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala
index 3f6e5ac..dc96397 100644
--- a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala
+++ b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala
@@ -77,7 +77,7 @@ class ByteCode(val bytes: Array[Byte], val pos: Int, val length: Int) {
def fromUTF8StringAndBytes = {
val chunk: Array[Byte] = new Array[Byte](length)
System.arraycopy(bytes, pos, chunk, 0, length)
- val str = new String(io.Codec.fromUTF8(bytes, pos, length))
+ val str = new String(scala.io.Codec.fromUTF8(bytes, pos, length)
StringBytesPair(str, chunk)
}
@@ -241,7 +241,7 @@ case class ClassFileHeader(
case class ConstantPool(len: Int) {
val size = len - 1
- private val buffer = new scala.collection.mutable.ArrayBuffer[ConstantPool => Any]
+ private val buffer = new scala.collection.mutable.ArrayBuffer[(ConstantPool => Any) | Null]
private val values = Array.fill[Option[Any]](size)(None)
def isFull = buffer.length >= size
@@ -250,7 +250,7 @@ case class ConstantPool(len: Int) {
// Note constant pool indices are 1-based
val i = index - 1
values(i) getOrElse {
- val value = buffer(i)(this)
+ val value = buffer(i).nn(this)
buffer(i) = null
values(i) = Some(value)
value
@@ -262,4 +262,3 @@ case class ConstantPool(len: Int) {
this
}
}
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment