Skip to content
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

Mark reified varargs parameter @Deprecated #3319

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bjmi
Copy link
Contributor

@bjmi bjmi commented Apr 19, 2024

see title

Discourage use of reified argument
@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 12.52%. Comparing base (7f2445e) to head (b610228).

❗ Current head b610228 differs from pull request most recent head eb23b28. Consider uploading reports for the commit eb23b28 to get more accurate results

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #3319       +/-   ##
=============================================
- Coverage     85.33%   12.52%   -72.81%     
+ Complexity     2924      429     -2495     
=============================================
  Files           336      336               
  Lines          8907     8907               
  Branches       1109     1109               
=============================================
- Hits           7601     1116     -6485     
- Misses         1013     7577     +6564     
+ Partials        293      214       -79     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TimvdLippe
Copy link
Contributor

How does this show up in your Idea? I understand we rely on the magic of the compiler to determine the type of the generic argument, but I didn't know you could annotate individual arguments as deprecated. Can you share a screenshot of a usage to show the UX?

@bjmi
Copy link
Contributor Author

bjmi commented Apr 21, 2024

Currently IntelliJ IDEA and Eclipse IDE simply ignore the @deprecated annotation when used on parameters.

But the intention to keep end users from passing a parameter value still applies.

A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. Compilers warn when a deprecated program element is used or overridden in non-deprecated code. - Javadoc

More information in this SO answer.

What do you think? :)

@TimvdLippe
Copy link
Contributor

Since this annotation will not show up in either tooling or the compiler itself, I don't see a lot of use for adding it. When the compiler does emit a warning when a parameter is passed into such a method, I do see the value in adding it. For now, I am inclined to not merge this change. WDYT?

@bjmi
Copy link
Contributor Author

bjmi commented Apr 24, 2024

Could you please wait for the outcome of IDEA-352253? If it is implemented then the use of avoiding user errors is increased. Otherwise this PR has no real added value.

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.

None yet

3 participants