From 822bcd130061ba701f882076f71ca39709b6fe89 Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Wed, 15 Apr 2020 17:10:05 -0700 Subject: [PATCH] suppress more javac warnings about unchecked casts --- jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java | 1 + jme3-core/src/main/java/com/jme3/app/LegacyApplication.java | 1 + .../src/main/java/com/jme3/app/state/AppStateManager.java | 1 + jme3-core/src/main/java/com/jme3/asset/AssetConfig.java | 1 + jme3-core/src/main/java/com/jme3/asset/AssetKey.java | 1 + .../main/java/com/jme3/asset/cache/SimpleAssetCache.java | 1 + .../main/java/com/jme3/asset/cache/WeakRefAssetCache.java | 1 + .../java/com/jme3/asset/cache/WeakRefCloneAssetCache.java | 1 + .../main/java/com/jme3/cinematic/events/AnimationEvent.java | 2 ++ .../main/java/com/jme3/environment/EnvironmentCamera.java | 1 + .../generation/IrradianceSphericalHarmonicsGenerator.java | 1 + .../generation/PrefilteredEnvMapFaceGenerator.java | 1 + .../src/main/java/com/jme3/export/SavableClassUtil.java | 3 +++ .../src/main/java/com/jme3/post/FilterPostProcessor.java | 3 +++ .../src/main/java/com/jme3/renderer/opengl/GLTiming.java | 1 + .../src/main/java/com/jme3/renderer/queue/GeometryList.java | 1 + jme3-core/src/main/java/com/jme3/scene/Spatial.java | 5 +++++ .../java/com/jme3/scene/instancing/InstancedGeometry.java | 1 + jme3-core/src/main/java/com/jme3/shader/BufferObject.java | 6 ++++++ .../src/main/java/com/jme3/shader/ShaderGenerator.java | 1 + .../src/main/java/com/jme3/shadow/AbstractShadowFilter.java | 1 + jme3-core/src/main/java/com/jme3/util/IntMap.java | 5 +++++ jme3-core/src/main/java/com/jme3/util/ListMap.java | 5 +++++ jme3-core/src/main/java/com/jme3/util/ListSort.java | 2 ++ .../src/main/java/com/jme3/util/MaterialDebugAppState.java | 1 + jme3-core/src/main/java/com/jme3/util/SafeArrayList.java | 3 +++ jme3-core/src/main/java/com/jme3/util/SortUtil.java | 3 +++ .../test/java/com/jme3/material/plugins/J3MLoaderTest.java | 1 + .../src/tools/java/jme3tools/optimize/TextureAtlas.java | 1 + .../src/main/java/com/jme3/system/JmeDesktopSystem.java | 1 + .../src/main/java/com/jme3/audio/plugins/OGGLoader.java | 1 + .../src/main/java/com/jme3/system/lwjgl/LwjglContext.java | 1 + jme3-networking/src/main/java/com/jme3/network/Filters.java | 2 ++ .../src/main/java/com/jme3/network/base/DefaultClient.java | 1 + .../src/main/java/com/jme3/network/rmi/ObjectStore.java | 2 ++ .../src/main/java/com/jme3/network/rmi/RmiSerializer.java | 1 + .../network/serializing/serializers/FieldSerializer.java | 1 + .../main/java/com/jme3/network/service/AbstractService.java | 1 + .../java/com/jme3/network/service/rmi/RmiClientService.java | 1 + .../java/com/jme3/network/service/rmi/RmiHostedService.java | 1 + .../java/com/jme3/network/service/rpc/RpcClientService.java | 2 ++ .../fbx/java/com/jme3/scene/plugins/fbx/mesh/FbxMesh.java | 1 + .../com/jme3/scene/plugins/gltf/CustomContentManager.java | 2 ++ .../src/xml/java/com/jme3/export/xml/DOMInputCapsule.java | 3 +++ .../terrain/geomipmap/picking/BresenhamTerrainPicker.java | 1 + 45 files changed, 78 insertions(+) diff --git a/jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java b/jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java index 6f075aa33..42244df19 100644 --- a/jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java +++ b/jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java @@ -438,6 +438,7 @@ public class Tweens { this.method.setAccessible(true); } + @SuppressWarnings("unchecked") private static Method findMethod(Class type, String name, Object... args) { for (Method m : type.getDeclaredMethods()) { if (!Objects.equals(m.getName(), name)) { diff --git a/jme3-core/src/main/java/com/jme3/app/LegacyApplication.java b/jme3-core/src/main/java/com/jme3/app/LegacyApplication.java index 2e020f28b..9956d3349 100644 --- a/jme3-core/src/main/java/com/jme3/app/LegacyApplication.java +++ b/jme3-core/src/main/java/com/jme3/app/LegacyApplication.java @@ -718,6 +718,7 @@ public class LegacyApplication implements Application, SystemListener { * @param runnable The runnable to run in the main jME3 thread */ @Override + @SuppressWarnings("unchecked") public void enqueue(Runnable runnable){ enqueue(new RunnableWrapper(runnable)); } diff --git a/jme3-core/src/main/java/com/jme3/app/state/AppStateManager.java b/jme3-core/src/main/java/com/jme3/app/state/AppStateManager.java index 96a7295d3..5271debe7 100644 --- a/jme3-core/src/main/java/com/jme3/app/state/AppStateManager.java +++ b/jme3-core/src/main/java/com/jme3/app/state/AppStateManager.java @@ -242,6 +242,7 @@ public class AppStateManager { * @return First attached state that is an instance of stateClass. If failOnMiss is true * then an IllegalArgumentException is thrown if the state is not attached. */ + @SuppressWarnings("unchecked") public T getState(Class stateClass, boolean failOnMiss){ synchronized (states){ AppState[] array = getStates(); diff --git a/jme3-core/src/main/java/com/jme3/asset/AssetConfig.java b/jme3-core/src/main/java/com/jme3/asset/AssetConfig.java index bef9cfece..d172d9ed6 100644 --- a/jme3-core/src/main/java/com/jme3/asset/AssetConfig.java +++ b/jme3-core/src/main/java/com/jme3/asset/AssetConfig.java @@ -65,6 +65,7 @@ public final class AssetConfig { } } + @SuppressWarnings("unchecked") public static void loadText(AssetManager assetManager, URL configUrl) throws IOException{ InputStream in = configUrl.openStream(); try { diff --git a/jme3-core/src/main/java/com/jme3/asset/AssetKey.java b/jme3-core/src/main/java/com/jme3/asset/AssetKey.java index f8439c111..ed9a15c2e 100644 --- a/jme3-core/src/main/java/com/jme3/asset/AssetKey.java +++ b/jme3-core/src/main/java/com/jme3/asset/AssetKey.java @@ -59,6 +59,7 @@ public class AssetKey implements Savable, Cloneable { } @Override + @SuppressWarnings("unchecked") public AssetKey clone() { try { return (AssetKey) super.clone(); diff --git a/jme3-core/src/main/java/com/jme3/asset/cache/SimpleAssetCache.java b/jme3-core/src/main/java/com/jme3/asset/cache/SimpleAssetCache.java index 94818a159..cd13d8dc7 100644 --- a/jme3-core/src/main/java/com/jme3/asset/cache/SimpleAssetCache.java +++ b/jme3-core/src/main/java/com/jme3/asset/cache/SimpleAssetCache.java @@ -56,6 +56,7 @@ public class SimpleAssetCache implements AssetCache { } @Override + @SuppressWarnings("unchecked") public T getFromCache(AssetKey key) { return (T) keyToAssetMap.get(key); } diff --git a/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java b/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java index 23e96fd38..bd94a6819 100644 --- a/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java +++ b/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java @@ -95,6 +95,7 @@ public class WeakRefAssetCache implements AssetCache { } @Override + @SuppressWarnings("unchecked") public T getFromCache(AssetKey key) { AssetRef ref = assetCache.get(key); if (ref != null){ diff --git a/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java b/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java index 989376c3d..70a21b457 100644 --- a/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java +++ b/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java @@ -157,6 +157,7 @@ public class WeakRefCloneAssetCache implements AssetCache { } @Override + @SuppressWarnings("unchecked") public T getFromCache(AssetKey key) { AssetRef smartInfo = smartCache.get(key); if (smartInfo == null) { diff --git a/jme3-core/src/main/java/com/jme3/cinematic/events/AnimationEvent.java b/jme3-core/src/main/java/com/jme3/cinematic/events/AnimationEvent.java index cc409b8ec..b56136893 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/events/AnimationEvent.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/events/AnimationEvent.java @@ -284,6 +284,7 @@ public class AnimationEvent extends AbstractCinematicEvent { } @Override + @SuppressWarnings("unchecked") public void initEvent(Application app, Cinematic cinematic) { super.initEvent(app, cinematic); this.cinematic = cinematic; @@ -451,6 +452,7 @@ public class AnimationEvent extends AbstractCinematicEvent { } @Override + @SuppressWarnings("unchecked") public void dispose() { super.dispose(); if (cinematic != null) { diff --git a/jme3-core/src/main/java/com/jme3/environment/EnvironmentCamera.java b/jme3-core/src/main/java/com/jme3/environment/EnvironmentCamera.java index 6f2f82143..92163d398 100644 --- a/jme3-core/src/main/java/com/jme3/environment/EnvironmentCamera.java +++ b/jme3-core/src/main/java/com/jme3/environment/EnvironmentCamera.java @@ -368,6 +368,7 @@ public class EnvironmentCamera extends BaseAppState { JobProgressListener callback; Spatial scene; + @SuppressWarnings("unchecked") public SnapshotJob(JobProgressListener callback, Spatial scene) { this.callback = callback; this.scene = scene; diff --git a/jme3-core/src/main/java/com/jme3/environment/generation/IrradianceSphericalHarmonicsGenerator.java b/jme3-core/src/main/java/com/jme3/environment/generation/IrradianceSphericalHarmonicsGenerator.java index 7a3f637ff..91ab48db2 100644 --- a/jme3-core/src/main/java/com/jme3/environment/generation/IrradianceSphericalHarmonicsGenerator.java +++ b/jme3-core/src/main/java/com/jme3/environment/generation/IrradianceSphericalHarmonicsGenerator.java @@ -101,6 +101,7 @@ public class IrradianceSphericalHarmonicsGenerator extends RunnableWithProgress app.enqueue(new Callable() { @Override + @SuppressWarnings("unchecked") public Void call() throws Exception { listener.done(6); return null; diff --git a/jme3-core/src/main/java/com/jme3/environment/generation/PrefilteredEnvMapFaceGenerator.java b/jme3-core/src/main/java/com/jme3/environment/generation/PrefilteredEnvMapFaceGenerator.java index 6d37f90fb..51a401e66 100644 --- a/jme3-core/src/main/java/com/jme3/environment/generation/PrefilteredEnvMapFaceGenerator.java +++ b/jme3-core/src/main/java/com/jme3/environment/generation/PrefilteredEnvMapFaceGenerator.java @@ -137,6 +137,7 @@ public class PrefilteredEnvMapFaceGenerator extends RunnableWithProgress { app.enqueue(new Callable() { @Override + @SuppressWarnings("unchecked") public Void call() throws Exception { listener.done(face); return null; diff --git a/jme3-core/src/main/java/com/jme3/export/SavableClassUtil.java b/jme3-core/src/main/java/com/jme3/export/SavableClassUtil.java index 2e206a416..5861ab894 100644 --- a/jme3-core/src/main/java/com/jme3/export/SavableClassUtil.java +++ b/jme3-core/src/main/java/com/jme3/export/SavableClassUtil.java @@ -90,6 +90,7 @@ public class SavableClassUtil { return result; } + @SuppressWarnings("unchecked") public static int[] getSavableVersions(Class clazz) throws IOException{ ArrayList versionList = new ArrayList(); Class superclass = clazz; @@ -105,6 +106,7 @@ public class SavableClassUtil { return versions; } + @SuppressWarnings("unchecked") public static int getSavableVersion(Class clazz) throws IOException{ try { Field field = clazz.getField("SAVABLE_VERSION"); @@ -221,6 +223,7 @@ public class SavableClassUtil { * * @return the pre-existing constructor (not null) */ + @SuppressWarnings("unchecked") private static Constructor findNoArgConstructor(String className) throws ClassNotFoundException, InstantiationException { Class clazz = Class.forName(className); diff --git a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java index 628540235..644f1a556 100644 --- a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java +++ b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java @@ -551,6 +551,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable { } @Override + @SuppressWarnings("unchecked") public void write(JmeExporter ex) throws IOException { OutputCapsule oc = ex.getCapsule(this); oc.write(numSamples, "numSamples", 0); @@ -558,6 +559,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable { } @Override + @SuppressWarnings("unchecked") public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); numSamples = ic.readInt("numSamples", 0); @@ -593,6 +595,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable { * @param filterType the filter type * @return a filter assignable form the given type */ + @SuppressWarnings("unchecked") public T getFilter(Class filterType) { for (Filter c : filters.getArray()) { if (filterType.isAssignableFrom(c.getClass())) { diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTiming.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTiming.java index 7e6833b8b..1ba235688 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTiming.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLTiming.java @@ -62,6 +62,7 @@ public class GLTiming implements InvocationHandler { } @Override + @SuppressWarnings("unchecked") public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); if (methodName.equals("resetStats")) { diff --git a/jme3-core/src/main/java/com/jme3/renderer/queue/GeometryList.java b/jme3-core/src/main/java/com/jme3/renderer/queue/GeometryList.java index 796050d6a..bbe1986c8 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/queue/GeometryList.java +++ b/jme3-core/src/main/java/com/jme3/renderer/queue/GeometryList.java @@ -149,6 +149,7 @@ public class GeometryList implements Iterable{ /** * Sorts the elements in the list according to their Comparator. */ + @SuppressWarnings("unchecked") public void sort() { if (size > 1) { // sort the spatial list using the comparator diff --git a/jme3-core/src/main/java/com/jme3/scene/Spatial.java b/jme3-core/src/main/java/com/jme3/scene/Spatial.java index ab3cf0d47..e76b65e1d 100644 --- a/jme3-core/src/main/java/com/jme3/scene/Spatial.java +++ b/jme3-core/src/main/java/com/jme3/scene/Spatial.java @@ -837,6 +837,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab * * @see Spatial#addControl(com.jme3.scene.control.Control) */ + @SuppressWarnings("unchecked") public T getControl(Class controlType) { for (Control c : controls.getArray()) { if (controlType.isAssignableFrom(c.getClass())) { @@ -1435,6 +1436,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab * Called internally by com.jme3.util.clone.Cloner. Do not call directly. */ @Override + @SuppressWarnings("unchecked") public void cloneFields( Cloner cloner, Object original ) { // Clone all of the fields that need fix-ups and/or potential @@ -1502,6 +1504,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab } } + @SuppressWarnings("unchecked") public Collection getUserDataKeys() { if (userData != null) { return userData.keySet(); @@ -1540,6 +1543,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab } @Override + @SuppressWarnings("unchecked") public void write(JmeExporter ex) throws IOException { OutputCapsule capsule = ex.getCapsule(this); capsule.write(name, "name", null); @@ -1558,6 +1562,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab } @Override + @SuppressWarnings("unchecked") public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); diff --git a/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java b/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java index 0ec4bed4d..571b74d9e 100644 --- a/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java +++ b/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java @@ -375,6 +375,7 @@ public class InstancedGeometry extends Geometry { return geometries; } + @SuppressWarnings("unchecked") public VertexBuffer[] getAllInstanceData() { ArrayList allData = new ArrayList(); if (transformInstanceData != null) { diff --git a/jme3-core/src/main/java/com/jme3/shader/BufferObject.java b/jme3-core/src/main/java/com/jme3/shader/BufferObject.java index 886f4a1ab..edbed3841 100644 --- a/jme3-core/src/main/java/com/jme3/shader/BufferObject.java +++ b/jme3-core/src/main/java/com/jme3/shader/BufferObject.java @@ -226,6 +226,7 @@ public class BufferObject extends NativeObject { * @param the value's type. * @return the current value. */ + @SuppressWarnings("unchecked") public T getFieldValue(final String name) { final BufferObjectField field = fields.get(name); @@ -492,6 +493,7 @@ public class BufferObject extends NativeObject { * @param data the data buffer. * @param value the value. */ + @SuppressWarnings("unchecked") protected void writeMat3Array(final ByteBuffer data, final Object value) { if (value instanceof Matrix3f[]) { @@ -523,6 +525,7 @@ public class BufferObject extends NativeObject { * @param data the data buffer. * @param value the value. */ + @SuppressWarnings("unchecked") protected void writeMat4Array(final ByteBuffer data, final Object value) { if (value instanceof Matrix4f[]) { @@ -555,6 +558,7 @@ public class BufferObject extends NativeObject { * @param data the data buffer. * @param value the value. */ + @SuppressWarnings("unchecked") protected void writeVec4Array(final ByteBuffer data, final Object value) { if (value instanceof Object[]) { @@ -586,6 +590,7 @@ public class BufferObject extends NativeObject { * @param data the data buffer. * @param value the value. */ + @SuppressWarnings("unchecked") protected void writeVec3Array(final ByteBuffer data, final Object value) { if (value instanceof Vector3f[]) { @@ -617,6 +622,7 @@ public class BufferObject extends NativeObject { * @param data the data buffer. * @param value the value. */ + @SuppressWarnings("unchecked") protected void writeVec2Array(final ByteBuffer data, final Object value) { if (value instanceof Vector2f[]) { diff --git a/jme3-core/src/main/java/com/jme3/shader/ShaderGenerator.java b/jme3-core/src/main/java/com/jme3/shader/ShaderGenerator.java index a86340ab9..217c5e8d4 100644 --- a/jme3-core/src/main/java/com/jme3/shader/ShaderGenerator.java +++ b/jme3-core/src/main/java/com/jme3/shader/ShaderGenerator.java @@ -194,6 +194,7 @@ public abstract class ShaderGenerator { * @param info the ShaderGenerationInfo * @param type the Shader type */ + @SuppressWarnings("unchecked") protected void generateDeclarationAndMainBody(List shaderNodes, StringBuilder sourceDeclaration, StringBuilder source, ShaderGenerationInfo info, Shader.ShaderType type) { for (ShaderNode shaderNode : shaderNodes) { if (info.getUnusedNodes().contains(shaderNode.getName())) { diff --git a/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowFilter.java b/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowFilter.java index abdbe054d..ab98e7dd5 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowFilter.java +++ b/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowFilter.java @@ -328,6 +328,7 @@ public abstract class AbstractShadowFilter ext } @Override + @SuppressWarnings("unchecked") public AbstractShadowFilter jmeClone() { try { return (AbstractShadowFilter) super.clone(); diff --git a/jme3-core/src/main/java/com/jme3/util/IntMap.java b/jme3-core/src/main/java/com/jme3/util/IntMap.java index c1c9b0abe..cc8cff33d 100644 --- a/jme3-core/src/main/java/com/jme3/util/IntMap.java +++ b/jme3-core/src/main/java/com/jme3/util/IntMap.java @@ -80,6 +80,7 @@ public final class IntMap implements Iterable>, Cloneable, JmeClonea } @Override + @SuppressWarnings("unchecked") public IntMap clone(){ try{ IntMap clone = (IntMap) super.clone(); @@ -137,6 +138,7 @@ public final class IntMap implements Iterable>, Cloneable, JmeClonea return false; } + @SuppressWarnings("unchecked") public T get(int key) { int index = key & mask; for (Entry e = table[index]; e != null; e = e.next){ @@ -147,6 +149,7 @@ public final class IntMap implements Iterable>, Cloneable, JmeClonea return null; } + @SuppressWarnings("unchecked") public T put(int key, T value) { int index = key & mask; // Check if key already exists. @@ -186,6 +189,7 @@ public final class IntMap implements Iterable>, Cloneable, JmeClonea return null; } + @SuppressWarnings("unchecked") public T remove(int key) { int index = key & mask; Entry prev = table[index]; @@ -320,6 +324,7 @@ public final class IntMap implements Iterable>, Cloneable, JmeClonea } @Override + @SuppressWarnings("unchecked") public Entry clone(){ try{ Entry clone = (Entry) super.clone(); diff --git a/jme3-core/src/main/java/com/jme3/util/ListMap.java b/jme3-core/src/main/java/com/jme3/util/ListMap.java index ea8b0f363..be627c783 100644 --- a/jme3-core/src/main/java/com/jme3/util/ListMap.java +++ b/jme3-core/src/main/java/com/jme3/util/ListMap.java @@ -74,6 +74,7 @@ public final class ListMap extends AbstractMap implements Cloneable, } @Override + @SuppressWarnings("unchecked") public boolean equals(Object obj) { if (obj == null) { return false; @@ -103,18 +104,21 @@ public final class ListMap extends AbstractMap implements Cloneable, // private final ArrayList> entries; + @SuppressWarnings("unchecked") public ListMap(){ entries = new ListMapEntry[4]; backingMap = new HashMap(4); // entries = new ArrayList>(); } + @SuppressWarnings("unchecked") public ListMap(int initialCapacity){ entries = new ListMapEntry[initialCapacity]; backingMap = new HashMap(initialCapacity); // entries = new ArrayList>(initialCapacity); } + @SuppressWarnings("unchecked") public ListMap(Map map){ entries = new ListMapEntry[map.size()]; backingMap = new HashMap(map.size()); @@ -195,6 +199,7 @@ public final class ListMap extends AbstractMap implements Cloneable, } @Override + @SuppressWarnings("unchecked") public V put(K key, V value) { if (backingMap.containsKey(key)){ // set the value on the entry diff --git a/jme3-core/src/main/java/com/jme3/util/ListSort.java b/jme3-core/src/main/java/com/jme3/util/ListSort.java index cbb038bca..68379672e 100644 --- a/jme3-core/src/main/java/com/jme3/util/ListSort.java +++ b/jme3-core/src/main/java/com/jme3/util/ListSort.java @@ -131,6 +131,7 @@ public class ListSort { * * @param len */ + @SuppressWarnings("unchecked") public final void allocateStack(int len) { length = len; @@ -995,6 +996,7 @@ public class ListSort { /* * test case */ + @SuppressWarnings("unchecked") public static void main(String[] argv) { Integer[] arr = new Integer[]{5, 6, 2, 9, 10, 11, 12, 8, 3, 12, 3, 7, 12, 32, 458, 12, 5, 3, 78, 45, 12, 32, 58, 45, 65, 45, 98, 45, 65, 2, 3, 47, 21, 35}; ListSort ls = new ListSort(); diff --git a/jme3-core/src/main/java/com/jme3/util/MaterialDebugAppState.java b/jme3-core/src/main/java/com/jme3/util/MaterialDebugAppState.java index 9aafe44ce..a38a26a85 100644 --- a/jme3-core/src/main/java/com/jme3/util/MaterialDebugAppState.java +++ b/jme3-core/src/main/java/com/jme3/util/MaterialDebugAppState.java @@ -299,6 +299,7 @@ public class MaterialDebugAppState extends AbstractAppState { } @Override + @SuppressWarnings("unchecked") public void reload() { Field[] fields1 = filter.getClass().getDeclaredFields(); Field[] fields2 = filter.getClass().getSuperclass().getDeclaredFields(); diff --git a/jme3-core/src/main/java/com/jme3/util/SafeArrayList.java b/jme3-core/src/main/java/com/jme3/util/SafeArrayList.java index 73759f03c..b85cc2226 100644 --- a/jme3-core/src/main/java/com/jme3/util/SafeArrayList.java +++ b/jme3-core/src/main/java/com/jme3/util/SafeArrayList.java @@ -104,6 +104,7 @@ public class SafeArrayList implements List, Cloneable { } @Override + @SuppressWarnings("unchecked") public SafeArrayList clone() { try { SafeArrayList clone = (SafeArrayList)super.clone(); @@ -122,6 +123,7 @@ public class SafeArrayList implements List, Cloneable { } } + @SuppressWarnings("unchecked") protected final T[] createArray(Class type, int size) { return (T[])java.lang.reflect.Array.newInstance(type, size); } @@ -194,6 +196,7 @@ public class SafeArrayList implements List, Cloneable { } @Override + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { E[] array = getArray(); diff --git a/jme3-core/src/main/java/com/jme3/util/SortUtil.java b/jme3-core/src/main/java/com/jme3/util/SortUtil.java index 104e35a9e..5f99631d6 100644 --- a/jme3-core/src/main/java/com/jme3/util/SortUtil.java +++ b/jme3-core/src/main/java/com/jme3/util/SortUtil.java @@ -73,6 +73,7 @@ public class SortUtil { end procedure */ + @SuppressWarnings("unchecked") public static void gsort(Object[] a, Comparator comp) { int pos = 1; int last = 0; @@ -241,6 +242,7 @@ end procedure } } + @SuppressWarnings("unchecked") public static void qsort(int[] a, int lo0, int hi0, Comparator comp) { // bail out if we're already done if (hi0 <= lo0) { @@ -324,6 +326,7 @@ end procedure } } + @SuppressWarnings("unchecked") private static void merge(Object[] src, Object[] dest, int low, int middle, int high, Comparator comp) { int leftEnd = middle - 1; diff --git a/jme3-core/src/test/java/com/jme3/material/plugins/J3MLoaderTest.java b/jme3-core/src/test/java/com/jme3/material/plugins/J3MLoaderTest.java index b60e82c64..4e10a450c 100644 --- a/jme3-core/src/test/java/com/jme3/material/plugins/J3MLoaderTest.java +++ b/jme3-core/src/test/java/com/jme3/material/plugins/J3MLoaderTest.java @@ -46,6 +46,7 @@ public class J3MLoaderTest { private MaterialDef materialDef; @Before + @SuppressWarnings("unchecked") public void setUp() throws Exception { when(assetKey.getExtension()).thenReturn(".j3m"); when(assetInfo.getManager()).thenReturn(assetManager); diff --git a/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java b/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java index c254580b2..aba3a4066 100644 --- a/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java +++ b/jme3-core/src/tools/java/jme3tools/optimize/TextureAtlas.java @@ -348,6 +348,7 @@ public class TextureAtlas { } } + @SuppressWarnings("unchecked") private Image convertImageToAwt(Image source) { //use awt dependent classes without actual dependency via reflection try { diff --git a/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java b/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java index d5f2e420b..f5fb45af2 100644 --- a/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java +++ b/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java @@ -261,6 +261,7 @@ public class JmeDesktopSystem extends JmeSystemDelegate { return ctx; } + @SuppressWarnings("unchecked") private T newObject(String className) { try { Class clazz = (Class) Class.forName(className); diff --git a/jme3-jogg/src/main/java/com/jme3/audio/plugins/OGGLoader.java b/jme3-jogg/src/main/java/com/jme3/audio/plugins/OGGLoader.java index 5250362d9..dda6e5ab1 100644 --- a/jme3-jogg/src/main/java/com/jme3/audio/plugins/OGGLoader.java +++ b/jme3-jogg/src/main/java/com/jme3/audio/plugins/OGGLoader.java @@ -260,6 +260,7 @@ public class OGGLoader implements AssetLoader { } } + @SuppressWarnings("unchecked") private AudioData load(InputStream in, boolean readStream, boolean streamCache) throws IOException{ if (readStream && streamCache){ oggStream = new CachedOggStream(in); diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java index 65fe2deed..2801ef0e1 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java @@ -288,6 +288,7 @@ public abstract class LwjglContext implements JmeContext { } } + @SuppressWarnings("unchecked") protected void initOpenCL(final long window) { logger.info("Initialize OpenCL with LWJGL3"); diff --git a/jme3-networking/src/main/java/com/jme3/network/Filters.java b/jme3-networking/src/main/java/com/jme3/network/Filters.java index ebcc52b22..277912ae5 100644 --- a/jme3-networking/src/main/java/com/jme3/network/Filters.java +++ b/jme3-networking/src/main/java/com/jme3/network/Filters.java @@ -47,6 +47,7 @@ public class Filters * Creates a filter that returns true for any value in the specified * list of values and false for all other cases. */ + @SuppressWarnings("unchecked") public static Filter in( T... values ) { return in( new HashSet(Arrays.asList(values)) ); @@ -66,6 +67,7 @@ public class Filters * list of values and false for all other cases. This is the equivalent * of calling not(in(values)). */ + @SuppressWarnings("unchecked") public static Filter notIn( T... values ) { return not( in( values ) ); diff --git a/jme3-networking/src/main/java/com/jme3/network/base/DefaultClient.java b/jme3-networking/src/main/java/com/jme3/network/base/DefaultClient.java index eec00323f..8bfd660b3 100644 --- a/jme3-networking/src/main/java/com/jme3/network/base/DefaultClient.java +++ b/jme3-networking/src/main/java/com/jme3/network/base/DefaultClient.java @@ -410,6 +410,7 @@ public class DefaultClient implements Client * Either calls the ErrorListener or closes the connection * if there are no listeners. */ + @SuppressWarnings("unchecked") protected void handleError( Throwable t ) { // If there are no listeners then close the connection with diff --git a/jme3-networking/src/main/java/com/jme3/network/rmi/ObjectStore.java b/jme3-networking/src/main/java/com/jme3/network/rmi/ObjectStore.java index 7313be0d8..d2bd13692 100644 --- a/jme3-networking/src/main/java/com/jme3/network/rmi/ObjectStore.java +++ b/jme3-networking/src/main/java/com/jme3/network/rmi/ObjectStore.java @@ -129,6 +129,7 @@ public class ObjectStore { Serializer.registerClass(RemoteMethodReturnMessage.class, s); } + @SuppressWarnings("unchecked") public ObjectStore(Client client) { this.client = client; client.addMessageListener(clientEventHandler, @@ -187,6 +188,7 @@ public class ObjectStore { } } + @SuppressWarnings("unchecked") public T getExposedObject(String name, Class type, boolean waitFor) throws InterruptedException{ RemoteObject ro = remoteObjects.get(name); if (ro == null){ diff --git a/jme3-networking/src/main/java/com/jme3/network/rmi/RmiSerializer.java b/jme3-networking/src/main/java/com/jme3/network/rmi/RmiSerializer.java index 8f55178d0..30446eeda 100644 --- a/jme3-networking/src/main/java/com/jme3/network/rmi/RmiSerializer.java +++ b/jme3-networking/src/main/java/com/jme3/network/rmi/RmiSerializer.java @@ -235,6 +235,7 @@ public class RmiSerializer extends Serializer { } @Override + @SuppressWarnings("unchecked") public T readObject(ByteBuffer data, Class c) throws IOException { if (c == RemoteObjectDefMessage.class){ return (T) readObjectDefs(data); diff --git a/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java b/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java index bbe2db278..296c344fd 100644 --- a/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java +++ b/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java @@ -55,6 +55,7 @@ public class FieldSerializer extends Serializer { private static Map savedFields = new HashMap(); private static Map savedCtors = new HashMap(); + @SuppressWarnings("unchecked") protected void checkClass(Class clazz) { // See if the class has a public no-arg constructor diff --git a/jme3-networking/src/main/java/com/jme3/network/service/AbstractService.java b/jme3-networking/src/main/java/com/jme3/network/service/AbstractService.java index 3123e8c82..055086e1b 100644 --- a/jme3-networking/src/main/java/com/jme3/network/service/AbstractService.java +++ b/jme3-networking/src/main/java/com/jme3/network/service/AbstractService.java @@ -60,6 +60,7 @@ public abstract class AbstractService implements Servi * Retrieves the first sibling service of the specified * type. */ + @SuppressWarnings("unchecked") protected > T getService( Class type ) { return type.cast(serviceManager.getService(type)); } diff --git a/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiClientService.java b/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiClientService.java index ea1506f72..0beb20bdf 100644 --- a/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiClientService.java +++ b/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiClientService.java @@ -160,6 +160,7 @@ public class RmiClientService extends AbstractClientService { } @Override + @SuppressWarnings("unchecked") public void start() { super.start(); diff --git a/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiHostedService.java b/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiHostedService.java index 766627464..e41e23599 100644 --- a/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiHostedService.java +++ b/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiHostedService.java @@ -180,6 +180,7 @@ public class RmiHostedService extends AbstractHostedService { * This method is called automatically for all new connections if * autohost is set to true. */ + @SuppressWarnings("unchecked") public void startHostingOnConnection( HostedConnection hc ) { if( log.isLoggable(Level.FINEST) ) { log.log(Level.FINEST, "startHostingOnConnection:{0}", hc); diff --git a/jme3-networking/src/main/java/com/jme3/network/service/rpc/RpcClientService.java b/jme3-networking/src/main/java/com/jme3/network/service/rpc/RpcClientService.java index a74a7c7d1..e4bb42bec 100644 --- a/jme3-networking/src/main/java/com/jme3/network/service/rpc/RpcClientService.java +++ b/jme3-networking/src/main/java/com/jme3/network/service/rpc/RpcClientService.java @@ -73,6 +73,7 @@ public class RpcClientService extends AbstractClientService { * Used internally to setup the RpcConnection and MessageDelegator. */ @Override + @SuppressWarnings("unchecked") protected void onInitialize( ClientServiceManager serviceManager ) { Client client = serviceManager.getClient(); this.rpc = new RpcConnection(client); @@ -86,6 +87,7 @@ public class RpcClientService extends AbstractClientService { * was previously added to the network Client. */ @Override + @SuppressWarnings("unchecked") public void terminate( ClientServiceManager serviceManager ) { Client client = serviceManager.getClient(); client.removeMessageListener(delegator, delegator.getMessageTypes()); diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/mesh/FbxMesh.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/mesh/FbxMesh.java index 5dd911bed..a5966136f 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/mesh/FbxMesh.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/mesh/FbxMesh.java @@ -110,6 +110,7 @@ public final class FbxMesh extends FbxNodeAttribute> { return skinDeformer; } + @SuppressWarnings("unchecked") public void applyCluster(FbxCluster cluster) { if (boneIndices == null) { boneIndices = new ArrayList[positions.length]; diff --git a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/CustomContentManager.java b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/CustomContentManager.java index ab7a3bc74..6205fea5e 100644 --- a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/CustomContentManager.java +++ b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/CustomContentManager.java @@ -63,6 +63,7 @@ public class CustomContentManager { return output; } + @SuppressWarnings("unchecked") private T readExtension(String name, JsonElement el, T input) throws AssetLoadException, IOException { JsonElement extensions = el.getAsJsonObject().getAsJsonObject("extensions"); if (extensions == null) { @@ -93,6 +94,7 @@ public class CustomContentManager { return input; } + @SuppressWarnings("unchecked") private T readExtras(String name, JsonElement el, T input) throws AssetLoadException { if (key == null) { return input; diff --git a/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMInputCapsule.java b/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMInputCapsule.java index 0fdc7f210..62d625b45 100644 --- a/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMInputCapsule.java +++ b/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMInputCapsule.java @@ -1105,6 +1105,7 @@ public class DOMInputCapsule implements InputCapsule { } @Override + @SuppressWarnings("unchecked") public ArrayList readSavableArrayList(String name, ArrayList defVal) throws IOException { try { Element tmpEl = findChildElement(currentElem, name); @@ -1139,6 +1140,7 @@ public class DOMInputCapsule implements InputCapsule { } @Override + @SuppressWarnings("unchecked") public ArrayList[] readSavableArrayListArray( String name, ArrayList[] defVal) throws IOException { try { @@ -1185,6 +1187,7 @@ public class DOMInputCapsule implements InputCapsule { } @Override + @SuppressWarnings("unchecked") public ArrayList[][] readSavableArrayListArray2D(String name, ArrayList[][] defVal) throws IOException { try { Element tmpEl = findChildElement(currentElem, name); diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/picking/BresenhamTerrainPicker.java b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/picking/BresenhamTerrainPicker.java index 08d354088..cb2fc2fe2 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/picking/BresenhamTerrainPicker.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/picking/BresenhamTerrainPicker.java @@ -83,6 +83,7 @@ public class BresenhamTerrainPicker implements TerrainPicker { } @Override + @SuppressWarnings("unchecked") public int getTerrainIntersection(Ray worldPick, CollisionResults results) { int numCollisions = 0; worldPickRay.set(worldPick);