<commit_before>/*
 * fb-contrib - Auxiliary detectors for Java programs
 * Copyright (C) 2005-2014 <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package com.mebigfatguy.fbcontrib.detect;

import java.util.HashSet;
import java.util.Set;

import org.apache.bcel.classfile.Code;

import com.mebigfatguy.fbcontrib.utils.BugType;

import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugReporter;
import edu.umd.cs.findbugs.BytecodeScanningDetector;
import edu.umd.cs.findbugs.OpcodeStack;
import edu.umd.cs.findbugs.ba.ClassContext;

/**
 *
 * looks for calls to Arrays.asList where the parameter is a primitive array.
 * This does not produce a list that holds the primitive boxed value, but a list of
 * one item, the array itself.
 *
 */
public class ConfusingArrayAsList extends BytecodeScanningDetector {

    private static Set<String> PRIMITIVE_ARRAYS = new HashSet<String>(8);
    static {
        PRIMITIVE_ARRAYS.add("[B");
        PRIMITIVE_ARRAYS.add("[C");
        PRIMITIVE_ARRAYS.add("[S");
        PRIMITIVE_ARRAYS.add("[I");
        PRIMITIVE_ARRAYS.add("[J");
        PRIMITIVE_ARRAYS.add("[F");
        PRIMITIVE_ARRAYS.add("[D");
        PRIMITIVE_ARRAYS.add("[Z");
        // oddly findbugs opcode stack reports single dim arrays as the following
        PRIMITIVE_ARRAYS.add("[[B");
        PRIMITIVE_ARRAYS.add("[[C");
        PRIMITIVE_ARRAYS.add("[[S");
        PRIMITIVE_ARRAYS.add("[[I");
        PRIMITIVE_ARRAYS.add("[[J");
        PRIMITIVE_ARRAYS.add("[[F");
        PRIMITIVE_ARRAYS.add("[[D");
        PRIMITIVE_ARRAYS.add("[[Z");

    }
    private BugReporter bugReporter;
    private OpcodeStack stack;

    /**
     * constructs a CAAL detector given the reporter to report bugs on
     * @param bugReporter the sync of bug reports
     */
    public ConfusingArrayAsList(BugReporter bugReporter) {
        this.bugReporter = bugReporter;
    }
<commit_msg>revert the single primitive array versions<commit_after>/*
 * fb-contrib - Auxiliary detectors for Java programs
 * Copyright (C) 2005-2014 <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package com.mebigfatguy.fbcontrib.detect;

import java.util.HashSet;
import java.util.Set;

import org.apache.bcel.classfile.Code;

import com.mebigfatguy.fbcontrib.utils.BugType;

import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugReporter;
import edu.umd.cs.findbugs.BytecodeScanningDetector;
import edu.umd.cs.findbugs.OpcodeStack;
import edu.umd.cs.findbugs.ba.ClassContext;

/**
 *
 * looks for calls to Arrays.asList where the parameter is a primitive array.
 * This does not produce a list that holds the primitive boxed value, but a list of
 * one item, the array itself.
 *
 */
public class ConfusingArrayAsList extends BytecodeScanningDetector {

    private static Set<String> PRIMITIVE_ARRAYS = new HashSet<String>(8);
    static {
        PRIMITIVE_ARRAYS.add("[[B");
        PRIMITIVE_ARRAYS.add("[[C");
        PRIMITIVE_ARRAYS.add("[[S");
        PRIMITIVE_ARRAYS.add("[[I");
        PRIMITIVE_ARRAYS.add("[[J");
        PRIMITIVE_ARRAYS.add("[[F");
        PRIMITIVE_ARRAYS.add("[[D");
        PRIMITIVE_ARRAYS.add("[[Z");
    }
    private BugReporter bugReporter;
    private OpcodeStack stack;

    /**
     * constructs a CAAL detector given the reporter to report bugs on
     * @param bugReporter the sync of bug reports
     */
    public ConfusingArrayAsList(BugReporter bugReporter) {
        this.bugReporter = bugReporter;
    }

{'fraction_non_alphanumeric': 0.09560935576528519, 'fraction_numerical': 0.010258514567090685, 'mean_word_length': 3.5518207282913163, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6815207', 'n_tokens_mistral': 1524, 'n_tokens_neox': 1510, 'n_words': 482}