GRADLE-3022 Avoid unnecessary boxing/unboxing

+review REVIEW-5135