Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow object instantiation without calling the default constructor #128

Closed
oswaldobapvicjr opened this issue May 22, 2023 · 0 comments · Fixed by #133
Closed

Allow object instantiation without calling the default constructor #128

oswaldobapvicjr opened this issue May 22, 2023 · 0 comments · Fixed by #133
Assignees
Labels
2.x The target Confectory version enhancement New feature or request

Comments

@oswaldobapvicjr
Copy link
Owner

oswaldobapvicjr commented May 22, 2023

Is your feature request related to a problem? Please describe.
Partially. I'm always frustrated when I have to write an empty default constructor to allow deserialization of Properties and INI files, while JSON frameworks such as Gson and Jackson allow the same without requiring a default constructor.

Describe the solution you'd like
A solution based on sun.misc.Unsafe so that an empty instance is created for deserialization, without calling any constructor, as described in https://dzone.com/articles/understanding-sunmiscunsafe.

Ideally, the programmer could disable this behavior via settings and use the "classic" solution, based on Reflection, if they prefer it.

Additional context

https://www.baeldung.com/java-unsafe

@oswaldobapvicjr oswaldobapvicjr added enhancement New feature or request 2.x The target Confectory version labels May 22, 2023
@oswaldobapvicjr oswaldobapvicjr self-assigned this May 22, 2023
@oswaldobapvicjr oswaldobapvicjr changed the title Allow object deserialization without the default constructor Allow object instantiation without calling the default constructor Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x The target Confectory version enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant