Skip to content

Conversation

scordio
Copy link
Contributor

@scordio scordio commented Aug 11, 2025

See #32683.

Deliverables

  • Annotate all existing Assert implementations
  • Build ArchUnit rule to ensure consistency

@snicoll
Copy link
Member

snicoll commented Aug 11, 2025

See #32683 (comment)

@snicoll snicoll added the status: on-hold We can't start working on this issue yet label Aug 11, 2025
@scordio scordio marked this pull request as draft August 11, 2025 07:30
@scordio
Copy link
Contributor Author

scordio commented Aug 11, 2025

As I need to extend Checkstyle's import-control.xml, would it be fine to add a top-level allow statement close to:

<allow class="org.springframework.lang.Contract" />

or should I define a more fine-grained rule, restricting it to the following packages?

  • org.springframework.boot.test.context.assertj
  • org.springframework.boot.test.json

@snicoll
Copy link
Member

snicoll commented Aug 11, 2025

would it be fine to add a top-level allow statement close to

Yep. The intention is to restrict only to certain AssertJ entry point and this is one of them so I think that's ok.

@snicoll
Copy link
Member

snicoll commented Sep 10, 2025

@scordio how is it going, anything I can do to help?

@scordio
Copy link
Contributor Author

scordio commented Sep 10, 2025

Apologies, life happened and this fell off my radar! 🤦

If not in a rush, I'm happy to continue on it over the weekend.

@wilkinsona
Copy link
Member

Thanks, @scordio. There's no rush.

@scordio scordio force-pushed the gh-32683-CheckReturnValue branch from 8978e51 to 76f6b34 Compare September 14, 2025 12:20
@scordio scordio force-pushed the gh-32683-CheckReturnValue branch from 76f6b34 to 934b746 Compare September 14, 2025 12:21
@scordio scordio changed the title Annotate ApplicationContextAssert methods with @CheckReturnValue Decorate all Assert implementations with @CheckReturnValue Sep 14, 2025
@scordio
Copy link
Contributor Author

scordio commented Sep 14, 2025

When building the project locally, I get two NullAway errors on :core:spring-boot:compileJava:

/Users/stefano/Projects/spring-boot/core/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ValueObjectBinder.java:424: error: [NullAway] Method returns @Nullable String @Nullable [], but overridden method returns String [], which has mismatched type parameter nullability
		public @Nullable String @Nullable [] getParameterNames(Constructor<?> constructor) {
		                                     ^
    (see http://t.uber.com/nullaway )
/Users/stefano/Projects/spring-boot/core/spring-boot/src/main/java/org/springframework/boot/logging/structured/StructuredLogFormatterFactory.java:240: error: [NullAway] referenced method returns @Nullable, but functional interface method java.util.function.Function.apply(T) returns @NonNull
					ArgumentResolver.from(StructuredLogFormatterFactory.this.instantiator::getArg));
					                      ^
    (see http://t.uber.com/nullaway )

but the CI seems fine 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: on-hold We can't start working on this issue yet status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants