Skip to content

fix(build): Fix deprecation warnings in FeatureConfiguration #1894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

adutra
Copy link
Contributor

@adutra adutra commented Jun 13, 2025

No description provided.

@@ -83,6 +83,7 @@ public static void enforceFeatureEnabledOrThrow(
.defaultValue(false)
.buildFeatureConfiguration();

@SuppressWarnings("deprecation")
Copy link
Contributor

@eric-maynard eric-maynard Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does get rid of the warnings, but aren't the warnings the main feature of the @Deprecated annotation?

ref: #1672 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage of the old config key is deprecated - using that should trigger a user-facing deprecation warning. The deprecation is triggering at the wrong site then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the link I didn't know there was a previous conversation on this topic.

That said, I rather disagree: the annotation is valuable mainly for consumers of the API, and especially when it's well documented in terms of when it was deprecated, when it will be removed and how to replace it.

Here, we own both the source of the deprecation warnings (the catalogConfigUnsafe method) and the call sites where the deprecation warnings are triggered (in FeatureConfiguration class): IOW, keeping the warnings around is not useful for Polaris devs.

And there is no risk of "forgetting" to update FeatureConfiguration later on: as soon as we remove the deprecated method, the FeatureConfiguration class wouldn't compile anymore.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My take on this: we should rather remove deprecation from catalogConfigUnsafe() and file issues to remove support for those legacy properties. The method itself has a valid use case in Polaris code, which is specifically to support migration from old config names to new name, so the method itself is not conceptually "deprecated".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A io.smallrye.config.RelocateConfigSourceInterceptor implementation can be used to nag users to update the configs.

Copy link
Contributor

@eric-maynard eric-maynard Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already a log to remind users to remove the configs, so we are covered from that perspective. This was more intended to nag maintainers to remove the deprecated method at some point in time. Otherwise, why deprecate methods? Will we always add this suppression when a method is deprecated?

@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jun 13, 2025
@snazy
Copy link
Member

snazy commented Jun 23, 2025

Looks like the PR needs a rebase

@adutra adutra force-pushed the fix-build-warnings branch from 29ea56f to 2da5794 Compare June 23, 2025 11:01
@snazy
Copy link
Member

snazy commented Jun 23, 2025

+1

@adutra
Copy link
Contributor Author

adutra commented Jun 25, 2025

@eric-maynard is that OK to merge this?

@snazy
Copy link
Member

snazy commented Jun 26, 2025

I think this is ready to be merged.

@adutra adutra merged commit e7a009f into apache:main Jun 26, 2025
11 checks passed
@adutra adutra deleted the fix-build-warnings branch June 26, 2025 10:08
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Jun 26, 2025
poojanilangekar pushed a commit to poojanilangekar/polaris that referenced this pull request Jun 26, 2025
@eric-maynard
Copy link
Contributor

@adutra my question wasn't really answered -- is the strategy to always suppress all deprecation warnings?

@snazy
Copy link
Member

snazy commented Jun 27, 2025

@eric-maynard the strategy is to address deprecation coming from dependencies. If something needs to be done in the Polaris code base in the future, it's better to open an issue so it doesn't get lost.

@eric-maynard
Copy link
Contributor

That still doesn’t answer my question. Will we suppress all deprecation warnings?

@dimas-b
Copy link
Contributor

dimas-b commented Jun 27, 2025

@eric-maynard @snazy @adutra : I'd like to reopen my suggestion of removing deprecation from PolarisConfiguration.catalogConfigUnsafe()

This method is not really intended to be called by "users" of Polaris. For internal calls (or calls from downstream projects) the purpose is to provide an upgrade path for users to gradually adjust to the new config names. So, in my mind the catalogConfigUnsafe() method is not deprecated. What is deprecated in the old property name (which is its argument). The use of these deprecated properties already leads to a WARN log message (targeted at end users).

All in all, I think it is preferable to remove deprecation from catalogConfigUnsafe() and file GH issues for unsupporting those properties in 2.0. WDYT?

@eric-maynard
Copy link
Contributor

eric-maynard commented Jun 27, 2025

That makes more sense to me. If we don't want to mark it as deprecated, that is a reasonable argument, but I don't really grok why we would mark it as deprecated but then disable the warning.

My argument for leaving it as deprecated is mostly to make it clear that there should be no new use of this method. And, when the old configs are yanked, the method can accordingly be yanked as well. In that sense it is marked for deprecation/removal.

dimas-b added a commit to dimas-b/polaris that referenced this pull request Jun 27, 2025
As discussed in apache#1894, `catalogConfigUnsafe()` has a use case in the
main codebase - that is to support gradual migration to new property
names.

Using legacy names in runtime already leads to a user-face WARN log message.

Support for those legacy property names is to be dropped in 2.0.
@dimas-b
Copy link
Contributor

dimas-b commented Jun 27, 2025

Ok, I opened #1970 for my proposal. If accepted/merged, I'll follow up with an issue for dropping old config names in 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants