|
55 | 55 | import org.hibernate.metamodel.model.domain.ManagedDomainType;
|
56 | 56 | import org.hibernate.metamodel.model.domain.PersistentAttribute;
|
57 | 57 | import org.hibernate.metamodel.model.domain.PluralPersistentAttribute;
|
58 |
| -import org.hibernate.metamodel.model.domain.SimpleDomainType; |
59 | 58 | import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
|
60 | 59 | import org.hibernate.metamodel.model.domain.internal.AnyDiscriminatorSqmPath;
|
61 | 60 | import org.hibernate.metamodel.model.domain.internal.EntitySqmPathSource;
|
@@ -2109,10 +2108,10 @@ else if ( ( possibleEnumValues = getPossibleEnumValues( rightExpressionContext )
|
2109 | 2108 | final SqmExpression<?> r = (SqmExpression<?>) rightExpressionContext.accept( this );
|
2110 | 2109 | if ( l instanceof AnyDiscriminatorSqmPath && r instanceof SqmLiteralEntityType ) {
|
2111 | 2110 | left = l;
|
2112 |
| - right = createDiscriminatorValue( (AnyDiscriminatorSqmPath) left, rightExpressionContext ); |
| 2111 | + right = createDiscriminatorValue( (AnyDiscriminatorSqmPath<?>) left, rightExpressionContext ); |
2113 | 2112 | }
|
2114 | 2113 | else if ( r instanceof AnyDiscriminatorSqmPath && l instanceof SqmLiteralEntityType ) {
|
2115 |
| - left = createDiscriminatorValue( (AnyDiscriminatorSqmPath) r, leftExpressionContext ); |
| 2114 | + left = createDiscriminatorValue( (AnyDiscriminatorSqmPath<?>) r, leftExpressionContext ); |
2116 | 2115 | right = r;
|
2117 | 2116 | }
|
2118 | 2117 | else {
|
@@ -2154,7 +2153,7 @@ else if ( right instanceof SqmLiteralNull<?> ) {
|
2154 | 2153 | }
|
2155 | 2154 |
|
2156 | 2155 | private <T> SqmExpression<T> createDiscriminatorValue(
|
2157 |
| - AnyDiscriminatorSqmPath anyDiscriminatorTypeSqmPath, |
| 2156 | + AnyDiscriminatorSqmPath<T> anyDiscriminatorTypeSqmPath, |
2158 | 2157 | HqlParser.ExpressionContext valueExpressionContext) {
|
2159 | 2158 | return new SqmAnyDiscriminatorValue<>(
|
2160 | 2159 | anyDiscriminatorTypeSqmPath.getNodeType().getPathName(),
|
@@ -2392,7 +2391,9 @@ public SqmPredicate visitBooleanExpressionPredicate(HqlParser.BooleanExpressionP
|
2392 | 2391 | if ( expression.getJavaType() != Boolean.class ) {
|
2393 | 2392 | throw new SemanticException( "Non-boolean expression used in predicate context: " + ctx.getText() );
|
2394 | 2393 | }
|
2395 |
| - return new SqmBooleanExpressionPredicate( expression, creationContext.getNodeBuilder() ); |
| 2394 | + @SuppressWarnings("unchecked") |
| 2395 | + final SqmExpression<Boolean> booleanExpression = expression; |
| 2396 | + return new SqmBooleanExpressionPredicate( booleanExpression, creationContext.getNodeBuilder() ); |
2396 | 2397 | }
|
2397 | 2398 |
|
2398 | 2399 | @Override
|
@@ -2433,7 +2434,7 @@ public SqmPath<?> visitEntityIdReference(HqlParser.EntityIdReferenceContext ctx)
|
2433 | 2434 | if ( ctx.getChildCount() != 5 ) {
|
2434 | 2435 | return idPath;
|
2435 | 2436 | }
|
2436 |
| - final HqlParser.PathContinuationContext pathContinuationContext = (HqlParser.PathContinuationContext) ctx.getChild( 4 ); |
| 2437 | +// final HqlParser.PathContinuationContext pathContinuationContext = (HqlParser.PathContinuationContext) ctx.getChild( 4 ); |
2437 | 2438 |
|
2438 | 2439 | throw new NotYetImplementedFor6Exception( "Path continuation from `id()` reference not yet implemented" );
|
2439 | 2440 | }
|
@@ -2538,7 +2539,7 @@ public SqmFkExpression<?> visitToOneFkReference(HqlParser.ToOneFkReferenceContex
|
2538 | 2539 |
|
2539 | 2540 | }
|
2540 | 2541 |
|
2541 |
| - return new SqmFkExpression( (SqmEntityValuedSimplePath<?>) sqmPath, creationContext.getNodeBuilder() ); |
| 2542 | + return new SqmFkExpression<>( (SqmEntityValuedSimplePath<?>) sqmPath, creationContext.getNodeBuilder() ); |
2542 | 2543 | }
|
2543 | 2544 |
|
2544 | 2545 | @Override
|
@@ -3360,7 +3361,6 @@ private SqmLiteral<? extends Number> hexLiteral(String text) {
|
3360 | 3361 | value = Integer.parseUnsignedInt( text, 16 );
|
3361 | 3362 | type = resolveExpressibleTypeBasic( Integer.class );
|
3362 | 3363 | }
|
3363 |
| - //noinspection unchecked |
3364 | 3364 | return new SqmLiteral<>(
|
3365 | 3365 | value,
|
3366 | 3366 | type,
|
@@ -3557,10 +3557,13 @@ public Object visitGenericFunction(HqlParser.GenericFunctionContext ctx) {
|
3557 | 3557 | );
|
3558 | 3558 | }
|
3559 | 3559 |
|
| 3560 | + //TODO: this fragment of code is extremely fragile and lacking in typesafety! |
3560 | 3561 | final ParseTree argumentChild = ctx.getChild( 2 );
|
3561 | 3562 | final List<SqmTypedNode<?>> functionArguments;
|
3562 | 3563 | if ( argumentChild instanceof HqlParser.GenericFunctionArgumentsContext ) {
|
3563 |
| - functionArguments = (List<SqmTypedNode<?>>) argumentChild.accept( this ); |
| 3564 | + @SuppressWarnings("unchecked") |
| 3565 | + List<SqmTypedNode<?>> node = (List<SqmTypedNode<?>>) argumentChild.accept(this); |
| 3566 | + functionArguments = node; |
3564 | 3567 | }
|
3565 | 3568 | else if ( "*".equals( argumentChild.getText() ) ) {
|
3566 | 3569 | functionArguments = Collections.singletonList( new SqmStar( getCreationContext().getNodeBuilder() ) );
|
|
0 commit comments