-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Mark annotations as ElementType.ANNOTATION_TYPE #1901
Comments
Can you at least give a code example? What would you like to type, and how should it behave? |
At work, so responding using my work account. An example:
This is a rather crude example, though. Sometimes I want to just combine multiple annotations together into a 'super-annotation'. I tend to have annotations for things like immutability, and such. For instance, making a The main thing I could suspect being a problem is that the Lombok AST parser may get confused and think it is actually annotating the annotation rather than what that annotation applies to. I have not yet tested this (by adding the flag myself). |
Alternatively, if it would be possible to provide an equivalent mechanism to I made a local copy of the |
I don't know what this mechanism is but it makes no sense. NonNull says something about the thing you put it on. Sooo.. the annotation interface cannot be null? That's like saying a circle cannot fly. Perhaps this is some meta-annotation thingie where some tool will replace an annotation with all the annotations that are on the annotation. This is not what the spec of annotations is designed to do, and would require writing an incorrect, confusing |
See #2294 for the concept of meta-annotating |
Hello again (though from my personal account this time rather than my work account),
I am requesting that the Lombok annotations have their
@Target
appended with ElementType.ANNOTATION_TYPE.I have a collection of combined annotations, combined using com.fasterxml.jackson.annotation.JacksonAnnotationsInside. However, I am unable to integrate lombok annotations with them due to the fact that the lombok annotations cannot target annotations themselves.
In one particular case (but not the only case), I have two separate annotations:
@NotNull
and@CheckedNotNull
.@NotNull
is a combination of a bunch of annotations to target javax, IntelliJ, Eclipse, VS Code, etc.@CheckedNotNull
is similar but should also integrate lombok's@NonNull
(so it actually, well, checks the value). This'd be trivial to do in C++ or Scala, but lombok's@NonNull
is the only one I'm familiar with to do it in Java.Not sure if there are additional complications - I haven't tested adding the additional target myself, yet. If I get time, I will.
The text was updated successfully, but these errors were encountered: