* @see CompileTimeErrorCode#CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD
* @see CompileTimeErrorCode#CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD
*/
private boolean checkForConflictingConstructorNameAndMember(ConstructorDeclaration node,
ConstructorElement constructorElement) {
SimpleIdentifier constructorName = node.getName();
String name = constructorElement.getName();
ClassElement classElement = constructorElement.getEnclosingElement();
// constructors
ConstructorElement[] constructors = classElement.getConstructors();
for (ConstructorElement otherConstructor : constructors) {
if (otherConstructor == constructorElement) {
continue;
}
if (ObjectUtilities.equals(name, otherConstructor.getName())) {
if (name == null || name.length() == 0) {
errorReporter.reportErrorForNode(CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT, node);
} else {
errorReporter.reportErrorForNode(
CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME,
node,
name);
}
return true;
}
}
// conflict with class member
if (constructorName != null && constructorElement != null && !constructorName.isSynthetic()) {
// fields
FieldElement field = classElement.getField(name);
if (field != null) {
errorReporter.reportErrorForNode(
CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD,