Boa tarde amigos!
Onde trabalho sou obrigada a utilizar o Software Analyser da IBM para verificar o meu código fonte. Em uma das análises recebi a seguinte recomendação:
“Sempre marque o tipo de objeto em um método equals”
sendo que meus métodos equals, ao meu ver não possuem nenhum problema na subescrita. Abaixo listo alguns deles:
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AgenciaBancaria other = (AgenciaBancaria) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
outro:
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Banco other = (Banco) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
O que eu gostaria de entender é o que significa marcar o tipo de objeto. Alguém faz isso??