Is there an existing issue for this?
Task description
We should add dev analyzer rules to help contributors catch issues around classes that were anonymous classes in Java in our codebase.
- Per our project naming conventions, the type name should end in "AnonymousClass", optionally followed by one or more digits. i.e. ThreadAnonymousClass, ThreadAnonymousClass1, and ThreadAnonymousClass123 are all valid, but AnonymousClassThread and ThreadAnonymousClassForSomeTest are not valid.
- The type should be
private and sealed (unless there is some good reason otherwise which could be suppressed).
- All fields on this type should be
private.
These rules should fire if "AnonymousClass" appears anywhere in the type name.
(Another option, and could be broken out separately: we could also have a custom attribute that indicates that it maps to an anonymous class in Java. This would help us apply extra scrutiny in analysis to these types, and might even let us drop the conventional name suffix at a later time if we wanted.)
Related: #666, #715
Is there an existing issue for this?
Task description
We should add dev analyzer rules to help contributors catch issues around classes that were anonymous classes in Java in our codebase.
privateandsealed(unless there is some good reason otherwise which could be suppressed).private.These rules should fire if "AnonymousClass" appears anywhere in the type name.
(Another option, and could be broken out separately: we could also have a custom attribute that indicates that it maps to an anonymous class in Java. This would help us apply extra scrutiny in analysis to these types, and might even let us drop the conventional name suffix at a later time if we wanted.)
Related: #666, #715