I am quite surprised to see you contemplate this option. Japan is a turn-key nuclear power already, and developing nuclear weapons is a relatively trivial technical step for Japan, as it already has sufficient stocks of plutonium and highly enriched uranium. Such an attack would be meaningless in terms of stopping a potential Japanese nuclear program, and of course would alienate vast numbers of countries.
Besides, do you think Japan would not retaliate militarily? What about its treaty ally, the US? How would other powers in the region react? Too many unknowns for China to act in such a reckless manner.
In truth, China's practical leadership would likely do nothing more than issue harsh rhetoric, like it did with its proxies North Korea and Pakistan. War, and potentially nuclear war, is a risk to the CCP's hold on power; and the CCP's hold on power is the CCP's highest priority.