Codeforces appears to have a minor bug in the backend regex evaluation for determining which submissions are legal java code. When attempting to submit, if you have an open curly brace in a submission before your outer class, you receive the following error:
Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(\w+).*
This happens even if the curly brace is in a comment. Here's an example case it won't let you submit when really it should:
Here's the thing though: according to regex101 the regex is correct, and the above java code does indeed match (with PHP >=7.3 regex, the default). This makes me believe there's some bug in how CF is evaluating whether the regex matches, rather than with the regex itself.
Why it matters
Although it's not a super big deal, often times I will use a comment block above my main class as a note pad to think about the problem, and whenever I use curly braces in my notes, if I don't go back and delete them before submitting, CF doesn't accept the submission.
Alright, that's all. Happy debugging, and let me know if I can help :)