-
-
Notifications
You must be signed in to change notification settings - Fork 354
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
feature: Add static factory methods for CtExtendedModifier #4202
Conversation
* @param kind the kind of this modifier. | ||
* @deprecated use {@link #explicit(ModifierKind)} to create an explicit modifier. | ||
*/ | ||
@Deprecated |
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.
Maybe add a since
value like 9.2? https://download.java.net/java/GA/jdk14/docs/api/java.base/java/lang/Deprecated.html#since()
LGTM. I would not deprecate the existing constructor to maximize backward compatibility (we love backward compatibility in Spoon). It just assumes a default implicitness, which we document and that's fine. |
I disagree. By providing the Just my two cents, I'm in favor of the deprecation given that these static methods should be added at all (which I don't have a strong opinion about). EDIT: Actually, by my logic, both existing constructors should be deprecated. |
The other constructor is currently used in places where the implicitness is given a boolean variable (or parameter). This should still be possible without having deprecation warnings. But if we have a static factory method for that too, we could deprecate it I think. |
I've never actually seen that used :). But it does further prove my point that deprecation does not mean "planned for removal". According to the Javadoc of
So I vote for deprecation of that constructor.
I suppose that's fair, rewriting that code to use |
I forgot to mention that this was added in Java 9, so that might be the reason |
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.
To me this is ready for merge.
@monperrus Do you want to veto the deprecation? I don't feel super strongly about it so I'll let you decide, but I would vote for including it (as argued above).
I love that. We use deprecation for signaling better alternatives (free added value for clients), but not for signaling removal (forced labor for clients). Merging! Thanks a lot! |
This adds two methods to
CtExtendedModifier
that allow to create instances without having to pass boolean values.I deprecated the constructor where the implicitness defaulted to
false
, as the result is less obvious compared to the named method.I also replaced the usages of the deprecated constructor and the usages of the other constructor where the second parameter was a boolean literal.
The usage as API might be more relevant with methods to directly add and remove extended modifiers, see #4136 for context.