Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly declare nullability of declared API #129

Open
xenoterracide opened this issue Sep 14, 2024 · 7 comments
Open

Explicitly declare nullability of declared API #129

xenoterracide opened this issue Sep 14, 2024 · 7 comments
Labels
in: infrastructure Infrastructure related topics module: ddd Domain-Driven Design related support type: enhancement New feature or request

Comments

@xenoterracide
Copy link

I wish the package/modules (at least for ddd/event) were "Null marked". @Nullmarked being the annotation provided by https://jspecify.dev. Although I wouldn't care if another JPMS compatible library was used.

Although it should probably have runtime annotations since it seems jakarta-annotation is source only, which doesn't work for spotbugs, and some other things.

not having this will make my replacing some of my own interfaces harder if not impossible.

Note: at this time I don't think... anything really supports just @Nullmarked although some support non null by default and that can be used as a hint.

I'd be willing to put in some legwork here.

@odrotbohm odrotbohm changed the title Nullity annotations Explicitly declare nullability of declared API Sep 20, 2024
@odrotbohm
Copy link
Member

As the amount of actual API we introduce is rather low (primarily a few of the interface types in jMolecules DDD) I'd consider this a low priority. Also, the first GA version of jSpecify is pretty young, it still has a few rough edges. There's work anticipated in that area for the next major revision of Spring Framework, favor but also some hesitation expressed in the interview with Jürgen here:

From the Spring side, we need official meta-annotation support so that we can declare our own nullability annotations with JSpecify meta-annotations instead of JSR 305 meta-annotations.

I'm not saying we need to adhere to Spring Framework, but describing the lack of usage of such annotations as “making something impossible” is a bit of a stretch, as virtually none of the Java world already work with them.

@odrotbohm odrotbohm added type: enhancement New feature or request module: ddd Domain-Driven Design related support in: infrastructure Infrastructure related topics labels Sep 20, 2024
@xenoterracide
Copy link
Author

there are alternatives that aren't jspecify. It's just one such set of annotations.

as virtually none of the Java world already work with them.

actually almost all of the java world works with them, just not according to spec. Rather you have to do the opposite of what they want an annotate all the things. Almost all of the java world just looks at the stringy name now, instead of relying on a pure list of annotations. That said, I'm not beholden to those, I don't much care, I'd just like to use something (that's not javax due to jpms).

I'd consider this a low priority

Fair, but I did offer to put in the effort.

@odrotbohm
Copy link
Member

Twisting my and your own words is not gonna get us any further. You explicitly mentioned jSpecify and I replied to that. I don't have anything to add what I wrote above: we hardly define any methods that would benefit from us deciding about the nullability constraints of those.

I am happy to revisit the places we already have actual assertions in place. That said, you can interpret the absence of nullabilty annotations an indicator of us currently not taking a stance on exactly that fact.

@xenoterracide
Copy link
Author

xenoterracide commented Sep 22, 2024

Although I wouldn't care if another JPMS compatible library was used.

I also said that. I think you are trying to twist my words.

That said, you can interpret the absence of nullabilty annotations an indicator of us currently not taking a stance on exactly that fact.

yeah, but that's not how existing tooling works with that. I might read it that way, but tooling doesn't ensure any safety in that case and can provide a variety of assumptions.

@xenoterracide
Copy link
Author

just an FYI, looks like spring is moving to jspecify spring-projects/spring-framework#28797 (comment)

@odrotbohm
Copy link
Member

You've read it here first, two weeks ago.

There's work anticipated in that area for the next major revision of Spring Framework …

@xenoterracide
Copy link
Author

Fair enough although you'll see that that ticket has some back and forth. The last I'd heard it was anticipated but they weren't going through with it yet because 1.0 didn't offer what they were looking for. I couldn't be sure you weren't working off of the information I had prior to that. which has been "they said they were", "they said they weren't". now they said they were again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: infrastructure Infrastructure related topics module: ddd Domain-Driven Design related support type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants