HHH-16515 - Add o.h.engine.profile to nullness checking
Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
parent
ea56fbdb53
commit
e7d0bd0955
|
@ -525,7 +525,7 @@ checkerFramework {
|
||||||
extraJavacArgs = [
|
extraJavacArgs = [
|
||||||
'-AsuppressWarnings=initialization',
|
'-AsuppressWarnings=initialization',
|
||||||
"-Astubs=${project.rootDir}/checkerstubs",
|
"-Astubs=${project.rootDir}/checkerstubs",
|
||||||
'-AonlyDefs=^org\\.hibernate\\.(jpamodelgen|spi|pretty|stat|(action|context|bytecode)\\.spi)\\.'
|
'-AonlyDefs=^org\\.hibernate\\.(jpamodelgen|spi|pretty|stat|engine\\.profile|(action|context|bytecode)\\.spi)\\.'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@ import org.hibernate.tuple.NonIdentifierAttribute;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
import static org.hibernate.engine.FetchStyle.SUBSELECT;
|
import static org.hibernate.engine.FetchStyle.SUBSELECT;
|
||||||
import static org.hibernate.engine.FetchTiming.IMMEDIATE;
|
import static org.hibernate.engine.FetchTiming.IMMEDIATE;
|
||||||
import static org.hibernate.engine.FetchStyle.JOIN;
|
import static org.hibernate.engine.FetchStyle.JOIN;
|
||||||
|
@ -36,7 +38,7 @@ public class DefaultFetchProfile extends FetchProfile {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Fetch getFetchByRole(String role) {
|
public @Nullable Fetch getFetchByRole(String role) {
|
||||||
final int last = role.lastIndexOf('.');
|
final int last = role.lastIndexOf('.');
|
||||||
final String entityName = role.substring( 0, last );
|
final String entityName = role.substring( 0, last );
|
||||||
final String property = role.substring( last + 1 );
|
final String property = role.substring( last + 1 );
|
||||||
|
|
|
@ -16,6 +16,8 @@ import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.type.BagType;
|
import org.hibernate.type.BagType;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
|
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
import static org.hibernate.engine.FetchStyle.JOIN;
|
import static org.hibernate.engine.FetchStyle.JOIN;
|
||||||
import static org.hibernate.engine.FetchStyle.SUBSELECT;
|
import static org.hibernate.engine.FetchStyle.SUBSELECT;
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ public class FetchProfile {
|
||||||
|
|
||||||
private boolean containsJoinFetchedCollection;
|
private boolean containsJoinFetchedCollection;
|
||||||
private boolean containsJoinFetchedBag;
|
private boolean containsJoinFetchedBag;
|
||||||
private Fetch bagJoinFetch;
|
private @Nullable Fetch bagJoinFetch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a {@link FetchProfile} with the given unique name.
|
* Constructs a {@link FetchProfile} with the given unique name.
|
||||||
|
@ -117,7 +119,7 @@ public class FetchProfile {
|
||||||
// we need to go back and ignore that previous bag join fetch.
|
// we need to go back and ignore that previous bag join fetch.
|
||||||
if ( containsJoinFetchedBag ) {
|
if ( containsJoinFetchedBag ) {
|
||||||
// just for safety...
|
// just for safety...
|
||||||
if ( fetches.remove( bagJoinFetch.getAssociation().getRole() ) != bagJoinFetch ) {
|
if ( bagJoinFetch != null && fetches.remove( bagJoinFetch.getAssociation().getRole() ) != bagJoinFetch ) {
|
||||||
LOG.unableToRemoveBagJoinFetch();
|
LOG.unableToRemoveBagJoinFetch();
|
||||||
}
|
}
|
||||||
bagJoinFetch = null;
|
bagJoinFetch = null;
|
||||||
|
@ -153,7 +155,7 @@ public class FetchProfile {
|
||||||
* @return The {@code Fetch}, or {@code null} if there was
|
* @return The {@code Fetch}, or {@code null} if there was
|
||||||
* no {@code Fetch} for the given association
|
* no {@code Fetch} for the given association
|
||||||
*/
|
*/
|
||||||
public Fetch getFetchByRole(String role) {
|
public @Nullable Fetch getFetchByRole(String role) {
|
||||||
return fetches.get( role );
|
return fetches.get( role );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue