Matt Benson [
https://community.jboss.org/people/mbenson] created the discussion
"VerifyError with complex Javassist instrumentation"
To view the discussion, visit:
https://community.jboss.org/message/805734#805734
--------------------------------------------------------------
Hi, I'm working on a new OSS project to allow Java developers to declaratively handle
the Java AccessController APIs. One of our features is the concept of "method
blueprinting" whereby the code requiring privileges is housed in a security-agnostic
static implementation method. Calls to such methods are translated to calls to local,
cloned methods. This basic concept is all working great with Javassist. The problem
occurs when such a "blueprint method" references a field. I have created code
to handle field accesses using reflection (as opposed to copying the field, which might
then not be initialized, etc.). I am by no means a bytecode expert, but I am familiar
with recursive-descent parsers and I have stepped through the code that compiles my
replacement statements; this all looks fine. I have compared the bytecode Javassist is
generating with the bytecode generated by javac to do the same type of field reflection
and I (from my inexpert POV) cannot see anything that appears significant. When I try to
run my instrumented code I get VerifyError "Incompatible argument to function".
I am at a complete loss. I would be highly appreciative if any experts were able to offer
further advice on how to proceed. If anyone is interested, the current code can be viewed
at
http://svn.apache.org/repos/asf/commons/sandbox/weaver/branches/fields
http://svn.apache.org/repos/asf/commons/sandbox/weaver/branches/fields . Probably the
easiest way to test is `mvn -DskipTests clean install` then `cd example; mvn test` to see
the problem.
TIA,
Matt
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/805734#805734]
Start a new discussion in Javassist at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]