If I have a java class SpecificDialog and inside that class I have a public static class Builder used to build an object of a SpecificDialog then the reason why the Builder is inside SpecificDialog is because it logically belongs there as it can only be used to build SpecifcDialogs. Is this the main reason?
But then if Builder is inside SpecificDialog then my SpecificDialog has access to every private field/member of the Builder. This may be undesirable because I can inadvertently modify some such private Builder's field from the outside SpecificDialog.
Is it there nothing can be done about that and, if not, shall I understand that this is not a big concern?
Whatever design you might choose, you’ll always be able to inadvertently do something that shouldn’t be done. Making a builder a static inner class of the class it builds is a common idiom that is used precisely because the outer class can access the private fields of the builder. Consider the builder as an integral part of the outer class, just like a private field or method, and make sure the class and its builder behave as they should.