Fix CodeQL note-severity alerts: confusing overloads with subtype parameters - #840
Merged
vharseko merged 1 commit intoAug 4, 2026
Conversation
…ameters Most of the java/confusing-method-signature alerts are on public overload sets of the SDK, on the implementation of the SLF4J Logger interface and on the deliberate handle(XxxCallback) dispatch family of SASLBindClientImpl, where the shape of the API cannot change. The ones which remain are private methods whose parameter types are related by inheritance, so that the overload is chosen from the static type of the variable, and one of them was a latent StackOverflowError: * AbstractPBKDF2PasswordStorageScheme had encodeWithRandomSalt(ByteString, ..) next to encodeWithRandomSalt(ByteSequence, ..). Since ByteString implements ByteSequence, the body of the first one called itself rather than the second, so any call would have recursed until the stack was exhausted. It was dead code: both callers pass a ByteSequence and bind to the other overload. It is removed. The file was also missing its license header. * ReplicationCliMain overloaded getConnection() and initializeWithArgParser() on MonoServerReplicationUserData and on three of its subtypes, so a variable declared with the base type silently selected the general method. The general ones are renamed to getConnectionToSourceServer() and initializeWithArgParserForSourceServer(), which is what they do: they prompt through sourceServerCI and read the source server arguments. The compiler identified every call site: initialize-all, pre and post external initialization, and status.
maximthomas
approved these changes
Aug 4, 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.
Addresses the
java/confusing-method-signaturealerts. Most of them cannot be acted on, but the ones which can were worth looking at: one was a latentStackOverflowError.A recursive overload which could never have worked
AbstractPBKDF2PasswordStorageSchemehad two overloads whose parameter types are related by inheritance:ByteStringimplementsByteSequence, so inside the first overload the most specific applicable method is itself: any call would have recursed until the stack was exhausted. It survived because it is dead code —encodePassword()andencodeAuthPassword()both pass aByteSequenceand bind to the second overload. The dead overload is removed.While there, the file received the license header it was missing. Its original attribution is left to the maintainers: the file was contributed in 2022 without a header, and this change does not invent one.
Overloads selected by the static type in the replication CLI
ReplicationCliMainoverloaded two private methods onMonoServerReplicationUserDataand on three of its subtypes (DisableReplicationUserData,StatusReplicationUserData,PurgeHistoricalUserData), so which method runs depends on the declared type of the variable rather than on the object. The two general overloads are renamed after what they actually do — they prompt throughsourceServerCIand read the source server arguments:getConnection(MonoServerReplicationUserData)→getConnectionToSourceServer(...)initializeWithArgParser(MonoServerReplicationUserData)→initializeWithArgParserForSourceServer(...)The compiler identified every call site of both: initialize-all, pre and post external initialization, and status.
Alerts deliberately left open (33)
Loggerinterface inOpenDJLoggerAdapter(trace/debug/info/warn/error(String, Object)next to(String, Throwable)): the shape is imposed by the interface.Connection.add(Entry|AddRequest),ChangeRecordWriter.writeChangeRecord(...)(four),Responses.newSearchResultEntry,LDIF.toLDIF,ByteStringBuilder.appendBytes,Converters.to/from(three),DirectoryServerPlugin.isConfigurationAcceptable,MonitorData.add,OperationContext.getCSN,SNMPMonitor.counter32Value/gauge32Value,AbstractIndexTableModel.compareNames,TemplateValue.appendand the two menu callbacks ofManageTasks. Renaming any of them is an API break.SASLBindClientImpl.handle(ChoiceCallback)andhandle(TextInputCallback): two members of a deliberate family of eighthandle(XxxCallback)methods whichhandle(Callback[])dispatches to; renaming two of the eight would make the family inconsistent.ConsistentHashDistributionLoadBalancer.synchronize(SearchResultHandler|IntermediateResponseHandler): the parameter types are unrelated, so no call can select the wrong one.Testing
opendj-server-legacy(-Pprecommit):PKCS5S2PasswordStorageSchemeTestCase(53),PBKDF2PasswordStorageSchemeTestCase(39),PBKDF2HmacSHA256PasswordStorageSchemeTestCase(39),PBKDF2HmacSHA512PasswordStorageSchemeTestCase(39) — 170 tests, all passing. The password storage schemes are the only place where code was removed; the replication CLI changes are private renames, verified by the compiler.