Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ subprojects {
properties['org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables']='warning'
properties['org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment']='warning'
properties['org.eclipse.jdt.core.compiler.problem.potentialNullReference']='warning'
properties['org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable']='warning'
properties['org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable']='ignore'
properties['org.eclipse.jdt.core.compiler.problem.rawTypeReference']='warning'
properties['org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation']='warning'
properties['org.eclipse.jdt.core.compiler.problem.redundantNullCheck']='warning'
Expand Down Expand Up @@ -171,7 +171,7 @@ subprojects {
properties['org.eclipse.jdt.core.compiler.problem.unusedLabel']='warning'
properties['org.eclipse.jdt.core.compiler.problem.unusedLocal']='warning'
properties['org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation']='warning'
properties['org.eclipse.jdt.core.compiler.problem.unusedParameter']='warning'
properties['org.eclipse.jdt.core.compiler.problem.unusedParameter']='ignore'
properties['org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference']='enabled'
properties['org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract']='disabled'
properties['org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete']='disabled'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
******************************************************************************/
package org.eclipse.lsp4j.debug.test;

import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.concurrent.Future;
Expand All @@ -25,7 +24,7 @@ public class DSPDebugServer {

// This is a test for https://github.com/eclipse-lsp4j/lsp4j/issues/224
@Test
public void testDebugServerCanBeLaunched() throws IOException {
public void testDebugServerCanBeLaunched() {
TestDebugServer testDebugServer = new TestDebugServer();
Launcher<IDebugProtocolClient> launcher = DSPLauncher.createServerLauncher(testDebugServer,
new PipedInputStream(), new PipedOutputStream());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
Expand All @@ -46,7 +44,7 @@ public class DSPLauncherTest {
private static final long TIMEOUT = 2000;

@Test
public void testNotification() throws IOException {
public void testNotification() {
OutputEventArguments p = new OutputEventArguments();
p.setOutput("Hello World");

Expand Down Expand Up @@ -152,7 +150,7 @@ public void setup() throws IOException {
}

@After
public void teardown() throws InterruptedException, ExecutionException {
public void teardown() throws InterruptedException {
clientListening.cancel(true);
serverListening.cancel(true);
Thread.sleep(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ protected void parseHeader(String line, Headers headers) {
headers.charset = line.substring(charsetIndex + 8).trim();
break;
}
default:
// Other headers are ignored
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ public void setContext(MessageContext<T> context) {

/**
* Get the context for the current request
* @return
*/
public MessageContext<T> getContext() {
return messageContext.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public void testSimple() {
Assert.assertEquals(2, foo.calls);
}

@SuppressWarnings("unused")
@Test
public void testDelegateThrows() {
DelegateThrows delegateThrows = new DelegateThrows();
Expand Down Expand Up @@ -128,6 +129,7 @@ public void testMultiServices() {
Assert.assertEquals(1, bar.calls);
}

@SuppressWarnings("unused")
@Test
public void testDuplicateNamesGeneratesError() {
DuplicateNames1 duplicateNames1 = new DuplicateNames1();
Expand Down Expand Up @@ -198,7 +200,7 @@ public void myNotification() {

endpoint.notify("myNotification", params);

if (predicate != null) {
if (predicate != null && logMessages != null) {
logMessages.await(r -> Level.WARNING == r.getLevel() && predicate.test(r.getMessage()));
}
} finally {
Expand Down Expand Up @@ -250,7 +252,7 @@ public CompletableFuture<String> getStringValue(String stringValue) {

Assert.assertEquals(expectedString, endpoint.request("getStringValue", params).get());

if (predicate != null) {
if (predicate != null && logMessages != null) {
logMessages.await(r -> Level.WARNING == r.getLevel() && predicate.test(r.getMessage()));
}
} finally {
Expand Down Expand Up @@ -316,7 +318,7 @@ public void myNotification(String stringValue, Integer intValue) {
});
endpoint.notify("myNotification", params);

if (predicate != null) {
if (predicate != null && logMessages != null) {
logMessages.await(r -> Level.WARNING == r.getLevel() && predicate.test(r.getMessage()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public int read() throws IOException {
}
};
MessageJsonHandler jsonHandler = new MessageJsonHandler(Collections.emptyMap());
StreamMessageProducer messageProducer = new StreamMessageProducer(input, jsonHandler);
messageProducer.listen(message -> {});
messageProducer.close();
try (StreamMessageProducer messageProducer = new StreamMessageProducer(input, jsonHandler)) {
messageProducer.listen(message -> {});
}
}).get(TIMEOUT, TimeUnit.MILLISECONDS);
}

Expand All @@ -83,9 +83,9 @@ public int read() throws IOException {
}
};
MessageJsonHandler jsonHandler = new MessageJsonHandler(Collections.emptyMap());
StreamMessageProducer messageProducer = new StreamMessageProducer(input, jsonHandler);
messageProducer.listen(message -> {});
messageProducer.close();
try (StreamMessageProducer messageProducer = new StreamMessageProducer(input, jsonHandler)) {
messageProducer.listen(message -> {});
}
}).get(TIMEOUT, TimeUnit.MILLISECONDS);
}

Expand All @@ -99,9 +99,9 @@ public int read() throws IOException {
}
};
MessageJsonHandler jsonHandler = new MessageJsonHandler(Collections.emptyMap());
StreamMessageProducer messageProducer = new StreamMessageProducer(input, jsonHandler);
messageProducer.listen(message -> {});
messageProducer.close();
try (StreamMessageProducer messageProducer = new StreamMessageProducer(input, jsonHandler)) {
messageProducer.listen(message -> {});
}
}).get(TIMEOUT, TimeUnit.MILLISECONDS);
}

Expand All @@ -116,9 +116,9 @@ public int read() throws IOException {
}
};
MessageJsonHandler jsonHandler = new MessageJsonHandler(Collections.emptyMap());
StreamMessageProducer messageProducer = new StreamMessageProducer(input, jsonHandler);
messageProducer.listen(message -> {});
messageProducer.close();
try (StreamMessageProducer messageProducer = new StreamMessageProducer(input, jsonHandler)) {
messageProducer.listen(message -> {});
}
}).get(TIMEOUT, TimeUnit.MILLISECONDS);
} catch (ExecutionException e) {
throw e.getCause();
Expand Down Expand Up @@ -149,12 +149,11 @@ protected void fireError(Throwable error) {
}

var jsonHandler = new MessageJsonHandler(Collections.emptyMap());
var producer = new TestProducer( new ByteArrayInputStream(inputStr.getBytes()), jsonHandler);
var received = new ArrayList<>();
producer.listen(received::add);
producer.close();

assertEquals("Both messages should be delivered", 2, received.size());
try (var producer = new TestProducer( new ByteArrayInputStream(inputStr.getBytes()), jsonHandler)) {
var received = new ArrayList<>();
producer.listen(received::add);
assertEquals("Both messages should be delivered", 2, received.size());
}
}).get(TIMEOUT, TimeUnit.MILLISECONDS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import jakarta.websocket.Session;

import org.eclipse.lsp4j.jsonrpc.Launcher;
import org.eclipse.lsp4j.jsonrpc.Launcher.Builder;

/**
* WebSocket endpoint implementation that connects to a JSON-RPC service.
Expand All @@ -37,8 +38,8 @@ public void onOpen(Session session, EndpointConfig config) {

/**
* Configure the JSON-RPC launcher. Implementations should set at least the
* {@link Launcher.Builder#setLocalService(Object) local service} and the
* {@link Launcher.Builder#setRemoteInterface(Class) remote interface}.
* {@link Builder#setLocalService(Object) local service} and the
* {@link Builder#setRemoteInterface(Class) remote interface}.
*/
protected abstract void configure(Launcher.Builder<T> builder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public interface NotebookDocumentService {
/**
* The open notification is sent from the client to the server when a notebook document
* is opened. It is only sent by a client if the server requested the synchronization
* mode {@code notebook} in its {@link ServerCapabilities#notebookDocumentSync} capability.
* mode {@code notebook} in its {@link ServerCapabilities#getNotebookDocumentSync()
* ServerCapabilities.notebookDocumentSync} capability.
* <p>
* Registration Options: {@link org.eclipse.lsp4j.NotebookDocumentSyncRegistrationOptions}
* <p>
Expand All @@ -36,7 +37,8 @@ public interface NotebookDocumentService {
/**
* The change notification is sent from the client to the server when a notebook document changes.
* It is only sent by a client if the server requested the synchronization mode {@code notebook}
* in its {@link ServerCapabilities#notebookDocumentSync} capability.
* in its {@link ServerCapabilities#getNotebookDocumentSync()
* ServerCapabilities.notebookDocumentSync} capability.
* <p>
* Registration Options: {@link org.eclipse.lsp4j.NotebookDocumentSyncRegistrationOptions}
* <p>
Expand All @@ -48,7 +50,8 @@ public interface NotebookDocumentService {
/**
* The save notification is sent from the client to the server when a notebook document is saved.
* It is only sent by a client if the server requested the synchronization mode {@code notebook}
* in its {@link ServerCapabilities#notebookDocumentSync} capability.
* in its {@link ServerCapabilities#getNotebookDocumentSync()
* ServerCapabilities.notebookDocumentSync} capability.
* <p>
* Registration Options: {@link org.eclipse.lsp4j.NotebookDocumentSyncRegistrationOptions}
* <p>
Expand All @@ -60,7 +63,8 @@ public interface NotebookDocumentService {
/**
* The close notification is sent from the client to the server when a notebook document is closed.
* It is only sent by a client if the server requested the synchronization mode {@code notebook}
* in its {@link ServerCapabilities#notebookDocumentSync} capability.
* in its {@link ServerCapabilities#getNotebookDocumentSync()
* ServerCapabilities.notebookDocumentSync} capability.
* <p>
* Registration Options: {@link org.eclipse.lsp4j.NotebookDocumentSyncRegistrationOptions}
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ default CompletableFuture<List<TypeHierarchyItem>> prepareTypeHierarchy(TypeHier
/**
* The request is sent from the client to the server to resolve the supertypes for
* a given type hierarchy item. Will return {@code null} if the server couldn't infer
* a valid type from {@link TypeHierarchySupertypesParams#item}. The request doesn't define
* a valid type from {@link TypeHierarchySupertypesParams#getItem()
* TypeHierarchySupertypesParams.item}. The request doesn't define
* its own client and server capabilities. It is only issued if a server registers for the
* {@code textDocument/prepareTypeHierarchy} request.
* <p>
Expand All @@ -544,7 +545,8 @@ default CompletableFuture<List<TypeHierarchyItem>> typeHierarchySupertypes(TypeH
/**
* The request is sent from the client to the server to resolve the subtypes for
* a given type hierarchy item. Will return {@code null} if the server couldn't infer
* a valid type from {@link TypeHierarchySubtypesParams#item}. The request doesn't define
* a valid type from {@link TypeHierarchySupertypesParams#getItem()
* TypeHierarchySupertypesParams.item}. The request doesn't define
* its own client and server capabilities. It is only issued if a server registers for the
* {@code textDocument/prepareTypeHierarchy} request.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

public class NonNullTest {

@SuppressWarnings("unused")
@Test
public void testCodeAction1() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
Expand Down Expand Up @@ -51,7 +50,7 @@ public class LauncherTest {

private static final long TIMEOUT = 2000;

@Test public void testNotification() throws IOException {
@Test public void testNotification() {
MessageParams p = new MessageParams();
p.setMessage("Hello World");
p.setType(MessageType.Info);
Expand Down Expand Up @@ -163,7 +162,7 @@ public String toString() {
logger.setLevel(Level.SEVERE);
}

@After public void teardown() throws InterruptedException, ExecutionException {
@After public void teardown() throws InterruptedException {
clientListening.cancel(true);
serverListening.cancel(true);
Thread.sleep(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.lsp4j.InitializeResult;
Expand All @@ -41,7 +40,7 @@ public class NullResponseTest implements LanguageServer {
private Object shutdownReturn;

@Test
public void testNullResponse() throws InterruptedException, ExecutionException {
public void testNullResponse() {
LogMessageAccumulator logMessages = new LogMessageAccumulator();
try {
logMessages.registerTo(GenericEndpoint.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ public CompletableFuture<DocumentLink> documentLinkResolve(DocumentLink params)
* creates a proxy, delegating to a remote endpoint, forwarding to another remote endpoint, that delegates to an actual implementation.
* @param intf
* @param impl
* @return
* @throws IOException
*/
public <T> T wrap(Class<T> intf, T impl) {
PipedInputStream in1 = new PipedInputStream();
Expand Down
Loading