Skip to content

Comments

Some Small Code Improvements#297

Merged
hypfvieh merged 1 commit intohypfvieh:masterfrom
BrandonSchmitt:small-code-improvements
Feb 19, 2026
Merged

Some Small Code Improvements#297
hypfvieh merged 1 commit intohypfvieh:masterfrom
BrandonSchmitt:small-code-improvements

Conversation

@BrandonSchmitt
Copy link
Contributor

I focused on low-hanging fruits that my IDE proposed while making sure, not to change behavior or potentially breaking any API usage. The changes include but are not limited to:

  • replacing lambdas with method references
  • Simplifying conditions
  • Using methods from the JDK over custom ones.
  • Removing No-Ops

I focused on low-hanging fruits that my IDE proposed while making sure, not to change behavior or potentially breaking any API usage. The changes include but are not limited to:
- replacing lambdas with method references
- Simplifying conditions
- Using methods from the JDK over custom ones.
- Removing No-Ops
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Explanation: The variable _sock is of type SocketChannel which implements NetworkChannel. So, the check _sock instanceof NetworkChannel can only be false if it is null. The else branch can then only be entered if it is indeed null. I wondered... Doesn't aut.getUid(null) always return -1? There might be more code that could be removed.

Copy link
Owner

Choose a reason for hiding this comment

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

Looks like this is a bigger bug you discovered.

When you check where getUid() is implemented, the code should return something more useful than -1 when a non-null value is given. I'll take a look at that.

dbi = connection.dynamicProxy(source, path, type);
assertNotNull(dbi);
assertTrue(TestInterfaceType.class.isInstance(dbi));
assertTrue(dbi instanceof TestInterfaceType);
Copy link
Owner

Choose a reason for hiding this comment

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

This one can also be replace with assertInstanceOf. I'll fix that.

@hypfvieh hypfvieh merged commit 96943a5 into hypfvieh:master Feb 19, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants