Fix Options.hasOption() under GWT
use string literals for System.getProperty()
use overload with default parameter
@@ -33,30 +33,31 @@ class Options {
* Whether certain debugging checks should be made, such as that only direct NIO Buffers are used when Unsafe is active,
* and a proxy should be created on calls to toImmutable().
*/
- static final boolean DEBUG = hasOption("joml.debug");
+ static final boolean DEBUG = hasOption(System.getProperty("joml.debug", "false"));
+//#ifdef __JRE__
/**
* Whether <i>not</i> to use sun.misc.Unsafe when copying memory with MemUtil.
*/
- static final boolean NO_UNSAFE = Options.hasOption("joml.nounsafe");
+ static final boolean NO_UNSAFE = hasOption(System.getProperty("joml.nounsafe", "false"));
+//#endif
/**
* Whether fast approximations of some java.lang.Math operations should be used.
*/
- static final boolean FASTMATH = Options.hasOption("joml.fastmath");
+ static final boolean FASTMATH = hasOption(System.getProperty("joml.fastmath", "false"));
/**
* When {@link #FASTMATH} is <code>true</code>, whether to use a lookup table for sin/cos.
*/
- static final boolean SIN_LOOKUP = Options.hasOption("joml.sinLookup");
+ static final boolean SIN_LOOKUP = hasOption(System.getProperty("joml.sinLookup", "false"));
/**
* When {@link #SIN_LOOKUP} is <code>true</code>, this determines the table size.
*/
static final int SIN_LOOKUP_BITS = Integer.parseInt(System.getProperty("joml.sinLookup.bits", "14"));
- static boolean hasOption(String option) {
- String v = System.getProperty(option);
+ static boolean hasOption(String v) {
if (v == null)
return false;
if (v.trim().length() == 0)
