Beijing objected to recent moves by Japan and the United States to expand military cooperation and sharply criticized the two nations for pledging jointly to defend Taiwan if China were to attack it .