Clarification on and issue

Hi @everyone, I saw this [TRUNK-5846] Checking the variable type before casting - OpenMRS Issues issue still open, I wish to know if there is any unfinished work regarding the issue. I am interested in working on it. Also can some provide me with more information on how the implementation should be done. thanks in advance

1 Like

Reading through the ticket comments will be helpful.

Thank you are @kdaud for the reminder. I have gone through the comments and reviewed the PR submitted by bejanut. I wish to understand more things before stating.

  1. the pproblem is we are casting a variable of type object on another of type validator, and in some classes, the variable is not checked before casting which inturns give an error.
  2. I wish to know what are we required to do incase a check is done and the varible is either null or of different type other than validator? Do we need to cast it to object before casting back to validator? just to clarify my doubts.
  3. Am I supposed to navigate through all the classes which implement the casting and add the check or can I simply create a global check class and invoke it where neccessary. I want to know because in most of the classes, i have gone through i see a validate class in w hich thw casting is done without any check. In that case can I just go ahead and do the check on the variable types? I also notice if the variable failed to be the right type, an error is thrown indicating the exact varible type expected to be there.
  4. Also just to confirm all of this is required to be worked on the openMRS core repo or also on another repo? I will appreciate if someone respond to this asap. thanks in advance.

@njiddasalifu did you take a look at the ticket description?

Yes, and I’ve started adding tests to some classes.

Hi @Kakumirizi I did read through the comments and saw a PR submitted by another dev, but the issue is not yet closed and I don’t think it has been resolved. I wanted to be clear whether to work on it or not.