Skip to content

Commit 81d196b

Browse files
committed
Fix NullAway suppression in EntityManagerFactoryBuilder
See gh-46587
1 parent fb429bc commit 81d196b

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

module/spring-boot-jpa/src/main/java/org/springframework/boot/jpa/EntityManagerFactoryBuilder.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ public LocalContainerEntityManagerFactoryBean build() {
266266
if (this.managedTypes != null) {
267267
entityManagerFactoryBean.setManagedTypes(this.managedTypes);
268268
}
269-
else {
270-
setPackagesToScan(entityManagerFactoryBean);
269+
else if (this.packagesToScan != null) {
270+
entityManagerFactoryBean.setPackagesToScan(this.packagesToScan);
271271
}
272272
Map<String, ?> jpaProperties = EntityManagerFactoryBuilder.this.jpaPropertiesFactory.apply(this.dataSource);
273273
entityManagerFactoryBean.getJpaPropertyMap().putAll(new LinkedHashMap<>(jpaProperties));
@@ -289,14 +289,6 @@ public LocalContainerEntityManagerFactoryBean build() {
289289
return entityManagerFactoryBean;
290290
}
291291

292-
// TODO: Review this. The test
293-
// HibernateJpaAutoConfigurationTests.usesManuallyDefinedLocalContainerEntityManagerFactoryBeanUsingBuilder
294-
// fails if an non-null assert is added
295-
@SuppressWarnings("NullAway")
296-
private void setPackagesToScan(LocalContainerEntityManagerFactoryBean entityManagerFactoryBean) {
297-
entityManagerFactoryBean.setPackagesToScan(this.packagesToScan);
298-
}
299-
300292
}
301293

302294
}

0 commit comments

Comments
 (0)