Remove sun.misc.Unsafe from tests and switch to constructor injection - #20
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GuiAppendernow depends on a newOutputSinkinterface instead ofMainWindow.MainWindowimplements it with its existingappendOutputmethod.GuiAppenderTestspasses aStringBuilder::appendlambda as the sink. No moresun.misc.Unsafe, no reflection, and the three "internal proprietary API" compiler warnings that showed up as annotations on every master run are gone.@Autowiredfield injection in the app package (MainWindow,GuiAppender,AppCommandLineRunner,ExamplesCommandLineRunner) replaced with Lombok@RequiredArgsConstructorandfinalfields.MainWindowreformatted 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 sourcesStill 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