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

Migrate to JSpecify annotations for nullability constraints. #625

Closed
wants to merge 4 commits into from

Conversation

christophstrobl
Copy link
Member

No description provided.

pom.xml Outdated
@@ -45,6 +45,11 @@
<version>${querydsl}</version>
<optional>true</optional>
</dependency>
<dependency>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't required, JSpecify is a transitive dependency of Spring Framework.

@@ -195,6 +195,7 @@ public <T> T update(Object id, T objectToUpdate) {
Assert.notNull(objectToUpdate, "Object to be updated must not be null");

String keyspace = resolveKeySpace(objectToUpdate.getClass());
Assert.notNull(keyspace, "Keyspace must not be null");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be required.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch - added that one before the null check in resolveKeySpace - same goes for others


Assert.notNull(id, "Id for object to be deleted must not be null");
Assert.notNull(type, "Type to delete must not be null");

String keyspace = resolveKeySpace(type);
Assert.notNull(keyspace, "Keyspace must not be null");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be required.

@@ -233,6 +235,7 @@ public <T> Optional<T> findById(Object id, Class<T> type) {
Assert.notNull(type, "Type to fetch must not be null");

String keyspace = resolveKeySpace(type);
Assert.notNull(keyspace, "Keyspace must not be null");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be required.

@@ -78,12 +79,13 @@ private List<?> sortAndFilterMatchingRange(Iterable<?> source, @Nullable Predica
return filterMatchingRange(tmp, criteria, offset, rows);
}

private static <S> List<S> filterMatchingRange(List<S> source, @Nullable Predicate criteria, long offset, int rows) {
@Contract("!null, _, _, _ -> !null")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, the return is never null and source cannot be null. You sure about this annotation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never null regardless of input - I don't mind dropping it.

@@ -145,7 +145,7 @@ public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConf

AbstractBeanDefinition beanDefinition = getDefaultKeyValueTemplateBeanDefinition(configurationSource);

if (beanDefinition != null) {
if (beanDefinition != null && configurationSource.getSource() != null) {
registerIfNotAlreadyRegistered(() -> beanDefinition, registry, keyValueTemplateName.get(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a missing @Nullable annotation for source in Commons.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe... care to check in commons.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mp911de mp911de added the type: enhancement A general enhancement label Feb 18, 2025
@mp911de mp911de linked an issue Feb 18, 2025 that may be closed by this pull request
mp911de pushed a commit that referenced this pull request Feb 20, 2025
mp911de pushed a commit that referenced this pull request Feb 20, 2025
See #618
Original pull request: #625
@mp911de mp911de added this to the 4.0 M2 (2025.1.0) milestone Feb 20, 2025
@mp911de mp911de closed this Feb 20, 2025
@mp911de mp911de deleted the issue/618 branch February 20, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to JSpecify annotations for nullability constraints
2 participants