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
Deprecate groovy #611
Deprecate groovy #611
Conversation
Deprecate methods that take explicit groovy types (e.g. groovy.lang.Closure, groovy.time.TimeDuration, etc). Also updates some javadoc that mentioned “Closure” to say that its Usage is deprecated.
1d52e2e
to
1d056d8
Compare
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.
Successfully built once rebased on the latest master (Jenkins issues are fixed by other merged PRs)
Few minor comment but otherwise, LGTM
public static <I,T> ExplicitEffector<I,T> create(String name, Class<T> type, List<ParameterType<?>> parameters, String description, Closure body) { | ||
LOG.warn("Use of groovy.lang.Closure is deprecated, in ExplicitEffector.create()"); |
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.
Shouldn't we suggest another class/method to use in the warning message?
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.
I've added this to javadoc on the class - I think that's good enough, as there's not a direct replacement (i.e. one would extend AbstractEffector
yourself instead, as we don't need to workaround for GROOVY-5122 if you're not using groovy - I'm not sure why anyone would want to do that).
I agree in general that if deprecating a method/class, one should point at the alternative - but if deprecating a class, I don't think we need it on every method.
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.
Fair enough
/** | ||
* @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. | ||
*/ | ||
@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.
Shouldn't we add a warning message here?
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.
My rule-of-thumb... if one might get at the code via a yaml blueprint (so never seeing a deprecation warning in your IDE/compiler), then we should include a log.warn. But if we can assume that the user will get compiler warnings, then that is sufficient.
I believe that this will only get called directly in code, so one should see a compiler warning.
/** | ||
* @deprecated since 0.11.0; explicit groovy utilities/support will be deleted. | ||
*/ | ||
@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.
Is this one really 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.
Yes, the parameter is of type groovy.time.TimeDuration
.
@tbouron I've responded to your comments - do you agree with those, or do you think I should make further changes before merging the PR? |
@aledsage Yes, I think that covers everything so LGTM 👍 |
Thanks @tbouron - merging now. |
As discussed on the dev@brooklyn mailing list (subject "[PROPOSAL] Remove groovy dependency/support").
Deprecate methods that take explicit groovy types (e.g.
groovy.lang.Closure
,groovy.time.TimeDuration
, etc).Also updates some javadoc that mentioned
Closure
to say that its usage is deprecated.In some places, it does a
LOG.warn()
about the deprecation when a groovy Closure etc is passed in - this is when we can't just deprecate the method, e.g. for use ofTypeCoercion
on when the method takesObject
and does an uglyinstanceof
.This does not touch:
org.apache.brooklyn.rest.resources.ScriptResource
(for groovy-script execution)AbstractManagementContext.invokeEffectorMethodLocal()
callingGroovyJavaMethods.invokeMethodOnMetaClass
)