You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/02/24 11:42:54 UTC

[plc4x] branch feature/cleaned-up-type-references updated: fix(codegen): temporary fix for duplicated parser args on dataio definition

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch feature/cleaned-up-type-references
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/feature/cleaned-up-type-references by this push:
     new 5b01ba0  fix(codegen): temporary fix for duplicated parser args on dataio definition
5b01ba0 is described below

commit 5b01ba05697b8a96c2ca71dfc14ca2c621ac7239
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Feb 24 12:42:44 2022 +0100

    fix(codegen): temporary fix for duplicated parser args on dataio definition
---
 .../src/main/resources/templates/java/model-template.java.ftlh        | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/code-generation/language-java/src/main/resources/templates/java/model-template.java.ftlh b/code-generation/language-java/src/main/resources/templates/java/model-template.java.ftlh
index 8e28069..0bd3ee6 100644
--- a/code-generation/language-java/src/main/resources/templates/java/model-template.java.ftlh
+++ b/code-generation/language-java/src/main/resources/templates/java/model-template.java.ftlh
@@ -576,6 +576,10 @@ public<#if type.isDiscriminatedParentTypeDefinition()> abstract</#if> class ${ty
     </#if>
 <#-- Here come the actual parse and serialize methods that actually do the parsing and serlaizing -->
     <#assign hasParserArguments=parserArguments?has_content/>
+    <#if type.isDiscriminatedChildTypeDefinition() && type.getParentType().orElseThrow().isDataIoTypeDefinition()>
+        <#assign hasParserArguments=type.parserArguments.isPresent()/>
+        <#assign parserArguments=type.parserArguments.orElseThrow()/>
+    </#if>
     <#assign parserArgumentList><#if hasParserArguments><#list parserArguments as parserArgument>${helper.getLanguageTypeNameForTypeReference(parserArgument.type, false)} ${parserArgument.name}<#sep>, </#sep></#list></#if></#assign>
     public static ${type.name}<#if type.isDiscriminatedChildTypeDefinition()>Builder staticParseBuilder<#else> staticParse</#if>(ReadBuffer readBuffer<#if hasParserArguments>, ${parserArgumentList}</#if>) throws ParseException {
         readBuffer.pullContext("${type.name}");