You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
IndexOutOfBoundException when using method level injection with no parameter #1795
When using an injection annotation on a method with 0 parameters the validation step throws an IndexOutOfBoundException.
the reason is that currently the full valdiation has to run and while the InjectHelper validates the parameter count and already have invalidated the annotation if it has 0 parameters lots of the annotaion handler do some additional changes that require the method parameter. the attempt to get a hand on this (not given) parameter results in this exeption.
i think we have to force stop the handler specific validation if the injectHelper already invalidated the annotation usage.
currently i have 3 ideas
// Option 1: return true/false from injecthelper.valid and return based on that value
if(!injectHelper.validate(OptionsMenuItem.class, element, validation)) {
return;
}
// Option 2: check validation.isValid() and return based on that value
injectHelper.validate(OptionsMenuItem.class, element, validation);
if(!validation.isValid()) {
return;
}
and without a sample Option 3: throw some kind of exception in injectHelper.validate() that is handled where *handler*.validate() is called.
while i like the option 3 for not needing a change in the handler i do not like the fact of using Exceptions for process/flow control.
I'm not sure about what i'd prefer of the other 2 options.
@WonderCsabo what option would you prefer? or do you have another idea?
also while checking this i had the idea to catch exceptions thrown by validate (and maybe process) and while still logging them do not "crash" but add some kine of invalidation for this exception like we were not able to validate/process this annotation see log for details. you know what i mean?
Activity
dodgex commentedon Jun 10, 2016
also while checking this i had the idea to catch exceptions thrown by
validate(and maybeprocess) and while still logging them do not "crash" but add some kine of invalidation for this exception likewe were not able to validate/process this annotation see log for details. you know what i mean?WonderCsabo commentedon Jun 12, 2016
Option one is shorter, but we use option two in the codebase. Maybe we would do that for the sake of consistency.
dodgex commentedon Jun 13, 2016
Okay. Then I'll try to fix this issue asap. :)
Merge pull request #1801 from dodgex/fix_IndexOutOfBoundException_in_…