Skip to content

Commit f8b1044

Browse files
committed
Remove generic T[] copy Op
It was broken
1 parent a36168f commit f8b1044

3 files changed

Lines changed: 43 additions & 7 deletions

File tree

scijava-ops-engine/src/main/java/org/scijava/ops/engine/copy/CopyOpCollection.java

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ public class CopyOpCollection<T> implements OpCollection {
4747
from -> Arrays.copyOf(from, from.length);
4848

4949
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
50-
public final Computers.Arity1<T[], T[]> copyGenericArray = (from, to) -> {
50+
public final Function<byte[], byte[]> copyByteArrayFunction = byte[]::clone;
51+
52+
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
53+
public final Computers.Arity1<byte[], byte[]> copyByteArray = (from, to) -> {
5154
int arrMax = Math.max(from.length, to.length);
5255
System.arraycopy(from, 0, to, 0, arrMax);
5356
};
5457

5558
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
56-
public final Function<byte[], byte[]> copyByteArrayFunction = byte[]::clone;
57-
58-
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
59-
public final Computers.Arity1<byte[], byte[]> copyByteArray = (from, to) -> {
59+
public final Computers.Arity1<Byte[], Byte[]> copyBoxedByteArray = (from,
60+
to) -> {
6061
int arrMax = Math.max(from.length, to.length);
6162
System.arraycopy(from, 0, to, 0, arrMax);
6263
};
@@ -72,6 +73,13 @@ public class CopyOpCollection<T> implements OpCollection {
7273
System.arraycopy(from, 0, to, 0, arrMax);
7374
};
7475

76+
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
77+
public final Computers.Arity1<Short[], Short[]> copyBoxedShortArray = (from,
78+
to) -> {
79+
int arrMax = Math.max(from.length, to.length);
80+
System.arraycopy(from, 0, to, 0, arrMax);
81+
};
82+
7583
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
7684
public final Function<int[], int[]> copyIntArrayFunction = int[]::clone;
7785

@@ -81,6 +89,13 @@ public class CopyOpCollection<T> implements OpCollection {
8189
System.arraycopy(from, 0, to, 0, arrMax);
8290
};
8391

92+
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
93+
public final Computers.Arity1<Integer[], Integer[]> copyBoxedIntegerArray = (
94+
from, to) -> {
95+
int arrMax = Math.max(from.length, to.length);
96+
System.arraycopy(from, 0, to, 0, arrMax);
97+
};
98+
8499
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
85100
public final Function<long[], long[]> copyLongArrayFunction = long[]::clone;
86101

@@ -90,6 +105,13 @@ public class CopyOpCollection<T> implements OpCollection {
90105
System.arraycopy(from, 0, to, 0, arrMax);
91106
};
92107

108+
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
109+
public final Computers.Arity1<Long[], Long[]> copyBoxedLongArray = (from,
110+
to) -> {
111+
int arrMax = Math.max(from.length, to.length);
112+
System.arraycopy(from, 0, to, 0, arrMax);
113+
};
114+
93115
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
94116
public final Function<float[], float[]> copyFloatArrayFunction =
95117
float[]::clone;
@@ -101,6 +123,13 @@ public class CopyOpCollection<T> implements OpCollection {
101123
System.arraycopy(from, 0, to, 0, arrMax);
102124
};
103125

126+
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
127+
public final Computers.Arity1<Float[], Float[]> copyBoxedFloatArray = (from,
128+
to) -> {
129+
int arrMax = Math.max(from.length, to.length);
130+
System.arraycopy(from, 0, to, 0, arrMax);
131+
};
132+
104133
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
105134
public final Function<double[], double[]> copyDoubleArrayFunction =
106135
double[]::clone;
@@ -112,6 +141,13 @@ public class CopyOpCollection<T> implements OpCollection {
112141
System.arraycopy(from, 0, to, 0, arrMax);
113142
};
114143

144+
@OpField(names = "copy.array, engine.copy", params = "array, arrayCopy")
145+
public final Computers.Arity1<Double[], Double[]> copyBoxedDoubleArray = (
146+
from, to) -> {
147+
int arrMax = Math.max(from.length, to.length);
148+
System.arraycopy(from, 0, to, 0, arrMax);
149+
};
150+
115151
@OpField(names = "copy.list, engine.copy", params = "array, arrayCopy")
116152
public final Computers.Arity1<List<T>, List<T>> copyList = (from, to) -> {
117153
to.clear();

scijava-ops-engine/src/test/java/org/scijava/ops/engine/impl/ServiceLoaderDiscoveryIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void opCollectionDiscoveryRegressionIT() {
6767
final List<OpInfo> infos = discoveries.stream() //
6868
.flatMap(c -> g.generateInfosFrom(c).stream()) //
6969
.collect(Collectors.toList());
70-
Assertions.assertEquals(294, infos.size());
70+
Assertions.assertEquals(299, infos.size());
7171
}
7272

7373
}

scijava-ops-image/src/test/java/org/scijava/ops/image/OpRegressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class OpRegressionTest {
4242

4343
@Test
4444
public void opDiscoveryRegressionIT() {
45-
long expected = 1906;
45+
long expected = 1911;
4646
long actual = ops.infos().size();
4747
assertEquals(expected, actual);
4848
}

0 commit comments

Comments
 (0)