Skip to content

Conversation

@cppwfs
Copy link
Collaborator

@cppwfs cppwfs commented Dec 2, 2025

Introduce JSpecify @NullMarked and @Nullable annotations across all modules to prevent null pointer exceptions at compile time using ErrorProne's NullAway checker.

Changes include:

  • Add @NullMarked to all package-info.java files to enable null-safety checking by default for all types in each package
  • Mark nullable fields and method parameters with @Nullable in core data models (TaskExecution, TaskProperties)
  • Update DAO interfaces and implementations (TaskExecutionDao, JdbcTaskExecutionDao, MapTaskExecutionDao) with proper nullability contracts for parameters and return types
  • Add null checks using Objects.requireNonNull before dereferencing potentially nullable fields in Spring-managed beans
  • Handle Spring framework patterns (@Autowired fields, @Value annotations, @PostConstruct initialization) by marking fields as @Nullable and adding runtime assertions where needed
  • Update repository layer (TaskRepository, SimpleTaskRepository, TaskExplorer) with accurate null contracts
  • Fix configuration classes (DefaultTaskConfigurer, SimpleTaskAutoConfiguration, TaskLifecycleConfiguration) to properly handle nullable dependencies
  • Update batch module autoconfiguration and listener classes with nullability annotations
  • Add nullability to stream event listeners and support classes
  • Configure Maven with .mvn/jvm.config and .mvn/maven.config to enable ErrorProne and NullAway checking via jspecify profile

Introduce JSpecify `@NullMarked` and `@Nullable` annotations across
all modules to prevent null pointer exceptions at compile time using
ErrorProne's NullAway checker.

Changes include:

- Add `@NullMarked` to all package-info.java files to enable
  null-safety checking by default for all types in each package
- Mark nullable fields and method parameters with `@Nullable` in core
  data models (`TaskExecution`, `TaskProperties`)
- Update DAO interfaces and implementations (`TaskExecutionDao`,
  `JdbcTaskExecutionDao`, `MapTaskExecutionDao`) with proper
  nullability contracts for parameters and return types
- Add null checks using `Objects.requireNonNull` before dereferencing
  potentially nullable fields in Spring-managed beans
- Handle Spring framework patterns (`@Autowired` fields, `@Value`
  annotations, `@PostConstruct` initialization) by marking fields as
  `@Nullable` and adding runtime assertions where needed
- Update repository layer (`TaskRepository`, `SimpleTaskRepository`,
  `TaskExplorer`) with accurate null contracts
- Fix configuration classes (`DefaultTaskConfigurer`,
  `SimpleTaskAutoConfiguration`, `TaskLifecycleConfiguration`) to
  properly handle nullable dependencies
- Update batch module autoconfiguration and listener classes with
  nullability annotations
- Add nullability to stream event listeners and support classes
- Configure Maven with `.mvn/jvm.config` and `.mvn/maven.config` to
  enable ErrorProne and NullAway checking via `jspecify` profile
@cppwfs cppwfs merged commit 7532ed8 into spring-cloud:main Dec 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant