Fixed local variable class name shadow rule violation

Local variables should not shadow class fields [RSPEC-1117](https://rules.sonarsource.com/java/RSPEC-1117)
This commit is contained in:
Abhijay Kumar 2020-08-21 19:37:52 +05:30
parent ee7c68ff3b
commit 5bc54c8341

View file

@ -30,10 +30,10 @@ import java.util.Map;
@Controller
class VetController {
private final VetRepository vets;
private final VetRepository vetRepository;
public VetController(VetRepository clinicService) {
this.vets = clinicService;
this.vetRepository = clinicService;
}
@GetMapping("/vets.html")
@ -41,7 +41,7 @@ class VetController {
// Here we are returning an object of type 'Vets' rather than a collection of Vet
// objects so it is simpler for Object-Xml mapping
Vets vets = new Vets();
vets.getVetList().addAll(this.vets.findAll());
vets.getVetList().addAll(this.vetRepository.findAll());
model.put("vets", vets);
return "vets/vetList";
}
@ -51,7 +51,7 @@ class VetController {
// Here we are returning an object of type 'Vets' rather than a collection of Vet
// objects so it is simpler for JSon/Object mapping
Vets vets = new Vets();
vets.getVetList().addAll(this.vets.findAll());
vets.getVetList().addAll(this.vetRepository.findAll());
return vets;
}