You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by Manuel <so...@yahoo.com> on 2004/02/27 06:11:07 UTC

Can someone help me figure out this Verifier?

Hi everyone,
I need help with the bcel Verifier. It's been a while
that I get an error on Pass3a when verifying some
classes. This error is not generated by my
instrumentation, since verification of the original
classes fails too. This is the error message:

Pass 3a, method number 0 ['void <init>()']:
VERIFIED_REJECTED
Instruction invokevirtual[182](3) 2 constraint
violated: Referenced method 'setSize' with expected
signature not found in class 'test.TomaGrafico'. The
native verfier does allow the method to be declared in
some superclass or implemented interface, which the
Java Virtual Machine Specification, Second Edition
does not.


Now, this error doesn't mean the classes are invalid,
and they actually get loaded properly and run without
a hitch, so up to now I've just ignored it. However,
I'm writing a test case to automatically test my
instrumentation on many classes, and then verify them.
But I can't get around this error. I tried getting the
VerificationResult of Pass3a, doing a getMessage() and
looking for the error message, and if it is there,
ignore it and move on to the next pass, but
unfortunately Pass3b depends (or has been made to
depend) on a successful pass3a. So, conclusion, I
can't  automatically verify classes after modifying
them (or even before) and know if I really get an
error that will make the native (JVM) verifier
complain.


If you know a way around this, please tell me. I
looked at the source of Pass3a, and identified the
lines where the error is given. But if I get rid of
that line, will the verifier at another point (in this
or other passes) identify the error, when it really
happens to bother the native verifier??? I wouldn't
mind delving into modifying the verifier if I was told
what to do.


By the way, why is this error given? As far as I can
tell, it is detected when calling a superclass method
with invokevirtual, is that right? Then why does javac
compile it that way?

Thanks for helping.

Manuel.


pd: if you know another way of automatically verifying
classes without getting this error, pleaset let me
know. I tried just loading the classes with the system
or the current classloader, but since I need to do
this before as well as after the transformation (some
classes won't get loaded even before touching them),
then the loader only really loads it the first time
around, and the second time (when it really matters
most), it uses the previously loaded version of the
class, instead of the new one. I'm going mad because I
can't make it reload the class.

__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org


Re: Can someone help me figure out this Verifier?

Posted by Andrew Huntwork <as...@huntwork.net>.
I think org.apache.bcel.verifier.NativeVerifier is what you're looking for.

Manuel wrote:
> Hi everyone,
> I need help with the bcel Verifier. It's been a while
> that I get an error on Pass3a when verifying some
> classes. This error is not generated by my
> instrumentation, since verification of the original
> classes fails too. This is the error message:
> 
> Pass 3a, method number 0 ['void <init>()']:
> VERIFIED_REJECTED
> Instruction invokevirtual[182](3) 2 constraint
> violated: Referenced method 'setSize' with expected
> signature not found in class 'test.TomaGrafico'. The
> native verfier does allow the method to be declared in
> some superclass or implemented interface, which the
> Java Virtual Machine Specification, Second Edition
> does not.
> 
> 
> Now, this error doesn't mean the classes are invalid,
> and they actually get loaded properly and run without
> a hitch, so up to now I've just ignored it. However,
> I'm writing a test case to automatically test my
> instrumentation on many classes, and then verify them.
> But I can't get around this error. I tried getting the
> VerificationResult of Pass3a, doing a getMessage() and
> looking for the error message, and if it is there,
> ignore it and move on to the next pass, but
> unfortunately Pass3b depends (or has been made to
> depend) on a successful pass3a. So, conclusion, I
> can't  automatically verify classes after modifying
> them (or even before) and know if I really get an
> error that will make the native (JVM) verifier
> complain.
> 
> 
> If you know a way around this, please tell me. I
> looked at the source of Pass3a, and identified the
> lines where the error is given. But if I get rid of
> that line, will the verifier at another point (in this
> or other passes) identify the error, when it really
> happens to bother the native verifier??? I wouldn't
> mind delving into modifying the verifier if I was told
> what to do.
> 
> 
> By the way, why is this error given? As far as I can
> tell, it is detected when calling a superclass method
> with invokevirtual, is that right? Then why does javac
> compile it that way?
> 
> Thanks for helping.
> 
> Manuel.
> 
> 
> pd: if you know another way of automatically verifying
> classes without getting this error, pleaset let me
> know. I tried just loading the classes with the system
> or the current classloader, but since I need to do
> this before as well as after the transformation (some
> classes won't get loaded even before touching them),
> then the loader only really loads it the first time
> around, and the second time (when it really matters
> most), it uses the previously loaded version of the
> class, instead of the new one. I'm going mad because I
> can't make it reload the class.
> 
> __________________________________
> Do you Yahoo!?
> Get better spam protection with Yahoo! Mail.
> http://antispam.yahoo.com/tools
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
> 

-- 
"I say to you that the VCR is to the American film
producer and the American public as the Boston
strangler is to the woman home alone."
         -Jack Valenti, President, Motion Picture
          Association of America, Inc., before
          The House Subcommittee on Courts, Civil
          Liberties, and The Administration of
          Justice, August, 1982,
          http://cryptome.org/hrcw-hear.htm


---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-user-help@jakarta.apache.org