Skip to content

Commit 158771b

Browse files
committed
fix two warnings
1 parent 87df79a commit 158771b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,11 +2234,8 @@ private void addQueryMethod(
22342234
}
22352235

22362236
final AnnotationValue value = getAnnotationValue( mirror, "value" );
2237-
if ( value != null ) {
2238-
final Object queryString = value.getValue();
2239-
if ( queryString instanceof String ) {
2240-
addQueryMethod(method, returnType, containerTypeName, mirror, isNative, value, (String) queryString);
2241-
}
2237+
if ( value != null && value.getValue() instanceof String queryString ) {
2238+
addQueryMethod( method, returnType, containerTypeName, mirror, isNative, value, queryString );
22422239
}
22432240
}
22442241

@@ -2388,8 +2385,7 @@ else if ( isInsertUpdateDelete(hql) ) {
23882385
else {
23892386
final HqlLexer hqlLexer = HqlParseTreeBuilder.INSTANCE.buildHqlLexer( hql );
23902387
final List<? extends Token> allTokens = hqlLexer.getAllTokens();
2391-
for (int i = 0; i < allTokens.size(); i++) {
2392-
final Token token = allTokens.get(i);
2388+
for ( final Token token : allTokens ) {
23932389
switch ( token.getType() ) {
23942390
case FROM:
23952391
return hql;
@@ -2449,8 +2445,8 @@ private void validateHql(
24492445
context.getEntityNameMappings(), context.getEnumTypesByValue(), context.isIndexing() )
24502446
);
24512447
if ( statement != null ) {
2452-
if ( statement instanceof SqmSelectStatement ) {
2453-
validateSelectHql( method, returnType, mirror, value, (SqmSelectStatement<?>) statement );
2448+
if ( statement instanceof SqmSelectStatement<?> selectStatement ) {
2449+
validateSelectHql( method, returnType, mirror, value, selectStatement );
24542450
}
24552451
else {
24562452
validateUpdateHql( method, returnType, mirror, value );

0 commit comments

Comments
 (0)