more @SuppressWarnings cleanups

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-09-05 09:58:11 +02:00
parent 5748376edc
commit 52a9de7cac
8 changed files with 12 additions and 17 deletions

View File

@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class CompositePropertyRefTest {
@Test
@SuppressWarnings({ "unchecked", "UnusedAssignment" })
@SuppressWarnings({ "unchecked", "unused" })
public void testOneToOnePropertyRef(SessionFactoryScope scope) {
scope.inTransaction(
session -> {

View File

@ -2878,7 +2878,6 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
@Test
@SkipForDialect(value = CockroachDialect.class, comment = "https://github.com/cockroachdb/cockroach/issues/41943")
@SuppressWarnings( {"UnusedAssignment", "UnusedDeclaration"})
public void testSelectExpressions() {
createTestBaseData();
Session session = openSession();
@ -3417,7 +3416,7 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
}
@Test
@SuppressWarnings( {"UnusedAssignment"})
@SuppressWarnings("unused")
public void testCachedJoinedAndJoinFetchedManyToOne() throws Exception {
Animal a = new Animal();
a.setDescription( "an animal" );
@ -3469,7 +3468,6 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
}
@Test
@SuppressWarnings( {"UnusedAssignment", "UnusedDeclaration"})
public void testCachedJoinedAndJoinFetchedOneToMany() throws Exception {
Animal a = new Animal();
a.setDescription( "an animal" );

View File

@ -99,7 +99,7 @@ public class MappedSuperclassWithGenericsTest {
private String keyThree;
}
@SuppressWarnings( "UnusedDeclaration" )
@SuppressWarnings("unused")
public static class PK implements Serializable {
private String keyOne;
private String keyTwo;

View File

@ -44,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertSame;
@BaseUnitTest
public class SimpleNationalizedTest {
@SuppressWarnings({ "UnusedDeclaration", "SpellCheckingInspection" })
@SuppressWarnings("unused")
@Entity(name = "NationalizedEntity")
public static class NationalizedEntity {
@Id

View File

@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
@SessionFactory
public class OneToManyTest {
@SuppressWarnings({ "unchecked", "UnusedAssignment" })
@SuppressWarnings("unchecked")
@Test
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsTemporaryTable.class)
public void testOneToManyLinkTable(SessionFactoryScope scope) {
@ -49,6 +49,7 @@ public class OneToManyTest {
}
);
@SuppressWarnings("unused")
Child merged = scope.fromTransaction(
session -> {
c.setParent( null );
@ -67,6 +68,7 @@ public class OneToManyTest {
scope.inTransaction(
session -> {
@SuppressWarnings("unused")
Child child = (Child) session.createQuery( "from Child" ).uniqueResult();
session.createQuery( "from Child c left join fetch c.parent" ).list();
session.createQuery( "from Child c inner join fetch c.parent" ).list();

View File

@ -310,7 +310,7 @@ public class MergeTest extends AbstractOperationTestCase {
}
@Test
@SuppressWarnings({ "unchecked", "UnusedAssignment", "UnusedDeclaration" })
@SuppressWarnings({"unchecked", "unused"})
public void testNoExtraUpdatesOnPersistentMergeVersionedWithCollection(SessionFactoryScope scope) {
VersionedEntity parent = new VersionedEntity( "parent", "parent" );
VersionedEntity child = new VersionedEntity( "child", "child" );
@ -337,7 +337,7 @@ public class MergeTest extends AbstractOperationTestCase {
VersionedEntity persistentChild = (VersionedEntity) persistentParent.getChildren()
.iterator()
.next();
return (VersionedEntity) session.merge( persistentParent ); // <-- This merge leads to failure
return session.merge( persistentParent ); // <-- This merge leads to failure
}
);

View File

@ -24,7 +24,6 @@ import org.hibernate.Hibernate;
import org.hibernate.QueryException;
import org.hibernate.Transaction;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.HANADialect;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.orm.test.sql.hand.Dimension;
@ -79,6 +78,7 @@ import static org.junit.jupiter.api.Assertions.fail;
xmlMappings = { "org/hibernate/orm/test/sql/hand/query/NativeSQLQueries.hbm.xml" }
)
@SessionFactory
@SuppressWarnings({"deprecation", "unused", "rawtypes", "unchecked"})
public class NativeSQLQueriesTest {
protected String getOrganizationFetchJoinEmploymentSQL() {
@ -384,7 +384,6 @@ public class NativeSQLQueriesTest {
}
@Test
@SuppressWarnings( {"deprecation", "UnusedDeclaration"})
public void testMappedAliasStrategy(SessionFactoryScope scope) {
Organization ifa = new Organization("IFA");
Organization jboss = new Organization("JBoss");
@ -466,7 +465,6 @@ public class NativeSQLQueriesTest {
}
@Test
@SuppressWarnings( {"unchecked"})
@FailureExpected( jiraKey = "unknown" )
public void testCompositeIdJoins(SessionFactoryScope scope) {
scope.inTransaction(
@ -535,7 +533,6 @@ public class NativeSQLQueriesTest {
}
@Test
@SuppressWarnings( {"UnusedDeclaration", "deprecation", "UnusedAssignment"})
public void testAutoDetectAliasing(SessionFactoryScope scope) {
Organization ifa = new Organization("IFA");
Organization jboss = new Organization("JBoss");
@ -676,7 +673,6 @@ public class NativeSQLQueriesTest {
}
@Test
@SuppressWarnings("unused")
public void testExplicitReturnAPI(SessionFactoryScope scope) {
Organization jboss = new Organization( "JBoss" );
Person me = new Person( "Steve" );
@ -787,7 +783,6 @@ public class NativeSQLQueriesTest {
}
@Test
@SuppressWarnings( {"unchecked", "UnusedDeclaration"})
public void testAddJoinForManyToMany(SessionFactoryScope scope) {
Person gavin = new Person( "Gavin" );
Person max = new Person( "Max" );
@ -813,7 +808,7 @@ public class NativeSQLQueriesTest {
session.flush();
session.clear();
// todo : see http://opensource.atlassian.com/projects/hibernate/browse/HHH-3908
// todo : see HHH-3908
// String sqlStr = "SELECT {groupp.*} , {gp.*} " +
// "FROM GROUPP groupp, GROUP_PERSON gp, PERSON person WHERE groupp.ID = gp.GROUP_ID and person.PERID = gp.PERSON_ID";
//

View File

@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
public class StatsTest {
// @Test
// @SuppressWarnings( {"UnusedAssignment"})
// @SuppressWarnings("unused")
// public void testCollectionFetchVsLoad() throws Exception {
// SessionFactory sf = buildBaseConfiguration()
// .setProperty( AvailableSettings.HBM2DDL_AUTO, "create-drop" )