Explorar o código

avoid using raw types

Stephen Gold %!s(int64=5) %!d(string=hai) anos
pai
achega
70ae48af1e

+ 1 - 1
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<Integer> gameControllerDeviceIds = new ArrayList<>();
         int[] deviceIds = InputDevice.getDeviceIds();
         for (int deviceId : deviceIds) {
             InputDevice dev = InputDevice.getDevice(deviceId);

+ 1 - 1
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<ChildCollisionShape> it = new LinkedList(compoundShape.getChildren()).iterator(); it.hasNext();) {
+        for (Iterator<ChildCollisionShape> it = new LinkedList<>(compoundShape.getChildren()).iterator(); it.hasNext();) {
             ChildCollisionShape childCollisionShape = it.next();
             CollisionShape child = childCollisionShape.shape;
             Vector3f location = childCollisionShape.location;

+ 1 - 1
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<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end) {
-        List results = new LinkedList();
+        List<PhysicsSweepTestResult> results = new LinkedList<>();
         sweepTest(shape, start, end , results);
         return results;
     }

+ 2 - 2
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<BitmapFont>(name));
     }
 
     @Override

+ 1 - 1
jme3-core/src/main/java/com/jme3/asset/ImplHandler.java

@@ -294,7 +294,7 @@ final class ImplHandler {
         Iterator<ImplThreadLocal<AssetLocator>> it = locatorsList.iterator();
        
         while (it.hasNext()){
-            ImplThreadLocal locator = it.next();
+            ImplThreadLocal<AssetLocator> locator = it.next();
             if (locator.getPath().equals(rootPath) &&
                 locator.getTypeClass().equals(locatorType)){
                 //it.remove();

+ 1 - 1
jme3-core/src/main/java/com/jme3/asset/ThreadingManager.java

@@ -77,7 +77,7 @@ public class ThreadingManager {
     }
 
     public <T> Future<T> loadAsset(AssetKey<T> assetKey) {
-        return executor.submit(new LoadingTask(assetKey));
+        return executor.submit(new LoadingTask<>(assetKey));
     }
 
     public static boolean isLoadingThread() {

+ 2 - 2
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<MaterialDef>(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<MaterialDef>(defName));
         paramValues = new ListMap<String, MatParam>();
 
         // load the textures and update nextTexUnit

+ 2 - 2
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<? extends Savable> clazz) throws IOException{
         BinaryClassObject bco = new BinaryClassObject();
         bco.alias = generateTag();
-        bco.nameFields = new HashMap<String, BinaryClassField>();
+        bco.nameFields = new HashMap<>();
         bco.classHierarchyVersions = SavableClassUtil.getSavableVersions(clazz);
         
         classes.put(clazz.getName(), bco);

+ 1 - 1
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();

+ 1 - 1
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<MaterialDef>(extendedMat));
             if (def == null) {
                 throw new MatParseException("Extended material " + extendedMat + " cannot be found.", materialStat);
             }

+ 2 - 2
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<MaterialList> 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});
         }

+ 1 - 1
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<Vertex>() {
+    private Comparator<Vertex> collapseComparator = new Comparator<Vertex>() {
         @Override
         public int compare(Vertex o1, Vertex o2) {
             if (Float.compare(o1.collapseCost, o2.collapseCost) == 0) {

+ 16 - 16
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<String> displayResCombo = null;
+    private JComboBox<String> colorDepthCombo = null;
+    private JComboBox<String> displayFreqCombo = null;
+    private JComboBox<String> 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<String> setUpResolutionChooser() {
+        JComboBox<String> 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)]);
     }
 

+ 1 - 1
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<Class> model = new DefaultListModel<>();
         for (Class c : classes) {
             model.addElement(c);
         }

+ 1 - 1
jme3-examples/src/main/java/jme3test/app/TestIDList.java

@@ -45,7 +45,7 @@ public class TestIDList {
 
         public StateCol(){
             // populate with free ids
-            List<Integer> freeIds = new ArrayList();
+            List<Integer> freeIds = new ArrayList<>();
             for (int i = 0; i < 16; i++){
                 freeIds.add(i);
             }

+ 2 - 2
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<AnimData> assetKey = new AssetKey<AnimData>(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;

+ 3 - 3
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<Object>() {
                             // 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<Object>() {
                             @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<Object>() {
                     // back on the OpenGL thread:
                     @Override
                     public Object call() throws Exception {