Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Objects.hashCode, Objects.equals, CloneUtils.clone, CloneUtils.cloneList, remove ObjectUtils #163

Merged
merged 5 commits into from
Jul 1, 2020
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: 3 additions & 4 deletions src/main/java/org/jfree/chart/ChartRenderingInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.jfree.chart.entity.EntityCollection;
import org.jfree.chart.entity.StandardEntityCollection;
import org.jfree.chart.plot.PlotRenderingInfo;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.PublicCloneable;
import org.jfree.chart.util.SerialUtils;

Expand Down Expand Up @@ -184,13 +183,13 @@ public boolean equals(Object obj) {
return false;
}
ChartRenderingInfo that = (ChartRenderingInfo) obj;
if (!ObjectUtils.equal(this.chartArea, that.chartArea)) {
if (!Objects.equals(this.chartArea, that.chartArea)) {
return false;
}
if (!ObjectUtils.equal(this.plotInfo, that.plotInfo)) {
if (!Objects.equals(this.plotInfo, that.plotInfo)) {
return false;
}
if (!ObjectUtils.equal(this.entities, that.entities)) {
if (!Objects.equals(this.entities, that.entities)) {
return false;
}
return true;
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/org/jfree/chart/JFreeChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
import org.jfree.chart.ui.RectangleInsets;
import org.jfree.chart.ui.Size2D;
import org.jfree.chart.ui.VerticalAlignment;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.PaintUtils;
import org.jfree.chart.util.SerialUtils;
import org.jfree.data.Range;
Expand Down Expand Up @@ -1511,7 +1510,7 @@ public boolean equals(Object obj) {
if (this.borderVisible != that.borderVisible) {
return false;
}
if (!ObjectUtils.equal(this.borderStroke, that.borderStroke)) {
if (!Objects.equals(this.borderStroke, that.borderStroke)) {
return false;
}
if (!PaintUtils.equal(this.borderPaint, that.borderPaint)) {
Expand All @@ -1520,22 +1519,21 @@ public boolean equals(Object obj) {
if (!this.padding.equals(that.padding)) {
return false;
}
if (!ObjectUtils.equal(this.title, that.title)) {
if (!Objects.equals(this.title, that.title)) {
return false;
}
if (!ObjectUtils.equal(this.subtitles, that.subtitles)) {
if (!Objects.equals(this.subtitles, that.subtitles)) {
return false;
}
if (!ObjectUtils.equal(this.plot, that.plot)) {
if (!Objects.equals(this.plot, that.plot)) {
return false;
}
if (!PaintUtils.equal(
this.backgroundPaint, that.backgroundPaint
)) {
return false;
}
if (!ObjectUtils.equal(this.backgroundImage,
that.backgroundImage)) {
if (!Objects.equals(this.backgroundImage, that.backgroundImage)) {
return false;
}
if (this.backgroundImageAlignment != that.backgroundImageAlignment) {
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/org/jfree/chart/LegendItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import org.jfree.chart.text.AttributedStringUtils;
import org.jfree.chart.ui.GradientPaintTransformer;
import org.jfree.chart.ui.StandardGradientPaintTransformer;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.PaintUtils;
import org.jfree.chart.util.PublicCloneable;
import org.jfree.chart.util.SerialUtils;
Expand Down Expand Up @@ -1010,7 +1009,7 @@ public boolean equals(Object obj) {
that.attributedLabel)) {
return false;
}
if (!ObjectUtils.equal(this.description, that.description)) {
if (!Objects.equals(this.description, that.description)) {
return false;
}
if (this.shapeVisible != that.shapeVisible) {
Expand All @@ -1025,8 +1024,7 @@ public boolean equals(Object obj) {
if (!PaintUtils.equal(this.fillPaint, that.fillPaint)) {
return false;
}
if (!ObjectUtils.equal(this.fillPaintTransformer,
that.fillPaintTransformer)) {
if (!Objects.equals(this.fillPaintTransformer, that.fillPaintTransformer)) {
return false;
}
if (this.shapeOutlineVisible != that.shapeOutlineVisible) {
Expand All @@ -1050,7 +1048,7 @@ public boolean equals(Object obj) {
if (!PaintUtils.equal(this.linePaint, that.linePaint)) {
return false;
}
if (!ObjectUtils.equal(this.labelFont, that.labelFont)) {
if (!Objects.equals(this.labelFont, that.labelFont)) {
return false;
}
if (!PaintUtils.equal(this.labelPaint, that.labelPaint)) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jfree/chart/LegendItemCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import java.util.List;
import java.util.Objects;

import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.CloneUtils;

/**
* A collection of legend items.
Expand Down Expand Up @@ -150,7 +150,7 @@ public int hashCode() {
@Override
public Object clone() throws CloneNotSupportedException {
LegendItemCollection clone = (LegendItemCollection) super.clone();
clone.items = (List) ObjectUtils.deepClone(this.items);
clone.items = CloneUtils.cloneList(this.items);
return clone;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jfree/chart/StrokeMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import org.jfree.chart.util.ObjectUtils;

import org.jfree.chart.util.Args;
import org.jfree.chart.util.SerialUtils;

Expand Down Expand Up @@ -148,7 +148,7 @@ public boolean equals(Object obj) {
K key = iterator.next();
Stroke s1 = getStroke(key);
Stroke s2 = that.getStroke(key);
if (!ObjectUtils.equal(s1, s2)) {
if (!Objects.equals(s1, s2)) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import java.util.Objects;

import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.entity.EntityCollection;
import org.jfree.chart.entity.XYAnnotationEntity;
import org.jfree.chart.plot.PlotRenderingInfo;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.util.ObjectUtils;

/**
* The interface that must be supported by annotations that are to be added to
Expand Down Expand Up @@ -175,10 +175,10 @@ public boolean equals(Object obj) {
return false;
}
AbstractXYAnnotation that = (AbstractXYAnnotation) obj;
if (!ObjectUtils.equal(this.toolTipText, that.toolTipText)) {
if (!Objects.equals(this.toolTipText, that.toolTipText)) {
return false;
}
if (!ObjectUtils.equal(this.url, that.url)) {
if (!Objects.equals(this.url, that.url)) {
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Objects;

import org.jfree.chart.HashUtils;
import org.jfree.chart.axis.CategoryAnchor;
Expand All @@ -56,7 +57,6 @@
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.PaintUtils;
import org.jfree.chart.util.Args;
import org.jfree.chart.util.PublicCloneable;
Expand Down Expand Up @@ -350,7 +350,7 @@ public boolean equals(Object obj) {
if (!PaintUtils.equal(this.paint, that.paint)) {
return false;
}
if (!ObjectUtils.equal(this.stroke, that.stroke)) {
if (!Objects.equals(this.stroke, that.stroke)) {
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Objects;

import org.jfree.chart.HashUtils;
import org.jfree.chart.axis.CategoryAxis;
Expand All @@ -58,7 +59,6 @@
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.text.TextUtils;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.Args;
import org.jfree.chart.util.PublicCloneable;
import org.jfree.chart.util.SerialUtils;
Expand Down Expand Up @@ -459,7 +459,7 @@ public boolean equals(Object obj) {
if (!this.arrowPaint.equals(that.arrowPaint)) {
return false;
}
if (!ObjectUtils.equal(this.arrowStroke, that.arrowStroke)) {
if (!Objects.equals(this.arrowStroke, that.arrowStroke)) {
return false;
}
if (this.labelOffset != that.labelOffset) {
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/jfree/chart/annotations/TextAnnotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Objects;

import org.jfree.chart.HashUtils;
import org.jfree.chart.event.AnnotationChangeEvent;
import org.jfree.chart.ui.TextAnchor;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.PaintUtils;
import org.jfree.chart.util.Args;
import org.jfree.chart.util.SerialUtils;
Expand Down Expand Up @@ -279,20 +279,19 @@ public boolean equals(Object obj) {
return false;
}
TextAnnotation that = (TextAnnotation) obj;
if (!ObjectUtils.equal(this.text, that.getText())) {
if (!Objects.equals(this.text, that.getText())) {
return false;
}
if (!ObjectUtils.equal(this.font, that.getFont())) {
if (!Objects.equals(this.font, that.getFont())) {
return false;
}
if (!PaintUtils.equal(this.paint, that.getPaint())) {
return false;
}
if (!ObjectUtils.equal(this.textAnchor, that.getTextAnchor())) {
if (!Objects.equals(this.textAnchor, that.getTextAnchor())) {
return false;
}
if (!ObjectUtils.equal(this.rotationAnchor,
that.getRotationAnchor())) {
if (!Objects.equals(this.rotationAnchor, that.getRotationAnchor())) {
return false;
}
if (this.rotationAngle != that.getRotationAngle()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Objects;

import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.PlotRenderingInfo;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.PaintUtils;
import org.jfree.chart.util.PublicCloneable;
import org.jfree.chart.util.SerialUtils;
Expand Down Expand Up @@ -228,7 +228,7 @@ public boolean equals(Object obj) {
if (!(this.y1 == that.y1)) {
return false;
}
if (!ObjectUtils.equal(this.stroke, that.stroke)) {
if (!Objects.equals(this.stroke, that.stroke)) {
return false;
}
if (!PaintUtils.equal(this.outlinePaint, that.outlinePaint)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Objects;

import org.jfree.chart.axis.AxisLocation;
import org.jfree.chart.axis.ValueAxis;
Expand All @@ -50,7 +51,6 @@
import org.jfree.chart.plot.PlotRenderingInfo;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.Args;
import org.jfree.chart.util.PublicCloneable;
import org.jfree.data.Range;
Expand Down Expand Up @@ -316,7 +316,7 @@ public boolean equals(Object obj) {
if (this.includeInDataBounds != that.includeInDataBounds) {
return false;
}
if (!ObjectUtils.equal(this.image, that.image)) {
if (!Objects.equals(this.image, that.image)) {
return false;
}
// seems to be the same...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
import java.util.Objects;

import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.Plot;
Expand All @@ -48,7 +49,6 @@
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.ui.Drawable;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.Args;
import org.jfree.chart.util.PublicCloneable;

Expand Down Expand Up @@ -211,7 +211,7 @@ public boolean equals(Object obj) {
if (this.drawScaleFactor != that.drawScaleFactor) {
return false;
}
if (!ObjectUtils.equal(this.drawable, that.drawable)) {
if (!Objects.equals(this.drawable, that.drawable)) {
return false;
}
// seem to be the same...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Objects;

import org.jfree.chart.axis.AxisLocation;
import org.jfree.chart.axis.ValueAxis;
Expand All @@ -54,7 +55,6 @@
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.ui.RectangleAnchor;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.Args;
import org.jfree.chart.util.PublicCloneable;

Expand Down Expand Up @@ -248,7 +248,7 @@ public boolean equals(Object obj) {
if (this.y != that.y) {
return false;
}
if (!ObjectUtils.equal(this.image, that.image)) {
if (!Objects.equals(this.image, that.image)) {
return false;
}
if (!this.anchor.equals(that.anchor)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Objects;

import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.Plot;
Expand All @@ -55,7 +56,6 @@
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.ui.RectangleEdge;
import org.jfree.chart.util.LineUtils;
import org.jfree.chart.util.ObjectUtils;
import org.jfree.chart.util.PaintUtils;
import org.jfree.chart.util.Args;
import org.jfree.chart.util.PublicCloneable;
Expand Down Expand Up @@ -230,7 +230,7 @@ public boolean equals(Object obj) {
if (!PaintUtils.equal(this.paint, that.paint)) {
return false;
}
if (!ObjectUtils.equal(this.stroke, that.stroke)) {
if (!Objects.equals(this.stroke, that.stroke)) {
return false;
}
// seems to be the same...
Expand Down
Loading