-
Notifications
You must be signed in to change notification settings - Fork 321
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
Deprecate and replace Guava-using APIs in ContainersStateFactory and its dependencies #2979
base: main
Are you sure you want to change the base?
Deprecate and replace Guava-using APIs in ContainersStateFactory and its dependencies #2979
Conversation
@@ -52,22 +67,18 @@ public Set<URI> findAllResourceUris(String path, Predicate<URI> isValidPredicate | |||
throw new IllegalArgumentException("Unsupported path : " + path + " (only folders and archives are supported)."); | |||
} | |||
|
|||
/** @deprecated Instead use {@link #traverseArchive(File, Predicate)} */ | |||
@Deprecated(since = "2.35.0", forRemoval = true) | |||
protected Set<URI> traverseArchive(File file, com.google.common.base.Predicate<URI> isValidPredicate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it is necessary to keep these protected methods as deprecated?
Are custom sub-classes of PathTraverser
something that should be supported?
If yes, it should probably also be ensured that these deprecated methods are still called in order to not make custom implementation dysfunctional.
The same applies for Reader
and RuntimeResourceSetInitializer
adjusted in this PR.
07be8f4
to
317b1e5
Compare
Even in this case, I have the same perplexity I expressed in #2978 My suspects might be proved by the fact that you have to add an explicit cast when you call the new method from the deprecated one when passing a lambda expression. |
private SetMultimap<String, URI> container2URIs; | ||
private SetMultimap<URI, String> uri2container; | ||
|
||
private Map<String, Set<URI>> container2URIs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous usages of container2URIs would never return null when queried via get(someHandle)
. getContainedURIs might need refinedment.
Into the bargain, it used to be possible to add items to the collection returned from getContainedURis and the changed would be reflected in the containers state, regardless of the fact whether the containers was initially known or not.
We don't (ab)use that detail in the framework, but I'm not a fan of the subtle change nor of the effort we'd need to put into retained that behaviro without using Guava Multimaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous usages of container2URIs would never return null when queried via
get(someHandle)
. getContainedURIs might need refinedment.
I adjusted getContainedURIs
to reflect that, i.e. to return container2URIs.getOrDefault(containerHandle, Set.of());
.
As a side-note, for uri2container.get(uri)
the result was already checked for null before.
Into the bargain, it used to be possible to add items to the collection returned from getContainedURis and the changed would be reflected in the containers state, regardless of the fact whether the containers was initially known or not. We don't (ab)use that detail in the framework, but I'm not a fan of the subtle change nor of the effort we'd need to put into retained that behaviro without using Guava Multimaps.
I would call this an undesired implementation detail on which callers shouldn't rely on. Furthermore the documentation of this class states
Lines 25 to 26 in 9e3b1b4
* This implementation {@link IAllContainersState} associates resource (e.g. their URIs) to containers. It assumes that | |
* all URIs and their containers are known when {@link #configure(List, Multimap)} is called. |
According to this contract it would not be allowed to add elements. And as a third point, adding elements to a value collection of container2URIs
, would mean that it goes out of sync with uri2container
.
For now I have made the value Sets immutable in order to enforce consistency here. Although this might break the previously possible (ab)use scenario you described.
317b1e5
to
e83b240
Compare
e83b240
to
35915a7
Compare
Also replace Guava where it is simply possible.
Part of #2975