<commit_before>package com.laytonsmith.PureUtilities.ClassLoading.ClassMirror;

import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

import com.google.common.base.Preconditions;
import com.laytonsmith.PureUtilities.Common.StringUtils;

import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;

import static org.objectweb.asm.Opcodes.*;

public class ClassMirrorVisitor extends ClassVisitor {

    private final ClassMirror.ClassInfo classInfo;

    ClassMirrorVisitor(ClassMirror.ClassInfo info) {
        super(Opcodes.ASM5);
        this.classInfo = info;
    }

    public ClassMirrorVisitor() {
        this(new ClassMirror.ClassInfo());
    }

    public ClassMirror<?> getMirror(URL source) {
        Preconditions.checkState(done, "Not done visiting %s", classInfo.name == null ? "none" : classInfo.name);
        return new ClassMirror<Object>(this.classInfo, source);
    }

    private boolean done;

    @Override
    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
        Preconditions.checkState(!done, "Can't visit %s, because we already visited %s", name, classInfo.name); // Ensure we never visit more than one class
        if ((access & ACC_ENUM) == ACC_ENUM) classInfo.isEnum = true;
        if ((access & ACC_INTERFACE) == ACC_INTERFACE) classInfo.isInterface = true;
        classInfo.modifiers = new ModifierMirror(ModifierMirror.Type.CLASS, access);
        classInfo.name = name;
        classInfo.classReferenceMirror = new ClassReferenceMirror(Type.getObjectType(name).getDescriptor());
        classInfo.superClass = superName;
        classInfo.interfaces = interfaces;
        super.visit(version, access, name, signature, superName, interfaces);<commit_msg>Remove random dependency on Guava<commit_after>package com.laytonsmith.PureUtilities.ClassLoading.ClassMirror;

import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

import com.laytonsmith.PureUtilities.Common.StringUtils;

import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;

import static org.objectweb.asm.Opcodes.*;

public class ClassMirrorVisitor extends ClassVisitor {

    private final ClassMirror.ClassInfo classInfo;

    ClassMirrorVisitor(ClassMirror.ClassInfo info) {
        super(Opcodes.ASM5);
        this.classInfo = info;
    }

    public ClassMirrorVisitor() {
        this(new ClassMirror.ClassInfo());
    }

    public ClassMirror<?> getMirror(URL source) {
        if(!done) {
            throw new IllegalStateException(String.format(
                    "Not done visiting %s", classInfo.name == null ? "none" : classInfo.name
            ));
        }
        return new ClassMirror<Object>(this.classInfo, source);
    }

    private boolean done;

    @Override
    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
        if(done) {
            // Ensure we never visit more than one class
            throw new IllegalStateException(String.format(
                    "Can't visit %s, because we already visited %s", name, classInfo.name
            ));
        }
        if ((access & ACC_ENUM) == ACC_ENUM) classInfo.isEnum = true;
        if ((access & ACC_INTERFACE) == ACC_INTERFACE) classInfo.isInterface = true;
        classInfo.modifiers = new ModifierMirror(ModifierMirror.Type.CLASS, access);
        classInfo.name = name;
        classInfo.classReferenceMirror = new ClassReferenceMirror(Type.getObjectType(name).getDescriptor());
        classInfo.superClass = superName;
        classInfo.interfaces = interfaces;
        super.visit(version, access, name, signature, superName, interfaces);
{'fraction_non_alphanumeric': 0.1000243368216111, 'fraction_numerical': 0.0004867364322219518, 'mean_word_length': 3.57174638487208, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1469119', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1134, 'n_words': 271}