4 ms·
This used to be much more valuable in older versions of java. But some of the most useful parts now have analogues in the standard library.
by bradleyjg 3y ago
This used to be much more valuable in older versions of java. But some of the most useful parts now have analogues in the standard library.
- happymellon 3y agoIndeed, and now it's just a hassle dealing with Guava CVEs that get flagged up for functionality that doesn't actually require Guava.
- cosmotic 3y agoAnd dealing with mismatching guava versions brought in as transitive dependencies.
- erik_seaberg 3y agoI wish Guava weren’t just one library that breaks backward compatibility casually. They follow semver, but the major version changes so often that it’s not that helpful (they’re up to 32.x!)
- falserum 3y agoWhat about just staying with older version, if you don’t have capacity to upgrade?
- dtech 3y agoThe problem is conflicting transitives, lib A depends on 29, B on 31.
- ygra 3y agoDoes Java have a solution for such things where both libs can use their own version without them conflicting (unless they hand out Guava types to others, of course)? Custom class loaders?
- mrudolph22 3y agoJava doesn’t have a universal practical solution for this. Principled solutions based on custom class loaders (such as OSGi) added tremendous complexity and created more problems than they solved. Other solutions such as shading (renaming classes and their usages to prevent name conflicts between different versions) work in some cases but have their own limitations and drawbacks.
- aramattamara 3y agoWhat about Java modules (aka JEP-200, aka Project Jigsaw, completed in 2017)? Used it for JavaFX apps with no problems.
- mrudolph22 3y agoJava modules are fine but don’t offer a solution for version conflicts.
- ianlevesque 3y agoYes custom class loaders can solve this. Eclipse had an entire OSGI module system that did this among other things. In general though Java (and Kotlin) have been trending toward simpler and lighter though for years and I’d recommend just sorting out your dependencies, even drop some, to avoid that kind of thing.
- aramattamara 3y agoYes, it's called Java modules (aka JEP-200). Although people often skip it and put everything in one module. It was released in Java 9 (started in 2014 and completed fully in 2017).
- vips7L 3y agoAFAIK Jigsaw solves a different problem. The transitive dep will still be found on the module path.
- Someone 3y ago
- deleted 3y ago[deleted]
- macksd 3y agoThat gets tough with transitive dependencies and the frequent CVEs.
- paulddraper 3y ago> What about just staying with older version See grandparent: "dealing with mismatching guava versions brought in as transitive dependencies"
- mey 3y agoEven better is getting Gradle/Maven to correctly pull "plain" vs "Android" versions of the package instead of them just publishing the diverging code base as two repository packages. https://github.com/google/guava/issues/2914 https://github.com/google/guava/issues/2914
- vips7L 3y agoor dealing with the 100 conflicting versions of Guava being pulled in as transitive dependencies.
- esafak 3y agoI dealt with a repo that admitted only one version of each library, probably following Google's lead, so we were stuck with an old version of Guava because it was used all over the place, and upgrading it would have required a lot of refactoring which was not worth anyone's time. One reason to prefer smaller libraries. https://en.wikipedia.org/wiki/Public_goods_game https://en.wikipedia.org/wiki/Public_goods_game
- nikanj 3y agoCVEs are terrible nowadays. Any enterprising ”security researcher” can file one against your project, and the CVE aggregators will flat refuse to take it down. See for example CVE-2023-29827 or CVE-2023-35116
- happymellon 3y agoUnfortunately that doesn't prevent "security" from putting checks in the build pipelines.
- shrdlu2 3y agoThat, and also when caffeine came out it replaced one of the major uses (caching) of guava. https://github.com/ben-manes/caffeine https://github.com/ben-manes/caffeine
- plandis 3y agoYeah this was about the last piece I’d really go to Guava for and Caffeine has been better for years at this point.
- p1mrx 3y agoDoes the standard library have a function to parse IP addresses without querying DNS? InetAddresses.forString() was the main reason I used Guava in the past.
- vips7L 3y agoInetAddress::getByName
- latestthing 3y agoThis queries dns in some cases
- johnasmith 3y agoOne of the newer things I've appreciated from guava is ListenableFuture to Kotlin suspend functions interop.