Skip to content

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

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

Closed
spring-projects-issues opened this issue Aug 1, 2017 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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:

Referenced from: commits 09f5c71

@spring-projects-issues
Copy link
Collaborator Author

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 Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants