Skip to content

Several improvements to GenericFilter's programmatic API #5083

Description

@fractal3000

Status

This issue originally listed four improvements to GenericFilter's programmatic API.
#5351 (PR #5363) delivered two of them and addressed a third differently. This issue now
tracks the remaining work.

# Improvement Status
1 MutableConfiguration interface — fix Configuration LSP violation ❌ Remaining
2 Atomic "register + activate" ⚠️ Resolved differently (see below)
3 Stable public refreshCurrentConfiguration() ✅ Done in #5351
4 protectedFromUserDeletion flag ✅ Done in #5351 (with a deviation, see note)

Remaining scope: split Configuration into a read-only interface + MutableConfiguration

Problem (unchanged)

Configuration declares mutating methods — setName, setRootLogicalFilterComponent,
setModified, setFilterComponentModified, setFilterComponentDefaultValue,
resetFilterComponentDefaultValue, resetAllDefaultValues — that DesignTimeConfiguration
cannot fulfil: it throws UnsupportedOperationException at runtime. There is no compile-time
signal that these methods are unsafe to call on a design-time configuration (LSP violation).

Expected behaviour

  • Configuration becomes read-only (identity, getters, getQueryCondition, read-only flags).
  • A new MutableConfiguration extends Configuration exposes the mutating methods.
  • RunTimeConfiguration implements MutableConfiguration;
    DesignTimeConfiguration implements Configuration — no more UnsupportedOperationException
    overrides.
  • APIs that mutate a configuration accept/return MutableConfiguration, so passing a
    design-time configuration into a mutating context becomes a compile error, not a
    runtime exception.

Compatibility note

Configuration is public API. Moving the mutators to MutableConfiguration is a breaking
change for any caller that mutates a configuration through the Configuration type. The
migration must be completed within the same change (callers updated; no mutators left
deprecated-but-still-declared on Configuration).


Notes on what was already delivered

Point 4 — protectedFromUserDeletion (done, with deviations):
The flag currently lives on the concrete RunTimeConfiguration
(isProtectedFromUserDeletion() / setProtectedFromUserDeletion()) — once
MutableConfiguration exists it should move there. By design it only hides the Remove
action
in the filter toolbar (GenericFilterRemoveAction#isApplicable); programmatic
removeConfiguration() still removes the configuration (it is used internally, e.g. by the
rename flow). This intentionally deviates from the original wording ("prevents
removeConfiguration()").

Point 2 — atomic register + activate (resolved differently):
Instead of a dedicated addAndSetCurrentConfiguration() method, the wrong-order / silent
no-op problem is mitigated by setCurrentConfiguration() now logging a warning when the
configuration is not registered. The atomic method was prototyped during #5351 and
intentionally dropped to avoid growing the API surface. No further action planned unless a
concrete need arises.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions