aparapi
aparapi copied to clipboard
[BOUNTY $25] Can not directly return an instantiated array.
Generating the code for the following will return an exception:
public class ReturnDoubleArrayNew extends Kernel {
double[] returnDoubleArrayNew() {
return new double[1024];
}
public void run() {
returnDoubleArrayNew();
}
}
However the following work around will compile just fine:
public class ReturnDoubleArrayVar extends Kernel {
double[] returnDoubleArrayVar() {
double[] doubles = new double[1024];
return doubles;
}
public void run() {
returnDoubleArrayVar();
}
}
I wrote a unit test which demonstrates this bug here:
https://github.com/Syncleus/aparapi/blob/master/src/test/java/com/aparapi/runtime/ReturnInstantiatedArrayDirectlyTest.java