public void computeValues() {
variableDeclarationMap = constantFinder.getVariableMap();
constructorDeclarationMap = constantFinder.getConstructorMap();
constructorInvocations = constantFinder.getConstructorInvocations();
for (Map.Entry<VariableElement, VariableDeclaration> entry : variableDeclarationMap.entrySet()) {
VariableDeclaration declaration = entry.getValue();
ReferenceFinder referenceFinder = new ReferenceFinder(
declaration,
referenceGraph,
variableDeclarationMap,
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) {