Skip to content

Commit 986f516

Browse files
authored
Document PMD fixes inline (#3976)
1 parent 3c2bd60 commit 986f516

40 files changed

+248
-275
lines changed

CodenameOne/src/com/codename1/ads/InnerActive.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
* @author Chen
3939
*/
40-
public class InnerActive extends AdsService{
40+
public class InnerActive extends AdsService{ // PMD Fix: UnusedPrivateField removed obsolete field
4141

4242
private final String REQUEST_URL = "http://m2m1.inner-active.com/simpleM2M/clientRequestHtmlAd";
4343

@@ -51,9 +51,6 @@ public class InnerActive extends AdsService{
5151
//UDID/IMEI
5252
private String hid;
5353

54-
//client Id
55-
private String cid;
56-
5754
private boolean banner = true;
5855

5956
private static boolean testAds = true;

CodenameOne/src/com/codename1/background/BackgroundFetch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ public interface BackgroundFetch {
6868
* @see com.codename1.ui.Display.getPreferredBackgroundFetchInterval()
6969
* @see com.codename1.ui.Display.isBackgroundFetchSupported()
7070
*/
71-
public void performBackgroundFetch(long deadline, Callback<Boolean> onComplete);
71+
void performBackgroundFetch(long deadline, Callback<Boolean> onComplete); // PMD Fix: UnnecessaryModifier removed
7272

7373
}

CodenameOne/src/com/codename1/capture/VideoCaptureConstraints.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ public class VideoCaptureConstraints {
101101
* to transfer the "preferred" constraints to corresponding "actual" constraints
102102
* based on what the platform supports.
103103
*/
104-
public static interface Compiler {
105-
public VideoCaptureConstraints compile(VideoCaptureConstraints cnst);
104+
public interface Compiler { // PMD Fix: UnnecessaryModifier removed implicit static
105+
VideoCaptureConstraints compile(VideoCaptureConstraints cnst); // PMD Fix: UnnecessaryModifier removed redundant public
106106
}
107107

108108
/**

CodenameOne/src/com/codename1/charts/ChartComponent.java

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -536,29 +536,21 @@ public void pointerDragged(int[] x, int[] y) {
536536
}
537537

538538
double[] zoomLimits = xyChart.getRenderer().getZoomLimits();
539-
if (zoomLimits != null && zoomLimits[0] != 0) {
540-
if (maxX - minX < zoomLimits[0]) {
541-
maxX = xyChart.getRenderer().getXAxisMax();
542-
minX = xyChart.getRenderer().getXAxisMin();
543-
}
539+
if (zoomLimits != null && zoomLimits[0] != 0 && maxX - minX < zoomLimits[0]) { // PMD Fix: CollapsibleIfStatements
540+
maxX = xyChart.getRenderer().getXAxisMax();
541+
minX = xyChart.getRenderer().getXAxisMin();
544542
}
545-
if (zoomLimits != null && zoomLimits[1] != 0) {
546-
if (maxX - minX > zoomLimits[1]) {
547-
maxX = xyChart.getRenderer().getXAxisMax();
548-
minX = xyChart.getRenderer().getXAxisMin();
549-
}
543+
if (zoomLimits != null && zoomLimits[1] != 0 && maxX - minX > zoomLimits[1]) { // PMD Fix: CollapsibleIfStatements
544+
maxX = xyChart.getRenderer().getXAxisMax();
545+
minX = xyChart.getRenderer().getXAxisMin();
550546
}
551-
if (zoomLimits != null && zoomLimits[2] != 0) {
552-
if (maxY - minY < zoomLimits[2]) {
553-
maxY = xyChart.getRenderer().getYAxisMax();
554-
minY = xyChart.getRenderer().getYAxisMin();
555-
}
547+
if (zoomLimits != null && zoomLimits[2] != 0 && maxY - minY < zoomLimits[2]) { // PMD Fix: CollapsibleIfStatements
548+
maxY = xyChart.getRenderer().getYAxisMax();
549+
minY = xyChart.getRenderer().getYAxisMin();
556550
}
557-
if (zoomLimits != null && zoomLimits[3] != 0) {
558-
if (maxY - minY > zoomLimits[3]) {
559-
maxY = xyChart.getRenderer().getYAxisMax();
560-
minY = xyChart.getRenderer().getYAxisMin();
561-
}
551+
if (zoomLimits != null && zoomLimits[3] != 0 && maxY - minY > zoomLimits[3]) { // PMD Fix: CollapsibleIfStatements
552+
maxY = xyChart.getRenderer().getYAxisMax();
553+
minY = xyChart.getRenderer().getYAxisMin();
562554
}
563555

564556
if (!xyChart.getRenderer().isZoomXEnabled()) {
@@ -894,7 +886,7 @@ private void zoomTransition(double minX, double maxX, double minY, double maxY,
894886
}
895887

896888
private interface IZoomTransition {
897-
public void start();
889+
void start();
898890
}
899891

900892
private class ZoomTransition implements Animation, IZoomTransition {

CodenameOne/src/com/codename1/charts/compat/GradientDrawable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public GradientDrawable(Orientation orientation, int[] colors) {
3939
this.colors = colors;
4040
}
4141

42-
public static enum Orientation {
42+
public enum Orientation { // PMD Fix: UnnecessaryModifier removed redundant static
4343
BL_TR,
4444
BOTTOM_TOP,
4545
BR_TL,

CodenameOne/src/com/codename1/charts/compat/Paint.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@
3434
* @author shannah
3535
* @deprecated
3636
*/
37-
public class Paint {
37+
public class Paint { // PMD Fix: UnusedPrivateField removed redundant antiAlias flag
3838

3939

4040
static Graphics g;
41-
private boolean antiAlias;
4241
private Font typeface = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
4342
private int strokeCap = Cap.BUTT;
4443
private int strokeJoin = Join.BEVEL;
@@ -154,7 +153,7 @@ public float measureText(char[] chars, int start, int count){
154153

155154

156155
public void setAntiAlias(boolean antialiasing) {
157-
this.antiAlias = antialiasing;
156+
// No-op for compatibility.
158157
}
159158

160159
public Font getTypeface() {
@@ -209,7 +208,7 @@ public void setStrokeWidth(float i) {
209208

210209

211210

212-
public static enum Style {
211+
public enum Style { // PMD Fix: UnnecessaryModifier removed redundant static
213212
FILL,
214213
FILL_AND_STROKE,
215214
STROKE

CodenameOne/src/com/codename1/charts/models/XYSeries.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,14 @@ private void initRange() {
8484
mMaxX = MathHelper.NULL_VALUE;
8585
mMinY = MathHelper.NULL_VALUE;
8686
mMaxY = MathHelper.NULL_VALUE;
87-
int length = getItemCount();
87+
int length = getItemCount(); // PMD Fix: UnusedLocalVariable removed redundant loop index
8888
for (int k = 0; k < length; k++) {
8989
double x = getX(k);
9090
double y = getY(k);
9191
updateRange(x, y);
9292
}
9393

94-
int i=0;
95-
}
94+
}
9695

9796
/**
9897
* Updates the range on both axes.

CodenameOne/src/com/codename1/charts/renderers/BasicStroke.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ public class BasicStroke {
5151
* @param intervals the path effect intervals
5252
* @param phase the path effect phase
5353
*/
54-
public BasicStroke(int cap, int join, float miter, float[] intervals, float phase) {
55-
mCap = cap;
56-
mJoin = join;
57-
mMiter = miter;
58-
mIntervals = intervals;
59-
}
54+
public BasicStroke(int cap, int join, float miter, float[] intervals, float phase) {
55+
mCap = cap;
56+
mJoin = join;
57+
mMiter = miter;
58+
mIntervals = intervals;
59+
mPhase = phase; // PMD Fix: UnusedFormalParameter store constructor argument
60+
}
6061

6162
/**
6263
* Returns the stroke cap.

CodenameOne/src/com/codename1/charts/renderers/DefaultRenderer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* An abstract renderer to be extended by the multiple series classes.
2525
*/
26-
public class DefaultRenderer {
26+
public class DefaultRenderer { // PMD Fix: UnusedPrivateField removed unused text font constant
2727
/** The chart title. */
2828
private String mChartTitle = "";
2929
/** The chart title text size. */
@@ -34,8 +34,6 @@ public class DefaultRenderer {
3434
public static final int BACKGROUND_COLOR = 0x0;
3535
/** The default color for text. */
3636
public static final int TEXT_COLOR = 0xEAEAEA;
37-
/** A text font for regular text, like the chart labels. */
38-
private static final Font REGULAR_TEXT_FONT = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
3937
/** The typeface name for the texts. */
4038
private int mTextTypefaceName = Font.FACE_SYSTEM;
4139
/** The typeface style for the texts. */

CodenameOne/src/com/codename1/charts/renderers/XYMultipleSeriesRenderer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ public enum Orientation {
121121
/** The rotate angle. */
122122
private int mAngle = 0;
123123

124-
private Orientation(int angle) {
125-
mAngle = angle;
126-
}
124+
Orientation(int angle) { // PMD Fix: UnnecessaryModifier removed implicit private keyword
125+
mAngle = angle;
126+
}
127127

128128
/**
129129
* Return the orientation rotate angle.

0 commit comments

Comments
 (0)