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 = [
|
||||
'-AsuppressWarnings=initialization',
|
||||
"-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 org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import static org.hibernate.engine.FetchStyle.SUBSELECT;
|
||||
import static org.hibernate.engine.FetchTiming.IMMEDIATE;
|
||||
import static org.hibernate.engine.FetchStyle.JOIN;
|
||||
|
@ -36,7 +38,7 @@ public class DefaultFetchProfile extends FetchProfile {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Fetch getFetchByRole(String role) {
|
||||
public @Nullable Fetch getFetchByRole(String role) {
|
||||
final int last = role.lastIndexOf('.');
|
||||
final String entityName = role.substring( 0, last );
|
||||
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.Type;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import static org.hibernate.engine.FetchStyle.JOIN;
|
||||
import static org.hibernate.engine.FetchStyle.SUBSELECT;
|
||||
|
||||
|
@ -47,7 +49,7 @@ public class FetchProfile {
|
|||
|
||||
private boolean containsJoinFetchedCollection;
|
||||
private boolean containsJoinFetchedBag;
|
||||
private Fetch bagJoinFetch;
|
||||
private @Nullable Fetch bagJoinFetch;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
if ( containsJoinFetchedBag ) {
|
||||
// just for safety...
|
||||
if ( fetches.remove( bagJoinFetch.getAssociation().getRole() ) != bagJoinFetch ) {
|
||||
if ( bagJoinFetch != null && fetches.remove( bagJoinFetch.getAssociation().getRole() ) != bagJoinFetch ) {
|
||||
LOG.unableToRemoveBagJoinFetch();
|
||||
}
|
||||
bagJoinFetch = null;
|
||||
|
@ -153,7 +155,7 @@ public class FetchProfile {
|
|||
* @return The {@code Fetch}, or {@code null} if there was
|
||||
* no {@code Fetch} for the given association
|
||||
*/
|
||||
public Fetch getFetchByRole(String role) {
|
||||
public @Nullable Fetch getFetchByRole(String role) {
|
||||
return fetches.get( role );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue