<commit_before>/*
 * Copyright © 2015 <NAME> (<EMAIL>)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package guru.nidi.codeassert.model;

import java.io.DataInputStream;
import java.io.IOException;

final class Constant {
    static final int
            UTF8 = 1,
            UNICODE = 2,
            INTEGER = 3,
            FLOAT = 4,
            LONG = 5,
            DOUBLE = 6,
            CLASS = 7,
            STRING = 8,
            FIELD = 9,
            METHOD = 10,
            INTERFACEMETHOD = 11,
            NAMEANDTYPE = 12,
            METHOD_HANDLE = 15,
            METHOD_TYPE = 16,
            INVOKEDYNAMIC = 18;

    final byte tag;
    final int nameIndex;
    final int typeIndex;
    final Object value;

    static Constant fromData(DataInputStream in) throws IOException {
        final byte tag = in.readByte();
        switch (tag) {
            case CLASS:
            case STRING:
            case METHOD_TYPE:
                return new Constant(tag, in.readUnsignedShort());
            case FIELD:
            case METHOD:
            case INTERFACEMETHOD:
            case NAMEANDTYPE:
            case INVOKEDYNAMIC:
                return new Constant(tag, in.readUnsignedShort(), in.readUnsignedShort());<commit_msg>support new constant pool types<commit_after>/*
 * Copyright © 2015 <NAME> (<EMAIL>)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package guru.nidi.codeassert.model;

import java.io.DataInputStream;
import java.io.IOException;

final class Constant {
    static final int
            UTF8 = 1,
            UNICODE = 2,
            INTEGER = 3,
            FLOAT = 4,
            LONG = 5,
            DOUBLE = 6,
            CLASS = 7,
            STRING = 8,
            FIELD = 9,
            METHOD = 10,
            INTERFACE_METHOD = 11,
            NAME_AND_TYPE = 12,
            METHOD_HANDLE = 15,
            METHOD_TYPE = 16,
            DYNAMIC = 17,
            INVOKE_DYNAMIC = 18,
            MODULE = 19,
            PACKGE = 20;

    final byte tag;
    final int nameIndex;
    final int typeIndex;
    final Object value;

    static Constant fromData(DataInputStream in) throws IOException {
        final byte tag = in.readByte();
        switch (tag) {
            case CLASS:
            case STRING:
            case METHOD_TYPE:
            case MODULE:
            case PACKGE:
                return new Constant(tag, in.readUnsignedShort());
            case FIELD:
            case METHOD:
            case INTERFACE_METHOD:
            case NAME_AND_TYPE:
            case DYNAMIC:
            case INVOKE_DYNAMIC:
                return new Constant(tag, in.readUnsignedShort(), in.readUnsignedShort());
{'fraction_non_alphanumeric': 0.0738453276047261, 'fraction_numerical': 0.017722878625134265, 'mean_word_length': 1.8742283950617284, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '981629', 'n_tokens_mistral': 1080, 'n_tokens_neox': 964, 'n_words': 365}