Let's assume we have a simple class:
public class Person {
private String name;
private int age;
public Person()
{
this.age = 0;
this.name = "Default Name";
}
public Person(String name, int age)
{
this.name = name;
this.age = age;
}
}
In an application which direcly(from another class) uses the second constructor, and indirecly(any other way than calling it from another class) uses the first one.
Is it OK to suppress unused warnings on the first constructor?
These are the two points of view:
Suppress the warnings - it hasn't got clearly visible usages and suppressing warnings doesn't produce any errors anyway..
Suppressing warnings is redundant and it shouldn't be done because it's unclear if a public method is used from a different point in an application
I am especially interested in info about empty constructors, which are used a lot in Enterprise Java.
Which is more correct? Thanks