Closed rubenporras closed 2 months ago
Hi @sebthom ,
I could not find a way to override the method CompletableFuture<List<@Nullable Object>> configuration(ConfigurationParams configurationParams)
after the new annotations, as the definition in LanguageClientImpl
and LanguageClient
do not have the same annotations.
To me this is a bug in the JDT, but the new protected method is in any case a better API for subclasses than the previous one.
What do you think of this PR?
Hi @rubenporras I don't understand why you can't find a way to override it. It seems to work fine for me:
package org.haxe4e.langserver;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.eclipse.jdt.annotation.*;
import org.eclipse.lsp4e.LanguageClientImpl;
import org.eclipse.lsp4j.*;
import org.haxe4e.util.TreeBuilder;
@SuppressWarnings("restriction") // https://bugs.eclipse.org/bugs/show_bug.cgi?id=536215
public final class HaxeLangServerClientImpl extends LanguageClientImpl implements HaxeLangServerClient {
private volatile boolean isInitTriggered = false;
@Override
public CompletableFuture<List<@Nullable Object>> configuration(final ConfigurationParams configurationParams) {
return super.configuration(configurationParams);
}
@Override
public @NonNullByDefault({}) CompletableFuture<Void> registerCapability(final RegistrationParams params) {
if (!isInitTriggered) {
// workaround for https://github.com/vshaxe/vshaxe/issues/501
final var event = new DidChangeConfigurationParams(new TreeBuilder<String>() //
.put("haxe", new TreeBuilder<String>() //
.getMap() //
).getMap());
getLanguageServer().getWorkspaceService().didChangeConfiguration(event);
isInitTriggered = true;
}
return super.registerCapability(params);
}
}
What is the error or warning you are seeing?
Hi @sebthom,
I do not know why, but changing the configuration item org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations
from disabled
to enabled
and restarting eclipse seems to solve the problem. I have tried changing the configuration yesterday already but it looks like the build that is triggered afterwards is not enough, and a restart is needed.
Does it makes sense to you?
do you still have the issue now that you merged the no-npe 1.0.4 version? I made a change to the EEA of LanguageClientImpl at https://github.com/vegardit/no-npe/commit/ec54909964f93ac9284383ae4ad34cfe731d1f29 which might solve the issue.
The problem is solved for me now. Thanks.
Nice!
Configuration Items