Skip to content

CXF-9285: Use precompiled namespace prefix mappers instead of generat… - #3816

Open
ffang wants to merge 1 commit into
apache:mainfrom
ffang:CXF-9285
Open

ffang wants to merge 1 commit into
apache:mainfrom
ffang:CXF-9285

Conversation

@ffang

@ffang ffang commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

…ing them

The ASM generated NamespaceMapper[RI|Internal] classes always extended org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper, so they were copies of the precompiled org.apache.cxf.common.jaxb.NamespaceMapper. The EclipseLink MOXy mapper is now precompiled too, as org.apache.cxf.common.jaxb.EclipseNamespaceMapper, against an optional org.eclipse.persistence.core dependency (an optional OSGi import), so no namespace mapper class is generated any more. Both implement the new ContextualNamespaceMapper interface, which DataWriterImpl calls directly; reflection is only kept for mappers from a custom ClassLoaderService.

This also fixes:

  • GeneratedNamespaceClassLoader looked up org.apache.cxf.jaxb.NamespaceMapper for a GlassFish marshaller while NamespaceClassGenerator generated NamespaceMapperRI, and found the MOXy mapper only if it had been captured at build time, so the load only setup lost the namespace prefixes
  • ClassLoaderProxyService logged an NPE at WARNING when no mapper class was available
  • the precompiled NamespaceMapper named its method setContextualNamespace while DataWriterImpl calls setContextualNamespaceDecls; the old name is kept as a deprecated alias

…ing them

The ASM generated NamespaceMapper[RI|Internal] classes always extended
org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper, so they were
copies of the precompiled org.apache.cxf.common.jaxb.NamespaceMapper. The
EclipseLink MOXy mapper is now precompiled too, as
org.apache.cxf.common.jaxb.EclipseNamespaceMapper, against an optional
org.eclipse.persistence.core dependency (an optional OSGi import), so no
namespace mapper class is generated any more. Both implement the new
ContextualNamespaceMapper interface, which DataWriterImpl calls directly;
reflection is only kept for mappers from a custom ClassLoaderService.

This also fixes:
- GeneratedNamespaceClassLoader looked up org.apache.cxf.jaxb.NamespaceMapper
  for a GlassFish marshaller while NamespaceClassGenerator generated
  NamespaceMapperRI, and found the MOXy mapper only if it had been captured
  at build time, so the load only setup lost the namespace prefixes
- ClassLoaderProxyService logged an NPE at WARNING when no mapper class was
  available
- the precompiled NamespaceMapper named its method setContextualNamespace
  while DataWriterImpl calls setContextualNamespaceDecls; the old name is
  kept as a deprecated alias
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.

1 participant