coc-java icon indicating copy to clipboard operation
coc-java copied to clipboard

Error at for method references allowed only at source level 1.8

Open albertparedandan opened this issue 5 years ago • 2 comments

Sorry if this is an obvious/dumb question. I kinda new to all this.

I get this error when i type: Thread t = new Thread(PrinterThread::print);

but if i compile and run the Java file, it executes fine. But after the buffer (using Vim) reloads and shows the error, compile and running again will give me error [Java 1610613382] [E] Method references are allowed only at source level 1.8 or above.

I have tried setting the java.configuration.runtimes in my CocConfig but still does the same thing.

albertparedandan avatar Sep 23 '20 09:09 albertparedandan

Don't know what that means, it could be from jdt.ls.

chemzqm avatar Sep 23 '20 10:09 chemzqm

It sounds like you have the Java source version set to something less than 1.8 somewhere in your project. If you were using Maven for your build you'd set the version in your pom.xml like this:

  <properties>
    <java.version>1.8</java.version>
  </properties>

dansomething avatar Oct 20 '20 21:10 dansomething

Should be bad configured java version.

chemzqm avatar Jan 29 '23 09:01 chemzqm