Java jdt-language-server version

Describe your feature request

The version of the org.eclipse.jdt.core.compiler.source=1.5 in the org.eclipse.jdt.core.prefs file is set to a very old version. Please change it to version 17, so that we don’t get “errors” in code completion for newer features.

What problem(s) would this feature solve?

Better code completion without red lines for code that actually works.

Explain what you were trying to do when you came across the problem leading to this feature request

I was writing code with lambda expressions in Java, where the code intelligence says that this is only available on source 1.8 or above, despite the compiler and runtime being at version 17.
I tried to change the version myself in the above mentioned file, but after a short while or a repl restart, it automatically changes the version back to 1.5. Please either allow us to change/customise it, or change it on your end.

4 Likes

Showstopper for any non-trivial Java program… any updates?

TLDR: 5 is ancient, been outdated for two decades. 17 should be the default. Setting is also glitching back to the default every 15 min or so.

Repl team, you can do better than this

@QwertyQwerty88

1 Like

just to be clear, replit staff all have a flair with the replit logo on their profile picture. Not that we like pinging of staff either.
And this “bug” is a trait of JDT which happens to be used by replit but is designed to be friendly for Eclipse users (just search on Google). To have replit change the default version on the Java template would make this a Feedback/General Problems topic.

Edit pom.xml like this:

<project>
<properties>
    <maven.compiler.source>17</maven.compiler.source>
</properties>
</project>

And then restart the Java language server

4 Likes

Thanks! We tried that yesterday and it doesn’t seem to affect Code Intelligence (red squiggly in screenshot). Is there another setting to refresh Code Intelligence for modern Java?

*Mea culpa, apologies on the ping

Try setting that version, then kill 1 in the Shell tab.

1 Like

Thanks, that seems to work! :raised_hands: :raised_hands:

Our class set maven.compiler.target as well - seemed this was necessary to update codegen.targetPlatform for example.

  <properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
  </properties>
1 Like

kill 1 reboots the whole repl. This is sufficient:

pkill -f '.*java-language-server.*'

Summary:

Add this to your pom.xml:

<properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
</properties>

(I also tried <maven.compiler.release>17</maven.compiler.release> but it didn’t work.)

Reload your browser tab Ctrl+R*.

You’ll notice that properties in .settings/org.eclipse.jdt.core.prefs have been updated:

org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.source=17

*Alternatively, type this in your replit’s Shell pane:

pkill -f '.*jdt-language-server.*'

It can take up to 20 seconds for .settings/org.eclipse.jdt.core.prefs to reflect the change you made to your pom.xml.

1 Like

Well, this solution has stopped working unfortunately. And now all my directories are not recognised as project files by Maven no matter what I do. Seems to be the right time to just give up on Replit. It shows a lot of potential, but there’s just too much stuff not working properly for it to actually be viable as anything but a tool to learn basic stuff.

1 Like

Yeah, something’s broken with the java language support. The code editor only shows syntax errors.
image

Basic expected IDE functions like checking the validity of method calls between classes in the project does not happen.

I tried moving my source files from the root directory to src/main/java directory to agree with the .classpath file, but that didn’t help.

Hopefully it gets fixed soon.

1 Like

I’m sad to see it’s not only me. But if it’s a general problem, hopefully they’ll get around to fixing it soon. It’s frustrating when it’s worked perfectly before, at least for me.

1 Like