Skip to content

Code analysis fixes: Refactor code for consistency and readability, i… #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: addtional-docs
Choose a base branch
from

Conversation

peter-lawrey
Copy link
Member

@peter-lawrey peter-lawrey commented May 23, 2025

This patch cleans up Java Thread Affinity source and test code after a static-analysis sweep.
It does not change runtime behaviour; all modifications are cosmetic or defensive.

Area Examples What changed
Logging LinuxJNAAffinity, FileLockBasedLockChecker, many others • Replaced string-concat ("msg "+val) with SLF4J parameterised messages ("msg {}", val).
Assertions & validations AffinityLock, LockInventory, tests • Added explicit IllegalArgumentException checks for invalid cpuId.
• Converted assertTrue(!x) to assertFalse(x) for clarity.
• Removed dead code comments.
Lambda / SAM conversions AffinityThreadFactory, several tests • Replaced anonymous classes with lambdas & method refs.
Type & null safety BootClassPath, VersionHelper, VanillaCpuLayout • Added @NotNull, StandardCharsets.UTF_8, and .isEmpty() idioms.
Formatting & whitespace Many files • Consistent spacing, braces, and indentation.
Suppression & warnings MicroJitterSampler, JNIClock, tests • Added targeted @SuppressWarnings and IDE hints (//noinspection …).
Minor refactors OSGiBundleTest, OSGiTestBase • Simplified temp variables; removed redundant initialisations.

Motivation

Improving code readability and log consistency helps:

  • downstream users reading the source,
  • future maintainers running static-analysis tools,
  • IDE inspections (fewer warnings).

…ncluding assertion simplifications and formatting improvements
@peter-lawrey peter-lawrey requested a review from tgd May 23, 2025 11:01
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