2
votes

I'm trying to verify "on the fly" generated bytecode!

I already had several attempts, one attempt was to compile my classes in runtime with the eclipse compiler another was to compile from memory as mentioned here:

Compile From Memory

First results looked okay but I'm still not a 100% sure if the verification process is truly valid according to the JAVA 6 guidelines and security measurements as well to normal OOP Models.

Any better way on how to verify bytecode?

2
how is this related to [assembly]? I guess you meant [java-bytecode-asm], right? - Stefan Paul Noack
What do you mean by "verify"? Do you mean for instance type-check? - aioobe
I never used the assembly tag, dont know why this was there... - Evils
Why I mean with verify is that I need to secure that there are no schematic problems like wrong inheritance and stuff, so I just need to secure that my bytecode does not break with java 6 rules - Evils

2 Answers

1
votes

If you load the generated bytecode using a standard class loader, the bytecode verifier of the JVM will verify (make sure it type checks, never falls of the "edge" of a method and so on) the bytecode for you.

0
votes

You can use the class verifier provided by the ASM toolkit. That does not require actually loading the classes by the JVM, and gives you more detailed verification error reports.