src/share/classes/com/sun/tools/javac/code/TargetType.java

changeset 1442
fcf89720ae71
parent 1357
c75be5bc5283
child 1521
71f35e4b93a5
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/TargetType.java	Mon Dec 10 12:10:50 2012 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/TargetType.java	Mon Dec 10 16:21:26 2012 +0000
     1.3 @@ -166,7 +166,7 @@
     1.4      static final int MAXIMUM_TARGET_TYPE_VALUE = 0x22;
     1.5  
     1.6      private final int targetTypeValue;
     1.7 -    private Set<TargetAttribute> flags;
     1.8 +    private final Set<TargetAttribute> flags;
     1.9  
    1.10      TargetType(int targetTypeValue, TargetAttribute... attributes) {
    1.11          if (targetTypeValue < Byte.MIN_VALUE
    1.12 @@ -233,10 +233,10 @@
    1.13          return this.targetTypeValue;
    1.14      }
    1.15  
    1.16 -    private static TargetType[] targets = null;
    1.17 +    private static final TargetType[] targets;
    1.18  
    1.19 -    private static TargetType[] buildTargets() {
    1.20 -        TargetType[] targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
    1.21 +    static {
    1.22 +        targets = new TargetType[MAXIMUM_TARGET_TYPE_VALUE + 1];
    1.23          TargetType[] alltargets = values();
    1.24          for (TargetType target : alltargets) {
    1.25              if (target.targetTypeValue >= 0)
    1.26 @@ -246,13 +246,9 @@
    1.27              if (targets[i] == null)
    1.28                  targets[i] = UNKNOWN;
    1.29          }
    1.30 -        return targets;
    1.31      }
    1.32  
    1.33      public static boolean isValidTargetTypeValue(int tag) {
    1.34 -        if (targets == null)
    1.35 -            targets = buildTargets();
    1.36 -
    1.37          if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
    1.38              return true;
    1.39  
    1.40 @@ -260,9 +256,6 @@
    1.41      }
    1.42  
    1.43      public static TargetType fromTargetTypeValue(int tag) {
    1.44 -        if (targets == null)
    1.45 -            targets = buildTargets();
    1.46 -
    1.47          if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
    1.48              return UNKNOWN;
    1.49  

mercurial