boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 179 forks source link

boot repl auto-completion broken in JDK 9 and above #706

Closed tirkarthi closed 5 years ago

tirkarthi commented 6 years ago

Problem Description

boot repl autocompletion in JDK 8 and above throws NullPointerException for certain cases

Steps to reproduce

➜  boot git:(fix-reply-jdk-9) ./bin/boot repl
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
nREPL server started on port 44038 on host 127.0.0.1 - nrepl://127.0.0.1:44038
REPL-y 0.3.7, nREPL 0.2.13
Clojure 1.9.0-alpha17
Java HotSpot(TM) 64-Bit Server VM 9.0.4+11
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> clojure.co         java.lang.NullPointerException:
java.util.concurrent.ExecutionException: java.lang.NullPointerException

Platform details

➜  boot git:(fix-reply-jdk-9) uname -a
Linux ubuntu-s-1vcpu-1gb-blr1-01 4.4.0-127-generic #153-Ubuntu SMP Sat May 19 10:58:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
➜  boot git:(fix-reply-jdk-9) java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

This is caused due to outdated version of reply 0.3.7 which is not compatible with JDK 9 and above. reply uses clojure-complete which causes the exception. This has been fixed in clojure-complete and in reply with 0.3.8 that uses updated clojure-complete. This has been fixed in lein master but not yet released. Bumping reply version to 0.4.0 which is the latest will help.

Ref reply commit : https://github.com/trptcolin/reply/commit/6a7eafc00952519420b8845d93254edbcdfa0011 Leiningen issue : https://github.com/technomancy/leiningen/issues/2380 Upstream clojure-complete issue : https://github.com/ninjudd/clojure-complete/issues/24

I am willing to raise a PR and any help on how to upgrade reply will help. I tried simple grep and replaced it in boot/worker/build.boot and boot/worker/project.clj . But make deps uses the old dependency. Is that something to do with downloading stable version of lein which doesn't have the fix?

alandipert commented 6 years ago

@tirkarthi that's right about make deps, lein is downloaded and used at build-time but none of its dependencies are built into boot artifacts, even though you'll see them fly by.

boot/worker/build.boot and boot/worker/project.clj are the right places to update the dep.

tirkarthi commented 6 years ago

Thanks I have updated the files to have 0.4.0 and made make clean and make deps. Then ./bin/boot repl still shows 0.3.7 for reply. I couldn't see reply getting updated or downloaded. Is there a way to create the release artifact and test this? I am new to boot being a lein use so please correct if I am doing something wrong to fetch dependencies.

alandipert commented 6 years ago

If you didn't change version.properties file in this repo, then the artifacts are installed as the version it contains (2.8.1 currently).

It sounds like you might have your own ~/.boot/boot.properties with a different BOOT_VERSION specified. So, when you run ./bin/boot, it's using jars for some older version of boot without your change. You can override that file and specify BOOT_VERSION as an environment variable like this:

BOOT_VERSION=2.8.1 ./bin/boot

Does that show you anything different?

tirkarthi commented 6 years ago

Thanks, I have a boot.properties file at ~/.boot/boot.properties. I ran BOOT_VERSION=2.8.1 ./bin/boot and it says Downloading https://github.com/boot-clj/boot/releases/download/2.8.1/boot.jar and hangs. I can see the file downloaded the boot.jar downloaded at the directory. Is running as root causing any problem? I have set export BOOT_AS_ROOT=yes for the session and still hangs.

tirkarthi commented 6 years ago

On an side note, I pushed a commit with reply version as 0.4.0 and the CI build for JDK 11 fails with the dependency clojure/core.rrb-vector at https://travis-ci.org/tirkarthi/boot/jobs/398611988#L803 . It used to pass few days back and it seems something has changed in between in the EA build that it fails now. Maybe I will try reporting it upstream since this occurs with 0.0.11 and maybe fixed in master which is not released yet.

Let me know if I can make a PR with reply upgraded and JDK 11 disabled in CI for now since EA builds seem to be unstable.

alandipert commented 6 years ago

When you say it hangs, for how long is it hanging?

I ask because downloading boot.jar can take a long time, like several minutes, and so it might just be downloading really slowly for you.

tirkarthi commented 6 years ago

I think it's something with root user. I had it for 15 minutes or so meanwhile no non-root user did it in 2 minutes. To make sure I install reply 0.4.0 I went to boot/worker and ran lein install which installs from the project.clj but still bin/boot repl shows 0.3.7 . I did make clean, rm -rf ~/.boot to run make deps and ran /bin/boot repl with environment variable but still no effect on the reply version. Maybe I will raise a PR with upgraded version and JDK 11 disabled so that you can verify.

Thanks.

alandipert commented 5 years ago

@tirkarthi if you raise a PR I'm happy to try it out, thank you in advance.

tirkarthi commented 5 years ago

Thanks I have raised #711 which is a find and replace of version numbers.

There seems to be problems with compiling Clojure on JDK 11 EA build due to recent changes in JDK. This causes CI to fail since the dependency chain uses core.rrb-vector which is also JDK 11 incompatible but the issue was fixed in master. Let me know if I need to disable JDK 11 for now in Travis that can raised a separate PR.

core.rrb-vector fixed in master : https://github.com/clojure/core.rrb-vector/commit/b489b3249d56bb6a104c2d4ead2da8ade8dd29b4 Clojure JIRA ticket : https://dev.clojure.org/jira/browse/CLJ-2374

alandipert commented 5 years ago

I think this is fixed now by #711, thank you.