From 70ae48af1e3b26a200042345679cb5c527209873 Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Wed, 15 Apr 2020 17:54:18 -0700 Subject: [PATCH] avoid using raw types --- .../android/AndroidJoystickJoyInput14.java | 2 +- .../bullet/util/CollisionShapeFactory.java | 2 +- .../java/com/jme3/bullet/PhysicsSpace.java | 2 +- .../com/jme3/asset/DesktopAssetManager.java | 4 +-- .../main/java/com/jme3/asset/ImplHandler.java | 2 +- .../java/com/jme3/asset/ThreadingManager.java | 2 +- .../main/java/com/jme3/material/Material.java | 4 +-- .../jme3/export/binary/BinaryExporter.java | 4 +-- .../jme3/font/plugins/BitmapFontLoader.java | 2 +- .../com/jme3/material/plugins/J3MLoader.java | 2 +- .../com/jme3/scene/plugins/OBJLoader.java | 4 +-- .../java/jme3tools/optimize/LodGenerator.java | 2 +- .../java/com/jme3/app/SettingsDialog.java | 32 +++++++++---------- .../src/main/java/jme3test/TestChooser.java | 2 +- .../main/java/jme3test/app/TestIDList.java | 2 +- .../jme3/scene/plugins/ogre/MeshLoader.java | 4 +-- .../jme3/terrain/geomipmap/TerrainGrid.java | 6 ++-- 17 files changed, 39 insertions(+), 39 deletions(-) diff --git a/jme3-android/src/main/java/com/jme3/input/android/AndroidJoystickJoyInput14.java b/jme3-android/src/main/java/com/jme3/input/android/AndroidJoystickJoyInput14.java index 1ed98977c..28453a9c6 100644 --- a/jme3-android/src/main/java/com/jme3/input/android/AndroidJoystickJoyInput14.java +++ b/jme3-android/src/main/java/com/jme3/input/android/AndroidJoystickJoyInput14.java @@ -113,7 +113,7 @@ public class AndroidJoystickJoyInput14 { joysticks.clear(); joystickIndex.clear(); - ArrayList gameControllerDeviceIds = new ArrayList(); + ArrayList gameControllerDeviceIds = new ArrayList<>(); int[] deviceIds = InputDevice.getDeviceIds(); for (int deviceId : deviceIds) { InputDevice dev = InputDevice.getDevice(deviceId); diff --git a/jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java b/jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java index 9f3bc797a..16d530294 100644 --- a/jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java +++ b/jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java @@ -296,7 +296,7 @@ public class CollisionShapeFactory { * @param vector */ public static void shiftCompoundShapeContents(CompoundCollisionShape compoundShape, Vector3f vector) { - for (Iterator it = new LinkedList(compoundShape.getChildren()).iterator(); it.hasNext();) { + for (Iterator it = new LinkedList<>(compoundShape.getChildren()).iterator(); it.hasNext();) { ChildCollisionShape childCollisionShape = it.next(); CollisionShape child = childCollisionShape.shape; Vector3f location = childCollisionShape.location; diff --git a/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java b/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java index fde793a87..4d64c454b 100644 --- a/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java +++ b/jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java @@ -1127,7 +1127,7 @@ public class PhysicsSpace { * @return a new list of results */ public List sweepTest(CollisionShape shape, Transform start, Transform end) { - List results = new LinkedList(); + List results = new LinkedList<>(); sweepTest(shape, start, end , results); return results; } 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 6816fceac..9e3c4294f 100644 --- a/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java +++ b/jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java @@ -396,7 +396,7 @@ public class DesktopAssetManager implements AssetManager { @Override public Object loadAsset(String name){ - return loadAsset(new AssetKey(name)); + return loadAsset(new AssetKey<>(name)); } @Override @@ -428,7 +428,7 @@ public class DesktopAssetManager implements AssetManager { @Override public BitmapFont loadFont(String name){ - return (BitmapFont) loadAsset(new AssetKey(name)); + return loadAsset(new AssetKey(name)); } @Override 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 ca7fe2381..edb9a0134 100644 --- a/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java +++ b/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java @@ -294,7 +294,7 @@ final class ImplHandler { Iterator> it = locatorsList.iterator(); while (it.hasNext()){ - ImplThreadLocal locator = it.next(); + ImplThreadLocal locator = it.next(); if (locator.getPath().equals(rootPath) && locator.getTypeClass().equals(locatorType)){ //it.remove(); diff --git a/jme3-core/src/main/java/com/jme3/asset/ThreadingManager.java b/jme3-core/src/main/java/com/jme3/asset/ThreadingManager.java index 4fe8bca13..43299a550 100644 --- a/jme3-core/src/main/java/com/jme3/asset/ThreadingManager.java +++ b/jme3-core/src/main/java/com/jme3/asset/ThreadingManager.java @@ -77,7 +77,7 @@ public class ThreadingManager { } public Future loadAsset(AssetKey assetKey) { - return executor.submit(new LoadingTask(assetKey)); + return executor.submit(new LoadingTask<>(assetKey)); } public static boolean isLoadingThread() { 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 3f27bb9a1..1626dc91b 100644 --- a/jme3-core/src/main/java/com/jme3/material/Material.java +++ b/jme3-core/src/main/java/com/jme3/material/Material.java @@ -101,7 +101,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { } public Material(AssetManager contentMan, String defName) { - this((MaterialDef) contentMan.loadAsset(new AssetKey(defName))); + this(contentMan.loadAsset(new AssetKey(defName))); } /** @@ -1109,7 +1109,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { assert applyDefaultValues && guessRenderStateApply; } - def = (MaterialDef) im.getAssetManager().loadAsset(new AssetKey(defName)); + def = im.getAssetManager().loadAsset(new AssetKey(defName)); paramValues = new ListMap(); // load the textures and update nextTexUnit diff --git a/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryExporter.java b/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryExporter.java index 2a4e13e6f..c9a37879f 100644 --- a/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryExporter.java +++ b/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryExporter.java @@ -370,10 +370,10 @@ public class BinaryExporter implements JmeExporter { return contentTable.get(object).getContent(); } - private BinaryClassObject createClassObject(Class clazz) throws IOException{ + private BinaryClassObject createClassObject(Class clazz) throws IOException{ BinaryClassObject bco = new BinaryClassObject(); bco.alias = generateTag(); - bco.nameFields = new HashMap(); + bco.nameFields = new HashMap<>(); bco.classHierarchyVersions = SavableClassUtil.getSavableVersions(clazz); classes.put(clazz.getName(), bco); diff --git a/jme3-core/src/plugins/java/com/jme3/font/plugins/BitmapFontLoader.java b/jme3-core/src/plugins/java/com/jme3/font/plugins/BitmapFontLoader.java index 082ab3544..b81253601 100644 --- a/jme3-core/src/plugins/java/com/jme3/font/plugins/BitmapFontLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/font/plugins/BitmapFontLoader.java @@ -48,7 +48,7 @@ public class BitmapFontLoader implements AssetLoader { private BitmapFont load(AssetManager assetManager, String folder, InputStream in) throws IOException{ MaterialDef spriteMat = - (MaterialDef) assetManager.loadAsset(new AssetKey("Common/MatDefs/Misc/Unshaded.j3md")); + assetManager.loadAsset(new AssetKey<>("Common/MatDefs/Misc/Unshaded.j3md")); BitmapCharacterSet charSet = new BitmapCharacterSet(); Material[] matPages = null; BitmapFont font = new BitmapFont(); diff --git a/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java b/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java index fc8f88376..234e449e5 100644 --- a/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java @@ -743,7 +743,7 @@ public class J3MLoader implements AssetLoader { String extendedMat = split[1].trim(); - MaterialDef def = (MaterialDef) assetManager.loadAsset(new AssetKey(extendedMat)); + MaterialDef def = assetManager.loadAsset(new AssetKey(extendedMat)); if (def == null) { throw new MatParseException("Extended material " + extendedMat + " cannot be found.", materialStat); } diff --git a/jme3-core/src/plugins/java/com/jme3/scene/plugins/OBJLoader.java b/jme3-core/src/plugins/java/com/jme3/scene/plugins/OBJLoader.java index 8f3b9f98f..6457feb59 100644 --- a/jme3-core/src/plugins/java/com/jme3/scene/plugins/OBJLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/scene/plugins/OBJLoader.java @@ -331,9 +331,9 @@ public final class OBJLoader implements AssetLoader { // NOTE: Cut off any relative/absolute paths name = new File(name).getName(); - AssetKey mtlKey = new AssetKey(key.getFolder() + name); + AssetKey mtlKey = new AssetKey<>(key.getFolder() + name); try { - matList = (MaterialList) assetManager.loadAsset(mtlKey); + matList = assetManager.loadAsset(mtlKey); } catch (AssetNotFoundException ex){ logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{name, key}); } diff --git a/jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java b/jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java index cddaee61d..db5cb0e85 100644 --- a/jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java +++ b/jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java @@ -242,7 +242,7 @@ public class LodGenerator { /** * Comparator used to sort vertices according to their collapse cost */ - private Comparator collapseComparator = new Comparator() { + private Comparator collapseComparator = new Comparator() { @Override public int compare(Vertex o1, Vertex o2) { if (Float.compare(o1.collapseCost, o2.collapseCost) == 0) { diff --git a/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java b/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java index c07679889..9f93715d6 100644 --- a/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java +++ b/jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java @@ -94,10 +94,10 @@ public final class SettingsDialog extends JFrame { private JCheckBox vsyncBox = null; private JCheckBox gammaBox = null; private JCheckBox fullscreenBox = null; - private JComboBox displayResCombo = null; - private JComboBox colorDepthCombo = null; - private JComboBox displayFreqCombo = null; - private JComboBox antialiasCombo = null; + private JComboBox displayResCombo = null; + private JComboBox colorDepthCombo = null; + private JComboBox displayFreqCombo = null; + private JComboBox antialiasCombo = null; private JLabel icon = null; private int selection = 0; private SelectionListener selectionListener = null; @@ -342,11 +342,11 @@ public final class SettingsDialog extends JFrame { displayResCombo = setUpResolutionChooser(); displayResCombo.addKeyListener(aListener); - colorDepthCombo = new JComboBox(); + colorDepthCombo = new JComboBox<>(); colorDepthCombo.addKeyListener(aListener); - displayFreqCombo = new JComboBox(); + displayFreqCombo = new JComboBox<>(); displayFreqCombo.addKeyListener(aListener); - antialiasCombo = new JComboBox(); + antialiasCombo = new JComboBox<>(); antialiasCombo.addKeyListener(aListener); fullscreenBox = new JCheckBox(resourceBundle.getString("checkbox.fullscreen")); fullscreenBox.setSelected(source.isFullscreen()); @@ -628,8 +628,8 @@ public final class SettingsDialog extends JFrame { * * @return the combo box of display modes. */ - private JComboBox setUpResolutionChooser() { - JComboBox resolutionBox = new JComboBox(); + private JComboBox setUpResolutionChooser() { + JComboBox resolutionBox = new JComboBox<>(); resolutionBox.addActionListener(new ActionListener() { @@ -663,11 +663,11 @@ public final class SettingsDialog extends JFrame { // grab available depths String[] depths = getDepths(resolution, modes); - colorDepthCombo.setModel(new DefaultComboBoxModel(depths)); + colorDepthCombo.setModel(new DefaultComboBoxModel<>(depths)); colorDepthCombo.setSelectedItem(colorDepth); // grab available frequencies String[] freqs = getFrequencies(resolution, modes); - displayFreqCombo.setModel(new DefaultComboBoxModel(freqs)); + displayFreqCombo.setModel(new DefaultComboBoxModel<>(freqs)); // Try to reset freq displayFreqCombo.setSelectedItem(displayFreq); @@ -686,18 +686,18 @@ public final class SettingsDialog extends JFrame { */ private void updateResolutionChoices() { if (!fullscreenBox.isSelected()) { - displayResCombo.setModel(new DefaultComboBoxModel( + displayResCombo.setModel(new DefaultComboBoxModel<>( getWindowedResolutions(windowModes))); if (displayResCombo.getItemCount() > 0) { displayResCombo.setSelectedIndex(displayResCombo.getItemCount()-1); } - colorDepthCombo.setModel(new DefaultComboBoxModel(new String[]{ + colorDepthCombo.setModel(new DefaultComboBoxModel<>(new String[]{ "24 bpp", "16 bpp"})); - displayFreqCombo.setModel(new DefaultComboBoxModel( + displayFreqCombo.setModel(new DefaultComboBoxModel<>( new String[]{resourceBundle.getString("refresh.na")})); displayFreqCombo.setEnabled(false); } else { - displayResCombo.setModel(new DefaultComboBoxModel( + displayResCombo.setModel(new DefaultComboBoxModel<>( getResolutions(modes, Integer.MAX_VALUE, Integer.MAX_VALUE))); if (displayResCombo.getItemCount() > 0) { displayResCombo.setSelectedIndex(displayResCombo.getItemCount()-1); @@ -711,7 +711,7 @@ public final class SettingsDialog extends JFrame { // maybe in the future will add support for determining this info // through pbuffer String[] choices = new String[]{resourceBundle.getString("antialias.disabled"), "2x", "4x", "6x", "8x", "16x"}; - antialiasCombo.setModel(new DefaultComboBoxModel(choices)); + antialiasCombo.setModel(new DefaultComboBoxModel<>(choices)); antialiasCombo.setSelectedItem(choices[Math.min(source.getSamples()/2,5)]); } diff --git a/jme3-examples/src/main/java/jme3test/TestChooser.java b/jme3-examples/src/main/java/jme3test/TestChooser.java index 822ae2afa..30bec8754 100644 --- a/jme3-examples/src/main/java/jme3test/TestChooser.java +++ b/jme3-examples/src/main/java/jme3test/TestChooser.java @@ -323,7 +323,7 @@ public class TestChooser extends JDialog { final FilteredJList list = new FilteredJList(); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - DefaultListModel model = new DefaultListModel(); + DefaultListModel model = new DefaultListModel<>(); for (Class c : classes) { model.addElement(c); } diff --git a/jme3-examples/src/main/java/jme3test/app/TestIDList.java b/jme3-examples/src/main/java/jme3test/app/TestIDList.java index 37f3f56ea..1d7a4a894 100644 --- a/jme3-examples/src/main/java/jme3test/app/TestIDList.java +++ b/jme3-examples/src/main/java/jme3test/app/TestIDList.java @@ -45,7 +45,7 @@ public class TestIDList { public StateCol(){ // populate with free ids - List freeIds = new ArrayList(); + List freeIds = new ArrayList<>(); for (int i = 0; i < 16; i++){ freeIds.add(i); } diff --git a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MeshLoader.java b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MeshLoader.java index 1ef446b8f..1a7c56087 100644 --- a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MeshLoader.java +++ b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MeshLoader.java @@ -595,9 +595,9 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { } private void startSkeleton(String name) { - AssetKey assetKey = new AssetKey(folderName + name + ".xml"); + AssetKey assetKey = new AssetKey(folderName + name + ".xml"); try { - animData = (AnimData) assetManager.loadAsset(assetKey); + animData = assetManager.loadAsset(assetKey); } catch (AssetNotFoundException ex) { logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{assetKey, key}); animData = null; diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainGrid.java b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainGrid.java index b2e145b42..d06bddd9e 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainGrid.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainGrid.java @@ -163,7 +163,7 @@ public class TerrainGrid extends TerrainQuad { if (isCenter(quadIdx)) { // if it should be attached as a child right now, attach it - getControl(UpdateControl.class).enqueue(new Callable() { + getControl(UpdateControl.class).enqueue(new Callable() { // back on the OpenGL thread: @Override public Object call() throws Exception { @@ -177,7 +177,7 @@ public class TerrainGrid extends TerrainQuad { } }); } else { - getControl(UpdateControl.class).enqueue(new Callable() { + getControl(UpdateControl.class).enqueue(new Callable() { @Override public Object call() throws Exception { removeQuad(newQuad); @@ -188,7 +188,7 @@ public class TerrainGrid extends TerrainQuad { } } - getControl(UpdateControl.class).enqueue(new Callable() { + getControl(UpdateControl.class).enqueue(new Callable() { // back on the OpenGL thread: @Override public Object call() throws Exception {