• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eclipse-aascw / aas-core-codegen / 34992909053
85%

Build:
DEFAULT BRANCH: main
Ran 15 Sep 2026 04:11PM UTC
Jobs 3
Files 269
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

15 Sep 2026 04:06PM UTC coverage: 85.322%. Remained the same
34992909053

push

github

web-flow
Carry the literal text on the Java enum (#692)

Until now a generated Java enumeration was bare -- no fields, no methods,
no interface -- and its string representation lived only in a private
``HashMap<E, String>`` in ``Stringification``. Every enumeration therefore
needed a method of its own to render it: eleven ``Map`` fields with eleven
static initialisers, eleven ``writeTextAs_{Enum}`` shims in the XML
serialization, and eleven ``{enum}ToJsonValue`` methods in the JSON one.
None of them could be collapsed, because ``toString`` / ``mustToString``
are an *overload set*, selected at compile time from the static type of
the argument, so something has to name each enumeration exactly once.

The type erasure in Java prevents us from having generic
enumeration-related functions. Instead, we introduce a new interface and
collapse it::

    public enum ModellingKind implements IEnum {
      TEMPLATE("Template"),
      INSTANCE("Instance");

      private final String literalText;

      ModellingKind(String literalText) {
        this.literalText = literalText;
      }

      @Override
      public String literalText() {
        return literalText;
      }
    }

Then one non-generic method serves every enumeration -- virtual dispatch
does the work which the overload set could not::

    private static void writeEnum(
      IEnum that,
      XMLStreamWriter writer) throws XMLStreamException {
      writer.writeCharacters(that.literalText());
    }

``ContentWriter<? super T>`` at the use sites already accepts it, so
``_VisitorWithWriter::writeEnum`` binds wherever ``writeTextAs_KeyTypes``
used to. A type parameter would add a variable nothing reads.

The JSON serialization gains the same single method, ``toJsonValue(IEnum)``.
Its eleven ``{enum}ToJsonValue`` methods stay -- each one admits only the
literals of its own enumeration, which is worth keeping at the call site --
but they now all delegate to it, so the serialization lives in one place.
The name c... (continued)

22 of 22 new or added lines in 4 files covered. (100.0%)

1 existing line in 1 file now uncovered.

33954 of 39795 relevant lines covered (85.32%)

2.56 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
83.89
0.07% aas_core_codegen/java/lib/_generate_types.py
Jobs
ID Job ID Ran Files Coverage
1 3.12 - 34992909053.1 15 Sep 2026 04:13PM UTC 269
85.32
GitHub Action Run
2 3.11 - 34992909053.2 15 Sep 2026 04:13PM UTC 269
85.32
GitHub Action Run
3 3.10 - 34992909053.3 15 Sep 2026 04:13PM UTC 269
85.32
GitHub Action Run
Source Files on build 34992909053
  • Tree
  • List 269
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 16b91919 on github
  • Prev Build on main (#34982437814)
  • Next Build on main (#35062787678)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc