Skip to content

fix: add GWT super-source for TypeRegistryLoader - #15

Merged
haumacher merged 1 commit into
msgbuf:mainfrom
jhuesing:fix/gwt-type-registry-loader
May 21, 2026
Merged

haumacher merged 1 commit into
msgbuf:mainfrom
jhuesing:fix/gwt-type-registry-loader

Conversation

@jhuesing

Copy link
Copy Markdown
Contributor

Summary

GWT compilation fails with msgbuf-api 1.2.1 because TypeRegistryLoader references java.util.ServiceLoader, which is not part of GWT's JRE emulation. The GWT compiler rejects the code at compile time regardless of the runtime try/catch.

Simply excluding TypeRegistryLoader from GWT source is not sufficient because the code generator emits TypeRegistryLoader.ensureLoaded() into generated classes — the type must remain resolvable.

This PR adds a GWT super-source with a no-op TypeRegistryLoader replacement, so that:

  • GWT compilation succeeds
  • Generated code referencing TypeRegistryLoader.ensureLoaded() compiles in GWT
  • JVM behaviour is unchanged (the real class with ServiceLoader is still used)

Changes

  • MsgBuf.gwt.xml: added <super-source path="super"/>
  • New file super/de/haumacher/msgbuf/data/TypeRegistryLoader.java: no-op replacement for GWT

TypeRegistryLoader uses java.util.ServiceLoader which is not available
in GWT's JRE emulation. This causes GWT compilation to fail for any
project inheriting the MsgBuf GWT module.

Provide a no-op super-source replacement so that GWT compilation
succeeds. On GWT, type registration must happen via explicit init()
calls on generated registration classes.
@haumacher
haumacher merged commit 5b39586 into msgbuf:main May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants