We actually did have a ruling like that in Germany, so our highest available punishment, “lifelong” prison sentences aren’t what the name implies. They are long, always more than 15 years and usually above 20, but eventually you get out.
There is another measure available to keep people locked up indefinitely, “Sicherheitsverwahrung”, which keeps getting extended if they are considered to remain a large threat to society. But it’s not supposed to be a punishment, so they get more commodities at least.