jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juozas Baliuka" <bali...@mwm.lt>
Subject Re: wrapping native methods
Date Tue, 08 Oct 2002 11:48:03 GMT

It depends on JVM some of them have options to dissable verifier like
-noverify
http://www-3.ibm.com/software/webservers/appserv/doc/v40/ae/infocenter/olt/d
ebugger/ref/rbcjvmar.htm

 I believe On some JVM's you can replace boot classloader to transform
System classes.
You can scan all classes and replace call to System.currentTimeMillis() or
implement this
method yourself, It because you can't rename native method. this will not
work:

public static currentTimeMillis(){
  return _currentTimeMillis() + 1000*60;
}







>AFAIK, it is not possible to modify core Java classes
>(not without cheating anyway).

OK, if I did cheat (by replacing the system class loader?)
would it be possible? ie add instructions around a native method?

I want to make sure that _every_ call to System.currentTimeMillis()
runs our extra code - including our code, 3rd party libraries, and
system code.  Wouldn't scanning classses for calls to the method also
have the same problem with trying to modify system classes that call
currentTimeMillis().

Thanks again
Andrew

>You can, however, modify all other classes. For example,
>scan the classes for calls to invokestatic
>System.currentTimeMillis (very easy with BCEL), and
>replace them with invokestatic <your_class.your_method>.
>This simple replacement (as opposed to adding the code
>inline) would be your best bet, as it shouldn't require
>any other changes.
>You can do this ahead of time, or at run time with your
>own ClassLoader.



----------------------------------------------------------------------------
----


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


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


Mime
View raw message