Metro Manila (CNN Philippines, May 31) — President Rodrigo Duterte questioned China's sweeping claims in the South China Sea as he capped off his four-day visit to Japan on Friday.

"I love China, it has helped us a bit. But it behooves upon us to ask, is it right for a country to claim the whole ocean?" Duterte said in a rare rebuke of Beijing, whose friendship he has nurtured. He made the remark as he veered away from his prepared speech in the 25th International Conference on the Future of Asia in Tokyo.

China continues to claim almost the entire South China Sea despite an arbitration ruling that invalidated its stake that is supposedly based on historical records. The arbitral tribunal recognized the Philippines' sovereign rights in some sea features within in its 200-nautical mile exclusive economic zone that China claims. The government calls the areas that the Philippines claims and occupies as the West Philippine Sea, where China has built artificial islands, prohibited Filipino fishermen from fishing, and interfered in petroleum exploration.

Duterte said the code of conduct which will lay out what claimants can and cannot do in the disputed waters "is just about two years away."

The Philippines is the country coordinator for ASEAN-China Dialogue Relations until 2021. ASEAN has been pushing for decades for a legally-binding code of conduct in the South China Sea but progress has been slow because of resistance from China.

Duterte did not talk about China's actions in the contested areas, but addressed non-claimant countries' "testing [of] waters in the South China Sea.

"Because of the absence of the conduct of the sea, France, Britain, America are testing the waters... It is really testing who can fire the first shot. And I am sad and bewildered – not angry – because I cannot do anything," Duterte said.

The U.S. is not a claimant country but conducts freedom-of-navigation exercises and criticizes China's alleged militarization in the South China Sea. Duterte said there could never be fruitful talk between the U.S. and China, amid rising trade tensions between the two countries.

READ: Duterte: South China Sea is now in China's hands, why create friction?

"There has to be anybody not identified with any country that China does not like because there will never be a sort of an America, China talking seriously about territories. It will just end up in a shouting match," Duterte said.

He also reiterated that he is not forcing China to follow the arbitral ruling, saying the Philippines cannot go to war against the East Asian giant.

"The China Sea is part of the Republic of China and so we give it. Why? Because they are there. And a lot of lousy politicians in my country want me to to push the arbitral ruling because we won," Duterte said, wrongly using the formal name of Taiwan instead of People's Republic of China. "My country is very small, it has progressed a little over the years, I don't know why. But I cannot afford war with anybody, not only with China."

Duterte has been heavily criticized for his pursuing friendly ties with China amid the dispute. Critics fear billions worth of loans and pledges from China would force the Philippines into a debt trap, something both Manila and Beijing officials denied.

The Philippines earlier protested China's actions in the West Philippine Sea, including the swarming of Chinese vessels around Pag-asa Island and Chinese fishermen's harvesting of giant clams, locally known as Taklobos, in Scarborough Shoal. Malacañang, however, has distanced itself from the complaint filed by former government officials against Chinese President Xi Jinping over the alleged militarization of artificial islands, damage to marine environment, and harassment of Filipino fishermen.

READ: China's 'most destructive' boats back in Scarborough – think tank

Duterte said he wants to talk to Xi again. The last time they talked in April, reports said Xi reiterated China's rejection of the landmark arbitral ruling.

"lf I get a chance to visit Beijing again, I'll try to talk to President Xi Jinping... the longer it takes for the issue to be there, it is always a flash point for trouble," he said.