Skip to content

Commit

Permalink
review items: unnecessary checks; numeric constant instead of loop var
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsolt Mészárovics committed Sep 2, 2016
1 parent 94ff54d commit cbecc00
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ public MetaHolder create(Object proxy, Method collapserMethod, Object obj, Objec
Class<?> collapserReturnType = collapserMethod.getReturnType();
boolean observable = collapserReturnType.equals(Observable.class);

if (!batchReturnType.equals(List.class))
throw new IllegalStateException("required batch method for collapser is absent: "
+ "(java.util.List) " + obj.getClass().getCanonicalName() + "." +
hystrixCollapser.batchMethod() + "(java.util.List)");

if (!collapserMethod.getParameterTypes()[0]
.equals(getFirstGenericParameter(batchCommandMethod.getGenericParameterTypes()[0]))) {
throw new IllegalStateException("required batch method for collapser is absent, wrong generic type: expected "
Expand Down Expand Up @@ -276,7 +271,7 @@ private static Class<?> getFirstGenericParameter(final Type type, final int nest
for (int cDept = 0; cDept < nestedDepth; cDept++) {
if (!(tType instanceof ParameterizedType))
throw new IllegalStateException(String.format("Sub type at nesting level %d of %s is expected to be generic", cDepth, type));
tType = ((ParameterizedType) tType).getActualTypeArguments()[0];
tType = ((ParameterizedType) tType).getActualTypeArguments()[cDept];
}

if (tType instanceof ParameterizedType)
Expand Down

0 comments on commit cbecc00

Please sign in to comment.