Provide access to LazyConstant via internal fallback module#9241
Provide access to LazyConstant via internal fallback module#9241mbien wants to merge 1 commit intoapache:masterfrom
Conversation
|
I'm a fan of the various forms of My inclination would be towards putting this in |
there is a good chance that this module won't grow because this trick does only work if the surface of the covered API is tiny and the fallback is simple enough. We could rename it and make it less generic - I wasn't sure either. Maybe something else will show up?
The general idea is to remove the indirection (in this case the module) once no longer needed and replace usage with the JDK api (would be very simple search/replace). I am not sure if it is possible to export a single package only for friends while having also normal public API (openide.util) - thats why I put it into a separate module instead of an existing one.
JDK itself uses the feature already for quite a while in form of the I don't think that everything we use should also be public. |
6d47ba6 to
d0515b6
Compare
No, but the point was I'm in favour of making this public API. It can be deprecated if/when it can be replaced, and will still help with migrating things away from things like class-holder idiom now. |
- introduces "JDK Fallbacks" module for internal use only - module delegates to JDK implementations if available and uses fallbacks if not - the accessors are meant to be temporary friend API with expiration date, only to bridge the gap between lower and upper runtime requirements
d0515b6 to
b32fc4a
Compare
This is the reason why I try to add this in the first place. Maybe I am missing something, but why would this be more difficult to achieve as internal utility? Module adds itself on the friends list and uses it. I really don't like the idea of adding public API while knowing that they will be deprecated in a few years - technically they would be deprecated the moment Thought about what else the module could offer at some point: Both List.ofLazy and Map.ofLazy should be doable with fallbacks I believe. I think those factory methods are interesting from a technical perspective but far more niche than |
Well, you've already added one extra unnecessary step! 😉 Basically, I disagree with the use of friend modules to hide APIs all over the code base. The friend feature should be used to provide a tunnel between interrelated modules that have a need to enable differently. Other than that it's almost always been a mistake. Yes, we might deprecate this in 4 years. It won't be less than 4. And it might be that we have a reason to keep it as a wrapper even then. I'm not going to block this, but I think the fallback module aspect is just unnecessary extra complexity for a simple, useful feature. |
|
ok. not convinced. Will keep it internal/non-permanent like originally intended to not repeat mistakes like WeakSet and others. Based on usage we can reevaluate it at a later point and move the code to |
namespace and module location can probably be improved. It would be also good to find some usage candidates and add a reference commit before merge.
draft for feedback