You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Adrian Cole <no...@github.com> on 2014/11/12 05:26:24 UTC

[jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

 * Change OAuthScopes into an interface as opposed to boilerplating annotations
 * Fixed errors because of boilerplating annotations.
You can merge this Pull Request by running:

  git pull https://github.com/adriancole/jclouds-labs-google adrian.oauth-scopes

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds-labs-google/pull/91

-- Commit Summary --

  * * Change OAuthScopes into an interface as opposed to boilerplating annotations.

-- File Changes --

    M google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/blobstore/GCSBlobStore.java (2)
    M google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageHttpApiModule.java (9)
    A google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageOAuthScopes.java (63)
    M google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApi.java (25)
    M google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketApi.java (48)
    M google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApi.java (32)
    M google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApi.java (60)
    M google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectApi.java (77)
    M google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ResumableUploadApi.java (16)
    M google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/reference/GoogleCloudStorageConstants.java (17)
    M google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageAuthenticatedRestContextLiveTest.java (3)
    M google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketAccessControlsApiExpectTest.java (3)
    M google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiExpectTest.java (21)
    M google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/BucketApiLiveTest.java (2)
    M google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApiExpectTest.java (3)
    M google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApiExpectTest.java (3)
    M google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageExpectTest.java (14)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java (9)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineHttpApiModule.java (9)
    D google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineScopes.java (28)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java (9)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AggregatedListApi.java (3)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java (11)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskTypeApi.java (3)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java (11)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java (10)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java (12)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java (13)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java (18)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java (6)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java (10)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/OperationApi.java (14)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java (5)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java (3)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java (11)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java (8)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java (16)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java (3)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/GoogleComputeEngineAuthenticatedRestContextLiveTest.java (3)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/AddressApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/DiskTypeApiExpectTest.java (1)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/FirewallApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ImageApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/InstanceApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/MachineTypeApiExpectTest.java (1)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/NetworkApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/OperationApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ProjectApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RegionApiExpectTest.java (1)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/RouteApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/SnapshotApiExpectTest.java (1)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/TargetPoolApiExpectTest.java (2)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/features/ZoneApiExpectTest.java (1)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineExpectTest.java (2)
    R google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/ToIteratorOfListPageExpectTest.java (4)
    M oauth/README (2)
    M oauth/pom.xml (4)
    M oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthHttpApiModule.java (5)
    M oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java (7)
    M oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthScopes.java (63)
    M oauth/src/main/java/org/jclouds/oauth/v2/functions/BuildTokenRequest.java (25)
    M oauth/src/test/java/org/jclouds/oauth/v2/binders/TokenBinderTest.java (29)
    M oauth/src/test/java/org/jclouds/oauth/v2/features/OAuthApiLiveTest.java (5)
    M oauth/src/test/java/org/jclouds/oauth/v2/features/OAuthApiMockTest.java (15)
    M oauth/src/test/java/org/jclouds/oauth/v2/internal/BaseOAuthApiLiveTest.java (22)

-- Patch Links --

https://github.com/jclouds/jclouds-labs-google/pull/91.patch
https://github.com/jclouds/jclouds-labs-google/pull/91.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Andrew Phillips <no...@github.com>.
Happy to see all the annotations go! Now we are passing API class names into some logic to determine which OAuth scope to use - any way to move that to an annotation at the class level?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62748143

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-google-pull-requests #278](https://jclouds.ci.cloudbees.com/job/jclouds-labs-google-pull-requests/278/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62668691

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
> +import org.jclouds.googlecloudstorage.features.DefaultObjectAccessControlsApi;
> +import org.jclouds.googlecloudstorage.features.ObjectAccessControlsApi;
> +import org.jclouds.http.HttpRequest;
> +import org.jclouds.oauth.v2.config.OAuthScopes;
> +import org.jclouds.rest.internal.GeneratedHttpRequest;
> +
> +import com.google.auto.value.AutoValue;
> +import com.google.common.collect.ImmutableList;
> +import com.google.common.collect.ImmutableSet;
> +
> +@AutoValue public abstract class GoogleCloudStorageOAuthScopes implements OAuthScopes {
> +   abstract OAuthScopes readOrWriteScopes();
> +
> +   abstract List<String> fullControlScopes();
> +
> +   abstract Set<Class<?>> aclApis();

The docs say that full control is read-write plus acls. I will clarify as
we accidentally put non acl methods into this bin before!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91/files#r20233552

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
@andreaturli not sure you are using oauth, but if so.. have a look!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62668950

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
@ccustine I think this should work OOB with digital ocean. lemme know.
@danbroudy ping! this affects you, but hopefully in a good way.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62668802

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-google-pull-requests #284](https://jclouds.ci.cloudbees.com/job/jclouds-labs-google-pull-requests/284/) UNSTABLE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62834545

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Andrew Phillips <no...@github.com>.
> Do you mean add another annotation to the API classes :-)

Yes, that was the suggestion. If we feel this is a special case, fine with me. If we're looking at this more generally, I was wondering about how likely it is to add a new API and then forget to update the "these APIs need the full access" set, which lives elsewhere.

I'm not certainly not a fan of annotations either, I was thinking more about possible solutions that are on the class that's under development.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62801632

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
Uhh let's please not do that. We overuse annotations.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62754987

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Chris Custine <no...@github.com>.
+1 Tested with Digital Ocean v2 with no issues.
@demobox Do you mean add another annotation to the API classes :-) This case (GCS full control scope) seems enough of a special case that I think it is easier to track the config without being annotation based IMHO.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62755737

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
> +import org.jclouds.googlecloudstorage.features.DefaultObjectAccessControlsApi;
> +import org.jclouds.googlecloudstorage.features.ObjectAccessControlsApi;
> +import org.jclouds.http.HttpRequest;
> +import org.jclouds.oauth.v2.config.OAuthScopes;
> +import org.jclouds.rest.internal.GeneratedHttpRequest;
> +
> +import com.google.auto.value.AutoValue;
> +import com.google.common.collect.ImmutableList;
> +import com.google.common.collect.ImmutableSet;
> +
> +@AutoValue public abstract class GoogleCloudStorageOAuthScopes implements OAuthScopes {
> +   abstract OAuthScopes readOrWriteScopes();
> +
> +   abstract List<String> fullControlScopes();
> +
> +   abstract Set<Class<?>> aclApis();

refactored into string matching

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91/files#r20270210

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
thx for the reviews!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62840420

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Andrew Phillips <no...@github.com>.
> @@ -81,11 +82,7 @@
>     @Provides @Singleton Supplier<Function<byte[], byte[]>> signOrProduceMacForToken(@Named(JWS_ALG) String jwsAlg,
>           Provider<SignOrProduceMacForToken> in) {
>        if (jwsAlg.equals(NONE)) { // Current implementation requires we return null on none.
> -         return Suppliers.<Function<byte[], byte[]>>ofInstance(new Function<byte[], byte[]>() {
> -            @Override public byte[] apply(byte[] input) {
> -               return null;
> -            }
> -         });
> +         return (Supplier) Suppliers.ofInstance(Functions.constant(null));

[minor] I'm OK with the cast, but no way to easily fix this with generics?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91/files#r20230790

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
Sorry I think you are missing context.

So authorization rules are usually written in broad strokes, and they are
definitely written in broad strokes in google and digital ocean projects.
The fact that we use HttpFilter annotations in the past to apply
authentication suggestions has already broken badly. That's why you'll
notice we have marker interfaces in both oauth and openstack (and I think
cloudstack). If nothing else, knowing this, we should move away from
authentication and authorization as annotations than make more of them. Not
knowing this, I can understand why you might suggest moving this to an
annotation.

Hope this helps.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62808761

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
ok decrapped the google oauth thing, still passes tests which proves the right scopes are applied. will merge on green

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62834357

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs-google #1707](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs-google/1707/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62834778

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Andrew Phillips <no...@github.com>.
> +import org.jclouds.googlecloudstorage.features.DefaultObjectAccessControlsApi;
> +import org.jclouds.googlecloudstorage.features.ObjectAccessControlsApi;
> +import org.jclouds.http.HttpRequest;
> +import org.jclouds.oauth.v2.config.OAuthScopes;
> +import org.jclouds.rest.internal.GeneratedHttpRequest;
> +
> +import com.google.auto.value.AutoValue;
> +import com.google.common.collect.ImmutableList;
> +import com.google.common.collect.ImmutableSet;
> +
> +@AutoValue public abstract class GoogleCloudStorageOAuthScopes implements OAuthScopes {
> +   abstract OAuthScopes readOrWriteScopes();
> +
> +   abstract List<String> fullControlScopes();
> +
> +   abstract Set<Class<?>> aclApis();

[minor] Call this "fullControlApis" or something? If I understand correctly, what distinguishes these APIs is that they need full, rather than R/W control. That happens to apply to the ACL APIs at this point, but this class does not need to know that?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91/files#r20230435

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Ignasi Barrera <no...@github.com>.
>     @SelectJson("items")
> +   @Fallback(NullOnNotFoundOr404.class)

I know this is not the scope of this PR, but is it OK to return `null` when returning lists? Shouldn't be more correct to return an empty list, or throw a `ResourceNotFoundException` if the object you are requesting does not exist?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91/files#r20257331

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs-google #1700](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs-google/1700/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62669285

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
Reopened #91.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#event-191836499

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
> +import org.jclouds.googlecloudstorage.features.DefaultObjectAccessControlsApi;
> +import org.jclouds.googlecloudstorage.features.ObjectAccessControlsApi;
> +import org.jclouds.http.HttpRequest;
> +import org.jclouds.oauth.v2.config.OAuthScopes;
> +import org.jclouds.rest.internal.GeneratedHttpRequest;
> +
> +import com.google.auto.value.AutoValue;
> +import com.google.common.collect.ImmutableList;
> +import com.google.common.collect.ImmutableSet;
> +
> +@AutoValue public abstract class GoogleCloudStorageOAuthScopes implements OAuthScopes {
> +   abstract OAuthScopes readOrWriteScopes();
> +
> +   abstract List<String> fullControlScopes();
> +
> +   abstract Set<Class<?>> aclApis();

I will change this to a regex and remove the class references.
Authorization needs to be a tight abstraction and light on maintenance.
Annotations are the wrong answer and I can see how this list of class
approach is also wrong.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91/files#r20234002

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs-google #1699](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs-google/1699/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62668877

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-google-pull-requests #279](https://jclouds.ci.cloudbees.com/job/jclouds-labs-google-pull-requests/279/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#issuecomment-62669042

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
Closed #91.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91#event-192481108

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Andrew Phillips <no...@github.com>.
> @@ -81,11 +82,7 @@
>     @Provides @Singleton Supplier<Function<byte[], byte[]>> signOrProduceMacForToken(@Named(JWS_ALG) String jwsAlg,
>           Provider<SignOrProduceMacForToken> in) {
>        if (jwsAlg.equals(NONE)) { // Current implementation requires we return null on none.
> -         return Suppliers.<Function<byte[], byte[]>>ofInstance(new Function<byte[], byte[]>() {
> -            @Override public byte[] apply(byte[] input) {
> -               return null;
> -            }
> -         });
> +         return (Supplier) Suppliers.ofInstance(Functions.constant(null));

> Hope this makes sense.

Works for me. Thanks!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91/files#r20254732

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
>     @SelectJson("items")
> +   @Fallback(NullOnNotFoundOr404.class)

this is a subtype of an existing resource, but regardless I agree the annotation is wrong. So many of these are wrong we need to completely clean this api. You noticing this in passing supports that this api hasn't really been thought through.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91/files#r20258068

Re: [jclouds-labs-google] Change OAuthScopes into an interface as opposed to boilerplating annotations (#91)

Posted by Adrian Cole <no...@github.com>.
> @@ -81,11 +82,7 @@
>     @Provides @Singleton Supplier<Function<byte[], byte[]>> signOrProduceMacForToken(@Named(JWS_ALG) String jwsAlg,
>           Provider<SignOrProduceMacForToken> in) {
>        if (jwsAlg.equals(NONE)) { // Current implementation requires we return null on none.
> -         return Suppliers.<Function<byte[], byte[]>>ofInstance(new Function<byte[], byte[]>() {
> -            @Override public byte[] apply(byte[] input) {
> -               return null;
> -            }
> -         });
> +         return (Supplier) Suppliers.ofInstance(Functions.constant(null));

Cure is worse than the disease on this one. Because input param to the
constant function is Object, you would have to create your own, just to
satisfy generics. That made the actual code dwarfed by dealing with
generics. Hope this makes sense.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/91/files#r20233696