Skip to content

Conversation

@rgoldberg
Copy link
Contributor

@rgoldberg rgoldberg commented Dec 1, 2021

Improved DefaultFactory#create(Class<T>):

  • Only handle cls argument being a Map or subtype differently than normal if cls is an interface
  • Create TreeMap if cls argument is SortedMap or sub-interface
  • Simplified normal instantiation:
    • no longer call deprecated method
    • only try setAccessible(true) if it might make a difference

Copy link
Owner

@remkop remkop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you; can you look at my feedback and let me know your thoughts?

Only handle Map differently than normal if the Map is an interface

Handle SortedMap
Simplified normal instantiation
Reinstated use of `Class#newInstance()` instead of `Constructor#newInstance()`.

Only use `Constructor#setAccessible(true)` if `IllegalAccessException` thrown.
@rgoldberg
Copy link
Contributor Author

I pushed the requested changes.

@remkop remkop added this to the 4.6.3 milestone Dec 15, 2021
@remkop remkop merged commit 2c6747e into remkop:master Dec 15, 2021
@remkop
Copy link
Owner

remkop commented Dec 15, 2021

Merged. Thank you for the contribution!

remkop added a commit that referenced this pull request Dec 15, 2021
@rgoldberg rgoldberg deleted the default-factory-create-maps branch December 15, 2021 08:44
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