1
Answer

Require custom attributes at compile time

t

t

19y
2.3k
1
Hi, I'd like to make a custom attribute required at compile-time basically it is a custom attribute that sits on a class. I have an abstract class called ScreenControl, and I want every subclass of ScreenControl to have to provide this custom attribute on its class definition my current solution only applies at run-time - which is to have an assertation that 'this.getType()' provides the desired custom attribute in the ScreenControl constructor. Is there a way to make it a compile-time error(/warning) not to provide the custom attribute on types deriving from my class?
Answers (1)