diff --git a/jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput.java b/jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput.java index fbbdc8c831..de6abbedc5 100644 --- a/jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput.java +++ b/jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput.java @@ -215,7 +215,7 @@ public Joystick[] loadJoysticks(InputManager inputManager) { if (!disableSensors) { joystickList.add(sensorJoyInput.loadJoystick(joystickList.size(), inputManager)); } - return joystickList.toArray( new Joystick[joystickList.size()] ); + return joystickList.toArray(new Joystick[0]); } @Override diff --git a/jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput14.java b/jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput14.java index 050a00e292..a21cd99176 100644 --- a/jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput14.java +++ b/jme3-android/src/main/java/com/jme3/input/android/AndroidJoyInput14.java @@ -94,7 +94,7 @@ public Joystick[] loadJoysticks(InputManager inputManager) { // load physical gamepads/joysticks joystickList.addAll(joystickJoyInput.loadJoysticks(joystickList.size(), inputManager)); // return the list of joysticks back to InputManager - return joystickList.toArray( new Joystick[joystickList.size()] ); + return joystickList.toArray(new Joystick[0]); } public boolean onGenericMotion(MotionEvent event) { diff --git a/jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java b/jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java index d0fab80311..409c0c9304 100644 --- a/jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java +++ b/jme3-android/src/main/java/com/jme3/input/android/AndroidSensorJoyInput.java @@ -546,9 +546,8 @@ public void onSensorChanged(SensorEvent se) { return; } synchronized(sensorData.valuesLock) { - for (int i=0; i= 0) + System.arraycopy(se.values, 0, sensorData.lastValues, 0, sensorData.lastValues.length); } if (sensorData.axes.size() > 0) { diff --git a/jme3-core/src/main/java/com/jme3/anim/Armature.java b/jme3-core/src/main/java/com/jme3/anim/Armature.java index 5058fcec24..936aef597b 100644 --- a/jme3-core/src/main/java/com/jme3/anim/Armature.java +++ b/jme3-core/src/main/java/com/jme3/anim/Armature.java @@ -83,7 +83,7 @@ public Armature(Joint[] jointList) { rootJointList.add(joint); } } - rootJoints = rootJointList.toArray(new Joint[rootJointList.size()]); + rootJoints = rootJointList.toArray(new Joint[0]); createSkinningMatrices(); diff --git a/jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java b/jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java index b6ca9c8873..d051193f0c 100644 --- a/jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java +++ b/jme3-core/src/main/java/com/jme3/anim/tween/Tweens.java @@ -597,13 +597,9 @@ public CallTweenMethod(double length, Object target, String methodName, Object.. // So now set up the real args list. this.args = new Object[args.length + 1]; if (tIndex == 0) { - for (int i = 0; i < args.length; i++) { - this.args[i + 1] = args[i]; - } + System.arraycopy(args, 0, this.args, 1, args.length); } else { - for (int i = 0; i < args.length; i++) { - this.args[i] = args[i]; - } + System.arraycopy(args, 0, this.args, 0, args.length); } } diff --git a/jme3-core/src/main/java/com/jme3/anim/util/AnimMigrationUtils.java b/jme3-core/src/main/java/com/jme3/anim/util/AnimMigrationUtils.java index b8e40a2b4c..f9617b77d1 100644 --- a/jme3-core/src/main/java/com/jme3/anim/util/AnimMigrationUtils.java +++ b/jme3-core/src/main/java/com/jme3/anim/util/AnimMigrationUtils.java @@ -94,7 +94,7 @@ public void visit(Spatial spatial) { padJointTracks(tracks, staticJoints[i]); } - clip.setTracks(tracks.toArray(new TransformTrack[tracks.size()])); + clip.setTracks(tracks.toArray(new TransformTrack[0])); composer.addAnimClip(clip); } diff --git a/jme3-core/src/main/java/com/jme3/animation/Animation.java b/jme3-core/src/main/java/com/jme3/animation/Animation.java index 554e6a0cc5..43c7929641 100644 --- a/jme3-core/src/main/java/com/jme3/animation/Animation.java +++ b/jme3-core/src/main/java/com/jme3/animation/Animation.java @@ -39,6 +39,7 @@ import com.jme3.util.clone.JmeCloneable; import java.io.IOException; +import java.util.Collections; /** * The animation class updates the animation target with the tracks of a given type. @@ -139,9 +140,7 @@ void setTime(float time, float blendAmount, AnimControl control, AnimChannel cha * @param tracksArray The tracks to set. */ public void setTracks(Track[] tracksArray) { - for (Track track : tracksArray) { - tracks.add(track); - } + Collections.addAll(tracks, tracksArray); } /** diff --git a/jme3-core/src/main/java/com/jme3/animation/Skeleton.java b/jme3-core/src/main/java/com/jme3/animation/Skeleton.java index 28a8515b2d..5f99dd6e0f 100644 --- a/jme3-core/src/main/java/com/jme3/animation/Skeleton.java +++ b/jme3-core/src/main/java/com/jme3/animation/Skeleton.java @@ -81,7 +81,7 @@ public Skeleton(Bone[] boneList) { rootBoneList.add(b); } } - rootBones = rootBoneList.toArray(new Bone[rootBoneList.size()]); + rootBones = rootBoneList.toArray(new Bone[0]); createSkinningMatrices(); diff --git a/jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java b/jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java index 2936a30072..559d7a29f2 100644 --- a/jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java +++ b/jme3-core/src/main/java/com/jme3/app/DetailedProfiler.java @@ -161,8 +161,7 @@ public void vpStep(VpStep step, ViewPort vp, RenderQueue.Bucket bucket) { curVpPath = vpPath.toString(); } else { if (bucket != null) { - path.append(curAppPath).append("/").append(curVpPath).append("/") - .append(bucket.name() + " Bucket"); + path.append(curAppPath).append("/").append(curVpPath).append("/").append(bucket.name()).append(" Bucket"); } else { path.append(curAppPath).append("/").append(vpPath); curVpPath = vpPath.toString(); diff --git a/jme3-core/src/main/java/com/jme3/app/state/ScreenshotAppState.java b/jme3-core/src/main/java/com/jme3/app/state/ScreenshotAppState.java index 462971a91c..1bd900895c 100644 --- a/jme3-core/src/main/java/com/jme3/app/state/ScreenshotAppState.java +++ b/jme3-core/src/main/java/com/jme3/app/state/ScreenshotAppState.java @@ -51,6 +51,7 @@ import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; +import java.nio.file.Files; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -326,11 +327,8 @@ public void setProfiler(AppProfiler profiler) { * @throws IOException if an I/O error occurs */ protected void writeImageFile(File file) throws IOException { - OutputStream outStream = new FileOutputStream(file); - try { + try(OutputStream outStream = Files.newOutputStream(file.toPath())) { JmeSystem.writeImageFile(outStream, "png", outBuf, width, height); - } finally { - outStream.close(); } } } diff --git a/jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java b/jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java index b03850c255..85f72386ca 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/Cinematic.java @@ -221,7 +221,7 @@ public void onPause() { public void write(JmeExporter ex) throws IOException { super.write(ex); OutputCapsule oc = ex.getCapsule(this); - oc.write(cinematicEvents.toArray(new CinematicEvent[cinematicEvents.size()]), "cinematicEvents", null); + oc.write(cinematicEvents.toArray(new CinematicEvent[0]), "cinematicEvents", null); oc.writeStringSavableMap(cameras, "cameras", null); oc.write(timeLine, "timeLine", null); diff --git a/jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java b/jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java index b6faaf27aa..c4b6c23570 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/TimeLine.java @@ -106,8 +106,7 @@ public int getLastKeyFrameIndex() { @SuppressWarnings("unchecked") public void write(JmeExporter ex) throws IOException { OutputCapsule oc = ex.getCapsule(this); - ArrayList list = new ArrayList(); - list.addAll(values()); + ArrayList list = new ArrayList(values()); oc.writeSavableArrayList(list, "keyFrames", null); } diff --git a/jme3-core/src/main/java/com/jme3/light/LightList.java b/jme3-core/src/main/java/com/jme3/light/LightList.java index 97c4c29820..26d3f0781e 100644 --- a/jme3-core/src/main/java/com/jme3/light/LightList.java +++ b/jme3-core/src/main/java/com/jme3/light/LightList.java @@ -334,10 +334,7 @@ public void write(JmeExporter ex) throws IOException { OutputCapsule oc = ex.getCapsule(this); // oc.write(owner, "owner", null); - ArrayList lights = new ArrayList<>(); - for (int i = 0; i < listSize; i++) { - lights.add(list[i]); - } + ArrayList lights = new ArrayList<>(Arrays.asList(list).subList(0, listSize)); oc.writeSavableArrayList(lights, "lights", null); } diff --git a/jme3-core/src/main/java/com/jme3/math/Spline.java b/jme3-core/src/main/java/com/jme3/math/Spline.java index d707d10a3f..ff60615cc9 100644 --- a/jme3-core/src/main/java/com/jme3/math/Spline.java +++ b/jme3-core/src/main/java/com/jme3/math/Spline.java @@ -34,6 +34,7 @@ import com.jme3.export.*; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -84,10 +85,7 @@ public Spline(SplineType splineType, Vector3f[] controlPoints, float curveTensio if (splineType == SplineType.Nurb) { throw new IllegalArgumentException("To create NURBS spline use: 'public Spline(Vector3f[] controlPoints, float[] weights, float[] nurbKnots)' constructor!"); } - for (int i = 0; i < controlPoints.length; i++) { - Vector3f vector3f = controlPoints[i]; - this.controlPoints.add(vector3f); - } + Collections.addAll(this.controlPoints, controlPoints); type = splineType; this.curveTension = curveTension; this.cycle = cycle; @@ -164,10 +162,7 @@ private void initCatmullRomWayPoints(List list) { CRcontrolPoints.add(list.get(0).subtract(list.get(1).subtract(list.get(0)))); } - for (Iterator it = list.iterator(); it.hasNext();) { - Vector3f vector3f = it.next(); - CRcontrolPoints.add(vector3f); - } + CRcontrolPoints.addAll(list); if (cycle) { CRcontrolPoints.add(list.get(1)); } else { diff --git a/jme3-core/src/main/java/com/jme3/opencl/DefaultPlatformChooser.java b/jme3-core/src/main/java/com/jme3/opencl/DefaultPlatformChooser.java index 3f3cb2596f..225b0b191b 100644 --- a/jme3-core/src/main/java/com/jme3/opencl/DefaultPlatformChooser.java +++ b/jme3-core/src/main/java/com/jme3/opencl/DefaultPlatformChooser.java @@ -77,9 +77,7 @@ public List chooseDevices(List platforms) //still no one found, try without interop LOG.warning("No device with OpenCL-OpenGL-interop found, try without"); for (Platform p : platforms) { - for (Device d : p.getDevices()) { - result.add(d); - } + result.addAll(p.getDevices()); if (!result.isEmpty()) { return result; } diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java index 60e6b30265..4c947e80ce 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java @@ -1398,7 +1398,7 @@ assert isValidNumber(fb) : "Invalid Matrix4f value " + uniform.getValue() + " fo case FloatArray: fb = uniform.getMultiData(); assert isValidNumber(fb) : "Invalid float array value " - + Arrays.asList((float[]) uniform.getValue()) + " for " + uniform.getBinding(); + + Arrays.toString((float[]) uniform.getValue()) + " for " + uniform.getBinding(); gl.glUniform1(loc, fb); break; case Vector2Array: diff --git a/jme3-core/src/main/java/com/jme3/scene/Mesh.java b/jme3-core/src/main/java/com/jme3/scene/Mesh.java index 2819c2838f..2d7636b725 100644 --- a/jme3-core/src/main/java/com/jme3/scene/Mesh.java +++ b/jme3-core/src/main/java/com/jme3/scene/Mesh.java @@ -705,8 +705,7 @@ public void setStreamed() { */ @Deprecated public void setInterleaved() { - ArrayList vbs = new ArrayList<>(); - vbs.addAll(buffersList); + ArrayList vbs = new ArrayList<>(buffersList); // ArrayList vbs = new ArrayList(buffers.values()); // index buffer not included when interleaving diff --git a/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java b/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java index e0a673838f..cdad1cf5dc 100644 --- a/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java +++ b/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java @@ -420,7 +420,7 @@ private void updateAllInstanceData() { if (globalInstanceData != null) { allData.addAll(Arrays.asList(globalInstanceData)); } - allInstanceData = allData.toArray(new VertexBuffer[allData.size()]); + allInstanceData = allData.toArray(new VertexBuffer[0]); } @Override diff --git a/jme3-core/src/main/java/com/jme3/scene/shape/Surface.java b/jme3-core/src/main/java/com/jme3/scene/shape/Surface.java index 9beef259e4..6617d42501 100644 --- a/jme3-core/src/main/java/com/jme3/scene/shape/Surface.java +++ b/jme3-core/src/main/java/com/jme3/scene/shape/Surface.java @@ -43,8 +43,8 @@ import com.jme3.scene.Mesh; import com.jme3.scene.VertexBuffer; import com.jme3.util.BufferUtils; -import java.io.IOException; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -229,7 +229,7 @@ private void buildSurface(boolean smooth) { } } - Vector3f[] verticesArray = vertices.toArray(new Vector3f[vertices.size()]); + Vector3f[] verticesArray = vertices.toArray(new Vector3f[0]); // normalMap merges normals of faces that will be rendered smooth Map normalMap = new HashMap<>(verticesArray.length); for (int i = 0; i < indices.length; i += 3) { diff --git a/jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java b/jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java index fbd1350eb8..b5cfe45c6e 100644 --- a/jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java +++ b/jme3-core/src/main/java/com/jme3/shader/Glsl100ShaderGenerator.java @@ -506,6 +506,7 @@ protected boolean isVarying(ShaderGenerationInfo info, ShaderNodeVariable v) { for (ShaderNodeVariable shaderNodeVariable : info.getVaryings()) { if (shaderNodeVariable.equals(v)) { isVarying = true; + break; } } return isVarying; diff --git a/jme3-core/src/main/java/com/jme3/util/JmeFormatter.java b/jme3-core/src/main/java/com/jme3/util/JmeFormatter.java index a582da4232..7ad6cbad82 100644 --- a/jme3-core/src/main/java/com/jme3/util/JmeFormatter.java +++ b/jme3-core/src/main/java/com/jme3/util/JmeFormatter.java @@ -52,7 +52,7 @@ public class JmeFormatter extends Formatter { final private StringBuffer store = new StringBuffer(); public JmeFormatter(){ - lineSeparator = System.getProperty("line.separator"); + lineSeparator = System.lineSeparator(); format = new MessageFormat("{0,time}"); } diff --git a/jme3-core/src/main/java/com/jme3/util/TangentBinormalGenerator.java b/jme3-core/src/main/java/com/jme3/util/TangentBinormalGenerator.java index 33c7f4ae11..573b7b447c 100644 --- a/jme3-core/src/main/java/com/jme3/util/TangentBinormalGenerator.java +++ b/jme3-core/src/main/java/com/jme3/util/TangentBinormalGenerator.java @@ -113,9 +113,7 @@ public TriangleData(Vector3f tangent, Vector3f binormal, Vector3f normal) { } public void setIndex(int[] index) { - for (int i = 0; i < index.length; i++) { - this.index[i] = index[i]; - } + System.arraycopy(index, 0, this.index, 0, index.length); } } diff --git a/jme3-core/src/main/java/com/jme3/util/xml/SAXUtil.java b/jme3-core/src/main/java/com/jme3/util/xml/SAXUtil.java index c3c7bc0e88..e9ee0ba0a5 100644 --- a/jme3-core/src/main/java/com/jme3/util/xml/SAXUtil.java +++ b/jme3-core/src/main/java/com/jme3/util/xml/SAXUtil.java @@ -105,7 +105,7 @@ public static float parseFloat(String f) throws SAXException { } public static boolean parseBool(String bool, boolean def) throws SAXException { - if (bool == null || bool.equals("")) + if (bool == null || bool.isEmpty()) return def; else return Boolean.valueOf(bool); 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 7b6c6ca79e..3af214fd45 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 @@ -39,6 +39,7 @@ import com.jme3.export.SavableClassUtil; import com.jme3.math.FastMath; import java.io.*; +import java.nio.file.Files; import java.util.ArrayList; import java.util.HashMap; import java.util.IdentityHashMap; @@ -320,8 +321,8 @@ private int findPrevMatch(BinaryIdContentPair oldPair, protected byte[] fixClassAlias(byte[] bytes, int width) { if (bytes.length != width) { byte[] newAlias = new byte[width]; - for (int x = width - bytes.length; x < width; x++) - newAlias[x] = bytes[x - bytes.length]; + if (bytes.length >= 0) + System.arraycopy(bytes, width - 2 * bytes.length, newAlias, width - bytes.length, bytes.length); return newAlias; } return bytes; @@ -334,8 +335,8 @@ public void save(Savable object, File f, boolean createDirectories) throws IOExc parentDirectory.mkdirs(); } - try (FileOutputStream fos = new FileOutputStream(f); - BufferedOutputStream bos = new BufferedOutputStream(fos)) { + try (OutputStream os = Files.newOutputStream(f.toPath()); + BufferedOutputStream bos = new BufferedOutputStream(os)) { save(object, bos); } } diff --git a/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryImporter.java b/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryImporter.java index 0be52a8192..c8e832fc98 100644 --- a/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryImporter.java +++ b/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryImporter.java @@ -38,6 +38,7 @@ import java.io.*; import java.net.URL; import java.nio.ByteOrder; +import java.nio.file.Files; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.logging.Level; @@ -258,9 +259,10 @@ public Savable load(URL f) throws IOException { } public Savable load(URL f, ReadListener listener) throws IOException { - InputStream is = f.openStream(); - Savable rVal = load(is, listener); - is.close(); + Savable rVal; + try (InputStream is = f.openStream()) { + rVal = load(is, listener); + } return rVal; } @@ -269,18 +271,16 @@ public Savable load(File f) throws IOException { } public Savable load(File f, ReadListener listener) throws IOException { - FileInputStream fis = new FileInputStream(f); - try { - return load(fis, listener); - } finally { - fis.close(); + try (InputStream is = Files.newInputStream(f.toPath())) { + return load(is, listener); } } public Savable load(byte[] data) throws IOException { - ByteArrayInputStream bais = new ByteArrayInputStream(data); - Savable rVal = load(bais); - bais.close(); + Savable rVal; + try (ByteArrayInputStream bais = new ByteArrayInputStream(data)) { + rVal = load(bais); + } return rVal; } @@ -291,18 +291,14 @@ public InputCapsule getCapsule(Savable id) { protected String readString(InputStream f, int length) throws IOException { byte[] data = new byte[length]; - for(int j = 0; j < length; j++) { - data[j] = (byte)f.read(); - } + f.read(data, 0, length); return new String(data); } protected String readString(int length, int offset) throws IOException { byte[] data = new byte[length]; - for(int j = 0; j < length; j++) { - data[j] = dataArray[j+offset]; - } + System.arraycopy(dataArray, offset, data, 0, length); return new String(data); } diff --git a/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryInputCapsule.java b/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryInputCapsule.java index 1903f3ecc1..be86667ecd 100644 --- a/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryInputCapsule.java +++ b/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryInputCapsule.java @@ -36,6 +36,7 @@ import com.jme3.export.SavableClassUtil; import com.jme3.util.BufferUtils; import com.jme3.util.IntMap; + import java.io.IOException; import java.nio.ByteBuffer; import java.nio.FloatBuffer; @@ -44,6 +45,7 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.BitSet; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; @@ -562,9 +564,7 @@ private ArrayList savableArrayListFromArray(Savable[] savables) { return null; } ArrayList arrayList = new ArrayList<>(savables.length); - for (int x = 0; x < savables.length; x++) { - arrayList.add(savables[x]); - } + Collections.addAll(arrayList, savables); return arrayList; } diff --git a/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryOutputCapsule.java b/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryOutputCapsule.java index bc8c7e825c..be48d8bb59 100644 --- a/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryOutputCapsule.java +++ b/jme3-core/src/plugins/java/com/jme3/export/binary/BinaryOutputCapsule.java @@ -744,8 +744,7 @@ else if (possibleMagic == DEFAULT_OBJECT) byte[] rVal = new byte[1 + size]; rVal[0] = (byte) size; - for (int x = 1; x < rVal.length; x++) - rVal[x] = bytes[bytes.length - size - 1 + x]; + System.arraycopy(bytes, bytes.length - size, rVal, 1, rVal.length - 1); return rVal; } diff --git a/jme3-core/src/plugins/java/com/jme3/export/binary/ByteUtils.java b/jme3-core/src/plugins/java/com/jme3/export/binary/ByteUtils.java index 531a42af6a..1d65f376a5 100644 --- a/jme3-core/src/plugins/java/com/jme3/export/binary/ByteUtils.java +++ b/jme3-core/src/plugins/java/com/jme3/export/binary/ByteUtils.java @@ -479,9 +479,8 @@ public static byte[] readData(byte[] store, int bytes, InputStream is) throws IO public static byte[] rightAlignBytes(byte[] bytes, int width) { if (bytes.length != width) { byte[] rVal = new byte[width]; - for (int x = width - bytes.length; x < width; x++) { - rVal[x] = bytes[x - (width - bytes.length)]; - } + if (width - (width - bytes.length) >= 0) + System.arraycopy(bytes, 0, rVal, width - bytes.length, bytes.length); return rVal; } 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 0a0c0403c2..bd62103d53 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 @@ -736,7 +736,7 @@ private void loadFromRoot(List roots) throws IOException{ String[] split = materialName.split(":", 2); - if (materialName.equals("")){ + if (materialName.isEmpty()){ throw new MatParseException("Material name cannot be empty", materialStat); } diff --git a/jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java b/jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java index f44dba182e..e6ae2bc467 100644 --- a/jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java +++ b/jme3-core/src/plugins/java/com/jme3/material/plugins/ShaderNodeLoaderDelegate.java @@ -167,11 +167,11 @@ protected void readShaderNodeDefinition(List statements, ShaderNodeDe shaderNodeDefinition.getShadersPath().add(shaderName); } else if (line.startsWith("Documentation")) { if (isLoadDoc) { - String doc = ""; + StringBuilder doc = new StringBuilder(); for (Statement statement1 : statement.getContents()) { - doc += "\n" + statement1.getLine(); + doc.append("\n").append(statement1.getLine()); } - shaderNodeDefinition.setDocumentation(doc); + shaderNodeDefinition.setDocumentation(doc.toString()); } } else if (line.startsWith("Input")) { varNames.clear(); 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 cd2b4a29e8..45d4b4a248 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 @@ -256,7 +256,7 @@ protected void readFace(){ }else if (split.length == 2){ v = Integer.parseInt(split[0].trim()); vt = Integer.parseInt(split[1].trim()); - }else if (split.length == 3 && !split[1].equals("")){ + }else if (split.length == 3 && !split[1].isEmpty()){ v = Integer.parseInt(split[0].trim()); vt = Integer.parseInt(split[1].trim()); vn = Integer.parseInt(split[2].trim()); diff --git a/jme3-core/src/plugins/java/com/jme3/texture/plugins/HDRLoader.java b/jme3-core/src/plugins/java/com/jme3/texture/plugins/HDRLoader.java index 183049f9ec..f716d83b8b 100644 --- a/jme3-core/src/plugins/java/com/jme3/texture/plugins/HDRLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/texture/plugins/HDRLoader.java @@ -225,7 +225,7 @@ public Image load(InputStream in, boolean flipY) throws IOException{ while (true){ String ln = readString(in); ln = ln.trim(); - if (ln.startsWith("#") || ln.equals("")){ + if (ln.startsWith("#") || ln.isEmpty()){ if (ln.equals("#?RADIANCE") || ln.equals("#?RGBE")) verifiedFormat = true; diff --git a/jme3-core/src/plugins/java/com/jme3/texture/plugins/ktx/KTXLoader.java b/jme3-core/src/plugins/java/com/jme3/texture/plugins/ktx/KTXLoader.java index 9cd78b35a3..f8ea80bd73 100644 --- a/jme3-core/src/plugins/java/com/jme3/texture/plugins/ktx/KTXLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/texture/plugins/ktx/KTXLoader.java @@ -322,6 +322,7 @@ private boolean checkFileIdentifier(byte[] b) { for (int i = 0; i < 12; i++) { if (b[i] != fileIdentifier[i]) { check = false; + break; } } return check; diff --git a/jme3-core/src/test/java/com/jme3/scene/MPOTestUtils.java b/jme3-core/src/test/java/com/jme3/scene/MPOTestUtils.java index d78703e500..6ca948a2f7 100644 --- a/jme3-core/src/test/java/com/jme3/scene/MPOTestUtils.java +++ b/jme3-core/src/test/java/com/jme3/scene/MPOTestUtils.java @@ -61,17 +61,12 @@ private MPOTestUtils() { private static void validateSubScene(Spatial scene) { scene.checkCulling(DUMMY_CAM); - Set actualOverrides = new HashSet<>(); - for (MatParamOverride override : scene.getWorldMatParamOverrides()) { - actualOverrides.add(override); - } + Set actualOverrides = new HashSet<>(scene.getWorldMatParamOverrides()); Set expectedOverrides = new HashSet<>(); Spatial current = scene; while (current != null) { - for (MatParamOverride override : current.getLocalMatParamOverrides()) { - expectedOverrides.add(override); - } + expectedOverrides.addAll(current.getLocalMatParamOverrides()); current = current.getParent(); } diff --git a/jme3-core/src/test/java/com/jme3/shader/DefineListTest.java b/jme3-core/src/test/java/com/jme3/shader/DefineListTest.java index ac3ada832b..fb39e44455 100644 --- a/jme3-core/src/test/java/com/jme3/shader/DefineListTest.java +++ b/jme3-core/src/test/java/com/jme3/shader/DefineListTest.java @@ -94,7 +94,7 @@ public void testSourceInitial() { for (int id = 0; id < NUM_DEFINES; ++id) { assert !dl.isSet(id); } - assert generateSource(dl).equals(""); + assert generateSource(dl).isEmpty(); } @Test @@ -112,7 +112,7 @@ public void testSourceBooleanDefine() { for (int id = 0; id < NUM_DEFINES; ++id) { assert !dl.isSet(id); } - assert generateSource(dl).equals(""); + assert generateSource(dl).isEmpty(); dl.set(BOOL_VAR, true); for (int id = 0; id < NUM_DEFINES; ++id) { @@ -125,7 +125,7 @@ public void testSourceBooleanDefine() { for (int id = 0; id < NUM_DEFINES; ++id) { assert !dl.isSet(id); } - assert generateSource(dl).equals(""); + assert generateSource(dl).isEmpty(); } @Test @@ -164,7 +164,7 @@ public void testSourceIntDefine() { for (int id = 0; id < NUM_DEFINES; ++id) { assert !dl.isSet(id); } - assert generateSource(dl).equals(""); + assert generateSource(dl).isEmpty(); } @Test diff --git a/jme3-core/src/test/java/com/jme3/shader/GLSLPreprocessorTest.java b/jme3-core/src/test/java/com/jme3/shader/GLSLPreprocessorTest.java index 91ab893ad5..3cb739d4ab 100644 --- a/jme3-core/src/test/java/com/jme3/shader/GLSLPreprocessorTest.java +++ b/jme3-core/src/test/java/com/jme3/shader/GLSLPreprocessorTest.java @@ -31,36 +31,34 @@ */ package com.jme3.shader; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - +import com.jme3.asset.AssetInfo; +import com.jme3.asset.AssetKey; +import com.jme3.system.TestUtil; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.InputStreamReader; - -import com.jme3.asset.AssetInfo; -import com.jme3.asset.AssetKey; -import com.jme3.system.TestUtil; - -import org.junit.Test; - import jme3tools.shader.Preprocessor; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import org.junit.Test; public class GLSLPreprocessorTest { String readAllAsString(InputStream is) throws Exception{ - String output = ""; + StringBuilder output = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); while (true) { String l = reader.readLine(); if (l == null) break; - if (output != "") output += "\n"; - output += l; + if (output.length() > 0) { + output.append("\n"); + } + output.append(l); } reader.close(); - return output; + return output.toString(); } @Test diff --git a/jme3-core/src/test/java/com/jme3/util/StructTest.java b/jme3-core/src/test/java/com/jme3/util/StructTest.java index 6dace56b16..ec96d81093 100644 --- a/jme3-core/src/test/java/com/jme3/util/StructTest.java +++ b/jme3-core/src/test/java/com/jme3/util/StructTest.java @@ -37,13 +37,13 @@ static class TestStruct implements Struct { public void testFieldsExtraction() { TestStruct test = new TestStruct(); java.util.List> fields = StructUtils.getFields(test); - String checkString = ""; + StringBuilder checkString = new StringBuilder(); for (StructField f : fields) { String s = f.getPosition() + " " + f.getName() + " " + f.getDepth() + "\n"; - checkString += s; + checkString.append(s); } String expectedString = "0 intField0 0\n1 floatField1 0\n2 floatFieldArray2 0\n3 subIntField0 1\n4 subFloatField1 1\n5 subIntField0 1\n6 subFloatField1 1\n7 subIntField0 1\n8 subFloatField1 1\n9 boolField6 0\n"; - assertEquals(expectedString, checkString); + assertEquals(expectedString, checkString.toString()); } @Test @@ -61,11 +61,11 @@ public void testStd140Serialization() { ByteBuffer bbf = bo.getData(); String expectedData = "100 0 0 0 0 0 -56 66 0 0 0 0 0 0 0 0 0 0 -56 66 0 0 0 0 0 0 0 0 0 0 0 0 0 0 72 67 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -106 67 0 0 0 0 0 0 0 0 0 0 0 0 100 0 0 0 0 0 -56 66 0 0 0 0 0 0 0 0 100 0 0 0 0 0 -56 66 0 0 0 0 0 0 0 0 100 0 0 0 0 0 -56 66 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "; - String actualData = ""; + StringBuilder actualData = new StringBuilder(); while (bbf.hasRemaining()) { - actualData += bbf.get() + " "; + actualData.append(bbf.get()).append(" "); } - assertEquals(expectedData, actualData); + assertEquals(expectedData, actualData.toString()); } @Test diff --git a/jme3-core/src/tools/java/jme3tools/optimize/GeometryBatchFactory.java b/jme3-core/src/tools/java/jme3tools/optimize/GeometryBatchFactory.java index 98ccf9c35b..99ebcae3bd 100644 --- a/jme3-core/src/tools/java/jme3tools/optimize/GeometryBatchFactory.java +++ b/jme3-core/src/tools/java/jme3tools/optimize/GeometryBatchFactory.java @@ -415,17 +415,17 @@ public static void printMesh(Mesh mesh) { System.out.println(outBuf.getBufferType() + ": "); for (int vert = 0; vert < outBuf.getNumElements(); vert++) { - String str = "["; + StringBuilder str = new StringBuilder("["); for (int comp = 0; comp < outBuf.getNumComponents(); comp++) { Object val = outBuf.getElementComponent(vert, comp); outBuf.setElementComponent(vert, comp, val); val = outBuf.getElementComponent(vert, comp); - str += val; + str.append(val); if (comp != outBuf.getNumComponents() - 1) { - str += ", "; + str.append(", "); } } - str += "]"; + str.append("]"); System.out.println(str); } System.out.println("------"); diff --git a/jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java b/jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java index 2a24c5e1b5..46320f41a3 100644 --- a/jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java +++ b/jme3-core/src/tools/java/jme3tools/optimize/LodGenerator.java @@ -224,12 +224,12 @@ boolean isMalformed() { @Override public String toString() { - String out = "Triangle{\n"; + StringBuilder out = new StringBuilder("Triangle{\n"); for (int i = 0; i < 3; i++) { - out += vertexId[i] + " : " + vertex[i].toString() + "\n"; + out.append(vertexId[i]).append(" : ").append(vertex[i].toString()).append("\n"); } - out += '}'; - return out; + out.append('}'); + return out.toString(); } } /** diff --git a/jme3-core/src/tools/java/jme3tools/savegame/SaveGame.java b/jme3-core/src/tools/java/jme3tools/savegame/SaveGame.java index f01b3e9c1c..16ab41983b 100644 --- a/jme3-core/src/tools/java/jme3tools/savegame/SaveGame.java +++ b/jme3-core/src/tools/java/jme3tools/savegame/SaveGame.java @@ -44,6 +44,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.Files; import java.util.logging.Level; import java.util.logging.Logger; import java.util.zip.GZIPInputStream; @@ -104,7 +105,7 @@ public static void saveGame(String gamePath, String dataName, Savable data, JmeS throw new IllegalStateException("SaveGame dataset cannot be created"); } } - os = new GZIPOutputStream(new BufferedOutputStream(new FileOutputStream(saveFile))); + os = new GZIPOutputStream(new BufferedOutputStream(Files.newOutputStream(saveFile.toPath()))); ex.save(data, os); Logger.getLogger(SaveGame.class.getName()).log(Level.FINE, "Saving data to: {0}", saveFile.getAbsolutePath()); } catch (IOException ex1) { @@ -182,7 +183,7 @@ public static Savable loadGame(String gamePath, String dataName, AssetManager ma if(!file.exists()){ return null; } - is = new GZIPInputStream(new BufferedInputStream(new FileInputStream(file))); + is = new GZIPInputStream(new BufferedInputStream(Files.newInputStream(file.toPath()))); BinaryImporter imp = BinaryImporter.getInstance(); if (manager != null) { imp.setAssetManager(manager); diff --git a/jme3-examples/src/main/java/jme3test/TestChooser.java b/jme3-examples/src/main/java/jme3test/TestChooser.java index 3799bd5832..4ad4200e9d 100644 --- a/jme3-examples/src/main/java/jme3test/TestChooser.java +++ b/jme3-examples/src/main/java/jme3test/TestChooser.java @@ -309,7 +309,7 @@ public void run() { Thread.sleep(100); } } else { - final Method mainMethod = clazz.getMethod("main", (new String[0]).getClass()); + final Method mainMethod = clazz.getMethod("main", String[].class); mainMethod.invoke(clazz, new Object[] { new String[0] }); } // wait for destroy diff --git a/jme3-examples/src/main/java/jme3test/app/TestCloner.java b/jme3-examples/src/main/java/jme3test/app/TestCloner.java index 7685333003..777faa5ff0 100644 --- a/jme3-examples/src/main/java/jme3test/app/TestCloner.java +++ b/jme3-examples/src/main/java/jme3test/app/TestCloner.java @@ -309,7 +309,7 @@ public void cloneFields( Cloner cloner, Object original ) { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("intArray=" + intArray); + sb.append("intArray=").append(intArray); for( int i = 0; i < intArray.length; i++ ) { if( i == 0 ) { sb.append("["); @@ -320,14 +320,14 @@ public String toString() { } sb.append("], "); - sb.append("intArray2D=" + intArray2D); + sb.append("intArray2D=").append(intArray2D); for( int i = 0; i < intArray2D.length; i++ ) { if( i == 0 ) { sb.append("["); } else { sb.append(", "); } - sb.append("intArray2D[" + i + "]=" + intArray2D[i]); + sb.append("intArray2D[").append(i).append("]=").append(intArray2D[i]); for( int j = 0; j < 2; j++ ) { if( j == 0 ) { sb.append("["); @@ -340,7 +340,7 @@ public String toString() { } sb.append("], "); - sb.append("objectArray=" + objects); + sb.append("objectArray=").append(objects); for( int i = 0; i < objects.length; i++ ) { if( i == 0 ) { sb.append("["); @@ -351,7 +351,7 @@ public String toString() { } sb.append("], "); - sb.append("objectArray=" + regularObjects); + sb.append("objectArray=").append(regularObjects); for( int i = 0; i < regularObjects.length; i++ ) { if( i == 0 ) { sb.append("["); @@ -362,7 +362,7 @@ public String toString() { } sb.append("], "); - sb.append("stringArray=" + strings); + sb.append("stringArray=").append(strings); for( int i = 0; i < strings.length; i++ ) { if( i == 0 ) { sb.append("["); diff --git a/jme3-examples/src/main/java/jme3test/effect/TestIssue1773.java b/jme3-examples/src/main/java/jme3test/effect/TestIssue1773.java index b466815dfb..c26d5a7de9 100644 --- a/jme3-examples/src/main/java/jme3test/effect/TestIssue1773.java +++ b/jme3-examples/src/main/java/jme3test/effect/TestIssue1773.java @@ -64,6 +64,7 @@ import com.jme3.system.AppSettings; import com.jme3.texture.Texture; import java.util.Arrays; +import java.util.Collections; /** * Test case for Issue 1773 (Wrong particle position when using @@ -162,7 +163,7 @@ private ParticleEmitter createParticleEmitter(Geometry geo, boolean pointSprite) emitter.setGravity(0, 0f, 0); //emitter.getParticleInfluencer().setVelocityVariation(1); //emitter.getParticleInfluencer().setInitialVelocity(new Vector3f(0, .5f, 0)); - emitter.setShape(new EmitterMeshVertexShape(Arrays.asList(geo.getMesh()))); + emitter.setShape(new EmitterMeshVertexShape(Collections.singletonList(geo.getMesh()))); //emitter.setShape(new EmitterMeshFaceShape(Arrays.asList(geo.getMesh()))); return emitter; } diff --git a/jme3-examples/src/main/java/jme3test/input/combomoves/ComboMoveExecution.java b/jme3-examples/src/main/java/jme3test/input/combomoves/ComboMoveExecution.java index 1e1049ab89..bc4f56986e 100644 --- a/jme3-examples/src/main/java/jme3test/input/combomoves/ComboMoveExecution.java +++ b/jme3-examples/src/main/java/jme3test/input/combomoves/ComboMoveExecution.java @@ -110,7 +110,7 @@ public boolean updateState(HashSet pressedMappings, float time){ // the following for debug only. if (currentState.getPressedMappings().length > 0){ - if (!debugString.equals("")) + if (!debugString.isEmpty()) debugString += ", "; debugString += Arrays.toString(currentState.getPressedMappings()).replace(", ", "+"); diff --git a/jme3-examples/src/main/java/jme3test/model/TestGltfLoading.java b/jme3-examples/src/main/java/jme3test/model/TestGltfLoading.java index b4ff39d248..0da5106d8e 100644 --- a/jme3-examples/src/main/java/jme3test/model/TestGltfLoading.java +++ b/jme3-examples/src/main/java/jme3test/model/TestGltfLoading.java @@ -267,9 +267,7 @@ private void playFirstAnim(Spatial s) { AnimComposer control = s.getControl(AnimComposer.class); if (control != null) { anims.clear(); - for (String name : control.getAnimClipsNames()) { - anims.add(name); - } + anims.addAll(control.getAnimClipsNames()); if (anims.isEmpty()) { return; } diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestAnimMigration.java b/jme3-examples/src/main/java/jme3test/model/anim/TestAnimMigration.java index 18b09edbf2..a4493eba12 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestAnimMigration.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestAnimMigration.java @@ -225,9 +225,7 @@ private void setupModel(Spatial model) { debugAppState.addArmatureFrom(sc); anims.clear(); - for (String name : composer.getAnimClipsNames()) { - anims.add(name); - } + anims.addAll(composer.getAnimClipsNames()); composer.actionSequence("Sequence1", composer.makeAction("Walk"), composer.makeAction("Run"), diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestAnimMorphSerialization.java b/jme3-examples/src/main/java/jme3test/model/anim/TestAnimMorphSerialization.java index 30306429da..5ad80ceda6 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestAnimMorphSerialization.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestAnimMorphSerialization.java @@ -165,9 +165,7 @@ private void setupModel(Spatial model) { debugAppState.addArmatureFrom(sc); anims.clear(); - for (String name : composer.getAnimClipsNames()) { - anims.add(name); - } + anims.addAll(composer.getAnimClipsNames()); if (anims.isEmpty()) { return; } diff --git a/jme3-examples/src/main/java/jme3test/model/anim/TestAnimSerialization.java b/jme3-examples/src/main/java/jme3test/model/anim/TestAnimSerialization.java index 512946bd01..99556ef4ca 100644 --- a/jme3-examples/src/main/java/jme3test/model/anim/TestAnimSerialization.java +++ b/jme3-examples/src/main/java/jme3test/model/anim/TestAnimSerialization.java @@ -166,9 +166,7 @@ private void setupModel(Spatial model) { debugAppState.addArmatureFrom(sc); anims.clear(); - for (String name : composer.getAnimClipsNames()) { - anims.add(name); - } + anims.addAll(composer.getAnimClipsNames()); if (anims.isEmpty()) { return; } diff --git a/jme3-examples/src/main/java/jme3test/network/TestChatClient.java b/jme3-examples/src/main/java/jme3test/network/TestChatClient.java index 7312122e67..bd31d086a5 100644 --- a/jme3-examples/src/main/java/jme3test/network/TestChatClient.java +++ b/jme3-examples/src/main/java/jme3test/network/TestChatClient.java @@ -166,8 +166,8 @@ public void messageReceived(Client source, Message m) { // One of the least efficient ways to add text to a // JEditorPane - chatMessages.append("" + (m.isReliable() ? "TCP" : "UDP") + ""); - chatMessages.append(" -- " + chat.getName() + " : "); + chatMessages.append("").append(m.isReliable() ? "TCP" : "UDP").append(""); + chatMessages.append(" -- ").append(chat.getName()).append(" : "); chatMessages.append(chat.getMessage()); chatMessages.append("
"); String s = "" + chatMessages + ""; diff --git a/jme3-examples/src/main/java/jme3test/texture/TestSkyRotation.java b/jme3-examples/src/main/java/jme3test/texture/TestSkyRotation.java index 89c0718733..1a1dc73860 100644 --- a/jme3-examples/src/main/java/jme3test/texture/TestSkyRotation.java +++ b/jme3-examples/src/main/java/jme3test/texture/TestSkyRotation.java @@ -131,7 +131,7 @@ public void onAction(String name, boolean ongoing, float ignored) { System.out.print("rotate floor and sky leftward ..."); } else if (name.equals("right")) { angle -= 0.1f; // radians - System.out.printf("rotate floor and sky spatials rightward ..."); + System.out.print("rotate floor and sky spatials rightward ..."); } else { return; } diff --git a/jme3-jbullet/src/main/java/com/jme3/bullet/control/KinematicRagdollControl.java b/jme3-jbullet/src/main/java/com/jme3/bullet/control/KinematicRagdollControl.java index 19f054be32..22134d6476 100644 --- a/jme3-jbullet/src/main/java/com/jme3/bullet/control/KinematicRagdollControl.java +++ b/jme3-jbullet/src/main/java/com/jme3/bullet/control/KinematicRagdollControl.java @@ -1281,8 +1281,8 @@ public Bone getBone(String name){ public void write(JmeExporter ex) throws IOException { super.write(ex); OutputCapsule oc = ex.getCapsule(this); - oc.write(boneList.toArray(new String[boneList.size()]), "boneList", new String[0]); - oc.write(boneLinks.values().toArray(new PhysicsBoneLink[boneLinks.size()]), "boneLinks", new PhysicsBoneLink[0]); + oc.write(boneList.toArray(new String[0]), "boneList", new String[0]); + oc.write(boneLinks.values().toArray(new PhysicsBoneLink[0]), "boneLinks", new PhysicsBoneLink[0]); oc.write(modelPosition, "modelPosition", new Vector3f()); oc.write(modelRotation, "modelRotation", new Quaternion()); oc.write(targetModel, "targetModel", null); diff --git a/jme3-lwjgl/src/main/java/com/jme3/input/lwjgl/JInputJoyInput.java b/jme3-lwjgl/src/main/java/com/jme3/input/lwjgl/JInputJoyInput.java index 30ad12d7f3..6535dcbee9 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/input/lwjgl/JInputJoyInput.java +++ b/jme3-lwjgl/src/main/java/com/jme3/input/lwjgl/JInputJoyInput.java @@ -110,7 +110,7 @@ public Joystick[] loadJoysticks(InputManager inputManager){ list.add(stick); } - joysticks = list.toArray( new JInputJoystick[list.size()] ); + joysticks = list.toArray(new JInputJoystick[0]); return joysticks; } diff --git a/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglGLDebugOutputHandler.java b/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglGLDebugOutputHandler.java index d943fe6eef..b4d8109ada 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglGLDebugOutputHandler.java +++ b/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglGLDebugOutputHandler.java @@ -72,7 +72,7 @@ public void handleMessage(int source, int type, int id, int severity, String mes String typeStr = constMap.get(type); String severityStr = constMap.get(severity); - System.err.println(String.format(MESSAGE_FORMAT, id, sourceStr, typeStr, severityStr, message)); + System.err.printf((MESSAGE_FORMAT) + "%n", id, sourceStr, typeStr, severityStr, message); Thread.dumpStack(); } diff --git a/jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwJoystickInput.java b/jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwJoystickInput.java index 39f0fa6b5a..4b72d5fe58 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwJoystickInput.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwJoystickInput.java @@ -123,7 +123,7 @@ public Joystick[] loadJoysticks(final InputManager inputManager) { } } - return joysticks.values().toArray(new GlfwJoystick[joysticks.size()]); + return joysticks.values().toArray(new GlfwJoystick[0]); } private String convertAxisIndex(final int index) { diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglGLDebugOutputHandler.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglGLDebugOutputHandler.java index aa9c46511c..5f1087cb4e 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglGLDebugOutputHandler.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglGLDebugOutputHandler.java @@ -73,6 +73,6 @@ public void invoke(int source, int type, int id, int severity, int length, long String typeStr = constMap.get(type); String severityStr = constMap.get(severity); - System.err.println(String.format(MESSAGE_FORMAT, id, sourceStr, typeStr, severityStr, message)); + System.err.printf((MESSAGE_FORMAT) + "%n", id, sourceStr, typeStr, severityStr, message); } } diff --git a/jme3-networking/src/main/java/com/jme3/network/base/KernelAdapter.java b/jme3-networking/src/main/java/com/jme3/network/base/KernelAdapter.java index 598858723d..b1dcc17a5e 100644 --- a/jme3-networking/src/main/java/com/jme3/network/base/KernelAdapter.java +++ b/jme3-networking/src/main/java/com/jme3/network/base/KernelAdapter.java @@ -229,7 +229,7 @@ protected void createAndDispatch( Envelope env ) int len = Math.min( 10, data.length ); StringBuilder sb = new StringBuilder(); for( int i = 0; i < len; i++ ) { - sb.append( "[" + Integer.toHexString(data[i]) + "]" ); + sb.append("[").append(Integer.toHexString(data[i])).append("]"); } log.log( Level.FINE, "First 10 bytes of incomplete message:" + sb ); throw new RuntimeException( "Envelope contained incomplete data:" + env ); diff --git a/jme3-networking/src/main/java/com/jme3/network/message/ChannelInfoMessage.java b/jme3-networking/src/main/java/com/jme3/network/message/ChannelInfoMessage.java index 231fe19ff6..f4a4240ecf 100644 --- a/jme3-networking/src/main/java/com/jme3/network/message/ChannelInfoMessage.java +++ b/jme3-networking/src/main/java/com/jme3/network/message/ChannelInfoMessage.java @@ -34,6 +34,7 @@ import com.jme3.network.AbstractMessage; import com.jme3.network.serializing.Serializable; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -69,6 +70,6 @@ public int[] getPorts() { @Override public String toString() { - return "ChannelInfoMessage[" + id + ", " + Arrays.asList(ports) + "]"; + return "ChannelInfoMessage[" + id + ", " + Arrays.toString(ports) + "]"; } } diff --git a/jme3-networking/src/main/java/com/jme3/network/message/SerializerRegistrationsMessage.java b/jme3-networking/src/main/java/com/jme3/network/message/SerializerRegistrationsMessage.java index 331c7ab096..9af5920239 100644 --- a/jme3-networking/src/main/java/com/jme3/network/message/SerializerRegistrationsMessage.java +++ b/jme3-networking/src/main/java/com/jme3/network/message/SerializerRegistrationsMessage.java @@ -151,7 +151,7 @@ public static void compile() { log.log( Level.FINE, " {0}", reg); } } - compiled = list.toArray(new Registration[list.size()]); + compiled = list.toArray(new Registration[0]); INSTANCE = new SerializerRegistrationsMessage(compiled); diff --git a/jme3-networking/src/main/java/com/jme3/network/rmi/ObjectStore.java b/jme3-networking/src/main/java/com/jme3/network/rmi/ObjectStore.java index 3e820ff5b4..d204b4b3df 100644 --- a/jme3-networking/src/main/java/com/jme3/network/rmi/ObjectStore.java +++ b/jme3-networking/src/main/java/com/jme3/network/rmi/ObjectStore.java @@ -170,7 +170,7 @@ public void exposeObject(String name, Object obj) throws IOException{ methodList.add(method); } } - localObj.methods = methodList.toArray(new Method[methodList.size()]); + localObj.methods = methodList.toArray(new Method[0]); // Put it in the store localObjects.put(localObj.objectId, localObj); diff --git a/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java b/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java index 3178892b05..c267ccd644 100644 --- a/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java +++ b/jme3-networking/src/main/java/com/jme3/network/serializing/serializers/FieldSerializer.java @@ -129,7 +129,7 @@ public int compare (SavedField o1, SavedField o2) { return o1.field.getName().compareTo(o2.field.getName()); } }); - savedFields.put(clazz, cachedFields.toArray(new SavedField[cachedFields.size()])); + savedFields.put(clazz, cachedFields.toArray(new SavedField[0])); } diff --git a/jme3-networking/src/main/java/com/jme3/network/service/rmi/ClassInfo.java b/jme3-networking/src/main/java/com/jme3/network/service/rmi/ClassInfo.java index d2a8c2886a..a1deddcca2 100644 --- a/jme3-networking/src/main/java/com/jme3/network/service/rmi/ClassInfo.java +++ b/jme3-networking/src/main/java/com/jme3/network/service/rmi/ClassInfo.java @@ -98,7 +98,7 @@ private MethodInfo[] toMethodInfo( Class type, Method[] methods ) { // Simple... add all methods exposed through the interface result.add(new MethodInfo(methodId++, m)); } - return result.toArray(new MethodInfo[result.size()]); + return result.toArray(new MethodInfo[0]); } public MethodInfo[] getMethods() { diff --git a/jme3-networking/src/main/java/com/jme3/network/util/AbstractMessageDelegator.java b/jme3-networking/src/main/java/com/jme3/network/util/AbstractMessageDelegator.java index 2eba38e444..c5e773b55e 100644 --- a/jme3-networking/src/main/java/com/jme3/network/util/AbstractMessageDelegator.java +++ b/jme3-networking/src/main/java/com/jme3/network/util/AbstractMessageDelegator.java @@ -82,7 +82,7 @@ protected AbstractMessageDelegator( Class delegateType, boolean automap ) { */ public Class[] getMessageTypes() { if( messageTypes == null ) { - messageTypes = methods.keySet().toArray(new Class[methods.size()]); + messageTypes = methods.keySet().toArray(new Class[0]); } return messageTypes; } diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java index e68649f276..3e29eba740 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneLoader.java @@ -286,7 +286,7 @@ private void applySkinning() { limb.buildBindPoseBoneTransform(); } } - skeleton = new Skeleton(bones.toArray(new Bone[bones.size()])); + skeleton = new Skeleton(bones.toArray(new Bone[0])); skeleton.setBindingPose(); for(FbxNode limb : limbMap.values()) limb.setSkeleton(skeleton); diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneWithAnimationLoader.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneWithAnimationLoader.java index a2a3c68f86..cdaf7c78e6 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneWithAnimationLoader.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/SceneWithAnimationLoader.java @@ -61,7 +61,7 @@ private String[] split(String src) { Matcher m = splitStrings.matcher(src); while(m.find()) list.add(m.group(1).replace("\"", "")); - return list.toArray(new String[list.size()]); + return list.toArray(new String[0]); } } diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/file/FbxDump.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/file/FbxDump.java index 242ce39346..8c8ad35c6e 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/file/FbxDump.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/file/FbxDump.java @@ -134,7 +134,7 @@ protected static void dumpProperty(String id, char propertyType, ps.print(bytes.length); ps.print(") ["); for (int j = 0; j < numToPrint; j++) { - ps.print(String.format("%02X", bytes[j] & 0xff)); + ps.printf("%02X", bytes[j] & 0xff); if (j != bytes.length - 1) { ps.print(" "); } diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/material/FbxMaterial.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/material/FbxMaterial.java index 8574bf0637..f06b8b3505 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/material/FbxMaterial.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/material/FbxMaterial.java @@ -57,14 +57,14 @@ public FbxMaterial(AssetManager assetManager, String sceneFolderName) { @Override public void fromElement(FbxElement element) { super.fromElement(element); - if(!getSubclassName().equals("")) { + if(!getSubclassName().isEmpty()) { return; } FbxElement shadingModelEl = element.getChildById("ShadingModel"); if (shadingModelEl != null) { shadingModel = (String) shadingModelEl.properties.get(0); - if (!shadingModel.equals("")) { + if (!shadingModel.isEmpty()) { if (!shadingModel.equalsIgnoreCase("phong") && !shadingModel.equalsIgnoreCase("lambert")) { logger.log(Level.WARNING, "FBX material uses unknown shading model: {0}. " diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/material/FbxTexture.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/material/FbxTexture.java index cb1cdd0d9e..af3f57e6b2 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/material/FbxTexture.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/material/FbxTexture.java @@ -95,7 +95,7 @@ protected Texture toJmeObject() { @Override public void fromElement(FbxElement element) { super.fromElement(element); - if (getSubclassName().equals("")) { + if (getSubclassName().isEmpty()) { for (FbxElement e : element.children) { if (e.id.equals("Type")) { e.properties.get(0); diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/obj/FbxObject.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/obj/FbxObject.java index d9439a2d4b..5e6fcd0295 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/obj/FbxObject.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/obj/FbxObject.java @@ -72,7 +72,7 @@ public String getSubclassName() { } public String getFullClassName() { - if (subclassName.equals("")) { + if (subclassName.isEmpty()) { return className; } else { return subclassName + " : " + className; diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxAnimNode.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxAnimNode.java index ba6f38d0b1..f7d5725463 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxAnimNode.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxAnimNode.java @@ -16,7 +16,7 @@ public class FbxAnimNode extends FbxObject { public FbxAnimNode(SceneLoader scene, FbxElement element) { super(scene, element); - if(type.equals("")) { + if(type.isEmpty()) { Double x = null, y = null, z = null; for(FbxElement e2 : element.getFbxProperties()) { String propName = (String) e2.properties.get(0); diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxMaterial.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxMaterial.java index 647fdc3753..0b8b951767 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxMaterial.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxMaterial.java @@ -22,7 +22,7 @@ public class FbxMaterial extends FbxObject { public FbxMaterial(SceneLoader scene, FbxElement element) { super(scene, element); - if(type.equals("")) { + if(type.isEmpty()) { for(FbxElement e : element.children) { if(e.id.equals("ShadingModel")) { shadingModel = (String) e.properties.get(0); diff --git a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxMesh.java b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxMesh.java index 9cc40fe5b9..5e6a416956 100644 --- a/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxMesh.java +++ b/jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/objects/FbxMesh.java @@ -508,7 +508,7 @@ else if(binormalsMapping.equals("ByPolygonVertex")) int materialId = e.getKey(); List indexes = e.getValue(); Mesh newMesh = mesh.clone(); - newMesh.setBuffer(VertexBuffer.Type.Index, 3, toArray(indexes.toArray(new Integer[indexes.size()]))); + newMesh.setBuffer(VertexBuffer.Type.Index, 3, toArray(indexes.toArray(new Integer[0]))); newMesh.setStatic(); newMesh.updateBound(); newMesh.updateCounts(); diff --git a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java index c24efbadc1..7d25bf88dd 100644 --- a/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java +++ b/jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java @@ -977,7 +977,7 @@ public void readAnimation(int animationIndex) throws IOException { } } - anim.setTracks(aTracks.toArray(new AnimTrack[aTracks.size()])); + anim.setTracks(aTracks.toArray(new AnimTrack[0])); anim = customContentManager.readExtensionAndExtras("animations", animation, anim); if (skinIndex != -1) { diff --git a/jme3-plugins/src/main/java/com/jme3/material/plugin/export/material/J3MExporter.java b/jme3-plugins/src/main/java/com/jme3/material/plugin/export/material/J3MExporter.java index 4affcd64c8..c3b04243aa 100644 --- a/jme3-plugins/src/main/java/com/jme3/material/plugin/export/material/J3MExporter.java +++ b/jme3-plugins/src/main/java/com/jme3/material/plugin/export/material/J3MExporter.java @@ -7,11 +7,11 @@ import com.jme3.material.MaterialDef; import java.io.BufferedOutputStream; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; /** * Saves a Material to a j3m file with proper formatting. @@ -61,8 +61,8 @@ public void save(Savable object, File f, boolean createDirectories) throws IOExc parentDirectory.mkdirs(); } - try (FileOutputStream fos = new FileOutputStream(f); - BufferedOutputStream bos = new BufferedOutputStream(fos)) { + try (OutputStream os = Files.newOutputStream(f.toPath()); + BufferedOutputStream bos = new BufferedOutputStream(os)) { save(object, bos); } } diff --git a/jme3-plugins/src/main/java/com/jme3/material/plugin/export/materialdef/J3mdTechniqueDefWriter.java b/jme3-plugins/src/main/java/com/jme3/material/plugin/export/materialdef/J3mdTechniqueDefWriter.java index 48f861a86b..ff823c1186 100644 --- a/jme3-plugins/src/main/java/com/jme3/material/plugin/export/materialdef/J3mdTechniqueDefWriter.java +++ b/jme3-plugins/src/main/java/com/jme3/material/plugin/export/materialdef/J3mdTechniqueDefWriter.java @@ -234,7 +234,7 @@ private void writeVariableMapping(final Writer out, final ShaderNode shaderNode, out.write(leftVar.getName()); - if (!mapping.getLeftSwizzling().equals("")) { + if (!mapping.getLeftSwizzling().isEmpty()) { out.write("."); out.write(mapping.getLeftSwizzling()); } @@ -255,7 +255,7 @@ private void writeVariableMapping(final Writer out, final ShaderNode shaderNode, out.write(rightVarName); - if (!mapping.getRightSwizzling().equals("")) { + if (!mapping.getRightSwizzling().isEmpty()) { out.write("."); out.write(mapping.getRightSwizzling()); } diff --git a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SkeletonLoader.java b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SkeletonLoader.java index 728580523a..934d613d40 100644 --- a/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SkeletonLoader.java +++ b/jme3-plugins/src/ogre/java/com/jme3/scene/plugins/ogre/SkeletonLoader.java @@ -178,7 +178,7 @@ public void endElement(String uri, String name, String qName) { for (Joint j : unusedJoints) { AnimMigrationUtils.padJointTracks(tracks, j); } - TransformTrack[] trackList = tracks.toArray(new TransformTrack[tracks.size()]); + TransformTrack[] trackList = tracks.toArray(new TransformTrack[0]); animClip.setTracks(trackList); tracks.clear(); } else if (qName.equals("keyframe")) { @@ -205,9 +205,9 @@ public void endElement(String uri, String name, String qName) { timesArray[i] = times.get(i); } - Vector3f[] transArray = translations.toArray(new Vector3f[translations.size()]); - Quaternion[] rotArray = rotations.toArray(new Quaternion[rotations.size()]); - Vector3f[] scalesArray = scales.toArray(new Vector3f[scales.size()]); + Vector3f[] transArray = translations.toArray(new Vector3f[0]); + Quaternion[] rotArray = rotations.toArray(new Quaternion[0]); + Vector3f[] scalesArray = scales.toArray(new Vector3f[0]); track.setKeyframes(timesArray, transArray, rotArray, scalesArray); } else { diff --git a/jme3-plugins/src/test/java/com/jme3/export/JmeExporterTest.java b/jme3-plugins/src/test/java/com/jme3/export/JmeExporterTest.java index d11df242cc..ff0a0d1c1b 100644 --- a/jme3-plugins/src/test/java/com/jme3/export/JmeExporterTest.java +++ b/jme3-plugins/src/test/java/com/jme3/export/JmeExporterTest.java @@ -31,26 +31,6 @@ */ package com.jme3.export; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - import com.jme3.asset.AssetInfo; import com.jme3.asset.AssetManager; import com.jme3.asset.DesktopAssetManager; @@ -62,6 +42,26 @@ import com.jme3.material.Material; import com.jme3.material.plugin.export.material.J3MExporter; import com.jme3.scene.Node; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.NoSuchFileException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; /** * Tests the methods on classes that implements the JmeExporter interface. @@ -117,7 +117,7 @@ public void testSaveWhenPathDoesExist() throws IOException { Assert.assertTrue(file.exists()); } - @Test(expected = FileNotFoundException.class) + @Test(expected = NoSuchFileException.class) public void testSaveWhenPathDoesntExistWithoutCreateDirs() throws IOException { File file = fileWithMissingParent(); exporter.save(material, file, false); @@ -168,7 +168,7 @@ public void testExporterConsistency() { origin.setUserData("testFloat", 1.5f); origin.setUserData("1", "test"); if (testLists) { - origin.setUserData("string-list", Arrays.asList("abc")); + origin.setUserData("string-list", Collections.singletonList("abc")); origin.setUserData("int-list", Arrays.asList(1, 2, 3)); origin.setUserData("float-list", Arrays.asList(1f, 2f, 3f)); } diff --git a/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMInputCapsule.java b/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMInputCapsule.java index 5e2466a6bb..f1992cbaa9 100644 --- a/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMInputCapsule.java +++ b/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMInputCapsule.java @@ -74,7 +74,7 @@ public DOMInputCapsule(Document doc, XMLImporter importer) { // file version is always unprefixed for backwards compatibility String version = currentElem.getAttribute("format_version"); - importer.formatVersion = version.equals("") ? 0 : Integer.parseInt(version); + importer.formatVersion = version.isEmpty() ? 0 : Integer.parseInt(version); } @Override @@ -873,7 +873,7 @@ public BitSet readBitSet(String name, BitSet defVal) throws IOException { @Override public Savable readSavable(String name, Savable defVal) throws IOException { Savable ret = defVal; - if (name != null && name.equals("")) + if (name != null && name.isEmpty()) logger.warning("Reading Savable String with name \"\"?"); try { Element tmpEl = null; @@ -928,7 +928,7 @@ private Savable readSavableFromCurrentElem(Savable defVal) throws tmp = SavableClassUtil.fromName(className); String versionsStr = XMLUtils.getAttribute(importer.getFormatVersion(), currentElem, "savable_versions"); - if (versionsStr != null && !versionsStr.equals("")){ + if (versionsStr != null && !versionsStr.isEmpty()){ String[] versionStr = versionsStr.split(","); classHierarchyVersions = new int[versionStr.length]; for (int i = 0; i < classHierarchyVersions.length; i++){ diff --git a/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMSerializer.java b/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMSerializer.java index f0e664427b..df4b64c418 100644 --- a/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMSerializer.java +++ b/jme3-plugins/src/xml/java/com/jme3/export/xml/DOMSerializer.java @@ -35,6 +35,7 @@ import java.io.*; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import org.w3c.dom.*; @@ -90,7 +91,7 @@ private void escape(Writer writer, String s) throws IOException { * @throws IOException for various error conditions */ public void serialize(Document doc, File file) throws IOException { - serialize(doc, new FileOutputStream(file)); + serialize(doc, Files.newOutputStream(file.toPath())); } /** diff --git a/jme3-plugins/src/xml/java/com/jme3/export/xml/XMLExporter.java b/jme3-plugins/src/xml/java/com/jme3/export/xml/XMLExporter.java index add3f5ab70..0d09b78bf5 100644 --- a/jme3-plugins/src/xml/java/com/jme3/export/xml/XMLExporter.java +++ b/jme3-plugins/src/xml/java/com/jme3/export/xml/XMLExporter.java @@ -36,9 +36,9 @@ import com.jme3.export.OutputCapsule; import com.jme3.export.Savable; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.nio.file.Files; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -83,11 +83,8 @@ public void save(Savable object, File f, boolean createDirectories) throws IOExc parentDirectory.mkdirs(); } - FileOutputStream fos = new FileOutputStream(f); - try { - save(object, fos); - } finally { - fos.close(); + try(OutputStream os = Files.newOutputStream(f.toPath())) { + save(object, os); } } diff --git a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/FluidSimHeightMap.java b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/FluidSimHeightMap.java index a1d01e0c67..2afb39db0a 100644 --- a/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/FluidSimHeightMap.java +++ b/jme3-terrain/src/main/java/com/jme3/terrain/heightmap/FluidSimHeightMap.java @@ -211,9 +211,7 @@ public boolean load() { // put the normalized heightmap into the range [0...255] and into the heightmap for (int y = 0; y < size; y++) { - for (int x = 0; x < size; x++) { - heightData[x + y * size] = tempBuffer[curBuf][x + y * size]; - } + System.arraycopy(tempBuffer[curBuf], y * size, heightData, y * size, size); } normalizeTerrain(NORMALIZE_RANGE); diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/CVRSettingHelper.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/CVRSettingHelper.java index 5be90516cb..fbf4b77330 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/CVRSettingHelper.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/CVRSettingHelper.java @@ -3,6 +3,7 @@ import com.sun.jna.Structure; import com.sun.jna.ptr.IntByReference; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1592
@@ -21,7 +22,7 @@ public CVRSettingHelper() { } @Override protected List getFieldOrder() { - return Arrays.asList("m_pSettings"); + return Collections.singletonList("m_pSettings"); } /** * @param m_pSettings class vr::IVRSettings *
diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix33_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix33_t.java index 25e7f8d670..ce845176d0 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix33_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix33_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1183
@@ -20,7 +21,7 @@ public HmdMatrix33_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("m"); + return Collections.singletonList("m"); } /** * @param m float[3][3]
diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix34_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix34_t.java index 175bc07f75..de7afedaa3 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix34_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix34_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1179
@@ -20,7 +21,7 @@ public HmdMatrix34_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("m"); + return Collections.singletonList("m"); } /** * @param m float[3][4]
diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix44_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix44_t.java index 2243e8f5fa..3691b609ad 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix44_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdMatrix44_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1187
@@ -20,7 +21,7 @@ public HmdMatrix44_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("m"); + return Collections.singletonList("m"); } /** * @param m float[4][4]
diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdQuad_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdQuad_t.java index 28abf8f754..54cf327722 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdQuad_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdQuad_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1225
@@ -20,7 +21,7 @@ public HmdQuad_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("vCorners"); + return Collections.singletonList("vCorners"); } /** * @param vCorners struct vr::HmdVector3_t[4]
diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector2_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector2_t.java index f66240574d..efdde16f0f 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector2_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector2_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1203
@@ -20,7 +21,7 @@ public HmdVector2_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("v"); + return Collections.singletonList("v"); } /** * @param v float[2]
diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector3_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector3_t.java index 92ad299605..463c2b884b 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector3_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector3_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1191
@@ -20,7 +21,7 @@ public HmdVector3_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("v"); + return Collections.singletonList("v"); } /** * @param v float[3]
diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector3d_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector3d_t.java index 7bde50647c..7ddb9d2bbc 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector3d_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector3d_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1199
@@ -20,7 +21,7 @@ public HmdVector3d_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("v"); + return Collections.singletonList("v"); } /** * @param v double[3]
diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector4_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector4_t.java index 1db01177cf..87b364c1bf 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector4_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/HmdVector4_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1195
@@ -20,7 +21,7 @@ public HmdVector4_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("v"); + return Collections.singletonList("v"); } /** * @param v float[4]
diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/RenderModel_ControllerMode_State_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/RenderModel_ControllerMode_State_t.java index cf1eac008f..0f2cb91b59 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/RenderModel_ControllerMode_State_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/RenderModel_ControllerMode_State_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1581
@@ -16,7 +17,7 @@ public RenderModel_ControllerMode_State_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("bScrollWheelVisible"); + return Collections.singletonList("bScrollWheelVisible"); } public RenderModel_ControllerMode_State_t(byte bScrollWheelVisible) { super(); diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/SpatialAnchorPose_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/SpatialAnchorPose_t.java index 2d3fc2cfdb..ba8559680e 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/SpatialAnchorPose_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/SpatialAnchorPose_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1636
@@ -17,7 +18,7 @@ public SpatialAnchorPose_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("mAnchorToAbsoluteTracking"); + return Collections.singletonList("mAnchorToAbsoluteTracking"); } /** @param mAnchorToAbsoluteTracking C type : HmdMatrix34_t */ public SpatialAnchorPose_t(HmdMatrix34_t mAnchorToAbsoluteTracking) { diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Controller_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Controller_t.java index e7959582cc..f6ca7c712e 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Controller_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Controller_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1304
@@ -16,7 +17,7 @@ public VREvent_Controller_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("button"); + return Collections.singletonList("button"); } public VREvent_Controller_t(int button) { super(); diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Ipd_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Ipd_t.java index afc05f74ea..dfc56951f7 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Ipd_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Ipd_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1346
@@ -16,7 +17,7 @@ public VREvent_Ipd_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("ipdMeters"); + return Collections.singletonList("ipdMeters"); } public VREvent_Ipd_t(float ipdMeters) { super(); diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_MessageOverlay_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_MessageOverlay_t.java index b0fe1b8c2e..9aaabbfbc8 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_MessageOverlay_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_MessageOverlay_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1380
@@ -16,7 +17,7 @@ public VREvent_MessageOverlay_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("unVRMessageOverlayResponse"); + return Collections.singletonList("unVRMessageOverlayResponse"); } public VREvent_MessageOverlay_t(int unVRMessageOverlayResponse) { super(); diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_PerformanceTest_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_PerformanceTest_t.java index 13f14852cc..24ccf2f85d 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_PerformanceTest_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_PerformanceTest_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1359
@@ -16,7 +17,7 @@ public VREvent_PerformanceTest_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("m_nFidelityLevel"); + return Collections.singletonList("m_nFidelityLevel"); } public VREvent_PerformanceTest_t(int m_nFidelityLevel) { super(); diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_ScreenshotProgress_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_ScreenshotProgress_t.java index b0511dbc24..5dbae683ad 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_ScreenshotProgress_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_ScreenshotProgress_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1369
@@ -16,7 +17,7 @@ public VREvent_ScreenshotProgress_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("progress"); + return Collections.singletonList("progress"); } public VREvent_ScreenshotProgress_t(float progress) { super(); diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_SeatedZeroPoseReset_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_SeatedZeroPoseReset_t.java index cb7c9f62c5..5ae711044a 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_SeatedZeroPoseReset_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_SeatedZeroPoseReset_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1362
@@ -16,7 +17,7 @@ public VREvent_SeatedZeroPoseReset_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("bResetBySystemMenu"); + return Collections.singletonList("bResetBySystemMenu"); } public VREvent_SeatedZeroPoseReset_t(byte bResetBySystemMenu) { super(); diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_SpatialAnchor_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_SpatialAnchor_t.java index eeb51f2e26..c4b1dc0686 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_SpatialAnchor_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_SpatialAnchor_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1420
@@ -17,7 +18,7 @@ public VREvent_SpatialAnchor_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("unHandle"); + return Collections.singletonList("unHandle"); } /** @param unHandle C type : SpatialAnchorHandle_t */ public VREvent_SpatialAnchor_t(int unHandle) { diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Status_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Status_t.java index d16d2c0727..b9da5b08d9 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Status_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_Status_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1338
@@ -16,7 +17,7 @@ public VREvent_Status_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("statusState"); + return Collections.singletonList("statusState"); } public VREvent_Status_t(int statusState) { super(); diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_WebConsole_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_WebConsole_t.java index 21d9bdf390..0c5bcc107d 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_WebConsole_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VREvent_WebConsole_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1405
@@ -17,7 +18,7 @@ public VREvent_WebConsole_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("webConsoleHandle"); + return Collections.singletonList("webConsoleHandle"); } /** @param webConsoleHandle C type : WebConsoleHandle_t */ public VREvent_WebConsole_t(long webConsoleHandle) { diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithDepth_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithDepth_t.java index 0601b2b7a3..2e4dae988c 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithDepth_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithDepth_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1275
@@ -17,7 +18,7 @@ public VRTextureWithDepth_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("depth"); + return Collections.singletonList("depth"); } /** @param depth C type : VRTextureDepthInfo_t */ public VRTextureWithDepth_t(VRTextureDepthInfo_t depth) { diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithPoseAndDepth_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithPoseAndDepth_t.java index bbe447ba2c..059f00c15e 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithPoseAndDepth_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithPoseAndDepth_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1278
@@ -17,7 +18,7 @@ public VRTextureWithPoseAndDepth_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("depth"); + return Collections.singletonList("depth"); } /** @param depth C type : VRTextureDepthInfo_t */ public VRTextureWithPoseAndDepth_t(VRTextureDepthInfo_t depth) { diff --git a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithPose_t.java b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithPose_t.java index 8eff35c066..88a83e6716 100644 --- a/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithPose_t.java +++ b/jme3-vr/src/main/java/com/jme3/system/jopenvr/VRTextureWithPose_t.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * native declaration : headers\openvr_capi.h:1266
@@ -17,7 +18,7 @@ public VRTextureWithPose_t() { } @Override protected List getFieldOrder() { - return Arrays.asList("mDeviceToAbsoluteTracking"); + return Collections.singletonList("mDeviceToAbsoluteTracking"); } /** @param mDeviceToAbsoluteTracking C type : HmdMatrix34_t */ public VRTextureWithPose_t(HmdMatrix34_t mDeviceToAbsoluteTracking) { diff --git a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Quaternion.java b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Quaternion.java index 72952297a1..da44faee35 100644 --- a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Quaternion.java +++ b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Quaternion.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * This file was autogenerated by JNAerator,
@@ -16,7 +17,7 @@ public OSVR_Quaternion() { } @Override protected List getFieldOrder() { - return Arrays.asList("data"); + return Collections.singletonList("data"); } /** @param data C type : double[4] */ public OSVR_Quaternion(double data[]) { diff --git a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Vec2.java b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Vec2.java index 7427d14461..b9b8c71242 100644 --- a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Vec2.java +++ b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Vec2.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * This file was autogenerated by JNAerator,
@@ -16,7 +17,7 @@ public OSVR_Vec2() { } @Override protected List getFieldOrder() { - return Arrays.asList("data"); + return Collections.singletonList("data"); } /** @param data C type : double[2] */ public OSVR_Vec2(double data[]) { diff --git a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Vec3.java b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Vec3.java index b3b2ed8893..166120f788 100644 --- a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Vec3.java +++ b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrclientreporttypes/OSVR_Vec3.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * This file was autogenerated by JNAerator,
@@ -16,7 +17,7 @@ public OSVR_Vec3() { } @Override protected List getFieldOrder() { - return Arrays.asList("data"); + return Collections.singletonList("data"); } /** @param data C type : double[3] */ public OSVR_Vec3(double data[]) { diff --git a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OSVR_Quaternion.java b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OSVR_Quaternion.java index 4627040206..32e1257b41 100644 --- a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OSVR_Quaternion.java +++ b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OSVR_Quaternion.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * This file was autogenerated by JNAerator,
@@ -16,7 +17,7 @@ public OSVR_Quaternion() { } @Override protected List getFieldOrder() { - return Arrays.asList("data"); + return Collections.singletonList("data"); } /** @param data C type : double[4] */ public OSVR_Quaternion(double data[]) { diff --git a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OSVR_Vec3.java b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OSVR_Vec3.java index 7aa44a9793..b4b95d2256 100644 --- a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OSVR_Vec3.java +++ b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrmatrixconventions/OSVR_Vec3.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * This file was autogenerated by JNAerator,
@@ -16,7 +17,7 @@ public OSVR_Vec3() { } @Override protected List getFieldOrder() { - return Arrays.asList("data"); + return Collections.singletonList("data"); } /** @param data C type : double[3] */ public OSVR_Vec3(double data[]) { diff --git a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrrendermanageropengl/OSVR_GraphicsLibraryOpenGL.java b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrrendermanageropengl/OSVR_GraphicsLibraryOpenGL.java index f52a83387b..a2e536a63c 100644 --- a/jme3-vr/src/main/java/com/jme3/system/osvr/osvrrendermanageropengl/OSVR_GraphicsLibraryOpenGL.java +++ b/jme3-vr/src/main/java/com/jme3/system/osvr/osvrrendermanageropengl/OSVR_GraphicsLibraryOpenGL.java @@ -2,6 +2,7 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** * This file was autogenerated by JNAerator,
@@ -16,7 +17,7 @@ public OSVR_GraphicsLibraryOpenGL() { } @Override protected List getFieldOrder() { - return Arrays.asList("toolkit"); + return Collections.singletonList("toolkit"); } /** @param toolkit C type : const OSVR_OpenGLToolkitFunctions* */ public OSVR_GraphicsLibraryOpenGL(com.jme3.system.osvr.osvrrendermanageropengl.OSVR_OpenGLToolkitFunctions.ByReference toolkit) {