Skip to content

Commit 91c799c

Browse files
committed
Improved CI build validation
1 parent 5391953 commit 91c799c

File tree

10 files changed

+77
-45
lines changed

10 files changed

+77
-45
lines changed

CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ public abstract class CodenameOneImplementation {
123123
*/
124124
private static final int RTL_RANGE_BEGIN = 0x590;
125125
private static final int RTL_RANGE_END = 0x7BF;
126-
private static Object displayLock;
127-
private static boolean bidi;
126+
private Object displayLock;
127+
private boolean bidi;
128128
private static boolean pollingThreadRunning;
129129
private static PushCallback callback;
130130
private static PurchaseCallback purchaseCallback;
@@ -927,16 +927,6 @@ public boolean paintNativePeersBehind() {
927927
return false;
928928
}
929929

930-
/**
931-
* Returns a lock object which can be synchronized against, this lock is used
932-
* by the EDT.
933-
*
934-
* @return a lock object
935-
*/
936-
public Object getDisplayLock() {
937-
return displayLock;
938-
}
939-
940930
/**
941931
* Installs the display lock allowing implementors to synchronize against the
942932
* Display mutex, this method is invoked internally and should not be used.
@@ -8786,7 +8776,7 @@ public void postMessage(MessageEvent message) {
87868776
* @return true in case of dark mode
87878777
*/
87888778
public Boolean isDarkMode() {
8789-
return null;
8779+
return Boolean.FALSE;
87908780
}
87918781

87928782
/**

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ public void delete(String file) {
161161
* @param retryCount the number of times to retry
162162
*/
163163
public void deleteRetry(final String file, final int retryCount) {
164-
System.gc();
165164
try {
166165
Util.getImplementation().deleteFile(file);
167166
} catch (Throwable t) {

CodenameOne/src/com/codename1/location/LocationManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public abstract class LocationManager {
5252
public static final int OUT_OF_SERVICE = 1;
5353
public static final int TEMPORARILY_UNAVAILABLE = 2;
5454
private static LocationListener listener;
55-
private static LocationRequest request;
55+
private LocationRequest request;
5656
private static Class backgroundlistener;
5757
private int status = TEMPORARILY_UNAVAILABLE;
5858

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public abstract class Purchase {
5656
private static final Object PENDING_PURCHASE_LOCK = new Object();
5757
private static final Object synchronizationLock = new Object();
5858
private static final Object receiptsLock = new Object();
59-
private static ReceiptStore receiptStore;
60-
private static List<Receipt> receipts;
61-
private static Date receiptsRefreshTime;
59+
private ReceiptStore receiptStore;
60+
private List<Receipt> receipts;
61+
private Date receiptsRefreshTime;
6262
/**
6363
* Boolean flag to prevent {@link #synchronizeReceipts(long, com.codename1.util.SuccessCallback) }
6464
* re-entry.
@@ -281,7 +281,7 @@ public boolean isItemListingSupported() {
281281
/**
282282
* Returns the product list for the given SKU array
283283
*
284-
* @param sku the ids for the specific products
284+
* @param skus the ids for the specific products
285285
* @return the product instances
286286
* @throws RuntimeException This method is a part of the managed payments API and will fail if
287287
* isManagedPaymentSupported() returns false

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public class Component implements Animation, StyleListener, Editable {
237237
* <p>
238238
* Users can disable this with {@code CN.setProperty("Component.revalidateOnStyleChange", "false")}.
239239
*/
240-
static boolean revalidateOnStyleChange = true;
240+
private static boolean revalidateOnStyleChange = true;
241241
static int restoreDragPercentage = -1;
242242
private static byte defaultDragTransparency = 55;
243243
private static boolean disableSmoothScrolling = false;
@@ -534,6 +534,14 @@ public static boolean isSetCursorSupported() {
534534
return Display.getInstance().getImplementation().isSetCursorSupported();
535535
}
536536

537+
static void setRevalidateOnStyleChange(boolean val) {
538+
revalidateOnStyleChange = val;
539+
}
540+
541+
static boolean isRevalidateOnStyleChange() {
542+
return revalidateOnStyleChange;
543+
}
544+
537545
/**
538546
* Parses the preferred size given as a string
539547
*
@@ -3197,8 +3205,8 @@ private void drawPaintersImpl(com.codename1.ui.Graphics g, Component par, Compon
31973205
}
31983206

31993207
private void paintRippleEffect(Graphics g) {
3200-
if (isRippleEffect() && Form.rippleComponent == this && Form.rippleMotion != null) {
3201-
paintRippleOverlay(g, Form.rippleX, Form.rippleY, Form.rippleMotion.getValue());
3208+
if (isRippleEffect() && Form.getRippleComponent() == this && Form.getRippleMotion() != null) {
3209+
paintRippleOverlay(g, Form.rippleX, Form.rippleY, Form.getRippleMotion().getValue());
32023210
}
32033211
}
32043212

@@ -4497,7 +4505,7 @@ protected void updateState() {
44974505
sourceStyle.setMargin(RIGHT, marginRight.getValue());
44984506
requiresRevalidate = true;
44994507
}
4500-
if (!Component.revalidateOnStyleChange) {
4508+
if (!Component.isRevalidateOnStyleChange()) {
45014509
// If revalidation on stylechange is not enabled, then the style animation
45024510
// won't work. We need to explicitly revalidate or repaint here.
45034511
if (requiresRevalidate) {
@@ -7063,7 +7071,7 @@ public void styleChanged(String propertyName, Style source) {
70637071
setShouldCalcPreferredSize(true);
70647072
Container parent = getParent();
70657073
if (parent != null && parent.getComponentForm() != null) {
7066-
if (revalidateOnStyleChange) {
7074+
if (isRevalidateOnStyleChange()) {
70677075
parent.revalidateLater();
70687076
}
70697077
}

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@
7878
* @see Component
7979
*/
8080
public class Container extends Component implements Iterable<Component> {
81-
static boolean enableLayoutOnPaint = true;
81+
private static boolean enableLayoutOnPaint = true;
8282
/**
8383
* Workaround for the behavior of the sidemenu bar on iOS etc. which translates aggressively,
8484
* this is visible with the table component where the lines slide out of place
8585
*/
8686
static int sidemenuBarTranslation;
87-
static boolean blockOverdraw = false;
87+
private static boolean blockOverdraw;
8888
boolean scrollableX;
8989
boolean scrollableY;
9090
/**
@@ -152,6 +152,10 @@ public Container(Layout layout, String uiid) {
152152
setFocusable(false);
153153
}
154154

155+
static void blockOverdraw() {
156+
blockOverdraw = true;
157+
}
158+
155159
/**
156160
* Constructs a new Container with a new layout manager.
157161
*
@@ -1002,6 +1006,10 @@ public void replaceAndWait(final Component current, final Component next, final
10021006
replaceComponents(current, next, t, true, false, null, 0, 0, true);
10031007
}
10041008

1009+
static void setEnableLayoutOnPaint(boolean val) {
1010+
enableLayoutOnPaint = val;
1011+
}
1012+
10051013
/**
10061014
* This method replaces the current Component with the next Component.
10071015
* Current Component must be contained in this Container.
@@ -1014,13 +1022,13 @@ public void replaceAndWait(final Component current, final Component next, final
10141022
* @param layoutAnimationSpeed the speed of the layout animation after replace is completed
10151023
*/
10161024
public void replaceAndWait(final Component current, final Component next, final Transition t, int layoutAnimationSpeed) {
1017-
enableLayoutOnPaint = false;
1025+
setEnableLayoutOnPaint(false);
10181026
replaceComponents(current, next, t, true, false, null, 0, layoutAnimationSpeed, true);
10191027
if (layoutAnimationSpeed > 0) {
10201028
animateLayoutAndWait(layoutAnimationSpeed);
10211029
}
10221030
dontRecurseContainer = false;
1023-
enableLayoutOnPaint = true;
1031+
setEnableLayoutOnPaint(true);
10241032
}
10251033

10261034
/**
@@ -3700,7 +3708,7 @@ public void morphAndWait(Component source, Component destination, int duration)
37003708

37013709
private void morph(Component source, Component destination, int duration, boolean wait, Runnable onCompletion) {
37023710
setShouldCalcPreferredSize(true);
3703-
enableLayoutOnPaint = false;
3711+
setEnableLayoutOnPaint(false);
37043712
dontRecurseContainer = true;
37053713
int deltaX = getAbsoluteX();
37063714
int deltaY = getAbsoluteY();
@@ -3755,7 +3763,7 @@ private void morph(Component source, Component destination, int duration, boolea
37553763
*/
37563764
private ComponentAnimation animateHierarchy(final int duration, boolean wait, int opacity, boolean add) {
37573765
setShouldCalcPreferredSize(true);
3758-
enableLayoutOnPaint = false;
3766+
setEnableLayoutOnPaint(false);
37593767
dontRecurseContainer = true;
37603768
Vector comps = new Vector();
37613769
findComponentsInHierachy(comps);
@@ -3853,7 +3861,7 @@ public ComponentAnimation createAnimateUnlayout(int duration, int opacity, Runna
38533861
*/
38543862
private ComponentAnimation animateUnlayout(final int duration, boolean wait, int opacity, Runnable callback, boolean add) {
38553863
setShouldCalcPreferredSize(true);
3856-
enableLayoutOnPaint = false;
3864+
setEnableLayoutOnPaint(false);
38573865
final int componentCount = getComponentCount();
38583866
int[] beforeX = new int[componentCount];
38593867
int[] beforeY = new int[componentCount];
@@ -3913,7 +3921,7 @@ private ComponentAnimation animateLayout(final int duration, boolean wait, int o
39133921
return null;
39143922
}
39153923
setShouldCalcPreferredSize(true);
3916-
enableLayoutOnPaint = false;
3924+
setEnableLayoutOnPaint(false);
39173925
final int componentCount = getComponentCount();
39183926
int[] beforeX = new int[componentCount];
39193927
int[] beforeY = new int[componentCount];
@@ -4362,7 +4370,7 @@ protected void updateState() {
43624370
}
43634371
thisContainer.repaint();
43644372
if (System.currentTimeMillis() - startTime >= duration) {
4365-
enableLayoutOnPaint = true;
4373+
setEnableLayoutOnPaint(true);
43664374
thisContainer.dontRecurseContainer = false;
43674375
Form f = thisContainer.getComponentForm();
43684376
finished = true;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,9 @@ public final class Display extends CN1Constants {
288288
private static final int MAX_ASYNC_EXCEPTION_DEPTH = 10;
289289
private static final int[] xArray1 = new int[1];
290290
private static final int[] yArray1 = new int[1];
291-
static int transitionDelay = -1;
291+
private int transitionDelay = -1;
292292
static CodenameOneImplementation impl;
293-
private static String selectedVirtualKeyboard = null;
293+
private String selectedVirtualKeyboard = null;
294294
private static final Map<String, VirtualKeyboardInterface> virtualKeyboards = new HashMap<String, VirtualKeyboardInterface>();
295295
private final LinkedList<Runnable> runningSerialCallsQueue = new LinkedList<Runnable>();
296296
boolean codenameOneExited;
@@ -3491,7 +3491,7 @@ public String getProperty(String key, String defaultValue) {
34913491
return out == null ? defaultValue : out;
34923492
}
34933493
if ("Component.revalidateOnStyleChange".equals(key)) {
3494-
return Component.revalidateOnStyleChange ? "true" : "false";
3494+
return Component.isRevalidateOnStyleChange() ? "true" : "false";
34953495
}
34963496
if (localProperties != null) {
34973497
String v = localProperties.get(key);
@@ -3516,14 +3516,14 @@ public void setProperty(String key, String value) {
35163516
return;
35173517
}
35183518
if ("blockOverdraw".equals(key)) {
3519-
Container.blockOverdraw = true;
3519+
Container.blockOverdraw();
35203520
return;
35213521
}
35223522
if ("blockCopyPaste".equals(key)) {
35233523
impl.blockCopyPaste("true".equals(value));
35243524
}
35253525
if ("Component.revalidateOnStyleChange".equals(key)) {
3526-
Component.revalidateOnStyleChange = "true".equalsIgnoreCase(value);
3526+
Component.setRevalidateOnStyleChange("true".equalsIgnoreCase(value));
35273527
}
35283528
if (key.startsWith("platformHint.")) {
35293529
impl.setPlatformHint(key, value);

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
public class Form extends Container {
7171
private static final String Z_INDEX_PROP = "cn1$_zIndex";
7272
static int activePeerCount;
73-
static Motion rippleMotion;
74-
static Component rippleComponent;
73+
private static Motion rippleMotion;
74+
private static Component rippleComponent;
7575
static int rippleX;
7676
static int rippleY;
7777
/**
@@ -256,6 +256,10 @@ public Form(Layout contentPaneLayout) {
256256
initGlobalToolbar();
257257
}
258258

259+
static Motion getRippleMotion() {
260+
return rippleMotion;
261+
}
262+
259263
/**
260264
* Sets the title after invoking the constructor
261265
*
@@ -2031,6 +2035,14 @@ public boolean animate() {
20312035
return super.animate();
20322036
}
20332037

2038+
static Component getRippleComponent() {
2039+
return rippleComponent;
2040+
}
2041+
2042+
private static void resetRippleComponent() {
2043+
rippleComponent = null;
2044+
}
2045+
20342046
/**
20352047
* Makes sure all animations are repainted so they would be rendered in every
20362048
* frame
@@ -2039,7 +2051,7 @@ void repaintAnimations() {
20392051
if (rippleComponent != null) {
20402052
rippleComponent.repaint();
20412053
if (rippleMotion == null) {
2042-
rippleComponent = null;
2054+
resetRippleComponent();
20432055
}
20442056
}
20452057
if (animatableComponents != null) {
@@ -3089,11 +3101,15 @@ public void keyRepeated(int keyCode) {
30893101
}
30903102
}
30913103

3104+
static void setRippleComponent(Component cmp) {
3105+
rippleComponent = cmp;
3106+
}
3107+
30923108
private void initRippleEffect(int x, int y, Component cmp) {
30933109
if (cmp.isRippleEffect()) {
30943110
rippleMotion = Motion.createEaseInMotion(0, 1000, 800);
30953111
rippleMotion.start();
3096-
rippleComponent = cmp;
3112+
setRippleComponent(cmp);
30973113
rippleX = x;
30983114
rippleY = y;
30993115
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ public boolean animate() {
304304
component.paintLockRelease();
305305
}
306306
slideToDestMotion = null;
307-
enableLayoutOnPaint = true;
307+
setEnableLayoutOnPaint(true);
308308
deregisterAnimatedInternal();
309309
setSelectedIndex(active);
310310
}
@@ -1653,7 +1653,7 @@ public void actionPerformed(ActionEvent evt) {
16531653
component.setX(component.getX() + diffX);
16541654
component.paintLock(false);
16551655
}
1656-
enableLayoutOnPaint = false;
1656+
setEnableLayoutOnPaint(false);
16571657
repaint();
16581658
}
16591659
}
@@ -1667,7 +1667,7 @@ public void actionPerformed(ActionEvent evt) {
16671667
component.setY(component.getY() + diffY);
16681668
component.paintLock(false);
16691669
}
1670-
enableLayoutOnPaint = false;
1670+
setEnableLayoutOnPaint(false);
16711671
repaint();
16721672
}
16731673
}

maven/core-unittests/spotbugs-exclude.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@
6565
<Bug pattern="SE_NO_SERIALVERSIONID"/>
6666
</Match>
6767

68+
<!-- We don't support clone() -->
69+
<Match>
70+
<Bug pattern="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE"/>
71+
</Match>
72+
73+
<!-- We don't support clone() -->
74+
<Match>
75+
<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
76+
</Match>
77+
78+
6879
<!-- Match>
6980
<Bug pattern="UI_INHERITANCE_UNSAFE_GETRESOURCE"/>
7081
</Match>

0 commit comments

Comments
 (0)