Skip to content

Conversation

@beikov
Copy link
Member

@beikov beikov commented Oct 31, 2025

Fixed potential NPEs in/for:

  • ArrayViaElementArgumentReturnTypeResolver
  • SqmPathRegistry#resolveFrom
  • SqmCriteriaNodeBuilder#createNullifFunctionNode
  • SqmBasicValuedSimplePath#getJavaTypeClass
  • SqmWindowFrame methods equals/hashCode/isCompatible/cacheHashCode
  • SqmConflictUpdateAction#where
  • SqmDynamicInstantiation#checkInstantiation
  • SqmQuerySpec method setRestriction/setGroupRestriction/collectSelectedFromSet
  • SqmSubQuery#getTupleLength
  • AbstractSqmRestrictedDmlStatement#setWhere

Also:

  • Add SqmPathRegistry#resolveFromByPath to return non-null value contrary to findFromByPath
  • Cleanup SqmFieldLiteral implementation by extending AbstractSqmExpression
  • Respect jakarta.persistence.criteria.AbstractQuery#getResultType contract to be non-null
  • Respect HibernateCriteriaBuilder#unwrap contract to be non-null
  • Remove NullSqmExpressible in favor of using null, since the Parameter type is nullable anyway
  • Fix SqmFromClause#appendHqlString not handling certain types of Sqm root and join nodes
  • Fix AbstractSqmSelectQuery#getSelection to behave according to JPA spec
  • Fix SqmSubQuery methods getSelection/getCompoundSelectionItems/isCompoundSelection to behave according to JPA spec
  • Make SqmFromClause and SqmSelectClause in SqmQuerySpec final and non-null
  • Make SqmSetClause in SqmUpdateStatement non-null

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Oct 31, 2025

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
    ↳ Offending commits: [81f6097]

› This message was automatically generated.


@Override
public AbstractIdentifiableType<? super J> getSuperType() {
public @Nullable AbstractIdentifiableType<? super J> getSuperType() {

Check notice

Code scanning / CodeQL

Confusing method names because of capitalization Note

The method 'getSuperType' may be confused with
getSupertype
.

@Override
JpaJoin<L, R> on(Expression<Boolean> restriction);
JpaJoin<L, R> on(@Nullable Expression<Boolean> restriction);

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method JpaJoin.on(..) could be confused with overloaded method
on
, since dispatch depends on static types.

@Override
JpaJoin<L, R> on(Predicate... restrictions);
JpaJoin<L, R> on(Predicate @Nullable... restrictions);

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method JpaJoin.on(..) could be confused with overloaded method
on
, since dispatch depends on static types.
JpaQueryStructure<T> setRestriction(@Nullable JpaPredicate restriction);

JpaQueryStructure<T> setRestriction(Expression<Boolean> restriction);
JpaQueryStructure<T> setRestriction(@Nullable Expression<Boolean> restriction);

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method JpaQueryStructure.setRestriction(..) could be confused with overloaded method
setRestriction
, since dispatch depends on static types.
JpaQueryStructure<T> setGroupRestriction(@Nullable JpaPredicate restrictions);

JpaQueryStructure<T> setGroupRestriction(Expression<Boolean> restriction);
JpaQueryStructure<T> setGroupRestriction(@Nullable Expression<Boolean> restriction);

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method JpaQueryStructure.setGroupRestriction(..) could be confused with overloaded method
setGroupRestriction
, since dispatch depends on static types.
return getRegisteredType( javaType.getTypeName() );
}

public <J> BasicType<J> getRegisteredType(Class<J> javaType) {
public <J> @Nullable BasicType<J> getRegisteredType(Class<J> javaType) {

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method BasicTypeRegistry.getRegisteredType(..) could be confused with overloaded method
getRegisteredType
, since dispatch depends on static types.
SqmBindableType<?> firstType,
SqmBindableType<?> secondType,
public @Nullable SqmBindableType<?> resolveArithmeticType(
@Nullable SqmBindableType<?> firstType,

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'operator' is never used.
return type == null ? null
: getSqlTemporalType( type.getRelationalJavaType()
.getRecommendedJdbcType( getCurrentBaseSqlTypeIndicators() ) );

}

@SuppressWarnings("deprecation")
public static TemporalType getSqlTemporalType(JdbcMapping jdbcMapping) {
public static @Nullable TemporalType getSqlTemporalType(JdbcMapping jdbcMapping) {

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method TypeConfiguration.getSqlTemporalType(..) could be confused with overloaded method
getSqlTemporalType
, since dispatch depends on static types.
Method TypeConfiguration.getSqlTemporalType(..) could be confused with overloaded method
getSqlTemporalType
, since dispatch depends on static types.
Method TypeConfiguration.getSqlTemporalType(..) could be confused with overloaded method
getSqlTemporalType
, since dispatch depends on static types.
return getSqlTemporalType( jdbcMapping.getJdbcType() );
}

@SuppressWarnings("deprecation")
public static TemporalType getSqlTemporalType(JdbcMappingContainer jdbcMappings) {
public static @Nullable TemporalType getSqlTemporalType(JdbcMappingContainer jdbcMappings) {

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method TypeConfiguration.getSqlTemporalType(..) could be confused with overloaded method
getSqlTemporalType
, since dispatch depends on static types.
Method TypeConfiguration.getSqlTemporalType(..) could be confused with overloaded method
getSqlTemporalType
, since dispatch depends on static types.
assert jdbcMappings.getJdbcTypeCount() == 1;
return getSqlTemporalType( jdbcMappings.getSingleJdbcMapping().getJdbcType() );
}

@SuppressWarnings("deprecation")
public static TemporalType getSqlTemporalType(MappingModelExpressible<?> type) {
public static @Nullable TemporalType getSqlTemporalType(MappingModelExpressible<?> type) {

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method TypeConfiguration.getSqlTemporalType(..) could be confused with overloaded method
getSqlTemporalType
, since dispatch depends on static types.
@beikov beikov force-pushed the sqm-null-annotations branch 2 times, most recently from aaca3b6 to b8f1e2e Compare November 3, 2025 13:32
@beikov beikov force-pushed the sqm-null-annotations branch from b8f1e2e to 81f6097 Compare November 3, 2025 15:44
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