Skip to content

Commit 2c6e5a1

Browse files
authored
Fix SpotBugs naming issues (#4408)
1 parent 6893bf2 commit 2c6e5a1

File tree

5 files changed

+42
-48
lines changed

5 files changed

+42
-48
lines changed

.github/scripts/generate-quality-report.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,8 @@ def main() -> None:
811811
"EQ_COMPARETO_USE_OBJECT_EQUALS",
812812
"MS_EXPOSE_REP",
813813
"NM_CONFUSING",
814+
"NM_FIELD_NAMING_CONVENTION",
815+
"NM_METHOD_NAMING_CONVENTION",
814816
"NO_NOTIFY_NOT_NOTIFYALL",
815817
"NP_LOAD_OF_KNOWN_NULL_VALUE",
816818
"NP_BOOLEAN_RETURN_NULL",

CodenameOne/src/com/codename1/analytics/AnalyticsService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static void visit(String page, String referer) {
167167
*/
168168
public static void sendCrashReport(Throwable t, String message, boolean fatal) {
169169
// https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#exception
170-
ConnectionRequest req = GetGARequest();
170+
ConnectionRequest req = getGaRequest();
171171
req.addArgument("t", "exception");
172172
System.out.println(message);
173173
req.addArgument("exd", message.substring(0, Math.min(message.length(), 150) - 1));
@@ -180,7 +180,7 @@ public static void sendCrashReport(Throwable t, String message, boolean fatal) {
180180
NetworkManager.getInstance().addToQueue(req);
181181
}
182182

183-
private static ConnectionRequest GetGARequest() {
183+
private static ConnectionRequest getGaRequest() {
184184
ConnectionRequest req = new ConnectionRequest();
185185
req.setUrl("https://www.google-analytics.com/collect");
186186
req.setPost(true);
@@ -246,7 +246,7 @@ public void actionPerformed(ActionEvent evt) {
246246
}
247247
if (appsMode) {
248248
// https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#apptracking
249-
final ConnectionRequest req = GetGARequest();
249+
final ConnectionRequest req = getGaRequest();
250250
req.addArgument("t", "appview");
251251
req.addArgument("an", Display.getInstance().getProperty("AppName", "Codename One App"));
252252
String version = Display.getInstance().getProperty("AppVersion", "1.0");

CodenameOne/src/com/codename1/charts/util/ColorUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public IColor(int argb) {
129129
this.green = (argb >>> 8) & 0xff;
130130
this.blue = (argb & 0xff);
131131

132-
this.argb = ToARGB(this);
132+
this.argb = toArgb(this);
133133
}
134134

135135

@@ -144,10 +144,10 @@ public IColor(int a, int r, int g, int b) {
144144
this.green = (g & 0xff);
145145
this.blue = (b & 0xff);
146146

147-
this.argb = ToARGB(this);
147+
this.argb = toArgb(this);
148148
}
149149

150-
private static int ToARGB(IColor c) { // PMD Fix: UnnecessaryModifier removed redundant final
150+
private static int toArgb(IColor c) { // PMD Fix: UnnecessaryModifier removed redundant final
151151
return ((c.alpha << 24) |
152152
(c.red << 16) |
153153
(c.green << 8) |

CodenameOne/src/com/codename1/ui/geom/GeneralPath.java

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,19 +2984,19 @@ public static boolean isInsideEvenOdd(int cross) {
29842984
public static class QuadCurve {
29852985

29862986
double ax, ay, bx, by;
2987-
double Ax, Ay, Bx, By;
2987+
double axCoeff, ayCoeff, bxCoeff, byCoeff;
29882988

29892989
public QuadCurve(double x1, double y1, double cx, double cy, double x2, double y2) {
29902990
ax = x2 - x1;
29912991
ay = y2 - y1;
29922992
bx = cx - x1;
29932993
by = cy - y1;
29942994

2995-
Bx = bx + bx; // Bx = 2.0 * bx
2996-
Ax = ax - Bx; // Ax = ax - 2.0 * bx
2995+
bxCoeff = bx + bx; // Bx = 2.0 * bx
2996+
axCoeff = ax - bxCoeff; // Ax = ax - 2.0 * bx
29972997

2998-
By = by + by; // By = 2.0 * by
2999-
Ay = ay - By; // Ay = ay - 2.0 * by
2998+
byCoeff = by + by; // By = 2.0 * by
2999+
ayCoeff = ay - byCoeff; // Ay = ay - 2.0 * by
30003000
}
30013001

30023002
int cross(double[] res, int rc, double py1, double py2) {
@@ -3024,10 +3024,10 @@ int cross(double[] res, int rc, double py1, double py2) {
30243024
continue;
30253025
}
30263026
// CURVE-INSIDE
3027-
double ry = t * (t * Ay + By);
3027+
double ry = t * (t * ayCoeff + byCoeff);
30283028
// ry = t * t * Ay + t * By
30293029
if (ry > py2) {
3030-
double rxt = t * Ax + bx;
3030+
double rxt = t * axCoeff + bx;
30313031
// rxt = 2.0 * t * Ax + Bx = 2.0 * t * Ax + 2.0 * bx
30323032
if (rxt > -DELTA && rxt < DELTA) {
30333033
continue;
@@ -3040,17 +3040,17 @@ int cross(double[] res, int rc, double py1, double py2) {
30403040
}
30413041

30423042
int solvePoint(double[] res, double px) {
3043-
double[] eqn = {-px, Bx, Ax};
3043+
double[] eqn = {-px, bxCoeff, axCoeff};
30443044
return solveQuad(eqn, res);
30453045
}
30463046

30473047
int solveExtrem(double[] res) {
30483048
int rc = 0;
3049-
if (!isZero(Ax)) {
3050-
res[rc++] = -Bx / (Ax + Ax);
3049+
if (!isZero(axCoeff)) {
3050+
res[rc++] = -bxCoeff / (axCoeff + axCoeff);
30513051
}
3052-
if (!isZero(Ay)) {
3053-
res[rc++] = -By / (Ay + Ay);
3052+
if (!isZero(ayCoeff)) {
3053+
res[rc++] = -byCoeff / (ayCoeff + ayCoeff);
30543054
}
30553055
return rc;
30563056
}
@@ -3059,11 +3059,11 @@ int addBound(double[] bound, int bc, double[] res, int rc, double minX, double m
30593059
for (int i = 0; i < rc; i++) {
30603060
double t = res[i];
30613061
if (t > -DELTA && t < 1 + DELTA) {
3062-
double rx = t * (t * Ax + Bx);
3062+
double rx = t * (t * axCoeff + bxCoeff);
30633063
if (minX <= rx && rx <= maxX) {
30643064
bound[bc++] = t;
30653065
bound[bc++] = rx;
3066-
bound[bc++] = t * (t * Ay + By);
3066+
bound[bc++] = t * (t * ayCoeff + byCoeff);
30673067
bound[bc++] = id;
30683068
if (changeId) {
30693069
id++;
@@ -3082,8 +3082,8 @@ int addBound(double[] bound, int bc, double[] res, int rc, double minX, double m
30823082
public static class CubicCurve {
30833083

30843084
double ax, ay, bx, by, cx, cy;
3085-
double Ax, Ay, Bx, By, Cx, Cy;
3086-
double Ax3, Bx2;
3085+
double axCoeff, ayCoeff, bxCoeff, byCoeff, cxCoeff, cyCoeff;
3086+
double axCoeff3, bxCoeff2;
30873087

30883088
public CubicCurve(double x1, double y1, double cx1, double cy1, double cx2, double cy2, double x2, double y2) {
30893089
ax = x2 - x1;
@@ -3093,16 +3093,16 @@ public CubicCurve(double x1, double y1, double cx1, double cy1, double cx2, doub
30933093
cx = cx2 - x1;
30943094
cy = cy2 - y1;
30953095

3096-
Cx = bx + bx + bx; // Cx = 3.0 * bx
3097-
Bx = cx + cx + cx - Cx - Cx; // Bx = 3.0 * cx - 6.0 * bx
3098-
Ax = ax - Bx - Cx; // Ax = ax - 3.0 * cx + 3.0 * bx
3096+
cxCoeff = bx + bx + bx; // Cx = 3.0 * bx
3097+
bxCoeff = cx + cx + cx - cxCoeff - cxCoeff; // Bx = 3.0 * cx - 6.0 * bx
3098+
axCoeff = ax - bxCoeff - cxCoeff; // Ax = ax - 3.0 * cx + 3.0 * bx
30993099

3100-
Cy = by + by + by; // Cy = 3.0 * by
3101-
By = cy + cy + cy - Cy - Cy; // By = 3.0 * cy - 6.0 * by
3102-
Ay = ay - By - Cy; // Ay = ay - 3.0 * cy + 3.0 * by
3100+
cyCoeff = by + by + by; // Cy = 3.0 * by
3101+
byCoeff = cy + cy + cy - cyCoeff - cyCoeff; // By = 3.0 * cy - 6.0 * by
3102+
ayCoeff = ay - byCoeff - cyCoeff; // Ay = ay - 3.0 * cy + 3.0 * by
31033103

3104-
Ax3 = Ax + Ax + Ax;
3105-
Bx2 = Bx + Bx;
3104+
axCoeff3 = axCoeff + axCoeff + axCoeff;
3105+
bxCoeff2 = bxCoeff + bxCoeff;
31063106
}
31073107

31083108
int cross(double[] res, int rc, double py1, double py2) {
@@ -3129,13 +3129,13 @@ int cross(double[] res, int rc, double py1, double py2) {
31293129
continue;
31303130
}
31313131
// CURVE-INSIDE
3132-
double ry = t * (t * (t * Ay + By) + Cy);
3132+
double ry = t * (t * (t * ayCoeff + byCoeff) + cyCoeff);
31333133
// ry = t * t * t * Ay + t * t * By + t * Cy
31343134
if (ry > py2) {
3135-
double rxt = t * (t * Ax3 + Bx2) + Cx;
3135+
double rxt = t * (t * axCoeff3 + bxCoeff2) + cxCoeff;
31363136
// rxt = 3.0 * t * t * Ax + 2.0 * t * Bx + Cx
31373137
if (rxt > -DELTA && rxt < DELTA) {
3138-
rxt = t * (Ax3 + Ax3) + Bx2;
3138+
rxt = t * (axCoeff3 + axCoeff3) + bxCoeff2;
31393139
// rxt = 6.0 * t * Ax + 2.0 * Bx
31403140
if (rxt < -DELTA || rxt > DELTA) {
31413141
// Inflection point
@@ -3151,29 +3151,29 @@ int cross(double[] res, int rc, double py1, double py2) {
31513151
}
31523152

31533153
int solvePoint(double[] res, double px) {
3154-
double[] eqn = {-px, Cx, Bx, Ax};
3154+
double[] eqn = {-px, cxCoeff, bxCoeff, axCoeff};
31553155
return solveCubic(eqn, res);
31563156
}
31573157

31583158
int solveExtremX(double[] res) {
3159-
double[] eqn = {Cx, Bx2, Ax3};
3159+
double[] eqn = {cxCoeff, bxCoeff2, axCoeff3};
31603160
return solveQuad(eqn, res);
31613161
}
31623162

31633163
int solveExtremY(double[] res) {
3164-
double[] eqn = {Cy, By + By, Ay + Ay + Ay};
3164+
double[] eqn = {cyCoeff, byCoeff + byCoeff, ayCoeff + ayCoeff + ayCoeff};
31653165
return solveQuad(eqn, res);
31663166
}
31673167

31683168
int addBound(double[] bound, int bc, double[] res, int rc, double minX, double maxX, boolean changeId, int id) {
31693169
for (int i = 0; i < rc; i++) {
31703170
double t = res[i];
31713171
if (t > -DELTA && t < 1 + DELTA) {
3172-
double rx = t * (t * (t * Ax + Bx) + Cx);
3172+
double rx = t * (t * (t * axCoeff + bxCoeff) + cxCoeff);
31733173
if (minX <= rx && rx <= maxX) {
31743174
bound[bc++] = t;
31753175
bound[bc++] = rx;
3176-
bound[bc++] = t * (t * (t * Ay + By) + Cy);
3176+
bound[bc++] = t * (t * (t * ayCoeff + byCoeff) + cyCoeff);
31773177
bound[bc++] = id;
31783178
if (changeId) {
31793179
id++;

CodenameOne/src/com/codename1/ui/layouts/GridBagLayout.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ protected GridBagLayoutInfo GetLayoutInfo(Container parent, int sizeflag) {
230230
}
231231
}*/
232232

233-
protected void ArrangeGrid(Container parent) {
233+
protected void arrangeGrid(Container parent) {
234234
ParentInfo info = lastParentInfo = getParentInfo(parent);
235235
if (getComponentsNumber(parent) == 0) {
236236
return;
@@ -253,14 +253,6 @@ protected GridBagConstraints lookupConstraints(Component comp) {
253253
return cons;
254254
}
255255

256-
protected void adjustForGravity(GridBagConstraints constraints, Rectangle r) {
257-
AdjustForGravity(constraints, r);
258-
}
259-
260-
protected void arrangeGrid(Container parent) {
261-
ArrangeGrid(parent);
262-
}
263-
264256
/*protected GridBagLayoutInfo getLayoutInfo(Container parent, int sizeflag) {
265257
return GetLayoutInfo(parent, sizeflag);
266258
}
@@ -274,7 +266,7 @@ protected Dimension getMinSize(Container parent, GridBagLayoutInfo info) {
274266
}
275267
}*/
276268

277-
protected void AdjustForGravity(GridBagConstraints constraints, Rectangle r) {
269+
protected void adjustForGravity(GridBagConstraints constraints, Rectangle r) {
278270
/*try {
279271
// ((GridBagConstraints) constraints).verify();
280272
} catch (IllegalArgumentException e) {

0 commit comments

Comments
 (0)