Some static analysis tools will barf on BeanDefinitionLoader when Groovy is not on the classpath (e.g. Graal VM native image builder). The problem can be avoided just by nesting the "if" clause containing the Groovy reference inside a defensive outer "if".
Comment From: wilkinsona
Equally, some static analysis tools will complain that the two if statements should be combined into one. I'm surprised that Checkstyle hasn't done so.
We can merge this if really necessary, but I'd prefer that it was fixed in Graal rather than it forcing lots of projects to make their code a little bit worse.
Comment From: philwebb
Perhaps we can extract a method to make it look a little less odd.
@dsyer Is there an open Graal issue for this?
Comment From: dsyer
There is a graal issue and they marked it as a bug, so maybe we do not need the do this here.
Comment From: wilkinsona
Yeah, looks like this hopefully won't be needed. I've subscribed to the Graal issue. I'll close this one for now and we can re-open it if the Graal issue doesn't help.