[Nestmates] RFR: 8189158: [Nestmates] Expand test coverage

David Holmes david.holmes at oracle.com
Wed Oct 11 09:06:31 UTC 2017


Hi Maurizio,

On 11/10/2017 6:16 PM, Maurizio Cimadamore wrote:
> Hi David,
> in general seems great, but I do have a question:
> 
> in privateMethods/TestReflection, what is the goal of this repetition:
> 
> void access_priv(TestReflection o) throws Throwable {
> *o.getClass()*.getDeclaredMethod("priv_invoke", new 
> Class<?>[0]).invoke(o, new Object[0]);
> *TestReflection.class*.getDeclaredMethod("priv_invoke", new 
> Class<?>[0]).invoke(o, new Object[0]);
> }
> 
> I could get this if 'o' had a different class than TestReflection.class 
> (e.g. a subclass) - but that doesn't seem to be the case in the test 
> (other test methods are similarly behaved). This means that the test is 
> basically just making sure that o.getClass() (where o is 
> TestReflection.class) and TestReflection.class yields the same Class 
> instance. Which should not increase test coverage w.r.t. nestmatest? Am 
> I missing something?

No, I just got myself confused - thinking 'o'  could have a different 
class, but it doesn't in that test - that's what the "hierarchy" test 
checks.

Updated webrev:

http://cr.openjdk.java.net/~dholmes/8189158/webrev.v2/

Thanks,
David

> Cheers
> Maurizio
> 
> 
> On 11/10/17 08:43, David Holmes wrote:
>> webrev: http://cr.openjdk.java.net/~dholmes/8189158/webrev/
>>
>> Reflection tests need to be run in such a way to check both the native 
>> accessors and the generated accessors.
>>
>> Reflection should check static class and o.getClass
>>
>> TestInvokeHierarchy needs a reflection and MethodHandles version.
>>
>> Thanks,
>> David
>>
> 


More information about the valhalla-dev mailing list