Skip to content

Remove duplicate -Xlint:options flags. #14788

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 16, 2025

Conversation

dweiss
Copy link
Contributor

@dweiss dweiss commented Jun 16, 2025

Fixes #14782 by not emitting duplicate lint flags to javac.

Copy link

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR.

Comment on lines +35 to +41
// TODO: this depends on the order of argument configuration...
int releaseIndex = options.compilerArgs.indexOf("--release")
options.compilerArgs.removeAt(releaseIndex)
options.compilerArgs.removeAt(releaseIndex)

// Remove conflicting options for the linter. #14782
options.compilerArgs.removeAll("-Xlint:options")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@breskeby is there any nicer way to do this kind of compilerArgs manipulation that doesn't
depend on the ordering of those configuration callbacks? I can think of a custom argument provider but this would be even more confusing than what it is now, I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a better idea than you. I can think of a smarter ArgumentProvider but no easy fix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you!

@dweiss dweiss requested a review from uschindler June 16, 2025 07:27
Copy link
Contributor

@uschindler uschindler left a comment

Choose a reason for hiding this comment

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

If this works it is ok as a first step. I had same idea.

Indeed the problem with configuration order is hard to handle. Currently we rely on order of configuration.

Maybe @breskeby has an idea.

I will comment on JDK issue that there is kind of a regression because the order how the options are applied changed. Maybe they should have a defined order.

I was not able to test it yesterday in train, I just opened issue. My bad.

Greetings from bbuzz2025.

@uschindler
Copy link
Contributor

Can you backport this change?

@dweiss
Copy link
Contributor Author

dweiss commented Jun 16, 2025

I will apply and backport, no worries, Uwe. Enjoy a beer in Berlin!

@dweiss dweiss merged commit 972b4e8 into apache:main Jun 16, 2025
7 checks passed
@dweiss dweiss deleted the lint-options-duplicate-removal branch June 16, 2025 08:19
@uschindler
Copy link
Contributor

If I remember: the order of configuration is still predictable by the order of including them into the main build script. I always felt bad with that, but it worked. Just want to confirm it also applies to changes in main.

@dweiss
Copy link
Contributor Author

dweiss commented Jun 16, 2025

Yes, I think this can be relied upon. I don't think it's mentioned anywhere, officially, but I think it's the case.

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.

compileMain24Java fails with JDK25+
3 participants