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

BeanDefinitionBuilder method arguments not annotated with @Nullable [SPR-15841] #20396

Closed
spring-issuemaster opened this issue Aug 1, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Aug 1, 2017

Mark Paluch opened SPR-15841 and commented

BeanDefinitionBuilder declares setInitMethodName, setDestroyMethodName and setScope methods that do not accept @Nullable arguments.

Forwarding values from a given BeanDefinition requires warning suppression or additional code to satisfy null checks:

class CassandraCqlClusterParser extends AbstractBeanDefinitionParser {

	@Override
	protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {

		BeanDefinitionBuilder builder = …;

		if (parserContext.isNested()) {

			// warning is raised in the next line
			builder.setScope(parserContext.getContainingBeanDefinition().getScope());
		}

		return …;
	}
}

Affects: 5.0 RC3

Issue Links:

  • #20099 Introduce null-safety of Spring Framework API
  • #20347 Make getters and setters null-safety consistent

Referenced from: commits 09f5c71

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 1, 2017

Juergen Hoeller commented

Good catch. We were also missing nullable declarations on constructor and property arguments there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.