1

Attempting to sbt compile a branch of my project ENSIME (experiment if you're interested) under Java 6 is giving a bizarre compiler warning:

[info] Compiling 48 Scala sources to /home/fommil/Projects/ensime-server/target/scala-2.11/classes...
[error] Class java.lang.invoke.MethodHandle not found - continuing with a stub.
[error] two errors found
[error] (compile:compile) Compilation failed
[error] Total time: 18 s, completed 03-Sep-2014 22:57:44

It works under Java 7.

Calling last reveals nothing more than the classpath of the compile (this would be equivalent to setting --debug level).

I've removed all the plugins from the project, and the problem still shows.

If I remove all my code - leaving just the build system and dependencies - with some stub scala entry points then there is no problem.

However, I can't exactly bisect my source code file because then it doesn't compile.

When the code is compiled, a grep (including binaries) of MethodHandle doesn't give any hits (although there is a jdk8 file in the tests resources, it is not relevant because the problem appears if it is removed).

It is only one (big) patch that has caused the problem (the previous commit compiles ok).

  1. How can I debug this further in sbt? it doesn't want to give any more info
  2. is this a known problem, or can anyone make an informed guess what is going on?
fommil
  • 5,757
  • 8
  • 41
  • 81
  • The entire java.lang.invoke package was introduced in Java 7. Are you sure that sbt itself is running under Java 6? The [answer to this old question](http://stackoverflow.com/questions/7701692/setting-up-sbt-to-use-java-7-for-compilation) may help to ensure that. – Spiro Michaylov Sep 04 '14 at 04:56
  • Yes I'm sure. I use PATH, JAVA_HOME and check javaHome . – fommil Sep 04 '14 at 07:00
  • It's a bit tedious, but you can try to use the -verbose:class switch on the Java command line. (I do realize you want something higher level, but I also see that you don't seem to be finding it.) – Spiro Michaylov Sep 04 '14 at 15:46

1 Answers1

0

It turns out that this was caused by pulling in Lucene, which requires Java 7.

A bit of an epic message fail from sbt: there doesn't appear to be any way to get it to output anything sensible.

fommil
  • 5,757
  • 8
  • 41
  • 81