Skip to content

Commit 609c7a0

Browse files
committed
Avoid creating flakey clone
1 parent 9052071 commit 609c7a0

5 files changed

Lines changed: 13 additions & 37 deletions

File tree

src/org/jbox2d/common/Mat22.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class Mat22 implements Serializable {
3838

3939
/**
4040
* Convert the matrix to printable format.
41-
* @return
41+
* @return
4242
*/
4343
@Override
4444
public String toString() {

src/org/jbox2d/common/Mat33.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @author Daniel Murphy
3232
*/
3333
public class Mat33 implements Serializable {
34-
private static final long serialVersionUID = 2L;
34+
3535

3636
public static final Mat33 IDENTITY = new Mat33(new Vec3(1, 0, 0), new Vec3(0, 1, 0), new Vec3(0,
3737
0, 1));
@@ -52,9 +52,9 @@ public Mat33(float exx, float exy, float exz, float eyx, float eyy, float eyz, f
5252
}
5353

5454
public Mat33(Vec3 argCol1, Vec3 argCol2, Vec3 argCol3) {
55-
ex = argCol1.clone();
56-
ey = argCol2.clone();
57-
ez = argCol3.clone();
55+
ex = new Vec3(argCol1);
56+
ey = new Vec3(argCol2);
57+
ez = new Vec3(argCol3);
5858
}
5959

6060
public void setZero() {

src/org/jbox2d/common/Rot.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/*******************************************************************************
22
* Copyright (c) 2013, Daniel Murphy
33
* All rights reserved.
4-
*
4+
*
55
* Redistribution and use in source and binary forms, with or without modification,
66
* are permitted provided that the following conditions are met:
77
* * Redistributions of source code must retain the above copyright notice,
88
* this list of conditions and the following disclaimer.
99
* * Redistributions in binary form must reproduce the above copyright notice,
1010
* this list of conditions and the following disclaimer in the documentation
1111
* and/or other materials provided with the distribution.
12-
*
12+
*
1313
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1414
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1515
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -27,7 +27,7 @@
2727

2828
/**
2929
* Represents a rotation
30-
*
30+
*
3131
* @author Daniel
3232
*/
3333
public class Rot implements Serializable {
@@ -91,14 +91,6 @@ public void getYAxis(Vec2 yAxis) {
9191
yAxis.set(-s, c);
9292
}
9393

94-
// @Override // annotation omitted for GWT-compatibility
95-
// public Rot clone() {
96-
// Rot copy = new Rot();
97-
// copy.s = s;
98-
// copy.c = c;
99-
// return copy;
100-
// }
101-
10294
public static final void mul(Rot q, Rot r, Rot out) {
10395
float tempc = q.c * r.c - q.s * r.s;
10496
out.s = q.s * r.c + q.c * r.s;

src/org/jbox2d/common/Vec2.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,6 @@ public final void absLocal() {
262262
y = MathUtils.abs(y);
263263
}
264264

265-
// @Override // annotation omitted for GWT-compatibility
266-
/**
267-
* Return a copy of this vector.
268-
*
269-
* @return
270-
*/
271-
// @Override
272-
// public final Vec2 clone() {
273-
// return new Vec2(this);
274-
// }
275-
276265
@Override
277266
public final String toString() {
278267
return "(" + x + "," + y + ")";
@@ -354,7 +343,7 @@ public final static void maxToOut(Vec2 a, Vec2 b, Vec2 out) {
354343
}
355344

356345
/**
357-
* @return
346+
* @return
358347
* @see java.lang.Object#hashCode()
359348
*/
360349
@Override
@@ -368,7 +357,7 @@ public int hashCode() { // automatically generated by Eclipse
368357

369358
/**
370359
* @param obj
371-
* @return
360+
* @return
372361
* @see java.lang.Object#equals(java.lang.Object)
373362
*/
374363
@Override

src/org/jbox2d/common/Vec3.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/*******************************************************************************
22
* Copyright (c) 2013, Daniel Murphy
33
* All rights reserved.
4-
*
4+
*
55
* Redistribution and use in source and binary forms, with or without modification,
66
* are permitted provided that the following conditions are met:
77
* * Redistributions of source code must retain the above copyright notice,
88
* this list of conditions and the following disclaimer.
99
* * Redistributions in binary form must reproduce the above copyright notice,
1010
* this list of conditions and the following disclaimer in the documentation
1111
* and/or other materials provided with the distribution.
12-
*
12+
*
1313
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1414
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1515
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -113,11 +113,6 @@ public void setZero() {
113113
z = 0;
114114
}
115115

116-
@Override
117-
public Vec3 clone() {
118-
return new Vec3(this);
119-
}
120-
121116
@Override
122117
public String toString() {
123118
return "(" + x + "," + y + "," + z + ")";
@@ -159,7 +154,7 @@ public final static void crossToOut(Vec3 a, Vec3 b, Vec3 out) {
159154
out.y = tempy;
160155
out.z = tempz;
161156
}
162-
157+
163158
public final static void crossToOutUnsafe(Vec3 a, Vec3 b, Vec3 out) {
164159
assert(out != b);
165160
assert(out != a);

0 commit comments

Comments
 (0)