Path variable 'test' is not consumed

Answered

Hi

I am getting this warning "Path variable 'test' is not consumed", but everything is working fine. What is causing this warning? I surely can suppress this warning, but it is not seem right.

IntelliJ IDEA 2020.3.1 (Ultimate Edition)
Build #IU-203.6682.168, built on December 29, 2020
Runtime version: 11.0.9.1+11-b1145.63 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12
Non-Bundled Plugins: com.intellij.kubernetes, YourKit Java Profiler 2020.9-b416 Integration, org.jetbrains.kotlin, org.intellij.scala

Sample code:

    @RestController
@RequestMapping("/test")
public class TestResponseController {
@GetMapping("/{test}")
warning here -> private Mono<String> getTestResponse(@ModelAttribute("test") Test test) {

...
@ControllerAdvice
public class TestResponseControllerAdvice {
private final ObjectMapper jsonObjectMapper;
public TestResponseControllerAdvice(ObjectMapper jsonObjectMapper) { this.jsonObjectMapper = jsonObjectMapper; }

@ModelAttribute("test")
public Test getTestPathVariable(@PathVariable String test) throws JsonProcessingException {
return jsonObjectMapper.readValue(test, Test.class);
}
}
1

Please sign in to leave a comment.