java:S6857 false positive when using @Value to inject directly into a Map

Make sure to read this post before raising a thread here:

Then tell us:

  • What language is this for? Java
  • Which rule? java:S6857 “SpEL expression should have a valid syntax”
  • Why do you believe it’s a false-positive/false-negative?
    Syntax working fine for injecting directly into a Map as presented here:
  • Using SonarCloud
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
public class TestConfiguration {
    private Map<String, Integer> valuesMap;

Hello @theBlackDragon,

Thanks for the report. I was able to reproduce the issue, Here is the ticket to fix it: [SONARJAVA-4917] - Jira


1 Like