Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

The connection between Checker Framework and Java Bean Validation Annotations; Javax and Jakarta

17 views
Skip to first unread message

Oliver Fischer

unread,
Nov 1, 2024, 11:01:51 AM11/1/24
to Checker Framework discussion
Hi guys,

I just noticed a difference in handling the @Nullable annotion if I switch from classic Java Bean Validation to Jakarta Bean Validation.

Some background. I had a small Spring Boot 3 application, used as proof of concept. Spring Boot uses Jakarta Bean Validation instead of Java Bean Validation.

That means that Spring Boot 3 uses


jakarta.validation.constraints.NotNull;

while Spring Boot 2 uses

javax.validation.constraints.NotNull;

I have some methods annotated like this one:

public
@NotNull(message = "Image version must be given")
@NotBlank(message = "Image version name must not be blank")
@Nullable String getVersion() { return version; }

Using the javax.* annotations this leads to errors generated by the compiler using the Checker Framework. If I use the jakarta.* annotations, the compiler does not complain.

So, does the Checker Framework also consider the Bean Validation annotations? And is support for Jakarta currently not given?

Thank you in advance?

Oliver

Michael Ernst

unread,
Nov 1, 2024, 11:11:00 AM11/1/24
to Oliver Fischer, Checker Framework discussion
Oliver-

The manual lists the annotations supported by the Nullness Checker.
It does not currently include the jakarta.* annotations, but we will add them.

-Mike

--

---
You received this message because you are subscribed to the Google Groups "Checker Framework discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to checker-framework-...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/checker-framework-discuss/4affd601-f34d-4d31-b5ef-f653ebe9d3fdn%40googlegroups.com.

Michael Ernst

unread,
Nov 1, 2024, 6:17:07 PM11/1/24
to Oliver Fischer, Checker Framework discussion
The latest release of the Checker Framework (3.48.2) supports the jakarta.validation.constraints.NotNull type annotation.

-Mike
Reply all
Reply to author
Forward
0 new messages