GeezerVison is showing github.com — Nil: Remove 'get' from type accessor method · IgorOffline/scijava-main@4e1f300
File treeExpand file treeCollapse file tree Open diff view settings scijava-function/templates/main/java/org/scijava/function src/main/java/org/scijava/ops/api templates/main/java/org/scijava/ops/api
main/java/org/scijava/ops/engine test/java/org/scijava/ops/engine
templates/main/java/org/scijava/ops/engine
scijava-ops-image/src/test/java/org/scijava/ops/image main/java/org/scijava/types test/java/org/scijava/types
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: scijava-function/templates/main/java/org/scijava/function/Globals.list +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -66,7 +66,7 @@ nilNames = ``` | 66 | 66 | ``` | 67 | 67 | typeArgs = ``` | 68 | 68 | { arity -> | 69 | | - String.join(', ', nilNames(arity).stream().map{a -> "${a}.getType()"}.collect()) | | 69 | + String.join(', ', nilNames(arity).stream().map{a -> "${a}.type()"}.collect()) | 70 | 70 | } | 71 | 71 | ``` | 72 | 72 | typeParamsList = ``` | |
Collapse file Copy file name to clipboardExpand all lines: scijava-function/templates/main/java/org/scijava/function/Inplaces.list +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -63,7 +63,7 @@ matchParams = ``` | 63 | 63 | ``` | 64 | 64 | typeArgs = ``` | 65 | 65 | { arity, io -> | 66 | | - String.join(', ', basicParamsList(arity, io).stream().map{a -> "${a}.getType()"}.collect()) | | 66 | + String.join(', ', basicParamsList(arity, io).stream().map{a -> "${a}.type()"}.collect()) | 67 | 67 | } | 68 | 68 | ``` | 69 | 69 | allMutableMutateParams = ``` | |
Collapse file Copy file name to clipboardExpand all lines: scijava-ops-api/src/main/java/org/scijava/ops/api/OpBuilder.java +13-13Lines changed: 13 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -129,7 +129,7 @@ public Producer<?> producer() { | 129 | 129 | final Nil<Producer<Object>> specialType = new Nil<>() { | 130 | 130 |
| 131 | 131 | @Override | 132 | | - public Type getType() { | | 132 | + public Type type() { | 133 | 133 | return Types.parameterize(Producer.class, new Type[] { Object.class }); | 134 | 134 | } | 135 | 135 | }; | @@ -798,9 +798,9 @@ public Producer<O> producer() { | 798 | 798 | final Nil<Producer<O>> specialType = new Nil<>() { | 799 | 799 |
| 800 | 800 | @Override | 801 | | - public Type getType() { | | 801 | + public Type type() { | 802 | 802 | return Types.parameterize(Producer.class, new Type[] { outType | 803 | | - .getType() }); | | 803 | + .type() }); | 804 | 804 | } | 805 | 805 | }; | 806 | 806 | return env.op(opName, specialType, new Nil<?>[0], outType, | @@ -20928,8 +20928,8 @@ private static <T> T matchFunctionHelper(final OpEnvironment env, | 20928 | 20928 | { | 20929 | 20929 | final Type[] types = new Type[inTypes.length + 1]; | 20930 | 20930 | for (int i = 0; i < inTypes.length; i++) | 20931 | | - types[i] = inTypes[i].getType(); | 20932 | | - types[types.length - 1] = outType.getType(); | | 20931 | + types[i] = inTypes[i].type(); | | 20932 | + types[types.length - 1] = outType.type(); | 20933 | 20933 | final Type specialType = Types.parameterize(opClass, types); | 20934 | 20934 | return (T) env.op(opName, Nil.of(specialType), inTypes, outType); | 20935 | 20935 | } | @@ -20941,8 +20941,8 @@ private static <T> T matchFunctionHelper(final OpEnvironment env, | 20941 | 20941 | { | 20942 | 20942 | final Type[] types = new Type[inTypes.length + 1]; | 20943 | 20943 | for (int i = 0; i < inTypes.length; i++) | 20944 | | - types[i] = inTypes[i].getType(); | 20945 | | - types[types.length - 1] = outType.getType(); | | 20944 | + types[i] = inTypes[i].type(); | | 20945 | + types[types.length - 1] = outType.type(); | 20946 | 20946 | final Type specialType = Types.parameterize(opClass, types); | 20947 | 20947 | return (T) env.op(opName, Nil.of(specialType), inTypes, outType, hints); | 20948 | 20948 | } | @@ -21653,8 +21653,8 @@ private static <T> T matchComputerHelper(final OpEnvironment env, | 21653 | 21653 | { | 21654 | 21654 | final Type[] types = new Type[inTypes.length + 1]; | 21655 | 21655 | for (int i = 0; i < inTypes.length; i++) | 21656 | | - types[i] = inTypes[i].getType(); | 21657 | | - types[types.length - 1] = outType.getType(); | | 21656 | + types[i] = inTypes[i].type(); | | 21657 | + types[types.length - 1] = outType.type(); | 21658 | 21658 | final Type specialType = Types.parameterize(opClass, types); | 21659 | 21659 | final Nil<?>[] nils = new Nil[inTypes.length + 1]; | 21660 | 21660 | System.arraycopy(inTypes, 0, nils, 0, inTypes.length); | @@ -21669,8 +21669,8 @@ private static <T> T matchComputerHelper(final OpEnvironment env, | 21669 | 21669 | { | 21670 | 21670 | final Type[] types = new Type[inTypes.length + 1]; | 21671 | 21671 | for (int i = 0; i < inTypes.length; i++) | 21672 | | - types[i] = inTypes[i].getType(); | 21673 | | - types[types.length - 1] = outType.getType(); | | 21672 | + types[i] = inTypes[i].type(); | | 21673 | + types[types.length - 1] = outType.type(); | 21674 | 21674 | final Type specialType = Types.parameterize(opClass, types); | 21675 | 21675 | final Nil<?>[] nils = new Nil[inTypes.length + 1]; | 21676 | 21676 | System.arraycopy(inTypes, 0, nils, 0, inTypes.length); | @@ -27812,7 +27812,7 @@ private static <T> T matchInplaceHelper(final OpEnvironment env, | 27812 | 27812 | { | 27813 | 27813 | final Type[] types = new Type[inTypes.length]; | 27814 | 27814 | for (int i = 0; i < inTypes.length; i++) | 27815 | | - types[i] = inTypes[i].getType(); | | 27815 | + types[i] = inTypes[i].type(); | 27816 | 27816 | final Type specialType = Types.parameterize(opClass, types); | 27817 | 27817 | return (T) env.op(opName, Nil.of(specialType), inTypes, outType); | 27818 | 27818 | } | @@ -27824,7 +27824,7 @@ private static <T> T matchInplaceHelper(final OpEnvironment env, | 27824 | 27824 | { | 27825 | 27825 | final Type[] types = new Type[inTypes.length]; | 27826 | 27826 | for (int i = 0; i < inTypes.length; i++) | 27827 | | - types[i] = inTypes[i].getType(); | | 27827 | + types[i] = inTypes[i].type(); | 27828 | 27828 | final Type specialType = Types.parameterize(opClass, types); | 27829 | 27829 | return (T) env.op(opName, Nil.of(specialType), inTypes, outType, hints); | 27830 | 27830 | } | |
Collapse file Copy file name to clipboardExpand all lines: scijava-ops-api/src/main/java/org/scijava/ops/api/OpInstance.java +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -77,17 +77,17 @@ public boolean equals(Object that) { | 77 | 77 | OpInstance<?> thatInstance = (OpInstance<?>) that; | 78 | 78 | boolean infosEqual = infoTree().equals(thatInstance.infoTree()); | 79 | 79 | boolean objectsEqual = op().equals(thatInstance.op()); | 80 | | - boolean typesEqual = getType().equals(thatInstance.getType()); | | 80 | + boolean typesEqual = type().equals(thatInstance.type()); | 81 | 81 | return infosEqual && objectsEqual && typesEqual; | 82 | 82 | } | 83 | 83 |
| 84 | 84 | @Override | 85 | 85 | public int hashCode() { | 86 | | - return Objects.hash(infoTree(), op(), getType()); | | 86 | + return Objects.hash(infoTree(), op(), type()); | 87 | 87 | } | 88 | 88 |
| 89 | 89 | @Override | 90 | | - public Type getType() { | | 90 | + public Type type() { | 91 | 91 | return reifiedType; | 92 | 92 | } | 93 | 93 |
| |
Collapse file Copy file name to clipboardExpand all lines: scijava-ops-api/src/main/java/org/scijava/ops/api/OpRequest.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -167,9 +167,9 @@ class PartialOpRequest implements OpRequest { | 167 | 167 | PartialOpRequest(String name, Nil<?>[] args, Nil<?> outType) { | 168 | 168 | this.name = name; | 169 | 169 | this.args = args == null ? null : Arrays.stream(args) // | 170 | | - .map(nil -> nil == null ? null : nil.getType()) // | | 170 | + .map(nil -> nil == null ? null : nil.type()) // | 171 | 171 | .toArray(Type[]::new); | 172 | | - this.outType = outType == null ? null : outType.getType(); | | 172 | + this.outType = outType == null ? null : outType.type(); | 173 | 173 | } | 174 | 174 |
| 175 | 175 | @Override | |
Collapse file Copy file name to clipboardExpand all lines: scijava-ops-api/src/main/java/org/scijava/ops/api/RichOp.java +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -70,8 +70,8 @@ default T op() { | 70 | 70 | */ | 71 | 71 |
| 72 | 72 | @Override | 73 | | - default Type getType() { | 74 | | - return instance().getType(); | | 73 | + default Type type() { | | 74 | + return instance().type(); | 75 | 75 | } | 76 | 76 |
| 77 | 77 | /** | |
Collapse file Copy file name to clipboardExpand all lines: scijava-ops-api/templates/main/java/org/scijava/ops/api/Globals.list +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -66,7 +66,7 @@ nilNames = ``` | 66 | 66 | ``` | 67 | 67 | typeArgs = ``` | 68 | 68 | { arity -> | 69 | | - String.join(', ', nilNames(arity).stream().map{a -> "${a}.getType()"}.collect()) | | 69 | + String.join(', ', nilNames(arity).stream().map{a -> "${a}.type()"}.collect()) | 70 | 70 | } | 71 | 71 | ``` | 72 | 72 | typeParamsList = ``` | |
Collapse file Copy file name to clipboardExpand all lines: scijava-ops-api/templates/main/java/org/scijava/ops/api/OpBuilder.vm +13-14Lines changed: 13 additions & 14 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -102,7 +102,7 @@ public class OpBuilder { | 102 | 102 | final Nil<Producer<Object>> specialType = new Nil<>() { | 103 | 103 |
| 104 | 104 | @Override | 105 | | - public Type getType() { | | 105 | + public Type type() { | 106 | 106 | return Types.parameterize(Producer.class, new Type[] { | 107 | 107 | Object.class }); | 108 | 108 | } | @@ -261,9 +261,8 @@ public class OpBuilder { | 261 | 261 | final Nil<Producer<O>> specialType = new Nil<>() { | 262 | 262 |
| 263 | 263 | @Override | 264 | | - public Type getType() { | 265 | | - return Types.parameterize(Producer.class, new Type[] { outType | 266 | | - .getType() }); | | 264 | + public Type type() { | | 265 | + return Types.parameterize(Producer.class, new Type[] { outType.type() }); | 267 | 266 | } | 268 | 267 | }; | 269 | 268 | return env.op(opName, specialType, new Nil<?>[0], outType, OpBuilder.this.hints); | @@ -863,8 +862,8 @@ public class OpBuilder { | 863 | 862 | { | 864 | 863 | final Type[] types = new Type[inTypes.length + 1]; | 865 | 864 | for (int i = 0; i < inTypes.length; i++) | 866 | | - types[i] = inTypes[i].getType(); | 867 | | - types[types.length - 1] = outType.getType(); | | 865 | + types[i] = inTypes[i].type(); | | 866 | + types[types.length - 1] = outType.type(); | 868 | 867 | final Type specialType = Types.parameterize(opClass, types); | 869 | 868 | return (T) env.op(opName, Nil.of(specialType), inTypes, outType); | 870 | 869 | } | @@ -875,8 +874,8 @@ public class OpBuilder { | 875 | 874 | { | 876 | 875 | final Type[] types = new Type[inTypes.length + 1]; | 877 | 876 | for (int i = 0; i < inTypes.length; i++) | 878 | | - types[i] = inTypes[i].getType(); | 879 | | - types[types.length - 1] = outType.getType(); | | 877 | + types[i] = inTypes[i].type(); | | 878 | + types[types.length - 1] = outType.type(); | 880 | 879 | final Type specialType = Types.parameterize(opClass, types); | 881 | 880 | return (T) env.op(opName, Nil.of(specialType), inTypes, outType, hints); | 882 | 881 | } | @@ -916,8 +915,8 @@ public class OpBuilder { | 916 | 915 | { | 917 | 916 | final Type[] types = new Type[inTypes.length + 1]; | 918 | 917 | for (int i = 0; i < inTypes.length; i++) | 919 | | - types[i] = inTypes[i].getType(); | 920 | | - types[types.length - 1] = outType.getType(); | | 918 | + types[i] = inTypes[i].type(); | | 919 | + types[types.length - 1] = outType.type(); | 921 | 920 | final Type specialType = Types.parameterize(opClass, types); | 922 | 921 | final Nil<?>[] nils = new Nil[inTypes.length + 1]; | 923 | 922 | System.arraycopy(inTypes, 0, nils, 0, inTypes.length); | @@ -930,8 +929,8 @@ public class OpBuilder { | 930 | 929 | { | 931 | 930 | final Type[] types = new Type[inTypes.length + 1]; | 932 | 931 | for (int i = 0; i < inTypes.length; i++) | 933 | | - types[i] = inTypes[i].getType(); | 934 | | - types[types.length - 1] = outType.getType(); | | 932 | + types[i] = inTypes[i].type(); | | 933 | + types[types.length - 1] = outType.type(); | 935 | 934 | final Type specialType = Types.parameterize(opClass, types); | 936 | 935 | final Nil<?>[] nils = new Nil[inTypes.length + 1]; | 937 | 936 | System.arraycopy(inTypes, 0, nils, 0, inTypes.length); | @@ -979,7 +978,7 @@ public class OpBuilder { | 979 | 978 | { | 980 | 979 | final Type[] types = new Type[inTypes.length]; | 981 | 980 | for (int i = 0; i < inTypes.length; i++) | 982 | | - types[i] = inTypes[i].getType(); | | 981 | + types[i] = inTypes[i].type(); | 983 | 982 | final Type specialType = Types.parameterize(opClass, types); | 984 | 983 | return (T) env.op(opName, Nil.of(specialType), inTypes, outType); | 985 | 984 | } | @@ -990,7 +989,7 @@ public class OpBuilder { | 990 | 989 | { | 991 | 990 | final Type[] types = new Type[inTypes.length]; | 992 | 991 | for (int i = 0; i < inTypes.length; i++) | 993 | | - types[i] = inTypes[i].getType(); | | 992 | + types[i] = inTypes[i].type(); | 994 | 993 | final Type specialType = Types.parameterize(opClass, types); | 995 | 994 | return (T) env.op(opName, Nil.of(specialType), inTypes, outType, hints); | 996 | 995 | } | |
Collapse file Copy file name to clipboardExpand all lines: scijava-ops-engine/src/main/java/org/scijava/ops/engine/impl/DefaultOpDescriptionGenerator.java +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -220,13 +220,13 @@ else if (m.getIOType() == CONTAINER) { | 220 | 220 |
| 221 | 221 | private static <T> String describeType(OpEnvironment env, Nil<T> from) { | 222 | 222 | Type specialType = Types.parameterize(Function.class, new Type[] { Types | 223 | | - .parameterize(Nil.class, new Type[] { from.getType() }), String.class }); | | 223 | + .parameterize(Nil.class, new Type[] { from.type() }), String.class }); | 224 | 224 | @SuppressWarnings("unchecked") | 225 | 225 | Nil<Function<Nil<T>, String>> specialTypeNil = | 226 | 226 | (Nil<Function<Nil<T>, String>>) Nil.of(specialType); | 227 | 227 | try { | 228 | 228 | Type nilFromType = Types.parameterize(Nil.class, new Type[] { from | 229 | | - .getType() }); | | 229 | + .type() }); | 230 | 230 | Hints h = new Hints( // | 231 | 231 | BaseOpHints.Adaptation.FORBIDDEN, // | 232 | 232 | BaseOpHints.Conversion.FORBIDDEN, // | @@ -237,7 +237,7 @@ private static <T> String describeType(OpEnvironment env, Nil<T> from) { | 237 | 237 | return op.apply(from); | 238 | 238 | } | 239 | 239 | catch (OpMatchingException e) { | 240 | | - return Types.raw(from.getType()).getSimpleName(); | | 240 | + return Types.raw(from.type()).getSimpleName(); | 241 | 241 | } | 242 | 242 | } | 243 | 243 |
| |
Collapse file Copy file name to clipboardExpand all lines: scijava-ops-engine/src/main/java/org/scijava/ops/engine/impl/DefaultOpEnvironment.java +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -228,11 +228,11 @@ public InfoTree treeFromInfo(OpInfo info, Nil<?> specialType, Hints hints) { | 228 | 228 | public <T> T opFromInfoChain(final InfoTree tree, final Nil<T> specialType, | 229 | 229 | Hints hints) | 230 | 230 | { | 231 | | - if (!(specialType.getType() instanceof ParameterizedType)) | | 231 | + if (!(specialType.type() instanceof ParameterizedType)) | 232 | 232 | throw new IllegalArgumentException("TODO"); | 233 | 233 | @SuppressWarnings("unchecked") | 234 | 234 | OpInstance<T> instance = (OpInstance<T>) tree.newInstance(specialType | 235 | | - .getType()); | | 235 | + .type()); | 236 | 236 | var conditions = MatchingConditions.from( // | 237 | 237 | new InfoMatchingOpRequest(tree.info(), Nil.of(tree.info().opType())), // | 238 | 238 | hints // | @@ -384,7 +384,7 @@ private <T> RichOp<T> findOp(final String opName, final Nil<T> specialType, | 384 | 384 | final Nil<?>[] inTypes, final Nil<?> outType, Hints hints) | 385 | 385 | { | 386 | 386 | final OpRequest request = DefaultOpRequest.fromTypes(opName, specialType | 387 | | - .getType(), outType != null ? outType.getType() : null, toTypes(inTypes)); | | 387 | + .type(), outType != null ? outType.type() : null, toTypes(inTypes)); | 388 | 388 |
| 389 | 389 | var conditions = MatchingConditions.from(request, hints); | 390 | 390 | try { | @@ -457,7 +457,7 @@ private <T> OpInstance<T> findOp(final OpInfo info, final Nil<T> specialType, | 457 | 457 | private Type[] toTypes(Nil<?>... nils) { | 458 | 458 | return Arrays.stream(nils) // | 459 | 459 | .filter(Objects::nonNull) // | 460 | | - .map(Nil::getType) // | | 460 | + .map(Nil::type) // | 461 | 461 | .toArray(Type[]::new); | 462 | 462 | } | 463 | 463 |
| @@ -554,7 +554,7 @@ private <T> RichOp<T> wrapOp(OpInstance<T> instance, | 554 | 554 | ", then you must define a new OpWrapper for that class!"); | 555 | 555 | } | 556 | 556 | // obtain the generic type of the Op w.r.t. the Wrapper class | 557 | | - Type reifiedSuperType = Types.getExactSuperType(instance.getType(), | | 557 | + Type reifiedSuperType = Types.getExactSuperType(instance.type(), | 558 | 558 | wrapper); | 559 | 559 | // wrap the Op | 560 | 560 | final OpWrapper<T> opWrapper = (OpWrapper<T>) wrappers.get(Types.raw( | @@ -567,7 +567,7 @@ private <T> RichOp<T> wrapOp(OpInstance<T> instance, | 567 | 567 | } | 568 | 568 | catch (NullPointerException e) { | 569 | 569 | throw new IllegalArgumentException("No wrapper exists for " + Types.raw( | 570 | | - instance.getType()).toString() + "."); | | 570 | + instance.type()).toString() + "."); | 571 | 571 | } | 572 | 572 | } | 573 | 573 |
| @@ -657,7 +657,7 @@ private List<RichOp<?>> resolveOpDependencies(OpInfo info, | 657 | 657 | dependencyChains.add(wrapOp(instance, conditions)); | 658 | 658 | // refine current type variable knowledge | 659 | 659 | GenericAssignability // | 660 | | - .inferTypeVariables(request.type(), instance.getType()) // | | 660 | + .inferTypeVariables(request.type(), instance.type()) // | 661 | 661 | .forEach(dependencyTypeVarAssigns::putIfAbsent); | 662 | 662 |
| 663 | 663 | } | |
|