Given a Java application which was written with performance in mind (i.e. methods are deliberately not declared 'strictfp' in the source code), is it possible to allow users to run the entire application in strictfp mode?
It looks like a crude approach would be to simply add the "strictfp" attribute to all methods of all classes using a custom class loader written using javassist. This would be similar to:
http://www.verious.com/qa/no-strictfp-in-scala-workarounds/
However, the class loader would need to add the strictpf attribute to all class methods in the application, including private ones. (The application is simply too large and complex to explicitly list all possible methods which might requre the strictfp attribute.)
The reflection API in javassist does not seem to support listing private methods:
http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/html/javassist/CtClass.html#getMethods()
Is what I want to do possible in javassist (or at all via the custom class loader approach)?
I don't know if this will help you, but if you could change to using the Oracle JRockit JVM, it has a JVM option to enable strictfp
globally - '-XX+:-StrictFP`
(There is a '-XX+:-UseStrictFP' option on Hotspot JVMs, but it has the reverse effect to what you want.)
Reference:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With