Skip to content

Remove sun.misc.Unsafe from tests and switch to constructor injection - #20

Merged
lpenap merged 1 commit into
masterfrom
lpenap/unsafe-cleanup
Sep 16, 2026
Merged

lpenap merged 1 commit into
masterfrom
lpenap/unsafe-cleanup

Conversation

@lpenap

@lpenap lpenap commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • GuiAppender now depends on a new OutputSink interface instead of MainWindow. MainWindow implements it with its existing appendOutput method.
  • GuiAppenderTests passes a StringBuilder::append lambda as the sink. No more sun.misc.Unsafe, no reflection, and the three "internal proprietary API" compiler warnings that showed up as annotations on every master run are gone.
  • All @Autowired field injection in the app package (MainWindow, GuiAppender, AppCommandLineRunner, ExamplesCommandLineRunner) replaced with Lombok @RequiredArgsConstructor and final fields.
  • MainWindow reformatted to consistent four-space indentation and fully-qualified Swing references replaced with imports. The diff is noisy for that reason; behavior is unchanged.

Verification

  • ./mvnw clean verify: 24 tests pass, JaCoCo coverage check met, no compiler warnings from project sources
  • Launched the built jar locally: Spring context starts, all beans wire through constructors, greeting logged

Still open

The remaining build warning (sun.misc.Unsafe::objectFieldOffset has been called by lombok.permit.Permit) comes from Lombok's annotation processor and persists with Lombok 1.18.48. Tracked upstream; not addressed here.

🤖 Generated with Claude Code

GuiAppenderTests allocated a MainWindow through sun.misc.Unsafe to skip
the JFrame constructor on headless CI and then set private fields by
reflection, producing "internal proprietary API" compiler warnings on
every build. GuiAppender now depends on a small OutputSink interface
that MainWindow implements, so the test passes a plain lambda instead.

All Spring beans in the app package now use Lombok's
@requiredargsconstructor with final fields instead of @Autowired field
injection. MainWindow is reformatted to consistent four-space
indentation while being rewritten.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@lpenap
lpenap merged commit b3e39a8 into master Sep 16, 2026
3 checks passed
@lpenap
lpenap deleted the lpenap/unsafe-cleanup branch September 16, 2026 16:15
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.

1 participant