Skip to content

Commit 551ba08

Browse files
Treiblesschorlectrueden
authored andcommitted
No need to pass the declaring class
1 parent 6149b29 commit 551ba08

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/java/org/scijava/ops/matcher/OpFieldInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public OpFieldInfo(final Object instance, final Field field) {
8383
// NB: Subclassing a collection and inheriting its fields is NOT
8484
// ALLOWED!
8585
try {
86-
struct = ParameterStructs.structOf(field.getDeclaringClass(), field);
86+
struct = ParameterStructs.structOf(field);
8787
OpUtils.checkHasSingleOutput(struct);
8888
// NB: Contextual parameters not supported for now.
8989
} catch (ValidityException e) {

src/main/java/org/scijava/param/ParameterStructs.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public static Struct structOf(final Class<?> type)
5353
return () -> items;
5454
}
5555

56-
public static Struct structOf(final Class<?> c, final Field f)
56+
public static Struct structOf(final Field field)
5757
throws ValidityException
5858
{
59-
final List<Member<?>> items = parse(c, f);
59+
final List<Member<?>> items = parse(field);
6060
return () -> items;
6161
}
6262

@@ -87,7 +87,8 @@ public static List<Member<?>> parse(final Class<?> type)
8787
return items;
8888
}
8989

90-
public static List<Member<?>> parse(final Class<?> c, final Field field) throws ValidityException {
90+
public static List<Member<?>> parse(final Field field) throws ValidityException {
91+
Class<?> c = field.getDeclaringClass();
9192
if (c == null || field == null) return null;
9293

9394
field.setAccessible(true);

0 commit comments

Comments
 (0)