Skip to content

Conversation

som-snytt
Copy link
Contributor

Fixes #23033

This commit just ensures unused annotation is retained for parameters. The previous tweak excluded constructor params (probably out of fear).

My limited understanding is that the meta annots decide what to do for fields: which elements receive the annotation.

For a class param, I assumed you don't know whether a param incurs a field until constructors. Does a using param always incur a field?

For the fix, follow the example of publicInBinary to retain the annotation.

A justification is that if I ask not to warn, I always mean don't warn about any of the things, so extra unused annotations is benign.

Should unused have the param meta annot? It is redundant because if there is a field, you will always use the param through a paramaccessor, which is either the field itself or the getter, and both will be annotated unused.

@som-snytt
Copy link
Contributor Author

ok I'll run the whole test suite locally after switching to jdk 17 because it's impossible to tell from CI failures whether it is my fault.

@som-snytt som-snytt force-pushed the issue/23033-unused-class-param branch from 58e7acd to 8c37715 Compare April 24, 2025 12:31
@som-snytt som-snytt marked this pull request as ready for review April 24, 2025 14:43
@Gedochao Gedochao requested a review from KacperFKorban April 25, 2025 06:46
@som-snytt som-snytt merged commit 1c886c6 into scala:main Apr 28, 2025
29 checks passed
@som-snytt som-snytt deleted the issue/23033-unused-class-param branch April 28, 2025 15:51
@WojciechMazur WojciechMazur added this to the 3.7.1 milestone May 1, 2025
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.

unused annotation does not silence warning in given using with shorthand

3 participants