From f5ddb290db27cda63c78510ec8b8fdbdf4bc2bf4 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Wed, 6 Aug 2014 07:52:03 -0700 Subject: 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 --- .../javax/media/j3d/TextureAttributesRetained.java | 34 +++++++++------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'src/classes') 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 -- cgit v1.2.3