diff options
author | David A. Madore <david+git@madore.org> | 2010-04-16 17:38:31 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2010-04-16 17:38:31 +0200 |
commit | 0c124ba807b8a16f4119df64cb11734ed8e4ac1b (patch) | |
tree | 242eb8f22604739fba5af23ed40268c7d5522d85 /org/madore | |
parent | c18d6e561179a3a96d93a9ae8c6034115ba36923 (diff) | |
download | damlengine-0c124ba807b8a16f4119df64cb11734ed8e4ac1b.tar.gz damlengine-0c124ba807b8a16f4119df64cb11734ed8e4ac1b.tar.bz2 damlengine-0c124ba807b8a16f4119df64cb11734ed8e4ac1b.zip |
Use static initializers correctly (I had forgotten the "static" keyword!).
Diffstat (limited to 'org/madore')
-rw-r--r-- | org/madore/damlengine/TodoAttr.java | 5 | ||||
-rw-r--r-- | org/madore/damlengine/TodoElement.java | 5 |
2 files changed, 2 insertions, 8 deletions
diff --git a/org/madore/damlengine/TodoAttr.java b/org/madore/damlengine/TodoAttr.java index b9cb800..2b3df23 100644 --- a/org/madore/damlengine/TodoAttr.java +++ b/org/madore/damlengine/TodoAttr.java @@ -11,8 +11,7 @@ public abstract class TodoAttr extends TodoItem { protected static Map<String,Constructor<? extends TodoAttr>> damlAttrConstructors; - protected static void initializeDamlAttrConstructors() { - // FIXME: this should be a static initializer, but for some reason does not work... + static { damlAttrConstructors = new HashMap<String,Constructor<? extends TodoAttr>>(); Class[] argTypes = new Class[]{ Attr.class, Element.class, Map.class, Map.class }; try { @@ -40,8 +39,6 @@ public abstract class TodoAttr extends TodoItem { Map<String,Object> options) { Constructor<? extends TodoAttr> constructor = null; String nsuri = attr.getNamespaceURI(); - if ( damlAttrConstructors == null ) - initializeDamlAttrConstructors(); // FIXME: see above if ( nsuri != null && nsuri.equals(DamlEngine.DAML_NS) ) constructor = damlAttrConstructors.get(attr.getLocalName()); if ( constructor != null ) diff --git a/org/madore/damlengine/TodoElement.java b/org/madore/damlengine/TodoElement.java index f8dcca1..a069b36 100644 --- a/org/madore/damlengine/TodoElement.java +++ b/org/madore/damlengine/TodoElement.java @@ -10,8 +10,7 @@ public abstract class TodoElement extends TodoItem { protected static Map<String,Constructor<? extends TodoElement>> damlConstructors; - protected static void initializeDamlConstructors() { - // FIXME: this should be a static initializer, but for some reason does not work... + static { damlConstructors = new HashMap<String,Constructor<? extends TodoElement>>(); } @@ -30,8 +29,6 @@ public abstract class TodoElement extends TodoItem { Map<String,Object> options) { Constructor<? extends TodoElement> constructor = null; String nsuri = node.getNamespaceURI(); - if ( damlConstructors == null ) - initializeDamlConstructors(); // FIXME: see above if ( nsuri != null && nsuri.equals(DamlEngine.DAML_NS) ) constructor = damlConstructors.get(node.getLocalName()); if ( constructor != null ) |