Enhancing ParameterInvokingEvent
From #9 some people had questions about the name of ParameterInvokingEvent, so this issue is here to facilitate discussion on how to enhance that marker interface.
Since I intended this to also be for static analysis, it may be worth having a way to specify which parameters are invoked upon so static analysis tools can do things like warn if a user is implementing a callback interface on a type which is not actually parameter invokable.
This could invoke adding an element specifying the indices of invokable parameters on the field or method return value for T or something else. e.g.
@ParameterInvokingEvent(indices = {0, 2}) // The first parameter and 3rd
Suggestion: a when parameter that allows you to specify if the parameter(s) are invoked before or after all other listeners:
@ParameterInvokingEvent(incides = {0, 2}, when = { When.BEFORE, When.AFTER })
// 1st param is invoked before all other listeners, 3rd param is invoked after all other listeners
Suggestion: a
whenparameter that allows you to specify if the parameter(s) are invoked before or after all other listeners:@ParameterInvokingEvent(incides = {0, 2}, when = { When.BEFORE, When.AFTER }) // 1st param is invoked before all other listeners, 3rd param is invoked after all other listeners
Would this be that useful for static analysis though? Considering that indices is mainly for tools, and you could specify the order of invocation in the documentation anyway.
From #9 some people had questions about the name of
ParameterInvokingEvent, so this issue is here to facilitate discussion on how to enhance that marker interface.Since I intended this to also be for static analysis, it may be worth having a way to specify which parameters are invoked upon so static analysis tools can do things like warn if a user is implementing a callback interface on a type which is not actually parameter invokable.
This could invoke adding an element specifying the indices of invokable parameters on the field or method return value for T or something else. e.g.
@ParameterInvokingEvent(indices = {0, 2}) // The first parameter and 3rd
How would the annotation be useful for static analysis? I mean, it would make sense if it was on the actual trait type (the ScaryEvents.Spooked interface for the example), but wouldn't putting it on the event field/method mean that tools would have to scan for events that have that handler type?