langtools/src/share/classes/com/sun/tools/javac/util/Names.java
author jjg
Tue, 16 Sep 2008 18:35:18 -0700
changeset 1260 a772ba9ba43d
child 1264 076a3cde30d5
permissions -rw-r--r--
6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes Reviewed-by: darcy, mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1260
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
     1
/*
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
     2
 * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
     4
 *
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    10
 *
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    15
 * accompanied this code).
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    16
 *
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    20
 *
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    23
 * have any questions.
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    24
 */
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    25
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    26
package com.sun.tools.javac.util;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    27
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    28
/**
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    29
 * Access to the compiler's name table.  STandard names are defined,
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    30
 * as well as methods to create new names.
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    31
 *
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    32
 *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    33
 *  you write code that depends on this, you do so at your own risk.
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    34
 *  This code and its internal interfaces are subject to change or
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    35
 *  deletion without notice.</b>
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    36
 */
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    37
public class Names {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    38
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    39
    public static final Context.Key<Names> namesKey = new Context.Key<Names>();
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    40
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    41
    public static Names instance(Context context) {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    42
        Names instance = context.get(namesKey);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    43
        if (instance == null) {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    44
            instance = new Names(context);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    45
            context.put(namesKey, instance);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    46
        }
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    47
        return instance;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    48
    }
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    49
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    50
    public final Name slash;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    51
    public final Name hyphen;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    52
    public final Name T;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    53
    public final Name slashequals;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    54
    public final Name deprecated;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    55
    public final Name init;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    56
    public final Name clinit;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    57
    public final Name error;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    58
    public final Name any;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    59
    public final Name empty;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    60
    public final Name one;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    61
    public final Name period;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    62
    public final Name comma;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    63
    public final Name semicolon;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    64
    public final Name asterisk;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    65
    public final Name _this;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    66
    public final Name _super;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    67
    public final Name _default;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    68
    public final Name _class;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    69
    public final Name java_lang;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    70
    public final Name java_lang_Object;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    71
    public final Name java_lang_Class;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    72
    public final Name java_lang_Cloneable;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    73
    public final Name java_io_Serializable;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    74
    public final Name serialVersionUID;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    75
    public final Name java_lang_Enum;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    76
    public final Name package_info;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    77
    public final Name ConstantValue;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    78
    public final Name LineNumberTable;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    79
    public final Name LocalVariableTable;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    80
    public final Name LocalVariableTypeTable;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    81
    public final Name CharacterRangeTable;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    82
    public final Name StackMap;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    83
    public final Name StackMapTable;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    84
    public final Name SourceID;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    85
    public final Name CompilationID;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    86
    public final Name Code;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    87
    public final Name Exceptions;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    88
    public final Name SourceFile;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    89
    public final Name InnerClasses;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    90
    public final Name Synthetic;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    91
    public final Name Bridge;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    92
    public final Name Deprecated;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    93
    public final Name Enum;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    94
    public final Name _name;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    95
    public final Name Signature;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    96
    public final Name Varargs;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    97
    public final Name Annotation;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    98
    public final Name RuntimeVisibleAnnotations;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
    99
    public final Name RuntimeInvisibleAnnotations;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   100
    public final Name RuntimeVisibleParameterAnnotations;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   101
    public final Name RuntimeInvisibleParameterAnnotations;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   102
    public final Name Value;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   103
    public final Name EnclosingMethod;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   104
    public final Name desiredAssertionStatus;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   105
    public final Name append;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   106
    public final Name family;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   107
    public final Name forName;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   108
    public final Name toString;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   109
    public final Name length;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   110
    public final Name valueOf;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   111
    public final Name value;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   112
    public final Name getMessage;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   113
    public final Name getClass;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   114
    public final Name TYPE;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   115
    public final Name FIELD;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   116
    public final Name METHOD;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   117
    public final Name PARAMETER;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   118
    public final Name CONSTRUCTOR;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   119
    public final Name LOCAL_VARIABLE;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   120
    public final Name ANNOTATION_TYPE;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   121
    public final Name PACKAGE;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   122
    public final Name SOURCE;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   123
    public final Name CLASS;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   124
    public final Name RUNTIME;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   125
    public final Name Array;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   126
    public final Name Method;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   127
    public final Name Bound;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   128
    public final Name clone;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   129
    public final Name getComponentType;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   130
    public final Name getClassLoader;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   131
    public final Name initCause;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   132
    public final Name values;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   133
    public final Name iterator;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   134
    public final Name hasNext;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   135
    public final Name next;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   136
    public final Name AnnotationDefault;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   137
    public final Name ordinal;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   138
    public final Name equals;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   139
    public final Name hashCode;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   140
    public final Name compareTo;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   141
    public final Name getDeclaringClass;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   142
    public final Name ex;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   143
    public final Name finalize;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   144
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   145
    public final Name.Table table;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   146
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   147
    public Names(Context context) {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   148
        Options options = Options.instance(context);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   149
        table = createTable(options);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   150
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   151
        slash = fromString("/");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   152
        hyphen = fromString("-");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   153
        T = fromString("T");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   154
        slashequals = fromString("/=");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   155
        deprecated = fromString("deprecated");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   156
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   157
        init = fromString("<init>");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   158
        clinit = fromString("<clinit>");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   159
        error = fromString("<error>");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   160
        any = fromString("<any>");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   161
        empty = fromString("");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   162
        one = fromString("1");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   163
        period = fromString(".");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   164
        comma = fromString(",");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   165
        semicolon = fromString(";");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   166
        asterisk = fromString("*");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   167
        _this = fromString("this");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   168
        _super = fromString("super");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   169
        _default = fromString("default");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   170
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   171
        _class = fromString("class");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   172
        java_lang = fromString("java.lang");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   173
        java_lang_Object = fromString("java.lang.Object");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   174
        java_lang_Class = fromString("java.lang.Class");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   175
        java_lang_Cloneable = fromString("java.lang.Cloneable");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   176
        java_io_Serializable = fromString("java.io.Serializable");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   177
        java_lang_Enum = fromString("java.lang.Enum");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   178
        package_info = fromString("package-info");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   179
        serialVersionUID = fromString("serialVersionUID");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   180
        ConstantValue = fromString("ConstantValue");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   181
        LineNumberTable = fromString("LineNumberTable");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   182
        LocalVariableTable = fromString("LocalVariableTable");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   183
        LocalVariableTypeTable = fromString("LocalVariableTypeTable");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   184
        CharacterRangeTable = fromString("CharacterRangeTable");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   185
        StackMap = fromString("StackMap");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   186
        StackMapTable = fromString("StackMapTable");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   187
        SourceID = fromString("SourceID");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   188
        CompilationID = fromString("CompilationID");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   189
        Code = fromString("Code");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   190
        Exceptions = fromString("Exceptions");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   191
        SourceFile = fromString("SourceFile");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   192
        InnerClasses = fromString("InnerClasses");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   193
        Synthetic = fromString("Synthetic");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   194
        Bridge = fromString("Bridge");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   195
        Deprecated = fromString("Deprecated");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   196
        Enum = fromString("Enum");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   197
        _name = fromString("name");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   198
        Signature = fromString("Signature");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   199
        Varargs = fromString("Varargs");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   200
        Annotation = fromString("Annotation");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   201
        RuntimeVisibleAnnotations = fromString("RuntimeVisibleAnnotations");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   202
        RuntimeInvisibleAnnotations = fromString("RuntimeInvisibleAnnotations");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   203
        RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   204
        RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   205
        Value = fromString("Value");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   206
        EnclosingMethod = fromString("EnclosingMethod");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   207
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   208
        desiredAssertionStatus = fromString("desiredAssertionStatus");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   209
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   210
        append = fromString("append");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   211
        family = fromString("family");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   212
        forName = fromString("forName");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   213
        toString = fromString("toString");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   214
        length = fromString("length");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   215
        valueOf = fromString("valueOf");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   216
        value = fromString("value");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   217
        getMessage = fromString("getMessage");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   218
        getClass = fromString("getClass");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   219
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   220
        TYPE = fromString("TYPE");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   221
        FIELD = fromString("FIELD");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   222
        METHOD = fromString("METHOD");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   223
        PARAMETER = fromString("PARAMETER");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   224
        CONSTRUCTOR = fromString("CONSTRUCTOR");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   225
        LOCAL_VARIABLE = fromString("LOCAL_VARIABLE");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   226
        ANNOTATION_TYPE = fromString("ANNOTATION_TYPE");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   227
        PACKAGE = fromString("PACKAGE");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   228
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   229
        SOURCE = fromString("SOURCE");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   230
        CLASS = fromString("CLASS");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   231
        RUNTIME = fromString("RUNTIME");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   232
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   233
        Array = fromString("Array");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   234
        Method = fromString("Method");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   235
        Bound = fromString("Bound");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   236
        clone = fromString("clone");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   237
        getComponentType = fromString("getComponentType");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   238
        getClassLoader = fromString("getClassLoader");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   239
        initCause = fromString("initCause");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   240
        values = fromString("values");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   241
        iterator = fromString("iterator");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   242
        hasNext = fromString("hasNext");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   243
        next = fromString("next");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   244
        AnnotationDefault = fromString("AnnotationDefault");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   245
        ordinal = fromString("ordinal");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   246
        equals = fromString("equals");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   247
        hashCode = fromString("hashCode");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   248
        compareTo = fromString("compareTo");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   249
        getDeclaringClass = fromString("getDeclaringClass");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   250
        ex = fromString("ex");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   251
        finalize = fromString("finalize");
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   252
    }
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   253
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   254
    protected Name.Table createTable(Options options) {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   255
        boolean useUnsharedTable = options.get("useUnsharedTable") != null;
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   256
        if (useUnsharedTable)
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   257
            return new UnsharedNameTable(this);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   258
        else
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   259
            return new SharedNameTable(this);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   260
    }
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   261
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   262
    public void dispose() {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   263
        table.dispose();
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   264
    }
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   265
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   266
    public Name fromChars(char[] cs, int start, int len) {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   267
        return table.fromChars(cs, start, len);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   268
    }
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   269
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   270
    public Name fromString(String s) {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   271
        return table.fromString(s);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   272
    }
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   273
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   274
    public Name fromUtf(byte[] cs) {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   275
        return table.fromUtf(cs);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   276
    }
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   277
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   278
    public Name fromUtf(byte[] cs, int start, int len) {
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   279
        return table.fromUtf(cs, start, len);
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   280
    }
a772ba9ba43d 6574134: Allow for alternative implementation of Name Table with garbage collection of name bytes
jjg
parents:
diff changeset
   281
}