code: @Override
  	protected void doUnload() {
  		Iterator<EObject> allContents = getAllProperContents(unloadingContents);
  		// This guard is needed to ensure that clear doesn't make the resource become loaded.
  		//
  		if (!doGetContents().isEmpty()) {
  			doGetContents().clear();
  		}
  		getErrors().clear();
  		getWarnings().clear();
  		while (allContents.hasNext()) {
  			unloaded((InternalEObject) allContents.next());
  		}
  		setParseResult(null);
  		setIsLoadedFromStorage(false);
  	}
docs: Copied from {@link ResourceImpl#doUnload()} but doesn't call {@link #getContents()} to avoid derived state
  computation.
  
  @since 2.8