What's with the fuss with trying to fit the J-20 with a gun anyways? The STOVL and CATOBAR variants of the F-35 don't have built-in guns either.
In today's and future's age of aerial warfare, it would be much more common that you get detonated by an enemy AAM than actually getting torn into bits by bullets.
Besides, with excellent degrees of maneuverability being the nature of every fighter jet in the world - What's the probability that enough bullets from your fighter jet's gun would even hit the enemy fighter, when both you and your enemy are engaging in highly agile, high-G dogfights at close distances at the same time?
Therefore, investments into Peregrine/CUDA/SACM-type small-sized SRAAMs would be a more suitable investment. You can only shoot directly ahead with your gun, but a very high G-capable SRAAM with off-boresight capabilities can cue onto targets that are considerably off the nose of your fighter jet.
In fact, given that we have talked about the
J-20 being already capable of carrying 6 new MRAAMs inside its main weapons bay before - A Chinese-variant of Peregrine/CUDA/SACM could theoretically allow the J-20 to carry up to 12 of them for close-quarters dogfighting and even self-defense against enemy AAMs. Simultaneously, allied fighters and/or loyal wingman UCAVs will be responsible for carrying the new MRAAMs and/or (U)LRAAMs for mid, long and ultra-long range anti-air missions.
Last-but-not-least - The J-20s will (if not already) have certain degree of A2G capability, even though the capability is possibly being inferior to that of the J-16 and JH-7.
Why? Because the J-20 is still a mainly A2A combat-focused airframe. Hence, we could say that the A2G capability is more like a "with-but-not-for" option for the J-20.
The same goes for the J-35, contrary to how many people tend to equate the J-35 to the F-35. This is despite in reality, both the J-35 and F-35 do not have the same main roles to play in the PLAN (and perhaps the PLAAF too) versus the USAF, USN and USMC, respectively.