Lets say John files a provisional patent at January 2016 with claim A. Some company B decides to file a non provisional patent with the exact same claim A at March 2016, because John's provisional is not searchable by neither the patent lawyer nor the patent examiner, so company B's non provisional patent application got granted.
Lets say at September 2016 John want's to turn his provisional patent into non provisional patent since the one year window is expiring and he finally finds enough money, but then he realized what company B has done.
Could John still file a non provisional patent with claim A and still get it granted?
If the answer is yes, does that render company B's non provisional patent useless? If yes, does that means company B just wasted a ton of money for nothing?
Edit: Assuming John is in the US.