[foreign-memaccess+abi] RFR: 8265185: make sure all code snippets in jdk.incubator.foreign javadoc comments are proper

Athijegannathan Sundararajan sundar at openjdk.java.net
Wed Apr 14 12:22:15 UTC 2021


On Wed, 14 Apr 2021 12:17:25 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> checked by compiling code snippets
>
> src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/package-info.java line 175:
> 
>> 173: ResourceScope scope = ... // initialize a resource scope object
>> 174: MemoryAddress addr = ... //obtain address from native code
>> 175: int x = MemoryAccess.getIntAtOffset(MemorySegment.allocateNative(scope), addr.toRawLongValue());
> 
> Shouldn't this use `globalNativeSegment` instead? We don't have an allocateNative overload that just takes a scope.

missed it! damage done now. may be part of next patch ...

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/501


More information about the panama-dev mailing list