constructorDeclarationMap);
referenceGraph.addNode(declaration);
declaration.getInitializer().accept(referenceFinder);
}
for (Entry<ConstructorElement, ConstructorDeclaration> entry : constructorDeclarationMap.entrySet()) {
ConstructorDeclaration declaration = entry.getValue();
ReferenceFinder referenceFinder = new ReferenceFinder(
declaration,
referenceGraph,
variableDeclarationMap,
constructorDeclarationMap);
referenceGraph.addNode(declaration);
boolean superInvocationFound = false;
NodeList<ConstructorInitializer> initializers = declaration.getInitializers();
for (ConstructorInitializer initializer : initializers) {
if (initializer instanceof SuperConstructorInvocation) {
superInvocationFound = true;
}
initializer.accept(referenceFinder);
}
if (!superInvocationFound) {
// No explicit superconstructor invocation found, so we need to manually insert
// a reference to the implicit superconstructor.
InterfaceType superclass = ((InterfaceType) entry.getKey().getReturnType()).getSuperclass();
if (superclass != null && !superclass.isObject()) {
ConstructorElement unnamedConstructor = superclass.getElement().getUnnamedConstructor();
ConstructorDeclaration superConstructorDeclaration = findConstructorDeclaration(unnamedConstructor);
if (superConstructorDeclaration != null) {
referenceGraph.addEdge(declaration, superConstructorDeclaration);
}
}
}
for (FormalParameter parameter : declaration.getParameters().getParameters()) {
referenceGraph.addNode(parameter);
referenceGraph.addEdge(declaration, parameter);
if (parameter instanceof DefaultFormalParameter) {
Expression defaultValue = ((DefaultFormalParameter) parameter).getDefaultValue();
if (defaultValue != null) {
ReferenceFinder parameterReferenceFinder = new ReferenceFinder(
parameter,
referenceGraph,
variableDeclarationMap,
constructorDeclarationMap);
defaultValue.accept(parameterReferenceFinder);
}
}
}
}
for (InstanceCreationExpression expression : constructorInvocations) {
referenceGraph.addNode(expression);
ConstructorElement constructor = expression.getStaticElement();
if (constructor == null) {
break;
}
constructor = followConstantRedirectionChain(constructor);
ConstructorDeclaration declaration = findConstructorDeclaration(constructor);
// An instance creation expression depends both on the constructor and the arguments passed
// to it.
ReferenceFinder referenceFinder = new ReferenceFinder(
expression,
referenceGraph,