Skip to content

Client.sendAndReceive is never called from anywhere in the tree #17

Description

@dmccoystephenson

Problem

Client.sendAndReceive is public and is called from nowhere in the repository. It is defined at src/SimpleServer/client/Client.java:27-30:

public String sendAndReceive(String s) {
    sendStringToServer(s);
    return getStringFromServer();
}

The one place in the tree that performs a send followed by a receive is ClientApp.sendSquareRequest, which calls the two halves separately instead, at src/SimpleServer/client/ClientApp.java:37 and :41:

client.sendStringToServer(message.toString());
...
receivedMessage.fromString(client.getStringFromServer());

Evidence

A tree-wide search for the identifier returns exactly one line, which is the declaration itself:

src/SimpleServer/client/Client.java:27:    public String sendAndReceive(String s) {

This is a source-verifiable absence and was established without a compiler. No claim about runtime behaviour is being made here.

Two ways this could be resolved

  1. ClientApp.sendSquareRequest is changed to call sendAndReceive, which is the method the pair was evidently written for. The call site is shortened and the method gains the caller it was designed to have.
  2. The method is deleted as dead code.

Option 1 is favoured in this report, because the method reads as intended API rather than as an accident, and because the convenience it offers is exactly what the only call site open-codes. Option 2 removes a member from a public class's surface, which is a decision that belongs to the repository owner rather than to an autonomous cycle.

Note for whoever implements this

Either option alters the client's send-and-receive path, and that path is observable only over a real socket. A JDK and a socket run are needed to demonstrate that a request still round-trips after the change, and this repository has no CI that would catch a regression otherwise.


This issue was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

drafted by Claude on behalf of Daniel Stephenson

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions