Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/scripts/generate-quality-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,12 @@ def _is_exempt(f: Finding) -> bool:
"UnusedFormalParameter",
"SwitchStmtsShouldHaveDefault",
"UnconditionalIfStatement",
"SimplifyConditional"
"SimplifyConditional",
"UselessOverridingMethod",
"UselessQualifiedThis",
"AvoidBranchingStatementAsLastInLoop",
"AvoidUsingVolatile",
"DoNotCallGarbageCollectionExplicitly"
}
violations = [f for f in pmd.findings if f.rule in forbidden_pmd_rules]
if violations:
Expand Down
2 changes: 2 additions & 0 deletions CodenameOne/src/com/codename1/capture/Capture.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ public static void captureVideo(ActionListener<ActionEvent> response) {

static class CallBack implements ActionListener<ActionEvent>, Runnable {
String url;
// We need volatile due to the usage of double locking optimization
@SuppressWarnings("PMD.AvoidUsingVolatile")
private volatile boolean completed;
private int targetWidth = -1;
private int targetHeight = -1;
Expand Down
7 changes: 3 additions & 4 deletions CodenameOne/src/com/codename1/components/RSSReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,11 @@ public boolean equals(Object o) {
return true;
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
int result = super.hashCode();
result = 31 * result + (sourceForm != null ? sourceForm.hashCode() : 0);
return result;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ public final class StorageImageAsync extends EncodedImage {
private final Image placeholderImage;
private boolean changePending;
private boolean imageCreated;
@SuppressWarnings("PMD.AvoidUsingVolatile")
private volatile byte[] imageData;
@SuppressWarnings("PMD.AvoidUsingVolatile")
private volatile boolean queued;

private StorageImageAsync(String fileName, Image placeholderImage) {
Expand Down
16 changes: 12 additions & 4 deletions CodenameOne/src/com/codename1/facebook/Album.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,19 @@ public boolean equals(Object o) {
return super.equals(o);
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
int result = super.hashCode();
result = 31 * result + from.hashCode();
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (location != null ? location.hashCode() : 0);
result = 31 * result + (link != null ? link.hashCode() : 0);
result = 31 * result + (cover_photo != null ? cover_photo.hashCode() : 0);
result = 31 * result + (privacy != null ? privacy.hashCode() : 0);
result = 31 * result + count;
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (created_time != null ? created_time.hashCode() : 0);
result = 31 * result + (updated_time != null ? updated_time.hashCode() : 0);
return result;
}
}
15 changes: 11 additions & 4 deletions CodenameOne/src/com/codename1/facebook/Page.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,18 @@ public boolean equals(Object o) {
return super.equals(o);
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
int result = super.hashCode();
result = 31 * result + (about != null ? about.hashCode() : 0);
result = 31 * result + (category != null ? category.hashCode() : 0);
result = 31 * result + (founded != null ? founded.hashCode() : 0);
result = 31 * result + likesCount;
result = 31 * result + (link != null ? link.hashCode() : 0);
result = 31 * result + (username != null ? username.hashCode() : 0);
result = 31 * result + (website != null ? website.hashCode() : 0);
result = 31 * result + (coverId != null ? coverId.hashCode() : 0);
result = 31 * result + (coverLink != null ? coverLink.hashCode() : 0);
return result;
}
}
18 changes: 14 additions & 4 deletions CodenameOne/src/com/codename1/facebook/Photo.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,21 @@ public boolean equals(Object o) {
return super.equals(o);
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
int result = super.hashCode();
result = 31 * result + from.hashCode();
result = 31 * result + (iconUrl != null ? iconUrl.hashCode() : 0);
result = 31 * result + (pictureUrl != null ? pictureUrl.hashCode() : 0);
result = 31 * result + (sourceUrl != null ? sourceUrl.hashCode() : 0);
result = 31 * result + height;
result = 31 * result + width;
result = 31 * result + (link != null ? link.hashCode() : 0);
result = 31 * result + (created_time != null ? created_time.hashCode() : 0);
result = 31 * result + (updated_time != null ? updated_time.hashCode() : 0);
result = 31 * result + position;
result = 31 * result + (images != null ? images.hashCode() : 0);
result = 31 * result + (comments != null ? comments.hashCode() : 0);
return result;
}
}
17 changes: 13 additions & 4 deletions CodenameOne/src/com/codename1/facebook/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,20 @@ public boolean equals(Object o) {
return super.equals(o);
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
int result = super.hashCode();
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (attribution != null ? attribution.hashCode() : 0);
result = 31 * result + (message != null ? message.hashCode() : 0);
result = 31 * result + (linkUrl != null ? linkUrl.hashCode() : 0);
result = 31 * result + (linkDescription != null ? linkDescription.hashCode() : 0);
result = 31 * result + (commentsCount != null ? commentsCount.hashCode() : 0);
result = 31 * result + (likes != null ? likes.hashCode() : 0);
result = 31 * result + (from != null ? from.hashCode() : 0);
result = 31 * result + (to != null ? to.hashCode() : 0);
result = 31 * result + (created_time != null ? created_time.hashCode() : 0);
result = 31 * result + (picture != null ? picture.hashCode() : 0);
return result;
}
}
24 changes: 19 additions & 5 deletions CodenameOne/src/com/codename1/facebook/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,26 @@ public boolean equals(Object o) {
return super.equals(o);
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
int result = super.hashCode();
result = 31 * result + (username != null ? username.hashCode() : 0);
result = 31 * result + (first_name != null ? first_name.hashCode() : 0);
result = 31 * result + (last_name != null ? last_name.hashCode() : 0);
result = 31 * result + (link != null ? link.hashCode() : 0);
result = 31 * result + (about != null ? about.hashCode() : 0);
result = 31 * result + (birthday != null ? birthday.hashCode() : 0);
result = 31 * result + (email != null ? email.hashCode() : 0);
result = 31 * result + (website != null ? website.hashCode() : 0);
result = 31 * result + (bio != null ? bio.hashCode() : 0);
result = 31 * result + (quotes != null ? quotes.hashCode() : 0);
result = 31 * result + (gender != null ? gender.hashCode() : 0);
result = 31 * result + (relationship_status != null ? relationship_status.hashCode() : 0);
result = 31 * result + (int) (timezone ^ (timezone >>> 32));
result = 31 * result + (last_updated != null ? last_updated.hashCode() : 0);
result = 31 * result + (locale != null ? locale.hashCode() : 0);
result = 31 * result + (location != null ? location.hashCode() : 0);
result = 31 * result + (hometown != null ? hometown.hashCode() : 0);
return result;
}

}
2 changes: 2 additions & 0 deletions CodenameOne/src/com/codename1/io/BufferedInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
*/
public class BufferedInputStream extends InputStream {
private static int streamCount = 0;

@SuppressWarnings("PMD.AvoidUsingVolatile")
private static volatile int defaultBufferSize = 8192;
private final String name;
private int actualAvailable = defaultBufferSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ public boolean equals(Object o) {
return true;
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
int result = super.hashCode();
result = 31 * result + data.hashCode();
result = 31 * result + (responseProcessed ? 1 : 0);
return result;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,11 @@ public boolean equals(Object o) {
return true;
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
int result = super.hashCode();
result = 31 * result + (parseTree != null ? parseTree.hashCode() : 0);
return result;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public final class GeofenceManager implements Iterable<Geofence> {
*/
private static final int defaultTimeout = 10000;
private static int MAX_ACTIVE_GEOFENCES = 19;
private static volatile GeofenceManager instance;
private static GeofenceManager instance;
// Reference to the last bubble set.
Geofence lastBubble;
/**
Expand Down
7 changes: 3 additions & 4 deletions CodenameOne/src/com/codename1/push/Push.java
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,11 @@ public boolean equals(Object o) {
return true;
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
int result = super.hashCode();
result = 31 * result + (successful ? 1 : 0);
return result;
}
}

Expand Down
6 changes: 3 additions & 3 deletions CodenameOne/src/com/codename1/social/Login.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public void doLogout() {
} else {
setAccessToken(null);
}
Preferences.delete(Login.this.getClass().getName() + "Token");
Preferences.delete(getClass().getName() + "Token");
}

/**
Expand Down Expand Up @@ -320,7 +320,7 @@ public void setAccessToken(AccessToken token) {
*/
public void validateToken() throws IOException {

String token = Preferences.get(Login.this.getClass().getName() + "Token", null);
String token = Preferences.get(getClass().getName() + "Token", null);
if (token == null || !validateToken(token)) {
AccessToken accessTok = getAccessToken();
if (accessTok != null && accessTok.getRefreshToken() != null) {
Expand All @@ -330,7 +330,7 @@ public void validateToken() throws IOException {
System.out.println("Attempting to refresh the access token");
AccessToken newTok = refreshReq.get(5000);
setAccessToken(newTok);
Preferences.set(Login.this.getClass().getName() + "Token", getAccessToken().getToken());
Preferences.set(getClass().getName() + "Token", getAccessToken().getToken());
return;
} catch (Throwable t) {
}
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/testing/TestReporting.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @author Shai Almog
*/
public class TestReporting {
private static volatile TestReporting instanceOverride;
private static TestReporting instanceOverride;
private final Hashtable<String, Boolean> testsExecuted = new Hashtable<String, Boolean>();

/**
Expand Down
4 changes: 2 additions & 2 deletions CodenameOne/src/com/codename1/ui/AutoCompleteTextField.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ private void removePopup() {
f = popup.getComponentForm();
}
if (f != null) {
Container lay = f.getLayeredPane(AutoCompleteTextField.this.getClass(), true);
Container lay = f.getLayeredPane(getClass(), true);
Container parent = popup.getParent();
if (parent != null) {
lay.removeComponent(parent);
Expand Down Expand Up @@ -447,7 +447,7 @@ public void actionPerformed(ActionEvent evt) {

if (f != null) {
if (popup.getParent() == null) {
Container lay = f.getLayeredPane(AutoCompleteTextField.this.getClass(), true);
Container lay = f.getLayeredPane(getClass(), true);
lay.setLayout(new LayeredLayout());
Container wrapper = new Container();
wrapper.add(popup);
Expand Down
5 changes: 0 additions & 5 deletions CodenameOne/src/com/codename1/ui/BrowserComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,6 @@ private SuccessCallback<JSRef> popReturnValueCallback(int id) {
return null;
}

@Override
protected void initComponent() {
super.initComponent();
}

@Override
protected void deinitialize() {
uninstallMessageListener();
Expand Down
5 changes: 0 additions & 5 deletions CodenameOne/src/com/codename1/ui/CheckBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,6 @@ protected String paramString() {
return super.paramString() + ", selected = " + selected;
}

@Override
void initComponentImpl() {
super.initComponentImpl();
}

private void updateSide() {
Boolean v = getUIManager().isThemeConstant("checkBoxOppositeSideBool");
if (v != null) {
Expand Down
10 changes: 0 additions & 10 deletions CodenameOne/src/com/codename1/ui/CommonProgressAnimations.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@ public static CircleProgress markComponentLoading(Component cmp) {
return (CircleProgress) markComponentLoading(cmp, CircleProgress.class);
}

@Override
public void paint(Graphics g) {
super.paint(g);
}

@Override
public boolean animate() {
step += stepSize;
Expand Down Expand Up @@ -296,11 +291,6 @@ public boolean animate() {
return true;
}

@Override
public void paint(Graphics g) {
super.paint(g);
}

@Override
protected void paintBackground(Graphics g) {
strlen = loremIpsum.length();
Expand Down
12 changes: 1 addition & 11 deletions CodenameOne/src/com/codename1/ui/Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ void replace(final Component current, final Component next, boolean avoidRepaint
Object constraint = layout.getComponentConstraint(current);
if (constraint != null) {
removeComponentImplNoAnimationSafety(current);
layout.addLayoutComponent(constraint, next, Container.this);
layout.addLayoutComponent(constraint, next, this);
} else {
removeComponentImplNoAnimationSafety(current);
}
Expand Down Expand Up @@ -3389,16 +3389,6 @@ public void paintComponentBackground(Graphics g) {
}
}

@Override
protected void paintBackground(Graphics g) {
super.paintBackground(g);
}

@Override
protected void paintBorderBackground(Graphics g) {
super.paintBorderBackground(g);
}

/**
* {@inheritDoc}
*/
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/ui/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ public boolean isInTransition() {
}

// Seems to be a false positive on this rule
@SuppressWarnings("PMD.SimplifyConditional")
@SuppressWarnings({"PMD.SimplifyConditional", "PMD.AvoidBranchingStatementAsLastInLoop"})
private void paintTransitionAnimation() {
Animation ani = animationQueue.get(0);
if (!ani.animate()) {
Expand Down
Loading
Loading