Skip to content

Make non-static nested classes static (CodeQL java/non-static-nested-class)#249

Open
vharseko wants to merge 2 commits into
OpenIdentityPlatform:masterfrom
vharseko:features/codeql-static-nested-class
Open

Make non-static nested classes static (CodeQL java/non-static-nested-class)#249
vharseko wants to merge 2 commits into
OpenIdentityPlatform:masterfrom
vharseko:features/codeql-static-nested-class

Conversation

@vharseko

@vharseko vharseko commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

Resolves all 12 open CodeQL java/non-static-nested-class alerts by adding static to member nested classes that never reference their enclosing instance. This removes the implicit outer-this reference (cleaner, avoids an unnecessary enclosing-instance link).

The change is behavior-preserving and self-checked by compilation: adding static to 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)

Class File Module
NullQueryHandler AuditServiceImpl.java commons/audit/core
ParseJsonValue CsvAuditEventHandler.java commons/audit/handler-csv
Transformer Profiler.java commons/doc-maven-plugin
TestSessionHandler BindingTest.java commons/http-framework/binding-test-utils
Trunk BranchingStreamWrapper.java commons/http-framework/core
ServletInputStreamImpl BufferedRequestWrapper.java commons/httpdump
NamedThreadFactory ExecutorServiceFactory.java commons/util
PruneTransactionPlayer JournalManager.java persistit/core
AlignedCellRenderer, KeyStateRenderer, ValueStateRenderer ManagementTableModel.java persistit/ui
FieldComparator ValueInspectorTreeNode.java persistit/ui

Notes

  • No qualified outer.new Inner() instantiation exists for any of these classes, so the change is source-compatible.
  • The three ManagementTableModel renderers extend DefaultTableCellRenderer (transitively Serializable); static alters 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.

…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).
@vharseko vharseko requested a review from maximthomas July 8, 2026 16:25
@vharseko vharseko added codeql CodeQL static-analysis findings refactoring Code cleanup / refactoring, no behavior change labels Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codeql CodeQL static-analysis findings refactoring Code cleanup / refactoring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants