When removing a child of a CompilationUnit (e.g. an ImportDeclaration), the CompilationUnit passes the result of List.remove() to Node.updateReferences(); see below.
boolean result = false;
...
if (result) {
updateReferences(result);
}
Node.updateReferences() checks whether the argument is either a SymbolReference or a SymbolDefinition and updates the usages accordingly. For ImportDeclarations which implement SymbolDefinition this does not work as expected
When removing a child of a
CompilationUnit(e.g. anImportDeclaration), theCompilationUnitpasses the result ofList.remove()toNode.updateReferences(); see below.Node.updateReferences()checks whether the argument is either aSymbolReferenceor aSymbolDefinitionand updates the usages accordingly. ForImportDeclarations which implementSymbolDefinitionthis does not work as expected