Skip to content

Commit 4ee84fe

Browse files
committed
Avoid usage of deprecated RoundingMode in BigDecimal
The setScale(...) method accepting the mode as integer has been deprecated with Java 9. Given that Draw2D requires at least Java 17, we can simply use the drop-in replacement via the RoundingMode enum. Contributes to eclipse-gef#778
1 parent 9fc9928 commit 4ee84fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/PrecisionGeometry.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010 itemis AG and others.
2+
* Copyright (c) 2010, 2025 itemis AG and others.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License 2.0 which is available at
@@ -14,6 +14,7 @@
1414
package org.eclipse.draw2d.geometry;
1515

1616
import java.math.BigDecimal;
17+
import java.math.RoundingMode;
1718

1819
/**
1920
* A Utilities class for precise geometry calculations.
@@ -27,7 +28,7 @@ public class PrecisionGeometry {
2728
* Precise calculations on doubles are performed based on BigDecimals,
2829
* converting to 16 digits scale, so there are no undesired rounding effects.
2930
*/
30-
private static final int ROUNDING = BigDecimal.ROUND_HALF_EVEN;
31+
private static final RoundingMode ROUNDING = RoundingMode.HALF_EVEN;
3132
private static final int SCALE = 16;
3233

3334
protected static final double preciseAdd(double d1, double d2) {

0 commit comments

Comments
 (0)