summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/util
diff options
context:
space:
mode:
authorWade Walker <[email protected]>2014-03-07 16:32:48 -0600
committerWade Walker <[email protected]>2014-03-07 16:32:48 -0600
commit7ab26044167c84fc6386cc179e8a8736d8978c91 (patch)
tree324619f7b0dc4d5498769e04f13a9d62764236a4 /src/com/jogamp/opencl/util
parent8c406de8eb50cf785b407e2facb3502e364a66ce (diff)
Remove Java lint warnings.
Remove all Java lint warnings, by fixing the code if possible, and if not possible then by inserting @SuppressWarnings. Some of these @SuppressWarnings can be replaced later with @SafeVarargs if we eventually drop support for Java 6.
Diffstat (limited to 'src/com/jogamp/opencl/util')
-rw-r--r--src/com/jogamp/opencl/util/CLMultiContext.java2
-rw-r--r--src/com/jogamp/opencl/util/JOCLVersion.java1
-rw-r--r--src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java15
3 files changed, 12 insertions, 6 deletions
diff --git a/src/com/jogamp/opencl/util/CLMultiContext.java b/src/com/jogamp/opencl/util/CLMultiContext.java
index 156a9fa6..c5bed86b 100644
--- a/src/com/jogamp/opencl/util/CLMultiContext.java
+++ b/src/com/jogamp/opencl/util/CLMultiContext.java
@@ -41,6 +41,7 @@ public class CLMultiContext implements CLResource {
/**
* Creates a multi context with all devices of the specified platforms and types.
*/
+ @SuppressWarnings("unchecked")
public static CLMultiContext create(CLPlatform[] platforms, CLDevice.Type... types) {
return create(platforms, CLDeviceFilters.type(types));
}
@@ -48,6 +49,7 @@ public class CLMultiContext implements CLResource {
/**
* Creates a multi context with all matching devices of the specified platforms.
*/
+ @SuppressWarnings("unchecked")
public static CLMultiContext create(CLPlatform[] platforms, Filter<CLDevice>... filters) {
if(platforms == null) {
diff --git a/src/com/jogamp/opencl/util/JOCLVersion.java b/src/com/jogamp/opencl/util/JOCLVersion.java
index 7ffa3eb6..7b837486 100644
--- a/src/com/jogamp/opencl/util/JOCLVersion.java
+++ b/src/com/jogamp/opencl/util/JOCLVersion.java
@@ -48,6 +48,7 @@ import static com.jogamp.common.util.VersionUtil.*;
* @author Michael Bien
* @deprecated Use {@link com.jogamp.opencl.JoclVersion}
*/
+@Deprecated
public class JOCLVersion extends JogampVersion {
private static final String PACKAGE = "com.jogamp.opencl";
diff --git a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
index e8bd0124..a1d376ab 100644
--- a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
+++ b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
@@ -31,12 +31,12 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
private FinishAction finishAction = FinishAction.DO_NOTHING;
private boolean released;
- private CLCommandQueuePool(CLQueueContextFactory factory, Collection<CLCommandQueue> queues) {
+ private CLCommandQueuePool(CLQueueContextFactory<C> factory, Collection<CLCommandQueue> queues) {
this.contexts = initContexts(queues, factory);
initExecutor();
}
- private List<CLQueueContext> initContexts(Collection<CLCommandQueue> queues, CLQueueContextFactory factory) {
+ private List<CLQueueContext> initContexts(Collection<CLCommandQueue> queues, CLQueueContextFactory<C> factory) {
List<CLQueueContext> newContexts = new ArrayList<CLQueueContext>(queues.size());
int index = 0;
@@ -69,8 +69,8 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
return create(factory, queues);
}
- public static <C extends CLQueueContext> CLCommandQueuePool create(CLQueueContextFactory<C> factory, Collection<CLCommandQueue> queues) {
- return new CLCommandQueuePool(factory, queues);
+ public static <C extends CLQueueContext> CLCommandQueuePool<C> create(CLQueueContextFactory<C> factory, Collection<CLCommandQueue> queues) {
+ return new CLCommandQueuePool<C>(factory, queues);
}
/**
@@ -78,7 +78,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* @see ExecutorService#submit(java.util.concurrent.Callable)
*/
public <R> Future<R> submit(CLTask<? super C, R> task) {
- return excecutor.submit(new TaskWrapper(task, finishAction));
+ return excecutor.submit(new TaskWrapper<C,R>(task, finishAction));
}
/**
@@ -127,7 +127,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
* Blocks until all tasks finish and sets up a new context for all queues.
* @return this
*/
- public <C extends CLQueueContext> CLCommandQueuePool switchContext(CLQueueContextFactory<C> factory) {
+ public CLCommandQueuePool<C> switchContext(CLQueueContextFactory<C> factory) {
excecutor.shutdown();
finishQueues(); // just to be sure
@@ -255,6 +255,9 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
public R call() throws Exception {
CLQueueContext context = ((QueueThread)Thread.currentThread()).context;
+ // we make sure to only wrap tasks on the correct kind of thread, so this
+ // shouldn't fail (trying to genericize QueueThread properly becomes tricky)
+ @SuppressWarnings("unchecked")
R result = task.execute((C)context);
if(mode.equals(FinishAction.FLUSH)) {
context.queue.flush();