From bcc0460de8fa5bb9f3865cd4d35fd512d32f48e1 Mon Sep 17 00:00:00 2001 From: Florent BENOIT Date: Tue, 19 Sep 2017 17:05:40 +0200 Subject: [PATCH] Some DTO in Che are using "arguments" and this is a reserved keyword so need to adapt the field name Change-Id: Ieb2f97499b4173a2b58c8c0565871aafef3b9ddc Signed-off-by: Florent BENOIT --- .../org/eclipse/che/plugin/typescript/dto/DTOHelper.java | 9 ++++++++- .../eclipse/che/plugin/typescript/dto/MyCustomDTO.java | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/che-core-typescript-dto-maven-plugin/src/main/java/org/eclipse/che/plugin/typescript/dto/DTOHelper.java b/core/che-core-typescript-dto-maven-plugin/src/main/java/org/eclipse/che/plugin/typescript/dto/DTOHelper.java index 859bab803bd..b76855e4133 100644 --- a/core/che-core-typescript-dto-maven-plugin/src/main/java/org/eclipse/che/plugin/typescript/dto/DTOHelper.java +++ b/core/che-core-typescript-dto-maven-plugin/src/main/java/org/eclipse/che/plugin/typescript/dto/DTOHelper.java @@ -67,7 +67,14 @@ public static boolean isDtoWith(Method method) { public static String getFieldName(String type) { char[] c = type.toCharArray(); c[0] = Character.toLowerCase(c[0]); - return new String(c); + + String val = new String(c); + + // replace reserved keyword + if ("arguments".equals(val)) { + val = "argumentsObj"; + } + return val; } /** Extract field name from the getter method */ diff --git a/core/che-core-typescript-dto-maven-plugin/src/test/java/org/eclipse/che/plugin/typescript/dto/MyCustomDTO.java b/core/che-core-typescript-dto-maven-plugin/src/test/java/org/eclipse/che/plugin/typescript/dto/MyCustomDTO.java index ed31fb07775..0cfab257fe3 100644 --- a/core/che-core-typescript-dto-maven-plugin/src/test/java/org/eclipse/che/plugin/typescript/dto/MyCustomDTO.java +++ b/core/che-core-typescript-dto-maven-plugin/src/test/java/org/eclipse/che/plugin/typescript/dto/MyCustomDTO.java @@ -10,6 +10,7 @@ */ package org.eclipse.che.plugin.typescript.dto; +import java.util.List; import java.util.Map; import org.eclipse.che.dto.shared.DTO; @@ -40,4 +41,11 @@ public interface MyCustomDTO { void setCustomMap(Map map); MyCustomDTO withCustomMap(Map map); + + // arguments is a reserved keyword for TypeScript + List getArguments(); + + void setArguments(List arguments); + + MyCustomDTO withArguments(List arguments); }