Skip to content

Add Accessors for Two Member Fields Used in PeerNodeStatus#1075

Merged
ArneBab merged 1 commit into
hyphanet:nextfrom
Bombe:feature/peer-node-status-accessors
Jun 22, 2025
Merged

Add Accessors for Two Member Fields Used in PeerNodeStatus#1075
ArneBab merged 1 commit into
hyphanet:nextfrom
Bombe:feature/peer-node-status-accessors

Conversation

@Bombe

@Bombe Bombe commented May 19, 2025

Copy link
Copy Markdown
Contributor

Once again, I am blocked in writing Tests for Fred by the presence of fields that I cannot mock using Mockito. Have some accessors instead!

@Bombe Bombe changed the title Add accessors for two attributes used in PeerNodeStatus Add Accessors for Two Member Fields Used in PeerNodeStatus May 19, 2025

@bertm bertm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the accessors (and the fields that they access) be package-private to reduce the size of the public API?

@Bombe

Bombe commented May 20, 2025

Copy link
Copy Markdown
Contributor Author

Could the accessors (and the fields that they access) be package-private to reduce the size of the public API?

Hmm, they probably could… depends on whether these methods need to be mocked by something outside of Fred. I don’t think there’s too much stuff using actual PeerNode objects outside of Fred, though… then again, plugins might? Hmm.

@bertm

bertm commented May 20, 2025

Copy link
Copy Markdown
Contributor

plugins might?

That's always possible, at least in theory. But most plugins would not have a business tracking peer nodes. Even then, these particular fields are pretty niche. I cannot imagine legitimate reasons for plugins to meddle with the peer backoff statistics.

@Bombe

Bombe commented May 20, 2025

Copy link
Copy Markdown
Contributor Author

plugins might?

That's always possible, at least in theory. But most plugins would not have a business tracking peer nodes. Even then, these particular fields are pretty niche. I cannot imagine legitimate reasons for plugins to meddle with the peer backoff statistics.

I mean, it doesn’t even matter, because the original fields are still public. 😄

@Bombe Bombe force-pushed the feature/peer-node-status-accessors branch from 1c112d2 to 8e7b81c Compare May 20, 2025 19:02
@Bombe

Bombe commented May 20, 2025

Copy link
Copy Markdown
Contributor Author

Could the accessors (and the fields that they access) be package-private to reduce the size of the public API?

Oof, I really need to learn to read better. 😄

Yeah, I’ll make the fields private, they weren’t used outside of PeerNode and PeerNodeStatus anyway.

Also, make the originally exposed fields private, as they are only used in
their own class and in aforementioned PeerNodeStatus, anyway.
@Bombe Bombe force-pushed the feature/peer-node-status-accessors branch from 8e7b81c to 58545eb Compare May 21, 2025 05:17
@ArneBab ArneBab merged commit 0d192db into hyphanet:next Jun 22, 2025
1 check passed
@Bombe Bombe deleted the feature/peer-node-status-accessors branch June 29, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants