Skip to content

Commit 3246b69

Browse files
committed
Clean up the Types class
* Remove 'get' prefix from type calculation methods. * Move all private methods down to "Helper methods" section.
1 parent e7a907b commit 3246b69

File tree

9 files changed

+349
-352
lines changed

9 files changed

+349
-352
lines changed

scijava-ops-engine/src/main/java/org/scijava/ops/engine/impl/DefaultOpEnvironment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ private <T> RichOp<T> wrapOp(OpInstance<T> instance,
554554
", then you must define a new OpWrapper for that class!");
555555
}
556556
// obtain the generic type of the Op w.r.t. the Wrapper class
557-
Type reifiedSuperType = Types.getExactSuperType(instance.type(),
557+
Type reifiedSuperType = Types.exactSuperType(instance.type(),
558558
wrapper);
559559
// wrap the Op
560560
final OpWrapper<T> opWrapper = (OpWrapper<T>) wrappers.get(Types.raw(

scijava-ops-engine/src/main/java/org/scijava/ops/engine/matcher/OpCandidate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public OpCandidate(final OpEnvironment env, final OpRequest request,
102102
public static Type getReifiedType(OpRequest request, OpInfo info,
103103
Map<TypeVariable<?>, Type> typeVarAssigns)
104104
{
105-
Type exactSuperType = Types.getExactSuperType(info.opType(), Types.raw(
105+
Type exactSuperType = Types.exactSuperType(info.opType(), Types.raw(
106106
request.type()));
107107
return Types.mapVarToTypes(exactSuperType, typeVarAssigns);
108108
}

scijava-ops-engine/src/main/java/org/scijava/ops/engine/matcher/convert/ConvertedOpInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ private static Type[] typesFromOpType(Class<?> opType, Method fMethod,
585585
Class<?> declaringClass = fMethod.getDeclaringClass();
586586
Type genericDeclaringClass = Types.parameterizeRaw(declaringClass);
587587
Type genericClass = Types.parameterizeRaw(opType);
588-
Type superGenericClass = Types.getExactSuperType(genericClass,
588+
Type superGenericClass = Types.exactSuperType(genericClass,
589589
declaringClass);
590590
GenericAssignability.inferTypeVariables(new Type[] {
591591
genericDeclaringClass }, new Type[] { superGenericClass }, map);

scijava-ops-engine/src/main/java/org/scijava/ops/engine/matcher/impl/InfoMatchingOpRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public InfoMatchingOpRequest(OpInfo info, Nil<?> specialType) {
6565
this.name = info.names().get(0);
6666
Type from = specialType.type();
6767
Type to = info.opType();
68-
this.type = Types.getExactSuperType(to, Types.raw(from));
68+
this.type = Types.exactSuperType(to, Types.raw(from));
6969
if (this.type instanceof ParameterizedType) {
7070
if (!GenericAssignability.checkGenericAssignability(from,
7171
(ParameterizedType) this.type, this.map, true))

scijava-ops-engine/src/main/java/org/scijava/ops/engine/matcher/impl/RuntimeSafeMatchingRoutine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private boolean inputsMatch(final OpCandidate candidate,
189189
final Type[] reqArgTypes = candidate.paddedArgs();
190190
final Type reqType = candidate.getRequest().type();
191191
final Type infoType = candidate.opInfo().opType();
192-
Type implementedInfoType = Types.getExactSuperType(infoType, Types.raw(
192+
Type implementedInfoType = Types.exactSuperType(infoType, Types.raw(
193193
reqType));
194194
if (!(implementedInfoType instanceof ParameterizedType)) {
195195
throw new UnsupportedOperationException(

scijava-ops-engine/src/main/java/org/scijava/ops/engine/struct/ClassParameterMemberParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public List<SynthesizedParameterMember<?>> parse(Class<?> source,
9797
private Method getDeclaredOpMethod(Class<?> c) throws NoSuchMethodException {
9898
// NB this is the functional method w.r.t. the interface, not w.r.t. the Op
9999
Method fMethod = FunctionalInterfaces.functionalMethodOf(c);
100-
Type[] paramTypes = Types.getExactParameterTypes(fMethod, c);
100+
Type[] paramTypes = Types.exactParamTypes(fMethod, c);
101101
Class<?>[] rawParamTypes = Arrays.stream(paramTypes).map(t -> Types.raw(t))
102102
.toArray(Class[]::new);
103103
try {

scijava-ops-engine/src/main/java/org/scijava/ops/engine/struct/FunctionalParameters.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static List<FunctionalMethodType> findFunctionalMethodTypes(
112112

113113
List<FunctionalMethodType> out = new ArrayList<>();
114114
int i = 0;
115-
for (Type t : Types.getExactParameterTypes(functionalMethod,
115+
for (Type t : Types.exactParamTypes(functionalMethod,
116116
paramfunctionalType))
117117
{
118118
final ItemIO ioType;
@@ -125,7 +125,7 @@ else if (AnnotationUtils.getMethodParameterAnnotation(functionalMethod, i,
125125
i++;
126126
}
127127

128-
Type returnType = Types.getExactReturnType(functionalMethod,
128+
Type returnType = Types.exactReturnType(functionalMethod,
129129
paramfunctionalType);
130130
if (!returnType.equals(void.class)) {
131131
out.add(new FunctionalMethodType(returnType, ItemIO.OUTPUT));

0 commit comments

Comments
 (0)