jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Schlapbach <schlp...@iam.unibe.ch>
Subject Re: wrapping native methods
Date Tue, 08 Oct 2002 22:04:55 GMT
I don't know wether this is still of interest, but I found these two 
papers guite illuminating:

[Gon98] Li Gong. Secure java class loading. In IEEE Internet Computing, 
volume 2, 1998.

[LB98] Sheng Ling and Gilad Bracha. Dynamic class loading in the java 
virtual machine. In Proceedings OOPSLA 98, 1998.


Andrew Smallbone wrote:
>>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>

Andreas Schlapbach      schlpbch@iam.unibe.ch

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

View raw message