[issue 461] Replacing a static builder() call with an explicit Builder() creation to prevent and "ambiguous method" compilation error on OpenJDK, Java 7 and others. The compiler can't figure out which static builder() method is the correct one :-(

This commit is contained in:
Andrew Phillips 2011-12-21 20:54:06 -05:00
parent f7f81d6567
commit e788f76411
1 changed files with 9 additions and 1 deletions

View File

@ -423,7 +423,15 @@ public class RestAnnotationProcessor<T> {
requestBuilder = GeneratedHttpRequest.Builder.<T> from(r);
endpoint = r.getEndpoint();
} else {
requestBuilder = GeneratedHttpRequest.<T> builder();
/*
* Can't use GeneratedHttpRequest.<T>builder() because the T is too
* general for the compiler to be able to distinguish between
* GeneratedHttpRequest.builder() and HttpMessage.builder() - the
* latter is available because GHR inherits from HM.
*
* See http://code.google.com/p/jclouds/issues/detail?id=461
*/
requestBuilder = new GeneratedHttpRequest.Builder<T>();
requestBuilder.method(getHttpMethodOrConstantOrThrowException(method));
}