Pre-defined rules

I am using sonarqube community edition version 8.9 and java 8. When I tried writing a custom rule based on a predefined rule S2698. It throws error as ‘atleast one issue expected’. I used the same test file but still getting that issue. Whether the rules are define based on Java version?

I think this StackOverflow post will help you.