Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore lenient null return value for ConditionContext.getBeanFactory() [SPR-16866] #21405

Closed
spring-projects-issues opened this issue May 23, 2018 · 1 comment
Assignees
Labels
in: core type: regression
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented May 23, 2018

Andy Wilkinson opened SPR-16866 and commented

Following the nullability changes in 5.0, three methods on ConditionContext may no longer return null, but may now throw an IlegalStateException instead. Those methods are:

  • getRegistry()
  • getBeanFactory()
  • getClassLoader()

It would be useful if their javadoc documented that an IllegalStateException may now be thrown.


Affects: 5.0.6

Reference URL: spring-projects/spring-boot#13226

Referenced from: commits 50d6d90, 46a89d9

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 28, 2018

Juergen Hoeller commented

It turns out that the deduced getBeanFactory() and getClassLoader() accessors should indeed be @Nullable since the registry may not be downcastable to the former whereas the resource loader's ClassLoader may actually be null (which is why null is also accepted as an argument to the common ClassUtils.forName method).

getRegistry() is arguably a special case since it is usually non-null, except for plain ClassPathScanningCandidateComponentProvider usage. I've retained the IllegalStateException there for the time being.

@spring-projects-issues spring-projects-issues added type: regression in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0.7 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: regression
Projects
None yet
Development

No branches or pull requests

2 participants