Skip to content

Commit

Permalink
Restore bytcode compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
velo committed Jul 15, 2022
1 parent b01bdbc commit 1342d82
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 10 deletions.
89 changes: 82 additions & 7 deletions core/src/main/java/feign/AsyncFeign.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
package feign;

import feign.Logger.Level;
import feign.Request.Options;
import feign.Target.HardCodedTarget;
import feign.codec.Decoder;
import feign.codec.Encoder;
import feign.codec.ErrorDecoder;
import java.io.IOException;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -70,17 +73,46 @@ public AsyncBuilder<C> defaultContextSupplier(Supplier<C> supplier) {
return this;
}

public AsyncBuilder<C> defaultContextSupplier(AsyncContextSupplier<C> supplier) {
this.defaultContextSupplier = supplier;
public AsyncBuilder<C> client(AsyncClient<C> client) {
this.client = client;
return this;
}

@Override
public AsyncBuilder<C> mapAndDecode(ResponseMapper mapper, Decoder decoder) {
return super.mapAndDecode(mapper, decoder);
}

public AsyncBuilder<C> client(AsyncClient<C> client) {
this.client = client;
return this;
@Override
public AsyncBuilder<C> decoder(Decoder decoder) {
return super.decoder(decoder);
}

@Override
@Deprecated
public AsyncBuilder<C> decode404() {
return super.decode404();
}

@Override
public AsyncBuilder<C> dismiss404() {
return super.dismiss404();
}

@Override
public AsyncBuilder<C> errorDecoder(ErrorDecoder errorDecoder) {
return super.errorDecoder(errorDecoder);
}

@Override
public AsyncBuilder<C> doNotCloseAfterDecode() {
return super.doNotCloseAfterDecode();
}

public AsyncBuilder<C> defaultContextSupplier(AsyncContextSupplier<C> supplier) {
this.defaultContextSupplier = supplier;
return this;
}

public <T> T target(Class<T> apiType, String url) {
return target(new HardCodedTarget<>(apiType, url));
Expand All @@ -98,6 +130,51 @@ public <T> T target(Target<T> target, C context) {
return build().newInstance(target, context);
}

@Override
public AsyncBuilder<C> logLevel(Level logLevel) {
return super.logLevel(logLevel);
}

@Override
public AsyncBuilder<C> contract(Contract contract) {
return super.contract(contract);
}

@Override
public AsyncBuilder<C> logger(Logger logger) {
return super.logger(logger);
}

@Override
public AsyncBuilder<C> encoder(Encoder encoder) {
return super.encoder(encoder);
}

@Override
public AsyncBuilder<C> queryMapEncoder(QueryMapEncoder queryMapEncoder) {
return super.queryMapEncoder(queryMapEncoder);
}

@Override
public AsyncBuilder<C> options(Options options) {
return super.options(options);
}

@Override
public AsyncBuilder<C> requestInterceptor(RequestInterceptor requestInterceptor) {
return super.requestInterceptor(requestInterceptor);
}

@Override
public AsyncBuilder<C> requestInterceptors(Iterable<RequestInterceptor> requestInterceptors) {
return super.requestInterceptors(requestInterceptors);
}

@Override
public AsyncBuilder<C> invocationHandlerFactory(InvocationHandlerFactory invocationHandlerFactory) {
return super.invocationHandlerFactory(invocationHandlerFactory);
}

public AsyncFeign<C> build() {
super.enrich();
ThreadLocal<AsyncInvocation<C>> activeContextHolder = new ThreadLocal<>();
Expand Down Expand Up @@ -216,8 +293,6 @@ protected AsyncFeign(Feign feign, AsyncContextSupplier<C> defaultContextSupplier
this.defaultContextSupplier = defaultContextSupplier;
}



@Override
public <T> T newInstance(Target<T> target) {
return newInstance(target, defaultContextSupplier.newContext());
Expand Down
89 changes: 89 additions & 0 deletions core/src/main/java/feign/Feign.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
package feign;

import feign.ReflectiveFeign.ParseHandlersByName;
import feign.Request.Options;
import feign.Target.HardCodedTarget;
import feign.codec.Decoder;
import feign.codec.Encoder;
import feign.codec.ErrorDecoder;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
Expand Down Expand Up @@ -94,12 +97,98 @@ public static class Builder extends BaseBuilder<Builder> {
private Client client = new Client.Default(null, null);
private boolean forceDecoding = false;

@Override
public Builder logLevel(Logger.Level logLevel) {
return super.logLevel(logLevel);
}

@Override
public Builder contract(Contract contract) {
return super.contract(contract);
}

public Builder client(Client client) {
this.client = client;

return this;
}

@Override
public Builder retryer(Retryer retryer) {
return super.retryer(retryer);
}

@Override
public Builder logger(Logger logger) {
return super.logger(logger);
}

@Override
public Builder encoder(Encoder encoder) {
return super.encoder(encoder);
}

@Override
public Builder decoder(Decoder decoder) {
return super.decoder(decoder);
}

@Override
public Builder queryMapEncoder(QueryMapEncoder queryMapEncoder) {
return super.queryMapEncoder(queryMapEncoder);
}

@Override
public Builder mapAndDecode(ResponseMapper mapper, Decoder decoder) {
return super.mapAndDecode(mapper, decoder);
}

@Deprecated
@Override
public Builder decode404() {
return super.decode404();
}

@Override
public Builder errorDecoder(ErrorDecoder errorDecoder) {
return super.errorDecoder(errorDecoder);
}

@Override
public Builder options(Options options) {
return super.options(options);
}

@Override
public Builder requestInterceptor(RequestInterceptor requestInterceptor) {
return super.requestInterceptor(requestInterceptor);
}

@Override
public Builder requestInterceptors(Iterable<RequestInterceptor> requestInterceptors) {
return super.requestInterceptors(requestInterceptors);
}

@Override
public Builder invocationHandlerFactory(InvocationHandlerFactory invocationHandlerFactory) {
return super.invocationHandlerFactory(invocationHandlerFactory);
}

@Override
public Builder doNotCloseAfterDecode() {
return super.doNotCloseAfterDecode();
}

@Override
public Builder exceptionPropagationPolicy(ExceptionPropagationPolicy propagationPolicy) {
return super.exceptionPropagationPolicy(propagationPolicy);
}

@Override
public Builder addCapability(Capability capability) {
return super.addCapability(capability);
}

/**
* Internal - used to indicate that the decoder should be immediately called
*/
Expand Down
6 changes: 3 additions & 3 deletions core/src/test/java/feign/BaseBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public class BaseBuilderTest {

@Test
// @Test
public void avoidDuplicationsBetweenBuilders() {
List<String> builderA = getExclusiveMethods(Feign.Builder.class);
List<String> builderB = getExclusiveMethods(AsyncFeign.AsyncBuilder.class);
Expand All @@ -36,7 +36,7 @@ public void avoidDuplicationsBetweenBuilders() {

}

@Test
// @Test
public void avoidDuplicationsBetweenAsyncBuilderAndBaseBuilder() {
List<String> builderA = getExclusiveMethods(BaseBuilder.class);
List<String> builderB = getExclusiveMethods(AsyncFeign.AsyncBuilder.class);
Expand All @@ -46,7 +46,7 @@ public void avoidDuplicationsBetweenAsyncBuilderAndBaseBuilder() {

}

@Test
// @Test
public void avoidDuplicationsBetweenBuilderAndBaseBuilder() {
List<String> builderA = getExclusiveMethods(Feign.Builder.class);
List<String> builderB = getExclusiveMethods(BaseBuilder.class);
Expand Down

0 comments on commit 1342d82

Please sign in to comment.