China is barely capable of taking over Taiwan without enormous cost and material and human loss. Japan is far, far harder to "invade" and is barely even something they would consider.
Even an "attack" (something short of an invasion), consisting of surgical strikes (and what, nukes?) would be prohibitively costly in every way possible and would also be 100% guaranteed to bring the US in to the conflict.
The Chinese government likes having Japan around as a useful lightning conductor for public anger, which redirects protests away from them. They are Japan's biggest trading partner. They are not going to invade any country this useful and valuable to them.
Please don't use a word like "invade" lightly; it's very, very far from ever being a reality.