Why does running javap on a compiled Scala class show weird entries in the constant pool?
When running javap -v on the compiled class resulting from this bit of Scala (version 2.8.1 final):
class Point(x : Int, y : Int)
I get the following output for the constant pool entries, along with several terminal beeps indicating non-printable chars?
#19 = Utf8 Lscala/reflect/ScalaSignature;
#20 = Utf8 bytes
#21 = Utf8 \t2\"\t!!>Lg9A(Z7qift4A\nqCA\r!BA
aM\4
-\tAA[1wC&Q\nTWm;=R\"\t
E\tQa]2bYL!a\tMr\1PE*,7\r\t+\t)A-\t/%:$
eDu\taP5oSRtDc!CAqA!)Qca-!)!da-
#22 = Utf8 RuntimeVisibleAnnotations
#23 = Utf8 Point
#24 = Class #23 // Point
Any idea what's going on and why? I've never seen bi开发者_StackOverflow社区nary garbage in CONSTANT_Utf8 entries before.
I'm using an OpenJDK 7 build on Mac 10.6, if that makes a difference - I will try to replicate tomorrow when I have other OSes to play with, and will update accordingly.
The ScalaSignature element is where the extra type information that Scala needs is stored. It's being stored (encoded, obviously) in annotations now so that it can be made available to reflection tools.
精彩评论