RFR: 6658: Remove unnecessary storing of pre-instrumented bytecode

Jessye Coleman-Shapiro github.com+29706926+jessyec-s at openjdk.java.net
Wed Jan 8 18:01:48 UTC 2020

On Fri, 20 Dec 2019 19:02:18 GMT, Marcus Hirt <hirt at openjdk.org> wrote:

>> This patch addresses [JMC-6658](https://bugs.openjdk.java.net/browse/JMC-6658) and removes the unnecessary storing of pre-instrumented bytecode that was implemented in [JMC-5458](https://bugs.openjdk.java.net/browse/JMC-5458).
> Hi Jessye! Looks good, but the testClearAllTransforms tests should really validate that the byte code no longer contains the emission of the events. Also, since the test execution order can't be known, the clear all transforms test should first attempt to transform. Also - the JMX API should really, really not return (potentially serialize) classes, but I will open a separate issue for this, as it is not related to this PR.

With huge help from @tabjy in https://github.com/openjdk/jmc/pull/23/commits/dc2c00b5da05bcb584fb83f7bac1893452bb0c9d I have made the two previous tests, testSetTransforms and testClearAllTransforms, into one testSetTransforms test.  I did this to make one non redundant test because as mentioned, before testing the clearing of all transforms, transforms have to be applied first, which is what testSetTransforms was previously doing . 

In this patch testSetTransforms has been modified to transform a method with an event that throws a run time exception.  To test that the byte code actually gets instrumented the transformed method is ran and checked to see that this run time exception is fired.  Similarly, clearing all transforms is tested by rerunning this method and ensuring that the exception is not fired.


PR: https://git.openjdk.java.net/jmc/pull/23

More information about the jmc-dev mailing list