For a ship +310 meters long, with a displacement of 70 000 tons, I have to say that 40 aircrafts is quite low, notably when only 30 of them are actually fighter aircrafts...
CCTV several times quoted Liaoning as carrying 36 airfraft (planes and helicopters combined). It's air wing is thus likely 24 J-15 and 12 helicopters. While a few more aircraft could be embarked, cramming the deck may also lower overall effectiveness when moving them around the deck in need of sorties preparation. That's in part why US doesn't use (not train with) 90 aircraft anymore.
Some stats:
Charles de Gaulle 11300 m2, hangar area 4200 m2 (140*30m), Rafale 74 m2
Nimitz deck 18500 m2, hangar area 7100 m2 (34*209m), Superhornet area when wings folded: 90 m2
Liaoning 14600 m2, hangar area 4000 m2 (153*26m), J-15 area when folded: 99m2
Rafale on CdG 209 m2 per plane.
Superhornet on Nimitz 284 m2 per plane.
J-15 on Liaoning 188 m2 per plane.
Now, of course, that's not how it really works, as there are other factors in involved, but as a very rough illustration - it shows there's least parking space per plane when it comes to J-15 and Liaoning combo. (one doesn't really park planes in the middle of the deck nor on the landing strip for example, so edge of the deck space is more important) When one would take into account take off surfaces Liaoning might suffer even more, as it needs those two forward stations to get two planes in the air in a relatively short time period. Using just one forward space and one rear launch station in combination is possible but is not as time efficient and isn't really practiced often. On the other hand, sometimes the rear stations needs to be used for range/payload reasons of the plane. Both Cdg and Nimitz can launch 2 planes at same time with having part of the bow reserved for extra parking space. Liaoning lacks that bow parking space if it wants to launch planes. So in effect it has even a little less.
Here's deck areas when two launch stations are clear for CdG and Liaoning (and 3 for Nimitz)
Cdg 7900 m2
Nimitz 11100 m2
Liaoning 8500 m2 (one forward, one rear launch station) or 10500 m2 (two forward launch stations)
Ratios then become:
163 m2 per Rafale (if 2 launch stations are used)
202 m2 per Superhornet (if 3 launch stations are used)
126 m2 per J-15 if 1 forward and 1 rear launch station used
146 m2 per J15 if 2 forward launch stations used
So then it's no wonder that CdG often carries 28 Rafales, sometimes even 30. Or that Nimitz carries 50+ Superhornets. And it's no wonder that the optimum figure for Liaoning is some 24 J-15s. Even though in theory one probably might cram 26, if needed.