Lack of salary transparency—better for corporate morale?

I don’t have an informed opinion on this except to note that I wish I kept my mouth shut when one of my former colleagues asked me how much I earned. It was quite a bit more than his pay who was senior to me. It didn’t end well. Had I known, I would have avoided answering. If unequal pay is unavoidable, they shouldn’t make it transparent.