question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enabling proper Error Prone integration with Buck

See original GitHub issue

We wanted to have a discussion on the best way to “upstream” our technique for using using Error Prone with Buck, which would primarily consist of adding documentation.

For the most part, our integration uses the available javac_jar and compiler_class_name options, where the javac jar is the Error Prone Ant artifact. Error Prone is packaged with a version of the JDK 9 javac compiler, whereas we currently build on JDK 8. This makes integration slightly tricky, as the JDK 9 javac includes updated versions of certain javax.tools and javax.lang.model.type classes as compared to what is in the JDK 8 rt.jar. To work around this issue, we have extracted the relevant classes from the EP javac jar into a small new jar tiny_tools.jar that we place in Buck’s bootclasspath via .buckjavaargs. (Placing the full EP Ant artifact in the bootclasspath is risky; see google/error-prone#934.) With this change, everything seems to work well, including plugin checks. One downside is that the EP Ant artifact exposes some third-party libraries like Guava to annotation processors; we opened google/error-prone#950 to relocate the classes most likely to cause conflicts.

An alternative integration point would be to use Error Prone as a Javac plugin, which is supported by Error Prone (see the docs). However, this integration requires Java 9, and we are still building on JDK 8; we have not yet tried it in the context of Buck builds.

In terms of upstreaming, one question is where the tiny_tools.jar file should live. We could create a separate Maven artifact for it, or add it to the Buck repo. It was created via a fairly manual process, and it could requiring updating when Error Prone uses a new javac version. We could also add some scripting around this to auto-generate the jar.

Other feedback / comments welcome. Thanks!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
msridharcommented, Mar 8, 2018

Some further clarity on classloader stuff. My understanding of bootstrap_deploy.jar was way off in the above comment. What actually happens is:

  1. Bazel places the full javac jar in the bootclasspath here
  2. Separate code manages the bootclasspath used when running javac, through a mix of passing the -bootclasspath parameter and calling the file manager APIs, e.g., here and here. This makes sense, as for example if you’re targeting 1.6, you want the bootclasspath seen by the compiler to match a 1.6 JVM.

Anyway, wanted to clarify that. Still thinking about the right integration for Buck; will post back when I have something.

1reaction
msridharcommented, Oct 18, 2019

FYI, we have documented how we got Error Prone to work with Buck builds on JDK 8 at Uber:

https://github.com/uber/okbuck/wiki/Using-Error-Prone-with-Buck-and-OkBuck

Feedback welcome and I’m happy to help with upstreaming docs or scripts if desired

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Error Prone with Buck and OkBuck - GitHub
Run tooling/errorprone/createtinyjavaxtools.sh to create a tinyjavaxtools.jar that contains key classes that need to be in Buck's bootclasspath.
Read more >
A comparative evaluation of hybrid error correction methods ...
The self-correction strategy corrects error-prone LRs by generating a consensus from a constructed layout of LRs.
Read more >
Bug Patterns - Error Prone
Each bug pattern includes code examples of both positive and negative cases; these examples are used in our regression test suite. Patterns which...
Read more >
Uncover the Bonus Components in Your Buck Converter ...
A good pin-out should enable the engineer to implement the following guidelines: Minimize the critical, high di/dt loop. Keep the high dv/dt ...
Read more >
How to Get More Bang for Your Buck When Integrating ...
There are a lot of good reasons to integrate Magento eCommerce ... is to avoid manual key entry which is time-consuming and error-prone....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found