-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Add Duration support for CacheBuilder.expireAfterWrite like in other guava projects #7232
Comments
Yes, we're aiming to add the Even once we do that, I'd still advise setting up your project to use a JRE version of Guava. Use a version whose number is at least as high as the highest version of Guava you depend on. In your case, that would mean 32.0.1-jre or higher. (I'd suggest going straight to the newest version, 33.2.0-jre, if you can.) This will ensure that all the Guava APIs are available to you even if we still don't add all of them to (We have some advice about this kind of JRE-Android conflict for users of Truth, another of our libraries. I should probably put something about it on the Guava site if we haven't already....) |
Hey @cpovirk, thank you for the prompt reply! Indeed I would do that but one of my dependencies is gRPC which is using the guava-android, so I cannot do anything for now. I will just go with another workaround for now. |
Ah, sorry, I didn't actually give advice on how to accomplish that :) If you declare a dependency in your own project on guava-33.2.0-jre, then that should take precedence over the other deps, since Maven picks the highest version number. guava-33.2.0-jre contains all the APIs of 31.1-jre and all the APIs of 32.0.1-android[*], so you should be safe. [*] OK, OK: Guava 33 did remove some APIs from guava-android that didn't work anyway—hence the bump in the major version number. Guava 32 didn't even do that, but it did remove an API in a separate artifact. Those removals will not be a problem in practice. |
Okok thanks for the help, will do that :) |
Also, related minor changes: - Import `java.time.Duration` instead of using it fully qualified. (Somehow, existing unqualified usages of `Duration` in _Javadoc_ references were working even without the import.) Compare cl/641315337. - "Upstream" a fix to a Javadoc reference to `maximumSize` from the Android flavor to the mainline. Fixes #7232 Progress on #6567 RELNOTES=`cache`: Added `CacheBuilder` `Duration` overloads to `guava-android`. PiperOrigin-RevId: 642709673
Also, related minor changes: - Import `java.time.Duration` instead of using it fully qualified. (Somehow, existing unqualified usages of `Duration` in _Javadoc_ references were working even without the import.) Compare cl/641315337. - "Upstream" a fix to a Javadoc reference to `maximumSize` from the Android flavor to the mainline. Fixes #7232 Progress on #6567 RELNOTES=`cache`: Added `CacheBuilder` `Duration` overloads to `guava-android`. PiperOrigin-RevId: 642709673
Also, related minor changes: - Import `java.time.Duration` instead of using it fully qualified. (Somehow, existing unqualified usages of `Duration` in _Javadoc_ references were working even without the import.) Compare cl/641315337. - "Upstream" a fix to a Javadoc reference to `maximumSize` from the Android flavor to the mainline. Fixes #7232 Progress on #6567 RELNOTES=`cache`: Added `CacheBuilder` `Duration` overloads to `guava-android`. PiperOrigin-RevId: 642709673
Also, related minor changes: - Import `java.time.Duration` instead of using it fully qualified. (Somehow, existing unqualified usages of `Duration` in _Javadoc_ references were working even without the import.) Compare cl/641315337. - "Upstream" a fix to a Javadoc reference to `maximumSize` from the Android flavor to the mainline. Fixes #7232 Progress on #6567 RELNOTES=`cache`: Added `CacheBuilder` `Duration` overloads to `guava-android`. PiperOrigin-RevId: 642709673
Also, related minor changes: - Import `java.time.Duration` instead of using it fully qualified. (Somehow, existing unqualified usages of `Duration` in _Javadoc_ references were working even without the import.) Compare cl/641315337. - "Upstream" a fix to a Javadoc reference to `maximumSize` from the Android flavor to the mainline. Fixes #7232 Progress on #6567 RELNOTES=`cache`: Added `CacheBuilder` `Duration` overloads to `guava-android`. PiperOrigin-RevId: 642993916
1. What are you trying to do?
I noticed that Guava has different projects which have their own implementation of CacheBuilder.
Some of them support an expireAfterWrite Duration while others not (like guava android)
Is this change planned?
Thanks!
2. What's the best code you can write to accomplish that without the new feature?
I would have to make some change son my code to not use the "bad" CacheBuilder.
3. What would that same code look like if we added your feature?
I would not have to do anything and guava CacheBuilder classes would be compatible.
(Optional) What would the method signatures for your feature look like?
No response
Concrete Use Cases
I have a project which which as a dependency A which on its turn as a dependency on com.google.guava:guava:jar:31.1 (CacheBuilder which supports Duration on expireAfterWrite).
I also have another dependency B which on its turn as a dependency on com.google.guava:guava:jar:32.0.1-android (CacheBuilder which doesn't support Duration on expireAfterWrite).
After compile, the dependency A is using the guava dependency B, which creates a conflict on the CacheBuilder expireAfterWrite.
Packages
No response
Checklist
I agree to follow the code of conduct.
I have read and understood the contribution guidelines.
I have read and understood Guava's philosophy, and I strongly believe that this proposal aligns with it.
I have visited the idea graveyard, and did not see anything similar to this idea.
The text was updated successfully, but these errors were encountered: