The U.S. Supreme Court affirmed a ruling that Helsinn Healthcare SA’s patents on anti-nausea medicine Aloxi were invalid because the company had disclosed the drug formulation two years before seeking the patents.

The Jan. 22 decision effectively blocks drugmakers from striking confidential licensing deals well before seeking a patent, limiting the time companies have to protect their inventions.

Helsinn argued a 2011 patent law overhaul excluded confidential sales from the on-sale bar, a rule blocking patent applications more than a year after initial sale of an innovation. But Justice Clarence Thomas, writing for the unanimous court, said the America Invents...