I typically have such small class definition, as below:
public static class Annotation {
private final String brand;
private final Sentiment sentiment;
public Annotation(String brand, Sentiment sentiment) {
this.brand = brand;
this.sentiment = sentiment;
}
public String brand() {
return this.brand;
}
public Sentiment sentiment() {
return this.sentiment;
}
}
There is no any method that can modify 'brand' and 'sentiment' by a client. If I remove the 'final' modifier, my IntelliJ gives me a warning, saying that I should add the 'final' method.
Is it good practice to always add 'final' in such cases?