Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/714#discussion_r119611421
--- Diff:
core/src/main/java/org/apache/brooklyn/util/core/flags/MethodCoercions.java ---
@@ -83,10 +86,11 @@ public boolean apply(@Nullable Method input) {
Optional<Method> matchingMethod = Iterables.tryFind(methods,
matchSingleParameterMethod(methodName, argument));
if (matchingMethod.isPresent()) {
Method method = matchingMethod.get();
+ Method accessibleMethod =
Reflections.findAccessibleMethod(method);
--- End diff --
The approach will fail for classes which have similar methods and one of
them is not accessible.
For example the builder of `IpOptions` has
```
abstract Builder address(Optional<String> address);
public Builder address(String address) {
```
If we have a registered coercion for `T -> Optional<T>` it will choose the
first one, but there's no public alternative for it in the superclasses. A
simpler case would be two methods to have `int`, `string` arguments where again
the former can be coerced to the latter.
A more resilient approach would be to get a list of the public methods for
all interfaces and superclasses (at line 76), filter them for public access and
then do the name/parameter matching.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---