diff options
Diffstat (limited to 'container-compiler-plugin/src/main/java/io/trygvis/persistence')
-rw-r--r-- | container-compiler-plugin/src/main/java/io/trygvis/persistence/generators/EntityManagerGenerator.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/container-compiler-plugin/src/main/java/io/trygvis/persistence/generators/EntityManagerGenerator.java b/container-compiler-plugin/src/main/java/io/trygvis/persistence/generators/EntityManagerGenerator.java index f524b1a..f621343 100644 --- a/container-compiler-plugin/src/main/java/io/trygvis/persistence/generators/EntityManagerGenerator.java +++ b/container-compiler-plugin/src/main/java/io/trygvis/persistence/generators/EntityManagerGenerator.java @@ -1,6 +1,7 @@ package io.trygvis.persistence.generators; import io.trygvis.container.compiler.SqlUnitModel; +import io.trygvis.container.compiler.model.AnnotationG; import io.trygvis.container.compiler.model.ClassG; import io.trygvis.container.compiler.model.Constructor; import io.trygvis.container.compiler.model.FieldRef; @@ -66,13 +67,12 @@ public class EntityManagerGenerator { List<String> body = new ArrayList<>(); for (EntityMirror entity : unit.getEntities().values()) { body.add("if (klass == " + entity.type.plainName + ".class) {"); - body.add(" @SuppressWarnings(\"unchecked\")"); - body.add(" SqlDao<Id, T> dao = (SqlDao<Id, T>) " + daoFields.get(entity).name + ";"); - body.add(" return (SqlDao<Id, T>) dao;"); + body.add(" return (SqlDao<Id, T>) " + daoFields.get(entity).name + ";"); body.add("}"); } body.add("throw new RuntimeException(\"Type is not a part of this persistence unit: \" + klass);"); - return new MethodRef(PUBLIC, sqlDatoType, "getDao", p, body).typeArgs("Id", "T"); + return new MethodRef(PUBLIC, sqlDatoType, "getDao", p, body).typeArgs("Id", "T"). + annotation(new AnnotationG(new TypeRef(SuppressWarnings.class), "\"unchecked\"")); } /* |