eclipse.jdt.ls icon indicating copy to clipboard operation
eclipse.jdt.ls copied to clipboard

[WIP] Run tests against javac bits

Open fbricon opened this issue 1 year ago • 1 comments

The idea is to run

mvn clean verify -Pjavac

But for some reason I run into:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:4.0.8:validate-classpath (default-validate-classpath) on project org.eclipse.jdt.ls.tests: Execution default-validate-classpath of goal org.eclipse.tycho:tycho-compiler-plugin:4.0.8:validate-classpath failed: org.osgi.framework.BundleException: Bundle org.eclipse.jdt.ls.tests cannot be resolved:org.eclipse.jdt.ls.tests [293] [ERROR] Unresolved requirement: Require-Bundle: org.eclipse.jdt.core.javac

@akurtakov @mickaelistria what am I missing?

fbricon avatar May 27 '24 09:05 fbricon

I got the tests running in https://ci.eclipse.org/ls/job/jdt-ls-javac/

fbricon avatar May 27 '24 23:05 fbricon

A fix to ensure completion actually produces results. The monitor field in https://github.com/eclipse-jdtls/eclipse-jdt-core-incubator/blob/dom-with-javac/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/DOMCompletionEngine.java never calls beginTask or anything other than isCancelled. We use beginTask in the monitor to initialize the time at which we will call setCancelled(true). This fixes things for now.

diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandler.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandler.java
index 2610ec8a..f7861c1e 100644
--- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandler.java
+++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandler.java
@@ -268,8 +268,9 @@ public class CompletionHandler{
                        IBuffer buffer = unit.getBuffer();
                        if (buffer != null && buffer.getLength() >= offset) {
                                IProgressMonitor subMonitor = new ProgressMonitorWrapper(monitor) {
-                                       private long timeLimit;
                                        private final long TIMEOUT = Long.getLong("completion.timeout", 5000);
+                                       // beginTask need not be called so initialize here just in case
+                                       private long timeLimit = System.currentTimeMillis() + TIMEOUT;
 
                                        @Override
                                        public void beginTask(String name, int totalWork) {

rgrunber avatar Oct 11 '24 13:10 rgrunber

@rgrunber are you sure it's related to this issue? At the moment, the DOMCompletionEngine shouldn't be turned on with other Javac feature (soon, but not yet), so the behavior shouldn't be impacted. Can you please report the issue about the monitor to the jdt-core-incubator repo? cc @datho7561

mickaelistria avatar Oct 11 '24 14:10 mickaelistria

I'll fix it in the DOMCompletionEngine; I have a PR up right now since it's a ~2-3 line change

datho7561 avatar Oct 11 '24 15:10 datho7561

It's all disabled by default. However, if a user were to turn on the completion through DOM, they would get no results every time.

rgrunber avatar Oct 11 '24 16:10 rgrunber

I've merged the fix to call beginTask() and done() on the progress monitor

datho7561 avatar Oct 11 '24 20:10 datho7561

@rgrunber Anything blocking? Can we merge it now?

testforstephen avatar Oct 14 '24 01:10 testforstephen

mmm

[ERROR] Cannot resolve target definition:
[ERROR]   Software being installed: org.eclipse.jdt.core 3.38.0.v20240515-1634
[ERROR]   Software being installed: org.eclipse.jdt.core.manipulation 1.21.300.v20240918-0710
[ERROR]   Only one of the following can be installed at once: [org.eclipse.jdt.core 3.40.0.v20240919-0625, org.eclipse.jdt.core 3.38.0.v20240515-1634, org.eclipse.jdt.core 3.39.0.v20240807-1632]
[ERROR]   Cannot satisfy dependency: org.eclipse.jdt.core.manipulation 1.21.300.v20240918-0710 depends on: osgi.bundle; org.eclipse.jdt.core [3.39.0,4.0.0)
[ERROR]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for JDT Language Server :: Parent 1.41.0-SNAPSHOT:
[INFO]
[INFO] JDT Language Server :: Parent ...................... SUCCESS [  0.024 s]
[INFO] JDT Language Server :: Target Platform ............. SUCCESS [  0.004 s]
[INFO] JDT Language Server :: Core ........................ FAILURE [  3.625 s]

fbricon avatar Oct 15 '24 08:10 fbricon

I can try to rebase the JDT LS incubator to see if it helps

mickaelistria avatar Oct 15 '24 08:10 mickaelistria

Any idea what's with all the test failures ? https://ci.eclipse.org/ls/job/jdt-ls-pr/5305/

Update: Ok, seems to be related to the version of ECJ that is being used to compile.. maybe I just need to bump it. Yup, ECJ bump 3.38.0.v20240524-2033 -> 3.39.0.v20240820-0604 :flying_saucer:

rgrunber avatar Oct 15 '24 21:10 rgrunber