ModuleNameResolver oldExpressionContextModuleNameResolver = moduleTypeInfo.getModuleNameResolver();
String newExpressionString = typeChecker.calculateUpdatedCodeExpression(oldExpression.getExpressionText(), oldExpression.getModuleContext(), oldExpressionContextModuleNameResolver, oldExpression.getQualificationMap(), oldName, newName, category, null);
CodeAnalyser codeAnalyser = new CodeAnalyser(typeChecker, moduleTypeInfo, false, false);
MessageLogger logger = new MessageLogger();
QualificationResults qualificationResults = codeAnalyser.qualifyExpression(newExpressionString, null, oldExpression.getQualificationMap(), logger);
if (qualificationResults == null) {
// failed to parse.
String featureName = functionalAgentMetadata.getFeatureName().getName();
String errorMessage =
"Can not update the metadata for " + featureName + ", example " + (i + 1) + ", since it could not be parsed.\n" +
"Compiler messages (if any): " + logger.getCompilerMessages(Severity.ERROR);
status.add(new Status(Status.Severity.WARNING, errorMessage));
continue;
}
String qualifiedNewExpressionString = qualificationResults.getQualifiedCode();
// Update the qualification map
CodeQualificationMap newQualifiedMap = oldExpression.getQualificationMap();
boolean qualificationMapWasUpdated = updateQualificationMap(newQualifiedMap);
boolean moduleContextNeedsUpdating =