This existing code compiles:
ResponseEntity<MultiValueMap> responseEntity = null;
...
responseEntity = restTemplate.postForEntity(serviceURL, entity,
MultiValueMap.class);
Compiles, but the linter is unhappy: found raw type: org.springframework.util.MultiValueMap
.
If I add the types of map’s key and value:
ResponseEntity<MultiValueMap<String, Object>> responseEntity = null;
the declaration line compiles, but the call to restTemplate.postForEntity()
becomes an error: incompatible types: inference variable T has incompatible equality constraints org.springframework.util.MultiValueMap<java.lang.String,java.lang.Object>,capture#1 of ? extends org.springframework.util.MultiValueMap
.
How do I make it right — pleasing lint in both places?