I'm writing a multiplayer game in Scala where the floating-point computations have to happen in exactly the same way on every computer, so I tried adding the @strictfp
annotation to every class, object, and trait. However, when I try to run the code I get errors like this one: java.lang.ClassFormatError: Method handleKeyPress in class com/nathanstoddard/common/renderer2d/InputHandler has illegal modifiers: 0xC01
. If I remove the @strictfp
annotation from that class, it gives a similar error message for a different method in a different class.
What does this error message mean, and how do I fix it? Is it a bug in my code or in the Scala compiler?
I've tried using the @strictfp
tag in smaller applications, and so far I've been unable to reproduce this crash with anything but my large project.
Also, is there a way to enable strictfp globally, so I don't have to add it to every class?
I'm using Scala 2.10.3 on Windows 7, and Java 1.7.0_10 (64-bit), and I'm running my program with sbt 0.12.2.