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
3 changes: 3 additions & 0 deletions .github/scripts/generate-quality-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ def main() -> None:
"NP_BOOLEAN_RETURN_NULL",
"REFLC_REFLECTION_MAY_INCREASE_ACCESSIBILITY_OF_CLASS",
"UI_INHERITANCE_UNSAFE_GETRESOURCE",
"URF_UNREAD_FIELD",
"URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD",
"UW_UNCOND_WAIT",
"SIC_INNER_SHOULD_BE_STATIC_ANON",
Expand All @@ -818,6 +819,8 @@ def _is_exempt(f: Finding) -> bool:
return True
if f.rule == "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" and "TarEntry.java" in loc:
return True
if f.rule == "URF_UNREAD_FIELD" and "GridBagLayoutInfo" in loc:
return True
return False


Expand Down
14 changes: 11 additions & 3 deletions CodenameOne/src/com/codename1/charts/compat/PathMeasure.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package com.codename1.charts.compat;

import com.codename1.ui.geom.GeneralPath;
import com.codename1.ui.geom.Rectangle;


/**
Expand All @@ -31,16 +32,23 @@
*/
public class PathMeasure {

GeneralPath path;
boolean forceClosed = false;
private final GeneralPath path;
private final boolean forceClosed;

public PathMeasure(GeneralPath p, boolean b) {
path = p;
forceClosed = b;
if (forceClosed && path != null) {
path.closePath();
}
}

public float getLength() {
return 10;
if (path == null) {
return 0;
}
Rectangle bounds = path.getBounds();
return (float) Math.max(bounds.getWidth(), bounds.getHeight());
}

public void getPosTan(int i, float[] coords, float[] tan) {
Expand Down
20 changes: 5 additions & 15 deletions CodenameOne/src/com/codename1/charts/views/BarChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,11 @@ public void drawSeries(Canvas canvas, Paint paint, List<Float> points,
int seriesNr = mDataset.getSeriesCount();
int length = points.size();
paint.setColor(seriesRenderer.getColor());
paint.setStyle(Style.FILL);
float halfDiffX = getHalfDiffX(points, length, seriesNr);

Point[] yvals = new Point[length / 2];
for (int i = 0; i < length; i += 2) {
Point p = new Point();
p.seriesIndex = i / 2;
p.yval = points.get(i + 1);
yvals[i / 2] = p;
}


for (int i = 0; i < length; i += 2) {
float x = points.get(i);
float y = points.get(i + 1);
paint.setStyle(Style.FILL);
float halfDiffX = getHalfDiffX(points, length, seriesNr);
for (int i = 0; i < length; i += 2) {
float x = points.get(i);
float y = points.get(i + 1);

if (mType == Type.HEAPED && seriesIndex > 0) {
float lastY = mPreviousSeriesPoints.get(i + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class InfiniteScrollAdapter {
private final Component ip;
private int componentLimit = -1;
private final InfiniteProgress progress;
private final Component endMarker = new EdgeMarker(true);
private final Component endMarker = new EdgeMarker();

private InfiniteScrollAdapter() {
progress = new InfiniteProgress();
Expand Down Expand Up @@ -225,10 +225,7 @@ public InfiniteProgress getInfiniteProgress() {
}

class EdgeMarker extends Component {
private final boolean top;

public EdgeMarker(boolean top) {
this.top = top;
public EdgeMarker() {
}

public Dimension calcPreferredSize() {
Expand Down
8 changes: 6 additions & 2 deletions CodenameOne/src/com/codename1/components/SplitPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ public SplitPane(Settings settings, Component topOrLeft, Component bottomOrRight
this.showDragHandle = settings.showDragHandle;
this.showExpandCollapseButtons = settings.showExpandCollapseButtons;
this.dividerUIID = settings.dividerUIID;
this.expandMaterialIcon = settings.expandMaterialIcon;
this.collapseMaterialIcon = settings.collapseMaterialIcon;
this.dragHandleMaterialIcon = settings.dragHandleMaterialIcon;
this.expandIcon = settings.expandIcon;
this.collapseIcon = settings.collapseIcon;
this.dragHandleIcon = settings.dragHandleIcon;

divider = new Divider();
add(this.topOrLeft).add(this.bottomOrRight).add(divider);
Expand Down Expand Up @@ -942,7 +948,6 @@ private class Divider extends Container {
private final Button btnExpand;
private final Label dragHandle;
int pressedX, pressedY, draggedX, draggedY;
LayeredLayoutConstraint pressedPreferredConstraint;
LayeredLayoutConstraint pressedConstraint;
private boolean inDrag;

Expand Down Expand Up @@ -1156,7 +1161,6 @@ public void pointerPressed(int x, int y) {
pressedX = x;
pressedY = y;
pressedConstraint = ((LayeredLayout) getLayout()).getOrCreateConstraint(this).copy();
pressedPreferredConstraint = preferredInset.copy();
inDrag = true;
pointerDragged(x, y);
}
Expand Down
2 changes: 0 additions & 2 deletions CodenameOne/src/com/codename1/components/ToastBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,6 @@ public class Status {
/**
* The start time of the process this status is tracking.
*/
private final long startTime;
/**
* This UIID that should be used to style the ToastBar text while this
* message is being displayed.
Expand Down Expand Up @@ -777,7 +776,6 @@ public class Status {
private boolean showProgressIndicator;

private Status() {
startTime = System.currentTimeMillis();
}

/**
Expand Down
3 changes: 0 additions & 3 deletions CodenameOne/src/com/codename1/io/gzip/Deflate.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ final class Deflate {
int pending; // nb of bytes in the pending buffer
int wrap = 1;
byte data_type; // UNKNOWN, BINARY or ASCII
byte method; // STORED (for zip only) or DEFLATED
int last_flush; // value of flush param for previous deflate call
int w_size; // LZ77 window size (32K by default)
int w_bits; // log2(w_size) (8..16)
Expand Down Expand Up @@ -1371,8 +1370,6 @@ private int deflateInit(int level, int method, int windowBits,
this.level = level;

this.strategy = strategy;
this.method = (byte) method;

return deflateReset();
}

Expand Down
4 changes: 0 additions & 4 deletions CodenameOne/src/com/codename1/io/gzip/GZIPHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,11 @@ public class GZIPHeader {
public static final byte OS_UNKNOWN = (byte) 0xff;

boolean text = false;
long time;
int xflags;
int os = 255;
byte[] extra;
byte[] name;
byte[] comment;
int hcrc;
long crc;
boolean done = false;
long mtime = 0;
private boolean fhcrc = false;

Expand Down
9 changes: 3 additions & 6 deletions CodenameOne/src/com/codename1/io/gzip/Inflate.java
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,9 @@ int inflate(int f) {
} catch (Return e) {
return e.r;
}
if (gheader != null)
gheader.time = this.need;
if (gheader != null) {
gheader.setModifiedTime(this.need);
}
if ((flags & 0x0200) != 0) {
checksum(4, this.need);
}
Expand All @@ -471,7 +472,6 @@ int inflate(int f) {
return e.r;
}
if (gheader != null) {
gheader.xflags = ((int) this.need) & 0xff;
gheader.os = (((int) this.need) >> 8) & 0xff;
}
if ((flags & 0x0200) != 0) {
Expand Down Expand Up @@ -555,9 +555,6 @@ int inflate(int f) {
} catch (Return e) {
return e.r;
}
if (gheader != null) {
gheader.hcrc = (int) (this.need & 0xffff);
}
if (this.need != (z.adler.getValue() & 0xffffL)) {
this.mode = BAD;
z.msg = "header crc mismatch";
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/io/gzip/Inflater.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,6 @@ public int setDictionary(byte[] dictionary, int dictLength) {
}

public boolean finished() {
return istate.mode == 12 /*DONE*/;
return finished;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public class JavascriptContext {
* the next JSObject. Each JSObject has an id associated with it which
* corresponds with its position in the Javascript lookup table.
*/
int objectId = 0;
long callId = 0;
private int callbackId = 0;
/**
Expand Down
3 changes: 0 additions & 3 deletions CodenameOne/src/com/codename1/maps/MapComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public class MapComponent extends Container {
private final boolean _debugInfo = false;
private boolean _needTiles = true;
private int draggedx, draggedy;
private int pressedx, pressedy;
private Vector _tiles;
private Point _delta = null;
private double latitude = Double.NaN;
Expand Down Expand Up @@ -329,8 +328,6 @@ public void pointerDragged(int x, int y) {
public void pointerPressed(int x, int y) {
super.pointerPressed(x, y);
lastPressed = System.currentTimeMillis();
pressedx = x;
pressedy = y;
draggedx = x;
draggedy = y;
}
Expand Down
11 changes: 2 additions & 9 deletions CodenameOne/src/com/codename1/ui/Container.java
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ void insertComponentAt(final int index, final Object constraint, final Component
}
cmp.setParent(this);

final QueuedInsertion insertion = new QueuedInsertion(index, constraint, cmp);
final QueuedInsertion insertion = new QueuedInsertion(index, cmp);
changeQueue.add(insertion);
a.addAnimation(new ComponentAnimation() {
private boolean alreadyAdded;
Expand Down Expand Up @@ -4084,11 +4084,6 @@ private static class QueuedChange {
* Encapsulates a child component insertion that occurs during an animation.
*/
private static class QueuedInsertion extends QueuedChange {
/**
* The component constraint of the component that was inserted.
*/
private final Object constraint;

/**
* The index where the component should be inserted.
*/
Expand All @@ -4098,13 +4093,11 @@ private static class QueuedInsertion extends QueuedChange {
* Creates a new queued insertion.
*
* @param index The index where the component is inserted.
* @param constraint The constraint.
* @param cmp The component that was inserted.
*/
QueuedInsertion(int index, Object constraint, Component cmp) {
QueuedInsertion(int index, Component cmp) {
super(TYPE_INSERT, cmp);
this.index = index;
this.constraint = constraint;
}
}

Expand Down
1 change: 0 additions & 1 deletion CodenameOne/src/com/codename1/ui/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ public final class Display extends CN1Constants {
private int previousKeyPressed;
private int lastKeyPressed;
private int lastDragOffset;
private final Rectangle tmpRect = new Rectangle();
private Form eventForm;

/**
Expand Down
3 changes: 0 additions & 3 deletions CodenameOne/src/com/codename1/ui/TextSelection.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ public int compare(Component o1, Component o2) {
*/
private final ActionListener pressListener = new ActionListener() {
int startX, startY;
int startDragHandleX, startDragHandleY;
final Rectangle startSelectedBounds = new Rectangle();
boolean inSelectionDrag;
private final int ONE_MM = CN.convertToPixels(1);
Expand Down Expand Up @@ -327,8 +326,6 @@ public void run() {
if (evt.getEventType() == ActionEvent.Type.PointerPressed) {
startX = evt.getX();
startY = evt.getY();
startDragHandleX = dh.getAbsoluteX();
startDragHandleY = dh.getAbsoluteY();
startSelectedBounds.setBounds(selectedBounds);
inSelectionDrag = true;
evt.consume();
Expand Down
2 changes: 0 additions & 2 deletions CodenameOne/src/com/codename1/ui/URLImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ public boolean isAsyncAdapter() {
* CachedImage used by {@link #createCachedImage(java.lang.String, java.lang.String, com.codename1.ui.Image, int) }
*/
private static class CachedImage extends Image {
boolean fetching;
int resizeRule;
Object image;
Image placeholderImage;
Expand All @@ -728,7 +727,6 @@ public CachedImage(Image placeholder, String url, int resize) {
this.placeholderImage = placeholder;
Util.downloadImageToCache(url, new SuccessCallback<Image>() {
public void onSucess(Image downloadedImage) {
fetching = false;
switch (resizeRule) {
case FLAG_RESIZE_FAIL: {
if (downloadedImage.getWidth() != placeholderImage.getWidth() || downloadedImage.getHeight() != placeholderImage.getHeight()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public final class CommonTransitions extends Transition {
private static boolean defaultLinearMotion = false;
private Motion motion, motion2;
private LazyValue<Motion> lazyMotion;
private long startTime;
private int slideType;
private int speed;
private int position;
Expand Down Expand Up @@ -395,7 +394,6 @@ public void initTransition() {
return;
}

startTime = System.currentTimeMillis();
Component source = getSource();
Component destination = getDestination();
position = 0;
Expand Down
11 changes: 3 additions & 8 deletions CodenameOne/src/com/codename1/ui/animations/MorphTransition.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,9 @@ public final void initTransition() {
cc.placeholderSrc.setHeight(cc.source.getHeight());
cc.placeholderSrc.setPreferredSize(new Dimension(cc.source.getWidth(), cc.source.getHeight()));

cc.originalContainer = cc.source.getParent();
cc.originalConstraint = cc.originalContainer.getLayout().getComponentConstraint(cc.source);
cc.originalOffset = cc.originalContainer.getComponentIndex(cc.source);
cc.originalContainer.replace(cc.source, cc.placeholderSrc, null);
cc.originalContainer.getComponentForm().getLayeredPane().addComponent(cc.source);
Container originalContainer = cc.source.getParent();
originalContainer.replace(cc.source, cc.placeholderSrc, null);
originalContainer.getComponentForm().getLayeredPane().addComponent(cc.source);
}
}

Expand Down Expand Up @@ -263,9 +261,6 @@ class CC {
Motion yMotion;
Motion wMotion;
Motion hMotion;
Object originalConstraint;
Container originalContainer;
int originalOffset;
public CC(Component source, Component dest, Form sourceForm, Form destForm) {
this.source = source;
this.dest = dest;
Expand Down
1 change: 0 additions & 1 deletion CodenameOne/src/com/codename1/ui/html/HTMLComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ public class HTMLComponent extends Container implements ActionListener, IOCallba
*/
boolean eventsEnabled = false;
HTMLParser parser;
int contCount = 0; // debug for CSS
boolean showImages = true; //true to download image, false otherwise
Component firstFocusable; // The first focusable link on the page
//Font
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ class CodenameOneMiGComponentWrapper implements ComponentWrapper {
private static boolean vp = true;
private final Component c;
private int compType = TYPE_UNSET;
private final Boolean bl = null;

public CodenameOneMiGComponentWrapper(Component c) {
this.c = c;
}
Expand Down
Loading
Loading