From 1c3ed5122f5c36b89c9b2707e2badfe834a3e9c5 Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Wed, 15 Apr 2020 18:22:18 -0700 Subject: [PATCH] suppress still more javac warnings about unchecked casts --- .../src/main/java/com/jme3/asset/DesktopAssetManager.java | 5 +++++ jme3-core/src/main/java/com/jme3/asset/ImplHandler.java | 4 ++++ jme3-core/src/main/java/com/jme3/material/Material.java | 2 ++ jme3-core/src/main/java/com/jme3/util/IntMap.java | 1 + jme3-examples/src/main/java/jme3test/TestChooser.java | 2 ++ 5 files changed, 14 insertions(+) diff --git a/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java b/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java index 9e3c4294f..a2effd046 100644 --- a/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java +++ b/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java @@ -143,6 +143,7 @@ public class DesktopAssetManager implements AssetManager { } } + @SuppressWarnings("unchecked") public void registerLoader(String clsName, String ... extensions){ Class clazz = null; try{ @@ -175,6 +176,7 @@ public class DesktopAssetManager implements AssetManager { } } + @SuppressWarnings("unchecked") public void registerLocator(String rootPath, String clsName){ Class clazz = null; try{ @@ -263,6 +265,7 @@ public class DesktopAssetManager implements AssetManager { * @throws AssetLoadException If failed to load asset due to exception or * other error. */ + @SuppressWarnings("unchecked") protected T loadLocatedAsset(AssetKey key, AssetInfo info, AssetProcessor proc, AssetCache cache) { AssetLoader loader = handler.aquireLoader(key); Object obj; @@ -318,6 +321,7 @@ public class DesktopAssetManager implements AssetManager { * {@link CloneableSmartAsset}, if the cache is null, or if the * processor did not clone the asset. */ + @SuppressWarnings("unchecked") protected T registerAndCloneSmartAsset(AssetKey key, T obj, AssetProcessor proc, AssetCache cache) { // object obj is the original asset // create an instance for user @@ -354,6 +358,7 @@ public class DesktopAssetManager implements AssetManager { } @Override + @SuppressWarnings("unchecked") public T loadAsset(AssetKey key){ if (key == null) throw new IllegalArgumentException("key cannot be null"); diff --git a/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java b/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java index edb9a0134..2eee902de 100644 --- a/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java +++ b/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java @@ -208,6 +208,7 @@ final class ImplHandler { } } + @SuppressWarnings("unchecked") public T getCache(Class cacheClass) { if (cacheClass == null) { return null; @@ -234,6 +235,7 @@ final class ImplHandler { return cache; } + @SuppressWarnings("unchecked") public T getProcessor(Class procClass){ if (procClass == null) return null; @@ -259,6 +261,7 @@ final class ImplHandler { return proc; } + @SuppressWarnings("unchecked") public void addLoader(final Class loaderType, String ... extensions){ // Synchronized access must be used for any ops on classToLoaderMap ImplThreadLocal local = new ImplThreadLocal(loaderType, extensions); @@ -285,6 +288,7 @@ final class ImplHandler { } } + @SuppressWarnings("unchecked") public void addLocator(final Class locatorType, String rootPath){ locatorsList.add(new ImplThreadLocal(locatorType, rootPath)); } diff --git a/jme3-core/src/main/java/com/jme3/material/Material.java b/jme3-core/src/main/java/com/jme3/material/Material.java index 1626dc91b..13bebb0bc 100644 --- a/jme3-core/src/main/java/com/jme3/material/Material.java +++ b/jme3-core/src/main/java/com/jme3/material/Material.java @@ -416,6 +416,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { * @param name the parameter name to look up. * @return current value or null if the parameter wasn't set. */ + @SuppressWarnings("unchecked") public T getParamValue(final String name) { final MatParam param = paramValues.get(name); return param == null ? null : (T) param.getValue(); @@ -1061,6 +1062,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { } @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/util/IntMap.java b/jme3-core/src/main/java/com/jme3/util/IntMap.java index cc8cff33d..b7b49b1eb 100644 --- a/jme3-core/src/main/java/com/jme3/util/IntMap.java +++ b/jme3-core/src/main/java/com/jme3/util/IntMap.java @@ -262,6 +262,7 @@ public final class IntMap implements Iterable>, Cloneable, JmeClonea } @Override + @SuppressWarnings("unchecked") public Entry next() { if (el >= size) throw new NoSuchElementException("No more elements!"); diff --git a/jme3-examples/src/main/java/jme3test/TestChooser.java b/jme3-examples/src/main/java/jme3test/TestChooser.java index 30bec8754..9d4af9d0d 100644 --- a/jme3-examples/src/main/java/jme3test/TestChooser.java +++ b/jme3-examples/src/main/java/jme3test/TestChooser.java @@ -393,11 +393,13 @@ public class TestChooser extends JDialog { private ListModel originalModel; @Override + @SuppressWarnings("unchecked") public void setModel(ListModel m) { originalModel = m; super.setModel(m); } + @SuppressWarnings("unchecked") private void update() { if (filter == null || filter.length() == 0) { super.setModel(originalModel);