Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Buck does not compile with Java 11 #1548

Closed
shs96c opened this issue Sep 28, 2017 · 19 comments
Closed

Buck does not compile with Java 11 #1548

shs96c opened this issue Sep 28, 2017 · 19 comments
Assignees

Comments

@shs96c
Copy link
Contributor

shs96c commented Sep 28, 2017

Set your JAVA_HOME to point to an official Java 9 JDK. Run ant clean default. Watch the catastrophic failure of the build.

Fortunately, once you have a compiled version of buck, it runs under Java 9, which is nice.

@jkeljo
Copy link
Contributor

jkeljo commented Sep 28, 2017

it runs under Java 9

Well, sort of. Some codepaths in the Java compilation support don't like it much. :-)

@ttsugriy ttsugriy self-assigned this Sep 28, 2017
@ttsugriy
Copy link
Contributor

known problem :( Internally we haven't embraced Java 9 yet, but it's on our radar to fix Java 9 builds :)

@epkugelmass
Copy link
Contributor

I've submitted a patch that mostly gets Buck built under JDK9. There are some remaining issues because of the Skylark dependency, which uses an old version of AutoValue that is not JDK9 friendly.

#1672

@ttsugriy
Copy link
Contributor

Thank you, @epkugelmass! This is pretty awesome. I'm going to work on resolving the old AutoValue issue.

@ttsugriy
Copy link
Contributor

Looks like even the latest version of AutoValue still has issues, so I'm going to have to wait until google/auto#563 is merged, new version of AutoValue is released and it's used in Bazel :(

@epkugelmass
Copy link
Contributor

Awesome! You'll probably also want to bump ASM for the RELEASE_9 Opcodes. Or I can do it. Was feeling a bit lazy.

@epkugelmass
Copy link
Contributor

Nevermind -- buck is already using 6.0. I'll update the patch to take advantage of that.

@davido
Copy link
Contributor

davido commented Dec 13, 2017

@ttsugriy I released a private version of auto-value with this PR included google/auto#563 here: [1]. I needed it to build gerrit code review with bazel, with Java 9: [2].

@TarasMazepa
Copy link

Actually google/auto#563 is merged so @ttsugriy it is good time to revisit this issue ;)

@ttsugriy
Copy link
Contributor

Java 9 is no longer supported by Oracle, so we are unlikely to be supporting it. We may repurposes this for Java 10 support though.

@ttsugriy
Copy link
Contributor

@davido, looks like Bazel is still using autovalue 1.4 https://source.bazel.build/bazel/+/master:third_party/auto/auto-value-1.4.jar :(

@davido
Copy link
Contributor

davido commented Mar 23, 2018

@ttsugriy Right, but I was able to build Bazel with this version with Java 9, see bazelbuild/bazel#4820.

@davido
Copy link
Contributor

davido commented Mar 23, 2018

@ttsugriy I filed this issue: bazelbuild/bazel#4906. I'm on vacation now, and can only look into it later.

@ttsugriy
Copy link
Contributor

I'm also fixing a few issues that creeped into Buck's codebase that relied on a different behavior of HashMap#computeIfAbsent which used to allow value computations inside of computeIfAbsent block (despite explicitly saying in javadoc that nobody should do it :) I've already fixed one of such bugs and will try to fix the rest as soon as possible. I'm testing against Java 10 though, since Java 9 is dead :)

@ttsugriy
Copy link
Contributor

sorry, wrong link. I was referring to [HashMap#computeIfAbsent's](https://docs.oracle.com/javase/10/docs/api/java/util/HashMap.html#computeIfAbsent(K,java.util.function.Function) which says

Throws:
ConcurrentModificationException - if it is detected that the mapping function modified this map

@shs96c shs96c changed the title Buck does not compile with Java 9 Buck does not compile with Java 10 Jul 9, 2018
@shs96c
Copy link
Contributor Author

shs96c commented Jul 9, 2018

By replacing ecj with the system compiler, it's possible to get further in the ant build. However, the aosp compilation fails because sun.misc.BASE64Encoder is not in the Java 10 JRE. I'm unsure of the reasons for compiling AOSP again, but ISTR it had something to do with allowing us to get fast android installs working. It may be worth revisiting this decision, or updating to a more recent snapshot of the AOSP.

@AmiZya
Copy link

AmiZya commented Feb 2, 2019

I guess another modification of the title is needed ;)

You're using Java 11, but Buck requires Java 8.

@ttsugriy ttsugriy assigned jtorkkola and unassigned ttsugriy Feb 2, 2019
@ttsugriy ttsugriy changed the title Buck does not compile with Java 10 Buck does not compile with Java 11 Feb 2, 2019
@davido
Copy link
Contributor

davido commented Feb 3, 2019

Actually, I can compile Buck with JDK11 without any issue. When I try to run Buck built on JDK11 it crashes: http://paste.openstack.org/show/744455.

Is it a known issue?

@epkugelmass
Copy link
Contributor

Known problem, though I don't know if there is a GitHub issue open for it.
You can fix it by passing the --java11-test-mode flag.

https://github.com/facebook/buck/blame/master/programs/buck.py#L187

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants