RFR: nestmates and methodhandles

Brian Goetz brian.goetz at oracle.com
Thu Feb 25 14:39:52 UTC 2016

Can I suggest doing this in TestNG?  You'll be far more productive -- 
and failures are easier to debug.  You can use sophisticated asserts 
rather than just comparing to a golden file.  jtreg already supports 
TestNG tests.

For example, each of the negative tests (try-catch-assert expected) can 
be its own test method, and TestNG has a way to mark a test method as 
expected to throw an exception.  So these could be written:

     @Test(expectedExceptions = ClassNotFoundException.class)
     public void testProtectedMethodNeg() {

It's far more clear what's going on, and each one is its own test case, 
meaning that you can pinpoint a failure more easily.

Happy to help you get up to speed on TestNG if that helps.

On 2/25/2016 8:12 AM, Stas Smirnov wrote:
> Hello,
> please review this set of tests to verify "parent-child" access using 
> MethodHandle in terms of nestmates vm exploration.
> 1. MethodHandleSubTop class contains methods to verify 
> private/protected methods/fields of the "super" class using 
> MethodHandle from a single one and double level of nesting using 
> access static bridges and direct access in negative and positive test 
> cases
> 2. MethodHandleInheritTest executes a number of positive and negative 
> test cases using MethodHandleSubTop methods
> it will allow us to verify current implementation and future, when 
> access bridges will be removed and MethodHandle access checks will be 
> modified.
> webrev: http://cr.openjdk.java.net/~stsmirno/nestmates/webrev.01
> Testing: RBT

More information about the valhalla-dev mailing list