SONAR-4690 improve code