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

@deprecated w/o argument is deprecated #948

Closed
daddykotex opened this issue May 5, 2023 · 4 comments · Fixed by #981
Closed

@deprecated w/o argument is deprecated #948

daddykotex opened this issue May 5, 2023 · 4 comments · Fixed by #981
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@daddykotex
Copy link
Contributor

We generate @deprecated annotation code from shapes that w/ the smithy.api#deprecated trait. smithy.api#deprecated is defined as:

/// Marks a shape or member as deprecated.
@trait
structure deprecated {
    /// The reason for deprecation.
    message: String,

    /// A description of when the shape was deprecated (e.g., a date or version).
    since: String,
}

So there are fields that we can use to render a proper @deprecated annotation in Scala code. I suggested that we get the message and since from the hint and fallback to N/A if empty.

@daddykotex daddykotex added enhancement New feature or request good first issue Good for newcomers labels May 5, 2023
@daddykotex
Copy link
Contributor Author

Note that this can be worked around if your compiler options are strict and you're getting error because of this with the following option: """-Wconf:msg=Specify both message and version: @deprecated("message", since = "1.0") :silent"""

@i10416
Copy link
Contributor

i10416 commented May 29, 2023

I think rendering deprecated message and since are already supported here #599, aren't they?

Or do you mean we should render deprecation without message and since as @deprecated(message = "N/A", since = "N/A") instead of @deprecated to avoid compiler error/warning?

@kubukoz
Copy link
Member

kubukoz commented May 29, 2023

I think it's the latter, yeah. Basically if either message or since is missing we'd replace it with N/A or an empty string (if that works from the scalac perspective)

daddykotex pushed a commit that referenced this issue May 30, 2023
Scala compiler raises warning for deprecated annotation without message
and/or since fields.

close #948
kubukoz pushed a commit that referenced this issue May 30, 2023
…t to N/A] (#989)

Co-authored-by: i10416 <ito.yo16uh90616@gmail.com>
Co-authored-by: Jakub Kozłowski <kubukoz@gmail.com>
close #948
@daddykotex
Copy link
Contributor Author

released in 0.17.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants