Source:
static boolean checkChoice(List<ArgumentProperty> definitionArgumentProperties, boolean definitionReturnsNullable, boolean definitionHasSession, Optional<InvocationConvention> invocationConvention) { for (int i = 0; i < definitionArgumentProperties.size(); i++) { InvocationArgumentConvention invocationArgumentConvention = invocationConvention.get().getArgumentConvention(i); NullConvention nullConvention = definitionArgumentProperties.get(i).getNullConvention(); if (definitionArgumentProperties.get(i).getArgumentType() == FUNCTION_TYPE && invocationArgumentConvention == InvocationArgumentConvention.FUNCTION) { return false; } if (nullConvention == RETURN_NULL_ON_NULL && invocationArgumentConvention != InvocationArgumentConvention.NEVER_NULL) { return false; } if (nullConvention == USE_BOXED_TYPE && invocationArgumentConvention != InvocationArgumentConvention.BOXED_NULLABLE) { return false; } if (nullConvention == USE_NULL_FLAG && invocationArgumentConvention != InvocationArgumentConvention.NULL_FLAG) { return false; } if (nullConvention == BLOCK_AND_POSITION && invocationArgumentConvention != InvocationArgumentConvention.BLOCK_POSITION) { return false; } } if (definitionReturnsNullable && invocationConvention.get().getReturnConvention() != InvocationReturnConvention.NULLABLE_RETURN) { return false; } if (!definitionReturnsNullable) { if (invocationConvention.get().getReturnConvention() != InvocationReturnConvention.FAIL_ON_NULL) { return false; } } if (definitionHasSession != invocationConvention.get().hasSession()) { return false; } return true; }

Target:
static boolean checkChoice(List<ArgumentProperty> definitionArgumentProperties, boolean definitionReturnsNullable, boolean definitionHasSession, Optional<InvocationConvention> invocationConvention) { for (int i = 0; i < definitionArgumentProperties.size(); i++) { InvocationArgumentConvention invocationArgumentConvention = invocationConvention.get().getArgumentConvention(i); NullConvention nullConvention = definitionArgumentProperties.get(i).getNullConvention(); if (definitionArgumentProperties.get(i).getArgumentType() == FUNCTION_TYPE) { if (invocationArgumentConvention != InvocationArgumentConvention.FUNCTION) { return false; } throw new UnsupportedOperationException("Invocation convention for function type is not supported"); } if (nullConvention == RETURN_NULL_ON_NULL && invocationArgumentConvention != InvocationArgumentConvention.NEVER_NULL) { return false; } if (nullConvention == USE_BOXED_TYPE && invocationArgumentConvention != InvocationArgumentConvention.BOXED_NULLABLE) { return false; } if (nullConvention == USE_NULL_FLAG && invocationArgumentConvention != InvocationArgumentConvention.NULL_FLAG) { return false; } if (nullConvention == BLOCK_AND_POSITION && invocationArgumentConvention != InvocationArgumentConvention.BLOCK_POSITION) { return false; } } if (definitionReturnsNullable && invocationConvention.get().getReturnConvention() != InvocationReturnConvention.NULLABLE_RETURN) { return false; } if (!definitionReturnsNullable) { if (invocationConvention.get().getReturnConvention() != InvocationReturnConvention.FAIL_ON_NULL) { return false; } } if (definitionHasSession != invocationConvention.get().hasSession()) { return false; } return true; }