Skip to content

Commit c08cb96

Browse files
committed
Types: eliminate unnecessary else clauses
1 parent 89072d7 commit c08cb96

File tree

1 file changed

+18
-30
lines changed

1 file changed

+18
-30
lines changed

src/main/java/org/scijava/util/Types.java

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2863,7 +2863,7 @@ else if (type instanceof ParameterizedType) {
28632863
else if (type instanceof TypeVariable) {
28642864
final TypeVariable<?> tv = (TypeVariable<?>) type;
28652865
if (tv.getBounds().length == 0) return Object.class;
2866-
else return erase(tv.getBounds()[0]);
2866+
return erase(tv.getBounds()[0]);
28672867
}
28682868
else if (type instanceof GenericArrayType) {
28692869
final GenericArrayType aType = (GenericArrayType) type;
@@ -2889,21 +2889,19 @@ private static Type mapTypeParameters(final Type toMapType,
28892889
if (isMissingTypeParameters(typeAndParams)) {
28902890
return erase(toMapType);
28912891
}
2892-
else {
2893-
final VarMap varMap = new VarMap();
2894-
Type handlingTypeAndParams = typeAndParams;
2895-
while (handlingTypeAndParams instanceof ParameterizedType) {
2896-
final ParameterizedType pType =
2897-
(ParameterizedType) handlingTypeAndParams;
2898-
final Class<?> clazz = (Class<?>) pType.getRawType(); // getRawType
2899-
// should always
2900-
// be Class
2901-
varMap.addAll(clazz.getTypeParameters(), pType
2902-
.getActualTypeArguments());
2903-
handlingTypeAndParams = pType.getOwnerType();
2904-
}
2905-
return varMap.map(toMapType);
2892+
final VarMap varMap = new VarMap();
2893+
Type handlingTypeAndParams = typeAndParams;
2894+
while (handlingTypeAndParams instanceof ParameterizedType) {
2895+
final ParameterizedType pType =
2896+
(ParameterizedType) handlingTypeAndParams;
2897+
final Class<?> clazz = (Class<?>) pType.getRawType(); // getRawType
2898+
// should always
2899+
// be Class
2900+
varMap.addAll(clazz.getTypeParameters(), pType
2901+
.getActualTypeArguments());
2902+
handlingTypeAndParams = pType.getOwnerType();
29062903
}
2904+
return varMap.map(toMapType);
29072905
}
29082906

29092907
/**
@@ -3030,9 +3028,7 @@ public static Type getTypeParameter(final Type type,
30303028
variable);
30313029
return ((ParameterizedType) superType).getActualTypeArguments()[index];
30323030
}
3033-
else {
3034-
return null;
3035-
}
3031+
return null;
30363032
}
30373033

30383034
/**
@@ -3115,9 +3111,7 @@ private static boolean isArraySupertype(final Type arraySuperType,
31153111
if (subTypeComponent == null) { // subType is not an array type
31163112
return false;
31173113
}
3118-
else {
3119-
return isSuperType(superTypeComponent, subTypeComponent);
3120-
}
3114+
return isSuperType(superTypeComponent, subTypeComponent);
31213115
}
31223116

31233117
/**
@@ -3155,9 +3149,7 @@ private static boolean contains(final Type containingType,
31553149
}
31563150
return true;
31573151
}
3158-
else {
3159-
return containingType.equals(containedType);
3160-
}
3152+
return containingType.equals(containedType);
31613153
}
31623154

31633155
/**
@@ -3341,9 +3333,7 @@ public static Type capture(final Type type) {
33413333
pType.getOwnerType());
33423334
return newParameterizedType(clazz, ownerType, capturedArguments);
33433335
}
3344-
else {
3345-
return type;
3346-
}
3336+
return type;
33473337
}
33483338

33493339
/**
@@ -3355,9 +3345,7 @@ public static String getTypeName(final Type type) {
33553345
return clazz.isArray() ? (getTypeName(clazz.getComponentType()) + "[]")
33563346
: clazz.getName();
33573347
}
3358-
else {
3359-
return type.toString();
3360-
}
3348+
return type.toString();
33613349
}
33623350

33633351
/**

0 commit comments

Comments
 (0)