Make non-static nested classes static (CodeQL java/non-static-nested-class)#249
Open
vharseko wants to merge 2 commits into
Open
Make non-static nested classes static (CodeQL java/non-static-nested-class)#249vharseko wants to merge 2 commits into
vharseko wants to merge 2 commits into
Conversation
…class) Add static to 12 member nested classes that never reference their enclosing instance, across 10 files, dropping the implicit outer-this reference. Behavior-preserving and self-checked by compilation: adding static to a nested class that actually used the enclosing instance would fail to compile. Verified by compiling every affected Maven module (commons audit, http-framework, util, httpdump, doc-maven-plugin, and persistit core/ui).
maximthomas
approved these changes
Jul 9, 2026
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
Resolves all 12 open CodeQL
java/non-static-nested-classalerts by addingstaticto member nested classes that never reference their enclosing instance. This removes the implicit outer-thisreference (cleaner, avoids an unnecessary enclosing-instance link).The change is behavior-preserving and self-checked by compilation: adding
staticto a nested class that actually used the enclosing instance is a compile error, so compiling every affected module validates each edit.Changes (12 classes, 10 files)
NullQueryHandlerParseJsonValueTransformerTestSessionHandlerTrunkServletInputStreamImplNamedThreadFactoryPruneTransactionPlayerAlignedCellRenderer,KeyStateRenderer,ValueStateRendererFieldComparatorNotes
outer.new Inner()instantiation exists for any of these classes, so the change is source-compatible.ManagementTableModelrenderers extendDefaultTableCellRenderer(transitivelySerializable);staticalters the serialized form, but Swing cell renderers are transient UI objects and are not persisted, so this is not a compatibility concern.Verification
Compiled
commons/audit/core,commons/audit/handler-csv,commons/doc-maven-plugin,commons/http-framework/core,commons/http-framework/binding-test-utils,commons/util/util,commons/httpdump,persistit/core,persistit/ui— all clean.