From 9687f50bcde589a6d5aa3b7525923df59d4e7d55 Mon Sep 17 00:00:00 2001 From: Koen Aers Date: Fri, 2 Aug 2024 12:53:08 +0300 Subject: [PATCH] HBX-2887: Add @SuppressWarnings(unchecked) and @SuppressWarnings(rawtypes) to remove warnings Signed-off-by: Koen Aers --- .../tool/orm/jbt/internal/factory/SessionWrapperFactory.java | 3 ++- .../tool/orm/jbt/internal/factory/TableWrapperFactory.java | 1 - .../tool/orm/jbt/internal/factory/TypeWrapperFactory.java | 1 + .../hibernate/tool/orm/jbt/internal/util/JpaConfiguration.java | 1 + .../hibernate/tool/orm/jbt/internal/util/SpecialRootClass.java | 2 ++ .../org/hibernate/tool/internal/export/java/Cfg2JavaTool.java | 2 +- .../tool/internal/reveng/binder/PrimaryKeyBinder.java | 2 +- 7 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/SessionWrapperFactory.java b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/SessionWrapperFactory.java index 756f656edd..5119d0eee7 100644 --- a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/SessionWrapperFactory.java +++ b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/SessionWrapperFactory.java @@ -46,7 +46,7 @@ public SessionFactoryWrapper getSessionFactory() { @Override public QueryWrapper createQuery(String s) { - org.hibernate.query.Query query = session.createQuery(s); + org.hibernate.query.Query query = session.createQuery(s, null); return QueryWrapperFactory.createQueryWrapper(query); } @@ -74,6 +74,7 @@ public boolean contains(Object o) { return result; } + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public QueryWrapper createCriteria(Class c) { CriteriaBuilder criteriaBuilder = session.getCriteriaBuilder(); diff --git a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/TableWrapperFactory.java b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/TableWrapperFactory.java index 1e0bed7b33..af6bfaaf9b 100644 --- a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/TableWrapperFactory.java +++ b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/TableWrapperFactory.java @@ -6,7 +6,6 @@ import org.hibernate.mapping.ForeignKey; import org.hibernate.mapping.PrimaryKey; import org.hibernate.mapping.Table; -import org.hibernate.mapping.Value; import org.hibernate.tool.orm.jbt.api.wrp.ColumnWrapper; import org.hibernate.tool.orm.jbt.api.wrp.ForeignKeyWrapper; import org.hibernate.tool.orm.jbt.api.wrp.PrimaryKeyWrapper; diff --git a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/TypeWrapperFactory.java b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/TypeWrapperFactory.java index f50b260fe9..12c5b8b066 100644 --- a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/TypeWrapperFactory.java +++ b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/factory/TypeWrapperFactory.java @@ -34,6 +34,7 @@ public Type getWrappedObject() { return type; } + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public String toString(Object object) { if (BasicType.class.isAssignableFrom(getWrappedObject().getClass())) { diff --git a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/util/JpaConfiguration.java b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/util/JpaConfiguration.java index 1fb5088ab5..6e1fbff5e9 100644 --- a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/util/JpaConfiguration.java +++ b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/util/JpaConfiguration.java @@ -76,6 +76,7 @@ public Configuration addFile(File file) { this.getClass().getName()); } + @SuppressWarnings("rawtypes") @Override public Configuration addClass(Class pc) { throw new RuntimeException( diff --git a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/util/SpecialRootClass.java b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/util/SpecialRootClass.java index b831a008ba..28b9e90973 100644 --- a/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/util/SpecialRootClass.java +++ b/jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/util/SpecialRootClass.java @@ -14,6 +14,8 @@ public class SpecialRootClass extends RootClass { + private static final long serialVersionUID = 1L; + private Property property; private Property parentProperty; diff --git a/orm/src/main/java/org/hibernate/tool/internal/export/java/Cfg2JavaTool.java b/orm/src/main/java/org/hibernate/tool/internal/export/java/Cfg2JavaTool.java index bd5acd7ee5..dce650e23b 100644 --- a/orm/src/main/java/org/hibernate/tool/internal/export/java/Cfg2JavaTool.java +++ b/orm/src/main/java/org/hibernate/tool/internal/export/java/Cfg2JavaTool.java @@ -406,7 +406,7 @@ public boolean isArray(String typeName) { return typeName!=null && typeName.endsWith("[]"); } - public Map getParameterTypes(NamedHqlQueryDefinition query) { + public Map getParameterTypes(NamedHqlQueryDefinition query) { Map result = null; try { Field field = NamedHqlQueryDefinitionImpl.class.getDeclaredField("parameterTypes"); diff --git a/orm/src/main/java/org/hibernate/tool/internal/reveng/binder/PrimaryKeyBinder.java b/orm/src/main/java/org/hibernate/tool/internal/reveng/binder/PrimaryKeyBinder.java index 210a7f3203..1901fe0a1a 100644 --- a/orm/src/main/java/org/hibernate/tool/internal/reveng/binder/PrimaryKeyBinder.java +++ b/orm/src/main/java/org/hibernate/tool/internal/reveng/binder/PrimaryKeyBinder.java @@ -197,7 +197,7 @@ private EnhancedComponent handleCompositeKey( Set processedColumns, List keyColumns) { EnhancedComponent result = new EnhancedComponent(getMetadataBuildingContext(), rc); - result.setMetaAttributes(Collections.EMPTY_MAP); + result.setMetaAttributes(Collections.emptyMap()); result.setEmbedded(false); result.setComponentClassName(getCompositeIdName(rc)); addKeyColumns(result, rc.getTable(), getKeyColumns(rc.getTable(), keyColumns), processedColumns);