diff options
author | Harvey Harrison <[email protected]> | 2014-08-06 07:52:03 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2014-08-06 07:52:03 -0700 |
commit | f5ddb290db27cda63c78510ec8b8fdbdf4bc2bf4 (patch) | |
tree | 73f0e9a029a9a5fe44e757867c6289c597b8f24a | |
parent | fd0c674d66ce786a2c34495c7c9c12c11844b418 (diff) |
j3dcore: avoid lazy enum array creation, do it unconditionally
The static ref was not being initialized properly (needed to be synchronized),
just pull it into a staic init block and mark it final.
Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r-- | src/classes/share/javax/media/j3d/TextureAttributesRetained.java | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/src/classes/share/javax/media/j3d/TextureAttributesRetained.java b/src/classes/share/javax/media/j3d/TextureAttributesRetained.java index c51e830..a31d8fc 100644 --- a/src/classes/share/javax/media/j3d/TextureAttributesRetained.java +++ b/src/classes/share/javax/media/j3d/TextureAttributesRetained.java @@ -52,11 +52,8 @@ class TextureAttributesRetained extends NodeComponentRetained { static final int COMBINE_RGB_SCALE_CHANGED = 0x0800; static final int COMBINE_ALPHA_SCALE_CHANGED = 0x1000; - // static class variable for commands used in messages - static Integer commandInt[] = null; - // static class variable for enums. Currently only supports 0 - 9. - static Integer enums[] = null; + static final Integer[] enums; // Texture transform Transform3D transform = new Transform3D(); @@ -95,25 +92,20 @@ class TextureAttributesRetained extends NodeComponentRetained { // true when mirror texCoord component set boolean mirrorCompDirty = false; - static final void initTextureEnums() { - // create some of the enums Integer to be used in the messages - // this can be eliminated if the message is modified to take - // integer itself - // - // NOTE: check with the actual enum value before using this - // list. This list only supports 0 - 9 - if (enums == null) { - enums = new Integer[10]; - for (int i = 0; i < 10; i++) { - enums[i] = new Integer(i); - } + static { + // create some of the enums Integer to be used in the messages + // this can be eliminated if the message is modified to take + // integer itself + // + // NOTE: check with the actual enum value before using this + // list. This list only supports 0 - 9 + enums = new Integer[10]; + for (int i = 0; i < enums.length; i++) { + enums[i] = new Integer(i); + } } - } - - TextureAttributesRetained() { - initTextureEnums(); - } + TextureAttributesRetained() {} // initCombineMode -- initializes the combine mode related fields // delay the allocation of memory to minimize |