[foreign] RFR 8224835: Pointer validity checks are applied inconsistently

Jorn Vernee jbvernee at xs4all.nl
Wed May 29 12:26:46 UTC 2019


Hi,

Please review the following:

Bug: https://bugs.openjdk.java.net/browse/JDK-8224835
Webrev: 
http://cr.openjdk.java.net/~jvernee/panama/webrevs/8224835/webrev.00/

This replaces the various public checkXXX methods on BoundedPointer with 
a single public checkAccess(AccessMode) method, which is then used 
everywhere outside of BoundedPointer. This makes sure that every place 
does all the needed checks, and not only one or the other.

I've also checked all the use sites, and noticed that the 
IllegalAccessException that Pointer::addr declared as being thrown was 
never actually thrown. Instead an AccessControlException was being 
thrown. So I've updated the relevant signatures as well, and this 
allowed for the removal of a bunch of try/catch blocks.

I've also removed the checks in References.OfStruct::get and 
References.OfArray::get, since we're not actually dereferencing the 
pointer at that point, only wrapping it. The checks will still happen 
later on when accessing a field or element (i.e. when actually 
dereferencing the pointer).

Thanks,
Jorn


More information about the panama-dev mailing list