Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-15841

BeanDefinitionBuilder method arguments not annotated with @Nullable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 5.0 RC3
    • Fix Version/s: 5.0 RC4
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      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 …;
      	}
      }
      

        Issue Links

          Activity

          Hide
          juergen.hoeller Juergen Hoeller added a comment -

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

          Show
          juergen.hoeller Juergen Hoeller added a comment - Good catch. We were also missing nullable declarations on constructor and property arguments there.

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              mp911de Mark Paluch
              Last updater:
              Stéphane Nicoll
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                7 weeks, 5 days ago