[
https://issues.apache.org/jira/browse/BROOKLYN-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16032963#comment-16032963
]
ASF GitHub Bot commented on BROOKLYN-513:
-----------------------------------------
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.
> yaml location for azurecompute-arm templateOptions.ipOptions fails
> ------------------------------------------------------------------
>
> Key: BROOKLYN-513
> URL: https://issues.apache.org/jira/browse/BROOKLYN-513
> Project: Brooklyn
> Issue Type: Bug
> Affects Versions: 0.11.0
> Reporter: Aled Sage
>
> When attempting to use the very latest jclouds 2.1.0-SNAPSHOT
> azurecompute-arm with the location yaml below, it fails to convert this to an
> {{IpOptions}} instance.
> {noformat}
> templateOptions:
> ipOptions:
> - subnet: manual-subnet-ambari
> {noformat}
> This is because of how jclouds declares its builder. The
> {{IpOptions.builder()}} method returns an instance of
> {{AutoValue_IpOptions.Builder}}, but that class is package-private [1].
> Therefore reflectively trying to call
> {{builder.subnet("manual-subnet-ambari")}} is failing because the method is
> not accessible.
> [1]
> https://github.com/jclouds/jclouds-labs/blob/master/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/options/IpOptions.java#L60
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)