On Fri, 13 May 2022 10:04:36 GMT, Jorn Vernee <jver...@openjdk.org> wrote:

> Address possible lossy conversion warning in `ProgrammableInvoker`.
> Testing: `run-test-jdk_foreign`, testing with patch from 
> https://github.com/openjdk/jdk/pull/8599 to see if the warning is gone.

line 215:

> 213:         for (int i = 0; i < highLevelType.parameterCount(); i++) {
> 214:             List<Binding> bindings = callingSequence.argumentBindings(i);
> 215:             argInsertPos += 
> Math.toIntExact(bindings.stream().filter(Binding.VMStore.class::isInstance).count())
>  + 1;

My gut feeling in this case would be that it's a bit strange to use 
`Math.toIntExact` to do a safe cast when you don't do `Math.addExact` to ensure 
that the result of the addition will not overflow. I wonder if a simple cast 
wouldn't be more appropriate - unless you really think that you might have more 
than Integer.MAX_VALUE bindings (which I doubt :-) ). But that's just my 


PR: https://git.openjdk.java.net/jdk/pull/8697

Reply via email to