Surely a gun installed in this position cannot actually get a clear shot to the front of the plane? So it either has to change into a raised blister like F-35, or the gun has to be on a mount that can raise it out of that recessed position, or the gun doesn't even fire forward ala Schräge Musik.2022 has jag-edged top hatches on the left side as well. The purpose is still unknown as J-20 is not likely to carry two cannons on both sides.
View attachment 66129
Alternatively maybe it's not for a gun at all, but for some other piece of equipment. Given J-20 has fuelling probe on the nose for probe-and-drogue refuel I don't think its likely to be a system for flying boom refuel. Who knows, hell maybe it's for laser dazzler.