Skip to content

Add missing @Override annotations and exclude the unused-parameter query - #215

Open
vharseko wants to merge 2 commits into
OpenIdentityPlatform:masterfrom
vharseko:fix-codeql-notes-override
Open

vharseko wants to merge 2 commits into
OpenIdentityPlatform:masterfrom
vharseko:fix-codeql-notes-override

Conversation

@vharseko

Copy link
Copy Markdown
Member

Summary

Last note-level CodeQL batch — the two bulk rules, handled differently:

Commit 1 — java/missing-override-annotation (329 alerts, 120 files)

@Override added on every flagged method, generated from the alert coordinates (one existing commented-out // @Override in ConfigMeta is simply restored). Verification is the compiler: @Override on a method that does not override or implement anything is a compile error, and the reactor build of all 27 touched modules passes cleanly. No behavioural change is possible from this annotation.

The one file outside the reactor — samples/audit-jms-sample/consumer/src/main/java/SimpleConsumer.java — gets @Override on the anonymous MessageListener.onMessage; its standalone POM could not be resolved offline, but the implementation is unambiguous.

32 of the files are also touched by the other open CodeQL PRs; the overlaps are single-line insertions.

Commit 2 — java/unused-parameter (114 alerts): exclude the query

Breakdown of the 114: 49 package-private, 27 public, 32 protected, 6 private. Nearly all are signatures the code does not control:

  • interface contracts — DataSourceConfigVisitor.visit(config, parameters), PluggablePublisher.setResult/end, ResultSetMapper, ServiceTrackerListener, EnhancedConfig, OperationHelper, ProvisionerService, ResourceFunctions callbacks;
  • OSGi Declarative Services lifecycle — activate/modified/deactivate(ComponentContext), unbind*(service) (the unbind signature is what DS requires);
  • Disruptor onEvent(entry, sequence, endOfBatch).

Rather than dismissing 114 alerts by hand, codeql.yml now carries a query-filters exclusion for java/unused-parameter with a comment explaining why; the alerts close as "no longer detected" on the next analysis. The 6 genuinely unused private parameters (Correlation.execScript, ConfiguredQueries.resolveInlineQuery, DocumentUtil.toMap, TaskScannerService.onExecute, ConfigMacroUtil.handleTime, SyncFailureHandlerFactoryImpl.unbindScriptRegistry) can be tidied separately if wanted.

Test plan

  • mvn compile across the 27 touched reactor modules — 0 errors (each @Override compiler-verified)
  • codeql.yml parses; the inline config now has query-filters: [{exclude: {id: java/unused-parameter}}]
  • CodeQL on this PR closes the 329 missing-override-annotation alerts and stops reporting unused-parameter

Every annotated method is verified by the compiler to override or implement
a supertype method. One commented-out @OverRide in ConfigMeta is restored.

Resolves the 329 java/missing-override-annotation CodeQL alerts.
The 114 findings are parameters dictated by interface, OSGi Declarative
Services and Disruptor contracts; the query carries no signal here.
@vharseko vharseko added java Pull requests that update Java code refactor Code refactoring without behavior change ci CI/CD, build and release workflows labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD, build and release workflows java Pull requests that update Java code refactor Code refactoring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant