1 /*******************************************************************************
 
   2  * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
 
   3  * All rights reserved. This program and the accompanying materials 
 
   4  * are made available under the terms of the Common Public License v0.5 
 
   5  * which accompanies this distribution, and is available at
 
   6  * http://www.eclipse.org/legal/cpl-v05.html
 
   9  *     IBM Corporation - initial API and implementation
 
  10  ******************************************************************************/
 
  11 package net.sourceforge.phpdt.internal.compiler.codegen;
 
  13 import net.sourceforge.phpdt.internal.compiler.ClassFile;
 
  14 import net.sourceforge.phpdt.internal.compiler.classfmt.ClassFileConstants;
 
  15 import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
 
  16 import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
 
  17 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
 
  18 import net.sourceforge.phpdt.internal.compiler.lookup.TypeIds;
 
  19 import net.sourceforge.phpdt.internal.compiler.util.CharOperation;
 
  22  * This type is used to store all the constant pool entries.
 
  24 public class ConstantPool implements ClassFileConstants, TypeIds {
 
  25         public static final int DOUBLE_INITIAL_SIZE = 5;
 
  26         public static final int FLOAT_INITIAL_SIZE = 3;
 
  27         public static final int INT_INITIAL_SIZE = 248;
 
  28         public static final int LONG_INITIAL_SIZE = 5;
 
  29         public static final int UTF8_INITIAL_SIZE = 778;
 
  30         public static final int STRING_INITIAL_SIZE = 761;
 
  31         public static final int FIELD_INITIAL_SIZE = 156;
 
  32         public static final int METHOD_INITIAL_SIZE = 236;
 
  33         public static final int INTERFACE_INITIAL_SIZE = 50;
 
  34         public static final int CLASS_INITIAL_SIZE = 86;
 
  35         public static final int NAMEANDTYPE_INITIAL_SIZE = 272;
 
  36         public static final int CONSTANTPOOL_INITIAL_SIZE = 2000;
 
  37         public static final int CONSTANTPOOL_GROW_SIZE = 6000;
 
  38         protected DoubleCache doubleCache;
 
  39         protected FloatCache floatCache;
 
  40         protected IntegerCache intCache;
 
  41         protected LongCache longCache;
 
  42         public CharArrayCache UTF8Cache;
 
  43         protected CharArrayCache stringCache;
 
  44         protected ObjectCache fieldCache;
 
  45         protected ObjectCache methodCache;
 
  46         protected ObjectCache interfaceMethodCache;
 
  47         protected ObjectCache classCache;
 
  48         protected FieldNameAndTypeCache nameAndTypeCacheForFields;
 
  49         protected MethodNameAndTypeCache nameAndTypeCacheForMethods;
 
  50         int[] wellKnownTypes = new int[21];
 
  51         int[] wellKnownMethods = new int[36];
 
  52         int[] wellKnownFields = new int[10];
 
  53         int[] wellKnownFieldNameAndTypes = new int[2];
 
  54         int[] wellKnownMethodNameAndTypes = new int[33];
 
  55         public byte[] poolContent;
 
  56         public int currentIndex = 1;
 
  57         public int currentOffset;
 
  58         // predefined constant index for well known types
 
  59         final static int JAVA_LANG_BOOLEAN_TYPE = 0;
 
  60         final static int JAVA_LANG_BYTE_TYPE = 1;
 
  61         final static int JAVA_LANG_CHARACTER_TYPE = 2;
 
  62         final static int JAVA_LANG_DOUBLE_TYPE = 3;
 
  63         final static int JAVA_LANG_FLOAT_TYPE = 4;
 
  64         final static int JAVA_LANG_INTEGER_TYPE = 5;
 
  65         final static int JAVA_LANG_LONG_TYPE = 6;
 
  66         final static int JAVA_LANG_SHORT_TYPE = 7;
 
  67         final static int JAVA_LANG_VOID_TYPE = 8;
 
  68         final static int JAVA_LANG_CLASS_TYPE = 9;
 
  69         final static int JAVA_LANG_CLASSNOTFOUNDEXCEPTION_TYPE = 10;
 
  70         final static int JAVA_LANG_NOCLASSDEFFOUNDERROR_TYPE = 11;
 
  71         final static int JAVA_LANG_OBJECT_TYPE = 12;
 
  72         final static int JAVA_LANG_STRING_TYPE = 13;
 
  73         final static int JAVA_LANG_STRINGBUFFER_TYPE = 14;
 
  74         final static int JAVA_LANG_SYSTEM_TYPE = 15;
 
  75         final static int JAVA_LANG_THROWABLE_TYPE = 16;
 
  76         final static int JAVA_LANG_ERROR_TYPE = 17;
 
  77         final static int JAVA_LANG_EXCEPTION_TYPE = 18;
 
  78         final static int JAVA_LANG_REFLECT_CONSTRUCTOR_TYPE = 19;
 
  79         final static int JAVA_LANG_ASSERTIONERROR_TYPE = 20;
 
  81         // predefined constant index for well known fields  
 
  82         final static int TYPE_BYTE_FIELD = 0;
 
  83         final static int TYPE_SHORT_FIELD = 1;
 
  84         final static int TYPE_CHARACTER_FIELD = 2;
 
  85         final static int TYPE_INTEGER_FIELD = 3;
 
  86         final static int TYPE_LONG_FIELD = 4;
 
  87         final static int TYPE_FLOAT_FIELD = 5;
 
  88         final static int TYPE_DOUBLE_FIELD = 6;
 
  89         final static int TYPE_BOOLEAN_FIELD = 7;
 
  90         final static int TYPE_VOID_FIELD = 8;
 
  91         final static int OUT_SYSTEM_FIELD = 9;
 
  92         // predefined constant index for well known methods 
 
  93         final static int FORNAME_CLASS_METHOD = 0;
 
  94         final static int NOCLASSDEFFOUNDERROR_CONSTR_METHOD = 1;
 
  95         final static int APPEND_INT_METHOD = 2;
 
  96         final static int APPEND_FLOAT_METHOD = 3;
 
  97         final static int APPEND_LONG_METHOD = 4;
 
  98         final static int APPEND_OBJECT_METHOD = 5;
 
  99         final static int APPEND_CHAR_METHOD = 6;
 
 100         final static int APPEND_STRING_METHOD = 7;
 
 101         final static int APPEND_BOOLEAN_METHOD = 8;
 
 102         final static int APPEND_DOUBLE_METHOD = 9;
 
 103         final static int STRINGBUFFER_STRING_CONSTR_METHOD = 10;
 
 104         final static int STRINGBUFFER_DEFAULT_CONSTR_METHOD = 11;
 
 105         final static int STRINGBUFFER_TOSTRING_METHOD = 12;
 
 106         final static int SYSTEM_EXIT_METHOD = 13;
 
 107         final static int THROWABLE_GETMESSAGE_METHOD = 14;
 
 108         final static int JAVALANGERROR_CONSTR_METHOD = 15;
 
 109         final static int GETCONSTRUCTOR_CLASS_METHOD = 16;
 
 110         final static int NEWINSTANCE_CONSTRUCTOR_METHOD = 17;
 
 111         final static int STRING_INTERN_METHOD = 18;
 
 112         final static int VALUEOF_INT_METHOD = 19;
 
 113         final static int VALUEOF_FLOAT_METHOD = 20;
 
 114         final static int VALUEOF_LONG_METHOD = 21;
 
 115         final static int VALUEOF_OBJECT_METHOD = 22;
 
 116         final static int VALUEOF_CHAR_METHOD = 23;
 
 117         final static int VALUEOF_BOOLEAN_METHOD = 24;
 
 118         final static int VALUEOF_DOUBLE_METHOD = 25;
 
 119         final static int ASSERTIONERROR_CONSTR_OBJECT_METHOD = 26;
 
 120         final static int ASSERTIONERROR_CONSTR_INT_METHOD = 27;
 
 121         final static int ASSERTIONERROR_CONSTR_LONG_METHOD = 28;
 
 122         final static int ASSERTIONERROR_CONSTR_FLOAT_METHOD = 29;
 
 123         final static int ASSERTIONERROR_CONSTR_DOUBLE_METHOD = 30;
 
 124         final static int ASSERTIONERROR_CONSTR_BOOLEAN_METHOD = 31;
 
 125         final static int ASSERTIONERROR_CONSTR_CHAR_METHOD = 32;
 
 126         final static int ASSERTIONERROR_DEFAULT_CONSTR_METHOD = 33;
 
 127         final static int DESIREDASSERTIONSTATUS_CLASS_METHOD = 34;
 
 128         final static int GETCLASS_OBJECT_METHOD = 35;
 
 129         // predefined constant index for well known name and type for fields
 
 130         final static int TYPE_JAVALANGCLASS_NAME_AND_TYPE = 0;
 
 131         final static int OUT_SYSTEM_NAME_AND_TYPE = 1;
 
 132         // predefined constant index for well known name and type for methods
 
 133         final static int FORNAME_CLASS_METHOD_NAME_AND_TYPE = 0;
 
 134         final static int CONSTR_STRING_METHOD_NAME_AND_TYPE = 1;
 
 135         final static int DEFAULT_CONSTR_METHOD_NAME_AND_TYPE = 2;
 
 136         final static int APPEND_INT_METHOD_NAME_AND_TYPE = 3;
 
 137         final static int APPEND_FLOAT_METHOD_NAME_AND_TYPE = 4;
 
 138         final static int APPEND_LONG_METHOD_NAME_AND_TYPE = 5;
 
 139         final static int APPEND_OBJECT_METHOD_NAME_AND_TYPE = 6;
 
 140         final static int APPEND_CHAR_METHOD_NAME_AND_TYPE = 7;
 
 141         final static int APPEND_STRING_METHOD_NAME_AND_TYPE = 8;
 
 142         final static int APPEND_BOOLEAN_METHOD_NAME_AND_TYPE = 9;
 
 143         final static int APPEND_DOUBLE_METHOD_NAME_AND_TYPE = 10;
 
 144         final static int TOSTRING_METHOD_NAME_AND_TYPE = 11;
 
 145         final static int EXIT_METHOD_NAME_AND_TYPE = 12;
 
 146         final static int GETMESSAGE_METHOD_NAME_AND_TYPE = 13;
 
 147         final static int GETCONSTRUCTOR_METHOD_NAME_AND_TYPE = 14;
 
 148         final static int NEWINSTANCE_METHOD_NAME_AND_TYPE = 15;
 
 149         final static int INTERN_METHOD_NAME_AND_TYPE = 16;
 
 150         final static int VALUEOF_INT_METHOD_NAME_AND_TYPE = 17;
 
 151         final static int VALUEOF_FLOAT_METHOD_NAME_AND_TYPE = 18;
 
 152         final static int VALUEOF_LONG_METHOD_NAME_AND_TYPE = 19;
 
 153         final static int VALUEOF_OBJECT_METHOD_NAME_AND_TYPE = 20;
 
 154         final static int VALUEOF_CHAR_METHOD_NAME_AND_TYPE = 21;
 
 155         final static int VALUEOF_BOOLEAN_METHOD_NAME_AND_TYPE = 22;
 
 156         final static int VALUEOF_DOUBLE_METHOD_NAME_AND_TYPE = 23;
 
 157         final static int CONSTR_INT_METHOD_NAME_AND_TYPE = 24;
 
 158         final static int CONSTR_LONG_METHOD_NAME_AND_TYPE = 25;
 
 159         final static int CONSTR_FLOAT_METHOD_NAME_AND_TYPE = 26;
 
 160         final static int CONSTR_DOUBLE_METHOD_NAME_AND_TYPE = 27;
 
 161         final static int CONSTR_OBJECT_METHOD_NAME_AND_TYPE = 28;
 
 162         final static int CONSTR_CHAR_METHOD_NAME_AND_TYPE = 29;
 
 163         final static int CONSTR_BOOLEAN_METHOD_NAME_AND_TYPE = 30;
 
 164         final static int DESIREDASSERTIONSTATUS_METHOD_NAME_AND_TYPE = 31;
 
 165         final static int GETCLASS_OBJECT_METHOD_NAME_AND_TYPE = 32;
 
 168         public ClassFile classFile;
 
 171  * ConstantPool constructor comment.
 
 173 public ConstantPool(ClassFile classFile) {
 
 174         this.UTF8Cache = new CharArrayCache(UTF8_INITIAL_SIZE);
 
 175         this.stringCache = new CharArrayCache(STRING_INITIAL_SIZE);
 
 176         this.fieldCache = new ObjectCache(FIELD_INITIAL_SIZE);
 
 177         this.methodCache = new ObjectCache(METHOD_INITIAL_SIZE);
 
 178         this.interfaceMethodCache = new ObjectCache(INTERFACE_INITIAL_SIZE);
 
 179         this.classCache = new ObjectCache(CLASS_INITIAL_SIZE);
 
 180         this.nameAndTypeCacheForMethods = new MethodNameAndTypeCache(NAMEANDTYPE_INITIAL_SIZE);
 
 181         this.nameAndTypeCacheForFields = new FieldNameAndTypeCache(NAMEANDTYPE_INITIAL_SIZE);   
 
 182         this.poolContent = classFile.header;
 
 183         this.currentOffset = classFile.headerOffset;
 
 184         // currentOffset is initialized to 0 by default
 
 185         this.currentIndex = 1;
 
 186         this.classFile = classFile;
 
 189  * Return the content of the receiver
 
 191 public byte[] dumpBytes() {
 
 192         System.arraycopy(poolContent, 0, (poolContent = new byte[currentOffset]), 0, currentOffset);
 
 196  * Return the index of the @fieldBinding.
 
 198  * Returns -1 if the @fieldBinding is not a predefined fieldBinding, 
 
 199  * the right index otherwise.
 
 201  * @param fieldBinding org.eclipse.jdt.internal.compiler.lookup.FieldBinding
 
 202  * @return <CODE>int</CODE>
 
 204 public int indexOfWellKnownFieldNameAndType(FieldBinding fieldBinding) {
 
 205         if ((fieldBinding.type.id == T_JavaLangClass) && (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE)))
 
 206                 return TYPE_JAVALANGCLASS_NAME_AND_TYPE;
 
 207         if ((fieldBinding.type.id == T_JavaIoPrintStream) && (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.Out)))
 
 208                 return OUT_SYSTEM_NAME_AND_TYPE;
 
 212  * Return the index of the @fieldBinding.
 
 214  * Returns -1 if the @fieldBinding is not a predefined fieldBinding, 
 
 215  * the right index otherwise.
 
 217  * @param fieldBinding org.eclipse.jdt.internal.compiler.lookup.FieldBinding
 
 218  * @return <CODE>int</CODE>
 
 220 public int indexOfWellKnownFields(FieldBinding fieldBinding) {
 
 221         switch (fieldBinding.declaringClass.id) {
 
 222                 case T_JavaLangByte :
 
 223                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
 
 224                                 return TYPE_BYTE_FIELD;
 
 226                 case T_JavaLangShort :
 
 227                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
 
 228                                 return TYPE_SHORT_FIELD;
 
 230                 case T_JavaLangCharacter :
 
 231                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
 
 232                                 return TYPE_CHARACTER_FIELD;
 
 234                 case T_JavaLangInteger :
 
 235                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
 
 236                                 return TYPE_INTEGER_FIELD;
 
 238                 case T_JavaLangLong :
 
 239                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
 
 240                                 return TYPE_LONG_FIELD;
 
 242                 case T_JavaLangFloat :
 
 243                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
 
 244                                 return TYPE_FLOAT_FIELD;
 
 246                 case T_JavaLangDouble :
 
 247                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
 
 248                                 return TYPE_DOUBLE_FIELD;
 
 250                 case T_JavaLangBoolean :
 
 251                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
 
 252                                 return TYPE_BOOLEAN_FIELD;
 
 254                 case T_JavaLangVoid :
 
 255                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
 
 256                                 return TYPE_VOID_FIELD;
 
 258                 case T_JavaLangSystem :
 
 259                         if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.Out))
 
 260                                 return OUT_SYSTEM_FIELD;
 
 265  * Return the index of the @methodBinding.
 
 267  * Returns -1 if the @methodBinding is not a predefined methodBinding, 
 
 268  * the right index otherwise.
 
 270  * @param methodBinding org.eclipse.jdt.internal.compiler.lookup.MethodBinding
 
 271  * @return <CODE>int</CODE>
 
 273 public int indexOfWellKnownMethodNameAndType(MethodBinding methodBinding) {
 
 274         char firstChar = methodBinding.selector[0];
 
 277                         if ((methodBinding.parameters.length == 1) && (methodBinding.parameters[0].id == T_JavaLangString) && (methodBinding.returnType.id == T_JavaLangClass) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ForName))) {
 
 278                                 // This method binding is forName(java.lang.String)
 
 279                                 return FORNAME_CLASS_METHOD_NAME_AND_TYPE;
 
 283                         if (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Init)) {
 
 284                                 switch(methodBinding.parameters.length) {
 
 286                                                 switch(methodBinding.parameters[0].id) {
 
 288                                                                 if (CharOperation.equals(methodBinding.signature(), QualifiedNamesConstants.StringConstructorSignature)) {
 
 289                                                                         return CONSTR_STRING_METHOD_NAME_AND_TYPE;      
 
 294                                                                 if (CharOperation.equals(methodBinding.signature(), QualifiedNamesConstants.AssertionErrorObjectConstrSignature)) {
 
 295                                                                         return CONSTR_OBJECT_METHOD_NAME_AND_TYPE;
 
 300                                                                 if (CharOperation.equals(methodBinding.signature(), QualifiedNamesConstants.AssertionErrorIntConstrSignature)) {
 
 301                                                                         return CONSTR_INT_METHOD_NAME_AND_TYPE;
 
 306                                                                 if (CharOperation.equals(methodBinding.signature(), QualifiedNamesConstants.AssertionErrorCharConstrSignature)) {
 
 307                                                                         return CONSTR_CHAR_METHOD_NAME_AND_TYPE;
 
 312                                                                 if (CharOperation.equals(methodBinding.signature(), QualifiedNamesConstants.AssertionErrorBooleanConstrSignature)) {
 
 313                                                                         return CONSTR_BOOLEAN_METHOD_NAME_AND_TYPE;
 
 318                                                                 if (CharOperation.equals(methodBinding.signature(), QualifiedNamesConstants.AssertionErrorFloatConstrSignature)) {
 
 319                                                                         return CONSTR_FLOAT_METHOD_NAME_AND_TYPE;
 
 324                                                                 if (CharOperation.equals(methodBinding.signature(), QualifiedNamesConstants.AssertionErrorDoubleConstrSignature)) {
 
 325                                                                         return CONSTR_DOUBLE_METHOD_NAME_AND_TYPE;
 
 330                                                                 if (CharOperation.equals(methodBinding.signature(), QualifiedNamesConstants.AssertionErrorLongConstrSignature)) {
 
 331                                                                         return CONSTR_LONG_METHOD_NAME_AND_TYPE;
 
 337                                                 if (methodBinding.signature().length == 3) {
 
 338                                                         return DEFAULT_CONSTR_METHOD_NAME_AND_TYPE;
 
 344                         if ((methodBinding.parameters.length == 1) && (methodBinding.returnType.id == T_JavaLangStringBuffer) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Append))) {
 
 345                                 switch (methodBinding.parameters[0].id) {
 
 349                                                 // This method binding is append(int)
 
 350                                                 return APPEND_INT_METHOD_NAME_AND_TYPE;
 
 352                                                 // This method binding is append(float)
 
 353                                                 return APPEND_FLOAT_METHOD_NAME_AND_TYPE;
 
 355                                                 // This method binding is append(long)
 
 356                                                 return APPEND_LONG_METHOD_NAME_AND_TYPE;
 
 357                                         case T_JavaLangObject :
 
 358                                                 // This method binding is append(java.lang.Object)
 
 359                                                 return APPEND_OBJECT_METHOD_NAME_AND_TYPE;
 
 361                                                 // This method binding is append(char)
 
 362                                                 return APPEND_CHAR_METHOD_NAME_AND_TYPE;
 
 363                                         case T_JavaLangString :
 
 364                                                 // This method binding is append(java.lang.String)
 
 365                                                 return APPEND_STRING_METHOD_NAME_AND_TYPE;
 
 367                                                 // This method binding is append(boolean)
 
 368                                                 return APPEND_BOOLEAN_METHOD_NAME_AND_TYPE;
 
 370                                                 // This method binding is append(double)
 
 371                                                 return APPEND_DOUBLE_METHOD_NAME_AND_TYPE;
 
 376                         if ((methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ToString))) {
 
 377                                 // This method binding is toString()
 
 378                                 return TOSTRING_METHOD_NAME_AND_TYPE;
 
 382                         if ((methodBinding.parameters.length == 1) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ValueOf))) {
 
 383                                 switch(methodBinding.parameters[0].id) {
 
 385                                                 return VALUEOF_OBJECT_METHOD_NAME_AND_TYPE;
 
 389                                                 return VALUEOF_INT_METHOD_NAME_AND_TYPE;
 
 391                                                 return VALUEOF_LONG_METHOD_NAME_AND_TYPE;
 
 393                                                 return VALUEOF_FLOAT_METHOD_NAME_AND_TYPE;
 
 395                                                 return VALUEOF_DOUBLE_METHOD_NAME_AND_TYPE;
 
 397                                                 return VALUEOF_BOOLEAN_METHOD_NAME_AND_TYPE;
 
 399                                                 return VALUEOF_CHAR_METHOD_NAME_AND_TYPE;
 
 404                         if ((methodBinding.parameters.length == 1) && (methodBinding.parameters[0].id == T_int) && (methodBinding.returnType.id == T_void) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Exit))) {
 
 405                                 // This method binding is exit(int)
 
 406                                 return EXIT_METHOD_NAME_AND_TYPE;
 
 410                         if ((methodBinding.selector.length == 10)
 
 411                             && (methodBinding.parameters.length == 0)
 
 412                             && (methodBinding.returnType.id == T_JavaLangString)
 
 413                             && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.GetMessage))) {
 
 414                                 // This method binding is getMessage()
 
 415                                 return GETMESSAGE_METHOD_NAME_AND_TYPE;
 
 417                         if (methodBinding.parameters.length == 0
 
 418                                 && methodBinding.returnType.id == T_JavaLangClass
 
 419                                 && CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.GetClass)) {
 
 420                                         return GETCLASS_OBJECT_METHOD_NAME_AND_TYPE;
 
 424                         if ((methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Intern))) {
 
 425                                 // This method binding is toString()
 
 426                                 return INTERN_METHOD_NAME_AND_TYPE;
 
 432  * Return the index of the @methodBinding.
 
 434  * Returns -1 if the @methodBinding is not a predefined methodBinding, 
 
 435  * the right index otherwise.
 
 437  * @param methodBinding org.eclipse.jdt.internal.compiler.lookup.MethodBinding
 
 438  * @return <CODE>int</CODE>
 
 440 public int indexOfWellKnownMethods(MethodBinding methodBinding) {
 
 441         char firstChar = methodBinding.selector[0];
 
 442         switch (methodBinding.declaringClass.id) {
 
 443                 case T_JavaLangClass :
 
 444                         if ((firstChar == 'f') && (methodBinding.isStatic()) && (methodBinding.parameters.length == 1) && (methodBinding.parameters[0].id == T_JavaLangString) && (methodBinding.returnType.id == T_JavaLangClass) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ForName))) {
 
 445                                 // This method binding is forName(java.lang.String)
 
 446                                 return FORNAME_CLASS_METHOD;
 
 447                         } else if ((firstChar == 'g') && (methodBinding.parameters.length == 1) && (methodBinding.returnType.id == T_JavaLangReflectConstructor) && CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.GetConstructor) && CharOperation.equals(methodBinding.parameters[0].constantPoolName(), QualifiedNamesConstants.ArrayJavaLangClassConstantPoolName)) {
 
 448                                         return GETCONSTRUCTOR_CLASS_METHOD;
 
 449                         } else if ((firstChar == 'd') && (methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_boolean) && CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.DesiredAssertionStatus)) {
 
 450                                         return DESIREDASSERTIONSTATUS_CLASS_METHOD;
 
 453                 case T_JavaLangNoClassDefError :
 
 454                         if ((firstChar == '<') && (methodBinding.parameters.length == 1) && (methodBinding.parameters[0].id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Init))) {
 
 455                                 // This method binding is NoClassDefFoundError(java.lang.String)
 
 456                                 return NOCLASSDEFFOUNDERROR_CONSTR_METHOD;
 
 459                 case T_JavaLangReflectConstructor :
 
 460                         if ((firstChar == 'n') && (methodBinding.parameters.length == 1) && (methodBinding.returnType.id == T_JavaLangObject) && CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.NewInstance) && CharOperation.equals(methodBinding.parameters[0].constantPoolName(), QualifiedNamesConstants.ArrayJavaLangObjectConstantPoolName)) {
 
 461                                 return NEWINSTANCE_CONSTRUCTOR_METHOD;
 
 464                 case T_JavaLangStringBuffer :
 
 465                         if ((firstChar == 'a') && (methodBinding.parameters.length == 1) && (methodBinding.returnType.id == T_JavaLangStringBuffer) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Append))) {
 
 466                                 switch (methodBinding.parameters[0].id) {
 
 470                                                 // This method binding is append(int)
 
 471                                                 return APPEND_INT_METHOD;
 
 473                                                 // This method binding is append(float)
 
 474                                                 return APPEND_FLOAT_METHOD;
 
 476                                                 // This method binding is append(long)
 
 477                                                 return APPEND_LONG_METHOD;
 
 478                                         case T_JavaLangObject :
 
 479                                                 // This method binding is append(java.lang.Object)
 
 480                                                 return APPEND_OBJECT_METHOD;
 
 482                                                 // This method binding is append(char)
 
 483                                                 return APPEND_CHAR_METHOD;
 
 484                                         case T_JavaLangString :
 
 485                                                 // This method binding is append(java.lang.String)
 
 486                                                 return APPEND_STRING_METHOD;
 
 488                                                 // This method binding is append(boolean)
 
 489                                                 return APPEND_BOOLEAN_METHOD;
 
 491                                                 // This method binding is append(double)
 
 492                                                 return APPEND_DOUBLE_METHOD;
 
 495                                 if ((firstChar == 't') && (methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ToString))) {
 
 496                                         // This method binding is toString()
 
 497                                         return STRINGBUFFER_TOSTRING_METHOD;
 
 499                                         if ((firstChar == '<') && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Init))) {
 
 500                                                 if ((methodBinding.parameters.length == 1) && (methodBinding.parameters[0].id == T_JavaLangString)) {
 
 501                                                         // This method binding is <init>(String)                    
 
 502                                                         return STRINGBUFFER_STRING_CONSTR_METHOD;
 
 504                                                         if (methodBinding.parameters.length == 0) {
 
 505                                                                 // This method binding is <init>()
 
 506                                                                 return STRINGBUFFER_DEFAULT_CONSTR_METHOD;
 
 511                 case T_JavaLangString :
 
 512                         if ((firstChar == 'v') && (methodBinding.parameters.length == 1) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ValueOf))) {
 
 513                                 // This method binding is valueOf(java.lang.Object)
 
 514                                 switch (methodBinding.parameters[0].id) {
 
 516                                                 return VALUEOF_OBJECT_METHOD;
 
 520                                                 return VALUEOF_INT_METHOD;
 
 522                                                 return VALUEOF_LONG_METHOD;
 
 524                                                 return VALUEOF_FLOAT_METHOD;
 
 526                                                 return VALUEOF_DOUBLE_METHOD;
 
 528                                                 return VALUEOF_BOOLEAN_METHOD;
 
 530                                                 return VALUEOF_CHAR_METHOD;
 
 533                                 if ((firstChar == 'i') && (methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Intern))) {
 
 534                                         // This method binding is valueOf(java.lang.Object)
 
 535                                         return STRING_INTERN_METHOD;
 
 538                 case T_JavaLangSystem :
 
 539                         if ((firstChar == 'e') && (methodBinding.parameters.length == 1) && (methodBinding.parameters[0].id == T_int) && (methodBinding.returnType.id == T_void) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Exit))) {
 
 540                                 // This method binding is exit(int)
 
 541                                 return SYSTEM_EXIT_METHOD;
 
 544                 case T_JavaLangThrowable :
 
 545                         if ((firstChar == 'g') && (methodBinding.selector.length == 10) && (methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.GetMessage))) {
 
 546                                 // This method binding is getMessage()
 
 547                                 return THROWABLE_GETMESSAGE_METHOD;
 
 550                 case T_JavaLangError :
 
 551                         if ((firstChar == '<') && (methodBinding.parameters.length == 1) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Init)) && (methodBinding.parameters[0].id == T_String)) {
 
 552                                 return JAVALANGERROR_CONSTR_METHOD;
 
 555                 case T_JavaLangAssertionError :
 
 556                         if ((firstChar == '<') && CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Init)) {
 
 557                                 switch (methodBinding.parameters.length) {
 
 559                                                 return ASSERTIONERROR_DEFAULT_CONSTR_METHOD;
 
 561                                                 switch(methodBinding.parameters[0].id) {
 
 563                                                                 return ASSERTIONERROR_CONSTR_BOOLEAN_METHOD;
 
 565                                                                 return ASSERTIONERROR_CONSTR_CHAR_METHOD;
 
 567                                                                 return ASSERTIONERROR_CONSTR_DOUBLE_METHOD;
 
 571                                                                 return ASSERTIONERROR_CONSTR_INT_METHOD;
 
 573                                                                 return ASSERTIONERROR_CONSTR_FLOAT_METHOD;
 
 575                                                                 return ASSERTIONERROR_CONSTR_LONG_METHOD;
 
 577                                                                 return ASSERTIONERROR_CONSTR_OBJECT_METHOD;
 
 582                 case T_JavaLangObject :
 
 583                         if (methodBinding.parameters.length == 0
 
 584                                 && CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.GetClass)) {
 
 585                                         return GETCLASS_OBJECT_METHOD;
 
 591  * Return the index of the @typeBinding
 
 593  * Returns -1 if the @typeBinding is not a predefined binding, the right index 
 
 596  * @param typeBinding org.eclipse.jdt.internal.compiler.lookup.TypeBinding
 
 597  * @return <CODE>int</CODE>
 
 599 public int indexOfWellKnownTypes(TypeBinding typeBinding) {
 
 600         switch(typeBinding.id) {
 
 601                 case T_JavaLangBoolean : return JAVA_LANG_BOOLEAN_TYPE;
 
 602                 case T_JavaLangByte : return JAVA_LANG_BYTE_TYPE;
 
 603                 case T_JavaLangCharacter : return JAVA_LANG_CHARACTER_TYPE;
 
 604                 case T_JavaLangDouble : return JAVA_LANG_DOUBLE_TYPE;
 
 605                 case T_JavaLangFloat : return JAVA_LANG_FLOAT_TYPE;
 
 606                 case T_JavaLangInteger : return JAVA_LANG_INTEGER_TYPE;
 
 607                 case T_JavaLangLong : return JAVA_LANG_LONG_TYPE;
 
 608                 case T_JavaLangShort : return JAVA_LANG_SHORT_TYPE;
 
 609                 case T_JavaLangVoid : return JAVA_LANG_VOID_TYPE;
 
 610                 case T_JavaLangClass : return JAVA_LANG_CLASS_TYPE;
 
 611                 case T_JavaLangClassNotFoundException : return JAVA_LANG_CLASSNOTFOUNDEXCEPTION_TYPE;
 
 612                 case T_JavaLangNoClassDefError : return JAVA_LANG_NOCLASSDEFFOUNDERROR_TYPE;
 
 613                 case T_JavaLangObject : return JAVA_LANG_OBJECT_TYPE;
 
 614                 case T_JavaLangString : return JAVA_LANG_STRING_TYPE;
 
 615                 case T_JavaLangStringBuffer : return JAVA_LANG_STRINGBUFFER_TYPE;
 
 616                 case T_JavaLangSystem : return JAVA_LANG_SYSTEM_TYPE;
 
 617                 case T_JavaLangThrowable : return JAVA_LANG_THROWABLE_TYPE;
 
 618                 case T_JavaLangError : return JAVA_LANG_ERROR_TYPE;
 
 619                 case T_JavaLangException : return JAVA_LANG_EXCEPTION_TYPE;
 
 620                 case T_JavaLangReflectConstructor : return JAVA_LANG_REFLECT_CONSTRUCTOR_TYPE;
 
 621                 case T_JavaLangAssertionError : return JAVA_LANG_ASSERTIONERROR_TYPE;
 
 625 public int literalIndex(byte[] utf8encoding, char[] stringCharArray) {
 
 627         if ((index = UTF8Cache.get(stringCharArray)) < 0) {
 
 628                 // The entry doesn't exit yet
 
 629                 index = UTF8Cache.put(stringCharArray, currentIndex);
 
 631                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 634                 // Write the tag first
 
 636                 // Then the size of the stringName array
 
 637                 //writeU2(utf8Constant.length);
 
 638                 int savedCurrentOffset = currentOffset;
 
 639                 if (currentOffset + 2 >= poolContent.length) {
 
 640                         // we need to resize the poolContent array because we won't have
 
 641                         // enough space to write the length
 
 642                         int length = poolContent.length;
 
 643                         System.arraycopy(poolContent, 0, (poolContent = new byte[length + CONSTANTPOOL_GROW_SIZE]), 0, length);
 
 646                 // add in once the whole byte array
 
 647                 int length = poolContent.length;
 
 648                 int utf8encodingLength = utf8encoding.length;
 
 649                 if (currentOffset + utf8encodingLength >= length) {
 
 650                         System.arraycopy(poolContent, 0, (poolContent = new byte[length + utf8encodingLength + CONSTANTPOOL_GROW_SIZE]), 0, length);
 
 652                 System.arraycopy(utf8encoding, 0, poolContent, currentOffset, utf8encodingLength);
 
 653                 currentOffset += utf8encodingLength;
 
 654                 // Now we know the length that we have to write in the constant pool
 
 655                 // we use savedCurrentOffset to do that
 
 656                 poolContent[savedCurrentOffset] = (byte) (utf8encodingLength >> 8);
 
 657                 poolContent[savedCurrentOffset + 1] = (byte) utf8encodingLength;
 
 662  * This method returns the index into the constantPool corresponding to the type descriptor.
 
 664  * @param char[] stringName
 
 665  * @return <CODE>int</CODE>
 
 667 public int literalIndex(char[] utf8Constant) {
 
 669         if ((index = UTF8Cache.get(utf8Constant)) < 0) {
 
 670                 // The entry doesn't exit yet
 
 671                 // Write the tag first
 
 673                 // Then the size of the stringName array
 
 674                 int savedCurrentOffset = currentOffset;
 
 675                 if (currentOffset + 2 >= poolContent.length) {
 
 676                         // we need to resize the poolContent array because we won't have
 
 677                         // enough space to write the length
 
 678                         int length = poolContent.length;
 
 679                         System.arraycopy(poolContent, 0, (poolContent = new byte[length + CONSTANTPOOL_GROW_SIZE]), 0, length);
 
 683                 for (int i = 0; i < utf8Constant.length; i++) {
 
 684                         char current = utf8Constant[i];
 
 685                         if ((current >= 0x0001) && (current <= 0x007F)) {
 
 686                                 // we only need one byte: ASCII table
 
 690                                 if (current > 0x07FF) {
 
 693                                         writeU1(0xE0 | ((current >> 12) & 0x0F)); // 0xE0 = 1110 0000
 
 694                                         writeU1(0x80 | ((current >> 6) & 0x3F)); // 0x80 = 1000 0000
 
 695                                         writeU1(0x80 | (current & 0x3F)); // 0x80 = 1000 0000
 
 697                                         // we can be 0 or between 0x0080 and 0x07FF
 
 698                                         // In that case we only need 2 bytes
 
 700                                         writeU1(0xC0 | ((current >> 6) & 0x1F)); // 0xC0 = 1100 0000
 
 701                                         writeU1(0x80 | (current & 0x3F)); // 0x80 = 1000 0000
 
 704                 if (length >= 65535) {
 
 705                         currentOffset = savedCurrentOffset - 1;
 
 708                 index = UTF8Cache.put(utf8Constant, currentIndex);
 
 710                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 713                 // Now we know the length that we have to write in the constant pool
 
 714                 // we use savedCurrentOffset to do that
 
 715                 poolContent[savedCurrentOffset] = (byte) (length >> 8);
 
 716                 poolContent[savedCurrentOffset + 1] = (byte) length;
 
 720 public int literalIndex(char[] stringCharArray, byte[] utf8encoding) {
 
 723         if ((index = stringCache.get(stringCharArray)) < 0) {
 
 724                 // The entry doesn't exit yet
 
 725                 stringIndex = literalIndex(utf8encoding, stringCharArray);
 
 726                 index = stringCache.put(stringCharArray, currentIndex++);
 
 728                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 730                 // Write the tag first
 
 732                 // Then the string index
 
 733                 writeU2(stringIndex);
 
 738  * This method returns the index into the constantPool corresponding to the double
 
 739  * value. If the double is not already present into the pool, it is added. The 
 
 740  * double cache is updated and it returns the right index.
 
 742  * @param <CODE>double</CODE> key
 
 743  * @return <CODE>int</CODE>
 
 745 public int literalIndex(double key) {
 
 746         //Retrieve the index from the cache
 
 747         // The double constant takes two indexes into the constant pool, but we only store
 
 748         // the first index into the long table
 
 750         // lazy initialization for base type caches
 
 751         // If it is null, initialize it, otherwise use it
 
 752         if (doubleCache == null) {
 
 753                         doubleCache = new DoubleCache(DOUBLE_INITIAL_SIZE);
 
 755         if ((index = doubleCache.get(key)) < 0) {
 
 756                 index = doubleCache.put(key, currentIndex++);
 
 758                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 760                 currentIndex++; // a double needs an extra place into the constant pool
 
 761                 // Write the double into the constant pool
 
 764                 // Then add the 8 bytes representing the double
 
 765                 long temp = java.lang.Double.doubleToLongBits(key);
 
 766                 for (int i = 0; i < 8; i++) {
 
 768                                 poolContent[currentOffset++] = (byte) (temp >>> (56 - (i << 3)));
 
 769                         } catch (IndexOutOfBoundsException e) { //currentOffset has been ++ already (see the -1)
 
 770                                 int length = poolContent.length;
 
 771                                 System.arraycopy(poolContent, 0, (poolContent = new byte[(length << 1) + CONSTANTPOOL_INITIAL_SIZE]), 0, length);
 
 772                                 poolContent[currentOffset - 1] = (byte) (temp >>> (56 - (i << 3)));
 
 779  * This method returns the index into the constantPool corresponding to the float
 
 780  * value. If the float is not already present into the pool, it is added. The 
 
 781  * int cache is updated and it returns the right index.
 
 783  * @param <CODE>float</CODE> key
 
 784  * @return <CODE>int</CODE>
 
 786 public int literalIndex(float key) {
 
 787         //Retrieve the index from the cache
 
 789         // lazy initialization for base type caches
 
 790         // If it is null, initialize it, otherwise use it
 
 791         if (floatCache == null) {
 
 792                 floatCache = new FloatCache(FLOAT_INITIAL_SIZE);
 
 794         if ((index = floatCache.get(key)) < 0) {
 
 795                 index = floatCache.put(key, currentIndex++);
 
 797                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 799                 // Write the float constant entry into the constant pool
 
 802                 // Then add the 4 bytes representing the float
 
 803                 int temp = java.lang.Float.floatToIntBits(key);
 
 804                 for (int i = 0; i < 4; i++) {
 
 806                                 poolContent[currentOffset++] = (byte) (temp >>> (24 - i * 8));
 
 807                         } catch (IndexOutOfBoundsException e) { //currentOffset has been ++ already (see the -1)
 
 808                                 int length = poolContent.length;
 
 809                                 System.arraycopy(poolContent, 0, (poolContent = new byte[length * 2 + CONSTANTPOOL_INITIAL_SIZE]), 0, length);
 
 810                                 poolContent[currentOffset - 1] = (byte) (temp >>> (24 - i * 8));
 
 817  * This method returns the index into the constantPool corresponding to the int
 
 818  * value. If the int is not already present into the pool, it is added. The 
 
 819  * int cache is updated and it returns the right index.
 
 821  * @param <CODE>int</CODE> key
 
 822  * @return <CODE>int</CODE>
 
 824 public int literalIndex(int key) {
 
 825         //Retrieve the index from the cache
 
 827         // lazy initialization for base type caches
 
 828         // If it is null, initialize it, otherwise use it
 
 829         if (intCache == null) {
 
 830                 intCache = new IntegerCache(INT_INITIAL_SIZE);
 
 832         if ((index = intCache.get(key)) < 0) {
 
 833                 index = intCache.put(key, currentIndex++);
 
 835                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 837                 // Write the integer constant entry into the constant pool
 
 840                 // Then add the 4 bytes representing the int
 
 841                 for (int i = 0; i < 4; i++) {
 
 843                                 poolContent[currentOffset++] = (byte) (key >>> (24 - i * 8));
 
 844                         } catch (IndexOutOfBoundsException e) { //currentOffset has been ++ already (see the -1)
 
 845                                 int length = poolContent.length;
 
 846                                 System.arraycopy(poolContent, 0, (poolContent = new byte[length * 2 + CONSTANTPOOL_INITIAL_SIZE]), 0, length);
 
 847                                 poolContent[currentOffset - 1] = (byte) (key >>> (24 - i * 8));
 
 854  * This method returns the index into the constantPool corresponding to the long
 
 855  * value. If the long is not already present into the pool, it is added. The 
 
 856  * long cache is updated and it returns the right index.
 
 858  * @param <CODE>long</CODE> key
 
 859  * @return <CODE>int</CODE>
 
 861 public int literalIndex(long key) {
 
 862         // Retrieve the index from the cache
 
 863         // The long constant takes two indexes into the constant pool, but we only store
 
 864         // the first index into the long table
 
 866         // lazy initialization for base type caches
 
 867         // If it is null, initialize it, otherwise use it
 
 868         if (longCache == null) {
 
 869                 longCache = new LongCache(LONG_INITIAL_SIZE);
 
 871         if ((index = longCache.get(key)) < 0) {
 
 872                 index = longCache.put(key, currentIndex++);
 
 874                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 876                 currentIndex++; // long value need an extra place into thwe constant pool
 
 877                 // Write the long into the constant pool
 
 880                 // Then add the 8 bytes representing the long
 
 881                 for (int i = 0; i < 8; i++) {
 
 883                                 poolContent[currentOffset++] = (byte) (key >>> (56 - (i << 3)));
 
 884                         } catch (IndexOutOfBoundsException e) { //currentOffset has been ++ already (see the -1)
 
 885                                 int length = poolContent.length;
 
 886                                 System.arraycopy(poolContent, 0, (poolContent = new byte[(length << 1) + CONSTANTPOOL_INITIAL_SIZE]), 0, length);
 
 887                                 poolContent[currentOffset - 1] = (byte) (key >>> (56 - (i << 3)));
 
 894  * This method returns the index into the constantPool corresponding to the type descriptor.
 
 896  * @param stringConstant java.lang.String
 
 897  * @return <CODE>int</CODE>
 
 899 public int literalIndex(String stringConstant) {
 
 901         char[] stringCharArray = stringConstant.toCharArray();
 
 902         if ((index = stringCache.get(stringCharArray)) < 0) {
 
 903                 // The entry doesn't exit yet
 
 904                 int stringIndex = literalIndex(stringCharArray);
 
 905                 index = stringCache.put(stringCharArray, currentIndex++);
 
 907                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 909                 // Write the tag first
 
 911                 // Then the string index
 
 912                 writeU2(stringIndex);
 
 917  * This method returns the index into the constantPool 
 
 918  * corresponding to the field binding aFieldBinding.
 
 920  * @param FieldBinding aFieldBinding
 
 921  * @return <CODE>int</CODE>
 
 923 public int literalIndex(FieldBinding aFieldBinding) {
 
 925         int nameAndTypeIndex;
 
 927         int indexWellKnownField;
 
 928         if ((indexWellKnownField = indexOfWellKnownFields(aFieldBinding)) == -1) {
 
 929                 if ((index = fieldCache.get(aFieldBinding)) < 0) {
 
 930                         // The entry doesn't exit yet
 
 931                         classIndex = literalIndex(aFieldBinding.declaringClass);
 
 932                         nameAndTypeIndex = literalIndexForFields(literalIndex(aFieldBinding.name), literalIndex(aFieldBinding.type.signature()), aFieldBinding);
 
 933                         index = fieldCache.put(aFieldBinding, currentIndex++);
 
 935                                 this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 937                         writeU1(FieldRefTag);
 
 939                         writeU2(nameAndTypeIndex);
 
 942                 if ((index = wellKnownFields[indexWellKnownField]) == 0) {
 
 943                         // that field need to be inserted
 
 944                         classIndex = literalIndex(aFieldBinding.declaringClass);
 
 945                         nameAndTypeIndex = literalIndexForFields(literalIndex(aFieldBinding.name), literalIndex(aFieldBinding.type.signature()), aFieldBinding);
 
 946                         index = wellKnownFields[indexWellKnownField] = currentIndex++;
 
 948                                 this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 950                         writeU1(FieldRefTag);
 
 952                         writeU2(nameAndTypeIndex);
 
 958  * This method returns the index into the constantPool corresponding to the 
 
 959  * method descriptor. It can be either an interface method reference constant
 
 960  * or a method reference constant.
 
 962  * @param MethodBinding aMethodBinding
 
 963  * @return <CODE>int</CODE>
 
 965 public int literalIndex(MethodBinding aMethodBinding) {
 
 967         int nameAndTypeIndex;
 
 969         int indexWellKnownMethod;
 
 970         if ((indexWellKnownMethod = indexOfWellKnownMethods(aMethodBinding)) == -1) {
 
 971                 if (aMethodBinding.declaringClass.isInterface()) {
 
 972                         // Lookinf into the interface method ref table
 
 973                         if ((index = interfaceMethodCache.get(aMethodBinding)) < 0) {
 
 974                                 classIndex = literalIndex(aMethodBinding.declaringClass);
 
 975                                 nameAndTypeIndex = literalIndexForMethods(literalIndex(aMethodBinding.constantPoolName()), literalIndex(aMethodBinding.signature()), aMethodBinding);
 
 976                                 index = interfaceMethodCache.put(aMethodBinding, currentIndex++);
 
 978                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 980                                 // Write the interface method ref constant into the constant pool
 
 982                                 writeU1(InterfaceMethodRefTag);
 
 983                                 // Then write the class index
 
 985                                 // The write the nameAndType index
 
 986                                 writeU2(nameAndTypeIndex);
 
 989                         // Lookinf into the method ref table
 
 990                         if ((index = methodCache.get(aMethodBinding)) < 0) {
 
 991                                 classIndex = literalIndex(aMethodBinding.declaringClass);
 
 992                                 nameAndTypeIndex = literalIndexForMethods(literalIndex(aMethodBinding.constantPoolName()), literalIndex(aMethodBinding.signature()), aMethodBinding);
 
 993                                 index = methodCache.put(aMethodBinding, currentIndex++);
 
 995                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
 997                                 // Write the method ref constant into the constant pool
 
 999                                 writeU1(MethodRefTag);
 
1000                                 // Then write the class index
 
1001                                 writeU2(classIndex);
 
1002                                 // The write the nameAndType index
 
1003                                 writeU2(nameAndTypeIndex);
 
1007                 // This is a well known method
 
1008                 if ((index = wellKnownMethods[indexWellKnownMethod]) == 0) {
 
1009                         // this methods was not inserted yet
 
1010                         if (aMethodBinding.declaringClass.isInterface()) {
 
1011                                 // Lookinf into the interface method ref table
 
1012                                 classIndex = literalIndex(aMethodBinding.declaringClass);
 
1013                                 nameAndTypeIndex = literalIndexForMethods(literalIndex(aMethodBinding.constantPoolName()), literalIndex(aMethodBinding.signature()), aMethodBinding);
 
1014                                 index = wellKnownMethods[indexWellKnownMethod] = currentIndex++;
 
1015                                 if (index > 0xFFFF){
 
1016                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1018                                 // Write the interface method ref constant into the constant pool
 
1019                                 // First add the tag
 
1020                                 writeU1(InterfaceMethodRefTag);
 
1021                                 // Then write the class index
 
1022                                 writeU2(classIndex);
 
1023                                 // The write the nameAndType index
 
1024                                 writeU2(nameAndTypeIndex);
 
1026                                 // Lookinf into the method ref table
 
1027                                 classIndex = literalIndex(aMethodBinding.declaringClass);
 
1028                                 nameAndTypeIndex = literalIndexForMethods(literalIndex(aMethodBinding.constantPoolName()), literalIndex(aMethodBinding.signature()), aMethodBinding);
 
1029                                 index = wellKnownMethods[indexWellKnownMethod] = currentIndex++;
 
1030                                 if (index > 0xFFFF){
 
1031                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1033                                 // Write the method ref constant into the constant pool
 
1034                                 // First add the tag
 
1035                                 writeU1(MethodRefTag);
 
1036                                 // Then write the class index
 
1037                                 writeU2(classIndex);
 
1038                                 // The write the nameAndType index
 
1039                                 writeU2(nameAndTypeIndex);
 
1046  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1048  * @param TypeBinding aTypeBinding
 
1049  * @return <CODE>int</CODE>
 
1051 public int literalIndex(TypeBinding aTypeBinding) {
 
1054         int indexWellKnownType;
 
1055         if ((indexWellKnownType = indexOfWellKnownTypes(aTypeBinding)) == -1) {
 
1056                 if ((index = classCache.get(aTypeBinding)) < 0) {
 
1057                         // The entry doesn't exit yet
 
1058                         nameIndex = literalIndex(aTypeBinding.constantPoolName());
 
1059                         index = classCache.put(aTypeBinding, currentIndex++);
 
1060                         if (index > 0xFFFF){
 
1061                                 this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1064                         // Then add the 8 bytes representing the long
 
1068                 if ((index = wellKnownTypes[indexWellKnownType]) == 0) {
 
1069                         // Need to insert that binding
 
1070                         nameIndex = literalIndex(aTypeBinding.constantPoolName());
 
1071                         index = wellKnownTypes[indexWellKnownType] = currentIndex++;
 
1072                         if (index > 0xFFFF){
 
1073                                 this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1076                         // Then add the 8 bytes representing the long
 
1083  * This method returns the index into the constantPool corresponding 
 
1084  * nameAndType constant with nameIndex, typeIndex.
 
1086  * @param int nameIndex
 
1087  * @param int nameIndex
 
1088  * @param org.eclipse.jdt.internal.compiler.lookup.FieldBinding a FieldBinding
 
1089  * @return <CODE>int</CODE>
 
1091 public int literalIndexForFields(int nameIndex, int typeIndex, FieldBinding key) {
 
1093         int indexOfWellKnownFieldNameAndType;
 
1094         if ((indexOfWellKnownFieldNameAndType = indexOfWellKnownFieldNameAndType(key)) == -1) {
 
1095                 // check if the entry already exists
 
1096                 if ((index = nameAndTypeCacheForFields.get(key)) == -1) {
 
1097                         // The entry doesn't exit yet
 
1098                         index = nameAndTypeCacheForFields.put(key, currentIndex++);
 
1099                         if (index > 0xFFFF){
 
1100                                 this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1102                         writeU1(NameAndTypeTag);
 
1107                 if ((index = wellKnownFieldNameAndTypes[indexOfWellKnownFieldNameAndType]) == 0) {
 
1108                         index = wellKnownFieldNameAndTypes[indexOfWellKnownFieldNameAndType] = currentIndex++;
 
1109                         if (index > 0xFFFF){
 
1110                                 this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1112                         writeU1(NameAndTypeTag);
 
1120  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1122  * @param TypeBinding aTypeBinding
 
1123  * @return <CODE>int</CODE>
 
1125 public int literalIndexForJavaLangBoolean() {
 
1127         if ((index = wellKnownTypes[JAVA_LANG_BOOLEAN_TYPE]) == 0) {
 
1129                 // The entry doesn't exit yet
 
1130                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangBooleanConstantPoolName);
 
1131                 index = wellKnownTypes[JAVA_LANG_BOOLEAN_TYPE] = currentIndex++;
 
1132                 if (index > 0xFFFF){
 
1133                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1136                 // Then add the 8 bytes representing the long
 
1142  * This method returns the index into the constantPool 
 
1143  * corresponding to the field binding aFieldBinding.
 
1145  * @return <CODE>int</CODE>
 
1147 public int literalIndexForJavaLangBooleanTYPE() {
 
1149         if ((index = wellKnownFields[TYPE_BOOLEAN_FIELD]) == 0) {
 
1150                 int nameAndTypeIndex;
 
1152                 // The entry doesn't exit yet
 
1153                 classIndex = literalIndexForJavaLangBoolean();
 
1154                 if ((nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE]) == 0) {
 
1155                         int nameIndex = literalIndex(QualifiedNamesConstants.TYPE);
 
1156                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaLangClassSignature);
 
1157                         nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE] = currentIndex++;
 
1158                         writeU1(NameAndTypeTag);
 
1162                 index = wellKnownFields[TYPE_BOOLEAN_FIELD] = currentIndex++;
 
1163                 if (index > 0xFFFF){
 
1164                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1166                 writeU1(FieldRefTag);
 
1167                 writeU2(classIndex);
 
1168                 writeU2(nameAndTypeIndex);
 
1173  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1175  * @param TypeBinding aTypeBinding
 
1176  * @return <CODE>int</CODE>
 
1178 public int literalIndexForJavaLangByte() {
 
1180         if ((index = wellKnownTypes[JAVA_LANG_BYTE_TYPE]) == 0) {
 
1182                 // The entry doesn't exit yet
 
1183                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangByteConstantPoolName);
 
1184                 index = wellKnownTypes[JAVA_LANG_BYTE_TYPE] = currentIndex++;
 
1185                 if (index > 0xFFFF){
 
1186                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1189                 // Then add the 8 bytes representing the long
 
1195  * This method returns the index into the constantPool 
 
1196  * corresponding to the field binding aFieldBinding.
 
1198  * @return <CODE>int</CODE>
 
1200 public int literalIndexForJavaLangByteTYPE() {
 
1202         if ((index = wellKnownFields[TYPE_BYTE_FIELD]) == 0) {
 
1203                 int nameAndTypeIndex;
 
1205                 // The entry doesn't exit yet
 
1206                 classIndex = literalIndexForJavaLangByte();
 
1207                 if ((nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE]) == 0) {
 
1208                         int nameIndex = literalIndex(QualifiedNamesConstants.TYPE);
 
1209                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaLangClassSignature);
 
1210                         nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE] = currentIndex++;
 
1211                         writeU1(NameAndTypeTag);
 
1215                 index = wellKnownFields[TYPE_BYTE_FIELD] = currentIndex++;
 
1216                 if (index > 0xFFFF){
 
1217                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1219                 writeU1(FieldRefTag);
 
1220                 writeU2(classIndex);
 
1221                 writeU2(nameAndTypeIndex);
 
1226  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1228  * @param TypeBinding aTypeBinding
 
1229  * @return <CODE>int</CODE>
 
1231 public int literalIndexForJavaLangCharacter() {
 
1233         if ((index = wellKnownTypes[JAVA_LANG_CHARACTER_TYPE]) == 0) {
 
1235                 // The entry doesn't exit yet
 
1236                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangCharacterConstantPoolName);
 
1237                 index = wellKnownTypes[JAVA_LANG_CHARACTER_TYPE] = currentIndex++;
 
1238                 if (index > 0xFFFF){
 
1239                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1242                 // Then add the 8 bytes representing the long
 
1248  * This method returns the index into the constantPool 
 
1249  * corresponding to the field binding aFieldBinding.
 
1251  * @return <CODE>int</CODE>
 
1253 public int literalIndexForJavaLangCharacterTYPE() {
 
1255         if ((index = wellKnownFields[TYPE_CHARACTER_FIELD]) == 0) {
 
1256                 int nameAndTypeIndex;
 
1258                 // The entry doesn't exit yet
 
1259                 classIndex = literalIndexForJavaLangCharacter();
 
1260                 if ((nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE]) == 0) {
 
1261                         int nameIndex = literalIndex(QualifiedNamesConstants.TYPE);
 
1262                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaLangClassSignature);
 
1263                         nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE] = currentIndex++;
 
1264                         writeU1(NameAndTypeTag);
 
1268                 index = wellKnownFields[TYPE_CHARACTER_FIELD] = currentIndex++;
 
1269                 if (index > 0xFFFF){
 
1270                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1272                 writeU1(FieldRefTag);
 
1273                 writeU2(classIndex);
 
1274                 writeU2(nameAndTypeIndex);
 
1279  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1281  * @param TypeBinding aTypeBinding
 
1282  * @return <CODE>int</CODE>
 
1284 public int literalIndexForJavaLangClass() {
 
1286         if ((index = wellKnownTypes[JAVA_LANG_CLASS_TYPE]) == 0) {
 
1288                 // The entry doesn't exit yet
 
1289                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangClassConstantPoolName);
 
1290                 index = wellKnownTypes[JAVA_LANG_CLASS_TYPE] = currentIndex++;
 
1291                 if (index > 0xFFFF){
 
1292                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1295                 // Then add the 8 bytes representing the long
 
1301  * This method returns the index into the constantPool corresponding to the 
 
1302  * method descriptor. It can be either an interface method reference constant
 
1303  * or a method reference constant.
 
1305  * @return <CODE>int</CODE>
 
1307 public int literalIndexForJavaLangClassForName() {
 
1309         int nameAndTypeIndex;
 
1311         // Looking into the method ref table
 
1312         if ((index = wellKnownMethods[FORNAME_CLASS_METHOD]) == 0) {
 
1313                 classIndex = literalIndexForJavaLangClass();
 
1314                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[FORNAME_CLASS_METHOD_NAME_AND_TYPE]) == 0) {
 
1315                         int nameIndex = literalIndex(QualifiedNamesConstants.ForName);
 
1316                         int typeIndex = literalIndex(QualifiedNamesConstants.ForNameSignature);
 
1317                         nameAndTypeIndex = wellKnownMethodNameAndTypes[FORNAME_CLASS_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1318                         writeU1(NameAndTypeTag);
 
1322                 index = wellKnownMethods[FORNAME_CLASS_METHOD] = currentIndex++;
 
1323                 if (index > 0xFFFF){
 
1324                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1326                 // Write the method ref constant into the constant pool
 
1327                 // First add the tag
 
1328                 writeU1(MethodRefTag);
 
1329                 // Then write the class index
 
1330                 writeU2(classIndex);
 
1331                 // The write the nameAndType index
 
1332                 writeU2(nameAndTypeIndex);
 
1337  * This method returns the index into the constantPool corresponding to the 
 
1338  * method descriptor. It can be either an interface method reference constant
 
1339  * or a method reference constant.
 
1341  * @return <CODE>int</CODE>
 
1343 public int literalIndexForJavaLangClassGetConstructor() {
 
1345         int nameAndTypeIndex;
 
1347         // Looking into the method ref table
 
1348         if ((index = wellKnownMethods[GETCONSTRUCTOR_CLASS_METHOD]) == 0) {
 
1349                 classIndex = literalIndexForJavaLangClass();
 
1350                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[GETCONSTRUCTOR_METHOD_NAME_AND_TYPE]) == 0) {
 
1351                         int nameIndex = literalIndex(QualifiedNamesConstants.GetConstructor);
 
1352                         int typeIndex = literalIndex(QualifiedNamesConstants.GetConstructorSignature);
 
1353                         nameAndTypeIndex = wellKnownMethodNameAndTypes[GETCONSTRUCTOR_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1354                         writeU1(NameAndTypeTag);
 
1358                 index = wellKnownMethods[GETCONSTRUCTOR_CLASS_METHOD] = currentIndex++;
 
1359                 if (index > 0xFFFF){
 
1360                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1362                 // Write the method ref constant into the constant pool
 
1363                 // First add the tag
 
1364                 writeU1(MethodRefTag);
 
1365                 // Then write the class index
 
1366                 writeU2(classIndex);
 
1367                 // The write the nameAndType index
 
1368                 writeU2(nameAndTypeIndex);
 
1373  * This method returns the index into the constantPool corresponding to the 
 
1374  * method descriptor. It can be either an interface method reference constant
 
1375  * or a method reference constant.
 
1377  * @return <CODE>int</CODE>
 
1379 public int literalIndexForJavaLangClassDesiredAssertionStatus() {
 
1381         int nameAndTypeIndex;
 
1383         // Looking into the method ref table
 
1384         if ((index = wellKnownMethods[DESIREDASSERTIONSTATUS_CLASS_METHOD]) == 0) {
 
1385                 classIndex = literalIndexForJavaLangClass();
 
1386                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[DESIREDASSERTIONSTATUS_METHOD_NAME_AND_TYPE]) == 0) {
 
1387                         int nameIndex = literalIndex(QualifiedNamesConstants.DesiredAssertionStatus);
 
1388                         int typeIndex = literalIndex(QualifiedNamesConstants.DesiredAssertionStatusSignature);
 
1389                         nameAndTypeIndex = wellKnownMethodNameAndTypes[DESIREDASSERTIONSTATUS_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1390                         writeU1(NameAndTypeTag);
 
1394                 index = wellKnownMethods[DESIREDASSERTIONSTATUS_CLASS_METHOD] = currentIndex++;
 
1395                 if (index > 0xFFFF){
 
1396                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1398                 // Write the method ref constant into the constant pool
 
1399                 // First add the tag
 
1400                 writeU1(MethodRefTag);
 
1401                 // Then write the class index
 
1402                 writeU2(classIndex);
 
1403                 // The write the nameAndType index
 
1404                 writeU2(nameAndTypeIndex);
 
1409  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1411  * @param TypeBinding aTypeBinding
 
1412  * @return <CODE>int</CODE>
 
1414 public int literalIndexForJavaLangClassNotFoundException() {
 
1416         if ((index = wellKnownTypes[JAVA_LANG_CLASSNOTFOUNDEXCEPTION_TYPE]) == 0) {
 
1418                 // The entry doesn't exit yet
 
1419                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangClassNotFoundExceptionConstantPoolName);
 
1420                 index = wellKnownTypes[JAVA_LANG_CLASSNOTFOUNDEXCEPTION_TYPE] = currentIndex++;
 
1421                 if (index > 0xFFFF){
 
1422                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1425                 // Then add the 8 bytes representing the long
 
1431  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1433  * @param TypeBinding aTypeBinding
 
1434  * @return <CODE>int</CODE>
 
1436 public int literalIndexForJavaLangDouble() {
 
1438         if ((index = wellKnownTypes[JAVA_LANG_DOUBLE_TYPE]) == 0) {
 
1440                 // The entry doesn't exit yet
 
1441                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangDoubleConstantPoolName);
 
1442                 index = wellKnownTypes[JAVA_LANG_DOUBLE_TYPE] = currentIndex++;
 
1443                 if (index > 0xFFFF){
 
1444                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1447                 // Then add the 8 bytes representing the long
 
1453  * This method returns the index into the constantPool 
 
1454  * corresponding to the field binding aFieldBinding.
 
1456  * @return <CODE>int</CODE>
 
1458 public int literalIndexForJavaLangDoubleTYPE() {
 
1460         if ((index = wellKnownFields[TYPE_DOUBLE_FIELD]) == 0) {
 
1461                 int nameAndTypeIndex;
 
1463                 // The entry doesn't exit yet
 
1464                 classIndex = literalIndexForJavaLangDouble();
 
1465                 if ((nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE]) == 0) {
 
1466                         int nameIndex = literalIndex(QualifiedNamesConstants.TYPE);
 
1467                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaLangClassSignature);
 
1468                         nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE] = currentIndex++;
 
1469                         writeU1(NameAndTypeTag);
 
1473                 index = wellKnownFields[TYPE_DOUBLE_FIELD] = currentIndex++;
 
1474                 if (index > 0xFFFF){
 
1475                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1477                 writeU1(FieldRefTag);
 
1478                 writeU2(classIndex);
 
1479                 writeU2(nameAndTypeIndex);
 
1484  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1486  * @param TypeBinding aTypeBinding
 
1487  * @return <CODE>int</CODE>
 
1489 public int literalIndexForJavaLangError() {
 
1491         if ((index = wellKnownTypes[JAVA_LANG_ERROR_TYPE]) == 0) {
 
1493                 // The entry doesn't exit yet
 
1494                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangErrorConstantPoolName);
 
1495                 index = wellKnownTypes[JAVA_LANG_ERROR_TYPE] = currentIndex++;
 
1496                 if (index > 0xFFFF){
 
1497                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1500                 // Then add the 8 bytes representing the long
 
1506  * This method returns the index into the constantPool corresponding to the 
 
1507  * method descriptor. It can be either an interface method reference constant
 
1508  * or a method reference constant.
 
1510  * @return <CODE>int</CODE>
 
1512 public int literalIndexForJavaLangErrorConstructor() {
 
1514         int nameAndTypeIndex;
 
1516         // Looking into the method ref table
 
1517         if ((index = wellKnownMethods[JAVALANGERROR_CONSTR_METHOD]) == 0) {
 
1518                 classIndex = literalIndexForJavaLangError();
 
1519                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_STRING_METHOD_NAME_AND_TYPE]) == 0) {
 
1520                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
1521                         int typeIndex = literalIndex(QualifiedNamesConstants.StringConstructorSignature);
 
1522                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_STRING_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1523                         writeU1(NameAndTypeTag);
 
1527                 index = wellKnownMethods[JAVALANGERROR_CONSTR_METHOD] = currentIndex++;
 
1528                 if (index > 0xFFFF){
 
1529                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1531                 // Write the method ref constant into the constant pool
 
1532                 // First add the tag
 
1533                 writeU1(MethodRefTag);
 
1534                 // Then write the class index
 
1535                 writeU2(classIndex);
 
1536                 // The write the nameAndType index
 
1537                 writeU2(nameAndTypeIndex);
 
1541 public int literalIndexForJavaLangException() {
 
1543         if ((index = wellKnownTypes[JAVA_LANG_EXCEPTION_TYPE]) == 0) {
 
1544                 // The entry doesn't exit yet
 
1545                 int nameIndex = literalIndex(QualifiedNamesConstants.JavaLangExceptionConstantPoolName);
 
1546                 index = wellKnownTypes[JAVA_LANG_EXCEPTION_TYPE] = currentIndex++;
 
1547                 if (index > 0xFFFF){
 
1548                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1551                 // Then add the 8 bytes representing the long
 
1557  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1559  * @param TypeBinding aTypeBinding
 
1560  * @return <CODE>int</CODE>
 
1562 public int literalIndexForJavaLangFloat() {
 
1564         if ((index = wellKnownTypes[JAVA_LANG_FLOAT_TYPE]) == 0) {
 
1566                 // The entry doesn't exit yet
 
1567                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangFloatConstantPoolName);
 
1568                 index = wellKnownTypes[JAVA_LANG_FLOAT_TYPE] = currentIndex++;
 
1569                 if (index > 0xFFFF){
 
1570                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1573                 // Then add the 8 bytes representing the long
 
1579  * This method returns the index into the constantPool 
 
1580  * corresponding to the field binding aFieldBinding.
 
1582  * @return <CODE>int</CODE>
 
1584 public int literalIndexForJavaLangFloatTYPE() {
 
1586         if ((index = wellKnownFields[TYPE_FLOAT_FIELD]) == 0) {
 
1587                 int nameAndTypeIndex;
 
1589                 // The entry doesn't exit yet
 
1590                 classIndex = literalIndexForJavaLangFloat();
 
1591                 if ((nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE]) == 0) {
 
1592                         int nameIndex = literalIndex(QualifiedNamesConstants.TYPE);
 
1593                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaLangClassSignature);
 
1594                         nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE] = currentIndex++;
 
1595                         writeU1(NameAndTypeTag);
 
1599                 index = wellKnownFields[TYPE_FLOAT_FIELD] = currentIndex++;
 
1600                 if (index > 0xFFFF){
 
1601                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1603                 writeU1(FieldRefTag);
 
1604                 writeU2(classIndex);
 
1605                 writeU2(nameAndTypeIndex);
 
1610  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1612  * @param TypeBinding aTypeBinding
 
1613  * @return <CODE>int</CODE>
 
1615 public int literalIndexForJavaLangInteger() {
 
1617         if ((index = wellKnownTypes[JAVA_LANG_INTEGER_TYPE]) == 0) {
 
1619                 // The entry doesn't exit yet
 
1620                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangIntegerConstantPoolName);
 
1621                 index = wellKnownTypes[JAVA_LANG_INTEGER_TYPE] = currentIndex++;
 
1622                 if (index > 0xFFFF){
 
1623                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1626                 // Then add the 8 bytes representing the long
 
1632  * This method returns the index into the constantPool 
 
1633  * corresponding to the field binding aFieldBinding.
 
1635  * @return <CODE>int</CODE>
 
1637 public int literalIndexForJavaLangIntegerTYPE() {
 
1639         if ((index = wellKnownFields[TYPE_INTEGER_FIELD]) == 0) {
 
1640                 int nameAndTypeIndex;
 
1642                 // The entry doesn't exit yet
 
1643                 classIndex = literalIndexForJavaLangInteger();
 
1644                 if ((nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE]) == 0) {
 
1645                         int nameIndex = literalIndex(QualifiedNamesConstants.TYPE);
 
1646                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaLangClassSignature);
 
1647                         nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE] = currentIndex++;
 
1648                         writeU1(NameAndTypeTag);
 
1652                 index = wellKnownFields[TYPE_INTEGER_FIELD] = currentIndex++;
 
1653                 if (index > 0xFFFF){
 
1654                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1656                 writeU1(FieldRefTag);
 
1657                 writeU2(classIndex);
 
1658                 writeU2(nameAndTypeIndex);
 
1663  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1665  * @param TypeBinding aTypeBinding
 
1666  * @return <CODE>int</CODE>
 
1668 public int literalIndexForJavaLangLong() {
 
1670         if ((index = wellKnownTypes[JAVA_LANG_LONG_TYPE]) == 0) {
 
1672                 // The entry doesn't exit yet
 
1673                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangLongConstantPoolName);
 
1674                 index = wellKnownTypes[JAVA_LANG_LONG_TYPE] = currentIndex++;
 
1675                 if (index > 0xFFFF){
 
1676                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1679                 // Then add the 8 bytes representing the long
 
1685  * This method returns the index into the constantPool 
 
1686  * corresponding to the field binding aFieldBinding.
 
1688  * @return <CODE>int</CODE>
 
1690 public int literalIndexForJavaLangLongTYPE() {
 
1692         if ((index = wellKnownFields[TYPE_LONG_FIELD]) == 0) {
 
1693                 int nameAndTypeIndex;
 
1695                 // The entry doesn't exit yet
 
1696                 classIndex = literalIndexForJavaLangLong();
 
1697                 if ((nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE]) == 0) {
 
1698                         int nameIndex = literalIndex(QualifiedNamesConstants.TYPE);
 
1699                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaLangClassSignature);
 
1700                         nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE] = currentIndex++;
 
1701                         writeU1(NameAndTypeTag);
 
1705                 index = wellKnownFields[TYPE_LONG_FIELD] = currentIndex++;
 
1706                 if (index > 0xFFFF){
 
1707                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1709                 writeU1(FieldRefTag);
 
1710                 writeU2(classIndex);
 
1711                 writeU2(nameAndTypeIndex);
 
1716  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1718  * @param TypeBinding aTypeBinding
 
1719  * @return <CODE>int</CODE>
 
1721 public int literalIndexForJavaLangNoClassDefFoundError() {
 
1723         if ((index = wellKnownTypes[JAVA_LANG_NOCLASSDEFFOUNDERROR_TYPE]) == 0) {
 
1725                 // The entry doesn't exit yet
 
1726                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangNoClassDefFoundErrorConstantPoolName);
 
1727                 index = wellKnownTypes[JAVA_LANG_NOCLASSDEFFOUNDERROR_TYPE] = currentIndex++;
 
1728                 if (index > 0xFFFF){
 
1729                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1732                 // Then add the 8 bytes representing the long
 
1739  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1741  * @param TypeBinding aTypeBinding
 
1742  * @return <CODE>int</CODE>
 
1744 public int literalIndexForJavaLangAssertionError() {
 
1746         if ((index = wellKnownTypes[JAVA_LANG_ASSERTIONERROR_TYPE]) == 0) {
 
1748                 // The entry doesn't exit yet
 
1749                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangAssertionErrorConstantPoolName);
 
1750                 index = wellKnownTypes[JAVA_LANG_ASSERTIONERROR_TYPE] = currentIndex++;
 
1751                 if (index > 0xFFFF){
 
1752                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1755                 // Then add the 8 bytes representing the long
 
1762  * This method returns the index into the constantPool corresponding to the type descriptor.
 
1764  * @param TypeBinding aTypeBinding
 
1765  * @return <CODE>int</CODE>
 
1767 public int literalIndexForJavaLangAssertionErrorConstructor(int typeBindingID) {
 
1769         int nameAndTypeIndex = 0;
 
1771         switch (typeBindingID) {
 
1775                         if ((index = wellKnownMethods[ASSERTIONERROR_CONSTR_INT_METHOD]) == 0) {
 
1776                                 classIndex = literalIndexForJavaLangAssertionError();
 
1777                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_INT_METHOD_NAME_AND_TYPE]) == 0) {
 
1778                                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
1779                                         int typeIndex = literalIndex(QualifiedNamesConstants.AssertionErrorIntConstrSignature);
 
1780                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_INT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1781                                         writeU1(NameAndTypeTag);
 
1785                                 index = wellKnownMethods[ASSERTIONERROR_CONSTR_INT_METHOD] = currentIndex++;
 
1786                                 if (index > 0xFFFF){
 
1787                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1789                                 // Write the method ref constant into the constant pool
 
1790                                 // First add the tag
 
1791                                 writeU1(MethodRefTag);
 
1792                                 // Then write the class index
 
1793                                 writeU2(classIndex);
 
1794                                 // The write the nameAndType index
 
1795                                 writeU2(nameAndTypeIndex);
 
1799                         if ((index = wellKnownMethods[ASSERTIONERROR_CONSTR_LONG_METHOD]) == 0) {
 
1800                                 classIndex = literalIndexForJavaLangAssertionError();
 
1801                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_LONG_METHOD_NAME_AND_TYPE]) == 0) {
 
1802                                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
1803                                         int typeIndex = literalIndex(QualifiedNamesConstants.AssertionErrorLongConstrSignature);
 
1804                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_LONG_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1805                                         writeU1(NameAndTypeTag);
 
1809                                 index = wellKnownMethods[ASSERTIONERROR_CONSTR_LONG_METHOD] = currentIndex++;
 
1810                                 if (index > 0xFFFF){
 
1811                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1813                                 // Write the method ref constant into the constant pool
 
1814                                 // First add the tag
 
1815                                 writeU1(MethodRefTag);
 
1816                                 // Then write the class index
 
1817                                 writeU2(classIndex);
 
1818                                 // The write the nameAndType index
 
1819                                 writeU2(nameAndTypeIndex);
 
1823                         if ((index = wellKnownMethods[ASSERTIONERROR_CONSTR_FLOAT_METHOD]) == 0) {
 
1824                                 classIndex = literalIndexForJavaLangAssertionError();
 
1825                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_FLOAT_METHOD_NAME_AND_TYPE]) == 0) {
 
1826                                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
1827                                         int typeIndex = literalIndex(QualifiedNamesConstants.AssertionErrorFloatConstrSignature);
 
1828                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_FLOAT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1829                                         writeU1(NameAndTypeTag);
 
1833                                 index = wellKnownMethods[ASSERTIONERROR_CONSTR_FLOAT_METHOD] = currentIndex++;
 
1834                                 if (index > 0xFFFF){
 
1835                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1837                                 // Write the method ref constant into the constant pool
 
1838                                 // First add the tag
 
1839                                 writeU1(MethodRefTag);
 
1840                                 // Then write the class index
 
1841                                 writeU2(classIndex);
 
1842                                 // The write the nameAndType index
 
1843                                 writeU2(nameAndTypeIndex);
 
1847                         if ((index = wellKnownMethods[ASSERTIONERROR_CONSTR_DOUBLE_METHOD]) == 0) {
 
1848                                 classIndex = literalIndexForJavaLangAssertionError();
 
1849                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_DOUBLE_METHOD_NAME_AND_TYPE]) == 0) {
 
1850                                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
1851                                         int typeIndex = literalIndex(QualifiedNamesConstants.AssertionErrorDoubleConstrSignature);
 
1852                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_DOUBLE_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1853                                         writeU1(NameAndTypeTag);
 
1857                                 index = wellKnownMethods[ASSERTIONERROR_CONSTR_DOUBLE_METHOD] = currentIndex++;
 
1858                                 if (index > 0xFFFF){
 
1859                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1861                                 // Write the method ref constant into the constant pool
 
1862                                 // First add the tag
 
1863                                 writeU1(MethodRefTag);
 
1864                                 // Then write the class index
 
1865                                 writeU2(classIndex);
 
1866                                 // The write the nameAndType index
 
1867                                 writeU2(nameAndTypeIndex);
 
1871                         if ((index = wellKnownMethods[ASSERTIONERROR_CONSTR_CHAR_METHOD]) == 0) {
 
1872                                 classIndex = literalIndexForJavaLangAssertionError();
 
1873                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_CHAR_METHOD_NAME_AND_TYPE]) == 0) {
 
1874                                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
1875                                         int typeIndex = literalIndex(QualifiedNamesConstants.AssertionErrorCharConstrSignature);
 
1876                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_CHAR_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1877                                         writeU1(NameAndTypeTag);
 
1881                                 index = wellKnownMethods[ASSERTIONERROR_CONSTR_CHAR_METHOD] = currentIndex++;
 
1882                                 if (index > 0xFFFF){
 
1883                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1885                                 // Write the method ref constant into the constant pool
 
1886                                 // First add the tag
 
1887                                 writeU1(MethodRefTag);
 
1888                                 // Then write the class index
 
1889                                 writeU2(classIndex);
 
1890                                 // The write the nameAndType index
 
1891                                 writeU2(nameAndTypeIndex);
 
1895                         if ((index = wellKnownMethods[ASSERTIONERROR_CONSTR_BOOLEAN_METHOD]) == 0) {
 
1896                                 classIndex = literalIndexForJavaLangAssertionError();
 
1897                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_BOOLEAN_METHOD_NAME_AND_TYPE]) == 0) {
 
1898                                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
1899                                         int typeIndex = literalIndex(QualifiedNamesConstants.AssertionErrorBooleanConstrSignature);
 
1900                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_BOOLEAN_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1901                                         writeU1(NameAndTypeTag);
 
1905                                 index = wellKnownMethods[ASSERTIONERROR_CONSTR_BOOLEAN_METHOD] = currentIndex++;
 
1906                                 if (index > 0xFFFF){
 
1907                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1909                                 // Write the method ref constant into the constant pool
 
1910                                 // First add the tag
 
1911                                 writeU1(MethodRefTag);
 
1912                                 // Then write the class index
 
1913                                 writeU2(classIndex);
 
1914                                 // The write the nameAndType index
 
1915                                 writeU2(nameAndTypeIndex);
 
1922                         if ((index = wellKnownMethods[ASSERTIONERROR_CONSTR_OBJECT_METHOD]) == 0) {
 
1923                                 classIndex = literalIndexForJavaLangAssertionError();
 
1924                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_OBJECT_METHOD_NAME_AND_TYPE]) == 0) {
 
1925                                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
1926                                         int typeIndex = literalIndex(QualifiedNamesConstants.AssertionErrorObjectConstrSignature);
 
1927                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_OBJECT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1928                                         writeU1(NameAndTypeTag);
 
1932                                 index = wellKnownMethods[ASSERTIONERROR_CONSTR_OBJECT_METHOD] = currentIndex++;
 
1933                                 if (index > 0xFFFF){
 
1934                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1936                                 // Write the method ref constant into the constant pool
 
1937                                 // First add the tag
 
1938                                 writeU1(MethodRefTag);
 
1939                                 // Then write the class index
 
1940                                 writeU2(classIndex);
 
1941                                 // The write the nameAndType index
 
1942                                 writeU2(nameAndTypeIndex);
 
1949  * This method returns the index into the constantPool corresponding to the 
 
1950  * method descriptor. It can be either an interface method reference constant
 
1951  * or a method reference constant.
 
1953  * @return <CODE>int</CODE>
 
1955 public int literalIndexForJavaLangAssertionErrorDefaultConstructor() {
 
1957         int nameAndTypeIndex;
 
1959         // Looking into the method ref table
 
1960         if ((index = wellKnownMethods[ASSERTIONERROR_DEFAULT_CONSTR_METHOD]) == 0) {
 
1961                 classIndex = literalIndexForJavaLangAssertionError();
 
1962                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[DEFAULT_CONSTR_METHOD_NAME_AND_TYPE]) == 0) {
 
1963                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
1964                         int typeIndex = literalIndex(QualifiedNamesConstants.DefaultConstructorSignature);
 
1965                         nameAndTypeIndex = wellKnownMethodNameAndTypes[DEFAULT_CONSTR_METHOD_NAME_AND_TYPE] = currentIndex++;
 
1966                         writeU1(NameAndTypeTag);
 
1970                 index = wellKnownMethods[ASSERTIONERROR_DEFAULT_CONSTR_METHOD] = currentIndex++;
 
1971                 if (index > 0xFFFF){
 
1972                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
1974                 // Write the method ref constant into the constant pool
 
1975                 // First add the tag
 
1976                 writeU1(MethodRefTag);
 
1977                 // Then write the class index
 
1978                 writeU2(classIndex);
 
1979                 // The write the nameAndType index
 
1980                 writeU2(nameAndTypeIndex);
 
1987  * This method returns the index into the constantPool corresponding to the 
 
1988  * method descriptor. It can be either an interface method reference constant
 
1989  * or a method reference constant.
 
1991  * @return <CODE>int</CODE>
 
1993 public int literalIndexForJavaLangNoClassDefFoundErrorStringConstructor() {
 
1995         int nameAndTypeIndex;
 
1997         // Looking into the method ref table
 
1998         if ((index = wellKnownMethods[NOCLASSDEFFOUNDERROR_CONSTR_METHOD]) == 0) {
 
1999                 classIndex = literalIndexForJavaLangNoClassDefFoundError();
 
2000                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_STRING_METHOD_NAME_AND_TYPE]) == 0) {
 
2001                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
2002                         int typeIndex = literalIndex(QualifiedNamesConstants.StringConstructorSignature);
 
2003                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_STRING_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2004                         writeU1(NameAndTypeTag);
 
2008                 index = wellKnownMethods[NOCLASSDEFFOUNDERROR_CONSTR_METHOD] = currentIndex++;
 
2009                 if (index > 0xFFFF){
 
2010                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2012                 // Write the method ref constant into the constant pool
 
2013                 // First add the tag
 
2014                 writeU1(MethodRefTag);
 
2015                 // Then write the class index
 
2016                 writeU2(classIndex);
 
2017                 // The write the nameAndType index
 
2018                 writeU2(nameAndTypeIndex);
 
2023  * This method returns the index into the constantPool corresponding to the type descriptor.
 
2025  * @param TypeBinding aTypeBinding
 
2026  * @return <CODE>int</CODE>
 
2028 public int literalIndexForJavaLangObject() {
 
2030         if ((index = wellKnownTypes[JAVA_LANG_OBJECT_TYPE]) == 0) {
 
2032                 // The entry doesn't exit yet
 
2033                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangObjectConstantPoolName);
 
2034                 index = wellKnownTypes[JAVA_LANG_OBJECT_TYPE] = currentIndex++;
 
2035                 if (index > 0xFFFF){
 
2036                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2039                 // Then add the 8 bytes representing the long
 
2045  * This method returns the index into the constantPool corresponding to the type descriptor.
 
2047  * @param TypeBinding aTypeBinding
 
2048  * @return <CODE>int</CODE>
 
2050 public int literalIndexForJavaLangReflectConstructor() {
 
2052         if ((index = wellKnownTypes[JAVA_LANG_REFLECT_CONSTRUCTOR_TYPE]) == 0) {
 
2054                 // The entry doesn't exit yet
 
2055                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangReflectConstructor);
 
2056                 index = wellKnownTypes[JAVA_LANG_REFLECT_CONSTRUCTOR_TYPE] = currentIndex++;
 
2057                 if (index > 0xFFFF){
 
2058                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2061                 // Then add the 8 bytes representing the long
 
2066 public int literalIndexForJavaLangReflectConstructorNewInstance() {
 
2068         int nameAndTypeIndex;
 
2070         // Looking into the method ref table
 
2071         if ((index = wellKnownMethods[NEWINSTANCE_CONSTRUCTOR_METHOD]) == 0) {
 
2072                 classIndex = literalIndexForJavaLangReflectConstructor();
 
2073                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[NEWINSTANCE_METHOD_NAME_AND_TYPE]) == 0) {
 
2074                         int nameIndex = literalIndex(QualifiedNamesConstants.NewInstance);
 
2075                         int typeIndex = literalIndex(QualifiedNamesConstants.NewInstanceSignature);
 
2076                         nameAndTypeIndex = wellKnownMethodNameAndTypes[NEWINSTANCE_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2077                         writeU1(NameAndTypeTag);
 
2081                 index = wellKnownMethods[NEWINSTANCE_CONSTRUCTOR_METHOD] = currentIndex++;
 
2082                 if (index > 0xFFFF){
 
2083                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2085                 // Write the method ref constant into the constant pool
 
2086                 // First add the tag
 
2087                 writeU1(MethodRefTag);
 
2088                 // Then write the class index
 
2089                 writeU2(classIndex);
 
2090                 // The write the nameAndType index
 
2091                 writeU2(nameAndTypeIndex);
 
2096  * This method returns the index into the constantPool corresponding to the type descriptor.
 
2098  * @param TypeBinding aTypeBinding
 
2099  * @return <CODE>int</CODE>
 
2101 public int literalIndexForJavaLangShort() {
 
2103         if ((index = wellKnownTypes[JAVA_LANG_SHORT_TYPE]) == 0) {
 
2105                 // The entry doesn't exit yet
 
2106                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangShortConstantPoolName);
 
2107                 index = wellKnownTypes[JAVA_LANG_SHORT_TYPE] = currentIndex++;
 
2108                 if (index > 0xFFFF){
 
2109                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2112                 // Then add the 8 bytes representing the long
 
2118  * This method returns the index into the constantPool 
 
2119  * corresponding to the field binding aFieldBinding.
 
2121  * @return <CODE>int</CODE>
 
2123 public int literalIndexForJavaLangShortTYPE() {
 
2125         if ((index = wellKnownFields[TYPE_SHORT_FIELD]) == 0) {
 
2126                 int nameAndTypeIndex;
 
2128                 // The entry doesn't exit yet
 
2129                 classIndex = literalIndexForJavaLangShort();
 
2130                 if ((nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE]) == 0) {
 
2131                         int nameIndex = literalIndex(QualifiedNamesConstants.TYPE);
 
2132                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaLangClassSignature);
 
2133                         nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE] = currentIndex++;
 
2134                         writeU1(NameAndTypeTag);
 
2138                 index = wellKnownFields[TYPE_SHORT_FIELD] = currentIndex++;
 
2139                 if (index > 0xFFFF){
 
2140                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2142                 writeU1(FieldRefTag);
 
2143                 writeU2(classIndex);
 
2144                 writeU2(nameAndTypeIndex);
 
2149  * This method returns the index into the constantPool corresponding to the type descriptor.
 
2151  * @param TypeBinding aTypeBinding
 
2152  * @return <CODE>int</CODE>
 
2154 public int literalIndexForJavaLangString() {
 
2156         if ((index = wellKnownTypes[JAVA_LANG_STRING_TYPE]) == 0) {
 
2158                 // The entry doesn't exit yet
 
2159                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangStringConstantPoolName);
 
2160                 index = wellKnownTypes[JAVA_LANG_STRING_TYPE] = currentIndex++;
 
2161                 if (index > 0xFFFF){
 
2162                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2165                 // Then add the 8 bytes representing the long
 
2171  * This method returns the index into the constantPool corresponding to the type descriptor.
 
2173  * @param TypeBinding aTypeBinding
 
2174  * @return <CODE>int</CODE>
 
2176 public int literalIndexForJavaLangStringBuffer() {
 
2178         if ((index = wellKnownTypes[JAVA_LANG_STRINGBUFFER_TYPE]) == 0) {
 
2180                 // The entry doesn't exit yet
 
2181                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangStringBufferConstantPoolName);
 
2182                 index = wellKnownTypes[JAVA_LANG_STRINGBUFFER_TYPE] = currentIndex++;
 
2183                 if (index > 0xFFFF){
 
2184                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2187                 // Then add the 8 bytes representing the long
 
2193  * This method returns the index into the constantPool corresponding to the 
 
2194  * method descriptor. It can be either an interface method reference constant
 
2195  * or a method reference constant.
 
2197  * @return <CODE>int</CODE>
 
2199 public int literalIndexForJavaLangStringBufferAppend(int typeID) {
 
2201         int nameAndTypeIndex = 0;
 
2207                         if ((index = wellKnownMethods[APPEND_INT_METHOD]) == 0) {
 
2208                                 classIndex = literalIndexForJavaLangStringBuffer();
 
2209                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_INT_METHOD_NAME_AND_TYPE]) == 0) {
 
2210                                         int nameIndex = literalIndex(QualifiedNamesConstants.Append);
 
2211                                         int typeIndex = literalIndex(QualifiedNamesConstants.AppendIntSignature);
 
2212                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_INT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2213                                         writeU1(NameAndTypeTag);
 
2217                                 index = wellKnownMethods[APPEND_INT_METHOD] = currentIndex++;
 
2218                                 if (index > 0xFFFF){
 
2219                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2221                                 // Write the method ref constant into the constant pool
 
2222                                 // First add the tag
 
2223                                 writeU1(MethodRefTag);
 
2224                                 // Then write the class index
 
2225                                 writeU2(classIndex);
 
2226                                 // The write the nameAndType index
 
2227                                 writeU2(nameAndTypeIndex);
 
2231                         if ((index = wellKnownMethods[APPEND_LONG_METHOD]) == 0) {
 
2232                                 classIndex = literalIndexForJavaLangStringBuffer();
 
2233                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_LONG_METHOD_NAME_AND_TYPE]) == 0) {
 
2234                                         int nameIndex = literalIndex(QualifiedNamesConstants.Append);
 
2235                                         int typeIndex = literalIndex(QualifiedNamesConstants.AppendLongSignature);
 
2236                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_LONG_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2237                                         writeU1(NameAndTypeTag);
 
2241                                 index = wellKnownMethods[APPEND_LONG_METHOD] = currentIndex++;
 
2242                                 if (index > 0xFFFF){
 
2243                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2245                                 // Write the method ref constant into the constant pool
 
2246                                 // First add the tag
 
2247                                 writeU1(MethodRefTag);
 
2248                                 // Then write the class index
 
2249                                 writeU2(classIndex);
 
2250                                 // The write the nameAndType index
 
2251                                 writeU2(nameAndTypeIndex);
 
2255                         if ((index = wellKnownMethods[APPEND_FLOAT_METHOD]) == 0) {
 
2256                                 classIndex = literalIndexForJavaLangStringBuffer();
 
2257                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_FLOAT_METHOD_NAME_AND_TYPE]) == 0) {
 
2258                                         int nameIndex = literalIndex(QualifiedNamesConstants.Append);
 
2259                                         int typeIndex = literalIndex(QualifiedNamesConstants.AppendFloatSignature);
 
2260                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_FLOAT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2261                                         writeU1(NameAndTypeTag);
 
2265                                 index = wellKnownMethods[APPEND_FLOAT_METHOD] = currentIndex++;
 
2266                                 if (index > 0xFFFF){
 
2267                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2269                                 // Write the method ref constant into the constant pool
 
2270                                 // First add the tag
 
2271                                 writeU1(MethodRefTag);
 
2272                                 // Then write the class index
 
2273                                 writeU2(classIndex);
 
2274                                 // The write the nameAndType index
 
2275                                 writeU2(nameAndTypeIndex);
 
2279                         if ((index = wellKnownMethods[APPEND_DOUBLE_METHOD]) == 0) {
 
2280                                 classIndex = literalIndexForJavaLangStringBuffer();
 
2281                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_DOUBLE_METHOD_NAME_AND_TYPE]) == 0) {
 
2282                                         int nameIndex = literalIndex(QualifiedNamesConstants.Append);
 
2283                                         int typeIndex = literalIndex(QualifiedNamesConstants.AppendDoubleSignature);
 
2284                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_DOUBLE_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2285                                         writeU1(NameAndTypeTag);
 
2289                                 index = wellKnownMethods[APPEND_DOUBLE_METHOD] = currentIndex++;
 
2290                                 if (index > 0xFFFF){
 
2291                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2293                                 // Write the method ref constant into the constant pool
 
2294                                 // First add the tag
 
2295                                 writeU1(MethodRefTag);
 
2296                                 // Then write the class index
 
2297                                 writeU2(classIndex);
 
2298                                 // The write the nameAndType index
 
2299                                 writeU2(nameAndTypeIndex);
 
2303                         if ((index = wellKnownMethods[APPEND_CHAR_METHOD]) == 0) {
 
2304                                 classIndex = literalIndexForJavaLangStringBuffer();
 
2305                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_CHAR_METHOD_NAME_AND_TYPE]) == 0) {
 
2306                                         int nameIndex = literalIndex(QualifiedNamesConstants.Append);
 
2307                                         int typeIndex = literalIndex(QualifiedNamesConstants.AppendCharSignature);
 
2308                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_CHAR_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2309                                         writeU1(NameAndTypeTag);
 
2313                                 index = wellKnownMethods[APPEND_CHAR_METHOD] = currentIndex++;
 
2314                                 if (index > 0xFFFF){
 
2315                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2317                                 // Write the method ref constant into the constant pool
 
2318                                 // First add the tag
 
2319                                 writeU1(MethodRefTag);
 
2320                                 // Then write the class index
 
2321                                 writeU2(classIndex);
 
2322                                 // The write the nameAndType index
 
2323                                 writeU2(nameAndTypeIndex);
 
2327                         if ((index = wellKnownMethods[APPEND_BOOLEAN_METHOD]) == 0) {
 
2328                                 classIndex = literalIndexForJavaLangStringBuffer();
 
2329                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_BOOLEAN_METHOD_NAME_AND_TYPE]) == 0) {
 
2330                                         int nameIndex = literalIndex(QualifiedNamesConstants.Append);
 
2331                                         int typeIndex = literalIndex(QualifiedNamesConstants.AppendBooleanSignature);
 
2332                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_BOOLEAN_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2333                                         writeU1(NameAndTypeTag);
 
2337                                 index = wellKnownMethods[APPEND_BOOLEAN_METHOD] = currentIndex++;
 
2338                                 if (index > 0xFFFF){
 
2339                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2341                                 // Write the method ref constant into the constant pool
 
2342                                 // First add the tag
 
2343                                 writeU1(MethodRefTag);
 
2344                                 // Then write the class index
 
2345                                 writeU2(classIndex);
 
2346                                 // The write the nameAndType index
 
2347                                 writeU2(nameAndTypeIndex);
 
2351                         if ((index = wellKnownMethods[APPEND_OBJECT_METHOD]) == 0) {
 
2352                                 classIndex = literalIndexForJavaLangStringBuffer();
 
2353                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_OBJECT_METHOD_NAME_AND_TYPE]) == 0) {
 
2354                                         int nameIndex = literalIndex(QualifiedNamesConstants.Append);
 
2355                                         int typeIndex = literalIndex(QualifiedNamesConstants.AppendObjectSignature);
 
2356                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_OBJECT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2357                                         writeU1(NameAndTypeTag);
 
2361                                 index = wellKnownMethods[APPEND_OBJECT_METHOD] = currentIndex++;
 
2362                                 if (index > 0xFFFF){
 
2363                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2365                                 // Write the method ref constant into the constant pool
 
2366                                 // First add the tag
 
2367                                 writeU1(MethodRefTag);
 
2368                                 // Then write the class index
 
2369                                 writeU2(classIndex);
 
2370                                 // The write the nameAndType index
 
2371                                 writeU2(nameAndTypeIndex);
 
2376                         if ((index = wellKnownMethods[APPEND_STRING_METHOD]) == 0) {
 
2377                                 classIndex = literalIndexForJavaLangStringBuffer();
 
2378                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_STRING_METHOD_NAME_AND_TYPE]) == 0) {
 
2379                                         int nameIndex = literalIndex(QualifiedNamesConstants.Append);
 
2380                                         int typeIndex = literalIndex(QualifiedNamesConstants.AppendStringSignature);
 
2381                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_STRING_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2382                                         writeU1(NameAndTypeTag);
 
2386                                 index = wellKnownMethods[APPEND_STRING_METHOD] = currentIndex++;
 
2387                                 if (index > 0xFFFF){
 
2388                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2390                                 // Write the method ref constant into the constant pool
 
2391                                 // First add the tag
 
2392                                 writeU1(MethodRefTag);
 
2393                                 // Then write the class index
 
2394                                 writeU2(classIndex);
 
2395                                 // The write the nameAndType index
 
2396                                 writeU2(nameAndTypeIndex);
 
2403  * This method returns the index into the constantPool corresponding to the 
 
2404  * method descriptor. It can be either an interface method reference constant
 
2405  * or a method reference constant.
 
2407  * @return <CODE>int</CODE>
 
2409 public int literalIndexForJavaLangStringBufferConstructor() {
 
2411         int nameAndTypeIndex;
 
2413         // Looking into the method ref table
 
2414         if ((index = wellKnownMethods[STRINGBUFFER_STRING_CONSTR_METHOD]) == 0) {
 
2415                 classIndex = literalIndexForJavaLangStringBuffer();
 
2416                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_STRING_METHOD_NAME_AND_TYPE]) == 0) {
 
2417                                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
2418                                         int typeIndex = literalIndex(QualifiedNamesConstants.StringConstructorSignature);
 
2419                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_STRING_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2420                                         writeU1(NameAndTypeTag);
 
2424                 index = wellKnownMethods[STRINGBUFFER_STRING_CONSTR_METHOD] = currentIndex++;
 
2425                 if (index > 0xFFFF){
 
2426                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2428                 // Write the method ref constant into the constant pool
 
2429                 // First add the tag
 
2430                 writeU1(MethodRefTag);
 
2431                 // Then write the class index
 
2432                 writeU2(classIndex);
 
2433                 // The write the nameAndType index
 
2434                 writeU2(nameAndTypeIndex);
 
2439  * This method returns the index into the constantPool corresponding to the 
 
2440  * method descriptor. It can be either an interface method reference constant
 
2441  * or a method reference constant.
 
2443  * @return <CODE>int</CODE>
 
2445 public int literalIndexForJavaLangStringBufferDefaultConstructor() {
 
2447         int nameAndTypeIndex;
 
2449         // Looking into the method ref table
 
2450         if ((index = wellKnownMethods[STRINGBUFFER_DEFAULT_CONSTR_METHOD]) == 0) {
 
2451                 classIndex = literalIndexForJavaLangStringBuffer();
 
2452                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[DEFAULT_CONSTR_METHOD_NAME_AND_TYPE]) == 0) {
 
2453                         int nameIndex = literalIndex(QualifiedNamesConstants.Init);
 
2454                         int typeIndex = literalIndex(QualifiedNamesConstants.DefaultConstructorSignature);
 
2455                         nameAndTypeIndex = wellKnownMethodNameAndTypes[DEFAULT_CONSTR_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2456                         writeU1(NameAndTypeTag);
 
2460                 index = wellKnownMethods[STRINGBUFFER_DEFAULT_CONSTR_METHOD] = currentIndex++;
 
2461                 if (index > 0xFFFF){
 
2462                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2464                 // Write the method ref constant into the constant pool
 
2465                 // First add the tag
 
2466                 writeU1(MethodRefTag);
 
2467                 // Then write the class index
 
2468                 writeU2(classIndex);
 
2469                 // The write the nameAndType index
 
2470                 writeU2(nameAndTypeIndex);
 
2475  * This method returns the index into the constantPool corresponding to the 
 
2476  * method descriptor. It can be either an interface method reference constant
 
2477  * or a method reference constant.
 
2479  * @return <CODE>int</CODE>
 
2481 public int literalIndexForJavaLangStringBufferToString() {
 
2483         int nameAndTypeIndex;
 
2485         // Looking into the method ref table
 
2486         if ((index = wellKnownMethods[STRINGBUFFER_TOSTRING_METHOD]) == 0) {
 
2487                 classIndex = literalIndexForJavaLangStringBuffer();
 
2488                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[TOSTRING_METHOD_NAME_AND_TYPE]) == 0) {
 
2489                         int nameIndex = literalIndex(QualifiedNamesConstants.ToString);
 
2490                         int typeIndex = literalIndex(QualifiedNamesConstants.ToStringSignature);
 
2491                         nameAndTypeIndex = wellKnownMethodNameAndTypes[TOSTRING_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2492                         writeU1(NameAndTypeTag);
 
2496                 index = wellKnownMethods[STRINGBUFFER_TOSTRING_METHOD] = currentIndex++;
 
2497                 if (index > 0xFFFF){
 
2498                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2500                 // Write the method ref constant into the constant pool
 
2501                 // First add the tag
 
2502                 writeU1(MethodRefTag);
 
2503                 // Then write the class index
 
2504                 writeU2(classIndex);
 
2505                 // The write the nameAndType index
 
2506                 writeU2(nameAndTypeIndex);
 
2511  * This method returns the index into the constantPool corresponding to the 
 
2512  * method descriptor. It can be either an interface method reference constant
 
2513  * or a method reference constant.
 
2515  * @return <CODE>int</CODE>
 
2517 public int literalIndexForJavaLangStringIntern() {
 
2519         int nameAndTypeIndex;
 
2521         // Looking into the method ref table
 
2522         if ((index = wellKnownMethods[STRING_INTERN_METHOD]) == 0) {
 
2523                 classIndex = literalIndexForJavaLangString();
 
2524                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[INTERN_METHOD_NAME_AND_TYPE]) == 0) {
 
2525                         int nameIndex = literalIndex(QualifiedNamesConstants.Intern);
 
2526                         int typeIndex = literalIndex(QualifiedNamesConstants.InternSignature);
 
2527                         nameAndTypeIndex = wellKnownMethodNameAndTypes[INTERN_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2528                         writeU1(NameAndTypeTag);
 
2532                 index = wellKnownMethods[STRING_INTERN_METHOD] = currentIndex++;
 
2533                 if (index > 0xFFFF){
 
2534                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2536                 // Write the method ref constant into the constant pool
 
2537                 // First add the tag
 
2538                 writeU1(MethodRefTag);
 
2539                 // Then write the class index
 
2540                 writeU2(classIndex);
 
2541                 // The write the nameAndType index
 
2542                 writeU2(nameAndTypeIndex);
 
2547  * This method returns the index into the constantPool corresponding to the 
 
2548  * method descriptor. It can be either an interface method reference constant
 
2549  * or a method reference constant.
 
2551  * @return <CODE>int</CODE>
 
2553 public int literalIndexForJavaLangStringValueOf(int typeID) {
 
2555         int nameAndTypeIndex = 0;
 
2556         int classIndex = literalIndexForJavaLangString();
 
2561                         if ((index = wellKnownMethods[VALUEOF_INT_METHOD]) == 0) {
 
2562                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_INT_METHOD_NAME_AND_TYPE]) == 0) {
 
2563                                         int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
 
2564                                         int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfIntSignature);
 
2565                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_INT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2566                                         writeU1(NameAndTypeTag);
 
2570                                 index = wellKnownMethods[VALUEOF_INT_METHOD] = currentIndex++;
 
2571                                 if (index > 0xFFFF){
 
2572                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2574                                 // Write the method ref constant into the constant pool
 
2575                                 // First add the tag
 
2576                                 writeU1(MethodRefTag);
 
2577                                 // Then write the class index
 
2578                                 writeU2(classIndex);
 
2579                                 // The write the nameAndType index
 
2580                                 writeU2(nameAndTypeIndex);
 
2584                         if ((index = wellKnownMethods[VALUEOF_LONG_METHOD]) == 0) {
 
2585                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_LONG_METHOD_NAME_AND_TYPE]) == 0) {
 
2586                                         int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
 
2587                                         int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfLongSignature);
 
2588                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_LONG_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2589                                         writeU1(NameAndTypeTag);
 
2593                                 index = wellKnownMethods[VALUEOF_LONG_METHOD] = currentIndex++;
 
2594                                 if (index > 0xFFFF){
 
2595                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2597                                 // Write the method ref constant into the constant pool
 
2598                                 // First add the tag
 
2599                                 writeU1(MethodRefTag);
 
2600                                 // Then write the class index
 
2601                                 writeU2(classIndex);
 
2602                                 // The write the nameAndType index
 
2603                                 writeU2(nameAndTypeIndex);
 
2607                         if ((index = wellKnownMethods[VALUEOF_FLOAT_METHOD]) == 0) {
 
2608                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_FLOAT_METHOD_NAME_AND_TYPE]) == 0) {
 
2609                                         int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
 
2610                                         int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfFloatSignature);
 
2611                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_FLOAT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2612                                         writeU1(NameAndTypeTag);
 
2616                                 index = wellKnownMethods[VALUEOF_FLOAT_METHOD] = currentIndex++;
 
2617                                 if (index > 0xFFFF){
 
2618                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2620                                 // Write the method ref constant into the constant pool
 
2621                                 // First add the tag
 
2622                                 writeU1(MethodRefTag);
 
2623                                 // Then write the class index
 
2624                                 writeU2(classIndex);
 
2625                                 // The write the nameAndType index
 
2626                                 writeU2(nameAndTypeIndex);
 
2630                         if ((index = wellKnownMethods[VALUEOF_DOUBLE_METHOD]) == 0) {
 
2631                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_DOUBLE_METHOD_NAME_AND_TYPE]) == 0) {
 
2632                                         int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
 
2633                                         int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfDoubleSignature);
 
2634                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_DOUBLE_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2635                                         writeU1(NameAndTypeTag);
 
2639                                 index = wellKnownMethods[VALUEOF_DOUBLE_METHOD] = currentIndex++;
 
2640                                 if (index > 0xFFFF){
 
2641                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2643                                 // Write the method ref constant into the constant pool
 
2644                                 // First add the tag
 
2645                                 writeU1(MethodRefTag);
 
2646                                 // Then write the class index
 
2647                                 writeU2(classIndex);
 
2648                                 // The write the nameAndType index
 
2649                                 writeU2(nameAndTypeIndex);
 
2653                         if ((index = wellKnownMethods[VALUEOF_CHAR_METHOD]) == 0) {
 
2654                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_CHAR_METHOD_NAME_AND_TYPE]) == 0) {
 
2655                                         int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
 
2656                                         int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfCharSignature);
 
2657                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_CHAR_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2658                                         writeU1(NameAndTypeTag);
 
2662                                 index = wellKnownMethods[VALUEOF_CHAR_METHOD] = currentIndex++;
 
2663                                 if (index > 0xFFFF){
 
2664                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2666                                 // Write the method ref constant into the constant pool
 
2667                                 // First add the tag
 
2668                                 writeU1(MethodRefTag);
 
2669                                 // Then write the class index
 
2670                                 writeU2(classIndex);
 
2671                                 // The write the nameAndType index
 
2672                                 writeU2(nameAndTypeIndex);
 
2676                         if ((index = wellKnownMethods[VALUEOF_BOOLEAN_METHOD]) == 0) {
 
2677                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_BOOLEAN_METHOD_NAME_AND_TYPE]) == 0) {
 
2678                                         int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
 
2679                                         int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfBooleanSignature);
 
2680                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_BOOLEAN_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2681                                         writeU1(NameAndTypeTag);
 
2685                                 index = wellKnownMethods[VALUEOF_BOOLEAN_METHOD] = currentIndex++;
 
2686                                 if (index > 0xFFFF){
 
2687                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2689                                 // Write the method ref constant into the constant pool
 
2690                                 // First add the tag
 
2691                                 writeU1(MethodRefTag);
 
2692                                 // Then write the class index
 
2693                                 writeU2(classIndex);
 
2694                                 // The write the nameAndType index
 
2695                                 writeU2(nameAndTypeIndex);
 
2699                         if ((index = wellKnownMethods[VALUEOF_OBJECT_METHOD]) == 0) {
 
2700                                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_OBJECT_METHOD_NAME_AND_TYPE]) == 0) {
 
2701                                         int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
 
2702                                         int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfObjectSignature);
 
2703                                         nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_OBJECT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2704                                         writeU1(NameAndTypeTag);
 
2708                                 index = wellKnownMethods[VALUEOF_OBJECT_METHOD] = currentIndex++;
 
2709                                 if (index > 0xFFFF){
 
2710                                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2712                                 // Write the method ref constant into the constant pool
 
2713                                 // First add the tag
 
2714                                 writeU1(MethodRefTag);
 
2715                                 // Then write the class index
 
2716                                 writeU2(classIndex);
 
2717                                 // The write the nameAndType index
 
2718                                 writeU2(nameAndTypeIndex);
 
2725  * This method returns the index into the constantPool corresponding to the type descriptor.
 
2727  * @param TypeBinding aTypeBinding
 
2728  * @return <CODE>int</CODE>
 
2730 public int literalIndexForJavaLangSystem() {
 
2732         if ((index = wellKnownTypes[JAVA_LANG_SYSTEM_TYPE]) == 0) {
 
2734                 // The entry doesn't exit yet
 
2735                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangSystemConstantPoolName);
 
2736                 index = wellKnownTypes[JAVA_LANG_SYSTEM_TYPE] = currentIndex++;
 
2737                 if (index > 0xFFFF){
 
2738                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2741                 // Then add the 8 bytes representing the long
 
2747  * This method returns the index into the constantPool corresponding to the 
 
2748  * method descriptor. It can be either an interface method reference constant
 
2749  * or a method reference constant.
 
2751  * @return <CODE>int</CODE>
 
2753 public int literalIndexForJavaLangSystemExitInt() {
 
2755         int nameAndTypeIndex;
 
2757         // Looking into the method ref table
 
2758         if ((index = wellKnownMethods[SYSTEM_EXIT_METHOD]) == 0) {
 
2759                 classIndex = literalIndexForJavaLangSystem();
 
2760                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[EXIT_METHOD_NAME_AND_TYPE]) == 0) {
 
2761                         int nameIndex = literalIndex(QualifiedNamesConstants.Exit);
 
2762                         int typeIndex = literalIndex(QualifiedNamesConstants.ExitIntSignature);
 
2763                         nameAndTypeIndex = wellKnownMethodNameAndTypes[EXIT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2764                         writeU1(NameAndTypeTag);
 
2768                 index = wellKnownMethods[SYSTEM_EXIT_METHOD] = currentIndex++;
 
2769                 if (index > 0xFFFF){
 
2770                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2772                 // Write the method ref constant into the constant pool
 
2773                 // First add the tag
 
2774                 writeU1(MethodRefTag);
 
2775                 // Then write the class index
 
2776                 writeU2(classIndex);
 
2777                 // The write the nameAndType index
 
2778                 writeU2(nameAndTypeIndex);
 
2783  * This method returns the index into the constantPool 
 
2784  * corresponding to the field binding aFieldBinding.
 
2786  * @return <CODE>int</CODE>
 
2788 public int literalIndexForJavaLangSystemOut() {
 
2790         if ((index = wellKnownFields[OUT_SYSTEM_FIELD]) == 0) {
 
2791                 int nameAndTypeIndex;
 
2793                 // The entry doesn't exit yet
 
2794                 classIndex = literalIndexForJavaLangSystem();
 
2795                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[OUT_SYSTEM_NAME_AND_TYPE]) == 0) {
 
2796                         int nameIndex = literalIndex(QualifiedNamesConstants.Out);
 
2797                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaIoPrintStreamSignature);
 
2798                         nameAndTypeIndex = wellKnownMethodNameAndTypes[OUT_SYSTEM_NAME_AND_TYPE] = currentIndex++;
 
2799                         writeU1(NameAndTypeTag);
 
2803                 index = wellKnownFields[OUT_SYSTEM_FIELD] = currentIndex++;
 
2804                 if (index > 0xFFFF){
 
2805                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2807                 writeU1(FieldRefTag);
 
2808                 writeU2(classIndex);
 
2809                 writeU2(nameAndTypeIndex);
 
2814  * This method returns the index into the constantPool corresponding to the type descriptor.
 
2816  * @param TypeBinding aTypeBinding
 
2817  * @return <CODE>int</CODE>
 
2819 public int literalIndexForJavaLangThrowable() {
 
2821         if ((index = wellKnownTypes[JAVA_LANG_THROWABLE_TYPE]) == 0) {
 
2823                 // The entry doesn't exit yet
 
2824                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangThrowableConstantPoolName);
 
2825                 index = wellKnownTypes[JAVA_LANG_THROWABLE_TYPE] = currentIndex++;
 
2826                 if (index > 0xFFFF){
 
2827                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2830                 // Then add the 8 bytes representing the long
 
2836  * This method returns the index into the constantPool corresponding to the 
 
2837  * method descriptor. It can be either an interface method reference constant
 
2838  * or a method reference constant.
 
2840  * @return <CODE>int</CODE>
 
2842 public int literalIndexForJavaLangThrowableGetMessage() {
 
2844         int nameAndTypeIndex;
 
2846         // Looking into the method ref table
 
2847         if ((index = wellKnownMethods[THROWABLE_GETMESSAGE_METHOD]) == 0) {
 
2848                 classIndex = literalIndexForJavaLangThrowable();
 
2849                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[GETMESSAGE_METHOD_NAME_AND_TYPE]) == 0) {
 
2850                         int nameIndex = literalIndex(QualifiedNamesConstants.GetMessage);
 
2851                         int typeIndex = literalIndex(QualifiedNamesConstants.GetMessageSignature);
 
2852                         nameAndTypeIndex = wellKnownMethodNameAndTypes[GETMESSAGE_METHOD_NAME_AND_TYPE] = currentIndex++;
 
2853                         writeU1(NameAndTypeTag);
 
2857                 index = wellKnownMethods[THROWABLE_GETMESSAGE_METHOD] = currentIndex++;
 
2858                 if (index > 0xFFFF){
 
2859                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2861                 // Write the method ref constant into the constant pool
 
2862                 // First add the tag
 
2863                 writeU1(MethodRefTag);
 
2864                 // Then write the class index
 
2865                 writeU2(classIndex);
 
2866                 // The write the nameAndType index
 
2867                 writeU2(nameAndTypeIndex);
 
2872  * This method returns the index into the constantPool corresponding to the type descriptor.
 
2874  * @param TypeBinding aTypeBinding
 
2875  * @return <CODE>int</CODE>
 
2877 public int literalIndexForJavaLangVoid() {
 
2879         if ((index = wellKnownTypes[JAVA_LANG_VOID_TYPE]) == 0) {
 
2881                 // The entry doesn't exit yet
 
2882                 nameIndex = literalIndex(QualifiedNamesConstants.JavaLangVoidConstantPoolName);
 
2883                 index = wellKnownTypes[JAVA_LANG_VOID_TYPE] = currentIndex++;
 
2884                 if (index > 0xFFFF){
 
2885                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2888                 // Then add the 8 bytes representing the long
 
2894  * This method returns the index into the constantPool 
 
2895  * corresponding to the field binding aFieldBinding.
 
2897  * @return <CODE>int</CODE>
 
2899 public int literalIndexForJavaLangVoidTYPE() {
 
2901         if ((index = wellKnownFields[TYPE_VOID_FIELD]) == 0) {
 
2902                 int nameAndTypeIndex;
 
2904                 // The entry doesn't exit yet
 
2905                 classIndex = literalIndexForJavaLangVoid();
 
2906                 if ((nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE]) == 0) {
 
2907                         int nameIndex = literalIndex(QualifiedNamesConstants.TYPE);
 
2908                         int typeIndex = literalIndex(QualifiedNamesConstants.JavaLangClassSignature);
 
2909                         nameAndTypeIndex = wellKnownFieldNameAndTypes[TYPE_JAVALANGCLASS_NAME_AND_TYPE] = currentIndex++;
 
2910                         writeU1(NameAndTypeTag);
 
2914                 index = wellKnownFields[TYPE_VOID_FIELD] = currentIndex++;
 
2915                 if (index > 0xFFFF){
 
2916                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2918                 writeU1(FieldRefTag);
 
2919                 writeU2(classIndex);
 
2920                 writeU2(nameAndTypeIndex);
 
2925  * This method returns the index into the constantPool corresponding to the type descriptor.
 
2927  * @param char[] stringName
 
2928  * @return <CODE>int</CODE>
 
2930 public int literalIndexForLdc(char[] stringCharArray) {
 
2932         if ((index = stringCache.get(stringCharArray)) < 0) {
 
2934                 // The entry doesn't exit yet
 
2935                 if ((stringIndex = UTF8Cache.get(stringCharArray)) < 0) {
 
2936                         // The entry doesn't exit yet
 
2937                         // Write the tag first
 
2939                         // Then the size of the stringName array
 
2940                         int savedCurrentOffset = currentOffset;
 
2941                         if (currentOffset + 2 >= poolContent.length) {
 
2942                                 // we need to resize the poolContent array because we won't have
 
2943                                 // enough space to write the length
 
2944                                 int length = poolContent.length;
 
2945                                 System.arraycopy(poolContent, 0, (poolContent = new byte[length + CONSTANTPOOL_GROW_SIZE]), 0, length);
 
2949                         for (int i = 0; i < stringCharArray.length; i++) {
 
2950                                 char current = stringCharArray[i];
 
2951                                 if ((current >= 0x0001) && (current <= 0x007F)) {
 
2952                                         // we only need one byte: ASCII table
 
2956                                         if (current > 0x07FF) {
 
2959                                                 writeU1(0xE0 | ((current >> 12) & 0x0F)); // 0xE0 = 1110 0000
 
2960                                                 writeU1(0x80 | ((current >> 6) & 0x3F)); // 0x80 = 1000 0000
 
2961                                                 writeU1(0x80 | (current & 0x3F)); // 0x80 = 1000 0000
 
2963                                                 // we can be 0 or between 0x0080 and 0x07FF
 
2964                                                 // In that case we only need 2 bytes
 
2966                                                 writeU1(0xC0 | ((current >> 6) & 0x1F)); // 0xC0 = 1100 0000
 
2967                                                 writeU1(0x80 | (current & 0x3F)); // 0x80 = 1000 0000
 
2970                         if (length >= 65535) {
 
2971                                 currentOffset = savedCurrentOffset - 1;
 
2974                         stringIndex = UTF8Cache.put(stringCharArray, currentIndex++);
 
2975                         // Now we know the length that we have to write in the constant pool
 
2976                         // we use savedCurrentOffset to do that
 
2977                         if (length > 65535) {
 
2980                         poolContent[savedCurrentOffset] = (byte) (length >> 8);
 
2981                         poolContent[savedCurrentOffset + 1] = (byte) length;
 
2983                 index = stringCache.put(stringCharArray, currentIndex++);
 
2984                 if (index > 0xFFFF){
 
2985                         this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
2987                 // Write the tag first
 
2989                 // Then the string index
 
2990                 writeU2(stringIndex);
 
2995  * This method returns the index into the constantPool corresponding 
 
2996  * nameAndType constant with nameIndex, typeIndex.
 
2998  * @param int nameIndex
 
2999  * @param int nameIndex
 
3000  * @param org.eclipse.jdt.internal.compiler.lookup.MethodBinding a methodBinding
 
3001  * @return <CODE>int</CODE>
 
3003 public int literalIndexForMethods(int nameIndex, int typeIndex, MethodBinding key) {
 
3005         int indexOfWellKnownMethodNameAndType;
 
3006         if ((indexOfWellKnownMethodNameAndType = indexOfWellKnownMethodNameAndType(key)) == -1) {
 
3007                 // check if the entry exists
 
3008                 if ((index = nameAndTypeCacheForMethods.get(key)) == -1) {
 
3009                         // The entry doesn't exit yet
 
3010                         index = nameAndTypeCacheForMethods.put(key, currentIndex++);
 
3011                         if (index > 0xFFFF){
 
3012                                 this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
3014                         writeU1(NameAndTypeTag);
 
3019                 if ((index = wellKnownMethodNameAndTypes[indexOfWellKnownMethodNameAndType]) == 0) {
 
3020                         index = wellKnownMethodNameAndTypes[indexOfWellKnownMethodNameAndType] = currentIndex++;
 
3021                         if (index > 0xFFFF){
 
3022                                 this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
 
3024                         writeU1(NameAndTypeTag);
 
3032  * This method returns the index into the constantPool corresponding to the 
 
3033  * method descriptor. It can be either an interface method reference constant
 
3034  * or a method reference constant.
 
3036  * @return <CODE>int</CODE>
 
3038 public int literalIndexForJavaLangObjectGetClass() {
 
3040         int nameAndTypeIndex;
 
3042         // Looking into the method ref table
 
3043         if ((index = wellKnownMethods[GETCLASS_OBJECT_METHOD]) == 0) {
 
3044                 classIndex = literalIndexForJavaLangObject();
 
3045                 if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[GETCLASS_OBJECT_METHOD_NAME_AND_TYPE]) == 0) {
 
3046                         int nameIndex = literalIndex(QualifiedNamesConstants.GetClass);
 
3047                         int typeIndex = literalIndex(QualifiedNamesConstants.GetClassSignature);
 
3048                         nameAndTypeIndex = wellKnownMethodNameAndTypes[GETCLASS_OBJECT_METHOD_NAME_AND_TYPE] = currentIndex++;
 
3049                         writeU1(NameAndTypeTag);
 
3053                 index = wellKnownMethods[GETCLASS_OBJECT_METHOD] = currentIndex++;
 
3054                 // Write the method ref constant into the constant pool
 
3055                 // First add the tag
 
3056                 writeU1(MethodRefTag);
 
3057                 // Then write the class index
 
3058                 writeU2(classIndex);
 
3059                 // The write the nameAndType index
 
3060                 writeU2(nameAndTypeIndex);
 
3065  * This method is used to clean the receiver in case of a clinit header is generated, but the 
 
3066  * clinit has no code.
 
3067  * This implementation assumes that the clinit is the first method to be generated.
 
3068  * @see org.eclipse.jdt.internal.compiler.ast.TypeDeclaration#addClinit()
 
3070 public void resetForClinit(int constantPoolIndex, int constantPoolOffset) {
 
3071         currentIndex = constantPoolIndex;
 
3072         currentOffset = constantPoolOffset;
 
3073         if (UTF8Cache.get(AttributeNamesConstants.CodeName) >= constantPoolIndex) {
 
3074                 UTF8Cache.remove(AttributeNamesConstants.CodeName);
 
3076         if (UTF8Cache.get(QualifiedNamesConstants.ClinitSignature) >= constantPoolIndex) {
 
3077                 UTF8Cache.remove(QualifiedNamesConstants.ClinitSignature);
 
3079         if (UTF8Cache.get(QualifiedNamesConstants.Clinit) >= constantPoolIndex) {
 
3080                 UTF8Cache.remove(QualifiedNamesConstants.Clinit);
 
3084  * Write a unsigned byte into the byte array
 
3086  * @param <CODE>int</CODE> The value to write into the byte array
 
3088 protected final void writeU1(int value) {
 
3090                 poolContent[currentOffset++] = (byte) value;
 
3091         } catch (IndexOutOfBoundsException e) {
 
3092                 //currentOffset has been ++ already (see the -1)
 
3093                 int length = poolContent.length;
 
3094                 System.arraycopy(poolContent, 0, (poolContent = new byte[length + CONSTANTPOOL_GROW_SIZE]), 0, length);
 
3095                 poolContent[currentOffset - 1] = (byte) value;
 
3099  * Write a unsigned byte into the byte array
 
3101  * @param <CODE>int</CODE> The value to write into the byte array
 
3103 protected final void writeU2(int value) {
 
3106                 poolContent[currentOffset++] = (byte) (value >> 8);
 
3107         } catch (IndexOutOfBoundsException e) {
 
3108                  //currentOffset has been ++ already (see the -1)
 
3109                 int length = poolContent.length;
 
3110                 System.arraycopy(poolContent, 0, (poolContent = new byte[length + CONSTANTPOOL_GROW_SIZE]), 0, length);
 
3111                 poolContent[currentOffset - 1] = (byte) (value >> 8);
 
3114                 poolContent[currentOffset++] = (byte) value;
 
3115         } catch (IndexOutOfBoundsException e) {
 
3116                  //currentOffset has been ++ already (see the -1)
 
3117                 int length = poolContent.length;
 
3118                 System.arraycopy(poolContent, 0, (poolContent = new byte[length + CONSTANTPOOL_GROW_SIZE]), 0, length);
 
3119                 poolContent[currentOffset - 1] = (byte) value;