diff options
4 files changed, 21 insertions, 8 deletions
diff --git a/src/java/com/jogamp/common/util/TaskBase.java b/src/java/com/jogamp/common/util/TaskBase.java index 9fd7c0d..35571e3 100644 --- a/src/java/com/jogamp/common/util/TaskBase.java +++ b/src/java/com/jogamp/common/util/TaskBase.java @@ -38,7 +38,12 @@ import jogamp.common.Debug; */ public abstract class TaskBase implements Runnable { /** Enable via the property <code>jogamp.debug.TaskBase.TraceSource</code> */ - private static final boolean TRACE_SOURCE = Debug.isPropertyDefined("jogamp.debug.TaskBase.TraceSource", true); + private static final boolean TRACE_SOURCE; + + static { + Debug.initSingleton(); + TRACE_SOURCE = Debug.isPropertyDefined("jogamp.debug.TaskBase.TraceSource", true); + } protected final Object syncObject; protected final boolean catchExceptions; diff --git a/src/java/com/jogamp/common/util/locks/Lock.java b/src/java/com/jogamp/common/util/locks/Lock.java index ea29763..df645ed 100644 --- a/src/java/com/jogamp/common/util/locks/Lock.java +++ b/src/java/com/jogamp/common/util/locks/Lock.java @@ -35,12 +35,12 @@ import jogamp.common.Debug; */ public interface Lock { - /** Enable via the property <code>jogamp.debug.Lock.TraceLock</code> */ - public static final boolean TRACE_LOCK = Debug.isPropertyDefined("jogamp.debug.Lock.TraceLock", true); - /** Enable via the property <code>jogamp.debug.Lock</code> */ public static final boolean DEBUG = Debug.debug("Lock"); + /** Enable via the property <code>jogamp.debug.Lock.TraceLock</code> */ + public static final boolean TRACE_LOCK = Debug.isPropertyDefined("jogamp.debug.Lock.TraceLock", true); + /** The default {@link #TIMEOUT} value, of {@value} ms */ public static final long DEFAULT_TIMEOUT = 5000; // 5s default timeout diff --git a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java index fc60265..841fa1d 100644 --- a/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java +++ b/src/java/com/jogamp/gluegen/structgen/CStructAnnotationProcessor.java @@ -80,8 +80,13 @@ import jogamp.common.Debug; @SupportedAnnotationTypes(value = {"com.jogamp.gluegen.structgen.CStruct"}) @SupportedSourceVersion(SourceVersion.RELEASE_6) public class CStructAnnotationProcessor extends AbstractProcessor { - private static final boolean DEBUG = Debug.isPropertyDefined("jogamp.gluegen.structgen.debug", true); private static final String DEFAULT = "_default_"; + private static final boolean DEBUG; + + static { + Debug.initSingleton(); + DEBUG = Debug.isPropertyDefined("jogamp.gluegen.structgen.debug", true); + } private static final String STRUCTGENOUTPUT_OPTION = "structgen.output"; private static final String STRUCTGENOUTPUT = PropertyAccess.getProperty("jogamp.gluegen."+STRUCTGENOUTPUT_OPTION, true, "gensrc"); diff --git a/src/java/jogamp/common/Debug.java b/src/java/jogamp/common/Debug.java index b8a32d8..b826a06 100644 --- a/src/java/jogamp/common/Debug.java +++ b/src/java/jogamp/common/Debug.java @@ -63,15 +63,18 @@ public class Debug extends PropertyAccess { debugAll = isPropertyDefined("jogamp.debug", true); } - public static boolean verbose() { + /** Ensures static init block has been issues, i.e. if calling through to {@link PropertyAccess#isPropertyDefined(String, boolean)}. */ + public static final void initSingleton() {} + + public static final boolean verbose() { return verbose; } - public static boolean debugAll() { + public static final boolean debugAll() { return debugAll; } - public static boolean debug(String subcomponent) { + public static final boolean debug(String subcomponent) { return debugAll() || isPropertyDefined("jogamp.debug." + subcomponent, true); } } |