Repository navigation
Add a store to the extension model - #1692
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1692 +/- ##
============================================
+ Coverage 80.33% 80.48% +0.14%
- Complexity 4242 4299 +57
============================================
Files 434 438 +4
Lines 13300 13432 +132
Branches 1693 1697 +4
============================================
+ Hits 10685 10811 +126
Misses 1976 1976
- Partials 639 645 +6 ☔ View full report in Codecov by Sentry. |
62e45c5 to
b97c016
Compare
|
Additionally to the annotations, Codecov is a bit unhappy |
b97c016 to
7e612cd
Compare
Vampire
left a comment
There was a problem hiding this comment.
Some comments to the changes so far. :-)
| * @throws PreconditionViolationException if the supplied object is {@code null} | ||
| * @see #notNull(Object, Supplier) | ||
| */ | ||
| public static <T> T notNull(T object, Supplier<String> messageProvider) throws PreconditionViolationException { |
There was a problem hiding this comment.
That's one valid argument yes.
What I say is, whether it makes sense to not use the default method that is meant for exactly that case.
The JavaDoc of Objects.requireNonNull says:
This method is designed primarily for doing parameter validation in methods and constructors, as demonstrated below
If you are aware of that and think it is better not to follow the standard and throw IAE instead, that's fine of course, just wanted to make sure you didn't miss it. :-)
| * @throws PreconditionViolationException if the supplied object is {@code null} | ||
| * @see #notNull(Object, Supplier) | ||
| */ | ||
| public static <T> T notNull(T object, Supplier<String> messageProvider) throws PreconditionViolationException { |
There was a problem hiding this comment.
You mean one that can be used for both cases?
Like IllegalThingException?
Also not sure that's worth it.
But on the other hand, if you want to use it for anything else than arguments, throwing IAE feels awkward too. 😕
| } | ||
|
|
||
| public static <T> T newInstance(Class<T> clazz, Object... args) { | ||
| Preconditions.notNull(clazz, "Class must not be null"); |
There was a problem hiding this comment.
2 unused imports are left now. :-)
| // Spring dependency management downgrades the jupiter version to 5.7.2 otherwise | ||
| ext['junit-jupiter.version'] = '5.10.0-M1' |
There was a problem hiding this comment.
Doesn't change that it does more harm than good and even its maintainer strongly recommends not to use it anymore but the built-in BOM support: https://www.linen.dev/s/gradle-community/t/2579116/what-is-the-proper-way-to-apply-a-bom-in-a-library-project-i#a7d4a60a-ab60-48dc-8477-f3f4462d1e6a :-)
1400c86 to
edd88c6
Compare
fceb690 to
d969db0
Compare
| return; | ||
| } | ||
|
|
||
| context = context.withChildStoreProvider(); |
There was a problem hiding this comment.
I am not a big fan of overriding parameter values in the method.
There was a problem hiding this comment.
I understand, but we've used this pattern for the context so far. We could change it in another PR.
| * @return the previous value; may be {@code null} | ||
| * @see AutoCloseable | ||
| */ | ||
| Object put(Object key, Object value); |
There was a problem hiding this comment.
If it stays Object, I would add @Nullable at least.
| /** | ||
| * Create a namespace which restricts access to data to all extensions | ||
| * which use the same sequence of {@code parts} for creating a namespace. | ||
| * | ||
| * <p>The order of the {@code parts} is significant. | ||
| * | ||
| * <p>Internally the {@code parts} are compared using {@link Object#equals(Object)}. | ||
| */ | ||
| public static Namespace create(Object... parts) { |
There was a problem hiding this comment.
Shouldn't this document that the used Objects for parts, need to be Immutable or at least have a stable equals/hashcode contract.
If an object changes its hashcode I guess the thing is broken.
Or do we say, yeah if you do such things, that is not our problem...
0db6d1a to
8ab294b
Compare
d0707cb to
32638db
Compare
32638db to
e517463
Compare
| * @see #get(Object, Class) | ||
| * @see #getOrDefault(Object, Class, Object) | ||
| */ | ||
| Object get(Object key); |
There was a problem hiding this comment.
But do we really need those extra methods with the extra argument?
Is store.get(THING, Bar.class).getFoo(); really more fluent than
store.<Bar>get(THING).getFoo(); which would spare those extra methods?
| } | ||
|
|
||
| public static <T> T newInstance(Class<T> clazz, Object... args) { | ||
| Preconditions.notNull(clazz, "Class must not be null"); |
There was a problem hiding this comment.
You really like your unused imports, don't you? :-D
e6ee6ac to
ee8e43c
Compare
commented
Dec 15, 2023
|
Thanks for the reviews @Vampire and @AndreasTu |

No description provided.