Japan has enough weaponry to make China think thrice before taking any action. Japan doesn't need nukes cuz it has the backing of the US. There are several US bases within Japan.
Attacking Japan will mean attacking the US. If and when the US withdraws military support from Japan, it can easily gain nukes. And Japan won't be alone. It'll probably be in a regional alliance with South Korea, Taiwan and maybe Vietnam. All of China's neighbors know that if China advances on one of them, they'll be next. So China will be hard pressed into using diplomatic, economic and cyber coercion instead of a direct physical attack.
Even then, attack on any of the above will likely trigger WWIII and will significantly damage China to the point the US can step in and finish the job. Which is why China doesn't make a move on Taiwan yet...
And it might not for the next 25 years.
Fanboys and nationalists are obviously deny this and start the troll factory.