avoid using raw types

master
Stephen Gold 5 years ago
parent c7a734d590
commit 70ae48af1e
  1. 2
      jme3-android/src/main/java/com/jme3/input/android/AndroidJoystickJoyInput14.java
  2. 2
      jme3-bullet/src/common/java/com/jme3/bullet/util/CollisionShapeFactory.java
  3. 2
      jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java
  4. 4
      jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java
  5. 2
      jme3-core/src/main/java/com/jme3/asset/ImplHandler.java
  6. 2
      jme3-core/src/main/java/com/jme3/asset/ThreadingManager.java
  7. 4
      jme3-core/src/main/java/com/jme3/material/Material.java
  8. 4
      jme3-core/src/plugins/java/com/jme3/export/binary/BinaryExporter.java
  9. 2
      jme3-core/src/plugins/java/com/jme3/font/plugins/BitmapFontLoader.java
  10. 2
      jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java
  11. 4
      jme3-core/src/plugins/java/com/jme3/scene/plugins/OBJLoader.java
  12. 2
      jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java
  13. 32
      jme3-desktop/src/main/java/com/jme3/app/SettingsDialog.java
  14. 2
      jme3-examples/src/main/java/jme3test/TestChooser.java
  15. 2
      jme3-examples/src/main/java/jme3test/app/TestIDList.java
  16. 4
      jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/MeshLoader.java
  17. 6
      jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/TerrainGrid.java

@ -113,7 +113,7 @@ public class AndroidJoystickJoyInput14 {
joysticks.clear(); joysticks.clear();
joystickIndex.clear(); joystickIndex.clear();
ArrayList gameControllerDeviceIds = new ArrayList(); ArrayList<Integer> gameControllerDeviceIds = new ArrayList<>();
int[] deviceIds = InputDevice.getDeviceIds(); int[] deviceIds = InputDevice.getDeviceIds();
for (int deviceId : deviceIds) { for (int deviceId : deviceIds) {
InputDevice dev = InputDevice.getDevice(deviceId); InputDevice dev = InputDevice.getDevice(deviceId);

@ -296,7 +296,7 @@ public class CollisionShapeFactory {
* @param vector * @param vector
*/ */
public static void shiftCompoundShapeContents(CompoundCollisionShape compoundShape, Vector3f 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(); ChildCollisionShape childCollisionShape = it.next();
CollisionShape child = childCollisionShape.shape; CollisionShape child = childCollisionShape.shape;
Vector3f location = childCollisionShape.location; Vector3f location = childCollisionShape.location;

@ -1127,7 +1127,7 @@ public class PhysicsSpace {
* @return a new list of results * @return a new list of results
*/ */
public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end) { public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end) {
List results = new LinkedList(); List<PhysicsSweepTestResult> results = new LinkedList<>();
sweepTest(shape, start, end , results); sweepTest(shape, start, end , results);
return results; return results;
} }

@ -396,7 +396,7 @@ public class DesktopAssetManager implements AssetManager {
@Override @Override
public Object loadAsset(String name){ public Object loadAsset(String name){
return loadAsset(new AssetKey(name)); return loadAsset(new AssetKey<>(name));
} }
@Override @Override
@ -428,7 +428,7 @@ public class DesktopAssetManager implements AssetManager {
@Override @Override
public BitmapFont loadFont(String name){ public BitmapFont loadFont(String name){
return (BitmapFont) loadAsset(new AssetKey(name)); return loadAsset(new AssetKey<BitmapFont>(name));
} }
@Override @Override

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

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

@ -101,7 +101,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
} }
public Material(AssetManager contentMan, String defName) { 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; assert applyDefaultValues && guessRenderStateApply;
} }
def = (MaterialDef) im.getAssetManager().loadAsset(new AssetKey(defName)); def = im.getAssetManager().loadAsset(new AssetKey<MaterialDef>(defName));
paramValues = new ListMap<String, MatParam>(); paramValues = new ListMap<String, MatParam>();
// load the textures and update nextTexUnit // load the textures and update nextTexUnit

@ -370,10 +370,10 @@ public class BinaryExporter implements JmeExporter {
return contentTable.get(object).getContent(); 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(); BinaryClassObject bco = new BinaryClassObject();
bco.alias = generateTag(); bco.alias = generateTag();
bco.nameFields = new HashMap<String, BinaryClassField>(); bco.nameFields = new HashMap<>();
bco.classHierarchyVersions = SavableClassUtil.getSavableVersions(clazz); bco.classHierarchyVersions = SavableClassUtil.getSavableVersions(clazz);
classes.put(clazz.getName(), bco); classes.put(clazz.getName(), bco);

@ -48,7 +48,7 @@ public class BitmapFontLoader implements AssetLoader {
private BitmapFont load(AssetManager assetManager, String folder, InputStream in) throws IOException{ private BitmapFont load(AssetManager assetManager, String folder, InputStream in) throws IOException{
MaterialDef spriteMat = 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(); BitmapCharacterSet charSet = new BitmapCharacterSet();
Material[] matPages = null; Material[] matPages = null;
BitmapFont font = new BitmapFont(); BitmapFont font = new BitmapFont();

@ -743,7 +743,7 @@ public class J3MLoader implements AssetLoader {
String extendedMat = split[1].trim(); String extendedMat = split[1].trim();
MaterialDef def = (MaterialDef) assetManager.loadAsset(new AssetKey(extendedMat)); MaterialDef def = assetManager.loadAsset(new AssetKey<MaterialDef>(extendedMat));
if (def == null) { if (def == null) {
throw new MatParseException("Extended material " + extendedMat + " cannot be found.", materialStat); throw new MatParseException("Extended material " + extendedMat + " cannot be found.", materialStat);
} }

@ -331,9 +331,9 @@ public final class OBJLoader implements AssetLoader {
// NOTE: Cut off any relative/absolute paths // NOTE: Cut off any relative/absolute paths
name = new File(name).getName(); name = new File(name).getName();
AssetKey mtlKey = new AssetKey(key.getFolder() + name); AssetKey<MaterialList> mtlKey = new AssetKey<>(key.getFolder() + name);
try { try {
matList = (MaterialList) assetManager.loadAsset(mtlKey); matList = assetManager.loadAsset(mtlKey);
} catch (AssetNotFoundException ex){ } catch (AssetNotFoundException ex){
logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{name, key}); logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{name, key});
} }

@ -242,7 +242,7 @@ public class LodGenerator {
/** /**
* Comparator used to sort vertices according to their collapse cost * Comparator used to sort vertices according to their collapse cost
*/ */
private Comparator collapseComparator = new Comparator<Vertex>() { private Comparator<Vertex> collapseComparator = new Comparator<Vertex>() {
@Override @Override
public int compare(Vertex o1, Vertex o2) { public int compare(Vertex o1, Vertex o2) {
if (Float.compare(o1.collapseCost, o2.collapseCost) == 0) { if (Float.compare(o1.collapseCost, o2.collapseCost) == 0) {

@ -94,10 +94,10 @@ public final class SettingsDialog extends JFrame {
private JCheckBox vsyncBox = null; private JCheckBox vsyncBox = null;
private JCheckBox gammaBox = null; private JCheckBox gammaBox = null;
private JCheckBox fullscreenBox = null; private JCheckBox fullscreenBox = null;
private JComboBox displayResCombo = null; private JComboBox<String> displayResCombo = null;
private JComboBox colorDepthCombo = null; private JComboBox<String> colorDepthCombo = null;
private JComboBox displayFreqCombo = null; private JComboBox<String> displayFreqCombo = null;
private JComboBox antialiasCombo = null; private JComboBox<String> antialiasCombo = null;
private JLabel icon = null; private JLabel icon = null;
private int selection = 0; private int selection = 0;
private SelectionListener selectionListener = null; private SelectionListener selectionListener = null;
@ -342,11 +342,11 @@ public final class SettingsDialog extends JFrame {
displayResCombo = setUpResolutionChooser(); displayResCombo = setUpResolutionChooser();
displayResCombo.addKeyListener(aListener); displayResCombo.addKeyListener(aListener);
colorDepthCombo = new JComboBox(); colorDepthCombo = new JComboBox<>();
colorDepthCombo.addKeyListener(aListener); colorDepthCombo.addKeyListener(aListener);
displayFreqCombo = new JComboBox(); displayFreqCombo = new JComboBox<>();
displayFreqCombo.addKeyListener(aListener); displayFreqCombo.addKeyListener(aListener);
antialiasCombo = new JComboBox(); antialiasCombo = new JComboBox<>();
antialiasCombo.addKeyListener(aListener); antialiasCombo.addKeyListener(aListener);
fullscreenBox = new JCheckBox(resourceBundle.getString("checkbox.fullscreen")); fullscreenBox = new JCheckBox(resourceBundle.getString("checkbox.fullscreen"));
fullscreenBox.setSelected(source.isFullscreen()); fullscreenBox.setSelected(source.isFullscreen());
@ -628,8 +628,8 @@ public final class SettingsDialog extends JFrame {
* *
* @return the combo box of display modes. * @return the combo box of display modes.
*/ */
private JComboBox setUpResolutionChooser() { private JComboBox<String> setUpResolutionChooser() {
JComboBox resolutionBox = new JComboBox(); JComboBox<String> resolutionBox = new JComboBox<>();
resolutionBox.addActionListener(new ActionListener() { resolutionBox.addActionListener(new ActionListener() {
@ -663,11 +663,11 @@ public final class SettingsDialog extends JFrame {
// grab available depths // grab available depths
String[] depths = getDepths(resolution, modes); String[] depths = getDepths(resolution, modes);
colorDepthCombo.setModel(new DefaultComboBoxModel(depths)); colorDepthCombo.setModel(new DefaultComboBoxModel<>(depths));
colorDepthCombo.setSelectedItem(colorDepth); colorDepthCombo.setSelectedItem(colorDepth);
// grab available frequencies // grab available frequencies
String[] freqs = getFrequencies(resolution, modes); String[] freqs = getFrequencies(resolution, modes);
displayFreqCombo.setModel(new DefaultComboBoxModel(freqs)); displayFreqCombo.setModel(new DefaultComboBoxModel<>(freqs));
// Try to reset freq // Try to reset freq
displayFreqCombo.setSelectedItem(displayFreq); displayFreqCombo.setSelectedItem(displayFreq);
@ -686,18 +686,18 @@ public final class SettingsDialog extends JFrame {
*/ */
private void updateResolutionChoices() { private void updateResolutionChoices() {
if (!fullscreenBox.isSelected()) { if (!fullscreenBox.isSelected()) {
displayResCombo.setModel(new DefaultComboBoxModel( displayResCombo.setModel(new DefaultComboBoxModel<>(
getWindowedResolutions(windowModes))); getWindowedResolutions(windowModes)));
if (displayResCombo.getItemCount() > 0) { if (displayResCombo.getItemCount() > 0) {
displayResCombo.setSelectedIndex(displayResCombo.getItemCount()-1); displayResCombo.setSelectedIndex(displayResCombo.getItemCount()-1);
} }
colorDepthCombo.setModel(new DefaultComboBoxModel(new String[]{ colorDepthCombo.setModel(new DefaultComboBoxModel<>(new String[]{
"24 bpp", "16 bpp"})); "24 bpp", "16 bpp"}));
displayFreqCombo.setModel(new DefaultComboBoxModel( displayFreqCombo.setModel(new DefaultComboBoxModel<>(
new String[]{resourceBundle.getString("refresh.na")})); new String[]{resourceBundle.getString("refresh.na")}));
displayFreqCombo.setEnabled(false); displayFreqCombo.setEnabled(false);
} else { } else {
displayResCombo.setModel(new DefaultComboBoxModel( displayResCombo.setModel(new DefaultComboBoxModel<>(
getResolutions(modes, Integer.MAX_VALUE, Integer.MAX_VALUE))); getResolutions(modes, Integer.MAX_VALUE, Integer.MAX_VALUE)));
if (displayResCombo.getItemCount() > 0) { if (displayResCombo.getItemCount() > 0) {
displayResCombo.setSelectedIndex(displayResCombo.getItemCount()-1); 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 // maybe in the future will add support for determining this info
// through pbuffer // through pbuffer
String[] choices = new String[]{resourceBundle.getString("antialias.disabled"), "2x", "4x", "6x", "8x", "16x"}; 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)]); antialiasCombo.setSelectedItem(choices[Math.min(source.getSamples()/2,5)]);
} }

@ -323,7 +323,7 @@ public class TestChooser extends JDialog {
final FilteredJList list = new FilteredJList(); final FilteredJList list = new FilteredJList();
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
DefaultListModel model = new DefaultListModel(); DefaultListModel<Class> model = new DefaultListModel<>();
for (Class c : classes) { for (Class c : classes) {
model.addElement(c); model.addElement(c);
} }

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

@ -595,9 +595,9 @@ public class MeshLoader extends DefaultHandler implements AssetLoader {
} }
private void startSkeleton(String name) { private void startSkeleton(String name) {
AssetKey assetKey = new AssetKey(folderName + name + ".xml"); AssetKey<AnimData> assetKey = new AssetKey<AnimData>(folderName + name + ".xml");
try { try {
animData = (AnimData) assetManager.loadAsset(assetKey); animData = assetManager.loadAsset(assetKey);
} catch (AssetNotFoundException ex) { } catch (AssetNotFoundException ex) {
logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{assetKey, key}); logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{assetKey, key});
animData = null; animData = null;

@ -163,7 +163,7 @@ public class TerrainGrid extends TerrainQuad {
if (isCenter(quadIdx)) { if (isCenter(quadIdx)) {
// if it should be attached as a child right now, attach it // 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: // back on the OpenGL thread:
@Override @Override
public Object call() throws Exception { public Object call() throws Exception {
@ -177,7 +177,7 @@ public class TerrainGrid extends TerrainQuad {
} }
}); });
} else { } else {
getControl(UpdateControl.class).enqueue(new Callable() { getControl(UpdateControl.class).enqueue(new Callable<Object>() {
@Override @Override
public Object call() throws Exception { public Object call() throws Exception {
removeQuad(newQuad); 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: // back on the OpenGL thread:
@Override @Override
public Object call() throws Exception { public Object call() throws Exception {

Loading…
Cancel
Save