Adds a CONSTANT_Utf8_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item. @param value a string. @return a new or already existing Symbol with the given value.
(final String value)
| 774 | * @return a new or already existing Symbol with the given value. |
| 775 | */ |
| 776 | int addConstantUtf8(final String value) { |
| 777 | int hashCode = hash(Symbol.CONSTANT_UTF8_TAG, value); |
| 778 | Entry entry = get(hashCode); |
| 779 | while (entry != null) { |
| 780 | if (entry.tag == Symbol.CONSTANT_UTF8_TAG |
| 781 | && entry.hashCode == hashCode |
| 782 | && entry.value.equals(value)) { |
| 783 | return entry.index; |
| 784 | } |
| 785 | entry = entry.next; |
| 786 | } |
| 787 | constantPool.putByte(Symbol.CONSTANT_UTF8_TAG).putUTF8(value); |
| 788 | return put(new Entry(constantPoolCount++, Symbol.CONSTANT_UTF8_TAG, value, hashCode)).index; |
| 789 | } |
| 790 | |
| 791 | /** |
| 792 | * Adds a new CONSTANT_String_info to the constant pool of this symbol table. |
no test coverage detected