RFR [XS] 8155239 [TESTBUG] Simple test setup for JVMTI ClassFileLoadHook

Ioi Lam ioi.lam at oracle.com
Wed Apr 27 23:59:10 UTC 2016


The string replacement works on any UTF8 strings that are embedded 
inside the class file. Since UTF8 strings are used in the class file 
both for literal strings, as well as names for methods/fields/classes, 
renaming fields or methods should work as well.

However, if you specify a very short string, like "X", it may actually 
overwrite any arbitrary bytes in the class file that happens to have the 
same value (e.g., in the bytecodes). I should add a precaution in the 
source code that you should pick a string that's long and unique enough 
to be safe.

- Ioi

On 4/27/16 2:53 PM, Chris Plummer wrote:
> Hi Ioi,
>
> Looks good. Thanks for doing this.
>
> I assume this is only meant for testing the conversion of a String, 
> and anything beyond that is use at your own risk (like renaming a 
> field or a method).
>
> thanks,
>
> Chris
>
> On 4/27/16 6:44 AM, Ioi Lam wrote:
>> Hi,
>>
>> Please review this simple test bug:
>>
>> https://bugs.openjdk.java.net/browse/JDK-8155239
>> http://cr.openjdk.java.net/~iklam/jdk9/8155239_simple_classfileloadhook.v01/ 
>>
>>
>> Testing ClassFileLoadHook is a pain. In many cases, we are not 
>> testing CFLH itself, but rather "how does my feature interact with 
>> CFLH. One example is the interaction between CDS and CFLH. This RFE 
>> makes it easy to write such tests.
>>
>> Please see SimpleClassFileLoadHookTest.java for an example.
>>
>> I've tested under Linux and I am now trying to test under all other 
>> platforms.
>>
>> Thanks
>> - Ioi
>



More information about the hotspot-dev mailing list