It doesn’t make sense. You know exactly why it doesn’t make sense. What you get by doing what the compiler already does for you exactly the same?
In fact I go further, in most cases it makes sense to create other constructors, which disarms this ability of the compiler to create a standard builder (the name of that mechanism), which in that case if you needed one you would have to create manually. But in practice almost every time you do this there must be something wrong, almost always do not need and should not have the default constructor, nor generated by the compiler.
The default constructor exists because it cannot be without one, but it is usually a mistake in robust applications. Of course there are situations where there really is no reason to create something more complex, a typical case is an anemic object.
Obviously if makes sense to have a default constructor (no parameters) and it must have some logic inside which is not empty or only to initialize the members of the object (this is what the constructor the compiler generates does), so it makes sense to create this constructor.
Have a question about the importance of the builder. Most created classes that do not have a constructor with parameters must be wrong, even if they work. You are only right if you always want to initialize with the default values of each type of object members.
When someone defends something, ask them to explain why, and then they can confront other people in more detail. If you don’t have why, ignore it, it may be right, but without knowing why you have no reason to do it.
do not necessarily see this as a good practice, but in some cases, if the class is accessed via Reflection it is quite possible that you have an unexpected behavior
– Lucas Miranda
@Lucasmiranda can give more details?
– Maniero
i was thinking about the possibility of some framework accessing the class through newInstance(), but thinking about it doesn’t make sense
– Lucas Miranda
@Even if a constructor is not explicitly declared, the default constructor will always be there, and in cases of Reflection it would still be possible to access it using Class.getConstructor() and then call the Constructor.newInstance()
– nullptr