Skip to content

Commit e295254

Browse files
Fix SpotBugs UPM_UNCALLED_PRIVATE_METHOD violations
Removed unused private methods across multiple files in the CodenameOne core library to address SpotBugs warnings. Updated .github/scripts/generate-quality-report.py to fail on future UPM_UNCALLED_PRIVATE_METHOD violations.
1 parent 0d748a1 commit e295254

20 files changed

+1
-344
lines changed

CodenameOne/src/com/codename1/io/CacheMap.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,6 @@ public Vector getKeysInCache() {
289289
return r;
290290
}
291291

292-
private Vector fetchFromStorageCache(int offset) {
293-
Vector v = getStorageCacheContent();
294-
Object[] arr = (Object[]) v.elementAt(offset);
295-
return (Vector) Storage.getInstance().readObject("$CACHE$" + cachePrefix + arr[1].toString());
296-
}
297-
298292
/**
299293
* Clears the storage cache
300294
*/

CodenameOne/src/com/codename1/io/ConnectionRequest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,10 +2732,6 @@ public void downloadImageToFileSystem(String file, SuccessCallback<Image> onSucc
27322732
downloadImageToFileSystem(file, onSuccess, onFail, true);
27332733
}
27342734

2735-
private void downloadImage(final SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail) {
2736-
downloadImage(onSuccess, onFail, true);
2737-
}
2738-
27392735
private void downloadImage(final SuccessCallback<Image> onSuccess, final FailureCallback<Image> onFail, boolean useCache) {
27402736
setReadResponseForErrors(false);
27412737
if (useCache) {

CodenameOne/src/com/codename1/payment/Purchase.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -746,51 +746,6 @@ public Receipt getFirstReceiptExpiringAfter(Date dt, String... skus) {
746746
return getFirstReceiptExpiringAfter(getReceipts(skus), dt, skus);
747747
}
748748

749-
/**
750-
* Fetch receipts from IAP service synchronously.
751-
*
752-
* @param ifOlderThanMs If the current data is not older than this number of milliseconds
753-
* then it will not attempt to fetch the receipts.
754-
* @return true if data was successfully retrieved. false otherwise.
755-
*/
756-
private boolean loadReceiptsSync(long ifOlderThanMs) {
757-
final boolean[] complete = new boolean[1];
758-
final boolean[] success = new boolean[1];
759-
loadReceipts(ifOlderThanMs, new SuccessCallback<Boolean>() {
760-
761-
public void onSucess(Boolean value) {
762-
complete[0] = true;
763-
success[0] = value;
764-
765-
synchronized (complete) {
766-
complete.notifyAll();
767-
}
768-
769-
}
770-
771-
});
772-
773-
if (!complete[0]) {
774-
Display.getInstance().invokeAndBlock(new Runnable() {
775-
776-
public void run() {
777-
while (!complete[0]) {
778-
synchronized (complete) {
779-
try {
780-
complete.wait();
781-
} catch (InterruptedException ex) {
782-
Thread.currentThread().interrupt();
783-
return;
784-
}
785-
}
786-
}
787-
}
788-
789-
});
790-
}
791-
return success[0];
792-
}
793-
794749
/**
795750
* Indicates whether refunding is possible when the SKU is purchased
796751
*

CodenameOne/src/com/codename1/testing/TestUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
public class TestUtils {
5353
private static boolean verbose;
5454

55+
@SuppressWarnings("unused")
5556
private TestUtils() {
5657
}
5758

CodenameOne/src/com/codename1/ui/BrowserComponent.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,6 @@ public static boolean isNativeBrowserSupported() {
290290
return Display.impl.isNativeBrowserComponentSupported();
291291
}
292292

293-
private static boolean isNumber(Object o) {
294-
if (o == null) {
295-
return false;
296-
}
297-
Class c = o.getClass();
298-
return c == Integer.class || c == Double.class || c == Float.class || c == Long.class || c == Short.class;
299-
}
300-
301293
/**
302294
* Injects parameters into a Javascript string expression. This will quote strings properly. The
303295
* expression should include placeholders for each parameter of the form ${0}, ${1}, etc..
@@ -548,13 +540,6 @@ private SuccessCallback<JSRef> popReturnValueCallback(int id) {
548540
return null;
549541
}
550542

551-
private JSONParser returnValueParser() {
552-
if (returnValueParser == null) {
553-
returnValueParser = new JSONParser();
554-
}
555-
return returnValueParser;
556-
}
557-
558543
@Override
559544
protected void initComponent() {
560545
super.initComponent();

CodenameOne/src/com/codename1/ui/Display.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,15 +2456,6 @@ public boolean hasDragOccured() {
24562456
return dragOccured;
24572457
}
24582458

2459-
private int[] pointerEvent(int off, int[] event) {
2460-
int[] peX = new int[(event.length - 1) / 2];
2461-
int offset = 0;
2462-
for (int iter = off; iter < (event.length - 1); iter += 2) {
2463-
peX[offset] = event[iter];
2464-
offset++;
2465-
}
2466-
return peX;
2467-
}
24682459

24692460
/**
24702461
* Returns true for a case where the EDT has nothing at all to do

CodenameOne/src/com/codename1/ui/Graphics.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -553,18 +553,6 @@ public void drawArc(int x, int y, int width, int height, int startAngle, int arc
553553
impl.drawArc(nativeGraphics, xTranslate + x, yTranslate + y, width, height, startAngle, arcAngle);
554554
}
555555

556-
private void drawStringImpl(String str, int x, int y) {
557-
// remove a commonly used trick to create a spacer label from the paint queue
558-
if (str.length() == 0 || (str.length() == 1 && str.charAt(0) == ' ')) {
559-
return;
560-
}
561-
if (!(current instanceof CustomFont)) {
562-
impl.drawString(nativeGraphics, str, x + xTranslate, y + yTranslate);
563-
} else {
564-
current.drawString(this, str, x, y);
565-
}
566-
}
567-
568556
/**
569557
* Draw a string using the current font and color in the x,y coordinates. The font is drawn
570558
* from the top position and not the baseline.

CodenameOne/src/com/codename1/ui/InputComponent.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ protected InputComponent() {
9393
}
9494

9595
// varags calls are significantly slower in java
96-
private static int max(int a, int b, int c) {
97-
return Math.max(Math.max(a, b), c);
98-
}
99-
10096
private static int max(int a, int b, int c, int d) {
10197
return Math.max(Math.max(Math.max(a, b), c), d);
10298
}

CodenameOne/src/com/codename1/ui/LinearGradientPaint.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,6 @@ public LinearGradientPaint(double startX, double startY, double endX, double end
8585
this.endY = endY;
8686
}
8787

88-
private static double findAngle(double x1, double y1, double x2, double y2) {
89-
return MathUtil.atan((y2 - y1) / (x2 - x1));
90-
}
91-
92-
private static double scaleX(double theta, double x) {
93-
return x / Math.cos(theta);
94-
}
95-
96-
private static double scaleY(double theta, double y) {
97-
return y / Math.sin(theta);
98-
}
9988

10089
/**
10190
* Paints linear gradient in the given bounds.

CodenameOne/src/com/codename1/ui/TextSelection.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -655,11 +655,6 @@ private boolean isVerticallyCoveredByBounds(Component cmp, Rectangle bounds) {
655655
return false;
656656
}
657657

658-
private boolean shouldCoverToEndOfLine(Span span, Rectangle bounds) {
659-
int spy = span.getBounds().getY();
660-
int sph = span.getBounds().getHeight();
661-
return spy + 2 * sph / 3 > bounds.getY() && spy + sph <= bounds.getY() + bounds.getHeight();
662-
}
663658

664659
private void updateSnappedSelectedBounds() {
665660
snappedSelectedBounds.setBounds(selectedBounds.getX(), selectedBounds.getY(), selectedBounds.getWidth(), selectedBounds.getHeight());

0 commit comments

Comments
 (0)