On Aug 21, 2013, at 2:58 AM, Mark Thomas wrote: > On 21/08/2013 01:24, Nick Williams wrote: > >> My backup idea is slightly less clean but, IMO, still more clean than adding >> ASM as a test-time dependency and trying to figure all of that out. I >> locally compiled fake "weaved" versions of the UnweavedClass (with the >> modified behavior) and then translated each version into a Java byte array >> definition. (These are extremely simple on-line, one-method classes, so the >> byte arrays are relatively short.) I then simply embedded the byte array >> definitions as static final byte[] fields the test class and replaced the >> byte code in my fake transformer with those embedded fields' content. I've >> tested this and it works great. >> >> Here's what the embedded byte code for the fake weaved classes looks like. >> What do you think? Is this acceptable? > > Works for me. It is pretty much exactly what I was going to suggest as I > read your mail. > > My only request would be to keep the class (and hence the byte code) as > short as possible.
Yep! One method that returns a String, has no arguments, and contains one line of code (the return statement) is about as simple as it gets! :-) Thanks, Nick --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org