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

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.

God bless,
-Toby Reyelts
> 
> >> This may be a stupid question, but is it possible to
> >> use BCEL to wrap> a native method?
> >
> > In what sense?
> 
> I mean insert java code that will run before and/or after the native
> method executes.
> For time related testing of our system I'd like to fool it to think
> its running in the future, I wondered if BCEL could be used to modify
> the value returned by java.lang.System.currentTimeMillis();
> transparently to the rest of the program
> 
> > You can't modify system classes
> 
> Is this true if I used something like the JavaWrapper example class to
> replace the class loader for the application?
> 
> Thanks
> Andrew
> 
> -- 
> Andrew Smallbone <[EMAIL PROTECTED]>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to