The problem with this line of code:
$this->setGenerator(null); is that you will end up with an empty meta tag that you don't want if you are SEO-wise.
So let's reveal where in the core API the generator tag is set. Go to the root of your joomla cms website and open this path : '/libraries/joomla/document/html/renderer/'. The file that we are interested in is 'head.php'.
If we look at line 83 we will see this code :
$strHtml .= $tab.''.$lnEnd;
GG you have the line of code responsible for the generator meta tag. The only thing you need to do is to comment this line.
//$strHtml .= $tab.''.$lnEnd;
So now if you refresh the page you will see that the tag is gone - magic :) - and that's it you've learned how to remove the generator tag. We will get back to this file later with some advices about the arangement of the meta tags As you can see Joomla comes with many methods to be customized and modified you only need to explore it's core to figure out the tricks.