mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 09:05:21 +00:00
squash some generic type-related warnings
This commit is contained in:
parent
9d62179d40
commit
cbaf856e18
@ -411,9 +411,10 @@ protected <Y> boolean isPrimitiveVariant(SingularAttribute<?,?> attribute, Class
|
|||||||
// Plural attributes
|
// Plural attributes
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Set<PluralAttribute<? super J, ?, ?>> getPluralAttributes() {
|
public Set<PluralAttribute<? super J, ?, ?>> getPluralAttributes() {
|
||||||
HashSet attributes = declaredPluralAttributes == null ? new HashSet<PluralAttribute<? super J, ?, ?>>() : new HashSet<PluralAttribute<? super J, ?, ?>>( declaredPluralAttributes.values() );
|
Set<PluralAttribute<? super J, ?, ?>> attributes = declaredPluralAttributes == null
|
||||||
|
? new HashSet<>()
|
||||||
|
: new HashSet<>( declaredPluralAttributes.values() );
|
||||||
if ( getSuperType() != null ) {
|
if ( getSuperType() != null ) {
|
||||||
attributes.addAll( getSuperType().getPluralAttributes() );
|
attributes.addAll( getSuperType().getPluralAttributes() );
|
||||||
}
|
}
|
||||||
@ -422,30 +423,26 @@ protected <Y> boolean isPrimitiveVariant(SingularAttribute<?,?> attribute, Class
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<PluralAttribute<J, ?, ?>> getDeclaredPluralAttributes() {
|
public Set<PluralAttribute<J, ?, ?>> getDeclaredPluralAttributes() {
|
||||||
return declaredPluralAttributes == null ?
|
return declaredPluralAttributes == null
|
||||||
Collections.EMPTY_SET : new HashSet<>( declaredPluralAttributes.values() );
|
? Collections.emptySet()
|
||||||
|
: new HashSet<>( declaredPluralAttributes.values() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "RedundantIfStatement"})
|
public PluralPersistentAttribute<? super J, ?, ?> findPluralAttribute(String name) {
|
||||||
public PluralPersistentAttribute findPluralAttribute(String name) {
|
|
||||||
PluralPersistentAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
PluralPersistentAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
||||||
if ( attribute != null ) {
|
if ( attribute != null ) {
|
||||||
return attribute;
|
return attribute;
|
||||||
}
|
}
|
||||||
|
else if ( getSuperType() != null ) {
|
||||||
if ( getSuperType() != null ) {
|
return getSuperType().findDeclaredPluralAttribute( name );
|
||||||
attribute = getSuperType().findDeclaredPluralAttribute( name );
|
}
|
||||||
if ( attribute != null ) {
|
else {
|
||||||
return attribute;
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public PluralPersistentAttribute<? super J, ?, ?> findDeclaredPluralAttribute(String name) {
|
public PluralPersistentAttribute<? super J, ?, ?> findDeclaredPluralAttribute(String name) {
|
||||||
return declaredPluralAttributes == null ? null : declaredPluralAttributes.get( name );
|
return declaredPluralAttributes == null ? null : declaredPluralAttributes.get( name );
|
||||||
}
|
}
|
||||||
@ -474,7 +471,7 @@ private <E> void checkTypeForPluralAttributes(
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public BagPersistentAttribute<? super J, ?> getCollection(String name) {
|
public BagPersistentAttribute<? super J, ?> getCollection(String name) {
|
||||||
PluralPersistentAttribute attribute = findPluralAttribute( name );
|
PluralPersistentAttribute<? super J, ?, ?> attribute = findPluralAttribute( name );
|
||||||
|
|
||||||
if ( attribute == null && getSuperType() != null ) {
|
if ( attribute == null && getSuperType() != null ) {
|
||||||
attribute = getSuperType().findPluralAttribute( name );
|
attribute = getSuperType().findPluralAttribute( name );
|
||||||
@ -505,7 +502,7 @@ private void basicCollectionCheck(PluralAttribute<? super J, ?, ?> attribute, St
|
|||||||
public <E> BagPersistentAttribute<? super J, E> getCollection(String name, Class<E> elementType) {
|
public <E> BagPersistentAttribute<? super J, E> getCollection(String name, Class<E> elementType) {
|
||||||
PluralAttribute<? super J, ?, ?> attribute = findPluralAttribute( name );
|
PluralAttribute<? super J, ?, ?> attribute = findPluralAttribute( name );
|
||||||
checkCollectionElementType( attribute, name, elementType );
|
checkCollectionElementType( attribute, name, elementType );
|
||||||
return (BagPersistentAttribute) attribute;
|
return (BagPersistentAttribute<? super J, E>) attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
private <E> void checkCollectionElementType(PluralAttribute<?,?,?> attribute, String name, Class<E> elementType) {
|
private <E> void checkCollectionElementType(PluralAttribute<?,?,?> attribute, String name, Class<E> elementType) {
|
||||||
@ -515,9 +512,9 @@ private <E> void checkCollectionElementType(PluralAttribute<?,?,?> attribute, St
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <E> CollectionAttribute<J, E> getDeclaredCollection(String name, Class<E> elementType) {
|
public <E> CollectionAttribute<J, E> getDeclaredCollection(String name, Class<E> elementType) {
|
||||||
final PluralAttribute attribute = findDeclaredPluralAttribute( name );
|
final PluralAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
||||||
checkCollectionElementType( attribute, name, elementType );
|
checkCollectionElementType( attribute, name, elementType );
|
||||||
return (CollectionAttribute) attribute;
|
return (CollectionAttribute<J, E>) attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -527,9 +524,9 @@ public <E> CollectionAttribute<J, E> getDeclaredCollection(String name, Class<E>
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public SetPersistentAttribute<? super J, ?> getSet(String name) {
|
public SetPersistentAttribute<? super J, ?> getSet(String name) {
|
||||||
final PluralAttribute attribute = findPluralAttribute( name );
|
final PluralAttribute<? super J, ?, ?> attribute = findPluralAttribute( name );
|
||||||
basicSetCheck( attribute, name );
|
basicSetCheck( attribute, name );
|
||||||
return (SetPersistentAttribute) attribute;
|
return (SetPersistentAttribute<? super J, ?>) attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void basicSetCheck(PluralAttribute<? super J, ?, ?> attribute, String name) {
|
private void basicSetCheck(PluralAttribute<? super J, ?, ?> attribute, String name) {
|
||||||
@ -544,7 +541,7 @@ private void basicSetCheck(PluralAttribute<? super J, ?, ?> attribute, String na
|
|||||||
public SetPersistentAttribute<J, ?> getDeclaredSet(String name) {
|
public SetPersistentAttribute<J, ?> getDeclaredSet(String name) {
|
||||||
final PluralPersistentAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
final PluralPersistentAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
||||||
basicSetCheck( attribute, name );
|
basicSetCheck( attribute, name );
|
||||||
return (SetPersistentAttribute) attribute;
|
return (SetPersistentAttribute<J, ?>) attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -562,7 +559,7 @@ private <E> void checkSetElementType(PluralAttribute<? super J, ?, ?> attribute,
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <E> SetAttribute<J, E> getDeclaredSet(String name, Class<E> elementType) {
|
public <E> SetAttribute<J, E> getDeclaredSet(String name, Class<E> elementType) {
|
||||||
final PluralAttribute attribute = findDeclaredPluralAttribute( name );
|
final PluralAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
||||||
checkSetElementType( attribute, name, elementType );
|
checkSetElementType( attribute, name, elementType );
|
||||||
return ( SetAttribute<J, E> ) attribute;
|
return ( SetAttribute<J, E> ) attribute;
|
||||||
}
|
}
|
||||||
@ -576,7 +573,7 @@ public <E> SetAttribute<J, E> getDeclaredSet(String name, Class<E> elementType)
|
|||||||
public ListPersistentAttribute<? super J, ?> getList(String name) {
|
public ListPersistentAttribute<? super J, ?> getList(String name) {
|
||||||
PluralAttribute<? super J, ?, ?> attribute = findPluralAttribute( name );
|
PluralAttribute<? super J, ?, ?> attribute = findPluralAttribute( name );
|
||||||
basicListCheck( attribute, name );
|
basicListCheck( attribute, name );
|
||||||
return (ListPersistentAttribute) attribute;
|
return (ListPersistentAttribute<? super J, ?>) attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void basicListCheck(PluralAttribute<? super J, ?, ?> attribute, String name) {
|
private void basicListCheck(PluralAttribute<? super J, ?, ?> attribute, String name) {
|
||||||
@ -591,7 +588,7 @@ private void basicListCheck(PluralAttribute<? super J, ?, ?> attribute, String n
|
|||||||
public ListPersistentAttribute<J, ?> getDeclaredList(String name) {
|
public ListPersistentAttribute<J, ?> getDeclaredList(String name) {
|
||||||
final PluralPersistentAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
final PluralPersistentAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
||||||
basicListCheck( attribute, name );
|
basicListCheck( attribute, name );
|
||||||
return (ListPersistentAttribute) attribute;
|
return (ListPersistentAttribute<J, ?>) attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -609,7 +606,7 @@ private <E> void checkListElementType(PluralAttribute<? super J, ?, ?> attribute
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <E> ListAttribute<J, E> getDeclaredList(String name, Class<E> elementType) {
|
public <E> ListAttribute<J, E> getDeclaredList(String name, Class<E> elementType) {
|
||||||
final PluralAttribute attribute = findDeclaredPluralAttribute( name );
|
final PluralAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
||||||
checkListElementType( attribute, name, elementType );
|
checkListElementType( attribute, name, elementType );
|
||||||
return ( ListAttribute<J, E> ) attribute;
|
return ( ListAttribute<J, E> ) attribute;
|
||||||
}
|
}
|
||||||
@ -623,7 +620,7 @@ public <E> ListAttribute<J, E> getDeclaredList(String name, Class<E> elementType
|
|||||||
public MapPersistentAttribute<? super J, ?, ?> getMap(String name) {
|
public MapPersistentAttribute<? super J, ?, ?> getMap(String name) {
|
||||||
PluralAttribute<? super J, ?, ?> attribute = findPluralAttribute( name );
|
PluralAttribute<? super J, ?, ?> attribute = findPluralAttribute( name );
|
||||||
basicMapCheck( attribute, name );
|
basicMapCheck( attribute, name );
|
||||||
return (MapPersistentAttribute) attribute;
|
return (MapPersistentAttribute<? super J, ?, ?>) attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void basicMapCheck(PluralAttribute<? super J, ?, ?> attribute, String name) {
|
private void basicMapCheck(PluralAttribute<? super J, ?, ?> attribute, String name) {
|
||||||
@ -638,7 +635,7 @@ private void basicMapCheck(PluralAttribute<? super J, ?, ?> attribute, String na
|
|||||||
public MapPersistentAttribute<J, ?, ?> getDeclaredMap(String name) {
|
public MapPersistentAttribute<J, ?, ?> getDeclaredMap(String name) {
|
||||||
final PluralPersistentAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
final PluralPersistentAttribute<? super J, ?, ?> attribute = findDeclaredPluralAttribute( name );
|
||||||
basicMapCheck( attribute, name );
|
basicMapCheck( attribute, name );
|
||||||
return (MapPersistentAttribute) attribute;
|
return (MapPersistentAttribute<J, ?, ?>) attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -672,10 +669,9 @@ public <K, V> MapAttribute<J, K, V> getDeclaredMap(String name, Class<K> keyType
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public SubGraphImplementor<J> makeSubGraph() {
|
public SubGraphImplementor<J> makeSubGraph() {
|
||||||
return new SubGraphImpl( this, true, jpaMetamodel() );
|
return new SubGraphImpl<>( this, true, jpaMetamodel() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -750,4 +746,9 @@ public void finishUp() {
|
|||||||
inFlightAccess = null;
|
inFlightAccess = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getClass().getSimpleName() + "[" + hibernateTypeName + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user