From 0f8f1904283c6178c56f32cb428ff7caec65ef42 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Tue, 31 Mar 2020 02:15:26 +0200 Subject: [PATCH] Fix deprecated methods --- src/main/java/fr/pandacube/util/orm/ORM.java | 2 +- src/main/java/fr/pandacube/util/orm/SQLElementList.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/pandacube/util/orm/ORM.java b/src/main/java/fr/pandacube/util/orm/ORM.java index a4edcd0..ccacd24 100644 --- a/src/main/java/fr/pandacube/util/orm/ORM.java +++ b/src/main/java/fr/pandacube/util/orm/ORM.java @@ -45,7 +45,7 @@ public final class ORM { try { tables.add(elemClass); Log.debug("[ORM] Start Init SQL table "+elemClass.getSimpleName()); - E instance = elemClass.newInstance(); + E instance = elemClass.getConstructor().newInstance(); String tableName = instance.tableName(); tableNames.put(elemClass, tableName); if (!tableExistInDB(tableName)) createTable(instance); diff --git a/src/main/java/fr/pandacube/util/orm/SQLElementList.java b/src/main/java/fr/pandacube/util/orm/SQLElementList.java index 208aa33..1bbc8c4 100644 --- a/src/main/java/fr/pandacube/util/orm/SQLElementList.java +++ b/src/main/java/fr/pandacube/util/orm/SQLElementList.java @@ -51,7 +51,7 @@ public class SQLElementList> extends ArrayList { Class elemClass = field.getSQLElementType(); try { - E emptyElement = elemClass.newInstance(); + E emptyElement = elemClass.getConstructor().newInstance(); emptyElement.set(field, value, false); } catch (Exception e) { throw new IllegalArgumentException("Illegal field or value or can't instanciante an empty instance of "