Maintenance actions
Hereafter, we detail the maintenance actions applied on the JFreeChart system for the qualitative evaluation detailed in section 5.2 of the paper.
Identified weaknesses
In the quantitative evaluation, 10 classes have been identified as both variable and quality-critical in JFreeChart.
org.jfree.chart.plot.CategoryPlot
org.jfree.chart.plot.XYPlot
org.jfree.chart.axis.DateAxis
org.jfree.chart.axis.NumberAxis
org.jfree.chart.JFreeChart
org.jfree.chart.title.TextTitle
org.jfree.chart.ChartPanel
org.jfree.chart.entity.ChartEntity
org.jfree.chart.labels.IntervalXYItemLabelGenerator
org.jfree.data.general.DefaultPieDataset
To reduce the set of classes in which applying modifications, we selected the ones maximizing their number of duplicated blocks or minimizing their test coverage, finally reducing the set to the 6 following classes.
Classes with code duplication
org.jfree.chart.plot.CategoryPlot
org.jfree.chart.plot.XYPlot
org.jfree.chart.axis.DateAxis
org.jfree.chart.axis.NumberAxis
Classes lacking tests
org.jfree.chart.ChartPanel
org.jfree.chart.entity.ChartEntity
Details of the maintenance actions
Classes with code duplication
The maintenance action for such classes is factorizing some duplicated blocks. Hereafter we detail the duplications that have been refactored.
Between org.jfree.chart.plot.XYPlot
and org.jfree.chart.plot.CategoryPlot
- setRangeAxis (XYPlot) duplicated in CategoryPlot
- L1931-L2107 (XYPlot) duplicated in CategoryPlot
- L2450-L2461 (XYPlot) duplicated in CategoryPlot
- L2515-L2653 (XYPlot) duplicated in CategoryPlot
- L2694-L2735 (XYPlot) duplicated in CategoryPlot
- L2745-L2838 (XYPlot) duplicated in CategoryPlot
Metrics evolution
- CategoryPlot
- cognitive complexity: 503 → 392
- duplicated blocks: 23 → 16
- XYPlot
- cognitive complexity: 666 → 603
- duplicated blocks: 24 → 21
In org.jfree.chart.axis.DateAxis
- L762-L786 duplicated in PeriodAxis (L972-L996)
- L1419-L1442 duplicated in L1471-L1494
- L1558-L1609 duplicated in L1676-L1726
- L1630-L1655 duplicated in L1747-L1771
Metrics evolution
- DateAxis
- cognitive complexity: 201 → 139
- duplicated blocks: 10 → 0
- PeriodAxis
- cognitive complexity: 112 → 104
- duplicated blocks: 2 → 1
In org.jfree.chart.axis.NumberAxis
- L312-L352 duplicated in LogAxis (L264-L304)
- L312-L352 duplicated in LogAxis (L529-L553)
- estimateMaximumTickLabelHeight duplicated in LogAxis
- L950-L984 duplicated in L1046-L1080
- L1083-L1105 duplicated in LogarithmicAxis (L1029-L1051)
Metrics evolution
- NumberAxis
- cognitive complexity: 163 → 127
- duplicated blocks: 12 → 4
- LogAxis
- cognitive complexity: 92 → 87
- duplicated blocks: 10 → 7
- LogarithmicAxis
- cognitive complexity: 315 → 281
- duplicated blocks: 4 → 0
Classes lacking tests
The maintenance action for such classes is adding test cases for several methods that are little to not tested. Hereafter we detail the methods for which tests have been added.
In org.jfree.chart.ChartPanel
- getShapeType
- getShapeCoords
- getRectCoords (private)
- getPolyCoords (private)
- getImageMapAreaTag
- toString
- equals
Metrics evolution
- coverage (JaCoCo): 25.7% → 52.2%
In org.jfree.chart.entity.ChartEntity
- getToolTipText
- scale
- paintComponent
- actionPerformed
- saveAsSVG
- saveFile extracted from saveAsSVG allowed to remove another duplication in saveAsPDF
- createFileChooser extracted from saveAsSVG allowed to remove two other duplications in saveAsPDF and doSaveAs
- mouseEntered
- mouseExited
- mousePressed
- mouseDragged
- mouseReleased
- getPointInRectangle
Metrics evolution
- coverage (JaCoCo): 30.7% → 90.5%