Java:S6833,false-positive with @RestController

Which product(s) you’re using

Spring Tool Suite 4 4.21 ,sonarlint plugin 9.1-9.2

Which language you’re analyzing

Java

Which rule is affected

S6833

Why you believe it’s a false-positive / false-negative

in my class ,NOT ALL methods are annotated with @ResponseBody.
and sonarlint still raise an issue

We also need you to include a code sample

package com.example.demo;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = { "/web" })
public class WebController {

	@GetMapping
	public Object loginpage() {
		return "login";
	}

	@PostMapping(value = "/login")
	@ResponseBody
	public Object login() {
		return null;
	}
}

Hey there.

I’ve moved your post to the section on reporting false-positives.

Can you please review this post and include the required information, such as a text-based reproducer (not a screenshot of code)?

please see my post

Hi @yanggaojun101,

Welcome to the community,

Thank you for reporting this false positive. I don’t know how we miss it when implementing the rule. I have created a ticket to fix it and you can track its progress here. For now, you can mark the issue as an FP.

hi colin,
Is this false-postivie fixed ?
I find the ticket no progress
https://sonarsource.atlassian.net/browse/SONARJAVA-4748

It hasn’t been worked on yet.