From 65e02f9638ec70254f961278f53dfb896c27a1dc Mon Sep 17 00:00:00 2001 From: "kevin.buntrock" Date: Tue, 1 Oct 2024 16:23:45 +0200 Subject: [PATCH] Accolades sur le "if liste null". Plus respectueux des bonnes pratiques (voir issue Sonar java:S121) --- TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs b/TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs index 09e3c529..1f944ce0 100644 --- a/TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs +++ b/TopModel.Generator.Jpa/JpaModelPropertyGenerator.cs @@ -125,9 +125,10 @@ public void WriteGetter(JavaWriter fw, Class classe, string tag, IProperty prope var type = _config.GetType(ap, _classes, useClassForAssociation: useClassForAssociation).Split('<').First(); if (_newableTypes.TryGetValue(type, out var newableType)) { - fw.WriteLine(indentLevel + 1, $"if(this.{propertyName} == null)"); + fw.WriteLine(indentLevel + 1, $"if(this.{propertyName} == null) {{"); fw.AddImport($"java.util.{newableType}"); fw.WriteLine(indentLevel + 2, $"this.{propertyName} = new {newableType}<>();"); + fw.WriteLine(indentLevel + 1, $"}}"); } }