Java custom annotation/decorator @Testing
I want to do something like this:
@test
private void methodThatGivesWarningIfUserTriesToUseThis() {
where @Testing
is a custom annotator/decorator in Java. I expect this @Testing
comment to behave almost exactly like a @Deprecated comment – if I or someone else accidentally tries to use its code in other sections, the IDE gives a warning (and the method name also has a
strikethrough on the font). So for the front
What should I do?
Note: I don’t want to use @Deprecated
because the method is not deprecated, I just want to use it for testing purposes
**This flag should also be checked at compile time, not runtime.
Solution
The problem is that, as its name suggests, comments are only used to comment 🙂
Creating such a comment is very simple, you need to do the following:
public @interface Testing
In order for your IDE to use it at compile time, you must write a plugin.
It’s a good start me in another SO The problem of starting plugin development is found in the problem.