Skip to content

GH-3644: Handle NoClassDefFoundError in DynMethods#3645

Open
nastra wants to merge 1 commit into
apache:masterfrom
nastra:dyn-classes-improvements
Open

GH-3644: Handle NoClassDefFoundError in DynMethods#3645
nastra wants to merge 1 commit into
apache:masterfrom
nastra:dyn-classes-improvements

Conversation

@nastra

@nastra nastra commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

All of the Dyn* classes use Class.forName(className, true, loader) and catch ClassNotFoundException when probing for optional implementations by class name, but Class.forName can also throw NoClassDefFoundError when the class itself is found but one of its transitive dependencies is missing. It can also throw ExceptionInInitializerError when the static initializer of the loaded class fails.
We're intentionally not handling ExceptionInInitializerError and propagate it to the caller.

DynConstructors already handles ClassNotFoundException and NoClassDefFoundError while DynMethods only handles ClassNotFoundException

This issue is similar to apache/iceberg#16793 and apache/iceberg#16611 that we're fixing on the Iceberg side.

Closes #3644

What changes are included in this PR?

Are these changes tested?

yes, added new tests to verify that DynConstructors and DynMethods behave correctly

Are there any user-facing changes?

no

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.

Handle NoClassDefFoundError in Dyn* classes

1 participant