Skip to content

Commit 6261c35

Browse files
committed
Remove IntelliJ warnings in main
1 parent f2239cb commit 6261c35

File tree

10 files changed

+22
-51
lines changed

10 files changed

+22
-51
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/engine/impl/ForeignKeys.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ private CompletionStage<Boolean> isNullifiable(final String entityName, Object o
250250
*
251251
* @return {@code true} if the given entity is not transient (meaning it is either detached/persistent)
252252
*/
253-
@SuppressWarnings("SimplifiableIfStatement")
254253
public static CompletionStage<Boolean> isNotTransient(String entityName, Object entity, Boolean assumed, SessionImplementor session) {
255254
if ( entity instanceof HibernateProxy ) {
256255
return trueFuture();
@@ -422,7 +421,7 @@ else if ( type.isAnyType() ) {
422421
nonNullableTransientEntities.add( propertyName, value );
423422
}
424423
} );
425-
};
424+
}
426425
}
427426
else if ( type.isComponentType() ) {
428427
final CompositeType actype = (CompositeType) type;

hibernate-reactive-core/src/main/java/org/hibernate/reactive/event/impl/DefaultReactiveFlushEntityEventListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class DirtyCheckContextImpl implements CustomEntityDirtinessStrategy.DirtyCheckC
525525
@Override
526526
public void doDirtyChecking(CustomEntityDirtinessStrategy.AttributeChecker attributeChecker) {
527527
found = new DirtyCheckAttributeInfoImpl( event ).visitAttributes( attributeChecker );
528-
if ( found != null && found.length == 0 ) {
528+
if ( found.length == 0 ) {
529529
found = null;
530530
}
531531
}

hibernate-reactive-core/src/main/java/org/hibernate/reactive/loader/collection/impl/ReactivePaddedBatchingCollectionInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
class ReactivePaddedBatchingCollectionInitializer extends ReactiveCollectionLoader {
2525

26-
private QueryableCollection persister;
26+
private final QueryableCollection persister;
2727
private final int[] batchSizes;
2828
private final ReactiveCollectionLoader[] loaders;
2929

hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveAbstractEntityPersister.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,6 @@ default CompletionStage<?> generateValue(
761761
InMemoryValueGenerationStrategy valueGenerationStrategy) {
762762
final ValueGenerator<?> valueGenerator = valueGenerationStrategy.getValueGenerator();
763763
if ( valueGenerator instanceof StageValueGenerator ) {
764-
final StageSessionFactoryImpl stageFactory = new StageSessionFactoryImpl( (SessionFactoryImpl) session.getFactory() );
765764
final Stage.Session stageSession = new StageSessionImpl( (ReactiveSession) session );
766765
return ( (StageValueGenerator<?>) valueGenerator )
767766
.generateValue( stageSession, owner );

hibernate-reactive-core/src/main/java/org/hibernate/reactive/pool/impl/SQLServerParameters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private static class Parser {
8181
private boolean inCComment;
8282
private boolean escaped;
8383
private int count = 0;
84-
private StringBuilder result;
84+
private final StringBuilder result;
8585
private int previous;
8686

8787
private Parser(String sql) {

hibernate-reactive-core/src/main/java/org/hibernate/reactive/pool/impl/SqlClientConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ private <T> T convertException(T rows, String sql, Throwable sqlException) {
150150
if ( sqlException == null ) {
151151
return rows;
152152
}
153-
if ( SQLIntegrityConstraintViolationException.class.isInstance( sqlException ) ) {
153+
if ( sqlException instanceof SQLIntegrityConstraintViolationException ) {
154154
throw new ConstraintViolationException( "could not execute statement", (SQLException) sqlException, sql );
155155
}
156-
if ( SQLException.class.isInstance( sqlException ) ) {
156+
if ( sqlException instanceof SQLException ) {
157157
throw new VertxSqlClientException( "could not execute statement", (SQLException) sqlException, sql );
158158
}
159159
return rethrow( sqlException );

hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/MySqlReactiveInformationExtractorImpl.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,9 @@ protected <T> T processImportedKeysResultSet(
177177
}
178178
orderByList.add( "ordinal_position" );
179179

180-
if ( orderByList.size() > 0 ) {
181-
sb.append( " order by " ).append( orderByList.get( 0 ) );
182-
for ( int i = 1 ; i < orderByList.size() ; i++ ) {
183-
sb.append( ", " ).append( orderByList.get( i ) );
184-
}
180+
sb.append( " order by " ).append( orderByList.get( 0 ) );
181+
for ( int i = 1 ; i < orderByList.size() ; i++ ) {
182+
sb.append( ", " ).append( orderByList.get( i ) );
185183
}
186184

187185
return getExtractionContext().getQueryResults( sb.toString(), parameters.toArray(), processor );

hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/OracleSqlReactiveInformationExtractorImpl.java

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected <T> T processPrimaryKeysResultSet(
3434
String catalogFilter,
3535
String schemaFilter,
3636
Identifier tableName,
37-
ExtractionContext.ResultSetProcessor<T> processor) throws SQLException {
37+
ExtractionContext.ResultSetProcessor<T> processor) {
3838
// This functionality is not used by ORM.
3939
throw new NotYetImplementedException();
4040
}
@@ -79,36 +79,18 @@ protected <T> T processImportedKeysResultSet(
7979
"(SELECT R_CONSTRAINT_NAME FROM USER_CONSTRAINTS WHERE OWNER = '" + schema + "' and table_name = '" + table + "' and CONSTRAINT_TYPE = 'R')";
8080

8181
final StringBuilder sb = new StringBuilder()
82-
.append( "select " + fkNameSubquery + " as " ).append( getResultSetForeignKeyLabel() )
82+
.append( "select " ).append( fkNameSubquery ).append( " as " ).append( getResultSetForeignKeyLabel() )
8383
.append( ", null as " ).append( getResultSetPrimaryKeyCatalogLabel() )
8484
.append( ", uc.owner as " ).append( getResultSetPrimaryKeySchemaLabel() )
8585
.append( ", ucc.table_name as " ).append( getResultSetPrimaryKeyTableLabel() )
8686
.append( ", ucc.column_name as ").append( getResultSetPrimaryKeyColumnNameLabel() )
8787
.append( ", ucc.column_name as " ).append( getResultSetForeignKeyColumnNameLabel() )
8888
.append( " from user_constraints uc join user_cons_columns ucc on uc.constraint_name = ucc.constraint_name ")
8989
// Exclude primary keys, which do not have a referenced table.
90-
.append( " where uc.constraint_name = " + constraintSubquery );
91-
92-
93-
// Now add constraints for the requested catalog/schema/table
94-
95-
final List<Object> parameters = new ArrayList<>();
96-
97-
final List<String> orderByList = new ArrayList<>();
98-
orderByList.add( "uc.owner" );
99-
orderByList.add( "ucc.table_name" );
100-
orderByList.add( "ucc.position" );
101-
102-
if ( orderByList.size() > 0 ) {
103-
sb.append( " order by " ).append( orderByList.get( 0 ) );
104-
for ( int i = 1 ; i < orderByList.size() ; i++ ) {
105-
sb.append( ", " ).append( orderByList.get( i ) );
106-
}
107-
}
108-
109-
T result = getExtractionContext().getQueryResults( sb.toString(), parameters.toArray(), processor );
90+
.append( " where uc.constraint_name = " ).append( constraintSubquery )
91+
.append( " order by uc.owner, ucc.table_name, ucc.position" );
11092

111-
return result;
93+
return getExtractionContext().getQueryResults( sb.toString(), null, processor );
11294
}
11395

11496
@Override

hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/SqlServerReactiveInformationExtractorImpl.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,8 @@ protected <T> T processIndexInfoResultSet(
189189

190190
sb.append( " order by OBJECT_SCHEMA_NAME( i.object_id), OBJECT_NAME( i.object_id ), ic.key_ordinal" );
191191

192-
T result = getExtractionContext().getQueryResults(
193-
sb.toString(),
194-
parameterValues.toArray(),
195-
processor
196-
);
197-
return result;
192+
return getExtractionContext()
193+
.getQueryResults( sb.toString(), parameterValues.toArray(), processor );
198194
}
199195

200196
@Override
@@ -241,11 +237,9 @@ protected <T> T processImportedKeysResultSet(
241237
}
242238
orderByList.add( "constraint_column_id" );
243239

244-
if ( orderByList.size() > 0 ) {
245-
sb.append( " order by " ).append( orderByList.get( 0 ) );
246-
for ( int i = 1 ; i < orderByList.size() ; i++ ) {
247-
sb.append( ", " ).append( orderByList.get( i ) );
248-
}
240+
sb.append( " order by " ).append( orderByList.get( 0 ) );
241+
for ( int i = 1 ; i < orderByList.size() ; i++ ) {
242+
sb.append( ", " ).append( orderByList.get( i ) );
249243
}
250244

251245
return getExtractionContext().getQueryResults( sb.toString(), parameters.toArray(), processor );

hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveStatelessSessionImpl.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -828,10 +828,9 @@ public <T> RootGraphImplementor<T> createEntityGraph(Class<T> entity) {
828828
private RootGraphImplementor<?> createEntityGraph(String graphName) {
829829
checkOpen();
830830
final RootGraphImplementor<?> named = getFactory().findEntityGraphByName( graphName );
831-
if ( named != null ) {
832-
return named.makeRootGraph( graphName, true );
833-
}
834-
return named;
831+
return named != null
832+
? named.makeRootGraph( graphName, true )
833+
: null;
835834
}
836835

837836
private RootGraphImplementor<?> getEntityGraph(String graphName) {

0 commit comments

Comments
 (0)