Skip to content

Commit de7a870

Browse files
committed
make API backward-compatible.
1 parent d181f60 commit de7a870

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/org/sosy_lab/java_smt/api/FloatingPointFormulaManager.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package org.sosy_lab.java_smt.api;
1010

11+
import static org.sosy_lab.java_smt.api.FormulaManager.API_METHOD_NOT_IMPLEMENTED;
1112
import static org.sosy_lab.java_smt.api.FormulaType.getFloatingPointType;
1213

1314
import java.math.BigDecimal;
@@ -41,8 +42,10 @@ public interface FloatingPointFormulaManager {
4142
* Converts a rounding mode formula to the corresponding enum value. This method is the inverse of
4243
* {@link #makeRoundingMode(FloatingPointRoundingMode)}.
4344
*/
44-
FloatingPointRoundingMode fromRoundingModeFormula(
45-
FloatingPointRoundingModeFormula pRoundingModeFormula);
45+
default FloatingPointRoundingMode fromRoundingModeFormula(
46+
FloatingPointRoundingModeFormula pRoundingModeFormula) {
47+
throw new UnsupportedOperationException(API_METHOD_NOT_IMPLEMENTED);
48+
}
4649

4750
/**
4851
* Creates a floating point formula representing the given double value with the specified type.

src/org/sosy_lab/java_smt/api/FormulaManager.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
/** FormulaManager class contains all operations which can be performed on formulas. */
2121
public interface FormulaManager {
2222

23+
/**
24+
* Standardized message for not implemented API methods.
25+
*
26+
* <p>This constant can be used in {@link UnsupportedOperationException} to indicate that a
27+
* certain method is not implemented by some subclass. We recommend using this constant in API
28+
* extensions where the default implementation throws an exception.
29+
*/
30+
String API_METHOD_NOT_IMPLEMENTED =
31+
"The requested method is not implemented in the current implementation of this interface.";
32+
2333
/**
2434
* Returns the Integer-Theory. Because most SAT-solvers support automatic casting between Integer-
2535
* and Rational-Theory, the Integer- and the RationalFormulaManager both return the same Formulas

0 commit comments

Comments
 (0)