docs: public void finalizeScript() {
  		if (this.isFinalized) {
  			throw new IllegalStateException("already finalized");
  		}
  		this.isFinalized = true;
  		ImportManager concreteImports = new ImportManager(true);
  		XImportSection importSection = getScript().getImportSection();
  		if (importSection != null) {
  			for (XImportDeclaration decl : importSection.getImportDeclarations()) {
  				concreteImports.addImportFor(decl.getImportedType());
  			}
  		}
  		for (String importName : getImportManager().getImports()) {
  			JvmType type = findType(getScript(), importName).getType();
  			if (concreteImports.addImportFor(type) && type instanceof JvmDeclaredType) {
  				XImportDeclaration declaration = XtypeFactory.eINSTANCE.createXImportDeclaration();
  				declaration.setImportedType((JvmDeclaredType) type);
  				if (importSection == null) {
  					importSection = XtypeFactory.eINSTANCE.createXImportSection();
  					getScript().setImportSection(importSection);
  				}
  				importSection.getImportDeclarations().add(declaration);
  			}
  		}
  		Resource resource = getScript().eResource();
  		if (resource instanceof DerivedStateAwareResource) {
  			((DerivedStateAwareResource) resource).discardDerivedState();
  		}
  	}