Skip to content

Ensured *Builder instances are no longer created with reflection #989

Merged
lhazlewood merged 5 commits intomasterfrom
issue-988-builder-factories
Apr 22, 2025
Merged

Ensured *Builder instances are no longer created with reflection #989
lhazlewood merged 5 commits intomasterfrom
issue-988-builder-factories

Conversation

@lhazlewood
Copy link
Copy Markdown
Contributor

Ensured *Builder instances are no longer created with reflection using Classes.newInstance. Instead, Classes.newInstance is used to create static/thread-safe Supplier singletons when the api module is loaded, and those singletons will directly instantiate *Builder instances at runtime using the new keyword`.

Resolves #988.

…g `Classes.newInstance`. Instead, `Classes.newInstance` is used to create static/thread-safe Supplier singletons when the api module is loaded, and those singletons will directly instantiate *Builder instances at runtime using the `new` keyword`.

Resolves #988.
@lhazlewood
Copy link
Copy Markdown
Contributor Author

@slovdahl are you able to build using this PR and test in your application?

@lhazlewood lhazlewood self-assigned this Apr 11, 2025
@slovdahl
Copy link
Copy Markdown

Thanks a lot for working on this! 🙇

I'll try to get it tested, but a problem right now is that we're still stuck on 0.11.x, and we get some runtime failures when upgrading to 0.12 that we have yet to solve. It might be easier for me to build a 0.11.x version with just this change applied. I'll try to get that done in the coming days.

@lhazlewood
Copy link
Copy Markdown
Contributor Author

@slovdahl I've decided to merge this because it's a little better for runtime performance in all environments, regardless of Tomcat's particular ClassLoader behavior. Maybe you can cherry pick this particular PR/commit for testing in your 0.11.x branch - please let us know how it goes!

I'll just add some release note edits to this first and do one more build before merging.

@lhazlewood lhazlewood added this to the 0.12.7 milestone Apr 22, 2025
@lhazlewood lhazlewood merged commit f1fde23 into master Apr 22, 2025
23 checks passed
@lhazlewood lhazlewood deleted the issue-988-builder-factories branch April 22, 2025 21:38
@lhazlewood lhazlewood mentioned this pull request Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime Builder creation enhancements

2 participants