Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project compiles with Eclipse; errors with JDTLS, using same data directory #3370

Open
aj-sarama opened this issue Jan 26, 2025 · 26 comments
Open

Comments

@aj-sarama
Copy link

I first set up my multi-project workspace in Eclipse. Opening the same project using JDTLS gives errors that indicate there is something wrong with the JRE being used by JDTLS:

Compiling for Java version '1.6' is no longer supported. Minimal supported version is '1.8'

My relevant Eclipse project settings are:

Preferences -> Java -> Installed JREs: JavaSE-11 (/path/to/jdk-11)
Preferences -> Java -> Compiler -> Compliance: 1.8 (required for my project)

These settings are reflected in my org.eclipse.jdt.core.prefs:

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

I pass the following settings via nvim-jdtls to the language server:

	settings = {
		java = {
			configuration = {
				runtimes = {
					{
						name = "JavaSE-11",
						path = "/same/path/to/jdk-11",
						default = true,
					}
				},
				compilerCompliance = "1.8",
			},

		}
	},

Using the same data directory as the Eclipse project that was set up without issues.

Again, I get errors that look like:
Compiling for Java version '1.6' is no longer supported. Minimal supported version is '1.8'

Please advise how I can continue to debug my setup.

@snjeza
Copy link
Contributor

snjeza commented Jan 26, 2025

@aj-sarama Could you show your .classpath, .project files? Is there pom.xml, build.gradle or build.gradle.kts in your workspace?

@aj-sarama
Copy link
Author

@snjeza

The project uses Ant as its build tool. There's a build.xml at the root of the project, although that file does not seem to specify which Java version to use. Could that be a problem?

It's a multi-project workspace, so there are many .project and .classpath files. Here's a .classpath file for one of the projects:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="output" path="bin"/>
</classpath>

@snjeza
Copy link
Contributor

snjeza commented Jan 27, 2025

The project uses Ant as its build tool. There's a build.xml at the root of the project, although that file does not seem to specify which Java version to use. Could that be a problem?

No, Java Ls doesn't check build.xml

It's a multi-project workspace, so there are many .project and .classpath files. Here's a .classpath file for one of the projects:

Could you check the project/directory where you get Compiling for Java version '1.6' is no longer supported. Minimal supported version is '1.8' ?

@aj-sarama
Copy link
Author

Oh, many of my projects have this in their .classpath:

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>

Also in their MANIFEST.MF:

Bundle-RequiredExecutionEnvironment: JavaSE-1.6

So that may be why JDTLS is tripping up, although I don't understand why/how Eclipse is handling this case and JDTLS is not...

@aj-sarama
Copy link
Author

Hi @snjeza

I have updated every .classpath and MANIFEST.MF in my project to use JavaSE-11. I still get the error Compiling for Java version '1.6' is no longer supported. Minimal supported version is '1.8' in a directory where this is the .classpath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="output" path="bin"/>
</classpath>

And this is the .project:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>com.raytheon.uf.viz.dataplugin.nswrc</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.python.pydev.PyDevBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.pde.ManifestBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.pde.SchemaBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.pde.PluginNature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.python.pydev.pythonNature</nature>
	</natures>
	<filteredResources>
		<filter>
			<id>1738028329262</id>
			<name></name>
			<type>30</type>
			<matcher>
				<id>org.eclipse.core.resources.regexFilterMatcher</id>
				<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
			</matcher>
		</filter>
	</filteredResources>
</projectDescription>

Booting up the same project in Eclipse, then running Clean results in none of these errors that I get with JDTLS.

@snjeza
Copy link
Contributor

snjeza commented Jan 28, 2025

@aj-sarama Could you attach your server log? - Enable Logging

@aj-sarama
Copy link
Author

@snjeza

Here's my JDTLS log, with the latest session:

jdtls.log

@rgrunber
Copy link
Contributor

Also, are you able to share the projects at all or pared down version of them ? You mentioned "Bundle-RequiredExecutionEnvironment in your MANIFEST files", but that implies these are Eclipse plugin projects (not supported out-of-the-box). Eclipse includes PDE (Plugin Development Environment), which gives that support by default. Not to be confused with Eclipse Java projects, which we do support. You also mentioned Ant ?

If you really do need PDE support, there is https://github.com/testforstephen/vscode-pde but the bundles that provide that support to the JDT-LS language server is embedded into the VS Code extension for it.

@aj-sarama
Copy link
Author

@rgrunber

Thanks for responding--yes, it is an Eclipse plugin project. So I would need PDE support for my project. Not particularly interested in using VSCode specifically. How difficult would it be to replicate the support provided by https://github.com/testforstephen/vscode-pde?

@rgrunber
Copy link
Contributor

rgrunber commented Jan 28, 2025

@aj-sarama ok, good to know. Hearing ant mentioned alongside PDE / Eclipse plugins gives me some scary flashbacks to pdebuild. If I had to guess, all you need is the contents of https://github.com/testforstephen/vscode-pde/tree/master/pde . Specifically org.eclipse.jdt.ls.importer.pde . That bundles contains the server-side code, which at it's most basic fetches the contents of a target file and sets them on the classpath.

I'm not sure if nvim-jdtls has a way to do this, but based on a quick look at the sources, you would need to invoke a command through the language server protocol. Specifically, the well-defined workspace/executeCommand with the 2 arguments "java.pde.reloadTargetPlatform" and another String representing the URI location of the target platform file on disk (ideally in the project that's opened).

See https://github.com/testforstephen/vscode-pde/blob/master/pde/org.eclipse.jdt.ls.importer.pde/src/org/eclipse/jdt/ls/importer/pde/internal/PDEDelegateCommandHandler.java#L67-L70 .

Update: This whole bundle is provided to JDT-LS through the bundles setting, which from looking at https://github.com/mfussenegger/nvim-jdtls, I see is possible. Also, just realized you would need to include all the dependencies of this importer bundle, which aren't part of JDT-LS. To do that I would get them from the list at https://github.com/testforstephen/vscode-pde/blob/master/gulpfile.js#L10-L65 , which also indicates where they would be populated after you build just what's inside the pde/ folder. Rough sample of what it looks like from VS Code :

(your absolute path would of course be a bit different)

bundles setting list
"bundles": [
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.sat4j.pb_2.3.6.v20201214.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.sat4j.core_2.3.6.v20201214.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/bcpg_1.78.1.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/bcprov_1.78.1.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/bcutil_1.78.1.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.ecf.identity_3.10.0.v20230422-0242.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.ecf.provider.filetransfer_3.3.0.v20230422-0242.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.concurrent_1.3.0.v20240213-1244.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.ecf_3.11.0.v20230507-1923.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.ecf.filetransfer_5.1.103.v20230705-0614.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.transport.ecf_1.4.200.v20240203-1359.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.tukaani.xz_1.9.0.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.engine_2.10.0.v20240210-0918.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.repository_2.8.100.v20240207-1113.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.metadata.repository_1.5.300.v20240201-0843.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.metadata_2.9.0.v20240213-1100.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.garbagecollector_1.3.200.v20240201-0843.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.jarprocessor_1.3.300.v20240201-0843.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.artifact.repository_1.5.300.v20240220-1431.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.director_2.6.300.v20240207-1113.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.publisher.eclipse_1.6.0.v20240229-1022.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.publisher_1.9.100.v20240212-1707.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.pde.build_3.12.300.v20240212-0530.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.team.core_3.10.300.v20240125-0912.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.repository.tools_2.4.300.v20240207-1113.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.core_2.11.0.v20240210-1628.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.pde.core_3.18.0.v20240215-1456.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.pde.launching_3.12.0.v20240214-2143.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.touchpoint.natives_1.5.200.v20240201-0843.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.equinox.p2.touchpoint.eclipse_2.4.200.v20240201-0843.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.jdt.ls.importer.pde_1.4.3.20240731-0722.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.e4.core.contexts_1.12.500.v20231220-1554.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.e4.core.services_2.4.300.v20240119-0800.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.e4.core.di_1.9.300.v20240207-1044.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.e4.core.di.annotations_1.8.300.v20231220-1554.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.ecf.provider.filetransfer.httpclient5_1.1.0.v20230423-0417.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.apache.httpcomponents.client5.httpclient5_5.2.1.v20230802-0806.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.apache.httpcomponents.core5.httpcore5_5.2.3.v20230922-1600.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.apache.httpcomponents.core5.httpcore5-h2_5.2.3.v20230922-1600.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.jdt.junit4.runtime_1.3.100.v20231214-1952.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.pde.junit.runtime_3.8.100.v20240130-1723.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.osgi.service.repository_1.1.0.201505202024.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.eclipse.m2e.pde.target_2.0.501.20240411-1122.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/biz.aQute.bnd.util_7.0.0.202310060912.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/biz.aQute.bndlib_7.0.0.202310060912.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/jakarta.annotation-api_2.1.1.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/jakarta.inject.jakarta.inject-api_2.0.1.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/org.apache.commons.commons-io_2.16.1.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/javax.annotation_1.3.5.v20200504-1837.jar",
            "/home/rgrunber/.vscode/extensions/yaozheng.vscode-pde-0.11.1/server/javax.inject_1.0.0.v20091030.jar"
        ]

@aj-sarama
Copy link
Author

@rgrunber

What a fantastic and helpful reply, thank you very much. I'm going to first see if my project works with VSCode + the PDE extension, and will follow your advice if it does.

@aj-sarama
Copy link
Author

@rgrunber

Working with VSCode and the PDE plugin now, I'm getting the same error and stack trace as the log I provided previously:

[Error - 9:55:58 PM] Jan 28, 2025, 9:55:58 PM Error
org.eclipse.equinox.simpleconfigurator/bundles.info (No such file or directory)
java.io.FileNotFoundException: org.eclipse.equinox.simpleconfigurator/bundles.info (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:106)

I have my .target file that I am using with the PDE plugin (abridged, since it is quite long):

<target includeMode="feature" name="Eclipse 4.21">
    <locations>
        <location path="/path/to/eclipse/dir" type="Directory"/>
    </locations>
    <includeBundles>
        <feature id="org.eclipse.rcp"/>
        <feature id="org.eclipse.e4.rcp"/>
        <feature id="org.eclipse.emf.common"/>
        <feature id="org.eclipse.emf.ecore"/>
        <feature id="org.eclipse.rcp.source"/>
        <feature id="org.eclipse.e4.rcp.source"/>
        <feature id="org.eclipse.platform"/>

Now in that /path/to/eclipse/dir, here is the directory structure:

.
├── binary
├── configuration
│   ├── org.eclipse.core.runtime
│   ├── org.eclipse.e4.ui.css.swt.theme
│   ├── org.eclipse.equinox.app
│   ├── org.eclipse.equinox.simpleconfigurator
│                ├── bundles.info (it's here...)
│   ├── org.eclipse.equinox.source
│   ├── org.eclipse.oomph.setup
│   ├── org.eclipse.osgi
│   ├── org.eclipse.ui.intro.universal
│   └── org.eclipse.update
├── dropins
├── features
│   ├── org.eclipse.buildship_3.1.5.v20210113-0929
...
│   └── org.python.pydev.feature_9.1.0.202110031145
├── p2
│   ├── org.eclipse.equinox.p2.core
│   └── org.eclipse.equinox.p2.engine
├── plugins
│   ├── com.python.pydev.analysis_9.1.0.202110031145
...
│   └── org.python.pydev.shared_ui_9.1.0.202110031145

I have confirmed that org.eclipse.equinox.simpleconfigurator/bundles.info exists and is readable. But it is under the configuration directory, so I'm not sure if that structure is right...

I get the error immediately after right clicking my .target file and running Reload Target Platform. Any pointers would be appreciated! :-)

@snjeza
Copy link
Contributor

snjeza commented Jan 28, 2025

Working with VSCode and the PDE plugin now, I'm getting the same error and stack trace as the log I provided previously:

@aj-sarama You may want to take a look at redhat-developer/vscode-java#3926 (comment)

@aj-sarama
Copy link
Author

@snjeza @rgrunber
Oh! I see.

It looks like VSCode was giving me a bunch of phantom errors after building my project, so I thought something was wrong. When it built, it reported ~250 errors. When I visited each file with errors, they magically disappeared from the diagnostics. I don't know how to diagnose whether that is a problem with VSCode/Java Extension/PDE Plugin or JDTLS. Or perhaps it's automatically resolving them somehow?

@snjeza
Copy link
Contributor

snjeza commented Jan 29, 2025

It looks like VSCode was giving me a bunch of phantom errors after building my project, so I thought something was wrong. When it built, it reported ~250 errors. When I visited each file with errors, they magically disappeared from the diagnostics.

@aj-sarama Could you attach some of these projects?

@rgrunber
Copy link
Contributor

rgrunber commented Jan 29, 2025

It would help to know what some/most of those 250 errors were, or even a sample project where it happens. We do have a setting to control how we check/update errors/warnings on opened files but for the most part, files shouldn't have to be opened to get the state of errors/warnings to be accurate. Sometimes it might appear as if the build is complete because you can do things, but the language server begins responding to requests even while the build might be ongoing. You'd want to pay attention to the Java server status item in the toolbar at the bottom. In some instances it can temporarily signal "Ready" and jump to building.

Screencast.From.2025-01-28.23-25-50.mp4

There are a very small set of errors which can disappear (but aren't truly resolved) (eg. type name already defined, preview features enabled for incompatible version) mainly because certain errors can only be detected by a full build, and when a file is opened a less intensive error reporting is done which doesn't catch some. This is a bug in how we report certain errors in our the language server.

@aj-sarama
Copy link
Author

@snjeza @rgrunber

The project is a very complicated monolith (~850 subprojects, ~13,000 source files), and although it is open source, it isn't so easy to get set up. So I'm not sure sharing the project here is the right approach.

As for the errors, the vast majority of them are "the import ___ cannot be resolved", where once I visit the file with the error in question, it seems to immediately resolve the issue. Rebuilding the project seems to make them pop up again. By watching the compilation progress, it seems like one project temporarily fails to build, leading to its dependencies being unable to import it. Once that project eventually does build successfully, those projects that depend on it are left with that error until I explicitly open them.

If it's a particular project setup issue, a screensharing situation may be more productive. In any case, please consider setting up either a sponsor page for JDTLS or your own GitHub sponsor pages. I am grateful that the both of you are giving me the time of day for my very specific issues.

One thing I question about VSCode's JDTLS is that it is not asking me for a data directory, and it doesn't seem to be configurable anywhere. Given that Eclipse handles the project okay, I figured passing the same data directory to JDTLS would be helpful.

I'm going to fork nvim-jdtls and add that workspace command for PDE support. Hopefully that combined with using a working Eclipse's data directory will make things behave.

@snjeza
Copy link
Contributor

snjeza commented Jan 29, 2025

@aj-sarama you can upload your projects to github - Creating a new repository

@aj-sarama
Copy link
Author

aj-sarama commented Jan 30, 2025

Unfortunately, I won't be able to do that, as they are sadly not fully open-source. I'll close the issue momentarily--I just wanted to ask, for my own PDE JDTLS setup,

@rgrunber in your analysis of how the PDE VSCode plugin works, I noticed you did not include this request to resolve the launch arguments through the included PDE project. Is it necessary to do this with my own extension of nvim-jdtls?

Edit: after further inspection, it looks like it's only necessary for launching the PDE application, which I probably will just do through Eclipse

@rgrunber
Copy link
Contributor

rgrunber commented Jan 30, 2025

Exactly. PDE provides the ability to generate the target platform (set of all dependencies that could be used to build/test the application) but also the ability to launch the application from a valid *.launch file in the workspace. This is actually done through the vscode-java-debug extension, which vscode-pde depends on.

The call at https://github.com/testforstephen/vscode-pde/blob/795f86673ba29f50f7c1f3e09c63d9d155577bfc/src/extension.ts#L120-L134 , programmatically configures this https://code.visualstudio.com/docs/java/java-debugging#_configuration-options , which is defined at https://github.com/microsoft/vscode-java-debug/blob/4d30fc1364a233570f9cdec1ee5522e3e6d49b1a/package.json#L369-L776 .

Regarding your data directory question, vscode-java configures that on behalf of users. It's details like these that we attempt to hide from users as they complicate things. VS Code defines a storage location for each extension (eg. ~/.config/Code/User/globalStorage/redhat.java/1.40.2025012508/), and a storage location for each opened project (eg. ~/.config/Code/User/workspaceStorage/23dc91ae29b7c331f94c926c474079b2/redhat.java/). We use the global storage to store Eclipse/Equinox configuration data (eg. jars embedded in bundles that must be placed here to be on the classpath, equinox dependency wiring information), and we use the workspace storage to store the actual Eclipse "data" location that is familiar to most Eclipse users. It's named jdt_ws (ss_ws is the one used for a lightweight startup of the language server) . We also link things like the .project/.classpath files as most users don't like seeing those files generated in their existing projects.

@aj-sarama
Copy link
Author

aj-sarama commented Jan 30, 2025

@rgrunber

For those "phantom errors" that seem to resolve themselves when I open a file, is there a command I can send to JDTLS using my neovim client, essentially asking it to reload a specific file? Something other than textDocument/didOpen?

Edit: right as the errors magically resolve themselves, JDTLS is sending a "Validating file" message to my client, and then stops reporting diagnostics like "Support for compiling Java 1.6..."

@rgrunber
Copy link
Contributor

"Validating file" is probably triggered by opening the file. Also, we dropped support for compiling projects that enforce a pre-1.8 around summer 2024. Recent Eclipse's releases (after summer 2024) should behave the same as the support was dropped there. See #3227 . It's updated on our README : https://github.com/eclipse-jdtls/eclipse.jdt.ls?tab=readme-ov-file#features . Just realized you mentioned this earlier on but couldn't understand how a BREE of JavaSE-1.6 could have caused any issues given we didn't support PDE at all by default. Maybe you have some .settings/ folder somewhere that contains "1.6" in the org.eclipse.jdt.core.prefs file ?

It actually looks like this kind of error, Compiling for Java version '1.7' is no longer supported. Minimal supported version is '1.8' is the same kind of problem that we ran into at redhat-developer/vscode-java#1111 . Can you confirm the errors return if you close the files and trigger a full build with shift+alt+b? The full build collect the errors generate from the build, while opening a file loses those errors. It's an issue we need to fix.

@aj-sarama
Copy link
Author

aj-sarama commented Jan 30, 2025

Yes, a rebuild does retrigger those errors. Let me know what specific questions I can answer about the project where that error originates, as I unfortunately cannot send it as-is.

Edit: your second paragraph confused me a little bit--are the errors legitimate and are being lost on open?

@snjeza
Copy link
Contributor

snjeza commented Jan 30, 2025

Edit: Let me know what specific questions I can answer about the project where that error originates, as I unfortunately cannot send it as-is.

@aj-sarama Could you show the project's .project and .classpath?

@aj-sarama
Copy link
Author

Oh, for a couple of my projects I see that I have this entry in the classpath:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>

That's obviously the problem here. Although, Eclipse doesn't seem to report this as an error for the same project setup.

@snjeza
Copy link
Contributor

snjeza commented Jan 31, 2025

Eclipse doesn't seem to report this as an error for the same project setup.

What version of Eclipse are you using?

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

No branches or pull requests

3 participants