MemoryAddress.toRawLongValue

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Jan 15 21:30:26 UTC 2021


Hi Chris,
I hear you - another option would be an OptionalLong - but that would 
create some extra allocations (although maybe that's ok). I think an 
extra predicate is something we could do. Again, with pattern matching 
the pair of predicate + accessor might (one day) just be replaced by a 
pattern declaration:

MemoryAddress addr = ...
if (add instanceof MemoryAddress.of(long rawValue)) {
   // use rawValue
}

Cheers
Maurizio

On 15/01/2021 20:49, Chris Vest wrote:
> Hi,
>
> In Netty we expect to have use for MemoryAddress.toRawLongValue, for JNI
> integration stuff.
> Calling it on a heap address will throw UOE, which is fine, but it'd be
> nice if we could check with some hasRawLongValue method instead and avoid
> making unsupported calls.
>
> Thanks,
> Chris


More information about the panama-dev mailing list