Summary: | Warning for private constructors are semantically incorrect | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | David Williams <david_williams> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | RESOLVED WONTFIX | QA Contact: | |
Severity: | major | ||
Priority: | P3 | CC: | for.work.things, Olivier_Thomann, sonia_dimitrov, thatnitind |
Version: | 3.3 | ||
Target Milestone: | 3.3 M6 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
David Williams
2007-02-11 16:50:05 EST
This is reported in Eclipse code as warnings during the build. Here are the plugins that are using this pattern: org.eclipse.ant.ui org.eclipse.equinox.preferences org.eclipse.jdt.compiler.apt org.eclipse.jdt.debug.ui org.eclipse.update.core David - a default constructor is ONLY added by the compiler if not other constructor is defined. Therefore, I don't see what the addition of extra private constructors is buying you; which is what the compiler is trying to tell you. Basically in both examples you gave, I don't see why discarding the unused private constructor would not be the right move... maybe missing something ? You might need the default constructor to be able to use the reflection and newInstance() to create a new instance, but you want to ensure that no users are instanciating this class that way. I wonder if using a constructor with package visibility would not do the same thing since in most cases, users are working outside of the current package. Discussed with David at the conf, and he agreed we are doing the right thing. |