I am trying to understand what would be correct usage of the annotations mentioned in the title.
I am aware of TYPE annotation usage as specified from answer here and java docs.
However after reading the article and going through the mail chain here I still have some grey areas as to what would be right usage of TYPE_USE annotation.
The grey areas for me are as follows.
As mentioned in the previous stack overflow question is it a shorter form as mentioned in the 2nd answer.
Does it only allow use case like below to have better type safety?
class PersonDto {
private List<@Valid Address> addresses;
// Some other code...
}
- How is the code referred in 2nd point different from type check perspective to below code.
class PersonDto {
@Valid
private List<Address> addresses;
// Some other code...
}
- As per mail chain mentioned above and my experiment with JDK-17 the example given in mail-chain it seems to be compiling fine. Proving my assumption in point 1.