Skip to content

Commit

Permalink
Adjust naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Nov 8, 2023
1 parent 9d6a587 commit b1ccf7a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ protected TypeDescription.Generic describeParameterType(Method method, int index
}

protected TypeDescription.Generic describeExceptionType(Method method, int index) {
Type[] genericExceptionTypes = method.getGenericExceptionTypes();
Arrays.sort(genericExceptionTypes, new Comparator<Type>() {
@Override
public int compare(Type type, Type t1) {
return type.getTypeName().compareTo(t1.getTypeName());
Type[] type = method.getGenericExceptionTypes();
Arrays.sort(type, new Comparator<Type>() {
public int compare(Type left, Type right) {
return left.getTypeName().compareTo(right.getTypeName());
}
});

return TypeDefinition.Sort.describe(genericExceptionTypes[index],
return TypeDefinition.Sort.describe(type[index],
new TypeDescription.Generic.AnnotationReader.Delegator.ForLoadedExecutableExceptionType(method, index));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ protected TypeDescription.Generic describeParameterType(Method method, int index
}

protected TypeDescription.Generic describeExceptionType(Method method, int index) {
Type[] genericExceptionTypes = method.getGenericExceptionTypes();
Arrays.sort(genericExceptionTypes, new Comparator<Type>() {
@Override
public int compare(Type type, Type t1) {
return type.getTypeName().compareTo(t1.getTypeName());
Type[] type = method.getGenericExceptionTypes();
Arrays.sort(type, new Comparator<Type>() {
public int compare(Type left, Type right) {
return left.getTypeName().compareTo(right.getTypeName());
}
});

return describe(genericExceptionTypes[index], new TypeDescription.Generic.AnnotationReader.Delegator.ForLoadedExecutableExceptionType(method, index))
return describe(type[index], new TypeDescription.Generic.AnnotationReader.Delegator.ForLoadedExecutableExceptionType(method, index))
.accept(TypeDescription.Generic.Visitor.Substitutor.ForAttachment.of(new MethodDescription.ForLoadedMethod(method)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ public void testNonGenericParameter() throws Exception {
Class<?> auxiliaryType = proxyOnlyDeclaredMethodOf(GenericType.class);
assertThat(auxiliaryType.getTypeParameters().length, is(0));
assertThat(auxiliaryType.getDeclaredMethod("call").getGenericReturnType(), is((Type) Object.class));
Field[] declaredFields = auxiliaryType.getDeclaredFields();
Arrays.sort(declaredFields, new Comparator<Field>() {
@Override
public int compare(Field field1, Field field2) {
return field1.getName().compareTo(field2.getName());
Field[] field = auxiliaryType.getDeclaredFields();
Arrays.sort(field, new Comparator<Field>() {
public int compare(Field left, Field right) {
return left.getName().compareTo(right.getName());
}
});
assertThat(declaredFields[1].getGenericType(), is((Type) Object.class));
assertThat(declaredFields[2].getGenericType(), is((Type) Number.class));
assertThat(field[1].getGenericType(), is((Type) Object.class));
assertThat(field[2].getGenericType(), is((Type) Number.class));
}

@Test
Expand Down

0 comments on commit b1ccf7a

Please sign in to comment.