Skip to content

Remove the stale migration deprecations of ObjectClass and AttributeDescription - #832

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:codeql/deprecated-internal-2
Aug 4, 2026
Merged

Remove the stale migration deprecations of ObjectClass and AttributeDescription#832
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:codeql/deprecated-internal-2

Conversation

@vharseko

@vharseko vharseko commented Aug 3, 2026

Copy link
Copy Markdown
Member

Closes 54 of the 68 java/deprecated-call alerts left after #823 and #826 — the ones pointing at the SDK's own API — without touching a single call site.

The problem with these deprecations

ObjectClass.isPlaceHolder(), AttributeDescription.getNameOrOID() and the four AttributeDescription.create() overloads which take the user provided attribute name are all marked the same way:

     * @deprecated This method may be removed at any time
     * @since OPENDJ-2803 Migrate Attribute
     */
    @Deprecated

These are migration markers left by the SDK rework. They name no replacement, and there is none:

  • a non-strict schema returns ObjectClass.newPlaceHolder(name) for an object class it does not know, and isPlaceHolder() is the only way of recognising it — short of asking the schema again by name with hasObjectClass(), which every one of the 27 call sites would have to do;
  • getNameOrOID() returns the attribute name as the user provided it, preserving its case and any alias; getAttributeType().getNameOrOID() returns the primary name from the schema, and toString() appends the options, so neither is a replacement — swapping them in would change the attribute names the server echoes back in responses and LDIF;
  • the create() overloads taking an attribute name keep that name in the resulting description, which the overloads without it drop.

The 54 calls are spread over the entry, schema, replication, plugin and control panel code. Keeping the markers therefore produces permanent code scanning alerts while telling nobody what to use instead.

What this change does

Drops the @Deprecated annotation and the @deprecated/@since tags from the six methods, and replaces them with a sentence explaining what each method is for and how it differs from the neighbouring, non-deprecated API — which is the information the marker was missing. No call site is modified, and no behaviour changes.

Alerts deliberately left open (14)

  • DirectoryServer.getConfigEntry (9) — this deprecation is meaningful ("use getEntry(DN) when possible") and worth keeping for new code, but all nine call sites are backend and config-manager initialization, or the collection of user defined attributes from a configuration entry, where the virtual attribute processing of getEntry() must not happen. The advice does not apply to them.
  • CoreConfigManager.isAllowAttributeNameExceptions (2) — its replacement, the ALLOW_MALFORMED_NAMES_AND_OPTIONS schema option, needs a schema from the server context. Both calls are in StaticUtils.isValidSchemaElement(), which is only called by the control panel schema editors while the user types a name, and a missing schema there would break the editor.
  • ChangelogBackend.getInstance (2) — "instead inject the required object where needed": FileChangelogDB and ChangeNumberIndexer are created by the replication server independently of the backend, so this is a lifecycle change rather than a call replacement.
  • Subject.getSubject (1)Subject.current() requires Java 18; this project targets Java 11.

Testing

Annotation and javadoc only, no code path changes. opendj-core full test suite — 8173 tests, all passing; opendj-core packages including javadoc generation, and opendj-server-legacy compiles cleanly against it.

…escription

ObjectClass.isPlaceHolder(), AttributeDescription.getNameOrOID() and the four
AttributeDescription.create() overloads taking the user provided attribute name
are marked "@deprecated This method may be removed at any time" with an
"@SInCE OPENDJ-2803/2987 Migrate ..." tag. These are migration markers of the
SDK rework which never named a replacement, and there is none:

* a non strict schema returns ObjectClass.newPlaceHolder(name) for an unknown
  object class, and isPlaceHolder() is the only way of recognising it without
  asking the schema again by name;
* getNameOrOID() returns the name as the user provided it, which the primary
  name of the attribute type does not preserve;
* the create() overloads taking an attribute name keep that name, which the
  overloads without it drop.

The 54 calls to these methods are spread over the entry, schema, replication and
control panel code, so keeping the markers only produces permanent alerts
without telling anybody what to use instead. Drop the markers and document what
each method is for, and how it differs from the neighbouring API.

The remaining deprecated calls of the server are left alone: getConfigEntry()
documents a replacement its callers cannot use, isAllowAttributeNameExceptions()
would need a schema which the control panel may not have, ChangelogBackend
.getInstance() asks for a lifecycle change, and Subject.getSubject() has no
replacement before Java 18.
@vharseko
vharseko requested a review from maximthomas August 3, 2026 13:45
@vharseko vharseko added security Security fixes / CodeQL code-scanning alerts java Pull requests that update java code labels Aug 3, 2026
@vharseko
vharseko merged commit 6ffbe15 into OpenIdentityPlatform:master Aug 4, 2026
17 checks passed
@vharseko
vharseko deleted the codeql/deprecated-internal-2 branch August 4, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update java code security Security fixes / CodeQL code-scanning alerts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants