[foreign-abi] [Rev 01] RFR: 8241148: need a way to create MemorySegment with contents from java String and a way to read a C char* as java String

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu Mar 19 11:02:29 UTC 2020


On Thu, 19 Mar 2020 04:05:16 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:

>> test/jdk/java/foreign/Test8241148.java line 81:
>> 
>>> 80:                 assertEquals(pathStr.length(), len);
>>> 81:                 System.out.println("PATH = " + pathStr);
>>> 82:             }
>> 
>> Should we compare it with System.getEnv?
>> 
>> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/System.html#getenv()
>> 
>> Perhaps we could strengthen the test that way by ensuring that the naive getenv returns same values for all the keys in
>> the System.getEnv Map.
>
> Will fix this.

I guess what I had in mind was more a for loop where we iterate over all the System.getEnv entries and we validate that
the strings we get are the same as those we get from the native function call. I'm saying this because maybe some env
properties have weirder strings attached to them which might run into encoding issues and the likes - also we'd remove
dependency on PATH in case it's not defined on a given system.

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

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


More information about the panama-dev mailing list