for (int i = 0, n = examples.length; i < n; i++) {
CALExample curExample = examples[i];
CALExpression oldExpression = curExample.getExpression();
// Get the qualified version of the new string
ModuleTypeInfo moduleTypeInfo = moduleContainer.getModuleTypeInfo(oldExpression.getModuleContext());
if (moduleTypeInfo == null) {
// The module is not in the workspace.
String featureName = functionalAgentMetadata.getFeatureName().getName();
ModuleName moduleContext = oldExpression.getModuleContext();
String errorMessage = "Can not update the metadata for " + featureName + ", example " + (i + 1) +
", since its module context " + moduleContext + " is not in the workspace.";
// Add a warning.
// Unfortunately, warnings are ignored.
// However, throwing a RenamingException will cause renaming to fail, which is not what we want.
status.add(new Status(Status.Severity.WARNING, errorMessage));
continue;
// throw new RenamingException(errorMessage);
}
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);