-
Notifications
You must be signed in to change notification settings - Fork 22
Description
The @Strictfp annotation is intended to standardize floating-point behavior across platforms, which I need for an application I'm developing. It can be applied to classes and concrete methods. Unfortunately, it currently fails when applied to abstract classes and traits. The attached .scala file demonstrates the problem. At runtime it fails with the error "java.lang.ClassFormatError: Method g in class A has illegal modifiers: 0xC01" or
"java.lang.ClassFormatError: Method f in class C has illegal modifiers: 0xC01". It appears that the Scala compiler is attempting to apply @Strictfp to abstract methods, which doesn't make sense and causes the JVM to throw an exception.
This bug can be worked around by applying @Strictfp to methods instead of classes. However, that would require applying it to every single concrete method, which would be very tedious, and it would be easy to miss some of them, which wouldn't cause any immediately obvious problems but might produce subtly different results on different platforms.
This bug occurs both when running the code in SBT and when compiling using scalac.