On 06.04.2023 13:56, Julian Reschke wrote:
Hi everybody,

as some have noticed, we have begun the migration away from Guava 15.0
to a *shaded* version of Guava (latest and greatest).

A new subproject has been added (oak-shaded-guava), which repackages
Guava 31 under the package name o.a.jackrabbit.guava. See
<https://issues.apache.org/jira/browse/OAK-9989> for details and
discussion.

If your IDE acts weird (be it Eclipse or IntelliJ), it's because it does
not understand the shaded subproject. Sorry for that. While there's no
fix for the IDEs, the workaround is to disable oak-shaded-guava
(Intellij) or remove it (Eclipse) - after having built it locally with
Maven.

As noticed by Angela, for IntelliJ this requires a relatively recent
version. The context menu item is in the "maven" view, BTW.

We may decide at a later point to work around this by moving this out of
the reactor pom.

What's next?

1) We have a few sub projects that currently expose Guava in APIs; these
APIs have been deprecated for long, and I'll remove those APIs *after*
the next release (1.52.0).

2) In the meantime, everybody can help by converting "their" sub
projects. (If you do so, please add a sub-task to
<https://issues.apache.org/jira/browse/OAK-7182>). This usually means
adding the dependency to the POM, and rewriting import statements. I
usually just run:

~~~
#!/bin/bash

find . -name "*.java" -exec sed
"s/^import\scom\.google\.common\.\(.*;\)/import
org.apache.jackrabbit.guava.common.\1/g" -i {} ";"
find . -name "*.java" -exec sed
"s/^import\sstatic\scom\.google\.common\.\(.*;\)/import static
org.apache.jackrabbit.guava.common.\1/g" -i {} ";"
~~~

WARNING: this is destructive. Only run it on a Git checkout with no
local changes, and do not do it inside your project root. You have been
warned.

After running this, you may find that a Guava 15 method actually has
been removed. Usually googling for the method signature will tell you
what happened.

For the modules where I already did the conversion, I also took the
opportunity to convert things to standard JDK 11 lingo where simple.
https://issues.apache.org/jira/browse/OAK-10180 /
https://github.com/apache/jackrabbit-oak/pull/890 is a good example for
that.

In the meantime, I changed my mind on this. I only do the minimal
changes needed; everything else should be done as a separate activity.

While continuing this work, I encountered cases where code uses methods
that have been removed or renamed in Guava. I'm not going to work on
these subprojects; instead I will open tickets and try to assign them to
people who are more familiar with that part of the code base (see
https://issues.apache.org/jira/browse/OAK-10197 for instance).

The currently planned timeline is:

1.52.0 (May?): release with shaded guava subproject and as many
subprojects converted as possible

1.54.0 (July?): remove deprecated APIs exposing native Guava

1.56.0: completely get rid of our Guava 15 dependency, only use the
shaded variant.

Feedback either here or in
<https://issues.apache.org/jira/browse/OAK-7182> appreciated.

Julian

Best regards, Julian

Reply via email to