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-projects-issues opened this issue Aug 1, 2017 · 1 comment
Assignees
Labels
in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues 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-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues 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
Labels
in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants