Would it be possible to annotate an annotation member which accepts a spel expression with @Spel to let IDEs know that this member can be evaluated? Maybe the @Spel annotation could indicate if expressions may reference beans, method parameters, etc.
If this mechanism is in place, third-party annotations could have their expressions validated by IDEs and it would simplify the IDEs' work by having a single general solution instead of implementing ad-hoc validations per annotation.
@interface Spel {
enum Access {
APPLICATION_CONTEXT, METHOD_PARAMETERS
}
Access[] access() default {};
}
@interface Locked {
@Spel(access = {METHOD_PARAMETERS})
String lockName();
}
class MyService {
@Locked(lockName = "taskLock-#{#taskId}")
void doSomethingThatMustBeLocked(long taskId, ...) { ... }
}
Would it be possible to annotate an annotation member which accepts a spel expression with
@Spelto let IDEs know that this member can be evaluated? Maybe the@Spelannotation could indicate if expressions may reference beans, method parameters, etc.If this mechanism is in place, third-party annotations could have their expressions validated by IDEs and it would simplify the IDEs' work by having a single general solution instead of implementing ad-hoc validations per annotation.