Skip to content

Commit d3210c1

Browse files
committed
Remove the unused code from the MethodInfo
The MethodInfo.configKey field is not more used since PR OpenFeign#1757 removing AsyncInvocation
1 parent a20fe95 commit d3210c1

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

core/src/main/java/feign/MethodInfo.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,15 @@
2020

2121
@Experimental
2222
public class MethodInfo {
23-
private final String configKey;
2423
private final Type underlyingReturnType;
2524
private final boolean asyncReturnType;
2625

27-
protected MethodInfo(String configKey, Type underlyingReturnType, boolean asyncReturnType) {
28-
this.configKey = configKey;
26+
protected MethodInfo(Type underlyingReturnType, boolean asyncReturnType) {
2927
this.underlyingReturnType = underlyingReturnType;
3028
this.asyncReturnType = asyncReturnType;
3129
}
3230

3331
MethodInfo(Class<?> targetType, Method method) {
34-
this.configKey = Feign.configKey(targetType, method);
35-
3632
final Type type = Types.resolve(targetType, targetType, method.getGenericReturnType());
3733

3834
if (type instanceof ParameterizedType
@@ -45,10 +41,6 @@ protected MethodInfo(String configKey, Type underlyingReturnType, boolean asyncR
4541
}
4642
}
4743

48-
String configKey() {
49-
return configKey;
50-
}
51-
5244
Type underlyingReturnType() {
5345
return underlyingReturnType;
5446
}

core/src/test/java/feign/MethodInfoTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public interface AsyncClient {
3333
@Test
3434
public void testCompletableFutureOfString() throws Exception {
3535
MethodInfo mi = new MethodInfo(AsyncClient.class, AsyncClient.class.getMethod("log"));
36-
assertEquals("AsyncClient#log()", mi.configKey());
3736
assertTrue(mi.isAsyncReturnType());
3837
assertEquals(String.class, mi.underlyingReturnType());
3938
}
@@ -50,7 +49,6 @@ public interface AsyncClient extends GenericAsyncClient<CompletableFuture<String
5049
@Test
5150
public void testGenericCompletableFutureOfString() throws Exception {
5251
MethodInfo mi = new MethodInfo(AsyncClient.class, AsyncClient.class.getMethod("log"));
53-
assertEquals("AsyncClient#log()", mi.configKey());
5452
assertTrue(mi.isAsyncReturnType());
5553
assertEquals(String.class, mi.underlyingReturnType());
5654
}
@@ -64,7 +62,6 @@ public interface SyncClient {
6462
@Test
6563
public void testString() throws Exception {
6664
MethodInfo mi = new MethodInfo(SyncClient.class, SyncClient.class.getMethod("log"));
67-
assertEquals("SyncClient#log()", mi.configKey());
6865
assertFalse(mi.isAsyncReturnType());
6966
assertEquals(String.class, mi.underlyingReturnType());
7067
}
@@ -98,7 +95,6 @@ public Type getOwnerType() {
9895
@Test
9996
public void testListOfStrings() throws Exception {
10097
MethodInfo mi = new MethodInfo(SyncClient.class, SyncClient.class.getMethod("log"));
101-
assertEquals("SyncClient#log()", mi.configKey());
10298
assertFalse(mi.isAsyncReturnType());
10399
assertTrue(Types.equals(new ListOfStrings(), mi.underlyingReturnType()));
104100
}

kotlin/src/main/java/feign/kotlin/KotlinMethodInfo.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@
2323

2424
class KotlinMethodInfo extends MethodInfo {
2525

26-
KotlinMethodInfo(String configKey, Type underlyingReturnType, boolean asyncReturnType) {
27-
super(configKey, underlyingReturnType, asyncReturnType);
26+
KotlinMethodInfo(Type underlyingReturnType, boolean asyncReturnType) {
27+
super(underlyingReturnType, asyncReturnType);
2828
}
2929

3030
static KotlinMethodInfo createInstance(Class<?> targetType, Method method) {
31-
String configKey = Feign.configKey(targetType, method);
32-
3331
final Type type = Types.resolve(targetType, targetType, method.getGenericReturnType());
3432

3533
Type underlyingReturnType;
@@ -38,6 +36,7 @@ static KotlinMethodInfo createInstance(Class<?> targetType, Method method) {
3836
asyncReturnType = true;
3937
underlyingReturnType = MethodKt.getKotlinMethodReturnType(method);
4038
if (underlyingReturnType == null) {
39+
String configKey = Feign.configKey(targetType, method);
4140
throw new IllegalArgumentException(
4241
String.format(
4342
"Method %s can't have continuation argument, only kotlin method is allowed",
@@ -52,6 +51,6 @@ static KotlinMethodInfo createInstance(Class<?> targetType, Method method) {
5251
underlyingReturnType = type;
5352
}
5453

55-
return new KotlinMethodInfo(configKey, underlyingReturnType, asyncReturnType);
54+
return new KotlinMethodInfo(underlyingReturnType, asyncReturnType);
5655
}
5756
}

0 commit comments

Comments
 (0)