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 2021/10/08 14:36:01 UTC

[plc4x] branch feature/mspec-ng updated: fix(plc4j/codgen): draft a const call adjustments

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

sruehl pushed a commit to branch feature/mspec-ng
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/feature/mspec-ng by this push:
     new 72852a0  fix(plc4j/codgen): draft a const call adjustments
72852a0 is described below

commit 72852a022e3034c50805cbcd6aa2cb303fa6450a
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Oct 8 16:34:14 2021 +0200

    fix(plc4j/codgen): draft a const call adjustments
---
 .../src/main/resources/templates/java/io-template.java.ftlh            | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/code-generation/language-java-ng/src/main/resources/templates/java/io-template.java.ftlh b/code-generation/language-java-ng/src/main/resources/templates/java/io-template.java.ftlh
index fc0a032..08532ea 100644
--- a/code-generation/language-java-ng/src/main/resources/templates/java/io-template.java.ftlh
+++ b/code-generation/language-java-ng/src/main/resources/templates/java/io-template.java.ftlh
@@ -321,8 +321,7 @@ public class ${type.name}IO implements <#if outputFlavor != "passive">MessageIO<
             <#assign simpleTypeReference = constField.type.asSimpleTypeReference().orElseThrow()>
         ${helper.getLanguageTypeNameForField(field)} ${constField.name} = ${helper.getReadBufferReadMethodCall(constField.name, simpleTypeReference, "", constField)};
 
-        // TODO: value assingment gets useless once this is transformed to field read only as the check happens within anyway
-        FieldReaderConst.INSTANCE.readConstField(String logicalName, new DataReaderSimple${helper.getLanguageTypeNameForTypeReference(simpleTypeReference, false)}(readBuffer), ${type.name}.${constField.name?upper_case}))
+        FieldReader${field.typeName?cap_first}.INSTANCE.read${field.typeName?cap_first}Field(String logicalName, new DataReaderSimple${helper.getLanguageTypeNameForTypeReference(simpleTypeReference, false)}(readBuffer), ${type.name}.${constField.name?upper_case}))
         <#else>
         ${helper.getLanguageTypeNameForField(field)} ${constField.name} = ${helper.getLanguageTypeNameForField(field)}.enumForValue(${helper.getReadBufferReadMethodCall(constField.name, helper.getEnumBaseTypeReference(constField.type), "", constField)});
         if(${constField.name} != ${type.name}.${constField.name?upper_case}) {