Skip to content

Commit 18146d9

Browse files
committed
Rename Types.param to Types.typeParamOf
Ideally, this method would be deleted in favor of using Types.typeParamsOf, which returns all type parameters, not just the ith one. But the typeParamsOf method appears to be a little buggy in comparison to Types.typeParamOf, so for now, both of them stay.
1 parent 8a900cf commit 18146d9

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

scijava-struct/src/test/java/org/scijava/struct/ParameterStructs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static List<Member<?>> parse(final Class<?> type)
6363
if (p.length == paramCount) {
6464
for (int i=0; i<p.length; i++) {
6565
String key = p[i].key();
66-
final Type itemType = Types.param(type, functionalType, i);
66+
final Type itemType = Types.typeParamOf(type, functionalType, i);
6767
final Class<?> rawItemType = Types.raw(itemType);
6868
final boolean valid = checkValidity(p[i], key, rawItemType, false,
6969
names, problems);

scijava-types/src/main/java/org/scijava/types/Types.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public static Type typeOf(final Field field, final Class<?> type) {
234234
* {@code String}.
235235
* </p>
236236
*/
237-
public static Type param(final Type type, final Class<?> c, final int no) {
237+
public static Type typeParamOf(final Type type, final Class<?> c, final int no) {
238238
return GenericTypeReflector.getTypeParameter(type, //
239239
c.getTypeParameters()[no]);
240240
}
@@ -1163,10 +1163,8 @@ private static boolean isApplicableToTypeVariableBounds(
11631163
for (int i = 0; i < paramBoundTypes.length; i++) {
11641164
// Get the type parameter of arg from the bound type which we know
11651165
// is parameterized.
1166-
final Type argType = param(arg, raw(paramBoundType), i);
1167-
if (argType == null) {
1168-
return false;
1169-
}
1166+
final Type argType = typeParamOf(arg, raw(paramBoundType), i);
1167+
if (argType == null) return false;
11701168
if (paramBoundTypes[i] instanceof TypeVariable<?> &&
11711169
!isApplicableToTypeParameter(argType,
11721170
(TypeVariable<?>) paramBoundTypes[i], typeBounds)) return false;

scijava-types/src/test/java/org/scijava/types/TypesTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,16 @@ public void testTypeOf() {
168168
assertSame(Integer.class, iType);
169169
}
170170

171-
/** Tests {@link Types#param}. */
171+
/** Tests {@link Types#typeParamOf}. */
172172
@Test
173-
public void testParam() {
173+
public void testTypeParamOf() {
174174
class Struct {
175175

176176
@SuppressWarnings("unused")
177177
private List<int[]> list;
178178
}
179179
final Type listType = type(Struct.class, "list");
180-
final Type paramType = Types.param(listType, List.class, 0);
180+
final Type paramType = Types.typeParamOf(listType, List.class, 0);
181181
final Class<?> paramClass = Types.raw(paramType);
182182
assertSame(int[].class, paramClass);
183183
}

0 commit comments

Comments
 (0)