String typeContent = constructTypeStub(parentCU, imports, lineDelimiter);
int index = cuContent.lastIndexOf(simpleTypeStub);
if (index == -1) {
AbstractTypeDeclaration typeNode = (AbstractTypeDeclaration) astRoot.types().get(0);
int start = ((ASTNode) typeNode.modifiers().get(0)).getStartPosition();
int end = typeNode.getStartPosition() + typeNode.getLength();
buffer.replace(start, end - start, typeContent);
} else {
buffer.replace(index, simpleTypeStub.length(), typeContent);
}