Skip to content

Remove guava from transitive compile classpath (#54309)#54695

Merged
rjernst merged 3 commits intoelastic:7.xfrom
rjernst:guava_runtime_7.x
Apr 8, 2020
Merged

Remove guava from transitive compile classpath (#54309)#54695
rjernst merged 3 commits intoelastic:7.xfrom
rjernst:guava_runtime_7.x

Conversation

@rjernst
Copy link
Copy Markdown
Member

@rjernst rjernst commented Apr 2, 2020

Guava was removed from Elasticsearch many years ago, but remnants of it
remain due to transitive dependencies. When a dependency pulls guava
into the compile classpath, devs can inadvertently begin using methods
from guava without realizing it. This commit moves guava to a runtime
dependency in the modules that it is needed.

Note that one special case is the html sanitizer in watcher. The third
party dep uses guava in the PolicyFactory class signature. However, only
calling a method on the PolicyFactory actually causes the class to be
loaded, a reference alone does not trigger compilation to look at the
class implementation. There we utilize a MethodHandle for invoking the
relevant method at runtime, where guava will continue to exist.

Guava was removed from Elasticsearch many years ago, but remnants of it
remain due to transitive dependencies. When a dependency pulls guava
into the compile classpath, devs can inadvertently begin using methods
from guava without realizing it. This commit moves guava to a runtime
dependency in the modules that it is needed.

Note that one special case is the html sanitizer in watcher. The third
party dep uses guava in the PolicyFactory class signature. However, only
calling a method on the PolicyFactory actually causes the class to be
loaded, a reference alone does not trigger compilation to look at the
class implementation. There we utilize a MethodHandle for invoking the
relevant method at runtime, where guava will continue to exist.
@rjernst rjernst merged commit 37795d2 into elastic:7.x Apr 8, 2020
@rjernst rjernst deleted the guava_runtime_7.x branch April 8, 2020 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant