Fix inspection issues

This commit is contained in:
AsamK 2023-12-15 17:32:30 +01:00
parent fc6a4b78eb
commit caa4fa0180
12 changed files with 12 additions and 15 deletions

View file

@ -220,7 +220,7 @@ public class SendHelper {
(messageSender, address, unidentifiedAccess) -> messageSender.sendTyping(List.of(address), (messageSender, address, unidentifiedAccess) -> messageSender.sendTyping(List.of(address),
List.of(unidentifiedAccess), List.of(unidentifiedAccess),
message, message,
null).get(0)); null).getFirst());
handleSendMessageResult(result); handleSendMessageResult(result);
return result; return result;
} }

View file

@ -302,7 +302,7 @@ public class StorageHelper {
logger.warn("Failed to read storage records, ignoring."); logger.warn("Failed to read storage records, ignoring.");
return null; return null;
} }
return !records.isEmpty() ? records.get(0) : null; return !records.isEmpty() ? records.getFirst() : null;
} }
private List<SignalStorageRecord> getSignalStorageRecords(final Collection<StorageId> storageIds) throws IOException { private List<SignalStorageRecord> getSignalStorageRecords(final Collection<StorageId> storageIds) throws IOException {

View file

@ -1291,7 +1291,7 @@ public class ManagerImpl implements Manager {
r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber())); r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber()));
case IdentityVerificationCode.ScannableSafetyNumber safetyNumber -> trustIdentity(recipient, case IdentityVerificationCode.ScannableSafetyNumber safetyNumber -> trustIdentity(recipient,
r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber())); r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber()));
case null, default -> throw new AssertionError("Invalid verification code type"); case null -> throw new AssertionError("Invalid verification code type");
}; };
} }

View file

@ -94,7 +94,7 @@ public class DbusCommandHandler {
"Multiple users found, you need to specify an account (phone number) with -a"); "Multiple users found, you need to specify an account (phone number) with -a");
} }
return accounts.get(0).getPath(); return accounts.getFirst().getPath();
} catch (UnknownMethod e) { } catch (UnknownMethod e) {
// dbus daemon not running in multi-account mode // dbus daemon not running in multi-account mode
return null; return null;

View file

@ -52,7 +52,6 @@ public abstract class DbusProperties implements Properties {
} }
@Override @Override
@SuppressWarnings("unchecked")
public Map<String, Variant<?>> GetAll(final String interface_name) { public Map<String, Variant<?>> GetAll(final String interface_name) {
final var handler = getHandlerOptional(interface_name); final var handler = getHandlerOptional(interface_name);
if (handler.isEmpty()) { if (handler.isEmpty()) {

View file

@ -668,7 +668,7 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
@Override @Override
public boolean isRegistered(String number) { public boolean isRegistered(String number) {
var result = isRegistered(List.of(number)); var result = isRegistered(List.of(number));
return result.get(0); return result.getFirst();
} }
@Override @Override

View file

@ -2,8 +2,6 @@ package org.asamk.signal.jsonrpc;
/** /**
* Represents a JSON-RPC (batch) request or (batch) response. * Represents a JSON-RPC (batch) request or (batch) response.
* https://www.jsonrpc.org/specification * <a href="https://www.jsonrpc.org/specification">https://www.jsonrpc.org/specification</a>
*/ */
public sealed abstract class JsonRpcMessage permits JsonRpcBatchMessage, JsonRpcRequest, JsonRpcResponse { public sealed abstract class JsonRpcMessage permits JsonRpcBatchMessage, JsonRpcRequest, JsonRpcResponse {}
}

View file

@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.node.ValueNode;
/** /**
* Represents a JSON-RPC request. * Represents a JSON-RPC request.
* https://www.jsonrpc.org/specification#request_object * <a href="https://www.jsonrpc.org/specification#request_object">https://www.jsonrpc.org/specification#request_object</a>
*/ */
public final class JsonRpcRequest extends JsonRpcMessage { public final class JsonRpcRequest extends JsonRpcMessage {

View file

@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.node.ValueNode;
/** /**
* Represents a JSON-RPC response. * Represents a JSON-RPC response.
* https://www.jsonrpc.org/specification#response_object * <a href="https://www.jsonrpc.org/specification#response_object">https://www.jsonrpc.org/specification#response_object</a>
*/ */
public final class JsonRpcResponse extends JsonRpcMessage { public final class JsonRpcResponse extends JsonRpcMessage {

View file

@ -94,7 +94,7 @@ public class SignalJsonRpcCommandHandler {
if (manager == null) { if (manager == null) {
final var managers = c.getManagers(); final var managers = c.getManagers();
if (managers.size() == 1) { if (managers.size() == 1) {
manager = managers.get(0); manager = managers.getFirst();
} }
} }
if (manager != null) { if (manager != null) {

View file

@ -126,7 +126,7 @@ public class SignalJsonRpcDispatcherHandler {
private void unsubscribeReceive(final Manager m) { private void unsubscribeReceive(final Manager m) {
final var subscriptionId = receiveHandlers.entrySet() final var subscriptionId = receiveHandlers.entrySet()
.stream() .stream()
.filter(e -> e.getValue().size() == 1 && e.getValue().get(0).first().equals(m)) .filter(e -> e.getValue().size() == 1 && e.getValue().getFirst().first().equals(m))
.map(Map.Entry::getKey) .map(Map.Entry::getKey)
.findFirst(); .findFirst();
subscriptionId.ifPresent(this::unsubscribeReceive); subscriptionId.ifPresent(this::unsubscribeReceive);

View file

@ -42,7 +42,7 @@ public class Util {
if (strings.isEmpty()) { if (strings.isEmpty()) {
return ""; return "";
} }
return strings.get(0) + strings.stream() return strings.getFirst() + strings.stream()
.skip(1) .skip(1)
.filter(s -> !s.isEmpty()) .filter(s -> !s.isEmpty())
.map(s -> Character.toUpperCase(s.charAt(0)) + s.substring(1).toLowerCase(Locale.ROOT)) .map(s -> Character.toUpperCase(s.charAt(0)) + s.substring(1).toLowerCase(Locale.ROOT))