7

I "upgraded" some jar files from class file version 49.0 to 50.0 with ProGuard.

Because preverification is optional with version 50.0, I wonder if there is a way to check if the class file has really an StackMapTable attribute in it.

(It's not that I don't trust ProGuard "[...] The following options upgrade class files to Java 6, by updating their internal version numbers and preverifying them." but I'd like to learn how to verify the existance of the StackMapTable.)

soc
  • 27,983
  • 20
  • 111
  • 215
  • soo u dont have sources and you couldnt compile it with java 6 compiler??? – anfy2002us May 28 '11 at 15:12
  • I'm using it with Scala and `scalac` only generates code for Java 5 (49.0) at the moment. – soc May 28 '11 at 15:13
  • but you shouldnt have problems java 5 compiled code to run in jvm 6 – anfy2002us May 28 '11 at 15:34
  • That's not the point. I want to find out if the signatures and bytecode emitted by `scalac` work with preverification and that was the only way I found except modifying `fjbg` itself. – soc May 28 '11 at 17:10
  • Does something like bcel help? http://jakarta.apache.org/bcel/apidocs/org/apache/bcel/classfile/StackMap.html – philwb Jun 07 '11 at 14:00
  • @philwb: It seems that this only covers the Micro Edition. The SMT on DE is different. – soc Jun 07 '11 at 17:14
  • Not sure about bcel support for stackmap entries actually being restricted to j2me, but, javaassist also has some support for stack map tables that might be useful to you: http://www.csg.is.titech.ac.jp/~chiba/javassist/html/javassist/bytecode/StackMapTable.html – philwb Jun 08 '11 at 14:14
  • philweb: That looks good, though I assumed it was as easy as looking at the bytecode with `javap`. Could you create an answer? – soc Jun 08 '11 at 16:51
  • Ok - answer is there. The one other nugget I came across was java -XX:-FailOverToOldVerifier -Xverify:all which should only verify if there is SMT information in a 50+ version class file. However, I haven't tried that and cant even tell you what it might look like on output. – philwb Jun 09 '11 at 14:08

1 Answers1

3

Javaasist has support for reviewing stack map tables.

The one other nugget I came across was java -XX:-FailOverToOldVerifier -Xverify:all which should only verify if there is SMT information in a 50+ version class file. However, I haven't tried that and cant even tell you what it might look like on output.

soc
  • 27,983
  • 20
  • 111
  • 215
philwb
  • 3,805
  • 19
  • 20