langtools/src/share/classes/com/sun/tools/javac/util/Names.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 133     public final Name Method;
 134     public final Name Bound;
 135     public final Name clone;
 136     public final Name getComponentType;
 137     public final Name getClassLoader;
 138     public final Name initCause;
 139     public final Name values;
 140     public final Name iterator;
 141     public final Name hasNext;
 142     public final Name next;
 143     public final Name AnnotationDefault;
 144     public final Name ordinal;
 145     public final Name equals;
 146     public final Name hashCode;
 147     public final Name compareTo;
 148     public final Name getDeclaringClass;
 149     public final Name ex;
 150     public final Name finalize;
 151     public final Name java_lang_AutoCloseable;
 152     public final Name close;

 153 
 154     public final Name.Table table;
 155 
 156     public Names(Context context) {
 157         Options options = Options.instance(context);
 158         table = createTable(options);
 159 
 160         slash = fromString("/");
 161         hyphen = fromString("-");
 162         T = fromString("T");
 163         slashequals = fromString("/=");
 164         deprecated = fromString("deprecated");
 165 
 166         init = fromString("<init>");
 167         clinit = fromString("<clinit>");
 168         error = fromString("<error>");
 169         any = fromString("<any>");
 170         empty = fromString("");
 171         one = fromString("1");
 172         period = fromString(".");


 251         Bound = fromString("Bound");
 252         clone = fromString("clone");
 253         getComponentType = fromString("getComponentType");
 254         getClassLoader = fromString("getClassLoader");
 255         initCause = fromString("initCause");
 256         values = fromString("values");
 257         iterator = fromString("iterator");
 258         hasNext = fromString("hasNext");
 259         next = fromString("next");
 260         AnnotationDefault = fromString("AnnotationDefault");
 261         ordinal = fromString("ordinal");
 262         equals = fromString("equals");
 263         hashCode = fromString("hashCode");
 264         compareTo = fromString("compareTo");
 265         getDeclaringClass = fromString("getDeclaringClass");
 266         ex = fromString("ex");
 267         finalize = fromString("finalize");
 268 
 269         java_lang_AutoCloseable = fromString("java.lang.AutoCloseable");
 270         close = fromString("close");

 271     }
 272 
 273     protected Name.Table createTable(Options options) {
 274         boolean useUnsharedTable = options.isSet("useUnsharedTable");
 275         if (useUnsharedTable)
 276             return new UnsharedNameTable(this);
 277         else
 278             return new SharedNameTable(this);
 279     }
 280 
 281     public void dispose() {
 282         table.dispose();
 283     }
 284 
 285     public Name fromChars(char[] cs, int start, int len) {
 286         return table.fromChars(cs, start, len);
 287     }
 288 
 289     public Name fromString(String s) {
 290         return table.fromString(s);
   1 /*
   2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 133     public final Name Method;
 134     public final Name Bound;
 135     public final Name clone;
 136     public final Name getComponentType;
 137     public final Name getClassLoader;
 138     public final Name initCause;
 139     public final Name values;
 140     public final Name iterator;
 141     public final Name hasNext;
 142     public final Name next;
 143     public final Name AnnotationDefault;
 144     public final Name ordinal;
 145     public final Name equals;
 146     public final Name hashCode;
 147     public final Name compareTo;
 148     public final Name getDeclaringClass;
 149     public final Name ex;
 150     public final Name finalize;
 151     public final Name java_lang_AutoCloseable;
 152     public final Name close;
 153     public final Name addSuppressed;
 154 
 155     public final Name.Table table;
 156 
 157     public Names(Context context) {
 158         Options options = Options.instance(context);
 159         table = createTable(options);
 160 
 161         slash = fromString("/");
 162         hyphen = fromString("-");
 163         T = fromString("T");
 164         slashequals = fromString("/=");
 165         deprecated = fromString("deprecated");
 166 
 167         init = fromString("<init>");
 168         clinit = fromString("<clinit>");
 169         error = fromString("<error>");
 170         any = fromString("<any>");
 171         empty = fromString("");
 172         one = fromString("1");
 173         period = fromString(".");


 252         Bound = fromString("Bound");
 253         clone = fromString("clone");
 254         getComponentType = fromString("getComponentType");
 255         getClassLoader = fromString("getClassLoader");
 256         initCause = fromString("initCause");
 257         values = fromString("values");
 258         iterator = fromString("iterator");
 259         hasNext = fromString("hasNext");
 260         next = fromString("next");
 261         AnnotationDefault = fromString("AnnotationDefault");
 262         ordinal = fromString("ordinal");
 263         equals = fromString("equals");
 264         hashCode = fromString("hashCode");
 265         compareTo = fromString("compareTo");
 266         getDeclaringClass = fromString("getDeclaringClass");
 267         ex = fromString("ex");
 268         finalize = fromString("finalize");
 269 
 270         java_lang_AutoCloseable = fromString("java.lang.AutoCloseable");
 271         close = fromString("close");
 272         addSuppressed = fromString("addSuppressed");
 273     }
 274 
 275     protected Name.Table createTable(Options options) {
 276         boolean useUnsharedTable = options.isSet("useUnsharedTable");
 277         if (useUnsharedTable)
 278             return new UnsharedNameTable(this);
 279         else
 280             return new SharedNameTable(this);
 281     }
 282 
 283     public void dispose() {
 284         table.dispose();
 285     }
 286 
 287     public Name fromChars(char[] cs, int start, int len) {
 288         return table.fromChars(cs, start, len);
 289     }
 290 
 291     public Name fromString(String s) {
 292         return table.fromString(s);