[foreign-abi] RFR: 8239345: need an enum for standard C types and a way to get a memory layout for those C types

Anthony Vanelverdinghe github.com+15714253+anthonyvdotbe at openjdk.java.net
Wed Feb 19 19:43:01 UTC 2020


On Wed, 19 Feb 2020 19:04:18 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> SystemABI.Type enum added and ABI_CLASS attribute of layout removed (inferred from Type instead)
> 
> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java line 206:
> 
>> 205:         var optAbiType = baseType.abiType();
>> 206:         ArgumentClassImpl baseArgClass = optAbiType.isPresent()? AArch64ABI.argumentClassFor(optAbiType.get()) : null;
>> 207:         if (baseArgClass != ArgumentClassImpl.VECTOR)
> 
> Missing space before `?` Consider replacing with Optional::orElseThrow

You can replace the ternary operator with `Optional::map`:
`java
optAbiType.map(AArch64ABI::argumentClassFor).orElse(null) // or orElseThrow() in case it should throw
`

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

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


More information about the panama-dev mailing list