A joke, right? It is laughable, both in terms of the sadistic punishment but also in that it is impossible to enforce and must be understood by police as a discretionary law. However, the purpose of the law is not such that it needs to be enforced by the police, as the hope is that protesters will self-police by demanding that comrades unmask. The law is really a divide and conquer tactic, attempting to isolate and marginalize "radical" elements of the protest. Grab teams will then, presumably, be better able to select targets and demonstrations will be less likely to protect the "radical" elements. It is also functional if the police are able to catch a comrade who engaged in a little of the smashy-smashy, as an extra charge to add on. Along these lines is how the authorities hope the police will strategically employ this law.
But there are a few problems with this strategy and the law may not have the desired effect. The most apparent reason is that police will not always exercise astute discretion. They will arrest people in panda costumes and mascots. They will arrest people wearing masks and nothing else. As with everything to do with protest, people will get creative and turn arrests into a PR nightmare for the authorities. It's only a matter of time before you see photos of a group of mimes being tackled by police. And what about the comrades with the enormous puppets? Do those count as masks too? Do the authorities even know what a mask is?
Another problem for the authorities is that masking up was not necessarily a "radical" thing to do. Lots of people mask up for the first time after seeing police wearing masks doing violence to unmasked, otherwise peaceful protesters. But now, comrades who otherwise masked up to feel protected from the police will be all the more likely to engage in a bit of the smashy-smashy, because, well, if you're looking at a decade in jail you'll want it to be worth it. Beyond this, arrests may require the use of excessive force, since protesters may fight tooth and nail to keep from being arrested. Also, if lots of people see that the masked element of a demonstration ignores the law and there are no consequences (since the law cannot be enforced), it becomes even more symbolic as an act of resistance, and may for that reason be all the more likely to spread to more "moderate" elements.
Overall, the law seems like another blunt tool of authority. The fuzzy use value of the law for police, the way protesters will use the law to their own purpose, and a general misunderstanding of protest culture mean that the law is destined to backfire. It's always going to be that way when authority, out of fear, uses the justice system to issue threats to people instead of listening to their legitimate demands.