Skip to content

Commit 70db300

Browse files
committed
build: Bump build deps
Resolve an issue with DiscreteTransform2 logic brought up by error-prone
1 parent bdd66ef commit 70db300

File tree

6 files changed

+44
-40
lines changed

6 files changed

+44
-40
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: License Check
1+
name: Spotless Check
22

33
on:
44
push:
@@ -8,5 +8,5 @@ on:
88

99
jobs:
1010
call-check:
11-
uses: SpongePowered/.github/.github/workflows/shared-check-license.yaml@master
11+
uses: SpongePowered/.github/.github/workflows/shared-check-spotless.yaml@master
1212
secrets: inherit

build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,12 @@ spongeConvention {
243243
}
244244

245245
indra {
246+
val checkstyleVersion: String by project
247+
246248
javaVersions {
247249
testWith(8, 11, 17)
248250
}
251+
checkstyle(checkstyleVersion)
249252

250253
configurePublications {
251254
artifactId = project.name.toLowerCase()

gradle.properties

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ javadocPublishRoot=https://jd.spongepowered.org/
99
org.gradle.parallel=true
1010

1111
adventureVersion=4.10.0
12-
caffeineVersion=2.9.2
12+
caffeineVersion=2.9.3
13+
checkstyleVersion=10.3.4
1314
configurateVersion=4.1.2
14-
errorproneVersion=2.10.0
15-
junitVersion=5.8.1
15+
errorproneVersion=2.16
16+
junitVersion=5.9.1
1617
log4jVersion=2.8.1
1718
mathVersion=2.0.1
18-
mockitoVersion=4.0.0
19+
mockitoVersion=4.8.0
1920
pluginSpiVersion=0.3.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

settings.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ pluginManagement {
77
}
88
}
99
plugins {
10-
val indraVersion = "2.1.1"
10+
val indraVersion = "3.0.1"
1111
id("org.spongepowered.gradle.event-impl-gen") version "7.0.0"
12-
id("org.spongepowered.gradle.sponge.dev") version "2.0.2"
13-
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.5"
14-
id("net.ltgt.errorprone") version "2.0.2"
12+
id("org.spongepowered.gradle.sponge.dev") version "2.1.1"
13+
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.6"
14+
id("net.ltgt.errorprone") version "3.0.1"
1515
id("net.kyori.indra.publishing") version indraVersion
1616
id("net.kyori.indra.publishing.sonatype") version indraVersion
1717
id("net.kyori.indra.checkstyle") version indraVersion

src/main/java/org/spongepowered/api/util/DiscreteTransform2.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class DiscreteTransform2 {
5353
private final Vector3d matrixRow0;
5454
private final Vector3d matrixRow1;
5555

56-
private DiscreteTransform2(Matrix3d matrix) {
56+
private DiscreteTransform2(final Matrix3d matrix) {
5757
this.matrix = matrix;
5858
this.matrixRow0 = matrix.row(0);
5959
this.matrixRow1 = matrix.row(1);
@@ -75,7 +75,7 @@ public Matrix3d matrix() {
7575
* @param vector The original vector
7676
* @return The transformed vector
7777
*/
78-
public Vector2i transform(Vector2i vector) {
78+
public Vector2i transform(final Vector2i vector) {
7979
return this.transform(vector.x(), vector.y());
8080
}
8181

@@ -87,7 +87,7 @@ public Vector2i transform(Vector2i vector) {
8787
* @param y The y coordinate of the original vector
8888
* @return The transformed vector
8989
*/
90-
public Vector2i transform(int x, int y) {
90+
public Vector2i transform(final int x, final int y) {
9191
return new Vector2i(this.transformX(x, y), this.transformY(x, y));
9292
}
9393

@@ -98,7 +98,7 @@ public Vector2i transform(int x, int y) {
9898
* @param vector The original vector
9999
* @return The transformed x coordinate
100100
*/
101-
public int transformX(Vector2i vector) {
101+
public int transformX(final Vector2i vector) {
102102
return this.transformX(vector.x(), vector.y());
103103
}
104104

@@ -110,7 +110,7 @@ public int transformX(Vector2i vector) {
110110
* @param y The y coordinate of the original vector
111111
* @return The transformed x coordinate
112112
*/
113-
public int transformX(int x, int y) {
113+
public int transformX(final int x, final int y) {
114114
return GenericMath.floor(this.matrixRow0.dot(x, y, 1) + GenericMath.FLT_EPSILON);
115115
}
116116

@@ -121,7 +121,7 @@ public int transformX(int x, int y) {
121121
* @param vector The original vector
122122
* @return The transformed y coordinate
123123
*/
124-
public int transformY(Vector2i vector) {
124+
public int transformY(final Vector2i vector) {
125125
return this.transformY(vector.x(), vector.y());
126126
}
127127

@@ -133,7 +133,7 @@ public int transformY(Vector2i vector) {
133133
* @param y The y coordinate of the original vector
134134
* @return The transformed y coordinate
135135
*/
136-
public int transformY(int x, int y) {
136+
public int transformY(final int x, final int y) {
137137
return GenericMath.floor(this.matrixRow1.dot(x, y, 1) + GenericMath.FLT_EPSILON);
138138
}
139139

@@ -154,7 +154,7 @@ public DiscreteTransform2 invert() {
154154
* @param that The transform to compose with
155155
* @return The new composed transform
156156
*/
157-
public DiscreteTransform2 compose(DiscreteTransform2 that) {
157+
public DiscreteTransform2 compose(final DiscreteTransform2 that) {
158158
return new DiscreteTransform2(this.matrix.mul(that.matrix));
159159
}
160160

@@ -166,7 +166,7 @@ public DiscreteTransform2 compose(DiscreteTransform2 that) {
166166
* @param that The transform to compose with
167167
* @return The new composed transform
168168
*/
169-
public DiscreteTransform2 andThen(DiscreteTransform2 that) {
169+
public DiscreteTransform2 andThen(final DiscreteTransform2 that) {
170170
return that.compose(this);
171171
}
172172

@@ -176,7 +176,7 @@ public DiscreteTransform2 andThen(DiscreteTransform2 that) {
176176
* @param vector The translation vector
177177
* @return The translated transform as a copy
178178
*/
179-
public DiscreteTransform2 withTranslation(Vector2i vector) {
179+
public DiscreteTransform2 withTranslation(final Vector2i vector) {
180180
return this.withTranslation(vector.x(), vector.y());
181181
}
182182

@@ -187,7 +187,7 @@ public DiscreteTransform2 withTranslation(Vector2i vector) {
187187
* @param y The y coordinate of the translation
188188
* @return The translated transform as a copy
189189
*/
190-
public DiscreteTransform2 withTranslation(int x, int y) {
190+
public DiscreteTransform2 withTranslation(final int x, final int y) {
191191
return new DiscreteTransform2(this.matrix.translate(x, y));
192192
}
193193

@@ -198,7 +198,7 @@ public DiscreteTransform2 withTranslation(int x, int y) {
198198
* @param a The scale factor
199199
* @return The scaled transform as a copy
200200
*/
201-
public DiscreteTransform2 withScale(int a) {
201+
public DiscreteTransform2 withScale(final int a) {
202202
return this.withScale(a, a);
203203
}
204204

@@ -209,7 +209,7 @@ public DiscreteTransform2 withScale(int a) {
209209
* @param vector The scale vector
210210
* @return The scaled transform as a copy
211211
*/
212-
public DiscreteTransform2 withScale(Vector2i vector) {
212+
public DiscreteTransform2 withScale(final Vector2i vector) {
213213
return this.withScale(vector.x(), vector.y());
214214
}
215215

@@ -221,7 +221,7 @@ public DiscreteTransform2 withScale(Vector2i vector) {
221221
* @param y The scale factor on y
222222
* @return The scaled transform as a copy
223223
*/
224-
public DiscreteTransform2 withScale(int x, int y) {
224+
public DiscreteTransform2 withScale(final int x, final int y) {
225225
if (x == 0) {
226226
throw new IllegalArgumentException("x == 0");
227227
}
@@ -240,7 +240,7 @@ public DiscreteTransform2 withScale(int x, int y) {
240240
* @param quarterTurns The number of quarter turns in this rotation
241241
* @return The rotated transform as a copy
242242
*/
243-
public DiscreteTransform2 withRotation(int quarterTurns) {
243+
public DiscreteTransform2 withRotation(final int quarterTurns) {
244244
return new DiscreteTransform2(this.matrix.rotate(Complexd.fromAngleDeg(quarterTurns * 90)));
245245
}
246246

@@ -257,7 +257,7 @@ public DiscreteTransform2 withRotation(int quarterTurns) {
257257
* the center
258258
* @return The rotated transform as a copy
259259
*/
260-
public DiscreteTransform2 withRotation(int quarterTurns, Vector2i point, boolean tileCorner) {
260+
public DiscreteTransform2 withRotation(final int quarterTurns, final Vector2i point, final boolean tileCorner) {
261261
Vector2d pointDouble = point.toDouble();
262262
if (tileCorner) {
263263
pointDouble = pointDouble.add(0.5, 0.5);
@@ -283,7 +283,7 @@ public DiscreteTransform2 withRotation(int quarterTurns, Vector2i point, boolean
283283
* of the center on the y axis
284284
* @return The rotated transform as a copy
285285
*/
286-
public DiscreteTransform2 withRotation(int halfTurns, Vector2i point, boolean tileCornerX, boolean tileCornerY) {
286+
public DiscreteTransform2 withRotation(final int halfTurns, final Vector2i point, final boolean tileCornerX, final boolean tileCornerY) {
287287
Vector2d pointDouble = point.toDouble();
288288
if (tileCornerX) {
289289
pointDouble = pointDouble.add(0.5, 0);
@@ -302,7 +302,7 @@ public DiscreteTransform2 withRotation(int halfTurns, Vector2i point, boolean ti
302302
* @param transform The transformation to add
303303
* @return The added transforms as a copy
304304
*/
305-
public DiscreteTransform2 withTransformation(DiscreteTransform2 transform) {
305+
public DiscreteTransform2 withTransformation(final DiscreteTransform2 transform) {
306306
return new DiscreteTransform2(transform.matrix().mul(this.matrix()));
307307
}
308308

@@ -313,7 +313,7 @@ public DiscreteTransform2 withTransformation(DiscreteTransform2 transform) {
313313
* @param matrix The matrix to use for the transform
314314
* @return The new transform, or {@link Optional#empty()}
315315
*/
316-
public static Optional<DiscreteTransform2> of(Matrix3d matrix) {
316+
public static Optional<DiscreteTransform2> of(final Matrix3d matrix) {
317317
if (Arrays.stream(matrix.toArray())
318318
.anyMatch(value -> Math.rint(value) != value)) {
319319
return Optional.empty();
@@ -327,7 +327,7 @@ public static Optional<DiscreteTransform2> of(Matrix3d matrix) {
327327
* @param vector The translation vector
328328
* @return The new translation transform
329329
*/
330-
public static DiscreteTransform2 fromTranslation(Vector2i vector) {
330+
public static DiscreteTransform2 fromTranslation(final Vector2i vector) {
331331
return DiscreteTransform2.fromTranslation(vector.x(), vector.y());
332332
}
333333

@@ -338,7 +338,7 @@ public static DiscreteTransform2 fromTranslation(Vector2i vector) {
338338
* @param y The y coordinate of the translation
339339
* @return The new translation transform
340340
*/
341-
public static DiscreteTransform2 fromTranslation(int x, int y) {
341+
public static DiscreteTransform2 fromTranslation(final int x, final int y) {
342342
return new DiscreteTransform2(Matrix3d.createTranslation(x, y));
343343
}
344344

@@ -349,7 +349,7 @@ public static DiscreteTransform2 fromTranslation(int x, int y) {
349349
* @param a The scale factor
350350
* @return The new scale transform
351351
*/
352-
public static DiscreteTransform2 fromScale(int a) {
352+
public static DiscreteTransform2 fromScale(final int a) {
353353
return DiscreteTransform2.fromScale(a, a);
354354
}
355355

@@ -360,7 +360,7 @@ public static DiscreteTransform2 fromScale(int a) {
360360
* @param vector The scale vector
361361
* @return The new scale transform
362362
*/
363-
public static DiscreteTransform2 fromScale(Vector2i vector) {
363+
public static DiscreteTransform2 fromScale(final Vector2i vector) {
364364
return DiscreteTransform2.fromScale(vector.x(), vector.y());
365365
}
366366

@@ -372,7 +372,7 @@ public static DiscreteTransform2 fromScale(Vector2i vector) {
372372
* @param y The scale factor on y
373373
* @return The new scale transform
374374
*/
375-
public static DiscreteTransform2 fromScale(int x, int y) {
375+
public static DiscreteTransform2 fromScale(final int x, final int y) {
376376
if (x == 0) {
377377
throw new IllegalArgumentException("x == 0");
378378
}
@@ -391,7 +391,7 @@ public static DiscreteTransform2 fromScale(int x, int y) {
391391
* @param quarterTurns The number of quarter turns in this rotation
392392
* @return The new rotation transform
393393
*/
394-
public static DiscreteTransform2 fromRotation(int quarterTurns) {
394+
public static DiscreteTransform2 fromRotation(final int quarterTurns) {
395395
return new DiscreteTransform2(Matrix3d.createRotation(Complexd.fromAngleDeg(quarterTurns * 90)));
396396
}
397397

@@ -407,7 +407,7 @@ public static DiscreteTransform2 fromRotation(int quarterTurns) {
407407
* the center
408408
* @return The new rotation transform
409409
*/
410-
public static DiscreteTransform2 fromRotation(int quarterTurns, Vector2i point, boolean tileCorner) {
410+
public static DiscreteTransform2 fromRotation(final int quarterTurns, final Vector2i point, final boolean tileCorner) {
411411
Vector2d pointDouble = point.toDouble();
412412
if (tileCorner) {
413413
pointDouble = pointDouble.add(0.5, 0.5);
@@ -432,7 +432,7 @@ public static DiscreteTransform2 fromRotation(int quarterTurns, Vector2i point,
432432
* of the center on the y axis
433433
* @return The new rotation transform
434434
*/
435-
public static DiscreteTransform2 fromRotation(int halfTurns, Vector2i point, boolean tileCornerX, boolean tileCornerY) {
435+
public static DiscreteTransform2 fromRotation(final int halfTurns, final Vector2i point, final boolean tileCornerX, final boolean tileCornerY) {
436436
Vector2d pointDouble = point.toDouble();
437437
if (tileCornerX) {
438438
pointDouble = pointDouble.add(0.5, 0);
@@ -454,7 +454,7 @@ public static DiscreteTransform2 fromRotation(int halfTurns, Vector2i point, boo
454454
* @param size The size of the area to rotate
455455
* @return The new rotation transform
456456
*/
457-
public static DiscreteTransform2 rotationAroundCenter(int quarterTurns, Vector2i size) {
457+
public static DiscreteTransform2 rotationAroundCenter(final int quarterTurns, final Vector2i size) {
458458
if (size.x() <= 0) {
459459
throw new IllegalArgumentException("The size on x must be positive");
460460
}
@@ -464,7 +464,7 @@ public static DiscreteTransform2 rotationAroundCenter(int quarterTurns, Vector2i
464464
final boolean mul180 = (quarterTurns & 1) == 0;
465465
final boolean xEven = (size.x() & 1) == 0;
466466
final boolean yEven = (size.y() & 1) == 0;
467-
if (!mul180 || xEven != yEven) {
467+
if (!mul180 && xEven != yEven) {
468468
throw new IllegalArgumentException("The size must have the same parity on all axes for rotations that are "
469469
+ "not a multiple of 180 degrees");
470470
}

0 commit comments

Comments
 (0)