-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Template parameters can be deprecated #273
base: main
Are you sure you want to change the base?
Conversation
One more thing:
Still this would maybe not work 100% all of the time, because Java users would have to pass a |
More notes:
Adding
However we must take care now what happens with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An empty comment so that this will not be part of my "review requests" list.
Sorry for the noise, @mkurz.
Hey Marcos, been a while! Hope all is well. I typically just click on the notification, and then hit "unsubscribe" at the top. That works well enough for the notification spam for a particular PR, for me. |
Hey Billy, how are you? Yeah, it's been a while, and I hope everything is well with you too.
Oh, that is not a notification, but instead, the list of review requests that appear when you access https://github.com/pulls/review-requested. |
Right now it's not possible to deprecate the generated
render
,apply
andf
methods. So we have no choice of breaking the API as soon the args passed via@(...)
change. This bit as before and bites us again in playframework/playframework#9447.Therefore I propose to once and for all fix this problem by adding a
@deprecatedParams
tag, which you can use to overload therender
andapply
method with deprecated ones. There is just one small problem: We can not overload thef
method, because they just differ in the return type... Therefore to make this work, we need to rename thatf
method. Therefore I will add a@templateFunctionName("...")
tag which just sets the name of thef
method.And this is how I suggest it will look like. Given you have the following template:
And you want to deprecate the arguments and replace them with String equivalents:
We pass the
@deprecatedParams
the version since when we want the methods to be deprecate and the name of thef
function which should be deprecated (here it'sf
because that is the default name). (the generated annotation will be like@deprecated(since="2.8.0", message="Use new method fn instead")
for thef
method and@deprecated(since="2.8.0", message="""Use arguments (one: String, two: String) instead""")
forapply
andrender
). Finally we pass the arguments for the deprecatedrender
,apply
and return type off
.Now in the next version we can just remove the
@deprecatedParams
tag, but keep the@templateFunctionName
(because that's the method's name now):Now in case we want to again deprecate these arguments you can now just remove the
@templateFunctionName
(resulting in the generating the methodf
with its default name), but tell@deprecatedParams("2.10.0", "fn")(...
that the method to deprecate isfn
.TODO's:
@templateFunctionName("...")
@templateFunctionName
@deprecatedParams
@deprecatedParams
(Docs need to be added to Java and Scala API always)