<commit_before>/**
 * (C) Copyright 2008 Chiral Behaviors, LLC. All Rights Reserved
 *
 * 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 com.chiralbehaviors.janus;

import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES;
import static org.objectweb.asm.Opcodes.ACC_ABSTRACT;
import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static org.objectweb.asm.Opcodes.V1_5;

import java.io.IOException;
import java.io.InputStream;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.GeneratorAdapter;
import org.objectweb.asm.commons.Method;

/**
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */

public class CompositeClassGenerator {
    class Visitor extends ClassVisitor {
        class MVisitor extends MethodVisitor {
            int      access;
            String[] exceptions;
            String   name, desc, signature;

            public MVisitor(int access, String name, String desc,
                            String signature, String[] exceptions,
                            MethodVisitor mv) {
                super(Opcodes.ASM5, mv);
                this.access = access;
                this.name = name;
                this.desc = desc;
                this.signature = signature;
                this.exceptions = exceptions;
            }

            @Override
            public void visitEnd() {
                super.visitEnd();
                CompositeClassGenerator.this.visitMethod(mixIn, fieldName,
                                                         access, name, desc,
                                                         signature, exceptions);
            }
        }

        protected String fieldName;

        protected Type   mixIn;

        public Visitor(Type mixIn, String fieldName) {
            super(Opcodes.ASM5);
            this.mixIn = mixIn;
            this.fieldName = fieldName;
        }

        @Override
        public MethodVisitor visitMethod(int access, String name, String desc,
                                         String signature, String[] exceptions) {
            MethodVisitor mv = super.visitMethod(access, name, desc, signature,
                                                 exceptions);
            return new MVisitor(access, name, desc, signature, exceptions, mv);
        }
    }

    public static final String    GENERATED_COMPOSITE_SUFFIX = "$composite";

    protected static final String MIX_IN_VAR_PREFIX          = "mixIn_";<commit_msg>Don't process static methods as ye 1.8 allows those on interfaces ;)<commit_after>/**
 * (C) Copyright 2008 Chiral Behaviors, LLC. All Rights Reserved
 *
 * 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 com.chiralbehaviors.janus;

import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES;
import static org.objectweb.asm.Opcodes.ACC_ABSTRACT;
import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static org.objectweb.asm.Opcodes.V1_5;

import java.io.IOException;
import java.io.InputStream;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.GeneratorAdapter;
import org.objectweb.asm.commons.Method;

/**
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */

public class CompositeClassGenerator {
    class Visitor extends ClassVisitor {
        class MVisitor extends MethodVisitor {
            int      access;
            String[] exceptions;
            String   name, desc, signature;

            public MVisitor(int access, String name, String desc,
                            String signature, String[] exceptions,
                            MethodVisitor mv) {
                super(Opcodes.ASM5, mv);
                this.access = access;
                this.name = name;
                this.desc = desc;
                this.signature = signature;
                this.exceptions = exceptions;
            }

            @Override
            public void visitEnd() {
                super.visitEnd();
                CompositeClassGenerator.this.visitMethod(mixIn, fieldName,
                                                         access, name, desc,
                                                         signature, exceptions);
            }
        }

        protected String fieldName;

        protected Type   mixIn;

        public Visitor(Type mixIn, String fieldName) {
            super(Opcodes.ASM5);
            this.mixIn = mixIn;
            this.fieldName = fieldName;
        }

        @Override
        public MethodVisitor visitMethod(int access, String name, String desc,
                                         String signature, String[] exceptions) {
            if (access == Opcodes.ACC_STATIC) {
                return super.visitMethod(access, name, desc, signature,
                                         exceptions);
            }
            MethodVisitor mv = super.visitMethod(access, name, desc, signature,
                                                 exceptions);
            return new MVisitor(access, name, desc, signature, exceptions, mv);
        }
    }

    public static final String    GENERATED_COMPOSITE_SUFFIX = "$composite";

    protected static final String MIX_IN_VAR_PREFIX          = "mixIn_";
{'fraction_non_alphanumeric': 0.0809407011975184, 'fraction_numerical': 0.0037512624440917616, 'mean_word_length': 2.0781527531083483, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1793351', 'n_tokens_mistral': 1786, 'n_tokens_neox': 1735, 'n_words': 519}