Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"bogus" entries in javap local table output

Tags:

java

javap

I was using javap to study the code produced for one of my classes and noticed the following output:

...
frame_type = 255 /* full_frame */
  offset_delta = 11
  locals = [ class Test, double, int, double, double, bogus, bogus, int, int, class "[D" ]
  stack = []
...

What is the meaning of those "bogus" type/variable entries in the locals table? How are they caused? What is their impact on the resulting code?

The class file was produced using the Eclipse 3.7 compiler and javap came from OpenJDK-1.6b22.

like image 516
thkala Avatar asked Nov 05 '22 12:11

thkala


1 Answers

I came upon this little gem while going over the Javassist documentation:

BOGUS

public static final Type BOGUS

Represents a non-accessible value. Code cannot access the value this type represents. It occurs when bytecode reuses a local variable table position with non-mergable types. An example would be compiled code which uses the same position for a primitive type in one branch, and a reference type in another branch.

I presume that this ambiguity is what causes the "bogus" entries in the locals table as well...

like image 154
thkala Avatar answered Nov 11 '22 21:11

thkala