I should have said withstand, not sustain.
And I said it couldn't shoot, and I have been correct up until now. It is simply idiotic that we can't put a gun on a plane for 14+ years. The solution is simple. Put in the gun and work out the RAM gun cover issues while the pilots learn to shoot with armed aircraft. There is no excuse that makes an sense for not clearing it to shoot live ammo before now.
Um, or it simply isn't a high priority. The gun is a low enough priority that they're even making it optional for the B and C variants.
For example, the F-22 didn't test fire its gun until 2003:
F-22 Milestones, Part 2 | Code One Magazine
The F-22 is generally around 10 years ahead of the F-35; the F-22 winner was announced in 1991 while the F-35 winner was announced in 2001. So by your metric, it took 12 years for them to fire the F-22's gun, while it took 14 for the F-35 -- and this for a plane that is largely single mission (air superiority with missiles and gun) without having to worry about the ground until later in its development. Similarly, I couldn't find a record of when the Rafale first fired its gun, but final approval for operational use of its gun was granted in mid-2000, for a plane that first flew in 1986:
Fox 3 - 2 by avia lduo
Looking around, for the Eurofighter Typhoon, it seems to have first fired its gun in flight in 2004, and it's a contemporary of the Rafale:
https://www.eurofighter.com/news-and-events/2004/04/eurofighter-typhoon-guns-and-missiles
In all these cases, it seems like the gun is fired only around a year or two before the plane's IOC; the F-22 IOC'ed in 2005, the Rafale IOC'ed in 2002, and the Typhoon IOC'ed in 2005. So the F-35A is on-track, with a gun test in 2015 and a planned IOC of 2016.
Long story short, the timeline for the F-35 to fire its gun seems to be about average for modern fighter aircraft. If you think its first gun trials are unacceptably late, you should be similarly upset about those other aircraft.