[lworld] setAccessible change and VarHandle test update

Paul Sandoz paul.sandoz at oracle.com
Thu Mar 8 20:27:49 UTC 2018


Looks good.

> On Mar 6, 2018, at 3:40 PM, mandy chung <mandy.chung at oracle.com> wrote:
> 
> Paul,
> 
> I have updated 
> VarHandleTestAccess* tests for value class.
>  
> UOE is thrown when it attempts to set the value instance field
> via VarHandle.  OTOH the exception message is empty and I have
> created JDK-8199149 to improve the exception message e.g. 
> indicating it's a value class.
> 

Thanks.


>   Any other tests should be
> updated?
> 

There are other tests that tunnel through method handles, see VarHandleTestMethodHandleAccess*.


>  
> This patch also updates the following:
> - Constructor::newInstance throws IAE on value class. 
>   Field::set* already throws IAE in lworld branch.
> - Constructor::setAccessible(true) throws IOE on value class.
> - Field::setAccessible(true) throws IOE on value instance fields
>   and static final fields. 
> - similarly trySetAccessible() returns false for the above cases.
> 
> 
> Value class is new and this is a good opportunity to enforce
> final is final on value classes.  So setAccessible is not
> supported on static final and instance fields on value types.
> 

Which also means the VM can treat these fields as final too. Is that being tracked somewhere?

Paul.

> 
> I disable verification and make the tests to run in -Xint
> temporarily until the lworld support is making further 
> progress.
> 
> Webrev:
>   
> http://cr.openjdk.java.net/~mchung/valhalla/webrevs/lworld-reflection-varhandles/
> 
> 
> Thanks
> Mandy
> 
> 



More information about the valhalla-dev mailing list