@@ -1594,7 +1594,7 @@ private CharSequence generateConstPropertyMethods(
15941594 sb .append (String .format ("\n " +
15951595 indent + " SBE_NODISCARD const char *%1$s() const\n " +
15961596 indent + " {\n " +
1597- indent + " static const std::uint8_t %1$sValues[] = {%2$s};\n \n " +
1597+ indent + " static const std::uint8_t %1$sValues[] = { %2$s };\n \n " +
15981598
15991599 indent + " return (const char *)%1$sValues;\n " +
16001600 indent + " }\n " ,
@@ -1604,7 +1604,7 @@ private CharSequence generateConstPropertyMethods(
16041604 sb .append (String .format ("\n " +
16051605 indent + " SBE_NODISCARD %1$s %2$s(const std::uint64_t index) const\n " +
16061606 indent + " {\n " +
1607- indent + " static const std::uint8_t %2$sValues[] = {%3$s};\n \n " +
1607+ indent + " static const std::uint8_t %2$sValues[] = { %3$s };\n \n " +
16081608
16091609 indent + " return (char)%2$sValues[index];\n " +
16101610 indent + " }\n " ,
@@ -1615,7 +1615,7 @@ private CharSequence generateConstPropertyMethods(
16151615 sb .append (String .format ("\n " +
16161616 indent + " std::uint64_t get%1$s(char *dst, const std::uint64_t length) const\n " +
16171617 indent + " {\n " +
1618- indent + " static std::uint8_t %2$sValues[] = {%3$s};\n " +
1618+ indent + " static std::uint8_t %2$sValues[] = { %3$s };\n " +
16191619 indent + " std::uint64_t bytesToCopy = " +
16201620 "length < sizeof(%2$sValues) ? length : sizeof(%2$sValues);\n \n " +
16211621
@@ -2465,6 +2465,7 @@ private CharSequence appendDisplay(
24652465
24662466 i += varDataToken .componentTokenCount ();
24672467 }
2468+
24682469 return sb ;
24692470 }
24702471
@@ -2474,14 +2475,13 @@ private CharSequence writeTokenDisplay(
24742475 final boolean [] atLeastOne ,
24752476 final String indent )
24762477 {
2477- final StringBuilder sb = new StringBuilder ();
2478- final String fieldName = "writer." + formatPropertyName (fieldTokenName );
2479-
24802478 if (typeToken .encodedLength () <= 0 || typeToken .isConstantEncoding ())
24812479 {
2482- return sb . toString () ;
2480+ return "" ;
24832481 }
24842482
2483+ final StringBuilder sb = new StringBuilder ();
2484+
24852485 if (atLeastOne [0 ])
24862486 {
24872487 sb .append (
@@ -2493,6 +2493,7 @@ private CharSequence writeTokenDisplay(
24932493 }
24942494
24952495 sb .append (indent + "builder << R\" (\" " + fieldTokenName + "\" : )\" ;\n " );
2496+ final String fieldName = "writer." + formatPropertyName (fieldTokenName );
24962497
24972498 switch (typeToken .signal ())
24982499 {
@@ -2596,6 +2597,7 @@ private CharSequence generateChoicesDisplay(final String name, final List<Token>
25962597 sb .append (
25972598 indent + " if (" + choiceName + "())\n " +
25982599 indent + " {\n " );
2600+
25992601 if (i > 0 )
26002602 {
26012603 sb .append (
@@ -2606,10 +2608,12 @@ private CharSequence generateChoicesDisplay(final String name, final List<Token>
26062608 }
26072609 sb .append (
26082610 indent + " builder << R\" (\" " + formatPropertyName (token .name ()) + "\" )\" ;\n " );
2611+
26092612 if (i < (size - 1 ))
26102613 {
26112614 sb .append (indent + " atLeastOne = true;\n " );
26122615 }
2616+
26132617 sb .append (
26142618 indent + " }\n " );
26152619 }
0 commit comments