JLS strictfp Interfaces specifies that :
The effect of the strictfp modifier is to make all float or double expressions within the interface declaration be explicitly FP-strict (§15.4).
This implies that all nested types declared in the interface are implicitly strictfp.
And JLS strictfp Classes :
The effect of the strictfp modifier is to make all float or double expressions within the interface declaration be explicitly FP-strict (§15.4).
This implies that all methods declared in the interface, and all nested types declared in the interface, are implicitly strictfp.
From those two paragraphs there is no indication of the behavior of strictfp
while implementing/extending an interface/class declared with strictfp
modifier.
After searching I found a good explanation of the usage of strictfp
keyword Use the strictfp modifier for floating-point calculation consistency across platforms, and it specifies that :
Strict behavior is not inherited by a subclass that extends a FP-strict superclass. An overriding method can independently choose to be FP-strict when the overridden method is not, or vice versa.
I tested the behavior of strictfp
keyword while extending class declared with strictfp
keyword and it's true : the strictfp
behavior is not inherited by classes extending the class, but the problem is while implementing an interface declared with strictfp
keyword it's not correct : the strictfp
behavior is not inherited by classes implementing the interface.
Can anyone explain me the correct behavior of strictfp
with implementing/extending an interface/class declared with strictfp
modifier ?