versions used
- SonarScanner 4.2.0.1873-macosx
- Sonarqube 8.2.0.32929 Docker
I am not sure if this is categorized as False-positive.
There could be additional operation other than just assigning value in the setter method.
In this case this is not an issue.
For e.g.
private fun updateViewLayoutParameters() {
rootView.layoutParams.height = myConfig.panelHeight
// To call parent.onSetLayoutParams() and requestLayout()
rootView.layoutParams = rootView.layoutParams
This code triggers View#setLayoutParams
Moreover, in Android usecase, there is Livedata.
If it is a LiveData, self-assigning calls Observer:onChanged(T).
In this case this is not an issue.
fun doSomething() {
// ...
myViewModel.name.observe(this, myObserver)
myViewModel.name.value = viewModel.name.value
}