Update detection logic to also consider `@Rules` classes. Also make the documentation a little clearer. Fixes gh-6768