suppress still more javac warnings about unchecked casts

master
Stephen Gold 5 years ago
parent 70ae48af1e
commit 1c3ed5122f
  1. 5
      jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java
  2. 4
      jme3-core/src/main/java/com/jme3/asset/ImplHandler.java
  3. 2
      jme3-core/src/main/java/com/jme3/material/Material.java
  4. 1
      jme3-core/src/main/java/com/jme3/util/IntMap.java
  5. 2
      jme3-examples/src/main/java/jme3test/TestChooser.java

@ -143,6 +143,7 @@ public class DesktopAssetManager implements AssetManager {
} }
} }
@SuppressWarnings("unchecked")
public void registerLoader(String clsName, String ... extensions){ public void registerLoader(String clsName, String ... extensions){
Class<? extends AssetLoader> clazz = null; Class<? extends AssetLoader> clazz = null;
try{ try{
@ -175,6 +176,7 @@ public class DesktopAssetManager implements AssetManager {
} }
} }
@SuppressWarnings("unchecked")
public void registerLocator(String rootPath, String clsName){ public void registerLocator(String rootPath, String clsName){
Class<? extends AssetLocator> clazz = null; Class<? extends AssetLocator> clazz = null;
try{ try{
@ -263,6 +265,7 @@ public class DesktopAssetManager implements AssetManager {
* @throws AssetLoadException If failed to load asset due to exception or * @throws AssetLoadException If failed to load asset due to exception or
* other error. * other error.
*/ */
@SuppressWarnings("unchecked")
protected <T> T loadLocatedAsset(AssetKey<T> key, AssetInfo info, AssetProcessor proc, AssetCache cache) { protected <T> T loadLocatedAsset(AssetKey<T> key, AssetInfo info, AssetProcessor proc, AssetCache cache) {
AssetLoader loader = handler.aquireLoader(key); AssetLoader loader = handler.aquireLoader(key);
Object obj; Object obj;
@ -318,6 +321,7 @@ public class DesktopAssetManager implements AssetManager {
* {@link CloneableSmartAsset}, if the cache is null, or if the * {@link CloneableSmartAsset}, if the cache is null, or if the
* processor did not clone the asset. * processor did not clone the asset.
*/ */
@SuppressWarnings("unchecked")
protected <T> T registerAndCloneSmartAsset(AssetKey<T> key, T obj, AssetProcessor proc, AssetCache cache) { protected <T> T registerAndCloneSmartAsset(AssetKey<T> key, T obj, AssetProcessor proc, AssetCache cache) {
// object obj is the original asset // object obj is the original asset
// create an instance for user // create an instance for user
@ -354,6 +358,7 @@ public class DesktopAssetManager implements AssetManager {
} }
@Override @Override
@SuppressWarnings("unchecked")
public <T> T loadAsset(AssetKey<T> key){ public <T> T loadAsset(AssetKey<T> key){
if (key == null) if (key == null)
throw new IllegalArgumentException("key cannot be null"); throw new IllegalArgumentException("key cannot be null");

@ -208,6 +208,7 @@ final class ImplHandler {
} }
} }
@SuppressWarnings("unchecked")
public <T extends AssetCache> T getCache(Class<T> cacheClass) { public <T extends AssetCache> T getCache(Class<T> cacheClass) {
if (cacheClass == null) { if (cacheClass == null) {
return null; return null;
@ -234,6 +235,7 @@ final class ImplHandler {
return cache; return cache;
} }
@SuppressWarnings("unchecked")
public <T extends AssetProcessor> T getProcessor(Class<T> procClass){ public <T extends AssetProcessor> T getProcessor(Class<T> procClass){
if (procClass == null) if (procClass == null)
return null; return null;
@ -259,6 +261,7 @@ final class ImplHandler {
return proc; return proc;
} }
@SuppressWarnings("unchecked")
public void addLoader(final Class<? extends AssetLoader> loaderType, String ... extensions){ public void addLoader(final Class<? extends AssetLoader> loaderType, String ... extensions){
// Synchronized access must be used for any ops on classToLoaderMap // Synchronized access must be used for any ops on classToLoaderMap
ImplThreadLocal local = new ImplThreadLocal(loaderType, extensions); ImplThreadLocal local = new ImplThreadLocal(loaderType, extensions);
@ -285,6 +288,7 @@ final class ImplHandler {
} }
} }
@SuppressWarnings("unchecked")
public void addLocator(final Class<? extends AssetLocator> locatorType, String rootPath){ public void addLocator(final Class<? extends AssetLocator> locatorType, String rootPath){
locatorsList.add(new ImplThreadLocal(locatorType, rootPath)); locatorsList.add(new ImplThreadLocal(locatorType, rootPath));
} }

@ -416,6 +416,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
* @param name the parameter name to look up. * @param name the parameter name to look up.
* @return current value or null if the parameter wasn't set. * @return current value or null if the parameter wasn't set.
*/ */
@SuppressWarnings("unchecked")
public <T> T getParamValue(final String name) { public <T> T getParamValue(final String name) {
final MatParam param = paramValues.get(name); final MatParam param = paramValues.get(name);
return param == null ? null : (T) param.getValue(); return param == null ? null : (T) param.getValue();
@ -1061,6 +1062,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
} }
@Override @Override
@SuppressWarnings("unchecked")
public void read(JmeImporter im) throws IOException { public void read(JmeImporter im) throws IOException {
InputCapsule ic = im.getCapsule(this); InputCapsule ic = im.getCapsule(this);

@ -262,6 +262,7 @@ public final class IntMap<T> implements Iterable<Entry<T>>, Cloneable, JmeClonea
} }
@Override @Override
@SuppressWarnings("unchecked")
public Entry next() { public Entry next() {
if (el >= size) if (el >= size)
throw new NoSuchElementException("No more elements!"); throw new NoSuchElementException("No more elements!");

@ -393,11 +393,13 @@ public class TestChooser extends JDialog {
private ListModel originalModel; private ListModel originalModel;
@Override @Override
@SuppressWarnings("unchecked")
public void setModel(ListModel m) { public void setModel(ListModel m) {
originalModel = m; originalModel = m;
super.setModel(m); super.setModel(m);
} }
@SuppressWarnings("unchecked")
private void update() { private void update() {
if (filter == null || filter.length() == 0) { if (filter == null || filter.length() == 0) {
super.setModel(originalModel); super.setModel(originalModel);

Loading…
Cancel
Save